vnc_unixsrc/0040775000076400007640000000000010616336517012503 5ustar constconstvnc_unixsrc/include/0040775000076400007640000000000010616336462014125 5ustar constconstvnc_unixsrc/include/rfbproto.h0100664000076400007640000012515710533024757016142 0ustar constconst/* * Copyright (C) 2000-2006 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* * rfbproto.h - header file for the RFB protocol, versions 3.3, 3.7 and 3.7t, * 3.8 and 3.8t ("t" suffix denotes TightVNC protocol extensions enabled) * * Uses types CARD for an n-bit unsigned integer, INT for an n-bit signed * integer (for n = 8, 16 and 32). * * All multiple byte integers are in big endian (network) order (most * significant byte first). Unless noted otherwise there is no special * alignment of protocol structures. * * * Once the initial handshaking is done, all messages start with a type byte, * (usually) followed by message-specific data. The order of definitions in * this file is as follows: * * (1) Structures used in several types of message. * (2) Structures used in the initial handshaking. * (3) Message types. * (4) Encoding types. * (5) For each message type, the form of the data following the type byte. * Sometimes this is defined by a single structure but the more complex * messages have to be explained by comments. */ /***************************************************************************** * * Structures used in several messages * *****************************************************************************/ /*----------------------------------------------------------------------------- * Structure used to specify a rectangle. This structure is a multiple of 4 * bytes so that it can be interspersed with 32-bit pixel data without * affecting alignment. */ typedef struct _rfbRectangle { CARD16 x; CARD16 y; CARD16 w; CARD16 h; } rfbRectangle; #define sz_rfbRectangle 8 /*----------------------------------------------------------------------------- * Structure used to specify pixel format. */ typedef struct _rfbPixelFormat { CARD8 bitsPerPixel; /* 8,16,32 only */ CARD8 depth; /* 8 to 32 */ CARD8 bigEndian; /* True if multi-byte pixels are interpreted as big endian, or if single-bit-per-pixel has most significant bit of the byte corresponding to first (leftmost) pixel. Of course this is meaningless for 8 bits/pix */ CARD8 trueColour; /* If false then we need a "colour map" to convert pixels to RGB. If true, xxxMax and xxxShift specify bits used for red, green and blue */ /* the following fields are only meaningful if trueColour is true */ CARD16 redMax; /* maximum red value (= 2^n - 1 where n is the number of bits used for red). Note this value is always in big endian order. */ CARD16 greenMax; /* similar for green */ CARD16 blueMax; /* and blue */ CARD8 redShift; /* number of shifts needed to get the red value in a pixel to the least significant bit. To find the red value from a given pixel, do the following: 1) Swap pixel value according to bigEndian (e.g. if bigEndian is false and host byte order is big endian, then swap). 2) Shift right by redShift. 3) AND with redMax (in host byte order). 4) You now have the red value between 0 and redMax. */ CARD8 greenShift; /* similar for green */ CARD8 blueShift; /* and blue */ CARD8 pad1; CARD16 pad2; } rfbPixelFormat; #define sz_rfbPixelFormat 16 /*----------------------------------------------------------------------------- * Structure used to describe protocol options such as tunneling methods, * authentication schemes and message types (protocol versions 3.7t, 3.8t). */ typedef struct _rfbCapabilityInfo { CARD32 code; /* numeric identifier */ CARD8 vendorSignature[4]; /* vendor identification */ CARD8 nameSignature[8]; /* abbreviated option name */ } rfbCapabilityInfo; #define sz_rfbCapabilityInfoVendor 4 #define sz_rfbCapabilityInfoName 8 #define sz_rfbCapabilityInfo 16 /* * Vendors known by TightVNC: standard VNC/RealVNC, TridiaVNC, and TightVNC. */ #define rfbStandardVendor "STDV" #define rfbTridiaVncVendor "TRDV" #define rfbTightVncVendor "TGHT" /***************************************************************************** * * Initial handshaking messages * *****************************************************************************/ /*----------------------------------------------------------------------------- * Protocol Version * * The server always sends 12 bytes to start which identifies the latest RFB * protocol version number which it supports. These bytes are interpreted * as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where * xxx and yyy are the major and minor version numbers (e.g. for version 3.8 * this is "RFB 003.008\n"). * * The client then replies with a similar 12-byte message giving the version * number of the protocol which should actually be used (which may be different * to that quoted by the server). * * It is intended that both clients and servers may provide some level of * backwards compatibility by this mechanism. Servers in particular should * attempt to provide backwards compatibility, and even forwards compatibility * to some extent. For example if a client demands version 3.1 of the * protocol, a 3.0 server can probably assume that by ignoring requests for * encoding types it doesn't understand, everything will still work OK. This * will probably not be the case for changes in the major version number. * * The format string below can be used in sprintf or sscanf to generate or * decode the version string respectively. */ #define rfbProtocolVersionFormat "RFB %03d.%03d\n" typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */ #define sz_rfbProtocolVersionMsg 12 /* * Negotiation of the security type (protocol versions 3.7, 3.8) * * Once the protocol version has been decided, the server either sends a list * of supported security types, or informs the client about an error (when the * number of security types is 0). Security type rfbSecTypeTight is used to * enable TightVNC-specific protocol extensions. The value rfbSecTypeVncAuth * stands for classic VNC authentication. * * The client selects a particular security type from the list provided by the * server. */ #define rfbSecTypeInvalid 0 #define rfbSecTypeNone 1 #define rfbSecTypeVncAuth 2 #define rfbSecTypeTight 16 /*----------------------------------------------------------------------------- * Negotiation of Tunneling Capabilities (protocol versions 3.7t, 3.8t) * * If the chosen security type is rfbSecTypeTight, the server sends a list of * supported tunneling methods ("tunneling" refers to any additional layer of * data transformation, such as encryption or external compression.) * * nTunnelTypes specifies the number of following rfbCapabilityInfo structures * that list all supported tunneling methods in the order of preference. * * NOTE: If nTunnelTypes is 0, that tells the client that no tunneling can be * used, and the client should not send a response requesting a tunneling * method. */ typedef struct _rfbTunnelingCapsMsg { CARD32 nTunnelTypes; /* followed by nTunnelTypes * rfbCapabilityInfo structures */ } rfbTunnelingCapsMsg; #define sz_rfbTunnelingCapsMsg 4 /*----------------------------------------------------------------------------- * Tunneling Method Request (protocol versions 3.7t, 3.8t) * * If the list of tunneling capabilities sent by the server was not empty, the * client should reply with a 32-bit code specifying a particular tunneling * method. The following code should be used for no tunneling. */ #define rfbNoTunneling 0 #define sig_rfbNoTunneling "NOTUNNEL" /*----------------------------------------------------------------------------- * Negotiation of Authentication Capabilities (protocol versions 3.7t, 3.8t) * * After setting up tunneling, the server sends a list of supported * authentication schemes. * * nAuthTypes specifies the number of following rfbCapabilityInfo structures * that list all supported authentication schemes in the order of preference. * * NOTE: If nAuthTypes is 0, that tells the client that no authentication is * necessary, and the client should not send a response requesting an * authentication scheme. */ typedef struct _rfbAuthenticationCapsMsg { CARD32 nAuthTypes; /* followed by nAuthTypes * rfbCapabilityInfo structures */ } rfbAuthenticationCapsMsg; #define sz_rfbAuthenticationCapsMsg 4 /*----------------------------------------------------------------------------- * Authentication Scheme Request (protocol versions 3.7t, 3.8t) * * If the list of authentication capabilities sent by the server was not empty, * the client should reply with a 32-bit code specifying a particular * authentication scheme. The following codes are supported. */ /* Standard authentication methods. */ #define rfbAuthNone 1 #define rfbAuthVNC 2 #define sig_rfbAuthNone "NOAUTH__" #define sig_rfbAuthVNC "VNCAUTH_" /* These two are not used in the mainstream version. */ #define rfbAuthUnixLogin 129 #define rfbAuthExternal 130 #define sig_rfbAuthUnixLogin "ULGNAUTH" #define sig_rfbAuthExternal "XTRNAUTH" /*----------------------------------------------------------------------------- * Authentication result codes (all protocol versions, but rfbAuthTooMany is * not used in protocol versions above 3.3) * * In the protocol version 3.8 and above, rfbAuthFailed is followed by a text * string describing the reason of failure. The text string is preceded with a * 32-bit counter of bytes in the string. */ #define rfbAuthOK 0 #define rfbAuthFailed 1 #define rfbAuthTooMany 2 /*----------------------------------------------------------------------------- * Client Initialisation Message * * Once the client and server are sure that they're happy to talk to one * another, the client sends an initialisation message. At present this * message only consists of a boolean indicating whether the server should try * to share the desktop by leaving other clients connected, or give exclusive * access to this client by disconnecting all other clients. */ typedef struct _rfbClientInitMsg { CARD8 shared; } rfbClientInitMsg; #define sz_rfbClientInitMsg 1 /*----------------------------------------------------------------------------- * Server Initialisation Message * * After the client initialisation message, the server sends one of its own. * This tells the client the width and height of the server's framebuffer, * its pixel format and the name associated with the desktop. */ typedef struct _rfbServerInitMsg { CARD16 framebufferWidth; CARD16 framebufferHeight; rfbPixelFormat format; /* the server's preferred pixel format */ CARD32 nameLength; /* followed by char name[nameLength] */ } rfbServerInitMsg; #define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat) /*----------------------------------------------------------------------------- * Server Interaction Capabilities Message (protocol versions 3.7t, 3.8t) * * If TightVNC protocol extensions are enabled, the server informs the client * what message types it supports in addition to ones defined in the standard * RFB protocol. * Also, the server sends the list of all supported encodings (note that it's * not necessary to advertise the "raw" encoding sinse it MUST be supported in * RFB 3.x protocols). * * This data immediately follows the server initialisation message. */ typedef struct _rfbInteractionCapsMsg { CARD16 nServerMessageTypes; CARD16 nClientMessageTypes; CARD16 nEncodingTypes; CARD16 pad; /* reserved, must be 0 */ /* followed by nServerMessageTypes * rfbCapabilityInfo structures */ /* followed by nClientMessageTypes * rfbCapabilityInfo structures */ } rfbInteractionCapsMsg; #define sz_rfbInteractionCapsMsg 8 /* * Following the server initialisation message it's up to the client to send * whichever protocol messages it wants. Typically it will send a * SetPixelFormat message and a SetEncodings message, followed by a * FramebufferUpdateRequest. From then on the server will send * FramebufferUpdate messages in response to the client's * FramebufferUpdateRequest messages. The client should send * FramebufferUpdateRequest messages with incremental set to true when it has * finished processing one FramebufferUpdate and is ready to process another. * With a fast client, the rate at which FramebufferUpdateRequests are sent * should be regulated to avoid hogging the network. */ /***************************************************************************** * * Message types * *****************************************************************************/ /* server -> client */ #define rfbFramebufferUpdate 0 #define rfbSetColourMapEntries 1 #define rfbBell 2 #define rfbServerCutText 3 #define rfbFileListData 130 #define rfbFileDownloadData 131 #define rfbFileUploadCancel 132 #define rfbFileDownloadFailed 133 /* signatures for non-standard messages */ #define sig_rfbFileListData "FTS_LSDT" #define sig_rfbFileDownloadData "FTS_DNDT" #define sig_rfbFileUploadCancel "FTS_UPCN" #define sig_rfbFileDownloadFailed "FTS_DNFL" /* client -> server */ #define rfbSetPixelFormat 0 #define rfbFixColourMapEntries 1 /* not currently supported */ #define rfbSetEncodings 2 #define rfbFramebufferUpdateRequest 3 #define rfbKeyEvent 4 #define rfbPointerEvent 5 #define rfbClientCutText 6 #define rfbFileListRequest 130 #define rfbFileDownloadRequest 131 #define rfbFileUploadRequest 132 #define rfbFileUploadData 133 #define rfbFileDownloadCancel 134 #define rfbFileUploadFailed 135 #define rfbFileCreateDirRequest 136 /* signatures for non-standard messages */ #define sig_rfbFileListRequest "FTC_LSRQ" #define sig_rfbFileDownloadRequest "FTC_DNRQ" #define sig_rfbFileUploadRequest "FTC_UPRQ" #define sig_rfbFileUploadData "FTC_UPDT" #define sig_rfbFileDownloadCancel "FTC_DNCN" #define sig_rfbFileUploadFailed "FTC_UPFL" #define sig_rfbFileCreateDirRequest "FTC_FCDR" /***************************************************************************** * * Encoding types * *****************************************************************************/ #define rfbEncodingRaw 0 #define rfbEncodingCopyRect 1 #define rfbEncodingRRE 2 #define rfbEncodingCoRRE 4 #define rfbEncodingHextile 5 #define rfbEncodingZlib 6 #define rfbEncodingTight 7 #define rfbEncodingZlibHex 8 #define rfbEncodingZRLE 16 /* signatures for basic encoding types */ #define sig_rfbEncodingRaw "RAW_____" #define sig_rfbEncodingCopyRect "COPYRECT" #define sig_rfbEncodingRRE "RRE_____" #define sig_rfbEncodingCoRRE "CORRE___" #define sig_rfbEncodingHextile "HEXTILE_" #define sig_rfbEncodingZlib "ZLIB____" #define sig_rfbEncodingTight "TIGHT___" #define sig_rfbEncodingZlibHex "ZLIBHEX_" #define sig_rfbEncodingZRLE "ZRLE____" /* * Special encoding numbers: * 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels; * 0xFFFFFF10 .. 0xFFFFFF1F -- mouse cursor shape data; * 0xFFFFFF20 .. 0xFFFFFF2F -- various protocol extensions; * 0xFFFFFF30 .. 0xFFFFFFDF -- not allocated yet; * 0xFFFFFFE0 .. 0xFFFFFFEF -- quality level for JPEG compressor; * 0xFFFFFFF0 .. 0xFFFFFFFF -- not allocated yet. */ #define rfbEncodingCompressLevel0 0xFFFFFF00 #define rfbEncodingCompressLevel1 0xFFFFFF01 #define rfbEncodingCompressLevel2 0xFFFFFF02 #define rfbEncodingCompressLevel3 0xFFFFFF03 #define rfbEncodingCompressLevel4 0xFFFFFF04 #define rfbEncodingCompressLevel5 0xFFFFFF05 #define rfbEncodingCompressLevel6 0xFFFFFF06 #define rfbEncodingCompressLevel7 0xFFFFFF07 #define rfbEncodingCompressLevel8 0xFFFFFF08 #define rfbEncodingCompressLevel9 0xFFFFFF09 #define rfbEncodingXCursor 0xFFFFFF10 #define rfbEncodingRichCursor 0xFFFFFF11 #define rfbEncodingPointerPos 0xFFFFFF18 #define rfbEncodingLastRect 0xFFFFFF20 #define rfbEncodingNewFBSize 0xFFFFFF21 #define rfbEncodingQualityLevel0 0xFFFFFFE0 #define rfbEncodingQualityLevel1 0xFFFFFFE1 #define rfbEncodingQualityLevel2 0xFFFFFFE2 #define rfbEncodingQualityLevel3 0xFFFFFFE3 #define rfbEncodingQualityLevel4 0xFFFFFFE4 #define rfbEncodingQualityLevel5 0xFFFFFFE5 #define rfbEncodingQualityLevel6 0xFFFFFFE6 #define rfbEncodingQualityLevel7 0xFFFFFFE7 #define rfbEncodingQualityLevel8 0xFFFFFFE8 #define rfbEncodingQualityLevel9 0xFFFFFFE9 /* signatures for "fake" encoding types */ #define sig_rfbEncodingCompressLevel0 "COMPRLVL" #define sig_rfbEncodingXCursor "X11CURSR" #define sig_rfbEncodingRichCursor "RCHCURSR" #define sig_rfbEncodingPointerPos "POINTPOS" #define sig_rfbEncodingLastRect "LASTRECT" #define sig_rfbEncodingNewFBSize "NEWFBSIZ" #define sig_rfbEncodingQualityLevel0 "JPEGQLVL" /***************************************************************************** * * Server -> client message definitions * *****************************************************************************/ /*----------------------------------------------------------------------------- * FramebufferUpdate - a block of rectangles to be copied to the framebuffer. * * This message consists of a header giving the number of rectangles of pixel * data followed by the rectangles themselves. The header is padded so that * together with the type byte it is an exact multiple of 4 bytes (to help * with alignment of 32-bit pixels): */ typedef struct _rfbFramebufferUpdateMsg { CARD8 type; /* always rfbFramebufferUpdate */ CARD8 pad; CARD16 nRects; /* followed by nRects rectangles */ } rfbFramebufferUpdateMsg; #define sz_rfbFramebufferUpdateMsg 4 /* * Each rectangle of pixel data consists of a header describing the position * and size of the rectangle and a type word describing the encoding of the * pixel data, followed finally by the pixel data. Note that if the client has * not sent a SetEncodings message then it will only receive raw pixel data. * Also note again that this structure is a multiple of 4 bytes. */ typedef struct _rfbFramebufferUpdateRectHeader { rfbRectangle r; CARD32 encoding; /* one of the encoding types rfbEncoding... */ } rfbFramebufferUpdateRectHeader; #define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * 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 _rfbCopyRect { 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 [...] where each is * []. */ typedef struct _rfbRREHeader { 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 * [...] where each is * []. This means that * the whole rectangle must be at most 255x255 pixels. */ typedef struct _rfbCoRRERectangle { 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) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ZLIB - zlib compression Encoding. We have an rfbZlibHeader structure * giving the number of bytes to follow. Finally the data follows in * zlib compressed format. */ typedef struct _rfbZlibHeader { CARD32 nBytes; } rfbZlibHeader; #define sz_rfbZlibHeader 4 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Tight Encoding. * *-- The first byte of each Tight-encoded rectangle is a "compression control * byte". Its format is as follows (bit 0 is the least significant one): * * bit 0: if 1, then compression stream 0 should be reset; * bit 1: if 1, then compression stream 1 should be reset; * bit 2: if 1, then compression stream 2 should be reset; * bit 3: if 1, then compression stream 3 should be reset; * bits 7-4: if 1000 (0x08), then the compression type is "fill", * if 1001 (0x09), then the compression type is "jpeg", * if 0xxx, then the compression type is "basic", * values greater than 1001 are not valid. * * If the compression type is "basic", then bits 6..4 of the * compression control byte (those xxx in 0xxx) specify the following: * * bits 5-4: decimal representation is the index of a particular zlib * stream which should be used for decompressing the data; * bit 6: if 1, then a "filter id" byte is following this byte. * *-- The data that follows after the compression control byte described * above depends on the compression type ("fill", "jpeg" or "basic"). * *-- If the compression type is "fill", then the only pixel value follows, in * client pixel format (see NOTE 1). This value applies to all pixels of the * rectangle. * *-- If the compression type is "jpeg", the following data stream looks like * this: * * 1..3 bytes: data size (N) in compact representation; * N bytes: JPEG image. * * Data size is compactly represented in one, two or three bytes, according * to the following scheme: * * 0xxxxxxx (for values 0..127) * 1xxxxxxx 0yyyyyyy (for values 128..16383) * 1xxxxxxx 1yyyyyyy zzzzzzzz (for values 16384..4194303) * * Here each character denotes one bit, xxxxxxx are the least significant 7 * bits of the value (bits 0-6), yyyyyyy are bits 7-13, and zzzzzzzz are the * most significant 8 bits (bits 14-21). For example, decimal value 10000 * should be represented as two bytes: binary 10010000 01001110, or * hexadecimal 90 4E. * *-- If the compression type is "basic" and bit 6 of the compression control * byte was set to 1, then the next (second) byte specifies "filter id" which * tells the decoder what filter type was used by the encoder to pre-process * pixel data before the compression. The "filter id" byte can be one of the * following: * * 0: no filter ("copy" filter); * 1: "palette" filter; * 2: "gradient" filter. * *-- If bit 6 of the compression control byte is set to 0 (no "filter id" * byte), or if the filter id is 0, then raw pixel values in the client * format (see NOTE 1) will be compressed. See below details on the * compression. * *-- The "gradient" filter pre-processes pixel data with a simple algorithm * which converts each color component to a difference between a "predicted" * intensity and the actual intensity. Such a technique does not affect * uncompressed data size, but helps to compress photo-like images better. * Pseudo-code for converting intensities to differences is the following: * * P[i,j] := V[i-1,j] + V[i,j-1] - V[i-1,j-1]; * if (P[i,j] < 0) then P[i,j] := 0; * if (P[i,j] > MAX) then P[i,j] := MAX; * D[i,j] := V[i,j] - P[i,j]; * * Here V[i,j] is the intensity of a color component for a pixel at * coordinates (i,j). MAX is the maximum value of intensity for a color * component. * *-- The "palette" filter converts true-color pixel data to indexed colors * and a palette which can consist of 2..256 colors. If the number of colors * is 2, then each pixel is encoded in 1 bit, otherwise 8 bits is used to * encode one pixel. 1-bit encoding is performed such way that the most * significant bits correspond to the leftmost pixels, and each raw of pixels * is aligned to the byte boundary. When "palette" filter is used, the * palette is sent before the pixel data. The palette begins with an unsigned * byte which value is the number of colors in the palette minus 1 (i.e. 1 * means 2 colors, 255 means 256 colors in the palette). Then follows the * palette itself which consist of pixel values in client pixel format (see * NOTE 1). * *-- The pixel data is compressed using the zlib library. But if the data * size after applying the filter but before the compression is less then 12, * then the data is sent as is, uncompressed. Four separate zlib streams * (0..3) can be used and the decoder should read the actual stream id from * the compression control byte (see NOTE 2). * * If the compression is not used, then the pixel data is sent as is, * otherwise the data stream looks like this: * * 1..3 bytes: data size (N) in compact representation; * N bytes: zlib-compressed data. * * Data size is compactly represented in one, two or three bytes, just like * in the "jpeg" compression method (see above). * *-- NOTE 1. If the color depth is 24, and all three color components are * 8-bit wide, then one pixel in Tight encoding is always represented by * three bytes, where the first byte is red component, the second byte is * green component, and the third byte is blue component of the pixel color * value. This applies to colors in palettes as well. * *-- NOTE 2. The decoder must reset compression streams' states before * decoding the rectangle, if some of bits 0,1,2,3 in the compression control * byte are set to 1. Note that the decoder must reset zlib streams even if * the compression type is "fill" or "jpeg". * *-- NOTE 3. The "gradient" filter and "jpeg" compression may be used only * when bits-per-pixel value is either 16 or 32, not 8. * *-- NOTE 4. The width of any Tight-encoded rectangle cannot exceed 2048 * pixels. If a rectangle is wider, it must be split into several rectangles * and each one should be encoded separately. * */ #define rfbTightExplicitFilter 0x04 #define rfbTightFill 0x08 #define rfbTightJpeg 0x09 #define rfbTightMaxSubencoding 0x09 /* Filters to improve compression efficiency */ #define rfbTightFilterCopy 0x00 #define rfbTightFilterPalette 0x01 #define rfbTightFilterGradient 0x02 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ZLIBHEX - zlib compressed Hextile Encoding. Essentially, this is the * hextile encoding with zlib compression on the tiles that can not be * efficiently encoded with one of the other hextile subencodings. The * new zlib subencoding uses two bytes to specify the length of the * compressed tile and then the compressed data follows. As with the * raw sub-encoding, the zlib subencoding invalidates the other * values, if they are also set. */ #define rfbHextileZlibRaw (1 << 5) #define rfbHextileZlibHex (1 << 6) /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * XCursor encoding. This is a special encoding used to transmit X-style * cursor shapes from server to clients. Note that for this encoding, * coordinates in rfbFramebufferUpdateRectHeader structure hold hotspot * position (r.x, r.y) and cursor size (r.w, r.h). If (w * h != 0), two RGB * samples are sent after header in the rfbXCursorColors structure. They * denote foreground and background colors of the cursor. If a client * supports only black-and-white cursors, it should ignore these colors and * assume that foreground is black and background is white. Next, two bitmaps * (1 bits per pixel) follow: first one with actual data (value 0 denotes * background color, value 1 denotes foreground color), second one with * transparency data (bits with zero value mean that these pixels are * transparent). Both bitmaps represent cursor data in a byte stream, from * left to right, from top to bottom, and each row is byte-aligned. Most * significant bits correspond to leftmost pixels. The number of bytes in * each row can be calculated as ((w + 7) / 8). If (w * h == 0), cursor * should be hidden (or default local cursor should be set by the client). */ typedef struct _rfbXCursorColors { CARD8 foreRed; CARD8 foreGreen; CARD8 foreBlue; CARD8 backRed; CARD8 backGreen; CARD8 backBlue; } rfbXCursorColors; #define sz_rfbXCursorColors 6 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * RichCursor encoding. This is a special encoding used to transmit cursor * shapes from server to clients. It is similar to the XCursor encoding but * uses client pixel format instead of two RGB colors to represent cursor * image. For this encoding, coordinates in rfbFramebufferUpdateRectHeader * structure hold hotspot position (r.x, r.y) and cursor size (r.w, r.h). * After header, two pixmaps follow: first one with cursor image in current * client pixel format (like in raw encoding), second with transparency data * (1 bit per pixel, exactly the same format as used for transparency bitmap * in the XCursor encoding). If (w * h == 0), cursor should be hidden (or * default local cursor should be set by the client). */ /*----------------------------------------------------------------------------- * 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 _rfbSetColourMapEntriesMsg { 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 _rfbBellMsg { CARD8 type; /* always rfbBell */ } rfbBellMsg; #define sz_rfbBellMsg 1 /*----------------------------------------------------------------------------- * ServerCutText - the server has new text in its cut buffer. */ typedef struct _rfbServerCutTextMsg { CARD8 type; /* always rfbServerCutText */ CARD8 pad1; CARD16 pad2; CARD32 length; /* followed by char text[length] */ } rfbServerCutTextMsg; #define sz_rfbServerCutTextMsg 8 /*----------------------------------------------------------------------------- * FileListData */ typedef struct _rfbFileListDataMsg { CARD8 type; CARD8 flags; CARD16 numFiles; CARD16 dataSize; CARD16 compressedSize; /* Followed by SizeData[numFiles] */ /* Followed by Filenames[compressedSize] */ } rfbFileListDataMsg; #define sz_rfbFileListDataMsg 8 /*----------------------------------------------------------------------------- * FileDownloadData */ typedef struct _rfbFileDownloadDataMsg { CARD8 type; CARD8 compressLevel; CARD16 realSize; CARD16 compressedSize; /* Followed by File[copressedSize], but if (realSize = compressedSize = 0) followed by CARD32 modTime */ } rfbFileDownloadDataMsg; #define sz_rfbFileDownloadDataMsg 6 /*----------------------------------------------------------------------------- * FileUploadCancel */ typedef struct _rfbFileUploadCancelMsg { CARD8 type; CARD8 unused; CARD16 reasonLen; /* Followed by reason[reasonLen] */ } rfbFileUploadCancelMsg; #define sz_rfbFileUploadCancelMsg 4 /*----------------------------------------------------------------------------- * FileDownloadFailed */ typedef struct _rfbFileDownloadFailedMsg { CARD8 type; CARD8 unused; CARD16 reasonLen; /* Followed by reason[reasonLen] */ } rfbFileDownloadFailedMsg; #define sz_rfbFileDownloadFailedMsg 4 /*----------------------------------------------------------------------------- * Union of all server->client messages. */ typedef union _rfbServerToClientMsg { CARD8 type; rfbFramebufferUpdateMsg fu; rfbSetColourMapEntriesMsg scme; rfbBellMsg b; rfbServerCutTextMsg sct; rfbFileListDataMsg fld; rfbFileDownloadDataMsg fdd; rfbFileUploadCancelMsg fuc; rfbFileDownloadFailedMsg fdf; } rfbServerToClientMsg; /***************************************************************************** * * Message definitions (client -> server) * *****************************************************************************/ /*----------------------------------------------------------------------------- * SetPixelFormat - tell the RFB server the format in which the client wants * pixels sent. */ typedef struct _rfbSetPixelFormatMsg { 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 _rfbFixColourMapEntriesMsg { 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 _rfbSetEncodingsMsg { 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 _rfbFramebufferUpdateRequestMsg { 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 _rfbKeyEventMsg { 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 _rfbPointerEventMsg { 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 rfbButton4Mask 8 #define rfbButton5Mask 16 #define sz_rfbPointerEventMsg 6 /*----------------------------------------------------------------------------- * ClientCutText - the client has new text in its cut buffer. */ typedef struct _rfbClientCutTextMsg { CARD8 type; /* always rfbClientCutText */ CARD8 pad1; CARD16 pad2; CARD32 length; /* followed by char text[length] */ } rfbClientCutTextMsg; #define sz_rfbClientCutTextMsg 8 /*----------------------------------------------------------------------------- * FileListRequest */ typedef struct _rfbFileListRequestMsg { CARD8 type; CARD8 flags; CARD16 dirNameSize; /* Followed by char Dirname[dirNameSize] */ } rfbFileListRequestMsg; #define sz_rfbFileListRequestMsg 4 /*----------------------------------------------------------------------------- * FileDownloadRequest */ typedef struct _rfbFileDownloadRequestMsg { CARD8 type; CARD8 compressedLevel; CARD16 fNameSize; CARD32 position; /* Followed by char Filename[fNameSize] */ } rfbFileDownloadRequestMsg; #define sz_rfbFileDownloadRequestMsg 8 /*----------------------------------------------------------------------------- * FileUploadRequest */ typedef struct _rfbFileUploadRequestMsg { CARD8 type; CARD8 compressedLevel; CARD16 fNameSize; CARD32 position; /* Followed by char Filename[fNameSize] */ } rfbFileUploadRequestMsg; #define sz_rfbFileUploadRequestMsg 8 /*----------------------------------------------------------------------------- * FileUploadData */ typedef struct _rfbFileUploadDataMsg { CARD8 type; CARD8 compressedLevel; CARD16 realSize; CARD16 compressedSize; /* Followed by File[compressedSize], but if (realSize = compressedSize = 0) followed by CARD32 modTime */ } rfbFileUploadDataMsg; #define sz_rfbFileUploadDataMsg 6 /*----------------------------------------------------------------------------- * FileDownloadCancel */ typedef struct _rfbFileDownloadCancelMsg { CARD8 type; CARD8 unused; CARD16 reasonLen; /* Followed by reason[reasonLen] */ } rfbFileDownloadCancelMsg; #define sz_rfbFileDownloadCancelMsg 4 /*----------------------------------------------------------------------------- * FileUploadFailed */ typedef struct _rfbFileUploadFailedMsg { CARD8 type; CARD8 unused; CARD16 reasonLen; /* Followed by reason[reasonLen] */ } rfbFileUploadFailedMsg; #define sz_rfbFileUploadFailedMsg 4 /*----------------------------------------------------------------------------- * FileCreateDirRequest */ typedef struct _rfbFileCreateDirRequestMsg { CARD8 type; CARD8 unused; CARD16 dNameLen; /* Followed by dName[dNameLen] */ } rfbFileCreateDirRequestMsg; #define sz_rfbFileCreateDirRequestMsg 4 /*----------------------------------------------------------------------------- * Union of all client->server messages. */ typedef union _rfbClientToServerMsg { CARD8 type; rfbSetPixelFormatMsg spf; rfbFixColourMapEntriesMsg fcme; rfbSetEncodingsMsg se; rfbFramebufferUpdateRequestMsg fur; rfbKeyEventMsg ke; rfbPointerEventMsg pe; rfbClientCutTextMsg cct; rfbFileListRequestMsg flr; rfbFileDownloadRequestMsg fdr; rfbFileUploadRequestMsg fupr; rfbFileUploadDataMsg fud; rfbFileDownloadCancelMsg fdc; rfbFileUploadFailedMsg fuf; rfbFileCreateDirRequestMsg fcdr; } rfbClientToServerMsg; vnc_unixsrc/include/vncauth.h0100664000076400007640000000221607120677563015752 0ustar constconst/* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* * vncauth.h - describes the functions provided by the vncauth library. */ #define MAXPWLEN 8 #define CHALLENGESIZE 16 extern int vncEncryptAndStorePasswd(char *passwd, char *fname); extern char *vncDecryptPasswdFromFile(char *fname); extern void vncRandomBytes(unsigned char *bytes); extern void vncEncryptBytes(unsigned char *bytes, char *passwd); vnc_unixsrc/Xvnc/0040775000076400007640000000000010616336502013413 5ustar constconstvnc_unixsrc/Xvnc/configure0100775000076400007640000000300510227464413015316 0ustar constconst#!/bin/sh # configure # # This script sets up for a build. It has been tested on the following # Operating System versions (uname outputs): # # Solaris 7 & 8 (SunOS, 5.7 or 5.8) # Tru64 4.0F & 5.1 (OSF1, V4.0 or V5.1) # Linux 2.4 (Linux, 2.4.0-4GB) # Irix 6.2 (IRIX, 6.2) SYSNAME=`uname -s` if [ "$SYSNAME" = AIX ] then MAJOR=`uname -v` MINOR=`uname -r` TEENY=0 else REV=`uname -r` if [ "$SYSNAME" = HP-UX ] then REV=`echo $REV | sed -e 's/^[^.]*\.//'` else if [ "$SYSNAME" != Darwin ] then REV=`echo $REV | sed -e 's/^V//' -e 's/-.*$//'` fi fi MAJOR=`echo $REV | awk -F. 'NF < 1 {print "0"} {print $1}'` MINOR=`echo $REV | awk -F. 'NF < 2 {print "0"} {print $2}'` TEENY=`echo $REV | awk -F. 'NF < 3 {print "0"} {print $3}'` fi echo "#define OSName $SYSNAME" > config/cf/platform.def echo "#define OSMajorVersion $MAJOR" >> config/cf/platform.def echo "#define OSMinorVersion $MINOR" >> config/cf/platform.def echo "#define OSTeenyVersion $TEENY" >> config/cf/platform.def echo "#define LinuxCLibMajorVersion 6" >> config/cf/platform.def if [ "$SYSNAME" = AIX ] then # xmkmf and imake are broken on AIX cd config/imake imake -I../cf -DTOPDIR=../.. -DCURDIR=. make Makefiles make includes make depend make cd ../.. imake -I./config/cf -DTOPDIR=./ -DCURDIR=. make Makefiles make includes make depend else cd config/imake xmkmf ../../ make cd ../.. xmkmf -a ./ fi exit 0 vnc_unixsrc/Xvnc/LABEL0100664000076400007640000000601607120677563014170 0ustar constconst X Window System, Version 11 Release 6.3 Portions Copyright by: X Consortium and Mark Adler Adobe Systems Incorporated AGE Logic, Inc. Gerrit Jan Akkerman Corin Anderson Doug Anson Apollo Computer Inc. Ares Software Corp. ATI AT&T, Inc. Robert V. Baron David Bateman Bigelow & Holmes Bitstream, Inc. Jon Block Adam de Boor Manfred Brands Richard Burdick Cognition Corp. Simon P. Cooper Regis Cridlig Robin Cutshaw Daniver Limited Daewoo Electronics Co.,Ltd. Data General Corporation David Dawes Jorge Delgado Digital Equipment Corporation Evans & Sutherland Computer Corporation Rickard E. Faith Erik Fortune Free Software Foundation, Inc. Joseph Friedman Fuji Xerox Co., Ltd. Fujitsu Limited Fujitsu Open Systems Solutions, Inc. Jean-loup Gailly Tiago Gons Pascal Haible Harm Hanemaayer Randy Hendry Matthieu Herrb Hewlett-Packard Company Hitachi, Ltd. David Holland Philip Homburg Alan Hourihane IBM Corporation The Institute of Software, Academia Sinica INTERACTIVE Systems Corporation Kaleb S. Keithley Jeff Kirk Marc Aurele La France Glenn G. Lai Scott Laird Thomas G. Lane Steven Lang Harry Langenbacher Patrick Lecoanet Sam Leffler Frederic Lepied Lexmark International, Inc. Sebastien Marineau Michael P. Marking Kevin E. Martin Davor Matic David McCullough David McKay MIPS Computer Systems, Inc. Joe Moss Thomas Mueller Rich Murphey NCR Corporation, Inc. Netscape Communications Network Computing Devices, Inc. Novell, Inc. NTT Software Corporation Number Nine Computer Corp. NVIDIA Corp. Erik Nygren Hans Oey Kazuyuki (ikko-) Okamoto Oki Technosystems Laboratory, Inc. OMRON Corporation Open Software Foundation Panacea Inc. Prentice Hall Quarterdeck Office Systems Regents of the University of California Bill Reynolds Thomas Roell The Santa Cruz Operation, Inc. Dale Schumacher Paolo Severini ShoGraphics, Inc. Silicon Graphics Computer Systems, Inc. Sony Corporation SRI Craig Struble Sun Microsystems, Inc. SunSoft, Inc. Tektronix, Inc. Finn Thoegersen Jon Tombs Linus Torvalds TOSHIBA Corp. Peter Trattler James Tsillas UniSoft Group Limited UNIX System Laboratories, Inc. Holger Veit Vrije Universiteit Larry Wall David E. Wexelblat Thomas Wolfram Henry A. Worth Wyse Technology, Inc. The XFree86 Project, Inc. Orest Zborowski vnc_unixsrc/Xvnc/include/0040775000076400007640000000000010616336466015047 5ustar constconstvnc_unixsrc/Xvnc/include/DECkeysym.h0100664000076400007640000000572007120677563017060 0ustar constconst/* $XConsortium: DECkeysym.h,v 1.4 94/04/17 20:10:47 rws Exp $ */ /*********************************************************** Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* * DEC private keysyms * (29th bit set) */ /* two-key compose sequence initiators, chosen to map to Latin1 characters */ #define DXK_ring_accent 0x1000FEB0 #define DXK_circumflex_accent 0x1000FE5E #define DXK_cedilla_accent 0x1000FE2C #define DXK_acute_accent 0x1000FE27 #define DXK_grave_accent 0x1000FE60 #define DXK_tilde 0x1000FE7E #define DXK_diaeresis 0x1000FE22 /* special keysym for LK2** "Remove" key on editing keypad */ #define DXK_Remove 0x1000FF00 /* Remove */ vnc_unixsrc/Xvnc/include/Xos_r.h0100664000076400007640000010457107120677563016321 0ustar constconst/* $XConsortium: Xos_r.h /main/5 1996/12/18 16:29:14 lehors $ */ /* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/include/Xos_r.h,v 1.3 1997/01/18 07:17:11 dawes Exp $ */ /* * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. * * Use this file in MT-safe code where you would have included * for readdir() * for getgrgid() or getgrnam() * for gethostbyname(), gethostbyaddr(), or getservbyname() * for getpwnam() or getpwuid() * for strtok() * for asctime(), ctime(), localtime(), or gmtime() * for getlogin() or ttyname() * or their thread-safe analogs. * * If you are on a platform that defines XTHREADS but does not have * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock * and _Xos_processUnlock macros before including this header. If * you are on OSF/1 V3.2 and plan to use readdir(), you must also define * _Xos_isThreadsInitialized. For convenience XOS_USE_XLIB_LOCKING or * XOS_USE_XT_LOCKING may be defined to obtain either Xlib-only or * Xt-based versions of these macros. These macros won't result in * truly thread-safe calls, but they are better than nothing. If you * do not want locking in this situation define XOS_USE_NO_LOCKING. * * NOTE: On systems lacking approriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * This header is nominally intended to simplify porting X11, Motif, and * CDE; it may be useful to other people too. The structure below is * complicated, mostly because P1003.1c (the IEEE POSIX Threads spec) * went through lots of drafts, and some vendors shipped systems based * on draft API that were changed later. Unfortunately POSIX did not * provide a feature-test macro for distinguishing each of the drafts. */ /* * This header has several parts. Search for "Effective prototypes" * to locate the beginning of a section. */ /* This header can be included multiple times with different defines! */ #ifndef _XOS_R_H_ # define _XOS_R_H_ # include # include # ifndef X_NOT_POSIX # ifdef _POSIX_SOURCE # include # else # define _POSIX_SOURCE # include # undef _POSIX_SOURCE # endif # endif #endif /* _XOS_R_H */ #ifndef WIN32 #ifdef __cplusplus extern "C" { #endif # if defined(XOS_USE_XLIB_LOCKING) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ typedef struct _LockInfoRec *LockInfoPtr; extern LockInfoPtr _Xglobal_lock; # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized (_Xglobal_lock) # endif # if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */, char * /* file */, int /* line */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? (*_XLockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? (*_XUnlockMutex_fn)(_Xglobal_lock,__FILE__,__LINE__) : 0) # endif # else # ifndef XAllocIDs /* Xlibint.h does not have multiple include protection */ # include /* for NeedFunctionPrototypes */ extern void (*_XLockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); extern void (*_XUnlockMutex_fn)( # if NeedFunctionPrototypes LockInfoPtr /* lock */ # endif ); # endif # ifndef _Xos_processLock # define _Xos_processLock \ (_XLockMutex_fn ? ((*_XLockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock \ (_XUnlockMutex_fn ? ((*_XUnlockMutex_fn)(_Xglobal_lock), 0) : 0) # endif # endif # elif defined(XOS_USE_XT_LOCKING) extern void (*_XtProcessLock)(); # ifndef _XtintrinsicP_h # include /* for NeedFunctionPrototypes */ extern void XtProcessLock( # if NeedFunctionPrototypes void # endif ); extern void XtProcessUnlock( # if NeedFunctionPrototypes void # endif ); # endif # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized _XtProcessLock # endif # ifndef _Xos_processLock # define _Xos_processLock XtProcessLock() # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock XtProcessUnlock() # endif # elif defined(XOS_USE_NO_LOCKING) # ifndef _Xos_isThreadInitialized # define _Xos_isThreadInitialized 0 # endif # ifndef _Xos_processLock # define _Xos_processLock 0 # endif # ifndef _Xos_processUnlock # define _Xos_processUnlock 0 # endif # endif #endif /* !defined WIN32 */ /* * Solaris 2.5 has SVR4 thread-safe API, but defines the POSIX * thread-safe feature test macro. Fix the feature test macro. */ #if defined(sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) # undef _POSIX_THREAD_SAFE_FUNCTIONS #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_PWD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetpwparams; * * struct passwd* _XGetpwnam(const char *name, _Xgetpwparams); * struct passwd* _XGetpwuid(uid_t uid, _Xgetpwparams); */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI) # define XOS_USE_MTSAFE_PWDAPI 1 # endif #endif #if !defined(X_INCLUDE_PWD_H) || defined(_XOS_INCLUDED_PWD_H) /* Do nothing */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ # if defined(X_NOT_POSIX) && !defined(i386) && !defined(SYSV) extern struct passwd *getpwuid(), *getpwnam(); # endif typedef int _Xgetpwparams; /* dummy */ # define _XGetpwuid(u,p) getpwuid((u)) # define _XGetpwnam(u,p) getpwnam((u)) #elif !defined(XOS_USE_MTSAFE_PWDAPI) || defined(XNO_MTSAFE_PWDAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ typedef struct { struct passwd pws; char pwbuf[1024]; struct passwd* pwp; size_t len; } _Xgetpwparams; # define _Xpw_copyPasswd(p) \ (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \ ((p).pws.pw_name = (p).pwbuf), \ ((p).len = strlen((p).pwp->pw_name)), \ strcpy((p).pws.pw_name, (p).pwp->pw_name), \ ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_passwd)), \ strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \ ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_age)), \ strcpy((p).pws.pw_age, (p).pwp->pw_age), \ ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_comment)), \ strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \ ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_gecos)), \ strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \ ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_dir)), \ strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \ ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \ ((p).len = strlen((p).pwp->pw_shell)), \ strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \ ((p).pwp = &(p).pws), \ 0 ) # define _XGetpwuid(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwuid((u))) ? _Xpw_copyPasswd(p) : 0), \ (_Xos_processUnlock), \ (p).pwp ) # define _XGetpwnam(u,p) \ ( (_Xos_processLock), \ (((p).pwp = getpwnam((u))) ? _Xpw_copyPasswd(p) : 0), \ (_Xos_processUnlock), \ (p).pwp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) /* SVR4 threads, AIX 4.2.0 and earlier and OSF/1 3.2 and earlier pthreads */ # if defined(Lynx) && !defined(LINE_MAX) # define LINE_MAX 2048 /* what Xthreads.h does */ # endif typedef struct { struct passwd pws; char pwbuf[LINE_MAX]; } _Xgetpwparams; # if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) || defined(Lynx) # ifndef Lynx # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # else /* Lynx */ # define _XGetpwuid(u,p) \ ((getpwuid_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # endif # else /* SVR4 */ # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) # endif /* SVR4 */ #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ /* Digital UNIX 4.0, but not (beta) T4.0-1 */ # if defined(__osf__) /* OSF/1 V4.0 doesn't declare the _P routines, breaking under C++. */ extern int _Pgetpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); extern int _Pgetpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **); # endif typedef struct { struct passwd pws; char pwbuf[LINE_MAX]; struct passwd* pwp; } _Xgetpwparams; typedef int _Xgetpwret; # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == -1) ? \ NULL : (p).pwp) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf),&(p).pwp) == -1) ? \ NULL : (p).pwp) #endif /* X_INCLUDE_PWD_H */ #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H) # define _XOS_INCLUDED_PWD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking the appropriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or * protocol lists! * * #define X_INCLUDE_NETDB_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgethostbynameparams; * typedef ... _Xgetservbynameparams; * * struct hostent* _XGethostbyname(const char* name,_Xgethostbynameparams); * struct hostent* _XGethostbyaddr(const char* addr, int len, int type, * _Xgethostbynameparams); * struct servent* _XGetservbyname(const char* name, const char* proto, * _Xgetservbynameparams); */ #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \ && !defined(WIN32) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI) # define XOS_USE_MTSAFE_NETDBAPI 1 # endif #endif #if !defined(X_INCLUDE_NETDB_H) || defined(_XOS_INCLUDED_NETDB_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI) /* UnixWare 2.0, or other systems with thread support but no _r API. */ /* WARNING: The h_addr_list and s_aliases values are *not* copied! */ typedef struct { struct hostent hent; char h_name[MAXHOSTNAMELEN]; struct hostent *hptr; } _Xgethostbynameparams; typedef struct { struct servent sent; char s_name[255]; char s_proto[255]; struct servent *sptr; } _Xgetservbynameparams; # define _Xg_copyHostent(hp) \ (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \ strcpy((hp).h_name, (hp).hptr->h_name), \ ((hp).hent.h_name = (hp).h_name), \ ((hp).hptr = &(hp).hent), \ 0 ) # define _Xg_copyServent(sp) \ (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \ strcpy((sp).s_name, (sp).sptr->s_name), \ ((sp).sent.s_name = (sp).s_name), \ strcpy((sp).s_proto, (sp).sptr->s_proto), \ ((sp).sent.s_proto = (sp).s_proto), \ ((sp).sptr = &(sp).sent), \ 0 ) # define _XGethostbyname(h,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyname((h))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGethostbyaddr(a,al,t,hp) \ ((_Xos_processLock), \ (((hp).hptr = gethostbyaddr((a),(al),(t))) ? _Xg_copyHostent(hp) : 0), \ (_Xos_processUnlock), \ (hp).hptr ) # define _XGetservbyname(s,p,sp) \ ((_Xos_processLock), \ (((sp).sptr = getservbyname((s),(p))) ? _Xg_copyServent(sp) : 0), \ (_Xos_processUnlock), \ (sp).sptr ) #elif defined(XUSE_NETDB_R_API) /* * POSIX does not specify _r equivalents for API, but some * vendors provide them anyway. Use them only when explicitly asked. */ # ifdef _POSIX_REENTRANT_FUNCTIONS # ifndef _POSIX_THREAD_SAFE_FUNCTIONS # if defined(AIXV3) || defined(AIXV4) || defined(__osf__) # define X_POSIX_THREAD_SAFE_FUNCTIONS 1 # endif # endif # endif # ifdef _POSIX_THREAD_SAFE_FUNCTIONS # define X_POSIX_THREAD_SAFE_FUNCTIONS 1 # endif # ifndef X_POSIX_THREAD_SAFE_FUNCTIONS typedef struct { struct hostent hent; char hbuf[LINE_MAX]; int herr; } _Xgethostbynameparams; typedef struct { struct servent sent; char sbuf[LINE_MAX]; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ gethostbyname_r((h),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGethostbyaddr(a,al,t,hp) \ gethostbyaddr_r((a),(al),(t),&(hp).hent,(hp).hbuf,sizeof((hp).hbuf),&(hp).herr) # define _XGetservbyname(s,p,sp) \ getservbyname_r((s),(p),&(sp).sent,(sp).sbuf,sizeof((sp).sbuf)) # else typedef struct { struct hostent hent; struct hostent_data hdata; } _Xgethostbynameparams; typedef struct { struct servent sent; struct servent_data sdata; } _Xgetservbynameparams; # define _XGethostbyname(h,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyname_r((h),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGethostbyaddr(a,al,t,hp) \ (bzero((char*)&(hp).hdata,sizeof((hp).hdata)), \ ((gethostbyaddr_r((a),(al),(t),&(hp).hent,&(hp).hdata) == -1) ? NULL : &(hp).hent)) # define _XGetservbyname(s,p,sp) \ (bzero((char*)&(sp).sdata,sizeof((sp).sdata)), \ ((getservbyname_r((s),(p),&(sp).sent,&(sp).sdata) == -1) ? NULL : &(sp).sent) ) # endif # ifdef X_POSIX_THREAD_SAFE_FUNCTIONS # undef X_POSIX_THREAD_SAFE_FUNCTIONS # endif #else /* The regular API is assumed to be MT-safe under POSIX. */ typedef int _Xgethostbynameparams; /* dummy */ typedef int _Xgetservbynameparams; /* dummy */ # define _XGethostbyname(h,hp) gethostbyname((h)) # define _XGethostbyaddr(a,al,t,hp) gethostbyaddr((a),(al),(t)) # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #endif /* X_INCLUDE_NETDB_H */ #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) # define _XOS_INCLUDED_NETDB_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_DIRENT_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xreaddirparams; * * struct dirent *_XReaddir(DIR *dir_pointer, _Xreaddirparams); */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # include # if !defined(X_NOT_POSIX) || defined(SYSV) || defined(USG) # include # else # include # ifndef dirent # define dirent direct # endif # endif # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI) # define XOS_USE_MTSAFE_DIRENTAPI 1 # endif #endif #if !defined(X_INCLUDE_DIRENT_H) || defined(_XOS_INCLUDED_DIRENT_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xreaddirparams; /* dummy */ # define _XReaddir(d,p) readdir(d) #elif !defined(XOS_USE_MTSAFE_DIRENTAPI) || defined(XNO_MTSAFE_DIRENTAPI) /* Systems with thread support but no _r API. */ typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #else typedef struct { struct dirent *result; struct dirent dir_entry; # ifdef _POSIX_PATH_MAX char buf[_POSIX_PATH_MAX]; # elif defined(NAME_MAX) char buf[NAME_MAX]; # else char buf[255]; # endif } _Xreaddirparams; # if defined(AIXV3) || defined(AIXV4) || defined(_POSIX_THREAD_SAFE_FUNCTIONS) /* AIX defines the draft POSIX symbol, but uses the final API. */ /* POSIX final API, returns (int)0 on success. */ # if defined(__osf__) /* OSF/1 V4.0 doesn't declare _Preaddir_r, breaking under C++. */ extern int _Preaddir_r(DIR *, struct dirent *, struct dirent **); # endif # define _XReaddir(d,p) \ (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result) # elif defined(_POSIX_REENTRANT_FUNCTIONS) && defined(__osf__) /* * OSF/1 V3.2 readdir_r() will SEGV if the main program is not * explicitly linked with -lc_r. The library REQUIREDLIBS don't help. * Assume that if threads have been initialized we're linked properly. */ # define _XReaddir(d,p) \ ( (_Xos_isThreadInitialized) ? \ (readdir_r((d), &((p).dir_entry)) ? NULL : &((p).dir_entry)) : \ ((_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result) ) # elif defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX draft API, returns (int)0 on success. */ # define _XReaddir(d,p) \ (readdir_r((d),&((p).dir_entry)) ? NULL : &((p).dir_entry)) # elif defined(SVR4) /* Pre-POSIX API, returns non-NULL on success. */ # define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry)) # else /* We have no idea what is going on. Fake it all using process locks. */ # define _XReaddir(d,p) \ ( (_Xos_processLock), \ (((p).result = readdir((d))) ? \ (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ ((p).result = &(p).dir_entry), 0) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # endif #endif /* X_INCLUDE_DIRENT_H */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # define _XOS_INCLUDED_DIRENT_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_UNISTD_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetloginparams; * typedef ... _Xttynameparams; * * char *_XGetlogin(_Xgetloginparams); * char *_XTtyname(int, _Xttynameparams); */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) /* already included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI) # define XOS_USE_MTSAFE_UNISTDAPI 1 # endif #endif #if !defined(X_INCLUDE_UNISTD_H) || defined(_XOS_INCLUDED_UNISTD_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetloginparams; /* dummy */ typedef int _Xttynameparams; /* dummy */ # define _XGetlogin(p) getlogin() # define _XTtyname(f) ttyname((f)) #elif !defined(XOS_USE_MTSAFE_UNISTDAPI) || defined(XNO_MTSAFE_UNISTDAPI) /* Systems with thread support but no _r API. */ typedef struct { char *result; # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { char *result; # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) \ ( (_Xos_processLock), \ (((p).result = getlogin()) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #define _XTtyname(f,p) \ ( (_Xos_processLock), \ (((p).result = ttyname(f)) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), \ ((p).buf[sizeof((p).buf)-1] = '\0'), \ ((p).result = (p).buf), 0) : 0), \ (_Xos_processUnlock), \ (p).result ) #elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX API. * * extern int getlogin_r(char *, size_t); * extern int ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) (getlogin_r((p).buf, sizeof((p).buf)) ? NULL : (p).buf) # define _XTtyname(f,p) \ (ttyname_r((f), (p).buf, sizeof((p).buf)) ? NULL : (p).buf) #else /* Pre-POSIX API. * * extern char *getlogin_r(char *, size_t); * extern char *ttyname_r(int, char *, size_t); */ typedef struct { # if defined(MAXLOGNAME) char buf[MAXLOGNAME]; # elif defined(LOGIN_NAME_MAX) char buf[LOGIN_NAME_MAX]; # else char buf[64]; # endif } _Xgetloginparams; typedef struct { # ifdef TTY_NAME_MAX char buf[TTY_NAME_MAX]; # elif defined(_POSIX_TTY_NAME_MAX) char buf[_POSIX_TTY_NAME_MAX]; # elif defined(_POSIX_PATH_MAX) char buf[_POSIX_PATH_MAX]; # else char buf[256]; # endif } _Xttynameparams; # define _XGetlogin(p) getlogin_r((p).buf, sizeof((p).buf)) # define _XTtyname(f,p) ttyname_r((f), (p).buf, sizeof((p).buf)) #endif /* X_INCLUDE_UNISTD_H */ #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H) # define _XOS_INCLUDED_UNISTD_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_STRING_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xstrtokparams; * * char *_XStrtok(char *, const char*, _Xstrtokparams); */ #if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H) /* has already been included by */ # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI) # define XOS_USE_MTSAFE_STRINGAPI 1 # endif #endif #if !defined(X_INCLUDE_STRING_H) || defined(_XOS_INCLUDED_STRING_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xstrtokparams; /* dummy */ # define _XStrtok(s1,s2,p) strtok((s1),(s2)) #elif !defined(XOS_USE_MTSAFE_STRINGAPI) || defined(XNO_MTSAFE_STRINGAPI) /* Systems with thread support but no _r API. */ typedef char *_Xstrtokparams; # define _XStrtok(s1,s2,p) \ ( (_Xos_processLock), \ ((p) = strtok((s1),(s2))), \ (_Xos_processUnlock), \ (p) ) #else /* POSIX or pre-POSIX API. */ typedef char * _Xstrtokparams; # define _XStrtok(s1,s2,p) strtok_r((s1),(s2),&(p)) #endif /* X_INCLUDE_STRING_H */ /***** wrappers *****/ /* * Effective prototypes for wrappers: * * #define X_INCLUDE_TIME_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xatimeparams; * typedef ... _Xctimeparams; * typedef ... _Xgtimeparams; * typedef ... _Xltimeparams; * * char *_XAsctime(const struct tm *, _Xatimeparams); * char *_XCtime(const time_t *, _Xctimeparams); * struct tm *_XGmtime(const time_t *, _Xgtimeparams); * struct tm *_XLocaltime(const time_t *, _Xltimeparams); */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI) # define XOS_USE_MTSAFE_TIMEAPI 1 # endif #endif #if !defined(X_INCLUDE_TIME_H) || defined(_XOS_INCLUDED_TIME_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xatimeparams; /* dummy */ # define _XAsctime(t,p) asctime((t)) typedef int _Xctimeparams; /* dummy */ # define _XCtime(t,p) ctime((t)) typedef int _Xgtimeparams; /* dummy */ # define _XGmtime(t,p) gmtime((t)) typedef int _Xltimeparams; /* dummy */ # define _XLocaltime(t,p) localtime((t)) #elif !defined(XOS_USE_MTSAFE_TIMEAPI) || defined(XNO_MTSAFE_TIMEAPI) /* Systems with thread support but no _r API. */ typedef struct { # ifdef TIMELEN char buf[TIMELEN]; # else char buf[26]; # endif char *result; } _Xctimeparams, _Xatimeparams; typedef struct { struct tm buf; struct tm *result; } _Xgtimeparams, _Xltimeparams; # define _XAsctime(t,p) \ ( (_Xos_processLock), \ (((p).result = asctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XCtime(t,p) \ ( (_Xos_processLock), \ (((p).result = ctime((t))) ? \ (strncpy((p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XGmtime(t,p) \ ( (_Xos_processLock), \ (((p).result = gmtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) # define _XLocaltime(t,p) \ ( (_Xos_processLock), \ (((p).result = localtime(t)) ? \ (memcpy(&(p).buf, (p).result, sizeof((p).buf)), (p).result = &(p).buf) : \ 0), \ (_Xos_processUnlock), \ (p).result ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (defined(__osf__) || defined(hpV4)) /* Returns (int)0 on success. OSF/1 v3.2, HP/UX 10 * * extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen); * extern int ctime_r(const time_t *timer, char *buffer, int buflen); * extern int gmtime_r(const time_t *timer, struct tm *result); * extern int localtime_r(const time_t *timer, struct tm *result); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) (asctime_r((t),(p),sizeof((p))) ? NULL : (p)) # define _XCtime(t,p) (ctime_r((t),(p),sizeof((p))) ? NULL : (p)) # define _XGmtime(t,p) (gmtime_r((t),&(p)) ? NULL : &(p)) # define _XLocaltime(t,p) (localtime_r((t),&(p)) ? NULL : &(p)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(sun) /* Returns NULL on failure. Solaris 2.5 * * extern char *asctime_r(const struct tm *tm,char *buf, int buflen); * extern char *ctime_r(const time_t *clock, char *buf, int buflen); * extern struct tm *gmtime_r(const time_t *clock, struct tm *res); * extern struct tm *localtime_r(const time_t *clock, struct tm *res); */ # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p),sizeof((p))) # define _XCtime(t,p) ctime_r((t),(p),sizeof((p))) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */ /* POSIX final API. OSF/1 v4.0, AIX, etc. * * extern char *asctime_r(const struct tm *timeptr, char *buffer); * extern char *ctime_r(const time_t *timer, char *buffer); * extern struct tm *gmtime_r(const time_t *timer, struct tm *result); * extern struct tm *localtime_r(const time_t *timer, struct tm *result); */ # if defined(__osf__) /* OSF/1 V4.0 doesn't declare the _P routines, breaking under C++. */ extern char *_Pasctime_r(const struct tm *, char *); extern char *_Pctime_r(const time_t *, char *); extern struct tm *_Plocaltime_r(const time_t *, struct tm *); # endif # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; # else typedef char _Xatimeparams[26]; typedef char _Xctimeparams[26]; # endif typedef struct tm _Xgtimeparams; typedef struct tm _Xltimeparams; # define _XAsctime(t,p) asctime_r((t),(p)) # define _XCtime(t,p) ctime_r((t),(p)) # define _XGmtime(t,p) gmtime_r((t),&(p)) # define _XLocaltime(t,p) localtime_r((t),&(p)) #endif /* X_INCLUDE_TIME_H */ #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H) # define _XOS_INCLUDED_TIME_H #endif /***** wrappers *****/ /* * Effective prototypes for wrappers: * * NOTE: On systems lacking appropriate _r functions Getgrgid() and * Getgrnam() do NOT copy the list of group members! * * Remember that fgetgrent(), setgrent(), getgrent(), and endgrent() * are not included in POSIX. * * #define X_INCLUDE_GRP_H * #define XOS_USE_..._LOCKING * #include * * typedef ... _Xgetgrparams; * * struct group *_XGetgrgid(gid_t, _Xgetgrparams); * struct group *_XGetgrnam(const char *, _Xgetgrparams); */ #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # include # if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI) # define XOS_USE_MTSAFE_GRPAPI 1 # endif #endif #if !defined(X_INCLUDE_GRP_H) || defined(_XOS_INCLUDED_GRP_H) /* Do nothing. */ #elif !defined(XTHREADS) && !defined(X_FORCE_USE_MTSAFE_API) /* Use regular, unsafe API. */ typedef int _Xgetgrparams; /* dummy */ #define _XGetgrgid(g,p) getgrgid((g)) #define _XGetgrnam(n,p) getgrnam((n)) #elif !defined(XOS_USE_MTSAFE_GRPAPI) || defined(XNO_MTSAFE_GRPAPI) /* Systems with thread support but no _r API. UnixWare 2.0. */ typedef struct { struct group grp; #ifdef LINE_MAX char buf[LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #else char buf[1024]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #endif struct group *pgrp; size_t len; } _Xgetgrparams; #ifdef SVR4 /* Copy the gr_passwd field too. */ # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ ((p).len = strlen((p).pgrp->gr_name)), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \ ((p).pgrp = &(p).grp), \ 0 ) #else # define _Xgrp_copyGroup(p) \ ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \ ((p).grp.gr_name = (p).buf), \ strcpy((p).grp.gr_name, (p).pgrp->gr_name), \ ((p).pgrp = &(p).grp), \ 0 ) #endif #define _XGetgrgid(g,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrgid((g))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #define _XGetgrnam(n,p) \ ( (_Xos_processLock), \ (((p).pgrp = getgrnam((n))) ? _Xgrp_copyGroup(p) : 0), \ (_Xos_processUnlock), \ (p).pgrp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (defined(sun) || defined(__osf__)) /* Non-POSIX API. Solaris, DEC v3.2. * * extern struct group *getgrgid_r(gid_t, struct group *, char *, int); * extern struct group *getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; #ifdef LINE_MAX char buf[LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #else char buf[1024]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #endif } _Xgetgrparams; #define _XGetgrgid(g,p) getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) #define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) /* Non-POSIX API. HP/UX 10, AIX 4. * * extern int getgrgid_r(gid_t, struct group *, char *, int); * extern int getgrnam_r(const char *, struct group *, char *, int); */ typedef struct { struct group grp; #ifdef LINE_MAX char buf[LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #else char buf[1024]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #endif } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #else /* POSIX final API. DEC v4.0, IRIX 6.2. * * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); */ # if defined(__osf__) /* OSF/1 V4.0 doesn't declare the _P routines, breaking under C++. */ extern int _Pgetgrgid_r(gid_t, struct group *, char *, size_t, struct group **); extern int _Pgetgrnam_r(const char *, struct group *, char *, size_t, struct group **); # endif typedef struct { struct group grp; #ifdef LINE_MAX char buf[LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #else char buf[1024]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ #endif struct group *result; } _Xgetgrparams; #define _XGetgrgid(g,p) \ ((getgrgid_r((g), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #define _XGetgrnam(n,p) \ ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf), &(p).result) ? \ NULL : (p).result)) #endif #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H) # define _XOS_INCLUDED_GRP_H #endif #ifdef __cplusplus } /* Close scope of 'extern "C"' declaration which encloses file. */ #endif vnc_unixsrc/Xvnc/include/Xproto.h0100664000076400007640000015544207120677563016525 0ustar constconst/* * $XConsortium: Xproto.h /main/21 1996/03/20 15:27:51 mor $ */ /* Definitions for the X window system used by server and c bindings */ /* * This packet-construction scheme makes the following assumptions: * * 1. The compiler is able * to generate code which addresses one- and two-byte quantities. * In the worst case, this would be done with bit-fields. If bit-fields * are used it may be necessary to reorder the request fields in this file, * depending on the order in which the machine assigns bit fields to * machine words. There may also be a problem with sign extension, * as K+R specify that bitfields are always unsigned. * * 2. 2- and 4-byte fields in packet structures must be ordered by hand * such that they are naturally-aligned, so that no compiler will ever * insert padding bytes. * * 3. All packets are hand-padded to a multiple of 4 bytes, for * the same reason. */ #ifndef XPROTO_H #define XPROTO_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include #include /* * Define constants for the sizes of the network packets. The sz_ prefix is * used instead of something more descriptive so that the symbols are no more * than 32 characters in length (which causes problems for some compilers). */ #define sz_xSegment 8 #define sz_xPoint 4 #define sz_xRectangle 8 #define sz_xArc 12 #define sz_xConnClientPrefix 12 #define sz_xConnSetupPrefix 8 #define sz_xConnSetup 32 #define sz_xPixmapFormat 8 #define sz_xDepth 8 #define sz_xVisualType 24 #define sz_xWindowRoot 40 #define sz_xTimecoord 8 #define sz_xHostEntry 4 #define sz_xCharInfo 12 #define sz_xFontProp 8 #define sz_xTextElt 2 #define sz_xColorItem 12 #define sz_xrgb 8 #define sz_xGenericReply 32 #define sz_xGetWindowAttributesReply 44 #define sz_xGetGeometryReply 32 #define sz_xQueryTreeReply 32 #define sz_xInternAtomReply 32 #define sz_xGetAtomNameReply 32 #define sz_xGetPropertyReply 32 #define sz_xListPropertiesReply 32 #define sz_xGetSelectionOwnerReply 32 #define sz_xGrabPointerReply 32 #define sz_xQueryPointerReply 32 #define sz_xGetMotionEventsReply 32 #define sz_xTranslateCoordsReply 32 #define sz_xGetInputFocusReply 32 #define sz_xQueryKeymapReply 40 #define sz_xQueryFontReply 60 #define sz_xQueryTextExtentsReply 32 #define sz_xListFontsReply 32 #define sz_xGetFontPathReply 32 #define sz_xGetImageReply 32 #define sz_xListInstalledColormapsReply 32 #define sz_xAllocColorReply 32 #define sz_xAllocNamedColorReply 32 #define sz_xAllocColorCellsReply 32 #define sz_xAllocColorPlanesReply 32 #define sz_xQueryColorsReply 32 #define sz_xLookupColorReply 32 #define sz_xQueryBestSizeReply 32 #define sz_xQueryExtensionReply 32 #define sz_xListExtensionsReply 32 #define sz_xSetMappingReply 32 #define sz_xGetKeyboardControlReply 52 #define sz_xGetPointerControlReply 32 #define sz_xGetScreenSaverReply 32 #define sz_xListHostsReply 32 #define sz_xSetModifierMappingReply 32 #define sz_xError 32 #define sz_xEvent 32 #define sz_xKeymapEvent 32 #define sz_xReq 4 #define sz_xResourceReq 8 #define sz_xCreateWindowReq 32 #define sz_xChangeWindowAttributesReq 12 #define sz_xChangeSaveSetReq 8 #define sz_xReparentWindowReq 16 #define sz_xConfigureWindowReq 12 #define sz_xCirculateWindowReq 8 #define sz_xInternAtomReq 8 #define sz_xChangePropertyReq 24 #define sz_xDeletePropertyReq 12 #define sz_xGetPropertyReq 24 #define sz_xSetSelectionOwnerReq 16 #define sz_xConvertSelectionReq 24 #define sz_xSendEventReq 44 #define sz_xGrabPointerReq 24 #define sz_xGrabButtonReq 24 #define sz_xUngrabButtonReq 12 #define sz_xChangeActivePointerGrabReq 16 #define sz_xGrabKeyboardReq 16 #define sz_xGrabKeyReq 16 #define sz_xUngrabKeyReq 12 #define sz_xAllowEventsReq 8 #define sz_xGetMotionEventsReq 16 #define sz_xTranslateCoordsReq 16 #define sz_xWarpPointerReq 24 #define sz_xSetInputFocusReq 12 #define sz_xOpenFontReq 12 #define sz_xQueryTextExtentsReq 8 #define sz_xListFontsReq 8 #define sz_xSetFontPathReq 8 #define sz_xCreatePixmapReq 16 #define sz_xCreateGCReq 16 #define sz_xChangeGCReq 12 #define sz_xCopyGCReq 16 #define sz_xSetDashesReq 12 #define sz_xSetClipRectanglesReq 12 #define sz_xCopyAreaReq 28 #define sz_xCopyPlaneReq 32 #define sz_xPolyPointReq 12 #define sz_xPolySegmentReq 12 #define sz_xFillPolyReq 16 #define sz_xPutImageReq 24 #define sz_xGetImageReq 20 #define sz_xPolyTextReq 16 #define sz_xImageTextReq 16 #define sz_xCreateColormapReq 16 #define sz_xCopyColormapAndFreeReq 12 #define sz_xAllocColorReq 16 #define sz_xAllocNamedColorReq 12 #define sz_xAllocColorCellsReq 12 #define sz_xAllocColorPlanesReq 16 #define sz_xFreeColorsReq 12 #define sz_xStoreColorsReq 8 #define sz_xStoreNamedColorReq 16 #define sz_xQueryColorsReq 8 #define sz_xLookupColorReq 12 #define sz_xCreateCursorReq 32 #define sz_xCreateGlyphCursorReq 32 #define sz_xRecolorCursorReq 20 #define sz_xQueryBestSizeReq 12 #define sz_xQueryExtensionReq 8 #define sz_xChangeKeyboardControlReq 8 #define sz_xBellReq 4 #define sz_xChangePointerControlReq 12 #define sz_xSetScreenSaverReq 12 #define sz_xChangeHostsReq 8 #define sz_xListHostsReq 4 #define sz_xChangeModeReq 4 #define sz_xRotatePropertiesReq 12 #define sz_xReply 32 #define sz_xGrabKeyboardReply 32 #define sz_xListFontsWithInfoReply 60 #define sz_xSetPointerMappingReply 32 #define sz_xGetKeyboardMappingReply 32 #define sz_xGetPointerMappingReply 32 #define sz_xGetModifierMappingReply 32 #define sz_xListFontsWithInfoReq 8 #define sz_xPolyLineReq 12 #define sz_xPolyArcReq 12 #define sz_xPolyRectangleReq 12 #define sz_xPolyFillRectangleReq 12 #define sz_xPolyFillArcReq 12 #define sz_xPolyText8Req 16 #define sz_xPolyText16Req 16 #define sz_xImageText8Req 16 #define sz_xImageText16Req 16 #define sz_xSetPointerMappingReq 4 #define sz_xForceScreenSaverReq 4 #define sz_xSetCloseDownModeReq 4 #define sz_xClearAreaReq 16 #define sz_xSetAccessControlReq 4 #define sz_xGetKeyboardMappingReq 8 #define sz_xSetModifierMappingReq 4 #define sz_xPropIconSize 24 #define sz_xChangeKeyboardMappingReq 8 /* For the purpose of the structure definitions in this file, we must redefine the following types in terms of Xmd.h's types, which may include bit fields. All of these are #undef'd at the end of this file, restoring the definitions in X.h. */ #define Window CARD32 #define Drawable CARD32 #define Font CARD32 #define Pixmap CARD32 #define Cursor CARD32 #define Colormap CARD32 #define GContext CARD32 #define Atom CARD32 #define VisualID CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define X_TCP_PORT 6000 /* add display number */ #define xTrue 1 #define xFalse 0 typedef CARD16 KeyButMask; /***************** connection setup structure. This is followed by numRoots xWindowRoot structs. *****************/ typedef struct { CARD8 byteOrder; BYTE pad; CARD16 majorVersion B16, minorVersion B16; CARD16 nbytesAuthProto B16; /* Authorization protocol */ CARD16 nbytesAuthString B16; /* Authorization string */ CARD16 pad2 B16; } xConnClientPrefix; typedef struct { CARD8 success; BYTE lengthReason; /*num bytes in string following if failure */ CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ } xConnSetupPrefix; typedef struct { CARD32 release B32; CARD32 ridBase B32, ridMask B32; CARD32 motionBufferSize B32; CARD16 nbytesVendor B16; /* number of bytes in vendor string */ CARD16 maxRequestSize B16; CARD8 numRoots; /* number of roots structs to follow */ CARD8 numFormats; /* number of pixmap formats */ CARD8 imageByteOrder; /* LSBFirst, MSBFirst */ CARD8 bitmapBitOrder; /* LeastSignificant, MostSign...*/ CARD8 bitmapScanlineUnit, /* 8, 16, 32 */ bitmapScanlinePad; /* 8, 16, 32 */ KeyCode minKeyCode, maxKeyCode; CARD32 pad2 B32; } xConnSetup; typedef struct { CARD8 depth; CARD8 bitsPerPixel; CARD8 scanLinePad; CARD8 pad1; CARD32 pad2 B32; } xPixmapFormat; /* window root */ typedef struct { CARD8 depth; CARD8 pad1; CARD16 nVisuals B16; /* number of xVisualType structures following */ CARD32 pad2 B32; } xDepth; typedef struct { VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD8 bitsPerRGB; CARD16 colormapEntries B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad B32; } xVisualType; typedef struct { Window windowId B32; Colormap defaultColormap B32; CARD32 whitePixel B32, blackPixel B32; CARD32 currentInputMask B32; CARD16 pixWidth B16, pixHeight B16; CARD16 mmWidth B16, mmHeight B16; CARD16 minInstalledMaps B16, maxInstalledMaps B16; VisualID rootVisualID B32; CARD8 backingStore; BOOL saveUnders; CARD8 rootDepth; CARD8 nDepths; /* number of xDepth structures following */ } xWindowRoot; /***************************************************************** * Structure Defns * Structures needed for replies *****************************************************************/ /* Used in GetMotionEvents */ typedef struct { CARD32 time B32; INT16 x B16, y B16; } xTimecoord; typedef struct { CARD8 family; BYTE pad; CARD16 length B16; } xHostEntry; typedef struct { INT16 leftSideBearing B16, rightSideBearing B16, characterWidth B16, ascent B16, descent B16; CARD16 attributes B16; } xCharInfo; typedef struct { Atom name B32; CARD32 value B32; } xFontProp; /* * non-aligned big-endian font ID follows this struct */ typedef struct { /* followed by string */ CARD8 len; /* number of *characters* in string, or FontChange (255) for font change, or 0 if just delta given */ INT8 delta; } xTextElt; typedef struct { CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD8 flags; /* DoRed, DoGreen, DoBlue booleans */ CARD8 pad; } xColorItem; typedef struct { CARD16 red B16, green B16, blue B16, pad B16; } xrgb; typedef CARD8 KEYCODE; /***************** * XRep: * meant to be 32 byte quantity *****************/ /* GenericReply is the common format of all replies. The "data" items are specific to each individual reply type. */ typedef struct { BYTE type; /* X_Reply */ BYTE data1; /* depends on reply type */ CARD16 sequenceNumber B16; /* of last request received by server */ CARD32 length B32; /* 4 byte quantities beyond size of GenericReply */ CARD32 data00 B32; CARD32 data01 B32; CARD32 data02 B32; CARD32 data03 B32; CARD32 data04 B32; CARD32 data05 B32; } xGenericReply; /* Individual reply formats. */ typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad B16; } xGetWindowAttributesReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xGetGeometryReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; Window root B32, parent B32; CARD16 nChildren B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xQueryTreeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Atom atom B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xInternAtomReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ CARD16 nameLength B16; /* # of characters in name */ CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetAtomNameReply; typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; /* of additional bytes */ Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xGetPropertyReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nProperties B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListPropertiesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window owner B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetSelectionOwnerReply; typedef struct { BYTE type; /* X_Reply */ BYTE status; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGrabPointerReply; typedef xGrabPointerReply xGrabKeyboardReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window root B32, child B32; INT16 rootX B16, rootY B16, winX B16, winY B16; CARD16 mask B16; CARD16 pad1 B16; CARD32 pad B32; } xQueryPointerReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetMotionEventsReply; typedef struct { BYTE type; /* X_Reply */ BOOL sameScreen; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window child B32; INT16 dstX B16, dstY B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xTranslateCoordsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 revertTo; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ Window focus B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xGetInputFocusReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 2, NOT 0; this is an extra-large reply */ BYTE map[32]; } xQueryKeymapReply; /* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */ typedef struct _xQueryFontReply { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nCharInfos" is 0 */ xCharInfo minBounds; #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */ } xQueryFontReply; typedef struct { BYTE type; /* X_Reply */ CARD8 drawDirection; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ INT16 fontAscent B16, fontDescent B16; INT16 overallAscent B16, overallDescent B16; INT32 overallWidth B32, overallLeft B32, overallRight B32; CARD32 pad B32; } xQueryTextExtentsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nFonts B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListFontsReply; /* Warning: this MUST match (up to component renaming) xQueryFontReply */ typedef struct { BYTE type; /* X_Reply */ CARD8 nameLength; /* 0 indicates end-of-reply-sequence */ CARD16 sequenceNumber B16; CARD32 length B32; /* definitely > 0, even if "nameLength" is 0 */ xCharInfo minBounds; #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nReplies B32; /* hint as to how many more replies might be coming */ } xListFontsWithInfoReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPaths B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetFontPathReply; typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetImageReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColormaps B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListInstalledColormapsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; CARD32 pixel B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xAllocColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pixel B32; CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad2 B32; CARD32 pad3 B32; } xAllocNamedColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16, nMasks B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xAllocColorCellsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nPixels B16; CARD16 pad2 B16; CARD32 redMask B32, greenMask B32, blueMask B32; CARD32 pad3 B32; CARD32 pad4 B32; } xAllocColorPlanesReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nColors B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryColorsReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 exactRed B16, exactGreen B16, exactBlue B16; CARD16 screenRed B16, screenGreen B16, screenBlue B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLookupColorReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 width B16, height B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryBestSizeReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xQueryExtensionReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListExtensionsReply; typedef struct { BYTE type; /* X_Reply */ CARD8 success; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xSetMappingReply; typedef xSetMappingReply xSetPointerMappingReply; typedef xSetMappingReply xSetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ CARD8 nElts; /* how many elements does the map have */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetPointerMappingReply; typedef struct { BYTE type; CARD8 keySymsPerKeyCode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xGetKeyboardMappingReply; typedef struct { BYTE type; CARD8 numKeyPerModifier; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetModifierMappingReply; typedef struct { BYTE type; /* X_Reply */ BOOL globalAutoRepeat; CARD16 sequenceNumber B16; CARD32 length B32; /* 5 */ CARD32 ledMask B32; CARD8 keyClickPercent, bellPercent; CARD16 bellPitch B16, bellDuration B16; CARD16 pad B16; BYTE map[32]; /* bit masks start here */ } xGetKeyboardControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 accelNumerator B16, accelDenominator B16; CARD16 threshold B16; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetPointerControlReply; typedef struct { BYTE type; /* X_Reply */ BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD16 timeout B16, interval B16; BOOL preferBlanking; BOOL allowExposures; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetScreenSaverReply; typedef struct { BYTE type; /* X_Reply */ BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nHosts B16; CARD16 pad1 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xListHostsReply; /***************************************************************** * Xerror * All errors are 32 bytes *****************************************************************/ typedef struct { BYTE type; /* X_Error */ BYTE errorCode; CARD16 sequenceNumber B16; /* the nth request from this client */ CARD32 resourceID B32; CARD16 minorCode B16; CARD8 majorCode; BYTE pad1; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xError; /***************************************************************** * xEvent * All events are 32 bytes *****************************************************************/ typedef struct _xEvent { union { struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; } u; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BOOL sameScreen; BYTE pad1; } keyButtonPointer; struct { CARD32 pad00 B32; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BYTE mode; /* really XMode */ BYTE flags; /* sameScreen and focus booleans, packed together */ #define ELFlagFocus (1<<0) #define ELFlagSameScreen (1<<1) } enterLeave; struct { CARD32 pad00 B32; Window window B32; BYTE mode; /* really XMode */ BYTE pad1, pad2, pad3; } focus; struct { CARD32 pad00 B32; Window window B32; CARD16 x B16, y B16, width B16, height B16; CARD16 count B16; CARD16 pad2 B16; } expose; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 x B16, y B16, width B16, height B16; CARD16 minorEvent B16; CARD16 count B16; BYTE majorEvent; BYTE pad1, pad2, pad3; } graphicsExposure; struct { CARD32 pad00 B32; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad; } noExposure; struct { CARD32 pad00 B32; Window window B32; CARD8 state; BYTE pad1, pad2, pad3; } visibility; struct { CARD32 pad00 B32; Window parent B32, window B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } createNotify; /* * The event feilds in the structures for DestroyNotify, UnmapNotify, * MapNotify, ReparentNotify, ConfigureNotify, CirclulateNotify, GravityNotify, * must be at the same offset because server internal code is depending upon * this to patch up the events before they are delivered. * Also note that MapRequest, ConfigureRequest and CirculateRequest have * the same offset for the event window. */ struct { CARD32 pad00 B32; Window event B32, window B32; } destroyNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL fromConfigure; BYTE pad1, pad2, pad3; } unmapNotify; struct { CARD32 pad00 B32; Window event B32, window B32; BOOL override; BYTE pad1, pad2, pad3; } mapNotify; struct { CARD32 pad00 B32; Window parent B32, window B32; } mapRequest; struct { CARD32 pad00 B32; Window event B32, window B32, parent B32; INT16 x B16, y B16; BOOL override; BYTE pad1, pad2, pad3; } reparent; struct { CARD32 pad00 B32; Window event B32, window B32, aboveSibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BOOL override; BYTE bpad; } configureNotify; struct { CARD32 pad00 B32; Window parent B32, window B32, sibling B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; CARD16 valueMask B16; CARD32 pad1 B32; } configureRequest; struct { CARD32 pad00 B32; Window event B32, window B32; INT16 x B16, y B16; CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32; } gravity; struct { CARD32 pad00 B32; Window window B32; CARD16 width B16, height B16; } resizeRequest; struct { /* The event field in the circulate record is really the parent when this is used as a CirculateRequest insteaad of a CircluateNotify */ CARD32 pad00 B32; Window event B32, window B32, parent B32; BYTE place; /* Top or Bottom */ BYTE pad1, pad2, pad3; } circulate; struct { CARD32 pad00 B32; Window window B32; Atom atom B32; Time time B32; BYTE state; /* NewValue or Deleted */ BYTE pad1; CARD16 pad2 B16; } property; struct { CARD32 pad00 B32; Time time B32; Window window B32; Atom atom B32; } selectionClear; struct { CARD32 pad00 B32; Time time B32; Window owner B32, requestor B32; Atom selection B32, target B32, property B32; } selectionRequest; struct { CARD32 pad00 B32; Time time B32; Window requestor B32; Atom selection B32, target B32, property B32; } selectionNotify; struct { CARD32 pad00 B32; Window window B32; Colormap colormap B32; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_new; #else BOOL new; #endif BYTE state; /* Installed or UnInstalled */ BYTE pad1, pad2; } colormap; struct { CARD32 pad00 B32; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } mappingNotify; struct { CARD32 pad00 B32; Window window B32; union { struct { Atom type B32; INT32 longs0 B32; INT32 longs1 B32; INT32 longs2 B32; INT32 longs3 B32; INT32 longs4 B32; } l; struct { Atom type B32; INT16 shorts0 B16; INT16 shorts1 B16; INT16 shorts2 B16; INT16 shorts3 B16; INT16 shorts4 B16; INT16 shorts5 B16; INT16 shorts6 B16; INT16 shorts7 B16; INT16 shorts8 B16; INT16 shorts9 B16; } s; struct { Atom type B32; INT8 bytes[20]; } b; } u; } clientMessage; } u; } xEvent; /* KeymapNotify events are not included in the above union because they are different from all other events: they do not have a "detail" or "sequenceNumber", so there is room for a 248-bit key mask. */ typedef struct { BYTE type; BYTE map[31]; } xKeymapEvent; #define XEventSize (sizeof(xEvent)) /* XReply is the union of all the replies above whose "fixed part" fits in 32 bytes. It does NOT include GetWindowAttributesReply, QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply ListFontsWithInfoReply */ typedef union { xGenericReply generic; xGetGeometryReply geom; xQueryTreeReply tree; xInternAtomReply atom; xGetAtomNameReply atomName; xGetPropertyReply property; xListPropertiesReply listProperties; xGetSelectionOwnerReply selection; xGrabPointerReply grabPointer; xGrabKeyboardReply grabKeyboard; xQueryPointerReply pointer; xGetMotionEventsReply motionEvents; xTranslateCoordsReply coords; xGetInputFocusReply inputFocus; xQueryTextExtentsReply textExtents; xListFontsReply fonts; xGetFontPathReply fontPath; xGetImageReply image; xListInstalledColormapsReply colormaps; xAllocColorReply allocColor; xAllocNamedColorReply allocNamedColor; xAllocColorCellsReply colorCells; xAllocColorPlanesReply colorPlanes; xQueryColorsReply colors; xLookupColorReply lookupColor; xQueryBestSizeReply bestSize; xQueryExtensionReply extension; xListExtensionsReply extensions; xSetModifierMappingReply setModifierMapping; xGetModifierMappingReply getModifierMapping; xSetPointerMappingReply setPointerMapping; xGetKeyboardMappingReply getKeyboardMapping; xGetPointerMappingReply getPointerMapping; xGetPointerControlReply pointerControl; xGetScreenSaverReply screenSaver; xListHostsReply hosts; xError error; xEvent event; } xReply; /***************************************************************** * REQUESTS *****************************************************************/ /* Request structure */ typedef struct _xReq { CARD8 reqType; CARD8 data; /* meaning depends on request type */ CARD16 length B16; /* length in 4 bytes quantities of whole request, including this header */ } xReq; /***************************************************************** * structures that follow request. *****************************************************************/ /* ResourceReq is used for any request which has a resource ID (or Atom or Time) as its one and only argument. */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 id B32; /* a Window, Drawable, Font, GContext, Pixmap, etc. */ } xResourceReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Window wid B32, parent B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif VisualID visual B32; CARD32 mask B32; } xCreateWindowReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD32 valueMask B32; } xChangeWindowAttributesReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; Window window B32; } xChangeSaveSetReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32, parent B32; INT16 x B16, y B16; } xReparentWindowReq; typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Window window B32; CARD16 mask B16; CARD16 pad2 B16; } xConfigureWindowReq; typedef struct { CARD8 reqType; CARD8 direction; CARD16 length B16; Window window B32; } xCirculateWindowReq; typedef struct { /* followed by padded string */ CARD8 reqType; BOOL onlyIfExists; CARD16 length B16; CARD16 nbytes B16; /* number of bytes in string */ CARD16 pad B16; } xInternAtomReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Window window B32; Atom property B32, type B32; CARD8 format; BYTE pad[3]; CARD32 nUnits B32; /* length of stuff following, depends on format */ } xChangePropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom property B32; } xDeletePropertyReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) BOOL c_delete; #else BOOL delete; #endif CARD16 length B16; Window window B32; Atom property B32, type B32; CARD32 longOffset B32; CARD32 longLength B32; } xGetPropertyReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Atom selection B32; Time time B32; } xSetSelectionOwnerReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window requestor B32; Atom selection B32, target B32, property B32; Time time B32; } xConvertSelectionReq; typedef struct { CARD8 reqType; BOOL propagate; CARD16 length B16; Window destination B32; CARD32 eventMask B32; #ifdef WORD64 /* the structure should have been quad-aligned */ BYTE eventdata[SIZEOF(xEvent)]; #else xEvent event; #endif /* WORD64 */ } xSendEventReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; Time time B32; } xGrabPointerReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 eventMask B16; BYTE pointerMode, keyboardMode; Window confineTo B32; Cursor cursor B32; CARD8 button; BYTE pad; CARD16 modifiers B16; } xGrabButtonReq; typedef struct { CARD8 reqType; CARD8 button; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabButtonReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; Time time B32; CARD16 eventMask B16; CARD16 pad2 B16; } xChangeActivePointerGrabReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; Time time B32; BYTE pointerMode, keyboardMode; CARD16 pad B16; } xGrabKeyboardReq; typedef struct { CARD8 reqType; BOOL ownerEvents; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 key; BYTE pointerMode, keyboardMode; BYTE pad1, pad2, pad3; } xGrabKeyReq; typedef struct { CARD8 reqType; CARD8 key; CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD16 pad B16; } xUngrabKeyReq; typedef struct { CARD8 reqType; CARD8 mode; CARD16 length B16; Time time B32; } xAllowEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; Time start B32, stop B32; } xGetMotionEventsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; } xTranslateCoordsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Window srcWid B32, dstWid B32; INT16 srcX B16, srcY B16; CARD16 srcWidth B16, srcHeight B16; INT16 dstX B16, dstY B16; } xWarpPointerReq; typedef struct { CARD8 reqType; CARD8 revertTo; CARD16 length B16; Window focus B32; Time time B32; } xSetInputFocusReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; CARD16 nbytes B16; BYTE pad1, pad2; /* string follows on word boundary */ } xOpenFontReq; typedef struct { CARD8 reqType; BOOL oddLength; CARD16 length B16; Font fid B32; } xQueryTextExtentsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 maxNames B16; CARD16 nbytes B16; /* followed immediately by string bytes */ } xListFontsReq; typedef xListFontsReq xListFontsWithInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nFonts B16; BYTE pad1, pad2; /* LISTofSTRING8 follows on word boundary */ } xSetFontPathReq; typedef struct { CARD8 reqType; CARD8 depth; CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16, height B16; } xCreatePixmapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; Drawable drawable B32; CARD32 mask B32; } xCreateGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD32 mask B32; } xChangeGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext srcGC B32, dstGC B32; CARD32 mask B32; } xCopyGCReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; GContext gc B32; CARD16 dashOffset B16; CARD16 nDashes B16; /* length LISTofCARD8 of values following */ } xSetDashesReq; typedef struct { CARD8 reqType; BYTE ordering; CARD16 length B16; GContext gc B32; INT16 xOrigin B16, yOrigin B16; } xSetClipRectanglesReq; typedef struct { CARD8 reqType; BOOL exposures; CARD16 length B16; Window window B32; INT16 x B16, y B16; CARD16 width B16, height B16; } xClearAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; } xCopyAreaReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable srcDrawable B32, dstDrawable B32; GContext gc B32; INT16 srcX B16, srcY B16, dstX B16, dstY B16; CARD16 width B16, height B16; CARD32 bitPlane B32; } xCopyPlaneReq; typedef struct { CARD8 reqType; BYTE coordMode; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolyPointReq; typedef xPolyPointReq xPolyLineReq; /* same request structure */ /* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */ typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; } xPolySegmentReq; typedef xPolySegmentReq xPolyArcReq; typedef xPolySegmentReq xPolyRectangleReq; typedef xPolySegmentReq xPolyFillRectangleReq; typedef xPolySegmentReq xPolyFillArcReq; typedef struct _FillPolyReq { CARD8 reqType; BYTE pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; BYTE shape; BYTE coordMode; CARD16 pad1 B16; } xFillPolyReq; typedef struct _PutImageReq { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 width B16, height B16; INT16 dstX B16, dstY B16; CARD8 leftPad; CARD8 depth; CARD16 pad B16; } xPutImageReq; typedef struct { CARD8 reqType; CARD8 format; CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; } xGetImageReq; /* the folloiwng used by PolyText8 and PolyText16 */ typedef struct { CARD8 reqType; CARD8 pad; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; /* items (xTextElt) start after struct */ } xPolyTextReq; typedef xPolyTextReq xPolyText8Req; typedef xPolyTextReq xPolyText16Req; typedef struct { CARD8 reqType; BYTE nChars; CARD16 length B16; Drawable drawable B32; GContext gc B32; INT16 x B16, y B16; } xImageTextReq; typedef xImageTextReq xImageText8Req; typedef xImageTextReq xImageText16Req; typedef struct { CARD8 reqType; BYTE alloc; CARD16 length B16; Colormap mid B32; Window window B32; VisualID visual B32; } xCreateColormapReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap mid B32; Colormap srcCmap B32; } xCopyColormapAndFreeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 red B16, green B16, blue B16; CARD16 pad2 B16; } xAllocColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* followed by structure */ BYTE pad1, pad2; } xAllocNamedColorReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, planes B16; } xAllocColorCellsReq; typedef struct { CARD8 reqType; BOOL contiguous; CARD16 length B16; Colormap cmap B32; CARD16 colors B16, red B16, green B16, blue B16; } xAllocColorPlanesReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD32 planeMask B32; } xFreeColorsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xStoreColorsReq; typedef struct { CARD8 reqType; CARD8 flags; /* DoRed, DoGreen, DoBlue, as in xColorItem */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 nbytes B16; /* number of name string bytes following structure */ BYTE pad1, pad2; } xStoreNamedColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; } xQueryColorsReq; typedef struct { /* followed by string of length len */ CARD8 reqType; BYTE pad; CARD16 length B16; Colormap cmap B32; CARD16 nbytes B16; /* number of string bytes following structure*/ BYTE pad1, pad2; } xLookupColorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Pixmap source B32, mask B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; CARD16 x B16, y B16; } xCreateCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cid B32; Font source B32, mask B32; CARD16 sourceChar B16, maskChar B16; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xCreateGlyphCursorReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Cursor cursor B32; CARD16 foreRed B16, foreGreen B16, foreBlue B16; CARD16 backRed B16, backGreen B16, backBlue B16; } xRecolorCursorReq; typedef struct { CARD8 reqType; #if defined(__cplusplus) || defined(c_plusplus) CARD8 c_class; #else CARD8 class; #endif CARD16 length B16; Drawable drawable B32; CARD16 width B16, height B16; } xQueryBestSizeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD16 nbytes B16; /* number of string bytes following structure */ BYTE pad1, pad2; } xQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 numKeyPerModifier; CARD16 length B16; } xSetModifierMappingReq; typedef struct { CARD8 reqType; CARD8 nElts; /* how many elements in the map */ CARD16 length B16; } xSetPointerMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xGetKeyboardMappingReq; typedef struct { CARD8 reqType; CARD8 keyCodes; CARD16 length B16; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD16 pad1 B16; } xChangeKeyboardMappingReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 mask B32; } xChangeKeyboardControlReq; typedef struct { CARD8 reqType; INT8 percent; /* -100 to 100 */ CARD16 length B16; } xBellReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 accelNum B16, accelDenum B16; INT16 threshold B16; BOOL doAccel, doThresh; } xChangePointerControlReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; INT16 timeout B16, interval B16; BYTE preferBlank, allowExpose; CARD16 pad2 B16; } xSetScreenSaverReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; CARD8 hostFamily; BYTE pad; CARD16 hostLength B16; } xChangeHostsReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; } xListHostsReq; typedef struct { CARD8 reqType; BYTE mode; CARD16 length B16; } xChangeModeReq; typedef xChangeModeReq xSetAccessControlReq; typedef xChangeModeReq xSetCloseDownModeReq; typedef xChangeModeReq xForceScreenSaverReq; typedef struct { /* followed by LIST of ATOM */ CARD8 reqType; BYTE pad; CARD16 length B16; Window window B32; CARD16 nAtoms B16; INT16 nPositions B16; } xRotatePropertiesReq; /* Reply codes */ #define X_Reply 1 /* Normal reply */ #define X_Error 0 /* Error */ /* Request codes */ #define X_CreateWindow 1 #define X_ChangeWindowAttributes 2 #define X_GetWindowAttributes 3 #define X_DestroyWindow 4 #define X_DestroySubwindows 5 #define X_ChangeSaveSet 6 #define X_ReparentWindow 7 #define X_MapWindow 8 #define X_MapSubwindows 9 #define X_UnmapWindow 10 #define X_UnmapSubwindows 11 #define X_ConfigureWindow 12 #define X_CirculateWindow 13 #define X_GetGeometry 14 #define X_QueryTree 15 #define X_InternAtom 16 #define X_GetAtomName 17 #define X_ChangeProperty 18 #define X_DeleteProperty 19 #define X_GetProperty 20 #define X_ListProperties 21 #define X_SetSelectionOwner 22 #define X_GetSelectionOwner 23 #define X_ConvertSelection 24 #define X_SendEvent 25 #define X_GrabPointer 26 #define X_UngrabPointer 27 #define X_GrabButton 28 #define X_UngrabButton 29 #define X_ChangeActivePointerGrab 30 #define X_GrabKeyboard 31 #define X_UngrabKeyboard 32 #define X_GrabKey 33 #define X_UngrabKey 34 #define X_AllowEvents 35 #define X_GrabServer 36 #define X_UngrabServer 37 #define X_QueryPointer 38 #define X_GetMotionEvents 39 #define X_TranslateCoords 40 #define X_WarpPointer 41 #define X_SetInputFocus 42 #define X_GetInputFocus 43 #define X_QueryKeymap 44 #define X_OpenFont 45 #define X_CloseFont 46 #define X_QueryFont 47 #define X_QueryTextExtents 48 #define X_ListFonts 49 #define X_ListFontsWithInfo 50 #define X_SetFontPath 51 #define X_GetFontPath 52 #define X_CreatePixmap 53 #define X_FreePixmap 54 #define X_CreateGC 55 #define X_ChangeGC 56 #define X_CopyGC 57 #define X_SetDashes 58 #define X_SetClipRectangles 59 #define X_FreeGC 60 #define X_ClearArea 61 #define X_CopyArea 62 #define X_CopyPlane 63 #define X_PolyPoint 64 #define X_PolyLine 65 #define X_PolySegment 66 #define X_PolyRectangle 67 #define X_PolyArc 68 #define X_FillPoly 69 #define X_PolyFillRectangle 70 #define X_PolyFillArc 71 #define X_PutImage 72 #define X_GetImage 73 #define X_PolyText8 74 #define X_PolyText16 75 #define X_ImageText8 76 #define X_ImageText16 77 #define X_CreateColormap 78 #define X_FreeColormap 79 #define X_CopyColormapAndFree 80 #define X_InstallColormap 81 #define X_UninstallColormap 82 #define X_ListInstalledColormaps 83 #define X_AllocColor 84 #define X_AllocNamedColor 85 #define X_AllocColorCells 86 #define X_AllocColorPlanes 87 #define X_FreeColors 88 #define X_StoreColors 89 #define X_StoreNamedColor 90 #define X_QueryColors 91 #define X_LookupColor 92 #define X_CreateCursor 93 #define X_CreateGlyphCursor 94 #define X_FreeCursor 95 #define X_RecolorCursor 96 #define X_QueryBestSize 97 #define X_QueryExtension 98 #define X_ListExtensions 99 #define X_ChangeKeyboardMapping 100 #define X_GetKeyboardMapping 101 #define X_ChangeKeyboardControl 102 #define X_GetKeyboardControl 103 #define X_Bell 104 #define X_ChangePointerControl 105 #define X_GetPointerControl 106 #define X_SetScreenSaver 107 #define X_GetScreenSaver 108 #define X_ChangeHosts 109 #define X_ListHosts 110 #define X_SetAccessControl 111 #define X_SetCloseDownMode 112 #define X_KillClient 113 #define X_RotateProperties 114 #define X_ForceScreenSaver 115 #define X_SetPointerMapping 116 #define X_GetPointerMapping 117 #define X_SetModifierMapping 118 #define X_GetModifierMapping 119 #define X_NoOperation 127 /* restore these definitions back to the typedefs in X.h */ #undef Window #undef Drawable #undef Font #undef Pixmap #undef Cursor #undef Colormap #undef GContext #undef Atom #undef VisualID #undef Time #undef KeyCode #undef KeySym #endif /* XPROTO_H */ vnc_unixsrc/Xvnc/include/keysymdef.h0100664000076400007640000020165407120677563017227 0ustar constconst/* $TOG: keysymdef.h /main/25 1997/06/21 10:54:51 kaleb $ */ /*********************************************************** Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define XK_VoidSymbol 0xFFFFFF /* void symbol */ #ifdef XK_MISCELLANY /* * TTY Functions, cleverly chosen to map to ascii, for convenience of * programming, but could have been arbitrary (at the cost of lookup * tables in client code. */ #define XK_BackSpace 0xFF08 /* back space, back char */ #define XK_Tab 0xFF09 #define XK_Linefeed 0xFF0A /* Linefeed, LF */ #define XK_Clear 0xFF0B #define XK_Return 0xFF0D /* Return, enter */ #define XK_Pause 0xFF13 /* Pause, hold */ #define XK_Scroll_Lock 0xFF14 #define XK_Sys_Req 0xFF15 #define XK_Escape 0xFF1B #define XK_Delete 0xFFFF /* Delete, rubout */ /* International & multi-key character composition */ #define XK_Multi_key 0xFF20 /* Multi-key character compose */ #define XK_SingleCandidate 0xFF3C #define XK_MultipleCandidate 0xFF3D #define XK_PreviousCandidate 0xFF3E /* Japanese keyboard support */ #define XK_Kanji 0xFF21 /* Kanji, Kanji convert */ #define XK_Muhenkan 0xFF22 /* Cancel Conversion */ #define XK_Henkan_Mode 0xFF23 /* Start/Stop Conversion */ #define XK_Henkan 0xFF23 /* Alias for Henkan_Mode */ #define XK_Romaji 0xFF24 /* to Romaji */ #define XK_Hiragana 0xFF25 /* to Hiragana */ #define XK_Katakana 0xFF26 /* to Katakana */ #define XK_Hiragana_Katakana 0xFF27 /* Hiragana/Katakana toggle */ #define XK_Zenkaku 0xFF28 /* to Zenkaku */ #define XK_Hankaku 0xFF29 /* to Hankaku */ #define XK_Zenkaku_Hankaku 0xFF2A /* Zenkaku/Hankaku toggle */ #define XK_Touroku 0xFF2B /* Add to Dictionary */ #define XK_Massyo 0xFF2C /* Delete from Dictionary */ #define XK_Kana_Lock 0xFF2D /* Kana Lock */ #define XK_Kana_Shift 0xFF2E /* Kana Shift */ #define XK_Eisu_Shift 0xFF2F /* Alphanumeric Shift */ #define XK_Eisu_toggle 0xFF30 /* Alphanumeric toggle */ #define XK_Zen_Koho 0xFF3D /* Multiple/All Candidate(s) */ #define XK_Mae_Koho 0xFF3E /* Previous Candidate */ /* 0xFF31 thru 0xFF3F are under XK_KOREAN */ /* Cursor control & motion */ #define XK_Home 0xFF50 #define XK_Left 0xFF51 /* Move left, left arrow */ #define XK_Up 0xFF52 /* Move up, up arrow */ #define XK_Right 0xFF53 /* Move right, right arrow */ #define XK_Down 0xFF54 /* Move down, down arrow */ #define XK_Prior 0xFF55 /* Prior, previous */ #define XK_Page_Up 0xFF55 #define XK_Next 0xFF56 /* Next */ #define XK_Page_Down 0xFF56 #define XK_End 0xFF57 /* EOL */ #define XK_Begin 0xFF58 /* BOL */ /* Misc Functions */ #define XK_Select 0xFF60 /* Select, mark */ #define XK_Print 0xFF61 #define XK_Execute 0xFF62 /* Execute, run, do */ #define XK_Insert 0xFF63 /* Insert, insert here */ #define XK_Undo 0xFF65 /* Undo, oops */ #define XK_Redo 0xFF66 /* redo, again */ #define XK_Menu 0xFF67 #define XK_Find 0xFF68 /* Find, search */ #define XK_Cancel 0xFF69 /* Cancel, stop, abort, exit */ #define XK_Help 0xFF6A /* Help */ #define XK_Break 0xFF6B #define XK_Mode_switch 0xFF7E /* Character set switch */ #define XK_script_switch 0xFF7E /* Alias for mode_switch */ #define XK_Num_Lock 0xFF7F /* Keypad Functions, keypad numbers cleverly chosen to map to ascii */ #define XK_KP_Space 0xFF80 /* space */ #define XK_KP_Tab 0xFF89 #define XK_KP_Enter 0xFF8D /* enter */ #define XK_KP_F1 0xFF91 /* PF1, KP_A, ... */ #define XK_KP_F2 0xFF92 #define XK_KP_F3 0xFF93 #define XK_KP_F4 0xFF94 #define XK_KP_Home 0xFF95 #define XK_KP_Left 0xFF96 #define XK_KP_Up 0xFF97 #define XK_KP_Right 0xFF98 #define XK_KP_Down 0xFF99 #define XK_KP_Prior 0xFF9A #define XK_KP_Page_Up 0xFF9A #define XK_KP_Next 0xFF9B #define XK_KP_Page_Down 0xFF9B #define XK_KP_End 0xFF9C #define XK_KP_Begin 0xFF9D #define XK_KP_Insert 0xFF9E #define XK_KP_Delete 0xFF9F #define XK_KP_Equal 0xFFBD /* equals */ #define XK_KP_Multiply 0xFFAA #define XK_KP_Add 0xFFAB #define XK_KP_Separator 0xFFAC /* separator, often comma */ #define XK_KP_Subtract 0xFFAD #define XK_KP_Decimal 0xFFAE #define XK_KP_Divide 0xFFAF #define XK_KP_0 0xFFB0 #define XK_KP_1 0xFFB1 #define XK_KP_2 0xFFB2 #define XK_KP_3 0xFFB3 #define XK_KP_4 0xFFB4 #define XK_KP_5 0xFFB5 #define XK_KP_6 0xFFB6 #define XK_KP_7 0xFFB7 #define XK_KP_8 0xFFB8 #define XK_KP_9 0xFFB9 /* * Auxilliary Functions; note the duplicate definitions for left and right * function keys; Sun keyboards and a few other manufactures have such * function key groups on the left and/or right sides of the keyboard. * We've not found a keyboard with more than 35 function keys total. */ #define XK_F1 0xFFBE #define XK_F2 0xFFBF #define XK_F3 0xFFC0 #define XK_F4 0xFFC1 #define XK_F5 0xFFC2 #define XK_F6 0xFFC3 #define XK_F7 0xFFC4 #define XK_F8 0xFFC5 #define XK_F9 0xFFC6 #define XK_F10 0xFFC7 #define XK_F11 0xFFC8 #define XK_L1 0xFFC8 #define XK_F12 0xFFC9 #define XK_L2 0xFFC9 #define XK_F13 0xFFCA #define XK_L3 0xFFCA #define XK_F14 0xFFCB #define XK_L4 0xFFCB #define XK_F15 0xFFCC #define XK_L5 0xFFCC #define XK_F16 0xFFCD #define XK_L6 0xFFCD #define XK_F17 0xFFCE #define XK_L7 0xFFCE #define XK_F18 0xFFCF #define XK_L8 0xFFCF #define XK_F19 0xFFD0 #define XK_L9 0xFFD0 #define XK_F20 0xFFD1 #define XK_L10 0xFFD1 #define XK_F21 0xFFD2 #define XK_R1 0xFFD2 #define XK_F22 0xFFD3 #define XK_R2 0xFFD3 #define XK_F23 0xFFD4 #define XK_R3 0xFFD4 #define XK_F24 0xFFD5 #define XK_R4 0xFFD5 #define XK_F25 0xFFD6 #define XK_R5 0xFFD6 #define XK_F26 0xFFD7 #define XK_R6 0xFFD7 #define XK_F27 0xFFD8 #define XK_R7 0xFFD8 #define XK_F28 0xFFD9 #define XK_R8 0xFFD9 #define XK_F29 0xFFDA #define XK_R9 0xFFDA #define XK_F30 0xFFDB #define XK_R10 0xFFDB #define XK_F31 0xFFDC #define XK_R11 0xFFDC #define XK_F32 0xFFDD #define XK_R12 0xFFDD #define XK_F33 0xFFDE #define XK_R13 0xFFDE #define XK_F34 0xFFDF #define XK_R14 0xFFDF #define XK_F35 0xFFE0 #define XK_R15 0xFFE0 /* Modifiers */ #define XK_Shift_L 0xFFE1 /* Left shift */ #define XK_Shift_R 0xFFE2 /* Right shift */ #define XK_Control_L 0xFFE3 /* Left control */ #define XK_Control_R 0xFFE4 /* Right control */ #define XK_Caps_Lock 0xFFE5 /* Caps lock */ #define XK_Shift_Lock 0xFFE6 /* Shift lock */ #define XK_Meta_L 0xFFE7 /* Left meta */ #define XK_Meta_R 0xFFE8 /* Right meta */ #define XK_Alt_L 0xFFE9 /* Left alt */ #define XK_Alt_R 0xFFEA /* Right alt */ #define XK_Super_L 0xFFEB /* Left super */ #define XK_Super_R 0xFFEC /* Right super */ #define XK_Hyper_L 0xFFED /* Left hyper */ #define XK_Hyper_R 0xFFEE /* Right hyper */ #endif /* XK_MISCELLANY */ /* * ISO 9995 Function and Modifier Keys * Byte 3 = 0xFE */ #ifdef XK_XKB_KEYS #define XK_ISO_Lock 0xFE01 #define XK_ISO_Level2_Latch 0xFE02 #define XK_ISO_Level3_Shift 0xFE03 #define XK_ISO_Level3_Latch 0xFE04 #define XK_ISO_Level3_Lock 0xFE05 #define XK_ISO_Group_Shift 0xFF7E /* Alias for mode_switch */ #define XK_ISO_Group_Latch 0xFE06 #define XK_ISO_Group_Lock 0xFE07 #define XK_ISO_Next_Group 0xFE08 #define XK_ISO_Next_Group_Lock 0xFE09 #define XK_ISO_Prev_Group 0xFE0A #define XK_ISO_Prev_Group_Lock 0xFE0B #define XK_ISO_First_Group 0xFE0C #define XK_ISO_First_Group_Lock 0xFE0D #define XK_ISO_Last_Group 0xFE0E #define XK_ISO_Last_Group_Lock 0xFE0F #define XK_ISO_Left_Tab 0xFE20 #define XK_ISO_Move_Line_Up 0xFE21 #define XK_ISO_Move_Line_Down 0xFE22 #define XK_ISO_Partial_Line_Up 0xFE23 #define XK_ISO_Partial_Line_Down 0xFE24 #define XK_ISO_Partial_Space_Left 0xFE25 #define XK_ISO_Partial_Space_Right 0xFE26 #define XK_ISO_Set_Margin_Left 0xFE27 #define XK_ISO_Set_Margin_Right 0xFE28 #define XK_ISO_Release_Margin_Left 0xFE29 #define XK_ISO_Release_Margin_Right 0xFE2A #define XK_ISO_Release_Both_Margins 0xFE2B #define XK_ISO_Fast_Cursor_Left 0xFE2C #define XK_ISO_Fast_Cursor_Right 0xFE2D #define XK_ISO_Fast_Cursor_Up 0xFE2E #define XK_ISO_Fast_Cursor_Down 0xFE2F #define XK_ISO_Continuous_Underline 0xFE30 #define XK_ISO_Discontinuous_Underline 0xFE31 #define XK_ISO_Emphasize 0xFE32 #define XK_ISO_Center_Object 0xFE33 #define XK_ISO_Enter 0xFE34 #define XK_dead_grave 0xFE50 #define XK_dead_acute 0xFE51 #define XK_dead_circumflex 0xFE52 #define XK_dead_tilde 0xFE53 #define XK_dead_macron 0xFE54 #define XK_dead_breve 0xFE55 #define XK_dead_abovedot 0xFE56 #define XK_dead_diaeresis 0xFE57 #define XK_dead_abovering 0xFE58 #define XK_dead_doubleacute 0xFE59 #define XK_dead_caron 0xFE5A #define XK_dead_cedilla 0xFE5B #define XK_dead_ogonek 0xFE5C #define XK_dead_iota 0xFE5D #define XK_dead_voiced_sound 0xFE5E #define XK_dead_semivoiced_sound 0xFE5F #define XK_dead_belowdot 0xFE60 #define XK_First_Virtual_Screen 0xFED0 #define XK_Prev_Virtual_Screen 0xFED1 #define XK_Next_Virtual_Screen 0xFED2 #define XK_Last_Virtual_Screen 0xFED4 #define XK_Terminate_Server 0xFED5 #define XK_AccessX_Enable 0xFE70 #define XK_AccessX_Feedback_Enable 0xFE71 #define XK_RepeatKeys_Enable 0xFE72 #define XK_SlowKeys_Enable 0xFE73 #define XK_BounceKeys_Enable 0xFE74 #define XK_StickyKeys_Enable 0xFE75 #define XK_MouseKeys_Enable 0xFE76 #define XK_MouseKeys_Accel_Enable 0xFE77 #define XK_Overlay1_Enable 0xFE78 #define XK_Overlay2_Enable 0xFE79 #define XK_AudibleBell_Enable 0xFE7A #define XK_Pointer_Left 0xFEE0 #define XK_Pointer_Right 0xFEE1 #define XK_Pointer_Up 0xFEE2 #define XK_Pointer_Down 0xFEE3 #define XK_Pointer_UpLeft 0xFEE4 #define XK_Pointer_UpRight 0xFEE5 #define XK_Pointer_DownLeft 0xFEE6 #define XK_Pointer_DownRight 0xFEE7 #define XK_Pointer_Button_Dflt 0xFEE8 #define XK_Pointer_Button1 0xFEE9 #define XK_Pointer_Button2 0xFEEA #define XK_Pointer_Button3 0xFEEB #define XK_Pointer_Button4 0xFEEC #define XK_Pointer_Button5 0xFEED #define XK_Pointer_DblClick_Dflt 0xFEEE #define XK_Pointer_DblClick1 0xFEEF #define XK_Pointer_DblClick2 0xFEF0 #define XK_Pointer_DblClick3 0xFEF1 #define XK_Pointer_DblClick4 0xFEF2 #define XK_Pointer_DblClick5 0xFEF3 #define XK_Pointer_Drag_Dflt 0xFEF4 #define XK_Pointer_Drag1 0xFEF5 #define XK_Pointer_Drag2 0xFEF6 #define XK_Pointer_Drag3 0xFEF7 #define XK_Pointer_Drag4 0xFEF8 #define XK_Pointer_Drag5 0xFEFD #define XK_Pointer_EnableKeys 0xFEF9 #define XK_Pointer_Accelerate 0xFEFA #define XK_Pointer_DfltBtnNext 0xFEFB #define XK_Pointer_DfltBtnPrev 0xFEFC #endif /* * 3270 Terminal Keys * Byte 3 = 0xFD */ #ifdef XK_3270 #define XK_3270_Duplicate 0xFD01 #define XK_3270_FieldMark 0xFD02 #define XK_3270_Right2 0xFD03 #define XK_3270_Left2 0xFD04 #define XK_3270_BackTab 0xFD05 #define XK_3270_EraseEOF 0xFD06 #define XK_3270_EraseInput 0xFD07 #define XK_3270_Reset 0xFD08 #define XK_3270_Quit 0xFD09 #define XK_3270_PA1 0xFD0A #define XK_3270_PA2 0xFD0B #define XK_3270_PA3 0xFD0C #define XK_3270_Test 0xFD0D #define XK_3270_Attn 0xFD0E #define XK_3270_CursorBlink 0xFD0F #define XK_3270_AltCursor 0xFD10 #define XK_3270_KeyClick 0xFD11 #define XK_3270_Jump 0xFD12 #define XK_3270_Ident 0xFD13 #define XK_3270_Rule 0xFD14 #define XK_3270_Copy 0xFD15 #define XK_3270_Play 0xFD16 #define XK_3270_Setup 0xFD17 #define XK_3270_Record 0xFD18 #define XK_3270_ChangeScreen 0xFD19 #define XK_3270_DeleteWord 0xFD1A #define XK_3270_ExSelect 0xFD1B #define XK_3270_CursorSelect 0xFD1C #define XK_3270_PrintScreen 0xFD1D #define XK_3270_Enter 0xFD1E #endif /* * Latin 1 * Byte 3 = 0 */ #ifdef XK_LATIN1 #define XK_space 0x020 #define XK_exclam 0x021 #define XK_quotedbl 0x022 #define XK_numbersign 0x023 #define XK_dollar 0x024 #define XK_percent 0x025 #define XK_ampersand 0x026 #define XK_apostrophe 0x027 #define XK_quoteright 0x027 /* deprecated */ #define XK_parenleft 0x028 #define XK_parenright 0x029 #define XK_asterisk 0x02a #define XK_plus 0x02b #define XK_comma 0x02c #define XK_minus 0x02d #define XK_period 0x02e #define XK_slash 0x02f #define XK_0 0x030 #define XK_1 0x031 #define XK_2 0x032 #define XK_3 0x033 #define XK_4 0x034 #define XK_5 0x035 #define XK_6 0x036 #define XK_7 0x037 #define XK_8 0x038 #define XK_9 0x039 #define XK_colon 0x03a #define XK_semicolon 0x03b #define XK_less 0x03c #define XK_equal 0x03d #define XK_greater 0x03e #define XK_question 0x03f #define XK_at 0x040 #define XK_A 0x041 #define XK_B 0x042 #define XK_C 0x043 #define XK_D 0x044 #define XK_E 0x045 #define XK_F 0x046 #define XK_G 0x047 #define XK_H 0x048 #define XK_I 0x049 #define XK_J 0x04a #define XK_K 0x04b #define XK_L 0x04c #define XK_M 0x04d #define XK_N 0x04e #define XK_O 0x04f #define XK_P 0x050 #define XK_Q 0x051 #define XK_R 0x052 #define XK_S 0x053 #define XK_T 0x054 #define XK_U 0x055 #define XK_V 0x056 #define XK_W 0x057 #define XK_X 0x058 #define XK_Y 0x059 #define XK_Z 0x05a #define XK_bracketleft 0x05b #define XK_backslash 0x05c #define XK_bracketright 0x05d #define XK_asciicircum 0x05e #define XK_underscore 0x05f #define XK_grave 0x060 #define XK_quoteleft 0x060 /* deprecated */ #define XK_a 0x061 #define XK_b 0x062 #define XK_c 0x063 #define XK_d 0x064 #define XK_e 0x065 #define XK_f 0x066 #define XK_g 0x067 #define XK_h 0x068 #define XK_i 0x069 #define XK_j 0x06a #define XK_k 0x06b #define XK_l 0x06c #define XK_m 0x06d #define XK_n 0x06e #define XK_o 0x06f #define XK_p 0x070 #define XK_q 0x071 #define XK_r 0x072 #define XK_s 0x073 #define XK_t 0x074 #define XK_u 0x075 #define XK_v 0x076 #define XK_w 0x077 #define XK_x 0x078 #define XK_y 0x079 #define XK_z 0x07a #define XK_braceleft 0x07b #define XK_bar 0x07c #define XK_braceright 0x07d #define XK_asciitilde 0x07e #define XK_nobreakspace 0x0a0 #define XK_exclamdown 0x0a1 #define XK_cent 0x0a2 #define XK_sterling 0x0a3 #define XK_currency 0x0a4 #define XK_yen 0x0a5 #define XK_brokenbar 0x0a6 #define XK_section 0x0a7 #define XK_diaeresis 0x0a8 #define XK_copyright 0x0a9 #define XK_ordfeminine 0x0aa #define XK_guillemotleft 0x0ab /* left angle quotation mark */ #define XK_notsign 0x0ac #define XK_hyphen 0x0ad #define XK_registered 0x0ae #define XK_macron 0x0af #define XK_degree 0x0b0 #define XK_plusminus 0x0b1 #define XK_twosuperior 0x0b2 #define XK_threesuperior 0x0b3 #define XK_acute 0x0b4 #define XK_mu 0x0b5 #define XK_paragraph 0x0b6 #define XK_periodcentered 0x0b7 #define XK_cedilla 0x0b8 #define XK_onesuperior 0x0b9 #define XK_masculine 0x0ba #define XK_guillemotright 0x0bb /* right angle quotation mark */ #define XK_onequarter 0x0bc #define XK_onehalf 0x0bd #define XK_threequarters 0x0be #define XK_questiondown 0x0bf #define XK_Agrave 0x0c0 #define XK_Aacute 0x0c1 #define XK_Acircumflex 0x0c2 #define XK_Atilde 0x0c3 #define XK_Adiaeresis 0x0c4 #define XK_Aring 0x0c5 #define XK_AE 0x0c6 #define XK_Ccedilla 0x0c7 #define XK_Egrave 0x0c8 #define XK_Eacute 0x0c9 #define XK_Ecircumflex 0x0ca #define XK_Ediaeresis 0x0cb #define XK_Igrave 0x0cc #define XK_Iacute 0x0cd #define XK_Icircumflex 0x0ce #define XK_Idiaeresis 0x0cf #define XK_ETH 0x0d0 #define XK_Eth 0x0d0 /* deprecated */ #define XK_Ntilde 0x0d1 #define XK_Ograve 0x0d2 #define XK_Oacute 0x0d3 #define XK_Ocircumflex 0x0d4 #define XK_Otilde 0x0d5 #define XK_Odiaeresis 0x0d6 #define XK_multiply 0x0d7 #define XK_Ooblique 0x0d8 #define XK_Ugrave 0x0d9 #define XK_Uacute 0x0da #define XK_Ucircumflex 0x0db #define XK_Udiaeresis 0x0dc #define XK_Yacute 0x0dd #define XK_THORN 0x0de #define XK_Thorn 0x0de /* deprecated */ #define XK_ssharp 0x0df #define XK_agrave 0x0e0 #define XK_aacute 0x0e1 #define XK_acircumflex 0x0e2 #define XK_atilde 0x0e3 #define XK_adiaeresis 0x0e4 #define XK_aring 0x0e5 #define XK_ae 0x0e6 #define XK_ccedilla 0x0e7 #define XK_egrave 0x0e8 #define XK_eacute 0x0e9 #define XK_ecircumflex 0x0ea #define XK_ediaeresis 0x0eb #define XK_igrave 0x0ec #define XK_iacute 0x0ed #define XK_icircumflex 0x0ee #define XK_idiaeresis 0x0ef #define XK_eth 0x0f0 #define XK_ntilde 0x0f1 #define XK_ograve 0x0f2 #define XK_oacute 0x0f3 #define XK_ocircumflex 0x0f4 #define XK_otilde 0x0f5 #define XK_odiaeresis 0x0f6 #define XK_division 0x0f7 #define XK_oslash 0x0f8 #define XK_ugrave 0x0f9 #define XK_uacute 0x0fa #define XK_ucircumflex 0x0fb #define XK_udiaeresis 0x0fc #define XK_yacute 0x0fd #define XK_thorn 0x0fe #define XK_ydiaeresis 0x0ff #endif /* XK_LATIN1 */ /* * Latin 2 * Byte 3 = 1 */ #ifdef XK_LATIN2 #define XK_Aogonek 0x1a1 #define XK_breve 0x1a2 #define XK_Lstroke 0x1a3 #define XK_Lcaron 0x1a5 #define XK_Sacute 0x1a6 #define XK_Scaron 0x1a9 #define XK_Scedilla 0x1aa #define XK_Tcaron 0x1ab #define XK_Zacute 0x1ac #define XK_Zcaron 0x1ae #define XK_Zabovedot 0x1af #define XK_aogonek 0x1b1 #define XK_ogonek 0x1b2 #define XK_lstroke 0x1b3 #define XK_lcaron 0x1b5 #define XK_sacute 0x1b6 #define XK_caron 0x1b7 #define XK_scaron 0x1b9 #define XK_scedilla 0x1ba #define XK_tcaron 0x1bb #define XK_zacute 0x1bc #define XK_doubleacute 0x1bd #define XK_zcaron 0x1be #define XK_zabovedot 0x1bf #define XK_Racute 0x1c0 #define XK_Abreve 0x1c3 #define XK_Lacute 0x1c5 #define XK_Cacute 0x1c6 #define XK_Ccaron 0x1c8 #define XK_Eogonek 0x1ca #define XK_Ecaron 0x1cc #define XK_Dcaron 0x1cf #define XK_Dstroke 0x1d0 #define XK_Nacute 0x1d1 #define XK_Ncaron 0x1d2 #define XK_Odoubleacute 0x1d5 #define XK_Rcaron 0x1d8 #define XK_Uring 0x1d9 #define XK_Udoubleacute 0x1db #define XK_Tcedilla 0x1de #define XK_racute 0x1e0 #define XK_abreve 0x1e3 #define XK_lacute 0x1e5 #define XK_cacute 0x1e6 #define XK_ccaron 0x1e8 #define XK_eogonek 0x1ea #define XK_ecaron 0x1ec #define XK_dcaron 0x1ef #define XK_dstroke 0x1f0 #define XK_nacute 0x1f1 #define XK_ncaron 0x1f2 #define XK_odoubleacute 0x1f5 #define XK_udoubleacute 0x1fb #define XK_rcaron 0x1f8 #define XK_uring 0x1f9 #define XK_tcedilla 0x1fe #define XK_abovedot 0x1ff #endif /* XK_LATIN2 */ /* * Latin 3 * Byte 3 = 2 */ #ifdef XK_LATIN3 #define XK_Hstroke 0x2a1 #define XK_Hcircumflex 0x2a6 #define XK_Iabovedot 0x2a9 #define XK_Gbreve 0x2ab #define XK_Jcircumflex 0x2ac #define XK_hstroke 0x2b1 #define XK_hcircumflex 0x2b6 #define XK_idotless 0x2b9 #define XK_gbreve 0x2bb #define XK_jcircumflex 0x2bc #define XK_Cabovedot 0x2c5 #define XK_Ccircumflex 0x2c6 #define XK_Gabovedot 0x2d5 #define XK_Gcircumflex 0x2d8 #define XK_Ubreve 0x2dd #define XK_Scircumflex 0x2de #define XK_cabovedot 0x2e5 #define XK_ccircumflex 0x2e6 #define XK_gabovedot 0x2f5 #define XK_gcircumflex 0x2f8 #define XK_ubreve 0x2fd #define XK_scircumflex 0x2fe #endif /* XK_LATIN3 */ /* * Latin 4 * Byte 3 = 3 */ #ifdef XK_LATIN4 #define XK_kra 0x3a2 #define XK_kappa 0x3a2 /* deprecated */ #define XK_Rcedilla 0x3a3 #define XK_Itilde 0x3a5 #define XK_Lcedilla 0x3a6 #define XK_Emacron 0x3aa #define XK_Gcedilla 0x3ab #define XK_Tslash 0x3ac #define XK_rcedilla 0x3b3 #define XK_itilde 0x3b5 #define XK_lcedilla 0x3b6 #define XK_emacron 0x3ba #define XK_gcedilla 0x3bb #define XK_tslash 0x3bc #define XK_ENG 0x3bd #define XK_eng 0x3bf #define XK_Amacron 0x3c0 #define XK_Iogonek 0x3c7 #define XK_Eabovedot 0x3cc #define XK_Imacron 0x3cf #define XK_Ncedilla 0x3d1 #define XK_Omacron 0x3d2 #define XK_Kcedilla 0x3d3 #define XK_Uogonek 0x3d9 #define XK_Utilde 0x3dd #define XK_Umacron 0x3de #define XK_amacron 0x3e0 #define XK_iogonek 0x3e7 #define XK_eabovedot 0x3ec #define XK_imacron 0x3ef #define XK_ncedilla 0x3f1 #define XK_omacron 0x3f2 #define XK_kcedilla 0x3f3 #define XK_uogonek 0x3f9 #define XK_utilde 0x3fd #define XK_umacron 0x3fe #endif /* XK_LATIN4 */ /* * Katakana * Byte 3 = 4 */ #ifdef XK_KATAKANA #define XK_overline 0x47e #define XK_kana_fullstop 0x4a1 #define XK_kana_openingbracket 0x4a2 #define XK_kana_closingbracket 0x4a3 #define XK_kana_comma 0x4a4 #define XK_kana_conjunctive 0x4a5 #define XK_kana_middledot 0x4a5 /* deprecated */ #define XK_kana_WO 0x4a6 #define XK_kana_a 0x4a7 #define XK_kana_i 0x4a8 #define XK_kana_u 0x4a9 #define XK_kana_e 0x4aa #define XK_kana_o 0x4ab #define XK_kana_ya 0x4ac #define XK_kana_yu 0x4ad #define XK_kana_yo 0x4ae #define XK_kana_tsu 0x4af #define XK_kana_tu 0x4af /* deprecated */ #define XK_prolongedsound 0x4b0 #define XK_kana_A 0x4b1 #define XK_kana_I 0x4b2 #define XK_kana_U 0x4b3 #define XK_kana_E 0x4b4 #define XK_kana_O 0x4b5 #define XK_kana_KA 0x4b6 #define XK_kana_KI 0x4b7 #define XK_kana_KU 0x4b8 #define XK_kana_KE 0x4b9 #define XK_kana_KO 0x4ba #define XK_kana_SA 0x4bb #define XK_kana_SHI 0x4bc #define XK_kana_SU 0x4bd #define XK_kana_SE 0x4be #define XK_kana_SO 0x4bf #define XK_kana_TA 0x4c0 #define XK_kana_CHI 0x4c1 #define XK_kana_TI 0x4c1 /* deprecated */ #define XK_kana_TSU 0x4c2 #define XK_kana_TU 0x4c2 /* deprecated */ #define XK_kana_TE 0x4c3 #define XK_kana_TO 0x4c4 #define XK_kana_NA 0x4c5 #define XK_kana_NI 0x4c6 #define XK_kana_NU 0x4c7 #define XK_kana_NE 0x4c8 #define XK_kana_NO 0x4c9 #define XK_kana_HA 0x4ca #define XK_kana_HI 0x4cb #define XK_kana_FU 0x4cc #define XK_kana_HU 0x4cc /* deprecated */ #define XK_kana_HE 0x4cd #define XK_kana_HO 0x4ce #define XK_kana_MA 0x4cf #define XK_kana_MI 0x4d0 #define XK_kana_MU 0x4d1 #define XK_kana_ME 0x4d2 #define XK_kana_MO 0x4d3 #define XK_kana_YA 0x4d4 #define XK_kana_YU 0x4d5 #define XK_kana_YO 0x4d6 #define XK_kana_RA 0x4d7 #define XK_kana_RI 0x4d8 #define XK_kana_RU 0x4d9 #define XK_kana_RE 0x4da #define XK_kana_RO 0x4db #define XK_kana_WA 0x4dc #define XK_kana_N 0x4dd #define XK_voicedsound 0x4de #define XK_semivoicedsound 0x4df #define XK_kana_switch 0xFF7E /* Alias for mode_switch */ #endif /* XK_KATAKANA */ /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC #define XK_Arabic_comma 0x5ac #define XK_Arabic_semicolon 0x5bb #define XK_Arabic_question_mark 0x5bf #define XK_Arabic_hamza 0x5c1 #define XK_Arabic_maddaonalef 0x5c2 #define XK_Arabic_hamzaonalef 0x5c3 #define XK_Arabic_hamzaonwaw 0x5c4 #define XK_Arabic_hamzaunderalef 0x5c5 #define XK_Arabic_hamzaonyeh 0x5c6 #define XK_Arabic_alef 0x5c7 #define XK_Arabic_beh 0x5c8 #define XK_Arabic_tehmarbuta 0x5c9 #define XK_Arabic_teh 0x5ca #define XK_Arabic_theh 0x5cb #define XK_Arabic_jeem 0x5cc #define XK_Arabic_hah 0x5cd #define XK_Arabic_khah 0x5ce #define XK_Arabic_dal 0x5cf #define XK_Arabic_thal 0x5d0 #define XK_Arabic_ra 0x5d1 #define XK_Arabic_zain 0x5d2 #define XK_Arabic_seen 0x5d3 #define XK_Arabic_sheen 0x5d4 #define XK_Arabic_sad 0x5d5 #define XK_Arabic_dad 0x5d6 #define XK_Arabic_tah 0x5d7 #define XK_Arabic_zah 0x5d8 #define XK_Arabic_ain 0x5d9 #define XK_Arabic_ghain 0x5da #define XK_Arabic_tatweel 0x5e0 #define XK_Arabic_feh 0x5e1 #define XK_Arabic_qaf 0x5e2 #define XK_Arabic_kaf 0x5e3 #define XK_Arabic_lam 0x5e4 #define XK_Arabic_meem 0x5e5 #define XK_Arabic_noon 0x5e6 #define XK_Arabic_ha 0x5e7 #define XK_Arabic_heh 0x5e7 /* deprecated */ #define XK_Arabic_waw 0x5e8 #define XK_Arabic_alefmaksura 0x5e9 #define XK_Arabic_yeh 0x5ea #define XK_Arabic_fathatan 0x5eb #define XK_Arabic_dammatan 0x5ec #define XK_Arabic_kasratan 0x5ed #define XK_Arabic_fatha 0x5ee #define XK_Arabic_damma 0x5ef #define XK_Arabic_kasra 0x5f0 #define XK_Arabic_shadda 0x5f1 #define XK_Arabic_sukun 0x5f2 #define XK_Arabic_switch 0xFF7E /* Alias for mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC #define XK_Serbian_dje 0x6a1 #define XK_Macedonia_gje 0x6a2 #define XK_Cyrillic_io 0x6a3 #define XK_Ukrainian_ie 0x6a4 #define XK_Ukranian_je 0x6a4 /* deprecated */ #define XK_Macedonia_dse 0x6a5 #define XK_Ukrainian_i 0x6a6 #define XK_Ukranian_i 0x6a6 /* deprecated */ #define XK_Ukrainian_yi 0x6a7 #define XK_Ukranian_yi 0x6a7 /* deprecated */ #define XK_Cyrillic_je 0x6a8 #define XK_Serbian_je 0x6a8 /* deprecated */ #define XK_Cyrillic_lje 0x6a9 #define XK_Serbian_lje 0x6a9 /* deprecated */ #define XK_Cyrillic_nje 0x6aa #define XK_Serbian_nje 0x6aa /* deprecated */ #define XK_Serbian_tshe 0x6ab #define XK_Macedonia_kje 0x6ac #define XK_Byelorussian_shortu 0x6ae #define XK_Cyrillic_dzhe 0x6af #define XK_Serbian_dze 0x6af /* deprecated */ #define XK_numerosign 0x6b0 #define XK_Serbian_DJE 0x6b1 #define XK_Macedonia_GJE 0x6b2 #define XK_Cyrillic_IO 0x6b3 #define XK_Ukrainian_IE 0x6b4 #define XK_Ukranian_JE 0x6b4 /* deprecated */ #define XK_Macedonia_DSE 0x6b5 #define XK_Ukrainian_I 0x6b6 #define XK_Ukranian_I 0x6b6 /* deprecated */ #define XK_Ukrainian_YI 0x6b7 #define XK_Ukranian_YI 0x6b7 /* deprecated */ #define XK_Cyrillic_JE 0x6b8 #define XK_Serbian_JE 0x6b8 /* deprecated */ #define XK_Cyrillic_LJE 0x6b9 #define XK_Serbian_LJE 0x6b9 /* deprecated */ #define XK_Cyrillic_NJE 0x6ba #define XK_Serbian_NJE 0x6ba /* deprecated */ #define XK_Serbian_TSHE 0x6bb #define XK_Macedonia_KJE 0x6bc #define XK_Byelorussian_SHORTU 0x6be #define XK_Cyrillic_DZHE 0x6bf #define XK_Serbian_DZE 0x6bf /* deprecated */ #define XK_Cyrillic_yu 0x6c0 #define XK_Cyrillic_a 0x6c1 #define XK_Cyrillic_be 0x6c2 #define XK_Cyrillic_tse 0x6c3 #define XK_Cyrillic_de 0x6c4 #define XK_Cyrillic_ie 0x6c5 #define XK_Cyrillic_ef 0x6c6 #define XK_Cyrillic_ghe 0x6c7 #define XK_Cyrillic_ha 0x6c8 #define XK_Cyrillic_i 0x6c9 #define XK_Cyrillic_shorti 0x6ca #define XK_Cyrillic_ka 0x6cb #define XK_Cyrillic_el 0x6cc #define XK_Cyrillic_em 0x6cd #define XK_Cyrillic_en 0x6ce #define XK_Cyrillic_o 0x6cf #define XK_Cyrillic_pe 0x6d0 #define XK_Cyrillic_ya 0x6d1 #define XK_Cyrillic_er 0x6d2 #define XK_Cyrillic_es 0x6d3 #define XK_Cyrillic_te 0x6d4 #define XK_Cyrillic_u 0x6d5 #define XK_Cyrillic_zhe 0x6d6 #define XK_Cyrillic_ve 0x6d7 #define XK_Cyrillic_softsign 0x6d8 #define XK_Cyrillic_yeru 0x6d9 #define XK_Cyrillic_ze 0x6da #define XK_Cyrillic_sha 0x6db #define XK_Cyrillic_e 0x6dc #define XK_Cyrillic_shcha 0x6dd #define XK_Cyrillic_che 0x6de #define XK_Cyrillic_hardsign 0x6df #define XK_Cyrillic_YU 0x6e0 #define XK_Cyrillic_A 0x6e1 #define XK_Cyrillic_BE 0x6e2 #define XK_Cyrillic_TSE 0x6e3 #define XK_Cyrillic_DE 0x6e4 #define XK_Cyrillic_IE 0x6e5 #define XK_Cyrillic_EF 0x6e6 #define XK_Cyrillic_GHE 0x6e7 #define XK_Cyrillic_HA 0x6e8 #define XK_Cyrillic_I 0x6e9 #define XK_Cyrillic_SHORTI 0x6ea #define XK_Cyrillic_KA 0x6eb #define XK_Cyrillic_EL 0x6ec #define XK_Cyrillic_EM 0x6ed #define XK_Cyrillic_EN 0x6ee #define XK_Cyrillic_O 0x6ef #define XK_Cyrillic_PE 0x6f0 #define XK_Cyrillic_YA 0x6f1 #define XK_Cyrillic_ER 0x6f2 #define XK_Cyrillic_ES 0x6f3 #define XK_Cyrillic_TE 0x6f4 #define XK_Cyrillic_U 0x6f5 #define XK_Cyrillic_ZHE 0x6f6 #define XK_Cyrillic_VE 0x6f7 #define XK_Cyrillic_SOFTSIGN 0x6f8 #define XK_Cyrillic_YERU 0x6f9 #define XK_Cyrillic_ZE 0x6fa #define XK_Cyrillic_SHA 0x6fb #define XK_Cyrillic_E 0x6fc #define XK_Cyrillic_SHCHA 0x6fd #define XK_Cyrillic_CHE 0x6fe #define XK_Cyrillic_HARDSIGN 0x6ff #endif /* XK_CYRILLIC */ /* * Greek * Byte 3 = 7 */ #ifdef XK_GREEK #define XK_Greek_ALPHAaccent 0x7a1 #define XK_Greek_EPSILONaccent 0x7a2 #define XK_Greek_ETAaccent 0x7a3 #define XK_Greek_IOTAaccent 0x7a4 #define XK_Greek_IOTAdiaeresis 0x7a5 #define XK_Greek_OMICRONaccent 0x7a7 #define XK_Greek_UPSILONaccent 0x7a8 #define XK_Greek_UPSILONdieresis 0x7a9 #define XK_Greek_OMEGAaccent 0x7ab #define XK_Greek_accentdieresis 0x7ae #define XK_Greek_horizbar 0x7af #define XK_Greek_alphaaccent 0x7b1 #define XK_Greek_epsilonaccent 0x7b2 #define XK_Greek_etaaccent 0x7b3 #define XK_Greek_iotaaccent 0x7b4 #define XK_Greek_iotadieresis 0x7b5 #define XK_Greek_iotaaccentdieresis 0x7b6 #define XK_Greek_omicronaccent 0x7b7 #define XK_Greek_upsilonaccent 0x7b8 #define XK_Greek_upsilondieresis 0x7b9 #define XK_Greek_upsilonaccentdieresis 0x7ba #define XK_Greek_omegaaccent 0x7bb #define XK_Greek_ALPHA 0x7c1 #define XK_Greek_BETA 0x7c2 #define XK_Greek_GAMMA 0x7c3 #define XK_Greek_DELTA 0x7c4 #define XK_Greek_EPSILON 0x7c5 #define XK_Greek_ZETA 0x7c6 #define XK_Greek_ETA 0x7c7 #define XK_Greek_THETA 0x7c8 #define XK_Greek_IOTA 0x7c9 #define XK_Greek_KAPPA 0x7ca #define XK_Greek_LAMDA 0x7cb #define XK_Greek_LAMBDA 0x7cb #define XK_Greek_MU 0x7cc #define XK_Greek_NU 0x7cd #define XK_Greek_XI 0x7ce #define XK_Greek_OMICRON 0x7cf #define XK_Greek_PI 0x7d0 #define XK_Greek_RHO 0x7d1 #define XK_Greek_SIGMA 0x7d2 #define XK_Greek_TAU 0x7d4 #define XK_Greek_UPSILON 0x7d5 #define XK_Greek_PHI 0x7d6 #define XK_Greek_CHI 0x7d7 #define XK_Greek_PSI 0x7d8 #define XK_Greek_OMEGA 0x7d9 #define XK_Greek_alpha 0x7e1 #define XK_Greek_beta 0x7e2 #define XK_Greek_gamma 0x7e3 #define XK_Greek_delta 0x7e4 #define XK_Greek_epsilon 0x7e5 #define XK_Greek_zeta 0x7e6 #define XK_Greek_eta 0x7e7 #define XK_Greek_theta 0x7e8 #define XK_Greek_iota 0x7e9 #define XK_Greek_kappa 0x7ea #define XK_Greek_lamda 0x7eb #define XK_Greek_lambda 0x7eb #define XK_Greek_mu 0x7ec #define XK_Greek_nu 0x7ed #define XK_Greek_xi 0x7ee #define XK_Greek_omicron 0x7ef #define XK_Greek_pi 0x7f0 #define XK_Greek_rho 0x7f1 #define XK_Greek_sigma 0x7f2 #define XK_Greek_finalsmallsigma 0x7f3 #define XK_Greek_tau 0x7f4 #define XK_Greek_upsilon 0x7f5 #define XK_Greek_phi 0x7f6 #define XK_Greek_chi 0x7f7 #define XK_Greek_psi 0x7f8 #define XK_Greek_omega 0x7f9 #define XK_Greek_switch 0xFF7E /* Alias for mode_switch */ #endif /* XK_GREEK */ /* * Technical * Byte 3 = 8 */ #ifdef XK_TECHNICAL #define XK_leftradical 0x8a1 #define XK_topleftradical 0x8a2 #define XK_horizconnector 0x8a3 #define XK_topintegral 0x8a4 #define XK_botintegral 0x8a5 #define XK_vertconnector 0x8a6 #define XK_topleftsqbracket 0x8a7 #define XK_botleftsqbracket 0x8a8 #define XK_toprightsqbracket 0x8a9 #define XK_botrightsqbracket 0x8aa #define XK_topleftparens 0x8ab #define XK_botleftparens 0x8ac #define XK_toprightparens 0x8ad #define XK_botrightparens 0x8ae #define XK_leftmiddlecurlybrace 0x8af #define XK_rightmiddlecurlybrace 0x8b0 #define XK_topleftsummation 0x8b1 #define XK_botleftsummation 0x8b2 #define XK_topvertsummationconnector 0x8b3 #define XK_botvertsummationconnector 0x8b4 #define XK_toprightsummation 0x8b5 #define XK_botrightsummation 0x8b6 #define XK_rightmiddlesummation 0x8b7 #define XK_lessthanequal 0x8bc #define XK_notequal 0x8bd #define XK_greaterthanequal 0x8be #define XK_integral 0x8bf #define XK_therefore 0x8c0 #define XK_variation 0x8c1 #define XK_infinity 0x8c2 #define XK_nabla 0x8c5 #define XK_approximate 0x8c8 #define XK_similarequal 0x8c9 #define XK_ifonlyif 0x8cd #define XK_implies 0x8ce #define XK_identical 0x8cf #define XK_radical 0x8d6 #define XK_includedin 0x8da #define XK_includes 0x8db #define XK_intersection 0x8dc #define XK_union 0x8dd #define XK_logicaland 0x8de #define XK_logicalor 0x8df #define XK_partialderivative 0x8ef #define XK_function 0x8f6 #define XK_leftarrow 0x8fb #define XK_uparrow 0x8fc #define XK_rightarrow 0x8fd #define XK_downarrow 0x8fe #endif /* XK_TECHNICAL */ /* * Special * Byte 3 = 9 */ #ifdef XK_SPECIAL #define XK_blank 0x9df #define XK_soliddiamond 0x9e0 #define XK_checkerboard 0x9e1 #define XK_ht 0x9e2 #define XK_ff 0x9e3 #define XK_cr 0x9e4 #define XK_lf 0x9e5 #define XK_nl 0x9e8 #define XK_vt 0x9e9 #define XK_lowrightcorner 0x9ea #define XK_uprightcorner 0x9eb #define XK_upleftcorner 0x9ec #define XK_lowleftcorner 0x9ed #define XK_crossinglines 0x9ee #define XK_horizlinescan1 0x9ef #define XK_horizlinescan3 0x9f0 #define XK_horizlinescan5 0x9f1 #define XK_horizlinescan7 0x9f2 #define XK_horizlinescan9 0x9f3 #define XK_leftt 0x9f4 #define XK_rightt 0x9f5 #define XK_bott 0x9f6 #define XK_topt 0x9f7 #define XK_vertbar 0x9f8 #endif /* XK_SPECIAL */ /* * Publishing * Byte 3 = a */ #ifdef XK_PUBLISHING #define XK_emspace 0xaa1 #define XK_enspace 0xaa2 #define XK_em3space 0xaa3 #define XK_em4space 0xaa4 #define XK_digitspace 0xaa5 #define XK_punctspace 0xaa6 #define XK_thinspace 0xaa7 #define XK_hairspace 0xaa8 #define XK_emdash 0xaa9 #define XK_endash 0xaaa #define XK_signifblank 0xaac #define XK_ellipsis 0xaae #define XK_doubbaselinedot 0xaaf #define XK_onethird 0xab0 #define XK_twothirds 0xab1 #define XK_onefifth 0xab2 #define XK_twofifths 0xab3 #define XK_threefifths 0xab4 #define XK_fourfifths 0xab5 #define XK_onesixth 0xab6 #define XK_fivesixths 0xab7 #define XK_careof 0xab8 #define XK_figdash 0xabb #define XK_leftanglebracket 0xabc #define XK_decimalpoint 0xabd #define XK_rightanglebracket 0xabe #define XK_marker 0xabf #define XK_oneeighth 0xac3 #define XK_threeeighths 0xac4 #define XK_fiveeighths 0xac5 #define XK_seveneighths 0xac6 #define XK_trademark 0xac9 #define XK_signaturemark 0xaca #define XK_trademarkincircle 0xacb #define XK_leftopentriangle 0xacc #define XK_rightopentriangle 0xacd #define XK_emopencircle 0xace #define XK_emopenrectangle 0xacf #define XK_leftsinglequotemark 0xad0 #define XK_rightsinglequotemark 0xad1 #define XK_leftdoublequotemark 0xad2 #define XK_rightdoublequotemark 0xad3 #define XK_prescription 0xad4 #define XK_minutes 0xad6 #define XK_seconds 0xad7 #define XK_latincross 0xad9 #define XK_hexagram 0xada #define XK_filledrectbullet 0xadb #define XK_filledlefttribullet 0xadc #define XK_filledrighttribullet 0xadd #define XK_emfilledcircle 0xade #define XK_emfilledrect 0xadf #define XK_enopencircbullet 0xae0 #define XK_enopensquarebullet 0xae1 #define XK_openrectbullet 0xae2 #define XK_opentribulletup 0xae3 #define XK_opentribulletdown 0xae4 #define XK_openstar 0xae5 #define XK_enfilledcircbullet 0xae6 #define XK_enfilledsqbullet 0xae7 #define XK_filledtribulletup 0xae8 #define XK_filledtribulletdown 0xae9 #define XK_leftpointer 0xaea #define XK_rightpointer 0xaeb #define XK_club 0xaec #define XK_diamond 0xaed #define XK_heart 0xaee #define XK_maltesecross 0xaf0 #define XK_dagger 0xaf1 #define XK_doubledagger 0xaf2 #define XK_checkmark 0xaf3 #define XK_ballotcross 0xaf4 #define XK_musicalsharp 0xaf5 #define XK_musicalflat 0xaf6 #define XK_malesymbol 0xaf7 #define XK_femalesymbol 0xaf8 #define XK_telephone 0xaf9 #define XK_telephonerecorder 0xafa #define XK_phonographcopyright 0xafb #define XK_caret 0xafc #define XK_singlelowquotemark 0xafd #define XK_doublelowquotemark 0xafe #define XK_cursor 0xaff #endif /* XK_PUBLISHING */ /* * APL * Byte 3 = b */ #ifdef XK_APL #define XK_leftcaret 0xba3 #define XK_rightcaret 0xba6 #define XK_downcaret 0xba8 #define XK_upcaret 0xba9 #define XK_overbar 0xbc0 #define XK_downtack 0xbc2 #define XK_upshoe 0xbc3 #define XK_downstile 0xbc4 #define XK_underbar 0xbc6 #define XK_jot 0xbca #define XK_quad 0xbcc #define XK_uptack 0xbce #define XK_circle 0xbcf #define XK_upstile 0xbd3 #define XK_downshoe 0xbd6 #define XK_rightshoe 0xbd8 #define XK_leftshoe 0xbda #define XK_lefttack 0xbdc #define XK_righttack 0xbfc #endif /* XK_APL */ /* * Hebrew * Byte 3 = c */ #ifdef XK_HEBREW #define XK_hebrew_doublelowline 0xcdf #define XK_hebrew_aleph 0xce0 #define XK_hebrew_bet 0xce1 #define XK_hebrew_beth 0xce1 /* deprecated */ #define XK_hebrew_gimel 0xce2 #define XK_hebrew_gimmel 0xce2 /* deprecated */ #define XK_hebrew_dalet 0xce3 #define XK_hebrew_daleth 0xce3 /* deprecated */ #define XK_hebrew_he 0xce4 #define XK_hebrew_waw 0xce5 #define XK_hebrew_zain 0xce6 #define XK_hebrew_zayin 0xce6 /* deprecated */ #define XK_hebrew_chet 0xce7 #define XK_hebrew_het 0xce7 /* deprecated */ #define XK_hebrew_tet 0xce8 #define XK_hebrew_teth 0xce8 /* deprecated */ #define XK_hebrew_yod 0xce9 #define XK_hebrew_finalkaph 0xcea #define XK_hebrew_kaph 0xceb #define XK_hebrew_lamed 0xcec #define XK_hebrew_finalmem 0xced #define XK_hebrew_mem 0xcee #define XK_hebrew_finalnun 0xcef #define XK_hebrew_nun 0xcf0 #define XK_hebrew_samech 0xcf1 #define XK_hebrew_samekh 0xcf1 /* deprecated */ #define XK_hebrew_ayin 0xcf2 #define XK_hebrew_finalpe 0xcf3 #define XK_hebrew_pe 0xcf4 #define XK_hebrew_finalzade 0xcf5 #define XK_hebrew_finalzadi 0xcf5 /* deprecated */ #define XK_hebrew_zade 0xcf6 #define XK_hebrew_zadi 0xcf6 /* deprecated */ #define XK_hebrew_qoph 0xcf7 #define XK_hebrew_kuf 0xcf7 /* deprecated */ #define XK_hebrew_resh 0xcf8 #define XK_hebrew_shin 0xcf9 #define XK_hebrew_taw 0xcfa #define XK_hebrew_taf 0xcfa /* deprecated */ #define XK_Hebrew_switch 0xFF7E /* Alias for mode_switch */ #endif /* XK_HEBREW */ /* * Thai * Byte 3 = d */ #ifdef XK_THAI #define XK_Thai_kokai 0xda1 #define XK_Thai_khokhai 0xda2 #define XK_Thai_khokhuat 0xda3 #define XK_Thai_khokhwai 0xda4 #define XK_Thai_khokhon 0xda5 #define XK_Thai_khorakhang 0xda6 #define XK_Thai_ngongu 0xda7 #define XK_Thai_chochan 0xda8 #define XK_Thai_choching 0xda9 #define XK_Thai_chochang 0xdaa #define XK_Thai_soso 0xdab #define XK_Thai_chochoe 0xdac #define XK_Thai_yoying 0xdad #define XK_Thai_dochada 0xdae #define XK_Thai_topatak 0xdaf #define XK_Thai_thothan 0xdb0 #define XK_Thai_thonangmontho 0xdb1 #define XK_Thai_thophuthao 0xdb2 #define XK_Thai_nonen 0xdb3 #define XK_Thai_dodek 0xdb4 #define XK_Thai_totao 0xdb5 #define XK_Thai_thothung 0xdb6 #define XK_Thai_thothahan 0xdb7 #define XK_Thai_thothong 0xdb8 #define XK_Thai_nonu 0xdb9 #define XK_Thai_bobaimai 0xdba #define XK_Thai_popla 0xdbb #define XK_Thai_phophung 0xdbc #define XK_Thai_fofa 0xdbd #define XK_Thai_phophan 0xdbe #define XK_Thai_fofan 0xdbf #define XK_Thai_phosamphao 0xdc0 #define XK_Thai_moma 0xdc1 #define XK_Thai_yoyak 0xdc2 #define XK_Thai_rorua 0xdc3 #define XK_Thai_ru 0xdc4 #define XK_Thai_loling 0xdc5 #define XK_Thai_lu 0xdc6 #define XK_Thai_wowaen 0xdc7 #define XK_Thai_sosala 0xdc8 #define XK_Thai_sorusi 0xdc9 #define XK_Thai_sosua 0xdca #define XK_Thai_hohip 0xdcb #define XK_Thai_lochula 0xdcc #define XK_Thai_oang 0xdcd #define XK_Thai_honokhuk 0xdce #define XK_Thai_paiyannoi 0xdcf #define XK_Thai_saraa 0xdd0 #define XK_Thai_maihanakat 0xdd1 #define XK_Thai_saraaa 0xdd2 #define XK_Thai_saraam 0xdd3 #define XK_Thai_sarai 0xdd4 #define XK_Thai_saraii 0xdd5 #define XK_Thai_saraue 0xdd6 #define XK_Thai_sarauee 0xdd7 #define XK_Thai_sarau 0xdd8 #define XK_Thai_sarauu 0xdd9 #define XK_Thai_phinthu 0xdda #define XK_Thai_maihanakat_maitho 0xdde #define XK_Thai_baht 0xddf #define XK_Thai_sarae 0xde0 #define XK_Thai_saraae 0xde1 #define XK_Thai_sarao 0xde2 #define XK_Thai_saraaimaimuan 0xde3 #define XK_Thai_saraaimaimalai 0xde4 #define XK_Thai_lakkhangyao 0xde5 #define XK_Thai_maiyamok 0xde6 #define XK_Thai_maitaikhu 0xde7 #define XK_Thai_maiek 0xde8 #define XK_Thai_maitho 0xde9 #define XK_Thai_maitri 0xdea #define XK_Thai_maichattawa 0xdeb #define XK_Thai_thanthakhat 0xdec #define XK_Thai_nikhahit 0xded #define XK_Thai_leksun 0xdf0 #define XK_Thai_leknung 0xdf1 #define XK_Thai_leksong 0xdf2 #define XK_Thai_leksam 0xdf3 #define XK_Thai_leksi 0xdf4 #define XK_Thai_lekha 0xdf5 #define XK_Thai_lekhok 0xdf6 #define XK_Thai_lekchet 0xdf7 #define XK_Thai_lekpaet 0xdf8 #define XK_Thai_lekkao 0xdf9 #endif /* XK_THAI */ /* * Korean * Byte 3 = e */ #ifdef XK_KOREAN #define XK_Hangul 0xff31 /* Hangul start/stop(toggle) */ #define XK_Hangul_Start 0xff32 /* Hangul start */ #define XK_Hangul_End 0xff33 /* Hangul end, English start */ #define XK_Hangul_Hanja 0xff34 /* Start Hangul->Hanja Conversion */ #define XK_Hangul_Jamo 0xff35 /* Hangul Jamo mode */ #define XK_Hangul_Romaja 0xff36 /* Hangul Romaja mode */ #define XK_Hangul_Codeinput 0xff37 /* Hangul code input mode */ #define XK_Hangul_Jeonja 0xff38 /* Jeonja mode */ #define XK_Hangul_Banja 0xff39 /* Banja mode */ #define XK_Hangul_PreHanja 0xff3a /* Pre Hanja conversion */ #define XK_Hangul_PostHanja 0xff3b /* Post Hanja conversion */ #define XK_Hangul_SingleCandidate 0xff3c /* Single candidate */ #define XK_Hangul_MultipleCandidate 0xff3d /* Multiple candidate */ #define XK_Hangul_PreviousCandidate 0xff3e /* Previous candidate */ #define XK_Hangul_Special 0xff3f /* Special symbols */ #define XK_Hangul_switch 0xFF7E /* Alias for mode_switch */ /* Hangul Consonant Characters */ #define XK_Hangul_Kiyeog 0xea1 #define XK_Hangul_SsangKiyeog 0xea2 #define XK_Hangul_KiyeogSios 0xea3 #define XK_Hangul_Nieun 0xea4 #define XK_Hangul_NieunJieuj 0xea5 #define XK_Hangul_NieunHieuh 0xea6 #define XK_Hangul_Dikeud 0xea7 #define XK_Hangul_SsangDikeud 0xea8 #define XK_Hangul_Rieul 0xea9 #define XK_Hangul_RieulKiyeog 0xeaa #define XK_Hangul_RieulMieum 0xeab #define XK_Hangul_RieulPieub 0xeac #define XK_Hangul_RieulSios 0xead #define XK_Hangul_RieulTieut 0xeae #define XK_Hangul_RieulPhieuf 0xeaf #define XK_Hangul_RieulHieuh 0xeb0 #define XK_Hangul_Mieum 0xeb1 #define XK_Hangul_Pieub 0xeb2 #define XK_Hangul_SsangPieub 0xeb3 #define XK_Hangul_PieubSios 0xeb4 #define XK_Hangul_Sios 0xeb5 #define XK_Hangul_SsangSios 0xeb6 #define XK_Hangul_Ieung 0xeb7 #define XK_Hangul_Jieuj 0xeb8 #define XK_Hangul_SsangJieuj 0xeb9 #define XK_Hangul_Cieuc 0xeba #define XK_Hangul_Khieuq 0xebb #define XK_Hangul_Tieut 0xebc #define XK_Hangul_Phieuf 0xebd #define XK_Hangul_Hieuh 0xebe /* Hangul Vowel Characters */ #define XK_Hangul_A 0xebf #define XK_Hangul_AE 0xec0 #define XK_Hangul_YA 0xec1 #define XK_Hangul_YAE 0xec2 #define XK_Hangul_EO 0xec3 #define XK_Hangul_E 0xec4 #define XK_Hangul_YEO 0xec5 #define XK_Hangul_YE 0xec6 #define XK_Hangul_O 0xec7 #define XK_Hangul_WA 0xec8 #define XK_Hangul_WAE 0xec9 #define XK_Hangul_OE 0xeca #define XK_Hangul_YO 0xecb #define XK_Hangul_U 0xecc #define XK_Hangul_WEO 0xecd #define XK_Hangul_WE 0xece #define XK_Hangul_WI 0xecf #define XK_Hangul_YU 0xed0 #define XK_Hangul_EU 0xed1 #define XK_Hangul_YI 0xed2 #define XK_Hangul_I 0xed3 /* Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_Kiyeog 0xed4 #define XK_Hangul_J_SsangKiyeog 0xed5 #define XK_Hangul_J_KiyeogSios 0xed6 #define XK_Hangul_J_Nieun 0xed7 #define XK_Hangul_J_NieunJieuj 0xed8 #define XK_Hangul_J_NieunHieuh 0xed9 #define XK_Hangul_J_Dikeud 0xeda #define XK_Hangul_J_Rieul 0xedb #define XK_Hangul_J_RieulKiyeog 0xedc #define XK_Hangul_J_RieulMieum 0xedd #define XK_Hangul_J_RieulPieub 0xede #define XK_Hangul_J_RieulSios 0xedf #define XK_Hangul_J_RieulTieut 0xee0 #define XK_Hangul_J_RieulPhieuf 0xee1 #define XK_Hangul_J_RieulHieuh 0xee2 #define XK_Hangul_J_Mieum 0xee3 #define XK_Hangul_J_Pieub 0xee4 #define XK_Hangul_J_PieubSios 0xee5 #define XK_Hangul_J_Sios 0xee6 #define XK_Hangul_J_SsangSios 0xee7 #define XK_Hangul_J_Ieung 0xee8 #define XK_Hangul_J_Jieuj 0xee9 #define XK_Hangul_J_Cieuc 0xeea #define XK_Hangul_J_Khieuq 0xeeb #define XK_Hangul_J_Tieut 0xeec #define XK_Hangul_J_Phieuf 0xeed #define XK_Hangul_J_Hieuh 0xeee /* Ancient Hangul Consonant Characters */ #define XK_Hangul_RieulYeorinHieuh 0xeef #define XK_Hangul_SunkyeongeumMieum 0xef0 #define XK_Hangul_SunkyeongeumPieub 0xef1 #define XK_Hangul_PanSios 0xef2 #define XK_Hangul_KkogjiDalrinIeung 0xef3 #define XK_Hangul_SunkyeongeumPhieuf 0xef4 #define XK_Hangul_YeorinHieuh 0xef5 /* Ancient Hangul Vowel Characters */ #define XK_Hangul_AraeA 0xef6 #define XK_Hangul_AraeAE 0xef7 /* Ancient Hangul syllable-final (JongSeong) Characters */ #define XK_Hangul_J_PanSios 0xef8 #define XK_Hangul_J_KkogjiDalrinIeung 0xef9 #define XK_Hangul_J_YeorinHieuh 0xefa /* Korean currency symbol */ #define XK_Korean_Won 0xeff #endif /* XK_KOREAN */ vnc_unixsrc/Xvnc/include/Xpoll.h0100664000076400007640000001626407463513423016320 0ustar constconst/* $XConsortium: Xpoll.h /main/6 1996/12/02 10:25:52 lehors $ */ /* Copyright (c) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XPOLL_H_ #define _XPOLL_H_ #ifndef WIN32 #ifndef USE_POLL #include #if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE) #include #ifdef luna #include #endif #endif /* AIX 4.2 fubar-ed , so go to heroic measures to get it */ #if defined(AIXV4) && !defined(NFDBITS) #include #endif #include #ifdef CSRG_BASED #include # if BSD < 199103 typedef long fd_mask; # endif #endif #define XFD_SETSIZE 256 #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif #ifndef NBBY #define NBBY 8 /* number of bits in a byte */ #endif #ifndef NFDBITS #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ #endif #ifndef howmany #define howmany(x,y) (((x)+((y)-1))/(y)) #endif #ifdef BSD # if BSD < 198911 /* 198911 == OSF/1, 199103 == CSRG_BASED */ # ifndef luna /* and even though on LUNA BSD == 43, it has it */ typedef struct fd_set { fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; } fd_set; # endif # endif #endif #if defined(hpux) && ! defined(HPUX_10) /* and perhaps old BSD ??? */ #define Select(n,r,w,e,t) select(n,(int*)r,(int*)w,(int*)e,(struct timeval*)t) #else #define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #endif #ifndef FD_SET #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #endif #ifndef FD_CLR #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #endif #ifndef FD_ISSET #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) #endif #ifndef FD_ZERO #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) #endif /* * The following macros are used by the servers only. There is an * explicit assumption that the bit array in the fd_set is at least * 256 bits long (8 32-bit words). This is true on most modern POSIX * systems. Note that this is merely an optimization for the servers * based on assumptions about the way that file descripters are * allocated on POSIX systems. * * When porting X to new systems it is important to adjust these * macros if the system has fewer than 256 bits in the fd_set bit * array. */ #define XFD_ANYSET(p) \ ((p)->fds_bits[0] || (p)->fds_bits[1] || \ (p)->fds_bits[2] || (p)->fds_bits[3] || \ (p)->fds_bits[4] || (p)->fds_bits[5] || \ (p)->fds_bits[6] || (p)->fds_bits[7]) #define XFD_COPYSET(src,dst) \ (dst)->fds_bits[0] = (src)->fds_bits[0]; \ (dst)->fds_bits[1] = (src)->fds_bits[1]; \ (dst)->fds_bits[2] = (src)->fds_bits[2]; \ (dst)->fds_bits[3] = (src)->fds_bits[3]; \ (dst)->fds_bits[4] = (src)->fds_bits[4]; \ (dst)->fds_bits[5] = (src)->fds_bits[5]; \ (dst)->fds_bits[6] = (src)->fds_bits[6]; \ (dst)->fds_bits[7] = (src)->fds_bits[7]; #define XFD_ANDSET(dst,b1,b2) \ (dst)->fds_bits[0] = ((b1)->fds_bits[0] & (b2)->fds_bits[0]); \ (dst)->fds_bits[1] = ((b1)->fds_bits[1] & (b2)->fds_bits[1]); \ (dst)->fds_bits[2] = ((b1)->fds_bits[2] & (b2)->fds_bits[2]); \ (dst)->fds_bits[3] = ((b1)->fds_bits[3] & (b2)->fds_bits[3]); \ (dst)->fds_bits[4] = ((b1)->fds_bits[4] & (b2)->fds_bits[4]); \ (dst)->fds_bits[5] = ((b1)->fds_bits[5] & (b2)->fds_bits[5]); \ (dst)->fds_bits[6] = ((b1)->fds_bits[6] & (b2)->fds_bits[6]); \ (dst)->fds_bits[7] = ((b1)->fds_bits[7] & (b2)->fds_bits[7]); #define XFD_ORSET(dst,b1,b2) \ (dst)->fds_bits[0] = ((b1)->fds_bits[0] | (b2)->fds_bits[0]); \ (dst)->fds_bits[1] = ((b1)->fds_bits[1] | (b2)->fds_bits[1]); \ (dst)->fds_bits[2] = ((b1)->fds_bits[2] | (b2)->fds_bits[2]); \ (dst)->fds_bits[3] = ((b1)->fds_bits[3] | (b2)->fds_bits[3]); \ (dst)->fds_bits[4] = ((b1)->fds_bits[4] | (b2)->fds_bits[4]); \ (dst)->fds_bits[5] = ((b1)->fds_bits[5] | (b2)->fds_bits[5]); \ (dst)->fds_bits[6] = ((b1)->fds_bits[6] | (b2)->fds_bits[6]); \ (dst)->fds_bits[7] = ((b1)->fds_bits[7] | (b2)->fds_bits[7]); #define XFD_UNSET(dst,b1) \ (dst)->fds_bits[0] &= ~((b1)->fds_bits[0]); \ (dst)->fds_bits[1] &= ~((b1)->fds_bits[1]); \ (dst)->fds_bits[2] &= ~((b1)->fds_bits[2]); \ (dst)->fds_bits[3] &= ~((b1)->fds_bits[3]); \ (dst)->fds_bits[4] &= ~((b1)->fds_bits[4]); \ (dst)->fds_bits[5] &= ~((b1)->fds_bits[5]); \ (dst)->fds_bits[6] &= ~((b1)->fds_bits[6]); \ (dst)->fds_bits[7] &= ~((b1)->fds_bits[7]); #else /* USE_POLL */ #include #endif /* USE_POLL */ #else /* WIN32 */ #define XFD_SETSIZE 256 #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif #include #define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) #define XFD_SETCOUNT(p) (((fd_set FAR *)(p))->fd_count) #define XFD_FD(p,i) (((fd_set FAR *)(p))->fd_array[i]) #define XFD_ANYSET(p) XFD_SETCOUNT(p) #define XFD_COPYSET(src,dst) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(src) ; __i++) { \ XFD_FD(dst,__i) = XFD_FD(src,__i); \ } \ XFD_SETCOUNT(dst) = XFD_SETCOUNT(src); \ } #define XFD_ANDSET(dst,b1,b2) { \ u_int __i; \ FD_ZERO(dst); \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ if (FD_ISSET(XFD_FD(b1,__i), b2)) \ FD_SET(XFD_FD(b1,__i), dst); \ } \ } #define XFD_ORSET(dst,b1,b2) { \ u_int __i; \ XFD_COPYSET(b1,dst); \ for (__i = 0; __i < XFD_SETCOUNT(b2) ; __i++) { \ if (!FD_ISSET(XFD_FD(b2,__i), dst)) \ FD_SET(XFD_FD(b2,__i), dst); \ } \ } /* this one is really sub-optimal */ #define XFD_UNSET(dst,b1) { \ u_int __i; \ for (__i = 0; __i < XFD_SETCOUNT(b1) ; __i++) { \ FD_CLR(XFD_FD(b1,__i), dst); \ } \ } /* we have to pay the price of having an array here, unlike with bitmasks calling twice FD_SET with the same fd is not transparent, so be careful */ #undef FD_SET #define FD_SET(fd,set) do { \ if (XFD_SETCOUNT(set) < FD_SETSIZE && !FD_ISSET(fd,set)) \ XFD_FD(set,XFD_SETCOUNT(set)++)=(fd); \ } while(0) #define getdtablesize() FD_SETSIZE #endif /* WIN32 */ #endif /* _XPOLL_H_ */ vnc_unixsrc/Xvnc/include/fonts/0040775000076400007640000000000010616336463016175 5ustar constconstvnc_unixsrc/Xvnc/include/fonts/fontstruct.h0100664000076400007640000002462507120677563020574 0ustar constconst/* $XConsortium: fontstruct.h /main/17 1996/08/09 16:23:54 kaleb $ */ /* $XFree86: xc/include/fonts/fontstruct.h,v 3.1 1996/12/23 05:58:39 dawes Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef FONTSTR_H #define FONTSTR_H #include #include "font.h" #include /* * This version of the server font data strucutre is only for describing * the in memory data structure. The file structure is not necessarily a * copy of this. That is up to the compiler and the OS layer font loading * machinery. */ #define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */ typedef struct _FontProp { long name; long value; /* assumes ATOM is not larger than INT32 */ } FontPropRec; typedef struct _FontResolution { unsigned short x_resolution; unsigned short y_resolution; unsigned short point_size; } FontResolutionRec; typedef struct _ExtentInfo { DrawDirection drawDirection; int fontAscent; int fontDescent; int overallAscent; int overallDescent; int overallWidth; int overallLeft; int overallRight; } ExtentInfoRec; typedef struct _CharInfo { xCharInfo metrics; /* info preformatted for Queries */ char *bits; /* pointer to glyph image */ } CharInfoRec; /* * Font is created at font load time. It is specific to a single encoding. * e.g. not all of the glyphs in a font may be part of a single encoding. */ typedef struct _FontInfo { unsigned short firstCol; unsigned short lastCol; unsigned short firstRow; unsigned short lastRow; unsigned short defaultCh; unsigned int noOverlap:1; unsigned int terminalFont:1; unsigned int constantMetrics:1; unsigned int constantWidth:1; unsigned int inkInside:1; unsigned int inkMetrics:1; unsigned int allExist:1; unsigned int drawDirection:2; unsigned int cachable:1; unsigned int anamorphic:1; short maxOverlap; short pad; xCharInfo maxbounds; xCharInfo minbounds; xCharInfo ink_maxbounds; xCharInfo ink_minbounds; short fontAscent; short fontDescent; int nprops; FontPropPtr props; char *isStringProp; } FontInfoRec; typedef struct _Font { int refcnt; FontInfoRec info; char bit; char byte; char glyph; char scan; fsBitmapFormat format; int (*get_glyphs) ( #if NeedNestedPrototypes FontPtr /* font */, unsigned long /* count */, unsigned char * /* chars */, FontEncoding /* encoding */, unsigned long * /* count */, CharInfoPtr * /* glyphs */ #endif ); int (*get_metrics) ( #if NeedNestedPrototypes FontPtr /* font */, unsigned long /* count */, unsigned char * /* chars */, FontEncoding /* encoding */, unsigned long * /* count */, xCharInfo ** /* glyphs */ #endif ); void (*unload_font) ( #if NeedNestedPrototypes FontPtr /* font */ #endif ); void (*unload_glyphs) ( #if NeedNestedPrototypes FontPtr /* font */ #endif ); FontPathElementPtr fpe; pointer svrPrivate; pointer fontPrivate; pointer fpePrivate; int maxPrivate; pointer *devPrivates; } FontRec; extern Bool _FontSetNewPrivate ( #if NeedFunctionPrototypes FontPtr /* pFont */, int /* n */, pointer /* ptr */ #endif ); extern int AllocateFontPrivateIndex ( #if NeedFunctionPrototypes void #endif ); #define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \ (pFont)->devPrivates[n]) #define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \ _FontSetNewPrivate (pFont, n, ptr) : \ ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE)) typedef struct _FontNames { int nnames; int size; int *length; char **names; } FontNamesRec; /* External view of font paths */ typedef struct _FontPathElement { int name_length; char *name; int type; int refcount; pointer private; } FontPathElementRec; typedef struct _FPEFunctions { int (*name_check) ( #if NeedFunctionPrototypes char* /* name */ #endif ); int (*init_fpe) ( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ); int (*reset_fpe) ( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ); int (*free_fpe) ( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ); int (*open_font) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, int /* flags */, char* /* name */, int /* namelen */, fsBitmapFormat /* format */, fsBitmapFormatMask /* fmask */, unsigned long /* id (type XID or FSID) */, FontPtr* /* pFont */, char** /* aliasName */, FontPtr /* non_cachable_font */ #endif ); int (*close_font) ( #if NeedNestedPrototypes FontPathElementPtr /* fpe */, FontPtr /* pFont */ #endif ); int (*list_fonts) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, FontNamesPtr /* names */ #endif ); int (*start_list_fonts_and_aliases) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, pointer* /* privatep */ #endif ); int (*list_next_font_or_alias) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char** /* namep */, int* /* namelenp */, char** /* resolvedp */, int* /* resolvedlenp */, pointer /* private */ #endif ); int (*start_list_fonts_with_info) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* patlen */, int /* maxnames */, pointer* /* privatep */ #endif ); int (*list_next_font_with_info) ( /* client, fpe, name, namelen, info, num, data */ #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char** /* name */, int* /* namelen */, FontInfoPtr* /* info */, int* /* numFonts */, pointer /* private */ #endif ); int (*wakeup_fpe) ( #if NeedNestedPrototypes FontPathElementPtr /* fpe */, unsigned long* /* LastSelectMask */ #endif ); int (*client_died) ( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */ #endif ); /* for load_glyphs, range_flag = 0 -> nchars = # of characters in data item_size = bytes/char data = list of characters range_flag = 1 -> nchars = # of fsChar2b's in data item_size is ignored data = list of fsChar2b's */ int (*load_glyphs) ( #if NeedNestedPrototypes pointer /* client */, FontPtr /* pfont */, Bool /* range_flag */, unsigned int /* nchars */, int /* item_size */, unsigned char* /* data */ #endif ); void (*set_path_hook)( #if NeedFunctionPrototypes void #endif ); } FPEFunctionsRec, FPEFunctions; #if 0 /* unused */ extern int InitFPETypes(); #endif /* * Various macros for computing values based on contents of * the above structures */ #define GLYPHWIDTHPIXELS(pci) \ ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) #define GLYPHHEIGHTPIXELS(pci) \ ((pci)->metrics.ascent + (pci)->metrics.descent) #define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) #define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7) #define BYTES_PER_ROW(bits, nbytes) \ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ : 0) #define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \ BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad)) /* * Macros for computing different bounding boxes for fonts; from * the font protocol */ #define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \ (pi)->fontAscent : (pi)->ink_maxbounds.ascent) #define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \ (pi)->fontDescent : (pi)->ink_maxbounds.descent) #define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi)) #define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \ (pi)->ink_minbounds.leftSideBearing : 0) #define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \ (pi)->ink_maxbounds.characterWidth ? \ (pi)->ink_maxbounds.rightSideBearing : \ (pi)->ink_maxbounds.characterWidth) #define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi)) #endif /* FONTSTR_H */ vnc_unixsrc/Xvnc/include/fonts/FSproto.h0100664000076400007640000005032607120677563017752 0ustar constconst/* $XConsortium: FSproto.h,v 1.11 94/04/17 20:11:05 gildea Exp $ */ /* Copyright (c) 1990, 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices, or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ #ifndef _FS_PROTO_H_ #define _FS_PROTO_H_ #include "FS.h" #define sz_fsPropOffset 20 #define sz_fsPropInfo 8 #define sz_fsResolution 6 #define sz_fsChar2b 2 #define sz_fsChar2b_version1 2 #define sz_fsOffset32 8 #define sz_fsRange 4 #define sz_fsXCharInfo 12 #define sz_fsXFontInfoHeader 40 #define sz_fsConnClientPrefix 8 #define sz_fsConnSetup 12 #define sz_fsConnSetupExtra 8 #define sz_fsConnSetupAccept 12 /* request sizes */ #define sz_fsReq 4 #define sz_fsListExtensionsReq 4 #define sz_fsResourceReq 8 #define sz_fsNoopReq 4 #define sz_fsListExtensionReq 4 #define sz_fsQueryExtensionReq 4 #define sz_fsListCataloguesReq 12 #define sz_fsSetCataloguesReq 4 #define sz_fsGetCataloguesReq 4 #define sz_fsSetEventMaskReq 8 #define sz_fsGetEventMaskReq 4 #define sz_fsCreateACReq 8 #define sz_fsFreeACReq 8 #define sz_fsSetAuthorizationReq 8 #define sz_fsSetResolutionReq 4 #define sz_fsGetResolutionReq 4 #define sz_fsListFontsReq 12 #define sz_fsListFontsWithXInfoReq 12 #define sz_fsOpenBitmapFontReq 16 #define sz_fsQueryXInfoReq 8 #define sz_fsQueryXExtents8Req 12 #define sz_fsQueryXExtents16Req 12 #define sz_fsQueryXBitmaps8Req 16 #define sz_fsQueryXBitmaps16Req 16 #define sz_fsCloseReq 8 /* reply sizes */ #define sz_fsReply 8 #define sz_fsGenericReply 8 #define sz_fsListExtensionsReply 8 #define sz_fsQueryExtensionReply 20 #define sz_fsListCataloguesReply 16 #define sz_fsGetCataloguesReply 8 #define sz_fsGetEventMaskReply 12 #define sz_fsCreateACReply 12 #define sz_fsGetResolutionReply 8 #define sz_fsListFontsReply 16 #define sz_fsListFontsWithXInfoReply (12 + sz_fsXFontInfoHeader) #define sz_fsOpenBitmapFontReply 16 #define sz_fsQueryXInfoReply (8 + sz_fsXFontInfoHeader) #define sz_fsQueryXExtents8Reply 12 #define sz_fsQueryXExtents16Reply 12 #define sz_fsQueryXBitmaps8Reply 20 #define sz_fsQueryXBitmaps16Reply 20 #define sz_fsError 16 #define sz_fsEvent 12 #define sz_fsKeepAliveEvent 12 #define fsTrue 1 #define fsFalse 0 /* temp decls */ #define Mask CARD32 #define Font CARD32 #define AccContext CARD32 typedef CARD32 fsTimestamp; #ifdef NOTDEF /* in fsmasks.h */ typedef CARD32 fsBitmapFormat; typedef CARD32 fsBitmapFormatMask; #endif #define sz_fsBitmapFormat 4 typedef struct { INT16 left B16, right B16; INT16 width B16; INT16 ascent B16, descent B16; CARD16 attributes B16; } fsXCharInfo; typedef struct { CARD8 high; CARD8 low; } fsChar2b; typedef struct { CARD8 low; CARD8 high; } fsChar2b_version1; typedef struct { CARD8 min_char_high; CARD8 min_char_low; CARD8 max_char_high; CARD8 max_char_low; } fsRange; typedef struct { CARD32 position B32; CARD32 length B32; } fsOffset32; typedef struct { fsOffset32 name; fsOffset32 value; CARD8 type; BYTE pad0; CARD16 pad1 B16; } fsPropOffset; typedef struct { CARD32 num_offsets B32; CARD32 data_len B32; /* offsets */ /* data */ } fsPropInfo; typedef struct { CARD16 x_resolution B16; CARD16 y_resolution B16; CARD16 point_size B16; } fsResolution; typedef struct { CARD32 flags B32; CARD8 char_range_min_char_high; CARD8 char_range_min_char_low; CARD8 char_range_max_char_high; CARD8 char_range_max_char_low; CARD8 draw_direction; CARD8 pad; CARD8 default_char_high; CARD8 default_char_low; INT16 min_bounds_left B16; INT16 min_bounds_right B16; INT16 min_bounds_width B16; INT16 min_bounds_ascent B16; INT16 min_bounds_descent B16; CARD16 min_bounds_attributes B16; INT16 max_bounds_left B16; INT16 max_bounds_right B16; INT16 max_bounds_width B16; INT16 max_bounds_ascent B16; INT16 max_bounds_descent B16; CARD16 max_bounds_attributes B16; INT16 font_ascent B16; INT16 font_descent B16; /* propinfo */ } fsXFontInfoHeader; /* requests */ typedef struct { BYTE byteOrder; CARD8 num_auths; CARD16 major_version B16; CARD16 minor_version B16; CARD16 auth_len B16; /* auth data */ } fsConnClientPrefix; typedef struct { CARD16 status B16; CARD16 major_version B16; CARD16 minor_version B16; CARD8 num_alternates; CARD8 auth_index; CARD16 alternate_len B16; CARD16 auth_len B16; /* alternates */ /* auth data */ } fsConnSetup; typedef struct { CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* more auth data */ } fsConnSetupExtra; typedef struct { CARD32 length B32; CARD16 max_request_len B16; CARD16 vendor_len B16; CARD32 release_number B32; /* vendor string */ } fsConnSetupAccept; typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; } fsReq; /* * The fsFakeReq structure is never used in the protocol; it is prepended * to incoming packets when setting up a connection so we can index * through InitialVector. To avoid alignment problems, it is padded * to the size of a word on the largest machine this code runs on. * Hence no sz_fsFakeReq constant is necessary. */ typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; CARD32 pad B32; /* to fill out to multiple of 64 bits */ } fsFakeReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font id B32; } fsResourceReq; typedef fsReq fsNoopReq; typedef fsReq fsListExtensionsReq; typedef struct { CARD8 reqType; BYTE nbytes; CARD16 length B16; /* name */ } fsQueryExtensionReq; typedef struct { CARD8 reqType; CARD8 data; CARD16 length B16; CARD32 maxNames B32; CARD16 nbytes B16; CARD16 pad2 B16; /* pattern */ } fsListCataloguesReq; typedef struct { CARD8 reqType; BYTE num_catalogues; CARD16 length B16; /* catalogues */ } fsSetCataloguesReq; typedef fsReq fsGetCataloguesReq; typedef struct { CARD8 reqType; CARD8 ext_opcode; CARD16 length B16; Mask event_mask; } fsSetEventMaskReq; typedef struct { CARD8 reqType; CARD8 ext_opcode; CARD16 length B16; } fsGetEventMaskReq; typedef struct { CARD8 reqType; BYTE num_auths; CARD16 length B16; AccContext acid B32; /* auth protocols */ } fsCreateACReq; typedef fsResourceReq fsFreeACReq; typedef fsResourceReq fsSetAuthorizationReq; typedef struct { CARD8 reqType; BYTE num_resolutions; CARD16 length B16; /* resolutions */ } fsSetResolutionReq; typedef fsReq fsGetResolutionReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; CARD32 maxNames B32; CARD16 nbytes B16; CARD16 pad2 B16; /* pattern */ } fsListFontsReq; typedef fsListFontsReq fsListFontsWithXInfoReq; typedef struct { CARD8 reqType; BYTE pad; CARD16 length B16; Font fid B32; fsBitmapFormatMask format_mask B32; fsBitmapFormat format_hint B32; /* pattern */ } fsOpenBitmapFontReq; typedef fsResourceReq fsQueryXInfoReq; typedef struct { CARD8 reqType; BOOL range; CARD16 length B16; Font fid B32; CARD32 num_ranges B32; /* list of chars */ } fsQueryXExtents8Req; typedef fsQueryXExtents8Req fsQueryXExtents16Req; typedef struct { CARD8 reqType; BOOL range; CARD16 length B16; Font fid B32; fsBitmapFormat format B32; CARD32 num_ranges B32; /* list of chars */ } fsQueryXBitmaps8Req; typedef fsQueryXBitmaps8Req fsQueryXBitmaps16Req; typedef fsResourceReq fsCloseReq; /* replies */ typedef struct { BYTE type; BYTE data1; CARD16 sequenceNumber B16; CARD32 length B32; } fsGenericReply; typedef struct { BYTE type; CARD8 nExtensions; CARD16 sequenceNumber B16; CARD32 length B32; /* extension names */ } fsListExtensionsReply; typedef struct { BYTE type; CARD8 present; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 major_version B16; CARD16 minor_version B16; CARD8 major_opcode; CARD8 first_event; CARD8 num_events; CARD8 first_error; CARD8 num_errors; CARD8 pad1; CARD16 pad2 B16; } fsQueryExtensionReply; typedef struct { BYTE type; BYTE pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_replies B32; CARD32 num_catalogues B32; /* catalog names */ } fsListCataloguesReply; typedef struct { BYTE type; CARD8 num_catalogues; CARD16 sequenceNumber B16; CARD32 length B32; /* catalogue names */ } fsGetCataloguesReply; typedef struct { BYTE type; BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 event_mask B32; } fsGetEventMaskReply; typedef struct { BYTE type; CARD8 auth_index; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* auth data */ } fsCreateACReply; typedef struct { CARD32 length B32; CARD16 status B16; CARD16 pad B16; /* auth data */ } fsCreateACExtraReply; typedef struct { BYTE type; CARD8 num_resolutions; CARD16 sequenceNumber B16; CARD32 length B32; /* resolutions */ } fsGetResolutionReply; typedef struct { BYTE type; BYTE pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 following B32; CARD32 nFonts B32; /* font names */ } fsListFontsReply; /* * this one is messy. the reply itself is variable length (unknown * number of replies) and the contents of each is variable (unknown * number of properties) * */ typedef struct { BYTE type; CARD8 nameLength; /* 0 is end-of-reply */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nReplies B32; CARD32 font_header_flags B32; CARD8 font_hdr_char_range_min_char_high; CARD8 font_hdr_char_range_min_char_low; CARD8 font_hdr_char_range_max_char_high; CARD8 font_hdr_char_range_max_char_low; CARD8 font_header_draw_direction; CARD8 font_header_pad; CARD8 font_header_default_char_high; CARD8 font_header_default_char_low; INT16 font_header_min_bounds_left B16; INT16 font_header_min_bounds_right B16; INT16 font_header_min_bounds_width B16; INT16 font_header_min_bounds_ascent B16; INT16 font_header_min_bounds_descent B16; CARD16 font_header_min_bounds_attributes B16; INT16 font_header_max_bounds_left B16; INT16 font_header_max_bounds_right B16; INT16 font_header_max_bounds_width B16; INT16 font_header_max_bounds_ascent B16; INT16 font_header_max_bounds_descent B16; CARD16 font_header_max_bounds_attributes B16; INT16 font_header_font_ascent B16; INT16 font_header_font_descent B16; /* propinfo */ /* name */ } fsListFontsWithXInfoReply; typedef struct { BYTE type; CARD8 otherid_valid; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 otherid B32; BYTE cachable; BYTE pad1; CARD16 pad2 B16; } fsOpenBitmapFontReply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 font_header_flags B32; CARD8 font_hdr_char_range_min_char_high; CARD8 font_hdr_char_range_min_char_low; CARD8 font_hdr_char_range_max_char_high; CARD8 font_hdr_char_range_max_char_low; CARD8 font_header_draw_direction; CARD8 font_header_pad; CARD8 font_header_default_char_high; CARD8 font_header_default_char_low; INT16 font_header_min_bounds_left B16; INT16 font_header_min_bounds_right B16; INT16 font_header_min_bounds_width B16; INT16 font_header_min_bounds_ascent B16; INT16 font_header_min_bounds_descent B16; CARD16 font_header_min_bounds_attributes B16; INT16 font_header_max_bounds_left B16; INT16 font_header_max_bounds_right B16; INT16 font_header_max_bounds_width B16; INT16 font_header_max_bounds_ascent B16; INT16 font_header_max_bounds_descent B16; CARD16 font_header_max_bounds_attributes B16; INT16 font_header_font_ascent B16; INT16 font_header_font_descent B16; /* propinfo */ } fsQueryXInfoReply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 num_extents B32; /* extents */ } fsQueryXExtents8Reply; typedef fsQueryXExtents8Reply fsQueryXExtents16Reply; typedef struct { BYTE type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 replies_hint B32; CARD32 num_chars B32; CARD32 nbytes B32; /* offsets */ /* glyphs */ } fsQueryXBitmaps8Reply; typedef fsQueryXBitmaps8Reply fsQueryXBitmaps16Reply; typedef union { fsGenericReply generic; fsListExtensionsReply extensions; fsGetResolutionReply getres; } fsReply; /* errors */ typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsRequestError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; fsBitmapFormat format B32; } fsFormatError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Font fontid; } fsFontError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; fsRange range; } fsRangeError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Mask event_mask; } fsEventMaskError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; AccContext acid; } fsAccessContextError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; Font fontid; } fsIDChoiceError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsNameError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; fsResolution resolution; } fsResolutionError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsAllocError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; CARD32 bad_length B32; } fsLengthError; typedef struct { BYTE type; BYTE request; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; CARD8 major_opcode; CARD8 minor_opcode; CARD16 pad B16; } fsImplementationError; /* events */ typedef struct { BYTE type; BYTE event_code; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; } fsKeepAliveEvent; typedef struct { BYTE type; BYTE event_code; CARD16 sequenceNumber B16; CARD32 length B32; fsTimestamp timestamp; BOOL added; BOOL deleted; CARD16 pad B16; } fsCatalogueChangeNotifyEvent; typedef fsCatalogueChangeNotifyEvent fsFontChangeNotifyEvent; typedef fsCatalogueChangeNotifyEvent fsEvent; /* reply codes */ #define FS_Reply 0 /* normal reply */ #define FS_Error 1 /* error */ #define FS_Event 2 /* request codes */ #define FS_Noop 0 #define FS_ListExtensions 1 #define FS_QueryExtension 2 #define FS_ListCatalogues 3 #define FS_SetCatalogues 4 #define FS_GetCatalogues 5 #define FS_SetEventMask 6 #define FS_GetEventMask 7 #define FS_CreateAC 8 #define FS_FreeAC 9 #define FS_SetAuthorization 10 #define FS_SetResolution 11 #define FS_GetResolution 12 #define FS_ListFonts 13 #define FS_ListFontsWithXInfo 14 #define FS_OpenBitmapFont 15 #define FS_QueryXInfo 16 #define FS_QueryXExtents8 17 #define FS_QueryXExtents16 18 #define FS_QueryXBitmaps8 19 #define FS_QueryXBitmaps16 20 #define FS_CloseFont 21 /* restore decls */ #undef Mask #undef Font #undef AccContext #endif /* _FS_PROTO_H_ */ vnc_unixsrc/Xvnc/include/fonts/Imakefile0100664000076400007640000000074707120677563020020 0ustar constconstXCOMM $XConsortium: Imakefile /main/6 1996/09/28 16:32:27 rws $ XCOMM $XFree86: xc/include/fonts/Imakefile,v 3.3 1996/12/23 05:58:37 dawes Exp $ HEADERS = FS.h FSproto.h fsmasks.h all:: BuildIncludes($(HEADERS),X11/fonts,../..) InstallMultipleFlags($(HEADERS),$(INCDIR)/X11/fonts,$(INSTINCFLAGS)) InstallLinkKitNonExecFile(fontstruct.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(font.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(fsmasks.h,$(LINKKITDIR)/include) vnc_unixsrc/Xvnc/include/fonts/font.h0100664000076400007640000001121207120677563017313 0ustar constconst/* $XConsortium: font.h /main/14 1996/09/28 16:32:33 rws $ */ /* $XFree86: xc/include/fonts/font.h,v 3.2 1997/01/14 22:13:06 dawes Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $NCDId: @(#)font.h,v 1.7 1991/06/24 17:00:23 lemke Exp $ */ #ifndef FONT_H #define FONT_H #ifndef BitmapFormatByteOrderMask #include "fsmasks.h" #endif /* data structures */ #ifndef _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; #define _XTYPEDEF_FONTPTR #endif typedef struct _FontInfo *FontInfoPtr; typedef struct _FontProp *FontPropPtr; typedef struct _ExtentInfo *ExtentInfoPtr; typedef struct _FontPathElement *FontPathElementPtr; #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; #define _XTYPEDEF_CHARINFOPTR #endif typedef struct _FontNames *FontNamesPtr; typedef struct _FontResolution *FontResolutionPtr; #define NullCharInfo ((CharInfoPtr) 0) #define NullFont ((FontPtr) 0) #define NullFontInfo ((FontInfoPtr) 0) /* draw direction */ #define LeftToRight 0 #define RightToLeft 1 #define BottomToTop 2 #define TopToBottom 3 typedef int DrawDirection; #define NO_SUCH_CHAR -1 #define FontAliasType 0x1000 #define AllocError 80 #define StillWorking 81 #define FontNameAlias 82 #define BadFontName 83 #define Suspended 84 #define Successful 85 #define BadFontPath 86 #define BadCharRange 87 #define BadFontFormat 88 #define FPEResetFailed 89 /* for when an FPE reset won't work */ /* OpenFont flags */ #define FontLoadInfo 0x0001 #define FontLoadProps 0x0002 #define FontLoadMetrics 0x0004 #define FontLoadBitmaps 0x0008 #define FontLoadAll 0x000f #define FontOpenSync 0x0010 #define FontReopen 0x0020 /* Query flags */ #define LoadAll 0x1 #define FinishRamge 0x2 #define EightBitFont 0x4 #define SixteenBitFont 0x8 /* Glyph Caching Modes */ #define CACHING_OFF 0 #define CACHE_16_BIT_GLYPHS 1 #define CACHE_ALL_GLYPHS 2 #define DEFAULT_GLYPH_CACHING_MODE CACHING_OFF extern int glyphCachingMode; extern int StartListFontsWithInfo( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*length*/, unsigned char */*pattern*/, int /*max_names*/ #endif ); extern FontNamesPtr MakeFontNamesRecord( #if NeedFunctionPrototypes unsigned /* size */ #endif ); extern void FreeFontNames( #if NeedFunctionPrototypes FontNamesPtr /* pFN*/ #endif ); extern int AddFontNamesName( #if NeedFunctionPrototypes FontNamesPtr /* names */, char * /* name */, int /* length */ #endif ); #if 0 /* unused */ extern int FontToFSError(); extern FontResolutionPtr GetClientResolution(); #endif typedef struct _FontPatternCache *FontPatternCachePtr; extern FontPatternCachePtr MakeFontPatternCache ( #if NeedFunctionPrototypes void #endif ); extern void FreeFontPatternCache ( #if NeedFunctionPrototypes FontPatternCachePtr /* cache */ #endif ); extern void EmptyFontPatternCache ( #if NeedFunctionPrototypes FontPatternCachePtr /* cache */ #endif ); extern void CacheFontPattern ( #if NeedFunctionPrototypes FontPatternCachePtr /* cache */, char * /* pattern */, int /* patlen */, FontPtr /* pFont */ #endif ); extern FontResolutionPtr GetClientResolutions( #if NeedFunctionPrototypes int * /* num */ #endif ); extern FontPtr FindCachedFontPattern ( #if NeedFunctionPrototypes FontPatternCachePtr /* cache */, char * /* pattern */, int /* patlen */ #endif ); extern void RemoveCachedFontPattern ( #if NeedFunctionPrototypes FontPatternCachePtr /* cache */, FontPtr /* pFont */ #endif ); typedef enum { Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit } FontEncoding; #endif /* FONT_H */ vnc_unixsrc/Xvnc/include/fonts/fsmasks.h0100664000076400007640000001014407120677563020017 0ustar constconst/* $XConsortium: fsmasks.h,v 1.5 94/04/17 20:11:08 dpw Exp $ */ /* * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * Network Computing Devices and Digital make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ /* Portions Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * masks & values used by the font lib and the font server */ #ifndef _FSMASKS_H_ #define _FSMASKS_H_ #include /* font format macros */ #define BitmapFormatByteOrderMask (1L << 0) #define BitmapFormatBitOrderMask (1L << 1) #define BitmapFormatImageRectMask (3L << 2) #define BitmapFormatScanlinePadMask (3L << 8) #define BitmapFormatScanlineUnitMask (3L << 12) #define BitmapFormatByteOrderLSB (0) #define BitmapFormatByteOrderMSB (1L << 0) #define BitmapFormatBitOrderLSB (0) #define BitmapFormatBitOrderMSB (1L << 1) #define BitmapFormatImageRectMin (0L << 2) #define BitmapFormatImageRectMaxWidth (1L << 2) #define BitmapFormatImageRectMax (2L << 2) #define BitmapFormatScanlinePad8 (0L << 8) #define BitmapFormatScanlinePad16 (1L << 8) #define BitmapFormatScanlinePad32 (2L << 8) #define BitmapFormatScanlinePad64 (3L << 8) #define BitmapFormatScanlineUnit8 (0L << 12) #define BitmapFormatScanlineUnit16 (1L << 12) #define BitmapFormatScanlineUnit32 (2L << 12) #define BitmapFormatScanlineUnit64 (3L << 12) #define BitmapFormatMaskByte (1L << 0) #define BitmapFormatMaskBit (1L << 1) #define BitmapFormatMaskImageRectangle (1L << 2) #define BitmapFormatMaskScanLinePad (1L << 3) #define BitmapFormatMaskScanLineUnit (1L << 4) typedef CARD32 fsBitmapFormat; typedef CARD32 fsBitmapFormatMask; #endif /* _FSMASKS_H_ */ vnc_unixsrc/Xvnc/include/fonts/FS.h0100664000076400007640000001032207120677563016656 0ustar constconst/* $TOG: FS.h /main/9 1997/06/13 13:01:10 barstow $ */ /* * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices or Digital * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * Network Computing Devices and Digital make no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ /* Portions Copyright (c) 1987, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _FS_H_ #define _FS_H_ #include "fsmasks.h" #define FS_PROTOCOL 2 #define FS_PROTOCOL_MINOR 0 typedef unsigned long FSID; #ifndef X_PROTOCOL /* protocol familes */ #define FamilyInternet 0 #define FamilyDECnet 1 #define FamilyChaos 2 typedef unsigned long Mask; typedef FSID Font; typedef FSID AccContext; typedef unsigned int FSDrawDirection; #endif #ifndef None #define None 0L #endif #define LeftToRightDrawDirection 0 #define RightToLeftDrawDirection 1 /* font info flags */ #define FontInfoAllCharsExist (1L << 0) #define FontInfoInkInside (1L << 1) #define FontInfoHorizontalOverlap (1L << 2) /* auth status flags */ #define AuthSuccess 0 #define AuthContinue 1 #define AuthBusy 2 #define AuthDenied 3 /* property types */ #define PropTypeString 0 #define PropTypeUnsigned 1 #define PropTypeSigned 2 #ifndef LSBFirst /* byte order */ #define LSBFirst 0 #define MSBFirst 1 #endif /* event masks */ #define CatalogueChangeNotifyMask (1L << 0) #define FontChangeNotifyMask (1L << 1) /* errors */ #define FSSuccess -1 #define FSBadRequest 0 #define FSBadFormat 1 #define FSBadFont 2 #define FSBadRange 3 #define FSBadEventMask 4 #define FSBadAccessContext 5 #define FSBadIDChoice 6 #define FSBadName 7 #define FSBadResolution 8 #define FSBadAlloc 9 #define FSBadLength 10 #define FSBadImplementation 11 #define FirstExtensionError 128 #define LastExtensionError 255 /* events */ #define KeepAlive 0 #define CatalogueChangeNotify 1 #define FontChangeNotify 2 #define FSLASTEvent 3 #endif /* _FS_H_ */ vnc_unixsrc/Xvnc/include/Imakefile0100664000076400007640000000240407120677563016657 0ustar constconstXCOMM $TOG: Imakefile /main/93 1997/06/13 15:34:58 kaleb $ XCOMM $XFree86: xc/include/Imakefile,v 3.9.2.1 1997/06/15 07:25:25 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags /**/ SUBDIRS = bitmaps extensions fonts #ifdef Win32Architecture EXTRA_HEADERS = Xw32defs.h Xwinsock.h #endif HEADERS = DECkeysym.h \ HPkeysym.h \ Sunkeysym.h \ X.h \ XWDFile.h \ Xalloca.h \ Xatom.h \ Xfuncproto.h \ Xfuncs.h \ Xmd.h \ Xos.h \ Xos_r.h \ Xosdefs.h \ Xpoll.h \ Xproto.h \ Xprotostr.h \ Xthreads.h \ ap_keysym.h \ keysym.h \ keysymdef.h \ $(EXTRA_HEADERS) all:: BuildIncludes($(HEADERS),X11,..) InstallMultipleFlags($(HEADERS),$(INCDIR)/X11,$(INSTINCFLAGS)) MakeSubdirs($(SUBDIRS)) InstallLinkKitNonExecFile(X.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xalloca.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xfuncproto.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xfuncs.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xmd.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xos.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xosdefs.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xproto.h,$(LINKKITDIR)/include/X11) InstallLinkKitNonExecFile(Xprotostr.h,$(LINKKITDIR)/include/X11) depend:: clean:: vnc_unixsrc/Xvnc/include/ap_keysym.h0100664000076400007640000000437207120677563017226 0ustar constconst/****************************************************************** Copyright 1987 by Apollo Computer Inc., Chelmsford, Massachusetts. Copyright 1989 by Hewlett-Packard Company. All Rights Reserved Permission to use, duplicate, change, and distribute this software and its documentation for any purpose and without fee is granted, provided that the above copyright notice appear in such copy and that this copyright notice appear in all supporting documentation, and that the names of Apollo Computer Inc., the Hewlett-Packard Company, or the X Consortium not be used in advertising or publicity pertaining to distribution of the software without written prior permission. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. ******************************************************************/ #define apXK_LineDel 0x1000FF00 #define apXK_CharDel 0x1000FF01 #define apXK_Copy 0x1000FF02 #define apXK_Cut 0x1000FF03 #define apXK_Paste 0x1000FF04 #define apXK_Move 0x1000FF05 #define apXK_Grow 0x1000FF06 #define apXK_Cmd 0x1000FF07 #define apXK_Shell 0x1000FF08 #define apXK_LeftBar 0x1000FF09 #define apXK_RightBar 0x1000FF0A #define apXK_LeftBox 0x1000FF0B #define apXK_RightBox 0x1000FF0C #define apXK_UpBox 0x1000FF0D #define apXK_DownBox 0x1000FF0E #define apXK_Pop 0x1000FF0F #define apXK_Read 0x1000FF10 #define apXK_Edit 0x1000FF11 #define apXK_Save 0x1000FF12 #define apXK_Exit 0x1000FF13 #define apXK_Repeat 0x1000FF14 #define apXK_KP_parenleft 0x1000FFA8 #define apXK_KP_parenright 0x1000FFA9 vnc_unixsrc/Xvnc/include/XWDFile.h0100664000076400007640000001011407120677563016456 0ustar constconst/* $XConsortium: XWDFile.h /main/18 1995/12/07 10:24:58 kaleb $ */ /* Copyright (c) 1985, 1986 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * XWDFile.h MIT Project Athena, X Window system window raster * image dumper, dump file format header file. * * Author: Tony Della Fera, DEC * 27-Jun-85 * * Modifier: William F. Wyatt, SAO * 18-Nov-86 - version 6 for saving/restoring color maps */ #ifndef XWDFILE_H #define XWDFILE_H #include #define XWD_FILE_VERSION 7 #define sz_XWDheader 100 #define sz_XWDColor 12 typedef CARD32 xwdval; /* for old broken programs */ /* Values in the file are most significant byte first. */ typedef struct _xwd_file_header { /* header_size = SIZEOF(XWDheader) + length of null-terminated * window name. */ CARD32 header_size B32; CARD32 file_version B32; /* = XWD_FILE_VERSION above */ CARD32 pixmap_format B32; /* ZPixmap or XYPixmap */ CARD32 pixmap_depth B32; /* Pixmap depth */ CARD32 pixmap_width B32; /* Pixmap width */ CARD32 pixmap_height B32; /* Pixmap height */ CARD32 xoffset B32; /* Bitmap x offset, normally 0 */ CARD32 byte_order B32; /* of image data: MSBFirst, LSBFirst */ /* bitmap_unit applies to bitmaps (depth 1 format XY) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_unit B32; CARD32 bitmap_bit_order B32; /* bitmaps only: MSBFirst, LSBFirst */ /* bitmap_pad applies to pixmaps (non-bitmaps) only. * It is the number of bits that each scanline is padded to. */ CARD32 bitmap_pad B32; CARD32 bits_per_pixel B32; /* Bits per pixel */ /* bytes_per_line is pixmap_width padded to bitmap_unit (bitmaps) * or bitmap_pad (pixmaps). It is the delta (in bytes) to get * to the same x position on an adjacent row. */ CARD32 bytes_per_line B32; CARD32 visual_class B32; /* Class of colormap */ CARD32 red_mask B32; /* Z red mask */ CARD32 green_mask B32; /* Z green mask */ CARD32 blue_mask B32; /* Z blue mask */ CARD32 bits_per_rgb B32; /* Log2 of distinct color values */ CARD32 colormap_entries B32; /* Number of entries in colormap; not used? */ CARD32 ncolors B32; /* Number of XWDColor structures */ CARD32 window_width B32; /* Window width */ CARD32 window_height B32; /* Window height */ CARD32 window_x B32; /* Window upper left X coordinate */ CARD32 window_y B32; /* Window upper left Y coordinate */ CARD32 window_bdrwidth B32; /* Window border width */ } XWDFileHeader; /* Null-terminated window name follows the above structure. */ /* Next comes XWDColor structures, at offset XWDFileHeader.header_size in * the file. XWDFileHeader.ncolors tells how many XWDColor structures * there are. */ typedef struct { CARD32 pixel B32; CARD16 red B16; CARD16 green B16; CARD16 blue B16; CARD8 flags; CARD8 pad; } XWDColor; /* Last comes the image data in the format described by XWDFileHeader. */ #endif /* XWDFILE_H */ vnc_unixsrc/Xvnc/include/extensions/0040775000076400007640000000000010616336465017245 5ustar constconstvnc_unixsrc/Xvnc/include/extensions/lbxdeltastr.h0100664000076400007640000000513607120677563021753 0ustar constconst/* $XConsortium: lbxdeltastr.h /main/7 1996/12/15 21:24:04 rws $ */ /* * Copyright 1993 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef LBX_DELTA_STRUCT_H #define LBX_DELTA_STRUCT_H #define MIN_CACHEABLE_LEN 8 #define DELTA_CACHEABLE(pcache, len) \ ((len) > MIN_CACHEABLE_LEN && (len) <= (pcache)->maxDeltasize) /* * An entry in the delta compactor cache */ typedef struct _LBXDeltaElem { int length; unsigned char *buf; } LBXDeltaElemRec, *LBXDeltaElemPtr; /* * Delta compactor cache */ typedef struct _LBXDeltas { unsigned short nDeltas; unsigned short maxDeltasize; LBXDeltaElemPtr deltas; unsigned short nextDelta; unsigned short activeDeltas; /* only needed for outgoing */ } LBXDeltasRec, *LBXDeltasPtr; /* * Motion delta cache */ typedef struct { BYTE swapped; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window root B32, event B32, child B32; INT16 rootX B16, rootY B16, eventX B16, eventY B16; KeyButMask state B16; BOOL sameScreen; } lbxMotionCache; /* * Motion delta events */ typedef struct { BYTE type; /* always eventBase + LbxQuickMotionDeltaEvent */ CARD8 deltaTime; INT8 deltaX; INT8 deltaY; } lbxQuickMotionDeltaEvent; #define sz_lbxQuickMotionDeltaEvent 4 typedef struct { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxMotionDeltaEvent */ INT8 deltaX; INT8 deltaY; CARD16 deltaTime B16; CARD16 deltaSequence B16; } lbxMotionDeltaEvent; #define sz_lbxMotionDeltaEvent 8 #endif /* LBX_DELTA_STRUCT_H */ vnc_unixsrc/Xvnc/include/extensions/lbxopts.h0100664000076400007640000000700307120677563021111 0ustar constconst/* $XConsortium: lbxopts.h /main/9 1996/11/15 21:33:35 rws $ */ /* * Copyright 1994 Network Computing Devices, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name Network Computing Devices, Inc. not be * used in advertising or publicity pertaining to distribution of this * software without specific, written prior permission. * * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC., * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA, * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ /* $XFree86: xc/include/extensions/lbxopts.h,v 1.3 1997/01/18 07:17:15 dawes Exp $ */ #ifndef _LBX_OPTS_H_ #define _LBX_OPTS_H_ /* * Negotiable configuration options */ #define LBX_OPT_DELTA_PROXY 0 #define LBX_OPT_DELTA_SERVER 1 #define LBX_OPT_STREAM_COMP 2 #define LBX_OPT_BITMAP_COMP 3 #define LBX_OPT_PIXMAP_COMP 4 #define LBX_OPT_MSG_COMP 5 /* aka "squishing" */ #define LBX_OPT_USE_TAGS 6 #define LBX_OPT_CMAP_ALL 7 #define LBX_OPT_EXTENSION 255 /* * Length fields are encoded in 1 or 3 bytes */ #define LBX_OPT_SMALLLEN_SIZE 1 #define LBX_OPT_BIGLEN_SIZE 3 #define LBX_OPT_BIGLEN_MIN 256 #define LBX_OPT_DECODE_LEN(p, len, size) \ if ((p)[0]) { \ (len) = (p)[0]; \ (size) = LBX_OPT_SMALLLEN_SIZE; \ } \ else { \ (len) = LBX_OPT_BIGLEN_MIN + (p)[1] << 8 | (p)[2]; \ (size) = LBX_OPT_BIGLEN_SIZE; \ } /* * Option header lengths */ #define LBX_OPT_SMALLHDR_LEN (1 + LBX_OPT_SMALLLEN_SIZE) #define LBX_OPT_BIGHDR_LEN (1 + LBX_OPT_BIGLEN_SIZE) /* * Delta compression parameters */ #define LBX_OPT_DELTA_REQLEN 6 #define LBX_OPT_DELTA_REPLYLEN 2 #define LBX_OPT_DELTA_NCACHE_DFLT 16 #define LBX_OPT_DELTA_MSGLEN_MIN 32 #define LBX_OPT_DELTA_MSGLEN_DFLT 64 /* * Stream compression opts */ #include #if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__)) struct iovec { caddr_t iov_base; int iov_len; }; #else #ifndef Lynx #include #else #include #endif #endif typedef void *LbxStreamCompHandle; typedef struct _LbxStreamOpts { LbxStreamCompHandle (*streamCompInit)(); pointer streamCompArg; int (*streamCompStuffInput)( int fd, unsigned char *buf, int buflen ); int (*streamCompInputAvail)( int fd ); int (*streamCompFlush)( int fd ); int (*streamCompRead)( int fd, unsigned char *buf, int buflen ); int (*streamCompWriteV)( int fd, struct iovec *iov, int iovcnt ); void (*streamCompOn)( int fd ); void (*streamCompOff)( int fd ); void (*streamCompFreeHandle)( LbxStreamCompHandle handle ); } LbxStreamOpts; #endif /* _LBX_OPTS_H_ */ vnc_unixsrc/Xvnc/include/extensions/dpmsstr.h0100664000076400007640000001156607120677563021123 0ustar constconst/***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * HISTORY */ /* * @(#)RCSfile: dpmsstr.h,v Revision: 1.1.4.2 (DEC) Date: 1995/11/21 19:34:19 */ #define X_DPMSGetVersion 0 #define X_DPMSCapable 1 #define X_DPMSGetTimeouts 2 #define X_DPMSSetTimeouts 3 #define X_DPMSEnable 4 #define X_DPMSDisable 5 #define X_DPMSForceLevel 6 #define X_DPMSInfo 7 #define DPMSNumberEvents 0 #define DPMSNumberErrors 0 #define DPMSMajorVersion 1 #define DPMSMinorVersion 1 #define DPMSExtensionName "DPMS" typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xDPMSGetVersionReq; #define sz_xDPMSGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetVersionReply; #define sz_xDPMSGetVersionReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSCapable */ CARD16 length B16; } xDPMSCapableReq; #define sz_xDPMSCapableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; BOOL capable; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xDPMSCapableReply; #define sz_xDPMSCapableReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */ CARD16 length B16; } xDPMSGetTimeoutsReq; #define sz_xDPMSGetTimeoutsReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDPMSGetTimeoutsReply; #define sz_xDPMSGetTimeoutsReply 32 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */ CARD16 length B16; CARD16 standby B16; CARD16 suspend B16; CARD16 off B16; CARD16 pad0 B16; } xDPMSSetTimeoutsReq; #define sz_xDPMSSetTimeoutsReq 12 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSEnable */ CARD16 length B16; } xDPMSEnableReq; #define sz_xDPMSEnableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSDisable */ CARD16 length B16; } xDPMSDisableReq; #define sz_xDPMSDisableReq 4 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSForceLevel */ CARD16 length B16; CARD16 level B16; /* power level requested */ CARD16 pad0 B16; } xDPMSForceLevelReq; #define sz_xDPMSForceLevelReq 8 typedef struct { CARD8 reqType; /* always DPMSCode */ CARD8 dpmsReqType; /* always X_DPMSInfo */ CARD16 length B16; } xDPMSInfoReq; #define sz_xDPMSInfoReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 power_level B16; BOOL state; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDPMSInfoReply; #define sz_xDPMSInfoReply 32 vnc_unixsrc/Xvnc/include/extensions/XKBgeom.h0100664000076400007640000004144107120677563020716 0ustar constconst/* $XConsortium: XKBgeom.h /main/7 1996/03/06 21:40:11 kaleb $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBGEOM_H_ #define _XKBGEOM_H_ #ifdef XKB_IN_SERVER #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias #define XkbAddGeomColor SrvXkbAddGeomColor #define XkbAddGeomDoodad SrvXkbAddGeomDoodad #define XkbAddGeomKey SrvXkbAddGeomKey #define XkbAddGeomOutline SrvXkbAddGeomOutline #define XkbAddGeomOverlay SrvXkbAddGeomOverlay #define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow #define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey #define XkbAddGeomProperty SrvXkbAddGeomProperty #define XkbAddGeomRow SrvXkbAddGeomRow #define XkbAddGeomSection SrvXkbAddGeomSection #define XkbAddGeomShape SrvXkbAddGeomShape #define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases #define XkbAllocGeomColors SrvXkbAllocGeomColors #define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads #define XkbAllocGeomKeys SrvXkbAllocGeomKeys #define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines #define XkbAllocGeomPoints SrvXkbAllocGeomPoints #define XkbAllocGeomProps SrvXkbAllocGeomProps #define XkbAllocGeomRows SrvXkbAllocGeomRows #define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads #define XkbAllocGeomSections SrvXkbAllocGeomSections #define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays #define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows #define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys #define XkbAllocGeomShapes SrvXkbAllocGeomShapes #define XkbAllocGeometry SrvXkbAllocGeometry #define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases #define XkbFreeGeomColors SrvXkbFreeGeomColors #define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads #define XkbFreeGeomProperties SrvXkbFreeGeomProperties #define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys #define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows #define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays #define XkbFreeGeomKeys SrvXKbFreeGeomKeys #define XkbFreeGeomRows SrvXKbFreeGeomRows #define XkbFreeGeomSections SrvXkbFreeGeomSections #define XkbFreeGeomPoints SrvXkbFreeGeomPoints #define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines #define XkbFreeGeomShapes SrvXkbFreeGeomShapes #define XkbFreeGeometry SrvXkbFreeGeometry #endif typedef struct _XkbProperty { char *name; char *value; } XkbPropertyRec,*XkbPropertyPtr; typedef struct _XkbColor { unsigned int pixel; char * spec; } XkbColorRec,*XkbColorPtr; typedef struct _XkbPoint { short x; short y; } XkbPointRec, *XkbPointPtr; typedef struct _XkbBounds { short x1,y1; short x2,y2; } XkbBoundsRec, *XkbBoundsPtr; #define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) #define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) typedef struct _XkbOutline { unsigned short num_points; unsigned short sz_points; unsigned short corner_radius; XkbPointPtr points; } XkbOutlineRec, *XkbOutlinePtr; typedef struct _XkbShape { Atom name; unsigned short num_outlines; unsigned short sz_outlines; XkbOutlinePtr outlines; XkbOutlinePtr approx; XkbOutlinePtr primary; XkbBoundsRec bounds; } XkbShapeRec, *XkbShapePtr; #define XkbOutlineIndex(s,o) ((o)-&(s)->outlines[0]) typedef struct _XkbShapeDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; } XkbShapeDoodadRec, *XkbShapeDoodadPtr; #define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbTextDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; short width; short height; unsigned short color_ndx; char * text; char * font; } XkbTextDoodadRec, *XkbTextDoodadPtr; #define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbIndicatorDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short shape_ndx; unsigned short on_color_ndx; unsigned short off_color_ndx; } XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; #define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) #define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) #define XkbSetIndicatorDoodadOnColor(g,d,c) \ ((d)->on_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadOffColor(g,d,c) \ ((d)->off_color_ndx= (c)-&(g)->colors[0]) #define XkbSetIndicatorDoodadShape(g,d,s) \ ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbLogoDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; unsigned short color_ndx; unsigned short shape_ndx; char * logo_name; } XkbLogoDoodadRec, *XkbLogoDoodadPtr; #define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) #define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) #define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) #define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) typedef struct _XkbAnyDoodad { Atom name; unsigned char type; unsigned char priority; short top; short left; short angle; } XkbAnyDoodadRec, *XkbAnyDoodadPtr; typedef union _XkbDoodad { XkbAnyDoodadRec any; XkbShapeDoodadRec shape; XkbTextDoodadRec text; XkbIndicatorDoodadRec indicator; XkbLogoDoodadRec logo; } XkbDoodadRec, *XkbDoodadPtr; #define XkbUnknownDoodad 0 #define XkbOutlineDoodad 1 #define XkbSolidDoodad 2 #define XkbTextDoodad 3 #define XkbIndicatorDoodad 4 #define XkbLogoDoodad 5 typedef struct _XkbKey { XkbKeyNameRec name; short gap; unsigned char shape_ndx; unsigned char color_ndx; } XkbKeyRec, *XkbKeyPtr; #define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) #define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) #define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) #define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) typedef struct _XkbRow { short top; short left; unsigned short num_keys; unsigned short sz_keys; int vertical; XkbKeyPtr keys; XkbBoundsRec bounds; } XkbRowRec, *XkbRowPtr; typedef struct _XkbSection { Atom name; unsigned char priority; short top; short left; unsigned short width; unsigned short height; short angle; unsigned short num_rows; unsigned short num_doodads; unsigned short num_overlays; unsigned short sz_rows; unsigned short sz_doodads; unsigned short sz_overlays; XkbRowPtr rows; XkbDoodadPtr doodads; XkbBoundsRec bounds; struct _XkbOverlay *overlays; } XkbSectionRec, *XkbSectionPtr; typedef struct _XkbOverlayKey { XkbKeyNameRec over; XkbKeyNameRec under; } XkbOverlayKeyRec,*XkbOverlayKeyPtr; typedef struct _XkbOverlayRow { unsigned short row_under; unsigned short num_keys; unsigned short sz_keys; XkbOverlayKeyPtr keys; } XkbOverlayRowRec,*XkbOverlayRowPtr; typedef struct _XkbOverlay { Atom name; XkbSectionPtr section_under; unsigned short num_rows; unsigned short sz_rows; XkbOverlayRowPtr rows; XkbBoundsPtr bounds; } XkbOverlayRec,*XkbOverlayPtr; typedef struct _XkbGeometry { Atom name; unsigned short width_mm; unsigned short height_mm; char * label_font; XkbColorPtr label_color; XkbColorPtr base_color; unsigned short sz_properties; unsigned short sz_colors; unsigned short sz_shapes; unsigned short sz_sections; unsigned short sz_doodads; unsigned short sz_key_aliases; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; XkbPropertyPtr properties; XkbColorPtr colors; XkbShapePtr shapes; XkbSectionPtr sections; XkbDoodadPtr doodads; XkbKeyAliasPtr key_aliases; } XkbGeometryRec; #define XkbGeomColorIndex(g,c) ((c)-&(g)->colors[0]) #define XkbGeomPropertiesMask (1<<0) #define XkbGeomColorsMask (1<<1) #define XkbGeomShapesMask (1<<2) #define XkbGeomSectionsMask (1<<3) #define XkbGeomDoodadsMask (1<<4) #define XkbGeomKeyAliasesMask (1<<5) #define XkbGeomAllMask (0x3f) typedef struct _XkbGeometrySizes { unsigned int which; unsigned short num_properties; unsigned short num_colors; unsigned short num_shapes; unsigned short num_sections; unsigned short num_doodads; unsigned short num_key_aliases; } XkbGeometrySizesRec,*XkbGeometrySizesPtr; _XFUNCPROTOBEGIN extern XkbPropertyPtr XkbAddGeomProperty( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, char * /* name */, char * /* value */ #endif ); extern XkbKeyAliasPtr XkbAddGeomKeyAlias( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, char * /* alias */, char * /* real */ #endif ); extern XkbColorPtr XkbAddGeomColor( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, char * /* spec */, unsigned int /* pixel */ #endif ); extern XkbOutlinePtr XkbAddGeomOutline( #if NeedFunctionPrototypes XkbShapePtr /* shape */, int /* sz_points */ #endif ); extern XkbShapePtr XkbAddGeomShape( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_outlines */ #endif ); extern XkbKeyPtr XkbAddGeomKey( #if NeedFunctionPrototypes XkbRowPtr /* row */ #endif ); extern XkbRowPtr XkbAddGeomRow( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* sz_keys */ #endif ); extern XkbSectionPtr XkbAddGeomSection( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, Atom /* name */, int /* sz_rows */, int /* sz_doodads */, int /* sz_overlays */ #endif ); extern XkbOverlayPtr XkbAddGeomOverlay( #if NeedFunctionPrototypes XkbSectionPtr /* section */, Atom /* name */, int /* sz_rows */ #endif ); extern XkbOverlayRowPtr XkbAddGeomOverlayRow( #if NeedFunctionPrototypes XkbOverlayPtr /* overlay */, int /* row_under */, int /* sz_keys */ #endif ); extern XkbOverlayKeyPtr XkbAddGeomOverlayKey( #if NeedFunctionPrototypes XkbOverlayPtr /* overlay */, XkbOverlayRowPtr /* row */, char * /* over */, char * /* under */ #endif ); extern XkbDoodadPtr XkbAddGeomDoodad( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, Atom /* name */ #endif ); extern void XkbFreeGeomKeyAliases( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomColors( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomDoodads( #if NeedFunctionPrototypes XkbDoodadPtr /* doodads */, int /* nDoodads */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomProperties( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomOverlayKeys( #if NeedFunctionPrototypes XkbOverlayRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomOverlayRows( #if NeedFunctionPrototypes XkbOverlayPtr /* overlay */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomOverlays( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomKeys( #if NeedFunctionPrototypes XkbRowPtr /* row */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomRows( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomSections( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomPoints( #if NeedFunctionPrototypes XkbOutlinePtr /* outline */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomOutlines( #if NeedFunctionPrototypes XkbShapePtr /* shape */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeomShapes( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* first */, int /* count */, Bool /* freeAll */ #endif ); extern void XkbFreeGeometry( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, unsigned int /* which */, Bool /* freeMap */ #endif ); extern Status XkbAllocGeomProps( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nProps */ #endif ); extern Status XkbAllocGeomKeyAliases( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nAliases */ #endif ); extern Status XkbAllocGeomColors( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nColors */ #endif ); extern Status XkbAllocGeomShapes( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nShapes */ #endif ); extern Status XkbAllocGeomSections( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nSections */ #endif ); extern Status XkbAllocGeomOverlays( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* num_needed */ #endif ); extern Status XkbAllocGeomOverlayRows( #if NeedFunctionPrototypes XkbOverlayPtr /* overlay */, int /* num_needed */ #endif ); extern Status XkbAllocGeomOverlayKeys( #if NeedFunctionPrototypes XkbOverlayRowPtr /* row */, int /* num_needed */ #endif ); extern Status XkbAllocGeomDoodads( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, int /* nDoodads */ #endif ); extern Status XkbAllocGeomSectionDoodads( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* nDoodads */ #endif ); extern Status XkbAllocGeomOutlines( #if NeedFunctionPrototypes XkbShapePtr /* shape */, int /* nOL */ #endif ); extern Status XkbAllocGeomRows( #if NeedFunctionPrototypes XkbSectionPtr /* section */, int /* nRows */ #endif ); extern Status XkbAllocGeomPoints( #if NeedFunctionPrototypes XkbOutlinePtr /* ol */, int /* nPts */ #endif ); extern Status XkbAllocGeomKeys( #if NeedFunctionPrototypes XkbRowPtr /* row */, int /* nKeys */ #endif ); extern Status XkbAllocGeometry( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, XkbGeometrySizesPtr /* sizes */ #endif ); extern Bool XkbComputeShapeTop( #if NeedFunctionPrototypes XkbShapePtr /* shape */, XkbBoundsPtr /* bounds */ #endif ); extern Bool XkbComputeShapeBounds( #if NeedFunctionPrototypes XkbShapePtr /* shape */ #endif ); extern Bool XkbComputeRowBounds( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, XkbSectionPtr /* section */, XkbRowPtr /* row */ #endif ); extern Bool XkbComputeSectionBounds( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, XkbSectionPtr /* section */ #endif ); extern char * XkbFindOverlayForKey( #if NeedFunctionPrototypes XkbGeometryPtr /* geom */, XkbSectionPtr /* wanted */, char * /* under */ #endif ); extern Status XkbGetGeometry( #if NeedFunctionPrototypes Display * /* dpy */, XkbDescPtr /* xkb */ #endif ); extern Status XkbGetNamedGeometry( #if NeedFunctionPrototypes Display * /* dpy */, XkbDescPtr /* xkb */, Atom /* name */ #endif ); _XFUNCPROTOEND #endif /* _XKBSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/mitmiscstr.h0100664000076400007640000000445207120677563021621 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */ /* $XConsortium: mitmiscstr.h,v 1.4 94/04/17 20:11:20 keith Exp $ */ #include "MITMisc.h" #define MITMISCNAME "MIT-SUNDRY-NONSTANDARD" typedef struct _SetBugMode { CARD8 reqType; /* always MITReqCode */ CARD8 mitReqType; /* always X_MITSetBugMode */ CARD16 length B16; BOOL onOff; BYTE pad0; CARD16 pad1; } xMITSetBugModeReq; #define sz_xMITSetBugModeReq 8 typedef struct _GetBugMode { CARD8 reqType; /* always MITReqCode */ CARD8 mitReqType; /* always X_MITGetBugMode */ CARD16 length B16; } xMITGetBugModeReq; #define sz_xMITGetBugModeReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL onOff; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xMITGetBugModeReply; #define sz_xMITGetBugModeReply 32 vnc_unixsrc/Xvnc/include/extensions/Imakefile0100664000076400007640000000260007120677563021054 0ustar constconstXCOMM $XConsortium: Imakefile /main/46 1996/09/28 16:17:59 rws $ XCOMM $XFree86: xc/include/extensions/Imakefile,v 3.13 1997/01/12 10:39:14 dawes Exp $ #if BuildScreenSaverLibrary SCREENSAVERHEADERS = saver.h saverproto.h scrnsaver.h #endif #if BuildXF86MiscLibrary XF86MISCHEADERS = xf86misc.h xf86mscstr.h #endif #if BuildXF86VidModeLibrary XF86VIDMODEHEADERS = xf86vmode.h xf86vmstr.h #endif #if BuildXF86DGALibrary XF86DGAHEADERS = xf86dga.h xf86dgastr.h #endif #if BuildLBX LBXHEADERS = lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h lbxopts.h lbxstr.h lbxzlib.h #endif #if BuildDPMSLibrary DPMSHEADERS = dpms.h dpmsstr.h #endif EXTRAHEADERS = $(SCREENSAVERHEADERS) $(XF86VIDMODEHEADERS) $(XF86DGAHEADERS) $(XF86MISCHEADERS) $(LBXHEADERS) $(DPMSHEADERS) HEADERS = Xext.h multibuf.h shape.h XShm.h MITMisc.h XI.h XInput.h XIproto.h \ XTest.h xtestext1.h XIE.h XIEproto.h XIEprotost.h sync.h \ XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h Xdbe.h Xdbeproto.h \ Xag.h Xagstr.h Xagsrv.h \ record.h recordstr.h \ lbxbuf.h lbxbufstr.h lbxdeltastr.h lbximage.h \ lbxopts.h lbxstr.h lbxzlib.h \ security.h securstr.h \ Print.h Printstr.h $(EXTRAHEADERS) all:: BuildIncludes($(HEADERS),X11/extensions,../..) InstallMultipleFlags($(HEADERS),$(INCDIR)/X11/extensions,$(INSTINCFLAGS)) InstallLinkKitMultipleDestFlags($(EXTRAHEADERS),$(LINKKITDIR)/include/X11/extensions,$(INSTDATFLAGS)) vnc_unixsrc/Xvnc/include/extensions/xf86dgastr.h0100664000076400007640000001166507120677563021427 0ustar constconst/* $XFree86: xc/include/extensions/xf86dgastr.h,v 3.3 1996/10/18 14:57:25 dawes Exp $ */ /* Copyright (c) 1995 Jon Tombs Copyright (c) 1995 XFree86 Inc. */ #ifndef _XF86DGASTR_H_ #define _XF86DGASTR_H_ #include "xf86dga.h" #define XF86DGANAME "XFree86-DGA" #define XF86DGA_MAJOR_VERSION 1 /* current version numbers */ #define XF86DGA_MINOR_VERSION 0 typedef struct _XF86DGAQueryVersion { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; } xXF86DGAQueryVersionReq; #define sz_xXF86DGAQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of DGA protocol */ CARD16 minorVersion B16; /* minor version of DGA protocol */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86DGAQueryVersionReply; #define sz_xXF86DGAQueryVersionReply 32 typedef struct _XF86DGAGetVideoLL { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetVideoLL */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetVideoLLReq; #define sz_xXF86DGAGetVideoLLReq 8 typedef struct _XF86DGAInstallColormap{ CARD8 reqType; CARD8 dgaReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad2; CARD32 id B32; /* colormap. */ } xXF86DGAInstallColormapReq; #define sz_xXF86DGAInstallColormapReq 12 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 offset B32; CARD32 width B32; CARD32 bank_size B32; CARD32 ram_size B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetVideoLLReply; #define sz_xXF86DGAGetVideoLLReply 32 typedef struct _XF86DGADirectVideo { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGADirectVideo */ CARD16 length B16; CARD16 screen B16; CARD16 enable B16; } xXF86DGADirectVideoReq; #define sz_xXF86DGADirectVideoReq 8 typedef struct _XF86DGAGetViewPortSize { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetViewPortSizeReq; #define sz_xXF86DGAGetViewPortSizeReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 width B32; CARD32 height B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetViewPortSizeReply; #define sz_xXF86DGAGetViewPortSizeReply 32 typedef struct _XF86DGASetViewPort { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGASetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 x B32; CARD32 y B32; } xXF86DGASetViewPortReq; #define sz_xXF86DGASetViewPortReq 16 typedef struct _XF86DGAGetVidPage { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGAGetVidPage */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAGetVidPageReq; #define sz_xXF86DGAGetVidPageReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 vpage B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAGetVidPageReply; #define sz_xXF86DGAGetVidPageReply 32 typedef struct _XF86DGASetVidPage { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_XF86DGASetVidPage */ CARD16 length B16; CARD16 screen B16; CARD16 vpage B16; } xXF86DGASetVidPageReq; #define sz_xXF86DGASetVidPageReq 8 typedef struct _XF86DGAQueryDirectVideo { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86DGAQueryDirectVideoReq; #define sz_xXF86DGAQueryDirectVideoReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 flags B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAQueryDirectVideoReply; #define sz_xXF86DGAQueryDirectVideoReply 32 typedef struct _XF86DGAViewPortChanged { CARD8 reqType; /* always DGAReqCode */ CARD8 dgaReqType; /* always X_DGAQueryVersion */ CARD16 length B16; CARD16 screen B16; CARD16 n B16; } xXF86DGAViewPortChangedReq; #define sz_xXF86DGAViewPortChangedReq 8 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 result B32; CARD32 pad B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86DGAViewPortChangedReply; #define sz_xXF86DGAViewPortChangedReply 32 #endif /* _XF86DGASTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/xteststr.h0100664000076400007640000000661207120677563021323 0ustar constconst/* $XConsortium: xteststr.h,v 1.9 94/04/17 20:11:30 rws Exp $ */ /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XTESTSTR_H_ #define _XTESTSTR_H_ #define Window CARD32 #define Time CARD32 #define Cursor CARD32 #define XTestCurrentCursor ((Cursor)1) typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGetVersion */ CARD16 length B16; CARD8 majorVersion; CARD8 pad; CARD16 minorVersion B16; } xXTestGetVersionReq; #define sz_xXTestGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 majorVersion; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 minorVersion B16; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestGetVersionReply; #define sz_xXTestGetVersionReply 32 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestCompareCursor */ CARD16 length B16; Window window B32; Cursor cursor B32; } xXTestCompareCursorReq; #define sz_xXTestCompareCursorReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL same; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXTestCompareCursorReply; #define sz_xXTestCompareCursorReply 32 /* used only on the client side */ typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestFakeInput */ CARD16 length B16; BYTE type; BYTE detail; CARD16 pad0 B16; Time time B32; Window root B32; CARD32 pad1 B32; CARD32 pad2 B32; INT16 rootX B16, rootY B16; CARD32 pad3 B32; CARD16 pad4 B16; CARD8 pad5; CARD8 deviceid; } xXTestFakeInputReq; #define sz_xXTestFakeInputReq 36 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 xtReqType; /* always X_XTestGrabControl */ CARD16 length B16; BOOL impervious; CARD8 pad0; CARD8 pad1; CARD8 pad2; } xXTestGrabControlReq; #define sz_xXTestGrabControlReq 8 #undef Window #undef Time #undef Cursor #endif /* _XTESTSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/XIproto.h0100664000076400007640000010440707120677563021030 0ustar constconst/* $XConsortium: XIproto.h /main/26 1996/03/20 15:30:59 mor $ */ /************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XIPROTO_H #define _XIPROTO_H #include #include /* make sure types have right sizes for protocol structures. */ #define Window CARD32 #define Time CARD32 #define KeyCode CARD8 /********************************************************* * * number of events, errors, and extension name. * */ #define MORE_EVENTS 0x80 #define DEVICE_BITS 0x7F #define InputClassBits 0x3F /* bits in mode field for input classes */ #define ModeBitsShift 6 /* amount to shift the remaining bits */ #define numInputClasses 7 #define IEVENTS 15 #define IERRORS 5 #define CLIENT_REQ 1 typedef struct _XExtEventInfo { Mask mask; BYTE type; BYTE word; } XExtEventInfo; typedef unsigned char *Pointer; struct tmask { Mask mask; Pointer dev; }; /********************************************************* * * Event constants used by library. * */ #define XI_DeviceValuator 0 #define XI_DeviceKeyPress 1 #define XI_DeviceKeyRelease 2 #define XI_DeviceButtonPress 3 #define XI_DeviceButtonRelease 4 #define XI_DeviceMotionNotify 5 #define XI_DeviceFocusIn 6 #define XI_DeviceFocusOut 7 #define XI_ProximityIn 8 #define XI_ProximityOut 9 #define XI_DeviceStateNotify 10 #define XI_DeviceMappingNotify 11 #define XI_ChangeDeviceNotify 12 #define XI_DeviceKeystateNotify 13 #define XI_DeviceButtonstateNotify 14 /********************************************************* * * Protocol request constants * */ #define X_GetExtensionVersion 1 #define X_ListInputDevices 2 #define X_OpenDevice 3 #define X_CloseDevice 4 #define X_SetDeviceMode 5 #define X_SelectExtensionEvent 6 #define X_GetSelectedExtensionEvents 7 #define X_ChangeDeviceDontPropagateList 8 #define X_GetDeviceDontPropagateList 9 #define X_GetDeviceMotionEvents 10 #define X_ChangeKeyboardDevice 11 #define X_ChangePointerDevice 12 #define X_GrabDevice 13 #define X_UngrabDevice 14 #define X_GrabDeviceKey 15 #define X_UngrabDeviceKey 16 #define X_GrabDeviceButton 17 #define X_UngrabDeviceButton 18 #define X_AllowDeviceEvents 19 #define X_GetDeviceFocus 20 #define X_SetDeviceFocus 21 #define X_GetFeedbackControl 22 #define X_ChangeFeedbackControl 23 #define X_GetDeviceKeyMapping 24 #define X_ChangeDeviceKeyMapping 25 #define X_GetDeviceModifierMapping 26 #define X_SetDeviceModifierMapping 27 #define X_GetDeviceButtonMapping 28 #define X_SetDeviceButtonMapping 29 #define X_QueryDeviceState 30 #define X_SendExtensionEvent 31 #define X_DeviceBell 32 #define X_SetDeviceValuators 33 #define X_GetDeviceControl 34 #define X_ChangeDeviceControl 35 /********************************************************* * * Protocol request and reply structures. * * GetExtensionVersion. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetExtensionVersion */ CARD16 length B16; CARD16 nbytes B16; CARD8 pad1, pad2; } xGetExtensionVersionReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetExtensionVersion */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 major_version B16; CARD16 minor_version B16; BOOL present; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetExtensionVersionReply; /********************************************************* * * ListInputDevices. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ListInputDevices */ CARD16 length B16; } xListInputDevicesReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ListInputDevices */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 ndevices; CARD8 pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xListInputDevicesReply; typedef struct _xDeviceInfo *xDeviceInfoPtr; typedef struct _xAnyClassinfo *xAnyClassPtr; typedef struct _xAnyClassinfo { CARD8 class; CARD8 length; } xAnyClassInfo; typedef struct _xDeviceInfo { CARD32 type B32; CARD8 id; CARD8 num_classes; CARD8 use; CARD8 pad1; } xDeviceInfo; typedef struct _xKeyInfo *xKeyInfoPtr; typedef struct _xKeyInfo { CARD8 class; CARD8 length; KeyCode min_keycode; KeyCode max_keycode; CARD16 num_keys B16; CARD8 pad1,pad2; } xKeyInfo; typedef struct _xButtonInfo *xButtonInfoPtr; typedef struct _xButtonInfo { CARD8 class; CARD8 length; CARD16 num_buttons B16; } xButtonInfo; typedef struct _xValuatorInfo *xValuatorInfoPtr; typedef struct _xValuatorInfo { CARD8 class; CARD8 length; CARD8 num_axes; CARD8 mode; CARD32 motion_buffer_size B32; } xValuatorInfo; typedef struct _xAxisInfo *xAxisInfoPtr; typedef struct _xAxisInfo { CARD32 resolution B32; CARD32 min_value B32; CARD32 max_value B32; } xAxisInfo; /********************************************************* * * OpenDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_OpenDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xOpenDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_OpenDevice */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xOpenDeviceReply; typedef struct { CARD8 class; CARD8 event_type_base; } xInputClassInfo; /********************************************************* * * CloseDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_CloseDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xCloseDeviceReq; /********************************************************* * * SetDeviceMode. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceMode */ CARD16 length B16; CARD8 deviceid; CARD8 mode; BYTE pad1, pad2; } xSetDeviceModeReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceMode */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceModeReply; /********************************************************* * * SelectExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SelectExtensionEvent */ CARD16 length B16; Window window B32; CARD16 count B16; CARD16 pad00 B16; } xSelectExtensionEventReq; /********************************************************* * * GetSelectedExtensionEvent. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetSelectedExtensionEvents */ CARD16 length B16; Window window B32; } xGetSelectedExtensionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetSelectedExtensionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 this_client_count B16; CARD16 all_clients_count B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetSelectedExtensionEventsReply; /********************************************************* * * ChangeDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeDeviceDontPropagateList */ CARD16 length B16; Window window B32; CARD16 count B16; CARD8 mode; BYTE pad; } xChangeDeviceDontPropagateListReq; /********************************************************* * * GetDeviceDontPropagateList. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceDontPropagateList */ CARD16 length B16; Window window B32; } xGetDeviceDontPropagateListReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* GetDeviceDontPropagateList */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 count B16; CARD16 pad00 B16; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceDontPropagateListReply; /********************************************************* * * GetDeviceMotionEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceMotionEvents*/ CARD16 length B16; Time start B32; Time stop B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceMotionEventsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceMotionEvents */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 nEvents B32; CARD8 axes; CARD8 mode; BYTE pad1, pad2; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } xGetDeviceMotionEventsReply; /********************************************************* * * ChangeKeyboardDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeKeyboardDevice */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xChangeKeyboardDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeKeyboardDevice*/ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeKeyboardDeviceReply; /********************************************************* * * ChangePointerDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangePointerDevice */ CARD16 length B16; CARD8 xaxis; CARD8 yaxis; CARD8 deviceid; BYTE pad1; } xChangePointerDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangePointerDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangePointerDeviceReply; /********************************************************* * * GrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDevice */ CARD16 length B16; Window grabWindow B32; Time time B32; CARD16 event_count B16; CARD8 this_device_mode; CARD8 other_devices_mode; BOOL ownerEvents; CARD8 deviceid; CARD16 pad01 B16; } xGrabDeviceReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GrabDevice */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGrabDeviceReply; /********************************************************* * * UngrabDevice. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UnGrabDevice */ CARD16 length B16; Time time B32; CARD8 deviceid; BYTE pad1, pad2, pad3; } xUngrabDeviceReq; /********************************************************* * * GrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 event_count B16; CARD16 modifiers B16; CARD8 modifier_device; CARD8 grabbed_device; CARD8 key; BYTE this_device_mode; BYTE other_devices_mode; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceKeyReq; /********************************************************* * * UngrabDeviceKey. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceKey */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 key; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceKeyReq; /********************************************************* * * GrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD8 grabbed_device; CARD8 modifier_device; CARD16 event_count B16; CARD16 modifiers B16; BYTE this_device_mode; BYTE other_devices_mode; CARD8 button; BOOL ownerEvents; BYTE pad1, pad2; } xGrabDeviceButtonReq; /********************************************************* * * UngrabDeviceButton. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_UngrabDeviceButton */ CARD16 length B16; Window grabWindow B32; CARD16 modifiers B16; CARD8 modifier_device; CARD8 button; CARD8 grabbed_device; BYTE pad1, pad2, pad3; } xUngrabDeviceButtonReq; /********************************************************* * * AllowDeviceEvents. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_AllowDeviceEvents */ CARD16 length B16; Time time B32; CARD8 mode; CARD8 deviceid; BYTE pad1, pad2; } xAllowDeviceEventsReq; /********************************************************* * * GetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceFocus */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceFocusReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceFocus */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 focus B32; Time time B32; CARD8 revertTo; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } xGetDeviceFocusReply; /********************************************************* * * SetDeviceFocus. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceFocus */ CARD16 length B16; Window focus B32; Time time B32; CARD8 revertTo; CARD8 device; CARD16 pad01 B16; } xSetDeviceFocusReq; /********************************************************* * * GetFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetFeedbackControl */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetFeedbackControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetFeedbackControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 num_feedbacks B16; CARD16 pad01 B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; } xGetFeedbackControlReply; typedef struct { CARD8 class; /* feedback class */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackState; typedef struct { CARD8 class; CARD8 id; CARD16 length B16; CARD16 pitch B16; CARD16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; BOOL global_auto_repeat; CARD8 click; CARD8 percent; BYTE pad; BYTE auto_repeats[32]; } xKbdFeedbackState; typedef struct { CARD8 class; CARD8 id; CARD16 length B16; CARD8 pad1,pad2; CARD16 accelNum B16; CARD16 accelDenom B16; CARD16 threshold B16; } xPtrFeedbackState; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; CARD16 length B16; /* feedback length */ CARD32 resolution B32; INT32 min_value B32; INT32 max_value B32; } xIntegerFeedbackState; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; CARD16 length B16; /* feedback length */ CARD16 max_symbols B16; CARD16 num_syms_supported B16; } xStringFeedbackState; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; CARD16 length B16; /* feedback length */ CARD8 percent; BYTE pad1, pad2, pad3; CARD16 pitch B16; CARD16 duration B16; } xBellFeedbackState; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackState; /********************************************************* * * ChangeFeedbackControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_ChangeFeedbackControl */ CARD16 length B16; CARD32 mask B32; CARD8 deviceid; CARD8 feedbackid; BYTE pad1, pad2; } xChangeFeedbackControlReq; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ } xFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback length */ CARD16 length B16; /* feedback length */ KeyCode key; CARD8 auto_repeat_mode; INT8 click; INT8 percent; INT16 pitch B16; INT16 duration B16; CARD32 led_mask B32; CARD32 led_values B32; } xKbdFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; INT16 num B16; INT16 denom B16; INT16 thresh B16; } xPtrFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT32 int_to_display B32; } xIntegerFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD8 pad1,pad2; CARD16 num_keysyms B16; } xStringFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ INT8 percent; BYTE pad1, pad2, pad3; INT16 pitch B16; INT16 duration B16; } xBellFeedbackCtl; typedef struct { CARD8 class; /* feedback class id */ CARD8 id; /* feedback id */ CARD16 length B16; /* feedback length */ CARD32 led_mask B32; CARD32 led_values B32; } xLedFeedbackCtl; /********************************************************* * * GetDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 count; BYTE pad1; } xGetDeviceKeyMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceKeyMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 keySymsPerKeyCode; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceKeyMappingReply; /********************************************************* * * ChangeDeviceKeyMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceKeyMapping */ CARD16 length B16; CARD8 deviceid; KeyCode firstKeyCode; CARD8 keySymsPerKeyCode; CARD8 keyCodes; } xChangeDeviceKeyMappingReq; /********************************************************* * * GetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 numKeyPerModifier; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xGetDeviceModifierMappingReply; /********************************************************* * * SetDeviceModifierMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceModifierMapping */ CARD16 length B16; CARD8 deviceid; CARD8 numKeyPerModifier; CARD16 pad1 B16; } xSetDeviceModifierMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceModifierMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 success; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceModifierMappingReply; /********************************************************* * * GetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_GetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xGetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 nElts; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceButtonMappingReply; /********************************************************* * * SetDeviceButtonMapping. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* X_SetDeviceButtonMapping */ CARD16 length B16; CARD8 deviceid; CARD8 map_length; BYTE pad1, pad2; } xSetDeviceButtonMappingReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceButtonMapping */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xSetDeviceButtonMappingReply; /********************************************************* * * QueryDeviceState. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_QueryDeviceState */ CARD16 length B16; CARD8 deviceid; BYTE pad1, pad2, pad3; } xQueryDeviceStateReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_QueryDeviceState */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 num_classes; BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xQueryDeviceStateReply; typedef struct { CARD8 class; CARD8 length; CARD8 num_keys; BYTE pad1; CARD8 keys[32]; } xKeyState; typedef struct { CARD8 class; CARD8 length; CARD8 num_buttons; BYTE pad1; CARD8 buttons[32]; } xButtonState; typedef struct { CARD8 class; CARD8 length; CARD8 num_valuators; CARD8 mode; } xValuatorState; /********************************************************* * * SendExtensionEvent. * THIS REQUEST MUST BE KEPT A MULTIPLE OF 8 BYTES IN LENGTH! * MORE EVENTS MAY FOLLOW AND THEY MUST BE QUAD-ALIGNED! * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_SendExtensionEvent */ CARD16 length B16; Window destination B32; CARD8 deviceid; BOOL propagate; CARD16 count B16; CARD8 num_events; BYTE pad1,pad2,pad3; } xSendExtensionEventReq; /********************************************************* * * DeviceBell. * */ typedef struct { CARD8 reqType; CARD8 ReqType; /* always X_DeviceBell */ CARD16 length B16; CARD8 deviceid; CARD8 feedbackid; CARD8 feedbackclass; INT8 percent; } xDeviceBellReq; /********************************************************* * * SetDeviceValuators. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_SetDeviceValuators */ CARD16 length B16; CARD8 deviceid; CARD8 first_valuator; CARD8 num_valuators; BYTE pad1; } xSetDeviceValuatorsReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_SetDeviceValuators */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xSetDeviceValuatorsReply; /********************************************************* * * GetDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_GetDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad2; } xGetDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_GetDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xGetDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceState; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD32 num_valuators B32; /* number of valuators */ } xDeviceResolutionState; /********************************************************* * * ChangeDeviceControl. * */ typedef struct { CARD8 reqType; /* input extension major code */ CARD8 ReqType; /* always X_ChangeDeviceControl */ CARD16 length B16; CARD16 control B16; CARD8 deviceid; BYTE pad0; } xChangeDeviceControlReq; typedef struct { CARD8 repType; /* X_Reply */ CARD8 RepType; /* always X_ChangeDeviceControl */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 status; BYTE pad1, pad2, pad3; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; } xChangeDeviceControlReply; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ } xDeviceCtl; typedef struct { CARD16 control B16; /* control type */ CARD16 length B16; /* control length */ CARD8 first_valuator; /* first valuator to change */ CARD8 num_valuators; /* number of valuators to change*/ CARD8 pad1,pad2; } xDeviceResolutionCtl; /********************************************************** * * Input extension events. * * DeviceValuator * */ typedef struct { BYTE type; CARD8 deviceid; CARD16 sequenceNumber B16; KeyButMask device_state B16; CARD8 num_valuators; CARD8 first_valuator; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; INT32 valuator3 B32; INT32 valuator4 B32; INT32 valuator5 B32; } deviceValuator; /********************************************************** * * DeviceKeyButtonPointer. * * Used for: DeviceKeyPress, DeviceKeyRelease, * DeviceButtonPress, DeviceButtonRelease, * ProximityIn, ProximityOut * DeviceMotionNotify, * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window root B32; Window event B32; Window child B32; INT16 root_x B16; INT16 root_y B16; INT16 event_x B16; INT16 event_y B16; KeyButMask state B16; BOOL same_screen; CARD8 deviceid; } deviceKeyButtonPointer; /********************************************************** * * DeviceFocus. * */ typedef struct { BYTE type; BYTE detail; CARD16 sequenceNumber B16; Time time B32; Window window B32; BYTE mode; CARD8 deviceid; BYTE pad1, pad2; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; } deviceFocus; /********************************************************** * * DeviceStateNotify. * * Note that the two high-order bits in the classes_reported * field are the proximity state (InProximity or OutOfProximity), * and the device mode (Absolute or Relative), respectively. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 num_keys; CARD8 num_buttons; CARD8 num_valuators; CARD8 classes_reported; CARD8 buttons[4]; CARD8 keys[4]; INT32 valuator0 B32; INT32 valuator1 B32; INT32 valuator2 B32; } deviceStateNotify; /********************************************************** * * DeviceKeyStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 keys[28]; } deviceKeyStateNotify; /********************************************************** * * DeviceButtonStateNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 buttons[28]; } deviceButtonStateNotify; /********************************************************** * * DeviceMappingNotify. * Fields must be kept in sync with core mappingnotify event. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; CARD8 request; KeyCode firstKeyCode; CARD8 count; BYTE pad1; Time time B32; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } deviceMappingNotify; /********************************************************** * * ChangeDeviceNotify. * */ typedef struct { BYTE type; BYTE deviceid; CARD16 sequenceNumber B16; Time time B32; CARD8 request; BYTE pad1, pad2, pad3; CARD32 pad00 B32; CARD32 pad01 B32; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; } changeDeviceNotify; #undef Window #undef Time #undef KeyCode #endif vnc_unixsrc/Xvnc/include/extensions/saverproto.h0100664000076400007640000001106007120677563021620 0ustar constconst/* * $XConsortium: saverproto.h,v 1.5 94/04/17 20:59:33 keith Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVERPROTO_H_ #define _SAVERPROTO_H_ #include "saver.h" #define X_ScreenSaverQueryVersion 0 typedef struct _ScreenSaverQueryVersion { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryVersion */ CARD16 length B16; CARD8 clientMajor; CARD8 clientMinor; CARD16 unused B16; } xScreenSaverQueryVersionReq; #define sz_xScreenSaverQueryVersionReq 8 typedef struct { CARD8 type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of protocol */ CARD16 minorVersion B16; /* minor version of protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xScreenSaverQueryVersionReply; #define sz_xScreenSaverQueryVersionReply 32 #define X_ScreenSaverQueryInfo 1 typedef struct _ScreenSaverQueryInfo { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverQueryInfo */ CARD16 length B16; Drawable drawable B32; } xScreenSaverQueryInfoReq; #define sz_xScreenSaverQueryInfoReq 8 typedef struct { CARD8 type; /* X_Reply */ BYTE state; /* Off, On */ CARD16 sequenceNumber B16; CARD32 length B32; Window window B32; CARD32 tilOrSince B32; CARD32 idle B32; CARD32 eventMask B32; BYTE kind; /* Blanked, Internal, External */ CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; } xScreenSaverQueryInfoReply; #define sz_xScreenSaverQueryInfoReply 32 #define X_ScreenSaverSelectInput 2 typedef struct _ScreenSaverSelectInput { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSelectInput */ CARD16 length B16; Drawable drawable B32; CARD32 eventMask B32; } xScreenSaverSelectInputReq; #define sz_xScreenSaverSelectInputReq 12 #define X_ScreenSaverSetAttributes 3 typedef struct _ScreenSaverSetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverSetAttributes */ CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16, borderWidth B16; BYTE c_class; CARD8 depth; VisualID visualID B32; CARD32 mask B32; } xScreenSaverSetAttributesReq; #define sz_xScreenSaverSetAttributesReq 28 #define X_ScreenSaverUnsetAttributes 4 typedef struct _ScreenSaverUnsetAttributes { CARD8 reqType; /* always ScreenSaverReqCode */ CARD8 saverReqType; /* always X_ScreenSaverUnsetAttributes */ CARD16 length B16; Drawable drawable B32; } xScreenSaverUnsetAttributesReq; #define sz_xScreenSaverUnsetAttributesReq 8 typedef struct _ScreenSaverNotify { CARD8 type; /* always eventBase + ScreenSaverNotify */ BYTE state; /* off, on, cycle */ CARD16 sequenceNumber B16; Time timestamp B32; Window root B32; Window window B32; /* screen saver window */ BYTE kind; /* blanked, internal, external */ BYTE forced; CARD16 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xScreenSaverNotifyEvent; #define sz_xScreenSaverNotifyEvent 32 #endif /* _SAVERPROTO_H_ */ vnc_unixsrc/Xvnc/include/extensions/scrnsaver.h0100664000076400007640000001063607120677563021432 0ustar constconst/* * $XConsortium: scrnsaver.h,v 1.6 94/04/17 20:59:34 keith Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SCRNSAVER_H_ #define _SCRNSAVER_H_ #include #include typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* screen saver window */ Window root; /* root window of event screen */ int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverCycle*/ int kind; /* ScreenSaverBlanked, ...Internal, ...External */ Bool forced; /* extents of new region */ Time time; /* event timestamp */ } XScreenSaverNotifyEvent; typedef struct { Window window; /* screen saver window - may not exist */ int state; /* ScreenSaverOff, ScreenSaverOn, ScreenSaverDisabled*/ int kind; /* ScreenSaverBlanked, ...Internal, ...External */ unsigned long til_or_since; /* time til or since screen saver */ unsigned long idle; /* total time since last user input */ unsigned long eventMask; /* currently selected events for this client */ } XScreenSaverInfo; _XFUNCPROTOBEGIN extern Bool XScreenSaverQueryExtension ( #if NeedFunctionPrototypes Display* /* display */, int* /* event_base */, int* /* error_base */ #endif ); extern Status XScreenSaverQueryVersion ( #if NeedFunctionPrototypes Display* /* display */, int* /* major_version */, int* /* minor_version */ #endif ); extern XScreenSaverInfo *XScreenSaverAllocInfo ( #if NeedFunctionPrototypes void #endif ); extern Status XScreenSaverQueryInfo ( #if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, XScreenSaverInfo* /* info */ #endif ); extern void XScreenSaverSelectInput ( #if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, unsigned long /* eventMask */ #endif ); extern void XScreenSaverSetAttributes ( #if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, int /* depth */, unsigned int /* class */, Visual * /* visual */, unsigned long /* valuemask */, XSetWindowAttributes * /* attributes */ #endif ); extern void XScreenSaverUnsetAttributes ( #if NeedFunctionPrototypes Display* /* display */, Drawable /* drawable */ #endif ); extern Status XScreenSaverRegister ( #if NeedFunctionPrototypes Display* /* display */, int /* screen */, XID /* xid */, Atom /* type */ #endif ); extern Status XScreenSaverUnregister ( #if NeedFunctionPrototypes Display* /* display */, int /* screen */ #endif ); extern Status XScreenSaverGetRegistered ( #if NeedFunctionPrototypes Display* /* display */, int /* screen */, XID* /* xid */, Atom* /* type */ #endif ); _XFUNCPROTOEND #endif /* _SCRNSAVER_H_ */ vnc_unixsrc/Xvnc/include/extensions/security.h0100664000076400007640000001442707120677563021275 0ustar constconst/* $XConsortium: security.h /main/6 1996/11/12 12:17:11 swick $ */ /* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _SECURITY_H #define _SECURITY_H #define _XAUTH_STRUCT_ONLY #include /* constants that server, library, and application all need */ #define XSecurityNumberEvents 1 #define XSecurityNumberErrors 2 #define XSecurityBadAuthorization 0 #define XSecurityBadAuthorizationProtocol 1 /* trust levels */ #define XSecurityClientTrusted 0 #define XSecurityClientUntrusted 1 /* authorization attribute masks */ #define XSecurityTimeout (1<<0) #define XSecurityTrustLevel (1<<1) #define XSecurityGroup (1<<2) #define XSecurityEventMask (1<<3) #define XSecurityAllAuthorizationAttributes \ (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask) /* event masks */ #define XSecurityAuthorizationRevokedMask (1<<0) #define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask /* event offsets */ #define XSecurityAuthorizationRevoked 0 #define XSecurityAuthorizationName "XC-QUERY-SECURITY-1" #define XSecurityAuthorizationNameLen 19 #ifndef _SECURITY_SERVER _XFUNCPROTOBEGIN Status XSecurityQueryExtension ( Display *dpy, int *major_version_return, int *minor_version_return); Xauth *XSecurityAllocXauth(void); void XSecurityFreeXauth(Xauth *auth); /* type for returned auth ids */ typedef unsigned long XSecurityAuthorization; typedef struct { unsigned int timeout; unsigned int trust_level; XID group; long event_mask; } XSecurityAuthorizationAttributes; Xauth *XSecurityGenerateAuthorization( Display *dpy, Xauth *auth_in, unsigned long valuemask, XSecurityAuthorizationAttributes *attributes, XSecurityAuthorization *auth_id_return); Status XSecurityRevokeAuthorization( Display *dpy, XSecurityAuthorization auth_id); _XFUNCPROTOEND typedef struct { int type; /* event base + XSecurityAuthorizationRevoked */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSecurityAuthorization auth_id; /* revoked authorization id */ } XSecurityAuthorizationRevokedEvent; #else /* _SECURITY_SERVER */ #include "input.h" /* for DeviceIntPtr */ #include "property.h" /* for PropertyPtr */ /* resource type to pass in LookupIDByType for authorizations */ extern RESTYPE SecurityAuthorizationResType; /* this is what we store for an authorization */ typedef struct { XID id; /* resource ID */ CARD32 timeout; /* how long to live in seconds after refcnt == 0 */ unsigned int trustLevel; /* trusted/untrusted */ XID group; /* see embedding extension */ unsigned int refcnt; /* how many clients connected with this auth */ unsigned int secondsRemaining; /* overflow time amount for >49 days */ OsTimerPtr timer; /* timer for this auth */ struct _OtherClients *eventClients; /* clients wanting events */ } SecurityAuthorizationRec, *SecurityAuthorizationPtr; /* The following callback is called when a GenerateAuthorization request * is processed to sanity check the group argument. The call data will * be a pointer to a SecurityValidateGroupInfoRec (below). * Functions registered on this callback are expected to examine the * group and set the valid field to TRUE if they recognize the group as a * legitimate group. If they don't recognize it, they should not change the * valid field. */ extern CallbackListPtr SecurityValidateGroupCallback; typedef struct { XID group; /* the group that was sent in GenerateAuthorization */ Bool valid; /* did anyone recognize it? if so, set to TRUE */ } SecurityValidateGroupInfoRec; /* Proc vectors for untrusted clients, swapped and unswapped versions. * These are the same as the normal proc vectors except that extensions * that haven't declared themselves secure will have ProcBadRequest plugged * in for their major opcode dispatcher. This prevents untrusted clients * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ extern int (*UntrustedProcVector[256])(ClientPtr client); extern int (*SwappedUntrustedProcVector[256])(ClientPtr client); extern Bool SecurityCheckDeviceAccess(ClientPtr client, DeviceIntPtr dev, Bool fromRequest); extern void SecurityAudit(char *format, ...); /* Give this value or higher to the -audit option to get security messages */ #define SECURITY_AUDIT_LEVEL 4 extern void SecurityCensorImage( ClientPtr client, RegionPtr pVisibleRegion, long widthBytesLine, DrawablePtr pDraw, int x, int y, int w, int h, unsigned int format, char * pBuf); #define SecurityAllowOperation 0 #define SecurityIgnoreOperation 1 #define SecurityErrorOperation 2 char SecurityCheckPropertyAccess( ClientPtr client, WindowPtr pWin, ATOM propertyName, Mask access_mode); #define SECURITY_POLICY_FILE_VERSION "version-1" char **SecurityGetSitePolicyStrings(int *n); #endif /* _SECURITY_SERVER */ #endif /* _SECURITY_H */ vnc_unixsrc/Xvnc/include/extensions/xf86misc.h0100664000076400007640000000561607120677563021075 0ustar constconst/* $XFree86: xc/include/extensions/xf86misc.h,v 3.6.2.4 1998/02/24 19:05:44 hohndel Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86MISC_H_ #define _XF86MISC_H_ #include #define X_XF86MiscQueryVersion 0 #ifdef _XF86MISC_SAVER_COMPAT_ #define X_XF86MiscGetSaver 1 #define X_XF86MiscSetSaver 2 #endif #define X_XF86MiscGetMouseSettings 3 #define X_XF86MiscGetKbdSettings 4 #define X_XF86MiscSetMouseSettings 5 #define X_XF86MiscSetKbdSettings 6 #define XF86MiscNumberEvents 0 #define XF86MiscBadMouseProtocol 0 #define XF86MiscBadMouseBaudRate 1 #define XF86MiscBadMouseFlags 2 #define XF86MiscBadMouseCombo 3 #define XF86MiscBadKbdType 4 #define XF86MiscModInDevDisabled 5 #define XF86MiscModInDevClientNotLocal 6 #define XF86MiscNumberErrors (XF86MiscModInDevClientNotLocal + 1) /* Never renumber these */ #define MTYPE_MICROSOFT 0 #define MTYPE_MOUSESYS 1 #define MTYPE_MMSERIES 2 #define MTYPE_LOGITECH 3 #define MTYPE_BUSMOUSE 4 #define MTYPE_LOGIMAN 5 #define MTYPE_PS_2 6 #define MTYPE_MMHIT 7 #define MTYPE_GLIDEPOINT 8 #define MTYPE_IMSERIAL 9 #define MTYPE_THINKING 10 #define MTYPE_IMPS2 11 #define MTYPE_THINKINGPS2 12 #define MTYPE_MMANPLUSPS2 13 #define MTYPE_GLIDEPOINTPS2 14 #define MTYPE_NETPS2 15 #define MTYPE_NETSCROLLPS2 16 #define MTYPE_SYSMOUSE 17 #define MTYPE_AUTOMOUSE 18 #define MTYPE_XQUEUE 127 #define MTYPE_OSMOUSE 126 #define KTYPE_UNKNOWN 0 #define KTYPE_84KEY 1 #define KTYPE_101KEY 2 #define KTYPE_OTHER 3 #define KTYPE_XQUEUE 4 #define MF_CLEAR_DTR 1 #define MF_CLEAR_RTS 2 #define MF_REOPEN 128 #ifndef _XF86MISC_SERVER_ _XFUNCPROTOBEGIN typedef struct { char* device; int type; int baudrate; int samplerate; int resolution; int buttons; Bool emulate3buttons; int emulate3timeout; Bool chordmiddle; int flags; } XF86MiscMouseSettings; typedef struct { int type; int rate; int delay; Bool servnumlock; } XF86MiscKbdSettings; Bool XF86MiscQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */ #endif ); Bool XF86MiscQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_base */, int* /* error_base */ #endif ); Status XF86MiscGetMouseSettings( #if NeedFunctionPrototypes Display* /* dpy */, XF86MiscMouseSettings* /* mouse info */ #endif ); Status XF86MiscGetKbdSettings( #if NeedFunctionPrototypes Display* /* dpy */, XF86MiscKbdSettings* /* keyboard info */ #endif ); Status XF86MiscSetMouseSettings( #if NeedFunctionPrototypes Display* /* dpy */, XF86MiscMouseSettings* /* mouse info */ #endif ); Status XF86MiscSetKbdSettings( #if NeedFunctionPrototypes Display* /* dpy */, XF86MiscKbdSettings* /* keyboard info */ #endif ); _XFUNCPROTOEND #endif #endif vnc_unixsrc/Xvnc/include/extensions/XIEproto.h0100664000076400007640000004724207120677563021140 0ustar constconst/* $XConsortium: XIEproto.h,v 1.6 94/04/17 20:11:12 mor Exp $ */ /****************************************************************************** Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. NOTICE This software is being provided by AGE Logic, Inc. under the following license. By obtaining, using and/or copying this software, you agree that you have read, understood, and will comply with these terms and conditions: Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee or royalty and to grant others any or all rights granted herein is hereby granted, provided that you agree to comply with the following copyright notice and statements, including the disclaimer, and that the same appears on all copies and derivative works of the software and documentation you make. "Copyright 1993, 1994 by AGE Logic, Inc." THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not limitation, AGE LOGIC MAKE NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. The name of AGE Logic, Inc. may not be used in advertising or publicity pertaining to this software without specific, written prior permission from AGE Logic. Title to this software shall at all times remain with AGE Logic, Inc. ******************************************************************************/ #ifndef _XIEPROTO_H_ #define _XIEPROTO_H_ #include #define Drawable CARD32 #define Colormap CARD32 #define GContext CARD32 typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; } xieReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xieQueryImageExtensionReq; typedef struct { CARD8 type; CARD8 data; CARD16 sequenceNum B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; xieTypServiceClass serviceClass; xieTypAlignment alignment; CARD16 unconstrainedMantissa B16; INT32 unconstrainedMaxExp B32; INT32 unconstrainedMinExp B32; CARD8 pad2[8]; /* LISTofCARD32 (constrained-levels) */ } xieQueryImageExtensionReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypTechniqueGroup techniqueGroup; CARD8 pad[3]; } xieQueryTechniquesReq; typedef struct { CARD8 type; CARD8 data; CARD16 sequenceNum B16; CARD32 length B32; CARD16 numTechniques B16; CARD8 pad[22]; /* LISTofTechniqueRec (numTechniques) */ } xieQueryTechniquesReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypColorList colorList B32; } xieCreateColorListReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypColorList colorList B32; } xieDestroyColorListReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypColorList colorList B32; } xiePurgeColorListReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypColorList colorList B32; } xieQueryColorListReq; typedef struct { CARD8 type; CARD8 data; CARD16 sequenceNum B16; CARD32 length B32; Colormap colormap B32; CARD8 pad[20]; /* LISTofCARD32 (length) */ } xieQueryColorListReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypLUT lut B32; } xieCreateLUTReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypLUT lut B32; } xieDestroyLUTReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotomap photomap B32; } xieCreatePhotomapReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotomap photomap B32; } xieDestroyPhotomapReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotomap photomap B32; } xieQueryPhotomapReq; typedef struct { CARD8 type; BOOL populated; CARD16 sequenceNum B16; CARD32 length B32; xieTypDataClass dataClass; xieTypDataType dataType; xieTypDecodeTechnique decodeTechnique B16; CARD32 width0 B32; CARD32 width1 B32; CARD32 width2 B32; CARD32 height0 B32; CARD32 height1 B32; CARD32 height2 B32; CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; } xieQueryPhotomapReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypROI roi B32; } xieCreateROIReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypROI roi B32; } xieDestroyROIReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotospace nameSpace B32; } xieCreatePhotospaceReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotospace nameSpace B32; } xieDestroyPhotospaceReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotospace nameSpace B32; CARD32 floID B32; CARD16 numElements B16; BOOL notify; CARD8 pad; /* LISTofPhotoElement (numElements) */ } xieExecuteImmediateReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotoflo floID B32; CARD16 numElements B16; CARD16 pad B16; /* LISTofPhotoElement (numElements) */ } xieCreatePhotofloReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotoflo floID B32; } xieDestroyPhotofloReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotoflo floID B32; BOOL notify; CARD8 pad[3]; } xieExecutePhotofloReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotoflo floID B32; xieTypPhototag start B16; CARD16 numElements B16; /* LISTofPhotoElement (numElements) */ } xieModifyPhotofloReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; xieTypPhotoflo floID B32; CARD16 numElements B16; CARD16 pad B16; /* LISTofPhotoElement (numElements) */ } xieRedefinePhotofloReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD32 nameSpace B32; CARD32 floID B32; xieTypPhototag element B16; BOOL final; CARD8 bandNumber; CARD32 byteCount B32; /* LISTofCARD8 (byteCount) */ /* pad (byteCount) */ } xiePutClientDataReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD32 nameSpace B32; CARD32 floID B32; CARD32 maxBytes B32; xieTypPhototag element B16; BOOL terminate; CARD8 bandNumber; } xieGetClientDataReq; typedef struct { CARD8 type; CARD8 newState; CARD16 sequenceNum B16; CARD32 length B32; CARD32 byteCount B32; CARD8 pad[20]; /* LISTofCARD8 (byteCount) */ /* pad (byteCount) */ } xieGetClientDataReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD32 nameSpace B32; CARD32 floID B32; } xieQueryPhotofloReq; typedef struct { CARD8 type; CARD8 state; CARD16 sequenceNum B16; CARD32 length B32; CARD16 expectedCount B16; CARD16 availableCount B16; CARD8 pad[20]; /* LISTofPhototag (expectedCount) */ /* pad (expectedCount * 2) */ /* LISTofPhototag (availableCount) */ /* pad (availableCount * 2) */ } xieQueryPhotofloReply; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD32 nameSpace B32; CARD32 floID B32; } xieAwaitReq; typedef struct { CARD8 reqType; CARD8 opcode; CARD16 length B16; CARD32 nameSpace B32; CARD32 floID B32; } xieAbortReq; /* * Request codes */ #define X_ieQueryImageExtension 1 #define X_ieQueryTechniques 2 #define X_ieCreateColorList 3 #define X_ieDestroyColorList 4 #define X_iePurgeColorList 5 #define X_ieQueryColorList 6 #define X_ieCreateLUT 7 #define X_ieDestroyLUT 8 #define X_ieCreatePhotomap 9 #define X_ieDestroyPhotomap 10 #define X_ieQueryPhotomap 11 #define X_ieCreateROI 12 #define X_ieDestroyROI 13 #define X_ieCreatePhotospace 14 #define X_ieDestroyPhotospace 15 #define X_ieExecuteImmediate 16 #define X_ieCreatePhotoflo 17 #define X_ieDestroyPhotoflo 18 #define X_ieExecutePhotoflo 19 #define X_ieModifyPhotoflo 20 #define X_ieRedefinePhotoflo 21 #define X_iePutClientData 22 #define X_ieGetClientData 23 #define X_ieQueryPhotoflo 24 #define X_ieAwait 25 #define X_ieAbort 26 #define xieNumProtoReq 26 /* * Events */ typedef struct { CARD8 event; xieTypPhotofloOutcome outcome; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; CARD8 pad[16]; } xiePhotofloDoneEvn; typedef struct { CARD8 event; CARD8 pad1; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; xieTypPhototag src B16; CARD16 type B16; CARD32 pad2 B32; CARD32 pad3 B16; CARD32 pad4 B32; } xieFloEvn; typedef struct { CARD8 event; CARD8 pad1; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; xieTypPhototag src B16; CARD16 type B16; xieTypColorList colorList B32; xieTypColorAllocTechnique colorAllocTechnique B16; CARD16 pad2 B16; CARD32 data B32; } xieColorAllocEvn; typedef struct { CARD8 event; CARD8 bandNumber; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; xieTypPhototag src B16; CARD16 type B16; xieTypDecodeTechnique decodeTechnique B16; BOOL aborted; CARD8 pad; CARD32 width B32; CARD32 height B32; } xieDecodeNotifyEvn; typedef struct { CARD8 event; CARD8 bandNumber; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; xieTypPhototag src B16; CARD16 type B16; CARD32 data0 B32; CARD32 data1 B32; CARD32 data2 B32; } xieExportAvailableEvn; typedef struct { CARD8 event; CARD8 pad; CARD16 sequenceNum B16; CARD32 time B32; CARD32 instanceNameSpace B32; CARD32 instanceFloID B32; xieTypPhototag src B16; CARD16 type B16; Window window B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; } xieImportObscuredEvn; /* * Errors */ typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 resourceID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 pad[21]; } xieResourceErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; CARD32 resourceID B32; CARD8 pad[8]; } xieFloResourceErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; CARD8 pad[12]; } xieFloErr, xieFloAccessErr, xieFloAllocErr, xieFloElementErr, xieFloLengthErr, xieFloMatchErr, xieFloSourceErr, xieFloImplementationErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; xieTypPhototag domainSrc B16; CARD8 pad[10]; } xieFloDomainErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; CARD8 pad[16]; } xieFloIDErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; CARD8 operator; CARD8 pad[11]; } xieFloOperatorErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; CARD16 techniqueNumber B16; CARD16 lenTechParams B16; CARD8 techniqueGroup; CARD8 pad[7]; } xieFloTechniqueErr; typedef struct { CARD8 error; CARD8 code; CARD16 sequenceNum B16; CARD32 floID B32; CARD16 minorOpcode B16; CARD8 majorOpcode; CARD8 floErrorCode; CARD32 nameSpace B32; xieTypPhototag phototag B16; CARD16 type B16; CARD32 badValue B32; CARD8 pad[8]; } xieFloValueErr; /* * SIZEOF values */ #define sz_xieReq 4 #define sz_xieQueryImageExtensionReq 8 #define sz_xieQueryImageExtensionReply 32 #define sz_xieQueryTechniquesReq 8 #define sz_xieQueryTechniquesReply 32 #define sz_xieCreateColorListReq 8 #define sz_xieDestroyColorListReq 8 #define sz_xiePurgeColorListReq 8 #define sz_xieQueryColorListReq 8 #define sz_xieQueryColorListReply 32 #define sz_xieCreateLUTReq 8 #define sz_xieDestroyLUTReq 8 #define sz_xieCreatePhotomapReq 8 #define sz_xieDestroyPhotomapReq 8 #define sz_xieQueryPhotomapReq 8 #define sz_xieQueryPhotomapReply 48 #define sz_xieCreateROIReq 8 #define sz_xieDestroyROIReq 8 #define sz_xieCreatePhotospaceReq 8 #define sz_xieDestroyPhotospaceReq 8 #define sz_xieExecuteImmediateReq 16 #define sz_xieCreatePhotofloReq 12 #define sz_xieDestroyPhotofloReq 8 #define sz_xieExecutePhotofloReq 12 #define sz_xieModifyPhotofloReq 12 #define sz_xieRedefinePhotofloReq 12 #define sz_xiePutClientDataReq 20 #define sz_xieGetClientDataReq 20 #define sz_xieGetClientDataReply 32 #define sz_xieQueryPhotofloReq 12 #define sz_xieQueryPhotofloReply 32 #define sz_xieAwaitReq 12 #define sz_xieAbortReq 12 #define sz_xiePhotofloDoneEvn 32 #define sz_xieColorAllocEvn 32 #define sz_xieDecodeNotifyEvn 32 #define sz_xieExportAvailableEvn 32 #define sz_xieImportObscuredEvn 32 #define sz_xieFloEvn 32 #define sz_xieResourceErr 32 #define sz_xieFloAccessErr 32 #define sz_xieFloAllocErr 32 #define sz_xieFloElementErr 32 #define sz_xieFloIDErr 32 #define sz_xieFloLengthErr 32 #define sz_xieFloMatchErr 32 #define sz_xieFloSourceErr 32 #define sz_xieFloDomainErr 32 #define sz_xieFloOperatorErr 32 #define sz_xieFloTechniqueErr 32 #define sz_xieFloValueErr 32 #define sz_xieFloImplementationErr 32 #define sz_xieFloErr 32 #undef Drawable #undef Colormap #undef GContext #endif /* _XIEPROTO_H_ */ vnc_unixsrc/Xvnc/include/extensions/xtestext1.h0100664000076400007640000002576507120677563021406 0ustar constconst/* * xtestext1.h * * X11 Input Synthesis Extension include file */ /* Copyright (c) 1986, 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hewlett-Packard makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. */ /* * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h */ /* * used in the XTestPressButton and XTestPressKey functions */ #define XTestPRESS 1 << 0 #define XTestRELEASE 1 << 1 #define XTestSTROKE 1 << 2 /* * When doing a key or button stroke, the number of milliseconds * to delay between the press and the release of a key or button * in the XTestPressButton and XTestPressKey functions. */ #define XTestSTROKE_DELAY_TIME 10 /* * used in the XTestGetInput function */ #define XTestEXCLUSIVE 1 << 0 #define XTestPACKED_ACTIONS 1 << 1 #define XTestPACKED_MOTION 1 << 2 /* * used in the XTestFakeInput function */ #define XTestFAKE_ACK_NOT_NEEDED 0 #define XTestFAKE_ACK_REQUEST 1 /* * used in the XTest extension initialization routine */ #define XTestEXTENSION_NAME "XTestExtension1" #define XTestEVENT_COUNT 2 /* * XTest request type values * * used in the XTest extension protocol requests */ #define X_TestFakeInput 1 #define X_TestGetInput 2 #define X_TestStopInput 3 #define X_TestReset 4 #define X_TestQueryInputSize 5 /* * This defines the maximum size of a list of input actions * to be sent to the server. It should always be a multiple of * 4 so that the entire xTestFakeInputReq structure size is a * multiple of 4. */ #define XTestMAX_ACTION_LIST_SIZE 64 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestFakeInput */ CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */ CARD32 ack B32; CARD8 action_list[XTestMAX_ACTION_LIST_SIZE]; } xTestFakeInputReq; #define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8) typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestGetInput */ CARD16 length B16; /* 2 */ CARD32 mode B32; } xTestGetInputReq; #define sz_xTestGetInputReq 8 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestStopInput */ CARD16 length B32; /* 1 */ } xTestStopInputReq; #define sz_xTestStopInputReq 4 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestReset */ CARD16 length B16; /* 1 */ } xTestResetReq; #define sz_xTestResetReq 4 typedef struct { CARD8 reqType; /* always XTestReqCode */ CARD8 XTestReqType; /* always X_TestQueryInputSize */ CARD16 length B16; /* 1 */ } xTestQueryInputSizeReq; #define sz_xTestQueryInputSizeReq 4 /* * This is the definition of the reply for the xTestQueryInputSize * request. It should remain the same minimum size as other replies * (32 bytes). */ typedef struct { CARD8 type; /* always X_Reply */ CARD8 pad1; CARD16 sequenceNumber B16; CARD32 length B32; /* always 0 */ CARD32 size_return B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xTestQueryInputSizeReply; /* * This is the definition for the input action wire event structure. * This event is sent to the client when the server has one or * more user input actions to report to the client. It must * remain the same size as all other wire events (32 bytes). */ #define XTestACTIONS_SIZE 28 typedef struct { CARD8 type; /* always XTestInputActionType */ CARD8 pad00; CARD16 sequenceNumber B16; CARD8 actions[XTestACTIONS_SIZE]; } xTestInputActionEvent; /* * This is the definition for the xTestFakeAck wire event structure. * This event is sent to the client when the server has completely * processed its input action buffer, and is ready for more. * It must remain the same size as all other wire events (32 bytes). */ typedef struct { CARD8 type; /* always XTestFakeAckType */ CARD8 pad00; CARD16 sequenceNumber B16; CARD32 pad02 B32; CARD32 pad03 B32; CARD32 pad04 B32; CARD32 pad05 B32; CARD32 pad06 B32; CARD32 pad07 B32; CARD32 pad08 B32; } xTestFakeAckEvent; /* * The server side of this extension does not (and should not) have * definitions for Display and Window. The ifndef allows the server * side of the extension to ignore the following typedefs. */ #ifndef XTestSERVER_SIDE /* * This is the definition for the input action host format event structure. * This is the form that a client using this extension will see when * it receives an input action event. */ typedef struct { int type; /* always XTestInputActionType */ Display *display; Window window; CARD8 actions[XTestACTIONS_SIZE]; } XTestInputActionEvent; /* * This is the definition for the xTestFakeAck host format event structure. * This is the form that a client using this extension will see when * it receives an XTestFakeAck event. */ typedef struct { int type; /* always XTestFakeAckType */ Display *display; Window window; } XTestFakeAckEvent; #endif /* * This is the definition for the format of the header byte * in the input action structures. */ #define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */ #define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */ #define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */ #define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */ #define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */ #define XTestMAX_DEVICE_ID 0x0f #define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4) #define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4) /* * These are the possible action types. */ #define XTestDELAY_ACTION 0 #define XTestKEY_ACTION 1 #define XTestMOTION_ACTION 2 #define XTestJUMP_ACTION 3 /* * These are the definitions for key/button motion input actions. */ #define XTestKEY_UP 0x04 #define XTestKEY_DOWN 0x00 typedef struct { CARD8 header; /* which device, key up/down */ CARD8 keycode; /* which key/button to move */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestKeyInfo; /* * This is the definition for pointer jump input actions. */ typedef struct { CARD8 header; /* which pointer */ CARD8 pad1; /* unused padding byte */ CARD16 jumpx B16; /* x coord to jump to */ CARD16 jumpy B16; /* y coord to jump to */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestJumpInfo; /* * These are the definitions for pointer relative motion input * actions. * * The sign bits for the x and y relative motions are contained * in the header byte. The x and y relative motions are packed * into one byte to make things fit in 32 bits. If the relative * motion range is larger than +/-15, use the pointer jump action. */ #define XTestMOTION_MAX 15 #define XTestMOTION_MIN -15 #define XTestX_NEGATIVE 0x04 #define XTestY_NEGATIVE 0x08 #define XTestX_MOTION_MASK 0x0f #define XTestY_MOTION_MASK 0xf0 #define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK) #define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK) #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK) #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4) typedef struct { CARD8 header; /* which pointer */ CARD8 motion_data; /* x,y relative motion */ CARD16 delay_time B16; /* how long to delay (in ms) */ } XTestMotionInfo; /* * These are the definitions for a long delay input action. It is * used when more than XTestSHORT_DELAY_TIME milliseconds of delay * (approximately one minute) is needed. * * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. * This guarantees that a header byte with a value of 0 is not * a valid header, so it can be used as a flag to indicate that * there are no more input actions in an XTestInputAction event. */ #define XTestSHORT_DELAY_TIME 0xffff #define XTestDELAY_DEVICE_ID 0x0f typedef struct { CARD8 header; /* always XTestDELAY_DEVICE_ID */ CARD8 pad1; /* unused padding byte */ CARD16 pad2 B16; /* unused padding word */ CARD32 delay_time B32; /* how long to delay (in ms) */ } XTestDelayInfo; vnc_unixsrc/Xvnc/include/extensions/securstr.h0100664000076400007640000000703707120677563021277 0ustar constconst/* $XConsortium: securstr.h /main/4 1996/11/12 12:17:47 swick $ */ /* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _SECURSTR_H #define _SECURSTR_H #include "security.h" #define SECURITY_EXTENSION_NAME "SECURITY" #define SECURITY_MAJOR_VERSION 1 #define SECURITY_MINOR_VERSION 0 #define X_SecurityQueryVersion 0 #define X_SecurityGenerateAuthorization 1 #define X_SecurityRevokeAuthorization 2 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xSecurityQueryVersionReq; #define sz_xSecurityQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityQueryVersionReply; #define sz_xSecurityQueryVersionReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD16 nbytesAuthProto B16; CARD16 nbytesAuthData B16; CARD32 valueMask B32; /* auth protocol name padded to 4 bytes */ /* auth protocol data padded to 4 bytes */ /* list of CARD32 values, if any */ } xSecurityGenerateAuthorizationReq; #define sz_xSecurityGenerateAuthorizationReq 12 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 authId B32; CARD16 dataLength B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityGenerateAuthorizationReply; #define sz_xSecurityGenerateAuthorizationReply 32 typedef struct { CARD8 reqType; CARD8 securityReqType; CARD16 length B16; CARD32 authId B32; } xSecurityRevokeAuthorizationReq; #define sz_xSecurityRevokeAuthorizationReq 8 typedef struct _xSecurityAuthorizationRevokedEvent { BYTE type; BYTE detail; CARD16 sequenceNumber B16; CARD32 authId B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xSecurityAuthorizationRevokedEvent; #define sz_xSecurityAuthorizationRevokedEvent 32 #endif /* _SECURSTR_H */ vnc_unixsrc/Xvnc/include/extensions/XLbx.h0100664000076400007640000000742507120677563020303 0ustar constconst/* $XConsortium: XLbx.h /main/21 1996/12/15 21:23:54 rws $ */ /* * Copyright 1992 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _XLBX_H_ #define _XLBX_H_ #include /* * NOTE: any changes or additions to the opcodes needs to be reflected * in the lbxCacheable array in Xserver/lbx/lbxmain.c */ #define X_LbxQueryVersion 0 #define X_LbxStartProxy 1 #define X_LbxStopProxy 2 #define X_LbxSwitch 3 #define X_LbxNewClient 4 #define X_LbxCloseClient 5 #define X_LbxModifySequence 6 #define X_LbxAllowMotion 7 #define X_LbxIncrementPixel 8 #define X_LbxDelta 9 #define X_LbxGetModifierMapping 10 #define X_LbxInvalidateTag 12 #define X_LbxPolyPoint 13 #define X_LbxPolyLine 14 #define X_LbxPolySegment 15 #define X_LbxPolyRectangle 16 #define X_LbxPolyArc 17 #define X_LbxFillPoly 18 #define X_LbxPolyFillRectangle 19 #define X_LbxPolyFillArc 20 #define X_LbxGetKeyboardMapping 21 #define X_LbxQueryFont 22 #define X_LbxChangeProperty 23 #define X_LbxGetProperty 24 #define X_LbxTagData 25 #define X_LbxCopyArea 26 #define X_LbxCopyPlane 27 #define X_LbxPolyText8 28 #define X_LbxPolyText16 29 #define X_LbxImageText8 30 #define X_LbxImageText16 31 #define X_LbxQueryExtension 32 #define X_LbxPutImage 33 #define X_LbxGetImage 34 #define X_LbxBeginLargeRequest 35 #define X_LbxLargeRequestData 36 #define X_LbxEndLargeRequest 37 #define X_LbxInternAtoms 38 #define X_LbxGetWinAttrAndGeom 39 #define X_LbxGrabCmap 40 #define X_LbxReleaseCmap 41 #define X_LbxAllocColor 42 #define X_LbxSync 43 #define LbxNumberReqs 44 #define LbxEvent 0 #define LbxQuickMotionDeltaEvent 1 #define LbxNumberEvents 2 /* This is always the master client */ #define LbxMasterClientIndex 0 /* LbxEvent lbxType sub-fields */ #define LbxSwitchEvent 0 #define LbxCloseEvent 1 #define LbxDeltaEvent 2 #define LbxInvalidateTagEvent 3 #define LbxSendTagDataEvent 4 #define LbxListenToOne 5 #define LbxListenToAll 6 #define LbxMotionDeltaEvent 7 #define LbxReleaseCmapEvent 8 #define LbxFreeCellsEvent 9 /* * Lbx image compression methods * * No compression is always assigned the value of 0. * * The rest of the compression method opcodes are assigned dynamically * at option negotiation time. */ #define LbxImageCompressNone 0 #define BadLbxClient 0 #define LbxNumberErrors (BadLbxClient + 1) /* tagged data types */ #define LbxTagTypeModmap 1 #define LbxTagTypeKeymap 2 #define LbxTagTypeProperty 3 #define LbxTagTypeFont 4 #define LbxTagTypeConnInfo 5 #ifndef _XLBX_SERVER_ _XFUNCPROTOBEGIN Bool XLbxQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */ #endif ); _XFUNCPROTOEND #endif #endif vnc_unixsrc/Xvnc/include/extensions/XKBstr.h0100664000076400007640000004354207120677563020603 0ustar constconst/* $TOG: XKBstr.h /main/16 1997/06/10 06:53:12 kaleb $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSTR_H_ #define _XKBSTR_H_ #include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) #define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) #if defined(WORD64) && defined(UNSIGNEDBITFIELDS) #define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\ (int)(((h)<<8)|(l)&0x7fff)) #else #define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) #endif /* * Common data structures and access macros */ typedef struct _XkbStateRec { unsigned char group; unsigned char locked_group; unsigned short base_group; unsigned short latched_group; unsigned char mods; unsigned char base_mods; unsigned char latched_mods; unsigned char locked_mods; unsigned char compat_state; unsigned char grab_mods; unsigned char compat_grab_mods; unsigned char lookup_mods; unsigned char compat_lookup_mods; unsigned short ptr_buttons; } XkbStateRec,*XkbStatePtr; #define XkbModLocks(s) ((s)->locked_mods) #define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) #define XkbGroupLock(s) ((s)->locked_group) #define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) #define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) #define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) typedef struct _XkbMods { unsigned char mask; /* effective mods */ unsigned char real_mods; unsigned short vmods; } XkbModsRec,*XkbModsPtr; typedef struct _XkbKTMapEntry { Bool active; unsigned char level; XkbModsRec mods; } XkbKTMapEntryRec,*XkbKTMapEntryPtr; typedef struct _XkbKeyType { XkbModsRec mods; unsigned char num_levels; unsigned char map_count; XkbKTMapEntryPtr map; XkbModsPtr preserve; Atom name; Atom * level_names; } XkbKeyTypeRec, *XkbKeyTypePtr; #define XkbNumGroups(g) ((g)&0x0f) #define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) #define XkbOutOfRangeGroupAction(g) ((g)&0xc0) #define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) #define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) #define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) /* * Structures and access macros used primarily by the server */ typedef struct _XkbBehavior { unsigned char type; unsigned char data; } XkbBehavior; #define XkbAnyActionDataSize 7 typedef struct _XkbAnyAction { unsigned char type; unsigned char data[XkbAnyActionDataSize]; } XkbAnyAction; typedef struct _XkbModAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; unsigned char vmods1; unsigned char vmods2; } XkbModAction; #define XkbModActionVMods(a) \ ((short)(((a)->vmods1<<8)|((a)->vmods2))) #define XkbSetModActionVMods(a,v) \ (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) typedef struct _XkbGroupAction { unsigned char type; unsigned char flags; char group_XXX; } XkbGroupAction; #define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) #define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) typedef struct _XkbISOAction { unsigned char type; unsigned char flags; unsigned char mask; unsigned char real_mods; char group_XXX; unsigned char affect; unsigned char vmods1; unsigned char vmods2; } XkbISOAction; typedef struct _XkbPtrAction { unsigned char type; unsigned char flags; unsigned char high_XXX; unsigned char low_XXX; unsigned char high_YYY; unsigned char low_YYY; } XkbPtrAction; #define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) #define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) #define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) #define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) typedef struct _XkbPtrBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; } XkbPtrBtnAction; typedef struct _XkbPtrDfltAction { unsigned char type; unsigned char flags; unsigned char affect; char valueXXX; } XkbPtrDfltAction; #define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) #define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) typedef struct _XkbSwitchScreenAction { unsigned char type; unsigned char flags; char screenXXX; } XkbSwitchScreenAction; #define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) #define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) typedef struct _XkbCtrlsAction { unsigned char type; unsigned char flags; unsigned char ctrls3; unsigned char ctrls2; unsigned char ctrls1; unsigned char ctrls0; } XkbCtrlsAction; #define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ ((a)->ctrls2=(((c)>>16)&0xff)),\ ((a)->ctrls1=(((c)>>8)&0xff)),\ ((a)->ctrls0=((c)&0xff))) #define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ (((unsigned int)(a)->ctrls2)<<16)|\ (((unsigned int)(a)->ctrls1)<<8)|\ ((unsigned int)((a)->ctrls0))) typedef struct _XkbMessageAction { unsigned char type; unsigned char flags; unsigned char message[6]; } XkbMessageAction; typedef struct _XkbRedirectKeyAction { unsigned char type; unsigned char new_key; unsigned char mods_mask; unsigned char mods; unsigned char vmods_mask0; unsigned char vmods_mask1; unsigned char vmods0; unsigned char vmods1; } XkbRedirectKeyAction; #define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ ((unsigned int)(a)->vmods0)) #define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) #define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ ((unsigned int)(a)->vmods_mask0)) #define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ ((a)->vmods_mask0=((m)&0xff))) typedef struct _XkbDeviceBtnAction { unsigned char type; unsigned char flags; unsigned char count; unsigned char button; unsigned char device; } XkbDeviceBtnAction; typedef struct _XkbDeviceValuatorAction { unsigned char type; unsigned char device; unsigned char v1_what; unsigned char v1_ndx; unsigned char v1_value; unsigned char v2_what; unsigned char v2_ndx; unsigned char v2_value; } XkbDeviceValuatorAction; typedef union _XkbAction { XkbAnyAction any; XkbModAction mods; XkbGroupAction group; XkbISOAction iso; XkbPtrAction ptr; XkbPtrBtnAction btn; XkbPtrDfltAction dflt; XkbSwitchScreenAction screen; XkbCtrlsAction ctrls; XkbMessageAction msg; XkbRedirectKeyAction redirect; XkbDeviceBtnAction devbtn; XkbDeviceValuatorAction devval; unsigned char type; } XkbAction; typedef struct _XkbControls { unsigned char mk_dflt_btn; unsigned char num_groups; unsigned char groups_wrap; XkbModsRec internal; XkbModsRec ignore_lock; unsigned int enabled_ctrls; unsigned short repeat_delay; unsigned short repeat_interval; unsigned short slow_keys_delay; unsigned short debounce_delay; unsigned short mk_delay; unsigned short mk_interval; unsigned short mk_time_to_max; unsigned short mk_max_speed; short mk_curve; unsigned short ax_options; unsigned short ax_timeout; unsigned short axt_opts_mask; unsigned short axt_opts_values; unsigned int axt_ctrls_mask; unsigned int axt_ctrls_values; unsigned char per_key_repeat[XkbPerKeyBitArraySize]; } XkbControlsRec, *XkbControlsPtr; #define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) #define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) #define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) typedef struct _XkbServerMapRec { unsigned short num_acts; unsigned short size_acts; XkbAction *acts; XkbBehavior *behaviors; unsigned short *key_acts; #if defined(__cplusplus) || defined(c_plusplus) /* explicit is a C++ reserved word */ unsigned char *c_explicit; #else unsigned char *explicit; #endif unsigned char vmods[XkbNumVirtualMods]; unsigned short *vmodmap; } XkbServerMapRec, *XkbServerMapPtr; #define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) /* * Structures and access macros used primarily by clients */ typedef struct _XkbSymMapRec { unsigned char kt_index[XkbNumKbdGroups]; unsigned char group_info; unsigned char width; unsigned short offset; } XkbSymMapRec, *XkbSymMapPtr; typedef struct _XkbClientMapRec { unsigned char size_types; unsigned char num_types; XkbKeyTypePtr types; unsigned short size_syms; unsigned short num_syms; KeySym *syms; XkbSymMapPtr key_sym_map; unsigned char *modmap; } XkbClientMapRec, *XkbClientMapPtr; #define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) #define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) #define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) #define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) #define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) #define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) #define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) #define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) #define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) /* * Compatibility structures and access macros */ typedef struct _XkbSymInterpretRec { KeySym sym; unsigned char flags; unsigned char match; unsigned char mods; unsigned char virtual_mod; XkbAnyAction act; } XkbSymInterpretRec,*XkbSymInterpretPtr; typedef struct _XkbCompatMapRec { XkbSymInterpretPtr sym_interpret; XkbModsRec groups[XkbNumKbdGroups]; unsigned short num_si; unsigned short size_si; } XkbCompatMapRec, *XkbCompatMapPtr; typedef struct _XkbIndicatorMapRec { unsigned char flags; unsigned char which_groups; unsigned char groups; unsigned char which_mods; XkbModsRec mods; unsigned int ctrls; } XkbIndicatorMapRec, *XkbIndicatorMapPtr; #define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ (((i)->which_groups&&(i)->groups)||\ ((i)->which_mods&&(i)->mods.mask)||\ ((i)->ctrls))) #define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ ((i)->which_mods)||((i)->ctrls)) typedef struct _XkbIndicatorRec { unsigned long phys_indicators; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbIndicatorRec,*XkbIndicatorPtr; typedef struct _XkbKeyNameRec { char name[XkbKeyNameLength]; } XkbKeyNameRec,*XkbKeyNamePtr; typedef struct _XkbKeyAliasRec { char real[XkbKeyNameLength]; char alias[XkbKeyNameLength]; } XkbKeyAliasRec,*XkbKeyAliasPtr; /* * Names for everything */ typedef struct _XkbNamesRec { Atom keycodes; Atom geometry; Atom symbols; Atom types; Atom compat; Atom vmods[XkbNumVirtualMods]; Atom indicators[XkbNumIndicators]; Atom groups[XkbNumKbdGroups]; XkbKeyNamePtr keys; XkbKeyAliasPtr key_aliases; Atom *radio_groups; Atom phys_symbols; unsigned char num_keys; unsigned char num_key_aliases; unsigned short num_rg; } XkbNamesRec,*XkbNamesPtr; typedef struct _XkbGeometry *XkbGeometryPtr; /* * Tie it all together into one big keyboard description */ typedef struct _XkbDesc { struct _XDisplay * dpy; unsigned short flags; unsigned short device_spec; KeyCode min_key_code; KeyCode max_key_code; XkbControlsPtr ctrls; XkbServerMapPtr server; XkbClientMapPtr map; XkbIndicatorPtr indicators; XkbNamesPtr names; XkbCompatMapPtr compat; XkbGeometryPtr geom; } XkbDescRec, *XkbDescPtr; #define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) #define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) #define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) #define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) #define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) #define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) #define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) #define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) #define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) #define XkbKeySymEntry(d,k,sl,g) \ (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) #define XkbKeyAction(d,k,n) \ (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) #define XkbKeyActionEntry(d,k,sl,g) \ (XkbKeyHasActions(d,k)?\ XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) #define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) #define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) #define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) #define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ ((k)<=(d)->max_key_code)) #define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) /* * The following structures can be used to track changes * to a keyboard device */ typedef struct _XkbMapChanges { unsigned short changed; KeyCode min_key_code; KeyCode max_key_code; unsigned char first_type; unsigned char num_types; KeyCode first_key_sym; unsigned char num_key_syms; KeyCode first_key_act; unsigned char num_key_acts; KeyCode first_key_behavior; unsigned char num_key_behaviors; KeyCode first_key_explicit; unsigned char num_key_explicit; KeyCode first_modmap_key; unsigned char num_modmap_keys; KeyCode first_vmodmap_key; unsigned char num_vmodmap_keys; unsigned char pad; unsigned short vmods; } XkbMapChangesRec,*XkbMapChangesPtr; typedef struct _XkbControlsChanges { unsigned int changed_ctrls; unsigned int enabled_ctrls_changes; Bool num_groups_changed; } XkbControlsChangesRec,*XkbControlsChangesPtr; typedef struct _XkbIndicatorChanges { unsigned int state_changes; unsigned int map_changes; } XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; typedef struct _XkbNameChanges { unsigned int changed; unsigned char first_type; unsigned char num_types; unsigned char first_lvl; unsigned char num_lvls; unsigned char num_aliases; unsigned char num_rg; unsigned char first_key; unsigned char num_keys; unsigned short changed_vmods; unsigned long changed_indicators; unsigned char changed_groups; } XkbNameChangesRec,*XkbNameChangesPtr; typedef struct _XkbCompatChanges { unsigned char changed_groups; unsigned short first_si; unsigned short num_si; } XkbCompatChangesRec,*XkbCompatChangesPtr; typedef struct _XkbChanges { unsigned short device_spec; unsigned short state_changes; XkbMapChangesRec map; XkbControlsChangesRec ctrls; XkbIndicatorChangesRec indicators; XkbNameChangesRec names; XkbCompatChangesRec compat; } XkbChangesRec, *XkbChangesPtr; /* * These data structures are used to construct a keymap from * a set of components or to list components in the server * database. */ typedef struct _XkbComponentNames { char * keymap; char * keycodes; char * types; char * compat; char * symbols; char * geometry; } XkbComponentNamesRec, *XkbComponentNamesPtr; typedef struct _XkbComponentName { unsigned short flags; char * name; } XkbComponentNameRec,*XkbComponentNamePtr; typedef struct _XkbComponentList { int num_keymaps; int num_keycodes; int num_types; int num_compat; int num_symbols; int num_geometry; XkbComponentNamePtr keymaps; XkbComponentNamePtr keycodes; XkbComponentNamePtr types; XkbComponentNamePtr compat; XkbComponentNamePtr symbols; XkbComponentNamePtr geometry; } XkbComponentListRec, *XkbComponentListPtr; /* * The following data structures describe and track changes to a * non-keyboard extension device */ typedef struct _XkbDeviceLedInfo { unsigned short led_class; unsigned short led_id; unsigned int phys_indicators; unsigned int maps_present; unsigned int names_present; unsigned int state; Atom names[XkbNumIndicators]; XkbIndicatorMapRec maps[XkbNumIndicators]; } XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; typedef struct _XkbDeviceInfo { char * name; Atom type; unsigned short device_spec; Bool has_own_state; unsigned short supported; unsigned short unsupported; unsigned short num_btns; XkbAction * btn_acts; unsigned short sz_leds; unsigned short num_leds; unsigned short dflt_kbd_fb; unsigned short dflt_led_fb; XkbDeviceLedInfoPtr leds; } XkbDeviceInfoRec,*XkbDeviceInfoPtr; #define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) #define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) #define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) typedef struct _XkbDeviceLedChanges { unsigned short led_class; unsigned short led_id; unsigned int defined; /* names or maps changed */ struct _XkbDeviceLedChanges *next; } XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; typedef struct _XkbDeviceChanges { unsigned int changed; unsigned short first_btn; unsigned short num_btns; XkbDeviceLedChangesRec leds; } XkbDeviceChangesRec,*XkbDeviceChangesPtr; #endif /* _XKBSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/xcmiscstr.h0100664000076400007640000000635007120677563021441 0ustar constconst/* $XConsortium: xcmiscstr.h,v 1.4 94/04/17 20:11:28 dpw Exp $ */ /* Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define X_XCMiscGetVersion 0 #define X_XCMiscGetXIDRange 1 #define X_XCMiscGetXIDList 2 #define XCMiscNumberEvents 0 #define XCMiscNumberErrors 0 #define XCMiscMajorVersion 1 #define XCMiscMinorVersion 1 #define XCMiscExtensionName "XC-MISC" typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetVersion */ CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xXCMiscGetVersionReq; #define sz_xXCMiscGetVersionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetVersionReply; #define sz_xXCMiscGetVersionReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDRange */ CARD16 length B16; } xXCMiscGetXIDRangeReq; #define sz_xXCMiscGetXIDRangeReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 start_id B32; CARD32 count B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xXCMiscGetXIDRangeReply; #define sz_xXCMiscGetXIDRangeReply 32 typedef struct { CARD8 reqType; /* always XCMiscCode */ CARD8 miscReqType; /* always X_XCMiscGetXIDList */ CARD16 length B16; CARD32 count B32; /* number of IDs requested */ } xXCMiscGetXIDListReq; #define sz_xXCMiscGetXIDListReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 count B32; /* number of IDs requested */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXCMiscGetXIDListReply; #define sz_xXCMiscGetXIDListReply 32 vnc_unixsrc/Xvnc/include/extensions/XKBsrv.h0100664000076400007640000007012107120677563020576 0ustar constconst/* $XConsortium: XKBsrv.h /main/25 1996/09/28 16:32:19 rws $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBSRV_H_ #define _XKBSRV_H_ #ifdef XKB_IN_SERVER #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey #define XkbAddKeyType SrvXkbAddKeyType #define XkbCopyKeyType SrvXkbCopyKeyType #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap #define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey #define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType #define XkbAllocCompatMap SrvXkbAllocCompatMap #define XkbAllocControls SrvXkbAllocControls #define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap #define XkbFreeControls SrvXkbFreeControls #define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames #define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo #define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo #define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo #define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges #define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods #define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods #endif #include #include typedef struct _XkbInterest { DeviceIntPtr dev; ClientPtr client; XID resource; struct _XkbInterest * next; CARD16 extDevNotifyMask; CARD16 stateNotifyMask; CARD16 namesNotifyMask; CARD32 ctrlsNotifyMask; CARD8 compatNotifyMask; BOOL bellNotifyMask; BOOL actionMessageMask; CARD16 accessXNotifyMask; CARD32 iStateNotifyMask; CARD32 iMapNotifyMask; CARD16 altSymsNotifyMask; CARD32 autoCtrls; CARD32 autoCtrlValues; } XkbInterestRec,*XkbInterestPtr; typedef struct _XkbRadioGroup { CARD8 flags; CARD8 nMembers; CARD8 dfltDown; CARD8 currentDown; CARD8 members[XkbRGMaxMembers]; } XkbRadioGroupRec, *XkbRadioGroupPtr; typedef struct _XkbEventCause { CARD8 kc; CARD8 event; CARD8 mjr; CARD8 mnr; ClientPtr client; } XkbEventCauseRec,*XkbEventCausePtr; #define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ (c)->mjr= (c)->mnr= 0; \ (c)->client= NULL; } #define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ (c)->mjr= (j),(c)->mnr= (n);\ (c)->client= (cl); } #define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) #define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) #define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) #define _OFF_TIMER 0 #define _KRG_WARN_TIMER 1 #define _KRG_TIMER 2 #define _SK_TIMEOUT_TIMER 3 #define _ALL_TIMEOUT_TIMER 4 #define _BEEP_NONE 0 #define _BEEP_FEATURE_ON 1 #define _BEEP_FEATURE_OFF 2 #define _BEEP_FEATURE_CHANGE 3 #define _BEEP_SLOW_WARN 4 #define _BEEP_SLOW_PRESS 5 #define _BEEP_SLOW_ACCEPT 6 #define _BEEP_SLOW_REJECT 7 #define _BEEP_SLOW_RELEASE 8 #define _BEEP_STICKY_LATCH 9 #define _BEEP_STICKY_LOCK 10 #define _BEEP_STICKY_UNLOCK 11 #define _BEEP_LED_ON 12 #define _BEEP_LED_OFF 13 #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 typedef struct _XkbSrvInfo { XkbStateRec prev_state; XkbStateRec state; XkbDescPtr desc; DeviceIntPtr device; KbdCtrlProcPtr kbdProc; XkbRadioGroupPtr radioGroups; CARD8 nRadioGroups; CARD8 clearMods; CARD8 setMods; INT16 groupChange; CARD16 dfltPtrDelta; double mouseKeysCurve; double mouseKeysCurveFactor; INT16 mouseKeysDX; INT16 mouseKeysDY; CARD8 mouseKeysFlags; Bool mouseKeysAccel; CARD8 mouseKeysCounter; CARD8 lockedPtrButtons; CARD8 shiftKeyCount; KeyCode mouseKey; KeyCode inactiveKey; KeyCode slowKey; KeyCode repeatKey; CARD8 krgTimerActive; CARD8 beepType; CARD8 beepCount; CARD32 flags; CARD32 lastPtrEventTime; CARD32 lastShiftEventTime; OsTimerPtr beepTimer; OsTimerPtr mouseKeyTimer; OsTimerPtr slowKeysTimer; OsTimerPtr bounceKeysTimer; OsTimerPtr repeatKeyTimer; OsTimerPtr krgTimer; } XkbSrvInfoRec, *XkbSrvInfoPtr; #define XkbSLI_IsDefault (1L<<0) #define XkbSLI_HasOwnState (1L<<1) typedef struct _XkbSrvLedInfo { CARD16 flags; CARD16 class; CARD16 id; union { KbdFeedbackPtr kf; LedFeedbackPtr lf; } fb; CARD32 physIndicators; CARD32 autoState; CARD32 explicitState; CARD32 effectiveState; CARD32 mapsPresent; CARD32 namesPresent; XkbIndicatorMapPtr maps; Atom * names; CARD32 usesBase; CARD32 usesLatched; CARD32 usesLocked; CARD32 usesEffective; CARD32 usesCompat; CARD32 usesControls; CARD32 usedComponents; } XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; /* * Settings for xkbClientFlags field (used by DIX) * These flags _must_ not overlap with XkbPCF_* */ #define _XkbClientInitialized (1<<15) #define _XkbWantsDetectableAutoRepeat(c)\ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) /* * Settings for flags field */ #define _XkbStateNotifyInProgress (1<<0) /***====================================================================***/ #define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) #define XkbAllFilteredEventsMask \ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbAX_KRGMask) /***====================================================================***/ extern int XkbReqCode; extern int XkbEventBase; extern int XkbKeyboardErrorCode; extern int XkbDisableLockActions; extern char * XkbBaseDirectory; extern char * XkbInitialMap; extern int _XkbClientMajor; extern int _XkbClientMinor; extern unsigned int XkbXIUnsupported; extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; extern Bool noXkbExtension; extern Bool XkbWantRulesProp; extern pointer XkbLastRepeatEvent; extern CARD32 xkbDebugFlags; extern CARD32 xkbDebugCtrls; #define _XkbAlloc(s) xalloc((s)) #define _XkbCalloc(n,s) Xcalloc((n)*(s)) #define _XkbRealloc(o,s) Xrealloc((o),(s)) #define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) #define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) #define _XkbTypedRealloc(o,n,t) \ ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) Xfree(p) #define _XkbLibError(c,l,d) \ { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) extern int DeviceKeyPress,DeviceKeyRelease; extern int DeviceButtonPress,DeviceButtonRelease; #ifdef XINPUT #define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) #define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) #else #define _XkbIsPressEvent(t) ((t)==KeyPress) #define _XkbIsReleaseEvent(t) ((t)==KeyRelease) #endif #define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ ((k)<=(c)->curKeySyms.maxKeyCode)) #define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ (c)->curKeySyms.minKeyCode+1) #define XConvertCase(s,l,u) XkbConvertCase(s,l,u) #define IsKeypadKey(s) XkbKSIsKeypad(s) #define Status int #define XPointer pointer #define Display struct _XDisplay #ifndef True #define True 1 #define False 0 #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif _XFUNCPROTOBEGIN extern void XkbFreeCompatMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ #endif ); extern void XkbFreeNames( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeMap */ #endif ); extern DeviceIntPtr _XkbLookupAnyDevice( #if NeedFunctionPrototypes int /* id */, int * /* why_rtrn */ #endif ); extern DeviceIntPtr _XkbLookupKeyboard( #if NeedFunctionPrototypes int /* id */, int * /* why_rtrn */ #endif ); extern DeviceIntPtr _XkbLookupBellDevice( #if NeedFunctionPrototypes int /* id */, int * /* why_rtrn */ #endif ); extern DeviceIntPtr _XkbLookupLedDevice( #if NeedFunctionPrototypes int /* id */, int * /* why_rtrn */ #endif ); extern DeviceIntPtr _XkbLookupButtonDevice( #if NeedFunctionPrototypes int /* id */, int * /* why_rtrn */ #endif ); extern XkbDescPtr XkbAllocKeyboard( #if NeedFunctionPrototypes void #endif ); extern Status XkbAllocClientMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nTypes */ #endif ); extern Status XkbAllocServerMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nNewActions */ #endif ); extern void XkbFreeClientMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ #endif ); extern void XkbFreeServerMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* what */, Bool /* freeMap */ #endif ); extern Status XkbAllocIndicatorMaps( #if NeedFunctionPrototypes XkbDescPtr /* xkb */ #endif ); extern Status XkbAllocCompatMap( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, unsigned int /* nInterpret */ #endif ); extern Status XkbAllocNames( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, int /* nTotalRG */, int /* nTotalAliases */ #endif ); extern Status XkbAllocControls( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which*/ #endif ); extern Status XkbCopyKeyType( #if NeedFunctionPrototypes XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */ #endif ); extern Status XkbCopyKeyTypes( #if NeedFunctionPrototypes XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, int /* num_types */ #endif ); extern Status XkbResizeKeyType( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, int /* type_ndx */, int /* map_count */, Bool /* want_preserve */, int /* new_num_lvls */ #endif ); extern void XkbFreeKeyboard( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* which */, Bool /* freeDesc */ #endif ); extern void XkbSetActionKeyMods( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* mods */ #endif ); extern Bool XkbCheckActionVMods( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, XkbAction * /* act */, unsigned int /* changed */ #endif ); extern Bool XkbApplyVModChanges( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */, unsigned int /* changed */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ #endif ); extern void XkbApplyVModChangesToAllDevices( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbDescPtr /* xkb */, unsigned int /* changed */, XkbEventCausePtr /* cause */ #endif ); extern unsigned int XkbMaskForVMask( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* vmask */ #endif ); extern Bool XkbVirtualModsToReal( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, unsigned int /* virtua_mask */, unsigned int * /* mask_rtrn */ #endif ); extern unsigned int XkbAdjustGroup( #if NeedFunctionPrototypes int /* group */, XkbControlsPtr /* ctrls */ #endif ); extern KeySym *XkbResizeKeySyms( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, int /* key */, int /* needed */ #endif ); extern XkbAction *XkbResizeKeyActions( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, int /* key */, int /* needed */ #endif ); extern void XkbUpdateKeyTypesFromCore( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */ #endif ); extern void XkbUpdateDescActions( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* changes */ #endif ); extern void XkbUpdateActions( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, KeyCode /* first */, CARD8 /* num */, XkbChangesPtr /* pChanges */, unsigned int * /* needChecksRtrn */, XkbEventCausePtr /* cause */ #endif ); extern void XkbUpdateCoreDescription( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, Bool /* resize */ #endif ); extern void XkbApplyMappingChange( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, CARD8 /* request */, KeyCode /* firstKey */, CARD8 /* num */, ClientPtr /* client */ #endif ); extern void XkbSetIndicators( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, CARD32 /* affect */, CARD32 /* values */, XkbEventCausePtr /* cause */ #endif ); extern void XkbUpdateIndicators( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, CARD32 /* changed */, Bool /* check_edevs */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ #endif ); extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, KbdFeedbackPtr /* kf */, LedFeedbackPtr /* lf */, unsigned int /* needed_parts */ #endif ); extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, unsigned int /* class */, unsigned int /* id */, unsigned int /* needed_parts */ #endif ); extern void XkbApplyLedNameChanges( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_names */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbApplyLedMapChanges( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_maps */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbApplyLedStateChanges( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* changed_leds */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbUpdateLedAutoState( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* maps_to_check */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbFlushLedEvents( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, XkbSrvLedInfoPtr /* sli */, xkbExtensionDeviceNotify * /* ed */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbUpdateAllDeviceIndicators( #if NeedFunctionPrototypes XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern unsigned int XkbIndicatorsToUpdate( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, unsigned long /* state_changes */, Bool /* enabled_ctrl_changes */ #endif ); extern void XkbComputeDerivedState( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */ #endif ); extern void XkbCheckSecondaryEffects( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */, unsigned int /* which */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void XkbCheckIndicatorMaps( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, unsigned int /* which */ #endif ); extern unsigned int XkbStateChangedFlags( #if NeedFunctionPrototypes XkbStatePtr /* old */, XkbStatePtr /* new */ #endif ); extern void XkbSendStateNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbStateNotify * /* pSN */ #endif ); extern void XkbSendMapNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbMapNotify * /* ev */ #endif ); extern int XkbComputeControlsNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, XkbControlsPtr /* old */, XkbControlsPtr /* new */, xkbControlsNotify * /* pCN */, Bool /* forceCtrlProc */ #endif ); extern void XkbSendControlsNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbControlsNotify * /* ev */ #endif ); extern void XkbSendCompatMapNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ #endif ); extern void XkbSendIndicatorNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, int /* xkbType */, xkbIndicatorNotify * /* ev */ #endif ); extern void XkbHandleBell( #if NeedFunctionPrototypes BOOL /* force */, BOOL /* eventOnly */, DeviceIntPtr /* kbd */, CARD8 /* percent */, pointer /* ctrl */, CARD8 /* class */, Atom /* name */, WindowPtr /* pWin */, ClientPtr /* pClient */ #endif ); extern void XkbSendAccessXNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbAccessXNotify * /* pEv */ #endif ); extern void XkbSendNamesNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbNamesNotify * /* ev */ #endif ); extern void XkbSendCompatNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbCompatMapNotify * /* ev */ #endif ); extern void XkbSendActionMessage( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, xkbActionMessage * /* ev */ #endif ); extern void XkbSendExtensionDeviceNotify( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, ClientPtr /* client */, xkbExtensionDeviceNotify * /* ev */ #endif ); extern void XkbSendNotification( #if NeedFunctionPrototypes DeviceIntPtr /* kbd */, XkbChangesPtr /* pChanges */, XkbEventCausePtr /* cause */ #endif ); extern void XkbProcessKeyboardEvent( #if NeedFunctionPrototypes struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ #endif ); extern void XkbProcessOtherEvent( #if NeedFunctionPrototypes struct _xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ #endif ); extern void XkbHandleActions( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, struct _xEvent * /* xE */, int /* count */ #endif ); extern Bool XkbEnableDisableControls( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */, unsigned long /* change */, unsigned long /* newValues */, XkbChangesPtr /* changes */, XkbEventCausePtr /* cause */ #endif ); extern void AccessXInit( #if NeedFunctionPrototypes DeviceIntPtr /* dev */ #endif ); extern Bool AccessXFilterPressEvent( #if NeedFunctionPrototypes register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ #endif ); extern Bool AccessXFilterReleaseEvent( #if NeedFunctionPrototypes register struct _xEvent * /* xE */, register DeviceIntPtr /* keybd */, int /* count */ #endif ); extern void AccessXCancelRepeatKey( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */, KeyCode /* key */ #endif ); extern void AccessXComputeCurveFactor( #if NeedFunctionPrototypes XkbSrvInfoPtr /* xkbi */, XkbControlsPtr /* ctrls */ #endif ); extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( #if NeedFunctionPrototypes XkbDeviceInfoPtr /* devi */, unsigned int /* ledClass */, unsigned int /* ledId */ #endif ); extern XkbDeviceInfoPtr XkbAllocDeviceInfo( #if NeedFunctionPrototypes unsigned int /* deviceSpec */, unsigned int /* nButtons */, unsigned int /* szLeds */ #endif ); extern void XkbFreeDeviceInfo( #if NeedFunctionPrototypes XkbDeviceInfoPtr /* devi */, unsigned int /* which */, Bool /* freeDevI */ #endif ); extern Status XkbResizeDeviceButtonActions( #if NeedFunctionPrototypes XkbDeviceInfoPtr /* devi */, unsigned int /* newTotal */ #endif ); extern XkbInterestPtr XkbFindClientResource( #if NeedFunctionPrototypes DevicePtr /* inDev */, ClientPtr /* client */ #endif ); extern XkbInterestPtr XkbAddClientResource( #if NeedFunctionPrototypes DevicePtr /* inDev */, ClientPtr /* client */, XID /* id */ #endif ); extern int XkbRemoveClient( #if NeedFunctionPrototypes DevicePtr /* inDev */, ClientPtr /* client */ #endif ); extern int XkbRemoveResourceClient( #if NeedFunctionPrototypes DevicePtr /* inDev */, XID /* id */ #endif ); extern int XkbDDXInitDevice( #if NeedFunctionPrototypes DeviceIntPtr /* dev */ #endif ); extern int XkbDDXAccessXBeep( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, unsigned int /* what */, unsigned int /* which */ #endif ); extern void XkbDDXKeyClick( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, int /* keycode */, int /* synthetic */ #endif ); extern int XkbDDXUsesSoftRepeat( #if NeedFunctionPrototypes DeviceIntPtr /* dev */ #endif ); extern void XkbDDXKeybdCtrlProc( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, KeybdCtrl * /* ctrl */ #endif ); extern void XkbDDXChangeControls( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbControlsPtr /* old */, XkbControlsPtr /* new */ #endif ); extern void XkbDDXUpdateIndicators( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, CARD32 /* newState */ #endif ); extern void XkbDDXUpdateDeviceIndicators( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, CARD32 /* newState */ #endif ); extern void XkbDDXFakePointerButton( #if NeedFunctionPrototypes int /* event */, int /* button */ #endif ); extern void XkbDDXFakePointerMotion( #if NeedFunctionPrototypes unsigned int /* flags */, int /* x */, int /* y */ #endif ); extern void XkbDDXFakeDeviceButton( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, Bool /* press */, int /* button */ #endif ); extern int XkbDDXTerminateServer( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ #endif ); extern int XkbDDXSwitchScreen( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, KeyCode /* key */, XkbAction * /* act */ #endif ); extern void XkbDisableComputedAutoRepeats( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, unsigned int /* key */ #endif ); extern void XkbSetRepeatKeys( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, int /* key */, int /* onoff */ #endif ); extern int XkbLatchModifiers( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, CARD8 /* mask */, CARD8 /* latches */ #endif ); extern int XkbLatchGroup( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, int /* group */ #endif ); extern void XkbClearAllLatchesAndLocks( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvInfoPtr /* xkbi */, Bool /* genEv */, XkbEventCausePtr /* cause */ #endif ); extern void XkbSetRulesDflts( #if NeedFunctionPrototypes char * /* rulesFile */, char * /* model */, char * /* layout */, char * /* variant */, char * /* options */ #endif ); extern void XkbInitDevice( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */ #endif ); extern Bool XkbInitKeyboardDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */, XkbComponentNamesPtr /* pNames */, KeySymsPtr /* pSyms */, CARD8 /* pMods */[], BellProcPtr /* bellProc */, KbdCtrlProcPtr /* ctrlProc */ #endif ); extern void XkbInitDevice( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */ #endif ); extern int SProcXkbDispatch( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern XkbGeometryPtr XkbLookupNamedGeometry( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, Atom /* name */, Bool * /* shouldFree */ #endif ); extern char * _XkbDupString( #if NeedFunctionPrototypes char * /* str */ #endif ); extern void XkbConvertCase( #if NeedFunctionPrototypes KeySym /* sym */, KeySym * /* lower */, KeySym * /* upper */ #endif ); extern Status XkbChangeKeycodeRange( #if NeedFunctionPrototypes XkbDescPtr /* xkb */, int /* minKC */, int /* maxKC */, XkbChangesPtr /* changes */ #endif ); #ifdef XKBSRV_NEED_FILE_FUNCS #include "extensions/XKMformat.h" #include "extensions/XKBfile.h" #include "extensions/XKBrules.h" #define _XkbListKeymaps 0 #define _XkbListKeycodes 1 #define _XkbListTypes 2 #define _XkbListCompat 3 #define _XkbListSymbols 4 #define _XkbListGeometry 5 #define _XkbListNumComponents 6 typedef struct _XkbSrvListInfo { int szPool; int nPool; char * pool; int maxRtrn; int nTotal; char * pattern[_XkbListNumComponents]; int nFound[_XkbListNumComponents]; } XkbSrvListInfoRec,*XkbSrvListInfoPtr; char * XkbGetRulesDflts( #if NeedFunctionPrototypes XkbRF_VarDefsPtr /* defs */ #endif ); extern void XkbSetRulesUsed( #if NeedFunctionPrototypes XkbRF_VarDefsPtr /* defs */ #endif ); extern Status XkbDDXList( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, XkbSrvListInfoPtr /* listing */, ClientPtr /* client */ #endif ); extern unsigned int XkbDDXLoadKeymapByNames( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, XkbFileInfoPtr /* finfoRtrn */, char * /* keymapNameRtrn */, int /* keymapNameRtrnLen */ #endif ); extern Bool XkbDDXNamesFromRules( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, char * /* rules */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */ #endif ); extern FILE *XkbDDXOpenConfigFile( #if NeedFunctionPrototypes char * /* mapName */, char * /* fileNameRtrn */, int /* fileNameRtrnLen */ #endif ); extern Bool XkbDDXApplyConfig( #if NeedFunctionPrototypes XPointer /* cfg_in */, XkbSrvInfoPtr /* xkbi */ #endif ); extern XPointer XkbDDXPreloadConfig( #if NeedFunctionPrototypes char ** /* rulesFileRtrn */, XkbRF_VarDefsPtr /* defs */, XkbComponentNamesPtr /* names */, DeviceIntPtr /* dev */ #endif ); extern int XkbDDXUsesSoftRepeat( #if NeedFunctionPrototypes DeviceIntPtr /* pXDev */ #endif ); extern void XkbDDXFakePointerMotion( #if NeedFunctionPrototypes unsigned int /* flags */, int /* x */, int /* y */ #endif ); extern int _XkbStrCaseCmp( #if NeedFunctionPrototypes char * /* str1 */, char * /* str2 */ #endif ); #endif /* XKBSRV_NEED_FILE_FUNCS */ _XFUNCPROTOEND #define XkbAtomGetString(d,s) NameForAtom(s) #endif /* _XKBSRV_H_ */ vnc_unixsrc/Xvnc/include/extensions/XShm.h0100664000076400007640000001063507120677563020302 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD */ /* $XConsortium: XShm.h,v 1.7 94/09/22 21:25:20 dpw Exp $ */ /* $XFree86: xc/include/extensions/XShm.h,v 1.2.2.1 1997/08/04 02:10:32 dawes Exp $ */ #ifndef _XSHM_H_ #define _XSHM_H_ #include #define X_ShmQueryVersion 0 #define X_ShmAttach 1 #define X_ShmDetach 2 #define X_ShmPutImage 3 #define X_ShmGetImage 4 #define X_ShmCreatePixmap 5 #define ShmCompletion 0 #define ShmNumberEvents (ShmCompletion + 1) #define BadShmSeg 0 #define ShmNumberErrors (BadShmSeg + 1) typedef unsigned long ShmSeg; #ifndef _XSHM_SERVER_ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Drawable drawable; /* drawable of request */ int major_code; /* ShmReqCode */ int minor_code; /* X_ShmPutImage */ ShmSeg shmseg; /* the ShmSeg used in the request */ unsigned long offset; /* the offset into ShmSeg used in the request */ } XShmCompletionEvent; typedef struct { ShmSeg shmseg; /* resource id */ int shmid; /* kernel id */ char *shmaddr; /* address in client */ Bool readOnly; /* how the server should attach it */ } XShmSegmentInfo; _XFUNCPROTOBEGIN Bool XShmQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); Bool XShmQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */, Bool* /* sharedPixmaps */ #endif ); int XShmPixmapFormat( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); Status XShmAttach( #if NeedFunctionPrototypes Display* /* dpy */, XShmSegmentInfo* /* shminfo */ #endif ); Status XShmDetach( #if NeedFunctionPrototypes Display* /* dpy */, XShmSegmentInfo* /* shminfo */ #endif ); Status XShmPutImage( #if NeedFunctionPrototypes Display* /* dpy */, Drawable /* d */, GC /* gc */, XImage* /* image */, int /* src_x */, int /* src_y */, int /* dst_x */, int /* dst_y */, unsigned int /* src_width */, unsigned int /* src_height */, Bool /* send_event */ #endif ); Status XShmGetImage( #if NeedFunctionPrototypes Display* /* dpy */, Drawable /* d */, XImage* /* image */, int /* x */, int /* y */, unsigned long /* plane_mask */ #endif ); XImage *XShmCreateImage( #if NeedFunctionPrototypes Display* /* dpy */, Visual* /* visual */, unsigned int /* depth */, int /* format */, char* /* data */, XShmSegmentInfo* /* shminfo */, unsigned int /* width */, unsigned int /* height */ #endif ); Pixmap XShmCreatePixmap( #if NeedFunctionPrototypes Display* /* dpy */, Drawable /* d */, char* /* data */, XShmSegmentInfo* /* shminfo */, unsigned int /* width */, unsigned int /* height */, unsigned int /* depth */ #endif ); _XFUNCPROTOEND #endif #endif vnc_unixsrc/Xvnc/include/extensions/Xag.h0100664000076400007640000000646407120677563020147 0ustar constconst/* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: Xag.h /main/2 1996/11/12 12:18:22 swick $ */ #ifndef _XAG_H_ #define _XAG_H_ #include #define X_XagQueryVersion 0 #define X_XagCreate 1 #define X_XagDestroy 2 #define X_XagGetAttr 3 #define X_XagQuery 4 #define X_XagCreateAssoc 5 #define X_XagDestroyAssoc 6 #define XagBadAppGroup 0 #define XagNumberErrors (XagBadAppGroup + 1) #define XagNsingleScreen 0 #define XagNdefaultRoot 1 #define XagNrootVisual 2 #define XagNdefaultColormap 3 #define XagNblackPixel 4 #define XagNwhitePixel 5 #define XagNappGroupLeader 6 #ifndef _XAG_SERVER_ #if NeedVarargsPrototypes #include #else #include #endif _XFUNCPROTOBEGIN typedef XID XAppGroup; Bool XagQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* major_version */, int* /* minor_version */ #endif ); Status XagCreateEmbeddedApplicationGroup( #if NeedFunctionPrototypes Display* /* dpy */, VisualID /* root_visual */, Colormap /* default_colormap */, unsigned long /* black_pixel */, unsigned long /* white_pixel */, XAppGroup* /* app_group_return */ #endif ); Status XagCreateNonembeddedApplicationGroup( #if NeedFunctionPrototypes Display* /* dpy */, XAppGroup* /* app_group_return */ #endif ); Status XagDestroyApplicationGroup( #if NeedFunctionPrototypes Display* /* dpy */, XAppGroup /* app_group */ #endif ); Status XagGetApplicationGroupAttributes( #if NeedVarargsPrototypes Display* /* dpy */, XAppGroup /* app_group */, ... #endif ); Status XagQueryApplicationGroup( #if NeedFunctionPrototypes Display* /* dpy */, XID /* resource_base */, XAppGroup* /* app_group_ret */ #endif ); Status XagCreateAssociation( #if NeedFunctionPrototypes Display* /* dpy */, Window* /* window_ret */, void* /* system_window */ #endif ); Status XagDestroyAssociation( #if NeedFunctionPrototypes Display* /* dpy */, Window /* window */ #endif ); _XFUNCPROTOEND #endif /* _XAG_SERVER_ */ #endif /* _XAG_H_ */ vnc_unixsrc/Xvnc/include/extensions/XIEprotost.h0100664000076400007640000007007707120677563021511 0ustar constconst/* $XConsortium: XIEprotost.h,v 1.6 94/04/17 20:11:12 mor Exp $ */ /****************************************************************************** Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. NOTICE This software is being provided by AGE Logic, Inc. under the following license. By obtaining, using and/or copying this software, you agree that you have read, understood, and will comply with these terms and conditions: Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee or royalty and to grant others any or all rights granted herein is hereby granted, provided that you agree to comply with the following copyright notice and statements, including the disclaimer, and that the same appears on all copies and derivative works of the software and documentation you make. "Copyright 1993, 1994 by AGE Logic, Inc." THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not limitation, AGE LOGIC MAKE NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. The name of AGE Logic, Inc. may not be used in advertising or publicity pertaining to this software without specific, written prior permission from AGE Logic. Title to this software shall at all times remain with AGE Logic, Inc. ******************************************************************************/ #ifndef _XIEPROTOST_H_ #define _XIEPROTOST_H_ #include /* defines things like CARD32 */ #define Drawable CARD32 #define Colormap CARD32 #define GContext CARD32 typedef CARD32 xieTypFloat; #ifndef WORD64 typedef xieTypFloat xieTypConstant[3]; typedef xieTypFloat xieTypMatrix[9]; #else /* WORD64 */ typedef CARD8 xieTypConstant[12]; typedef CARD8 xieTypMatrix[36]; #endif /* WORD64 */ typedef CARD8 xieTypAlignment; typedef CARD8 xieTypArithmeticOp; typedef CARD16 xieTypColorAllocTechnique; typedef CARD32 xieTypColorList; typedef CARD8 xieTypCompareOp; typedef CARD16 xieTypConstrainTechnique; typedef CARD16 xieTypConvertFromRGBTechnique; typedef CARD16 xieTypConvertToRGBTechnique; typedef CARD16 xieTypConvolveTechnique; typedef CARD8 xieTypDataClass; typedef CARD8 xieTypDataType; typedef CARD16 xieTypDecodeTechnique; typedef CARD16 xieTypDitherTechnique; typedef CARD16 xieTypEncodeTechnique; typedef CARD32 xieTypPhotospace; typedef CARD32 xieTypPhotoflo; typedef struct { union { struct { xieTypPhotospace nameSpace B32; CARD32 floID B32; } immed; struct { CARD32 nameSpace B32; xieTypPhotoflo floID B32; } stored; } u; } xieTypExecutable; typedef CARD8 xieTypExportNotify; typedef CARD8 xieTypExportState; typedef CARD16 xieTypGamutTechnique; typedef CARD16 xieTypGeometryTechnique; typedef struct { CARD32 value B32; CARD32 count B32; } xieTypHistogramData; typedef CARD16 xieTypHistogramShape; typedef CARD8 xieTypInterleave; typedef CARD32 xieTypLevels[3]; typedef CARD32 xieTypLUT; typedef CARD8 xieTypMathOp; typedef CARD8 xieTypOrientation; typedef CARD8 xieTypPhotofloOutcome; typedef CARD8 xieTypPhotofloState; typedef CARD32 xieTypPhotomap; typedef CARD16 xieTypPhototag; typedef struct { INT32 offsetX B32; INT32 offsetY B32; xieTypPhototag domain B16; } xieTypProcessDomain; typedef struct { INT32 x B32; INT32 y B32; CARD32 width B32; CARD32 height B32; } xieTypRectangle; typedef CARD32 xieTypROI; typedef CARD8 xieTypServiceClass; typedef CARD8 xieTypTechniqueGroup; typedef struct { BOOL needsParam; xieTypTechniqueGroup group; CARD16 number B16; CARD8 speed; CARD8 nameLength; CARD16 pad B16; /* LISTofCARD8 (nameLength) */ /* pad (nameLength) */ } xieTypTechniqueRec; typedef struct { xieTypPhototag src B16; CARD16 pad B16; INT32 dstX B32; INT32 dstY B32; } xieTypTile; typedef CARD8 xieTypTripleofCARD8[3]; typedef CARD16 xieTypTripleofCARD16[3]; typedef CARD32 xieTypTripleofCARD32[3]; typedef CARD16 xieTypWhiteAdjustTechnique; /* * Generic Element */ typedef struct { CARD16 elemType B16; CARD16 elemLength B16; } xieFlo; /* * Import Elements */ typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypDataClass class; xieTypOrientation bandOrder; CARD16 pad B16; CARD32 length0 B32; CARD32 length1 B32; CARD32 length2 B32; CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; } xieFloImportClientLUT; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; BOOL notify; xieTypDataClass class; CARD16 pad B16; CARD32 width0 B32; CARD32 width1 B32; CARD32 width2 B32; CARD32 height0 B32; CARD32 height1 B32; CARD32 height2 B32; CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypDecodeTechnique decodeTechnique B16; CARD16 lenParams B16; /* Technique dependent decode params */ } xieFloImportClientPhoto; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; CARD32 rectangles B32; } xieFloImportClientROI; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; Drawable drawable B32; INT16 srcX B16; INT16 srcY B16; CARD16 width B16; CARD16 height B16; CARD32 fill B32; BOOL notify; CARD8 pad[3]; } xieFloImportDrawable; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; Drawable drawable B32; INT16 srcX B16; INT16 srcY B16; CARD16 width B16; CARD16 height B16; CARD32 fill B32; CARD32 bitPlane B32; BOOL notify; CARD8 pad[3]; } xieFloImportDrawablePlane; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypLUT lut B32; } xieFloImportLUT; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhotomap photomap B32; BOOL notify; CARD8 pad[3]; } xieFloImportPhotomap; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypROI roi B32; } xieFloImportROI; /* * Process Elements */ typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src1 B16; xieTypPhototag src2 B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; xieTypArithmeticOp operator; CARD8 bandMask; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; } xieFloArithmetic; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src1 B16; xieTypPhototag src2 B16; xieTypPhototag src3 B16; CARD16 pad B16; } xieFloBandCombine; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; CARD32 levels B32; xieTypFloat bias B32; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; } xieFloBandExtract; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD8 bandNumber; CARD8 pad; } xieFloBandSelect; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src1 B16; xieTypPhototag src2 B16; xieTypPhototag alpha B16; CARD16 pad1 B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD8 bandMask; CARD8 pad2; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; xieTypFloat alphaConst B32; } xieFloBlend; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src1 B16; xieTypPhototag src2 B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; xieTypCompareOp operator; BOOL combine; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; CARD8 bandMask; CARD8 pad[3]; } xieFloCompare; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypConstrainTechnique constrain B16; CARD16 lenParams B16; /* Technique dependent constrain params */ } xieFloConstrain; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypDataClass class; CARD8 precision; Colormap colormap B32; } xieFloConvertFromIndex; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; xieTypConvertFromRGBTechnique convert B16; CARD16 lenParams B16; /* Technique dependent conversion params */ } xieFloConvertFromRGB; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; BOOL notify; CARD8 pad; Colormap colormap B32; xieTypColorList colorList B32; xieTypColorAllocTechnique colorAlloc B16; CARD16 lenParams B16; /* Technique dependent color alloc params */ } xieFloConvertToIndex; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; xieTypConvertToRGBTechnique convert B16; CARD16 lenParams B16; /* Technique dependent conversion params */ } xieFloConvertToRGB; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD8 bandMask; CARD8 kernelSize; xieTypConvolveTechnique convolve B16; CARD16 lenParams B16; /* LISTofFloat (kernelSize^2) */ /* Technique dependent convolve params */ } xieFloConvolve; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD8 bandMask; CARD8 pad; CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypDitherTechnique dither B16; CARD16 lenParams B16; /* Technique dependent dither params */ } xieFloDither; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD8 bandMask; CARD8 pad; CARD32 width B32; CARD32 height B32; xieTypFloat a B32; xieTypFloat b B32; xieTypFloat c B32; xieTypFloat d B32; xieTypFloat tx B32; xieTypFloat ty B32; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; xieTypGeometryTechnique sample B16; CARD16 lenParams B16; /* Technique dependent sample params */ } xieFloGeometry; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src1 B16; xieTypPhototag src2 B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD8 operator; CARD8 bandMask; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; } xieFloLogical; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad1 B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD16 pad2 B16; xieTypHistogramShape shape B16; CARD16 lenParams B16; /* Technique dependent shape params */ } xieFloMatchHistogram; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; xieTypMathOp operator; CARD8 bandMask; } xieFloMath; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; CARD16 numTiles B16; CARD16 pad B16; CARD32 width B32; CARD32 height B32; xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; /* LISTofTile (numTiles) */ } xieFloPasteUp; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypPhototag lut B16; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD8 bandMask; CARD8 pad; } xieFloPoint; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; } xieFloUnconstrain; /* * Export Elements */ typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypExportNotify notify; CARD8 pad1; INT32 domainOffsetX B32; INT32 domainOffsetY B32; xieTypPhototag domainPhototag B16; CARD16 pad2 B16; } xieFloExportClientHistogram; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypExportNotify notify; xieTypOrientation bandOrder; CARD32 start0 B32; CARD32 start1 B32; CARD32 start2 B32; CARD32 length0 B32; CARD32 length1 B32; CARD32 length2 B32; } xieFloExportClientLUT; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypExportNotify notify; CARD8 pad; xieTypEncodeTechnique encodeTechnique B16; CARD16 lenParams B16; /* Technique dependent encode params */ } xieFloExportClientPhoto; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; xieTypExportNotify notify; CARD8 pad; } xieFloExportClientROI; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; INT16 dstX B16; INT16 dstY B16; CARD16 pad B16; Drawable drawable B32; GContext gc B32; } xieFloExportDrawable; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; INT16 dstX B16; INT16 dstY B16; CARD16 pad B16; Drawable drawable B32; GContext gc B32; } xieFloExportDrawablePlane; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD8 merge; CARD8 pad; xieTypLUT lut B32; CARD32 start0 B32; CARD32 start1 B32; CARD32 start2 B32; } xieFloExportLUT; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; xieTypPhotomap photomap B32; xieTypEncodeTechnique encodeTechnique B16; CARD16 lenParams B16; /* Technique dependent encode params */ } xieFloExportPhotomap; typedef struct { CARD16 elemType B16; CARD16 elemLength B16; xieTypPhototag src B16; CARD16 pad B16; xieTypROI roi B32; } xieFloExportROI; /* * Technique Parameters */ typedef struct { xieTypFloat inputLow0 B32; xieTypFloat inputLow1 B32; xieTypFloat inputLow2 B32; xieTypFloat inputHigh0 B32; xieTypFloat inputHigh1 B32; xieTypFloat inputHigh2 B32; CARD32 outputLow0 B32; CARD32 outputLow1 B32; CARD32 outputLow2 B32; CARD32 outputHigh0 B32; CARD32 outputHigh1 B32; CARD32 outputHigh2 B32; } xieTecClipScale; typedef struct { CARD32 fill B32; } xieTecColorAllocAll; typedef struct { xieTypFloat matchLimit B32; xieTypFloat grayLimit B32; } xieTecColorAllocMatch; typedef struct { CARD32 maxCells B32; } xieTecColorAllocRequantize; typedef struct { xieTypFloat matrix00 B32; xieTypFloat matrix01 B32; xieTypFloat matrix02 B32; xieTypFloat matrix10 B32; xieTypFloat matrix11 B32; xieTypFloat matrix12 B32; xieTypFloat matrix20 B32; xieTypFloat matrix21 B32; xieTypFloat matrix22 B32; xieTypWhiteAdjustTechnique whiteAdjusted B16; CARD16 lenParams B16; /* Technique dependent white params */ } xieTecRGBToCIELab, xieTecRGBToCIEXYZ; typedef struct { CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypFloat lumaRed B32; xieTypFloat lumaGreen B32; xieTypFloat lumaBlue B32; xieTypFloat bias0 B32; xieTypFloat bias1 B32; xieTypFloat bias2 B32; } xieTecRGBToYCbCr; typedef struct { CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypFloat lumaRed B32; xieTypFloat lumaGreen B32; xieTypFloat lumaBlue B32; xieTypFloat scale B32; } xieTecRGBToYCC; typedef struct { xieTypFloat matrix00 B32; xieTypFloat matrix01 B32; xieTypFloat matrix02 B32; xieTypFloat matrix10 B32; xieTypFloat matrix11 B32; xieTypFloat matrix12 B32; xieTypFloat matrix20 B32; xieTypFloat matrix21 B32; xieTypFloat matrix22 B32; xieTypWhiteAdjustTechnique whiteAdjusted B16; CARD16 lenWhiteParams B16; xieTypGamutTechnique gamutCompress B16; CARD16 lenGamutParams B16; /* Technique dependent white params */ /* Technique dependent gamut params */ } xieTecCIELabToRGB, xieTecCIEXYZToRGB; typedef struct { CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypFloat lumaRed B32; xieTypFloat lumaGreen B32; xieTypFloat lumaBlue B32; xieTypFloat bias0 B32; xieTypFloat bias1 B32; xieTypFloat bias2 B32; xieTypGamutTechnique gamutCompress B16; CARD16 lenGamutParams B16; /* Technique dependent gamut params */ } xieTecYCbCrToRGB; typedef struct { CARD32 levels0 B32; CARD32 levels1 B32; CARD32 levels2 B32; xieTypFloat lumaRed B32; xieTypFloat lumaGreen B32; xieTypFloat lumaBlue B32; xieTypFloat scale B32; xieTypGamutTechnique gamutCompress B16; CARD16 lenGamutParams B16; /* Technique dependent gamut params */ } xieTecYCCToRGB; typedef struct { xieTypFloat constant0 B32; xieTypFloat constant1 B32; xieTypFloat constant2 B32; } xieTecConvolveConstant; typedef struct { xieTypOrientation fillOrder; xieTypOrientation pixelOrder; CARD8 pixelStride; CARD8 leftPad; CARD8 scanlinePad; CARD8 pad[3]; } xieTecDecodeUncompressedSingle; typedef struct { CARD8 leftPad[3]; xieTypOrientation fillOrder; CARD8 pixelStride[3]; xieTypOrientation pixelOrder; CARD8 scanlinePad[3]; xieTypOrientation bandOrder; xieTypInterleave interleave; CARD8 pad[3]; } xieTecDecodeUncompressedTriple; typedef struct { xieTypOrientation encodedOrder; BOOL normal; BOOL radiometric; CARD8 pad; } xieTecDecodeG31D, xieTecDecodeG32D, xieTecDecodeG42D, xieTecDecodeTIFF2; typedef struct { xieTypOrientation encodedOrder; BOOL normal; CARD16 pad B16; } xieTecDecodeTIFFPackBits; typedef struct { xieTypInterleave interleave; xieTypOrientation bandOrder; BOOL upSample; CARD8 pad; } xieTecDecodeJPEGBaseline; typedef struct { xieTypInterleave interleave; xieTypOrientation bandOrder; CARD16 pad B16; } xieTecDecodeJPEGLossless; typedef struct { CARD8 thresholdOrder; CARD8 pad[3]; } xieTecDitherOrdered; typedef struct { CARD8 preference; CARD8 pad[3]; } xieTecEncodeServerChoice; typedef struct { xieTypOrientation fillOrder; xieTypOrientation pixelOrder; CARD8 pixelStride; CARD8 scanlinePad; } xieTecEncodeUncompressedSingle; typedef struct { CARD8 pixelStride[3]; xieTypOrientation pixelOrder; CARD8 scanlinePad[3]; xieTypOrientation fillOrder; xieTypOrientation bandOrder; xieTypInterleave interleave; CARD16 pad B16; } xieTecEncodeUncompressedTriple; typedef struct { xieTypOrientation encodedOrder; BOOL alignEol; BOOL radiometric; CARD8 pad; } xieTecEncodeG31D; typedef struct { xieTypOrientation encodedOrder; BOOL alignEol; BOOL radiometric; BOOL uncompressed; CARD32 kFactor B32; } xieTecEncodeG32D; typedef struct { xieTypOrientation encodedOrder; BOOL radiometric; BOOL uncompressed; CARD8 pad; } xieTecEncodeG42D; typedef struct { xieTypInterleave interleave; xieTypOrientation bandOrder; CARD8 horizontalSamples[3]; CARD8 verticalSamples[3]; CARD16 lenQtable B16; /* multiple of 4 */ CARD16 lenACtable B16; /* multiple of 4 */ CARD16 lenDCtable B16; /* multiple of 4 */ CARD16 pad B16; /* LISTofCARD8 (Qtable) */ /* LISTofCARD8 (ACtable) */ /* LISTofCARD8 (DCtable) */ } xieTecEncodeJPEGBaseline; typedef struct { xieTypInterleave interleave; xieTypOrientation bandOrder; CARD16 lenTable B16; /* multiple of 4 */ CARD8 predictor[3]; CARD8 pad; /* LISTofCARD8 (table) */ } xieTecEncodeJPEGLossless; typedef struct { xieTypOrientation encodedOrder; BOOL radiometric; CARD16 pad B16; } xieTecEncodeTIFF2; typedef struct { xieTypOrientation encodedOrder; CARD8 pad[3]; } xieTecEncodeTIFFPackBits; typedef struct { INT16 simple B16; CARD16 pad B16; } xieTecGeomAntialiasByArea; typedef struct { INT16 kernelSize B16; CARD16 pad B16; } xieTecGeomAntialiasByLowpass; typedef struct { CARD8 radius; BOOL simple; CARD16 pad B16; xieTypFloat sigma B32; xieTypFloat normalize B32; } xieTecGeomGaussian; typedef struct { CARD8 modify; CARD8 pad[3]; } xieTecGeomNearestNeighbor; typedef struct { xieTypFloat mean B32; xieTypFloat sigma B32; } xieTecHistogramGaussian; typedef struct { BOOL shapeFactor; CARD8 pad[3]; xieTypFloat constant B32; } xieTecHistogramHyperbolic; typedef struct { xieTypFloat whitePoint0 B32; xieTypFloat whitePoint1 B32; xieTypFloat whitePoint2 B32; } xieTecWhiteAdjustCIELabShift; /* * SIZEOF values */ #define sz_xieTypAlignment 1 #define sz_xieTypArithmeticOp 1 #define sz_xieTypColorAllocTechnique 2 #define sz_xieTypColorList 4 #define sz_xieTypCompareOp 1 #define sz_xieTypConstant 12 #define sz_xieTypConstrainTechnique 2 #define sz_xieTypConvertFromRGBTechnique 2 #define sz_xieTypConvertToRGBTechnique 2 #define sz_xieTypConvolveTechnique 2 #define sz_xieTypDataClass 1 #define sz_xieTypDataType 1 #define sz_xieTypDecodeTechnique 2 #define sz_xieTypDitherTechnique 2 #define sz_xieTypEncodeTechnique 2 #define sz_xieTypPhotospace 4 #define sz_xieTypPhotoflo 4 #define sz_xieTypExecutable 8 #define sz_xieTypExportNotify 1 #define sz_xieTypExportState 1 #define sz_xieTypFloat 4 #define sz_xieTypGamutTechnique 2 #define sz_xieTypGeometryTechnique 2 #define sz_xieTypHistogramData 8 #define sz_xieTypHistogramShape 2 #define sz_xieTypInterleave 1 #define sz_xieTypLevels 12 #define sz_xieTypLUT 4 #define sz_xieTypMathOp 1 #define sz_xieTypMatrix 36 #define sz_xieTypOrientation 1 #define sz_xieTypPhotofloOutcome 1 #define sz_xieTypPhotofloState 1 #define sz_xieTypPhotomap 4 #define sz_xieTypPhototag 2 #define sz_xieTypProcessDomain 12 #define sz_xieTypRectangle 16 #define sz_xieTypROI 4 #define sz_xieTypServiceClass 1 #define sz_xieTypTechniqueGroup 1 #define sz_xieTypTechniqueRec 8 #define sz_xieTypTile 12 #define sz_xieTypTripleofCARD8 3 #define sz_xieTypTripleofCARD16 6 #define sz_xieTypTripleofCARD32 12 #define sz_xieTypWhiteAdjustTechnique 2 #define sz_xieFloImportClientLUT 32 #define sz_xieFloImportClientPhoto 48 #define sz_xieFloImportClientROI 8 #define sz_xieFloImportDrawable 24 #define sz_xieFloImportDrawablePlane 28 #define sz_xieFloImportLUT 8 #define sz_xieFloImportPhotomap 12 #define sz_xieFloImportROI 8 #define sz_xieFloArithmetic 32 #define sz_xieFloBandCombine 12 #define sz_xieFloBandExtract 28 #define sz_xieFloBandSelect 8 #define sz_xieFloBlend 40 #define sz_xieFloCompare 36 #define sz_xieFloConstrain 24 #define sz_xieFloConvertFromIndex 12 #define sz_xieFloConvertFromRGB 12 #define sz_xieFloConvertToIndex 20 #define sz_xieFloConvertToRGB 12 #define sz_xieFloConvolve 24 #define sz_xieFloDither 24 #define sz_xieFloGeometry 56 #define sz_xieFloLogical 32 #define sz_xieFloMatchHistogram 24 #define sz_xieFloMath 20 #define sz_xieFloPasteUp 28 #define sz_xieFloPoint 20 #define sz_xieFloUnconstrain 8 #define sz_xieFloExportClientHistogram 20 #define sz_xieFloExportClientLUT 32 #define sz_xieFloExportClientPhoto 12 #define sz_xieFloExportClientROI 8 #define sz_xieFloExportDrawable 20 #define sz_xieFloExportDrawablePlane 20 #define sz_xieFloExportLUT 24 #define sz_xieFloExportPhotomap 16 #define sz_xieFloExportROI 12 #define sz_xieTecColorAllocAll 4 #define sz_xieTecColorAllocMatch 8 #define sz_xieTecColorAllocRequantize 4 #define sz_xieTecClipScale 48 #define sz_xieTecHardClip 0 #define sz_xieTecRGBToCIELab 40 #define sz_xieTecRGBToCIEXYZ 40 #define sz_xieTecRGBToYCbCr 36 #define sz_xieTecRGBToYCC 28 #define sz_xieTecYCbCrToRGB 40 #define sz_xieTecYCCToRGB 32 #define sz_xieTecCIELabToRGB 44 #define sz_xieTecCIEXYZToRGB 44 #define sz_xieTecConvolveConstant 12 #define sz_xieTecConvolveReplicate 0 #define sz_xieTecDecodeUncompressedSingle 8 #define sz_xieTecDecodeUncompressedTriple 16 #define sz_xieTecDecodeG31D 4 #define sz_xieTecDecodeG32D 4 #define sz_xieTecDecodeG42D 4 #define sz_xieTecDecodeTIFF2 4 #define sz_xieTecDecodeTIFFPackBits 4 #define sz_xieTecDecodeJPEGBaseline 4 #define sz_xieTecDecodeJPEGLossless 4 #define sz_xieTecDitherOrdered 4 #define sz_xieTecDitherErrorDiffusion 4 #define sz_xieTecEncodeServerChoice 4 #define sz_xieTecEncodeUncompressedSingle 4 #define sz_xieTecEncodeUncompressedTriple 12 #define sz_xieTecEncodeG31D 4 #define sz_xieTecEncodeG32D 8 #define sz_xieTecEncodeG42D 4 #define sz_xieTecEncodeJPEGBaseline 16 #define sz_xieTecEncodeJPEGLossless 8 #define sz_xieTecEncodeTIFF2 4 #define sz_xieTecEncodeTIFFPackBits 4 #define sz_xieTecGamutNone 0 #define sz_xieTecGamutClipRGB 0 #define sz_xieTecGeomAntialias 0 #define sz_xieTecGeomAntialiasByArea 4 #define sz_xieTecGeomAntialiasByLowpass 4 #define sz_xieTecGeomBilinearInterpolation 0 #define sz_xieTecGeomGaussian 12 #define sz_xieTecGeomNearestNeighbor 4 #define sz_xieTecHistogramFlat 0 #define sz_xieTecHistogramGaussian 8 #define sz_xieTecHistogramHyperbolic 8 #define sz_xieTecWhiteAdjustNone 0 #define sz_xieTecWhiteAdjustCIELabShift 12 #undef Drawable #undef Colormap #undef GContext #endif /* _XIEPROTOST_H_ */ vnc_unixsrc/Xvnc/include/extensions/Xdbe.h0100664000076400007640000001007007120677563020276 0ustar constconst/* $XConsortium: Xdbe.h /main/3 1995/09/22 10:20:01 dpw $ */ /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for Xlib-related DBE * *****************************************************************************/ #ifndef XDBE_H #define XDBE_H /* INCLUDES */ #include #include "Xdbeproto.h" /* DEFINES */ /* Errors */ #define XdbeBadBuffer 0 /* TYPEDEFS */ typedef Drawable XdbeBackBuffer; typedef unsigned char XdbeSwapAction; typedef struct { Window swap_window; /* window for which to swap buffers */ XdbeSwapAction swap_action; /* swap action to use for swap_window */ } XdbeSwapInfo; typedef struct { Window window; /* window that buffer belongs to */ } XdbeBackBufferAttributes; typedef struct { int type; Display *display; /* display the event was read from */ XdbeBackBuffer buffer; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error base + XdbeBadBuffer */ unsigned char request_code; /* major opcode of failed request */ unsigned char minor_code; /* minor opcode of failed request */ } XdbeBufferError; /* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops * (for non-C++ builds) in X11/Xfuncproto.h. */ _XFUNCPROTOBEGIN extern Status XdbeQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* major_version_return */, int* /* minor_version_return */ #endif ); extern XdbeBackBuffer XdbeAllocateBackBufferName( #if NeedFunctionPrototypes Display* /* dpy */, Window /* window */, XdbeSwapAction /* swap_action */ #endif ); extern Status XdbeDeallocateBackBufferName( #if NeedFunctionPrototypes Display* /* dpy */, XdbeBackBuffer /* buffer */ #endif ); extern Status XdbeSwapBuffers( #if NeedFunctionPrototypes Display* /* dpy */, XdbeSwapInfo* /* swap_info */, int /* num_windows */ #endif ); extern Status XdbeBeginIdiom( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); extern Status XdbeEndIdiom( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); extern XdbeScreenVisualInfo *XdbeGetVisualInfo( #if NeedFunctionPrototypes Display* /* dpy */, Drawable* /* screen_specifiers */, int* /* num_screens */ #endif ); extern void XdbeFreeVisualInfo( #if NeedFunctionPrototypes XdbeScreenVisualInfo* /* visual_info */ #endif ); extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( #if NeedFunctionPrototypes Display* /* dpy */, XdbeBackBuffer /* buffer */ #endif ); _XFUNCPROTOEND #endif /* XDBE_H */ vnc_unixsrc/Xvnc/include/extensions/XKB.h0100664000076400007640000006673307120677563020061 0ustar constconst/* $XConsortium: XKB.h /main/14 1996/02/05 10:19:11 kaleb $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKB_H_ #define _XKB_H_ /* * XKB request codes, used in: * - xkbReqType field of all requests * - requestMinor field of some events */ #define X_kbUseExtension 0 #define X_kbSelectEvents 1 #define X_kbBell 3 #define X_kbGetState 4 #define X_kbLatchLockState 5 #define X_kbGetControls 6 #define X_kbSetControls 7 #define X_kbGetMap 8 #define X_kbSetMap 9 #define X_kbGetCompatMap 10 #define X_kbSetCompatMap 11 #define X_kbGetIndicatorState 12 #define X_kbGetIndicatorMap 13 #define X_kbSetIndicatorMap 14 #define X_kbGetNamedIndicator 15 #define X_kbSetNamedIndicator 16 #define X_kbGetNames 17 #define X_kbSetNames 18 #define X_kbGetGeometry 19 #define X_kbSetGeometry 20 #define X_kbPerClientFlags 21 #define X_kbListComponents 22 #define X_kbGetKbdByName 23 #define X_kbGetDeviceInfo 24 #define X_kbSetDeviceInfo 25 #define X_kbSetDebuggingFlags 101 /* * In the X sense, XKB reports only one event. * The type field of all XKB events is XkbEventCode */ #define XkbEventCode 0 #define XkbNumberEvents (XkbEventCode+1) /* * XKB has a minor event code so it can use one X event code for * multiple purposes. * - reported in the xkbType field of all XKB events. * - XkbSelectEventDetails: Indicates the event for which event details * are being changed */ #define XkbNewKeyboardNotify 0 #define XkbMapNotify 1 #define XkbStateNotify 2 #define XkbControlsNotify 3 #define XkbIndicatorStateNotify 4 #define XkbIndicatorMapNotify 5 #define XkbNamesNotify 6 #define XkbCompatMapNotify 7 #define XkbBellNotify 8 #define XkbActionMessage 9 #define XkbAccessXNotify 10 #define XkbExtensionDeviceNotify 11 /* * Event Mask: * - XkbSelectEvents: Specifies event interest. */ #define XkbNewKeyboardNotifyMask (1L << 0) #define XkbMapNotifyMask (1L << 1) #define XkbStateNotifyMask (1L << 2) #define XkbControlsNotifyMask (1L << 3) #define XkbIndicatorStateNotifyMask (1L << 4) #define XkbIndicatorMapNotifyMask (1L << 5) #define XkbNamesNotifyMask (1L << 6) #define XkbCompatMapNotifyMask (1L << 7) #define XkbBellNotifyMask (1L << 8) #define XkbActionMessageMask (1L << 9) #define XkbAccessXNotifyMask (1L << 10) #define XkbExtensionDeviceNotifyMask (1L << 11) #define XkbAllEventsMask (0xFFF) /* * NewKeyboardNotify event details: */ #define XkbNKN_KeycodesMask (1L << 0) #define XkbNKN_GeometryMask (1L << 1) #define XkbNKN_DeviceIDMask (1L << 2) #define XkbAllNewKeyboardEventsMask (0x7) /* * AccessXNotify event types: * - The 'what' field of AccessXNotify events reports the * reason that the event was generated. */ #define XkbAXN_SKPress 0 #define XkbAXN_SKAccept 1 #define XkbAXN_SKReject 2 #define XkbAXN_SKRelease 3 #define XkbAXN_BKAccept 4 #define XkbAXN_BKReject 5 #define XkbAXN_AXKWarning 6 /* * AccessXNotify details: * - Used as an event detail mask to limit the conditions under which * AccessXNotify events are reported */ #define XkbAXN_SKPressMask (1L << 0) #define XkbAXN_SKAcceptMask (1L << 1) #define XkbAXN_SKRejectMask (1L << 2) #define XkbAXN_SKReleaseMask (1L << 3) #define XkbAXN_BKAcceptMask (1L << 4) #define XkbAXN_BKRejectMask (1L << 5) #define XkbAXN_AXKWarningMask (1L << 6) #define XkbAllAccessXEventsMask (0xf) /* * Miscellaneous event details: * - event detail masks for assorted events that don't reall * have any details. */ #define XkbAllStateEventsMask XkbAllStateComponentsMask #define XkbAllMapEventsMask XkbAllMapComponentsMask #define XkbAllControlEventsMask XkbAllControlsMask #define XkbAllIndicatorEventsMask XkbAllIndicatorsMask #define XkbAllNameEventsMask XkbAllNamesMask #define XkbAllCompatMapEventsMask XkbAllCompatMask #define XkbAllBellEventsMask (1L << 0) #define XkbAllActionMessagesMask (1L << 0) /* * XKB reports one error: BadKeyboard * A further reason for the error is encoded into to most significant * byte of the resourceID for the error: * XkbErr_BadDevice - the device in question was not found * XkbErr_BadClass - the device was found but it doesn't belong to * the appropriate class. * XkbErr_BadId - the device was found and belongs to the right * class, but not feedback with a matching id was * found. * The low byte of the resourceID for this error contains the device * id, class specifier or feedback id that failed. */ #define XkbKeyboard 0 #define XkbNumberErrors 1 #define XkbErr_BadDevice 0xff #define XkbErr_BadClass 0xfe #define XkbErr_BadId 0xfd /* * Keyboard Components Mask: * - Specifies the components that follow a GetKeyboardByNameReply */ #define XkbClientMapMask (1L << 0) #define XkbServerMapMask (1L << 1) #define XkbCompatMapMask (1L << 2) #define XkbIndicatorMapMask (1L << 3) #define XkbNamesMask (1L << 4) #define XkbGeometryMask (1L << 5) #define XkbControlsMask (1L << 6) #define XkbAllComponentsMask (0x7f) /* * State detail mask: * - The 'changed' field of StateNotify events reports which of * the keyboard state components have changed. * - Used as an event detail mask to limit the conditions under * which StateNotify events are reported. */ #define XkbModifierStateMask (1L << 0) #define XkbModifierBaseMask (1L << 1) #define XkbModifierLatchMask (1L << 2) #define XkbModifierLockMask (1L << 3) #define XkbGroupStateMask (1L << 4) #define XkbGroupBaseMask (1L << 5) #define XkbGroupLatchMask (1L << 6) #define XkbGroupLockMask (1L << 7) #define XkbCompatStateMask (1L << 8) #define XkbGrabModsMask (1L << 9) #define XkbCompatGrabModsMask (1L << 10) #define XkbLookupModsMask (1L << 11) #define XkbCompatLookupModsMask (1L << 12) #define XkbPointerButtonMask (1L << 13) #define XkbAllStateComponentsMask (0x3fff) /* * Controls detail masks: * The controls specified in XkbAllControlsMask: * - The 'changed' field of ControlsNotify events reports which of * the keyboard controls have changed. * - The 'changeControls' field of the SetControls request specifies * the controls for which values are to be changed. * - Used as an event detail mask to limit the conditions under * which ControlsNotify events are reported. * * The controls specified in the XkbAllBooleanCtrlsMask: * - The 'enabledControls' field of ControlsNotify events reports the * current status of the boolean controls. * - The 'enabledControlsChanges' field of ControlsNotify events reports * any boolean controls that have been turned on or off. * - The 'affectEnabledControls' and 'enabledControls' fields of the * kbSetControls request change the set of enabled controls. * - The 'accessXTimeoutMask' and 'accessXTimeoutValues' fields of * an XkbControlsRec specify the controls to be changed if the keyboard * times out and the values to which they should be changed. * - The 'autoCtrls' and 'autoCtrlsValues' fields of the PerClientFlags * request specifies the specify the controls to be reset when the * client exits and the values to which they should be reset. * - The 'ctrls' field of an indicator map specifies the controls * that drive the indicator. * - Specifies the boolean controls affected by the SetControls and * LockControls key actions. */ #define XkbRepeatKeysMask (1L << 0) #define XkbSlowKeysMask (1L << 1) #define XkbBounceKeysMask (1L << 2) #define XkbStickyKeysMask (1L << 3) #define XkbMouseKeysMask (1L << 4) #define XkbMouseKeysAccelMask (1L << 5) #define XkbAccessXKeysMask (1L << 6) #define XkbAccessXTimeoutMask (1L << 7) #define XkbAccessXFeedbackMask (1L << 8) #define XkbAudibleBellMask (1L << 9) #define XkbOverlay1Mask (1L << 10) #define XkbOverlay2Mask (1L << 11) #define XkbIgnoreGroupLockMask (1L << 12) #define XkbGroupsWrapMask (1L << 27) #define XkbInternalModsMask (1L << 28) #define XkbIgnoreLockModsMask (1L << 29) #define XkbPerKeyRepeatMask (1L << 30) #define XkbControlsEnabledMask (1L << 31) #define XkbAllBooleanCtrlsMask (0x00001FFF) #define XkbAllControlsMask (0xF8001FFF) #define XkbAllControlEventsMask XkbAllControlsMask /* * AccessX Options Mask * - The 'accessXOptions' field of an XkbControlsRec specifies the * AccessX options that are currently in effect. * - The 'accessXTimeoutOptionsMask' and 'accessXTimeoutOptionsValues' * fields of an XkbControlsRec specify the Access X options to be * changed if the keyboard times out and the values to which they * should be changed. */ #define XkbAX_SKPressFBMask (1L << 0) #define XkbAX_SKAcceptFBMask (1L << 1) #define XkbAX_FeatureFBMask (1L << 2) #define XkbAX_SlowWarnFBMask (1L << 3) #define XkbAX_IndicatorFBMask (1L << 4) #define XkbAX_StickyKeysFBMask (1L << 5) #define XkbAX_TwoKeysMask (1L << 6) #define XkbAX_LatchToLockMask (1L << 7) #define XkbAX_SKReleaseFBMask (1L << 8) #define XkbAX_SKRejectFBMask (1L << 9) #define XkbAX_BKRejectFBMask (1L << 10) #define XkbAX_DumbBellFBMask (1L << 11) #define XkbAX_FBOptionsMask (0xF3F) #define XkbAX_SKOptionsMask (0x0C0) #define XkbAX_AllOptionsMask (0xFFF) /* * XkbUseCoreKbd is used to specify the core keyboard without having * to look up its X input extension identifier. * XkbUseCorePtr is used to specify the core pointer without having * to look up its X input extension identifier. * XkbDfltXIClass is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * device class. * XkbDfltXIId is used to specify "don't care" any place that the * XKB protocol is looking for an X Input Extension * feedback identifier. * XkbAllXIClasses is used to get information about all device indicators, * whether they're part of the indicator feedback class * or the keyboard feedback class. * XkbAllXIIds is used to get information about all device indicator * feedbacks without having to list them. * XkbXINone is used to indicate that no class or id has been specified. * XkbLegalXILedClass(c) True if 'c' specifies a legal class with LEDs * XkbLegalXIBellClass(c) True if 'c' specifies a legal class with bells * XkbExplicitXIDevice(d) True if 'd' explicitly specifies a device * XkbExplicitXIClass(c) True if 'c' explicitly specifies a device class * XkbExplicitXIId(c) True if 'i' explicitly specifies a device id * XkbSingleXIClass(c) True if 'c' specifies exactly one device class, * including the default. * XkbSingleXIId(i) True if 'i' specifies exactly one device * identifier, including the default. */ #define XkbUseCoreKbd 0x0100 #define XkbUseCorePtr 0x0200 #define XkbDfltXIClass 0x0300 #define XkbDfltXIId 0x0400 #define XkbAllXIClasses 0x0500 #define XkbAllXIIds 0x0600 #define XkbXINone 0xff00 #define XkbLegalXILedClass(c) (((c)==KbdFeedbackClass)||\ ((c)==LedFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbLegalXIBellClass(c) (((c)==KbdFeedbackClass)||\ ((c)==BellFeedbackClass)||\ ((c)==XkbDfltXIClass)||\ ((c)==XkbAllXIClasses)) #define XkbExplicitXIDevice(c) (((c)&(~0xff))==0) #define XkbExplicitXIClass(c) (((c)&(~0xff))==0) #define XkbExplicitXIId(c) (((c)&(~0xff))==0) #define XkbSingleXIClass(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIClass)) #define XkbSingleXIId(c) ((((c)&(~0xff))==0)||((c)==XkbDfltXIId)) #define XkbNoModifier 0xff #define XkbNoShiftLevel 0xff #define XkbNoShape 0xff #define XkbNoIndicator 0xff #define XkbNoModifierMask 0 #define XkbAllModifiersMask 0xff #define XkbAllVirtualModsMask 0xffff #define XkbNumKbdGroups 4 #define XkbMaxKbdGroup (XkbNumKbdGroups-1) #define XkbMaxMouseKeysBtn 4 /* * Group Index and Mask: * - Indices into the kt_index array of a key type. * - Mask specifies types to be changed for XkbChangeTypesOfKey */ #define XkbGroup1Index 0 #define XkbGroup2Index 1 #define XkbGroup3Index 2 #define XkbGroup4Index 3 #define XkbAnyGroup 254 #define XkbAllGroups 255 #define XkbGroup1Mask (1<<0) #define XkbGroup2Mask (1<<1) #define XkbGroup3Mask (1<<2) #define XkbGroup4Mask (1<<3) #define XkbAnyGroupMask (1<<7) #define XkbAllGroupsMask (0xf) /* * BuildCoreState: Given a keyboard group and a modifier state, * construct the value to be reported an event. * GroupForCoreState: Given the state reported in an event, * determine the keyboard group. * IsLegalGroup: Returns TRUE if 'g' is a valid group index. */ #define XkbBuildCoreState(m,g) ((((g)&0x3)<<13)|((m)&0xff)) #define XkbGroupForCoreState(s) (((s)>>13)&0x3) #define XkbIsLegalGroup(g) (((g)>=0)&&((g)type>=Xkb_SASetMods)&&((a)->type<=XkbSA_LockMods)) #define XkbIsGroupAction(a) (((a)->type>=XkbSA_SetGroup)&&((a)->type<=XkbSA_LockGroup)) #define XkbIsPtrAction(a) (((a)->type>=XkbSA_MovePtr)&&((a)->type<=XkbSA_SetPtrDflt)) /* * Key Behavior Qualifier: * KB_Permanent indicates that the behavior describes an unalterable * characteristic of the keyboard, not an XKB software-simulation of * the listed behavior. * Key Behavior Types: * Specifies the behavior of the underlying key. */ #define XkbKB_Permanent 0x80 #define XkbKB_OpMask 0x7f #define XkbKB_Default 0x00 #define XkbKB_Lock 0x01 #define XkbKB_RadioGroup 0x02 #define XkbKB_Overlay1 0x03 #define XkbKB_Overlay2 0x04 #define XkbKB_RGAllowNone 0x80 /* * Various macros which describe the range of legal keycodes. */ #define XkbMinLegalKeyCode 8 #define XkbMaxLegalKeyCode 255 #define XkbMaxKeyCount (XkbMaxLegalKeyCode-XkbMinLegalKeyCode+1) #define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) #define XkbIsLegalKeycode(k) (((k)>=XkbMinLegalKeyCode)&&((k)<=XkbMaxLegalKeyCode)) /* * Assorted constants and limits. */ #define XkbNumModifiers 8 #define XkbNumVirtualMods 16 #define XkbNumIndicators 32 #define XkbAllIndicatorsMask (0xffffffff) #define XkbMaxRadioGroups 32 #define XkbAllRadioGroupsMask (0xffffffff) #define XkbMaxShiftLevel 63 #define XkbMaxSymsPerKey (XkbMaxShiftLevel*XkbNumKbdGroups) #define XkbRGMaxMembers 12 #define XkbActionMessageLength 6 #define XkbKeyNameLength 4 #define XkbMaxRedirectCount 8 #define XkbGeomPtsPerMM 10 #define XkbGeomMaxColors 32 #define XkbGeomMaxLabelColors 3 #define XkbGeomMaxPriority 255 /* * Key Type index and mask for the four standard key types. */ #define XkbOneLevelIndex 0 #define XkbTwoLevelIndex 1 #define XkbAlphabeticIndex 2 #define XkbKeypadIndex 3 #define XkbLastRequiredType XkbKeypadIndex #define XkbNumRequiredTypes (XkbLastRequiredType+1) #define XkbMaxKeyTypes 255 #define XkbOneLevelMask (1<<0) #define XkbTwoLevelMask (1<<1) #define XkbAlphabeticMask (1<<2) #define XkbKeypadMask (1<<3) #define XkbAllRequiredTypes (0xf) #define XkbShiftLevel(n) ((n)-1) #define XkbShiftLevelMask(n) (1<<((n)-1)) /* * Extension name and version information */ #define XkbName "XKEYBOARD" #define XkbMajorVersion 1 #define XkbMinorVersion 0 /* * Explicit map components: * - Used in the 'explicit' field of an XkbServerMap. Specifies * the keyboard components that should _not_ be updated automatically * in response to core protocol keyboard mapping requests. */ #define XkbExplicitKeyTypesMask (0x0f) #define XkbExplicitKeyType1Mask (1<<0) #define XkbExplicitKeyType2Mask (1<<1) #define XkbExplicitKeyType3Mask (1<<2) #define XkbExplicitKeyType4Mask (1<<3) #define XkbExplicitInterpretMask (1<<4) #define XkbExplicitAutoRepeatMask (1<<5) #define XkbExplicitBehaviorMask (1<<6) #define XkbExplicitVModMapMask (1<<7) #define XkbAllExplicitMask (0xff) /* * Map components masks: * Those in AllMapComponentsMask: * - Specifies the individual fields to be loaded or changed for the * GetMap and SetMap requests. * Those in ClientInfoMask: * - Specifies the components to be allocated by XkbAllocClientMap. * Those in ServerInfoMask: * - Specifies the components to be allocated by XkbAllocServerMap. */ #define XkbKeyTypesMask (1<<0) #define XkbKeySymsMask (1<<1) #define XkbModifierMapMask (1<<2) #define XkbExplicitComponentsMask (1<<3) #define XkbKeyActionsMask (1<<4) #define XkbKeyBehaviorsMask (1<<5) #define XkbVirtualModsMask (1<<6) #define XkbVirtualModMapMask (1<<7) #define XkbAllClientInfoMask (XkbKeyTypesMask|XkbKeySymsMask|XkbModifierMapMask) #define XkbAllServerInfoMask (XkbExplicitComponentsMask|XkbKeyActionsMask|XkbKeyBehaviorsMask|XkbVirtualModsMask|XkbVirtualModMapMask) #define XkbAllMapComponentsMask (XkbAllClientInfoMask|XkbAllServerInfoMask) /* * Symbol interpretations flags: * - Used in the flags field of a symbol interpretation */ #define XkbSI_AutoRepeat (1<<0) #define XkbSI_LockingKey (1<<1) /* * Symbol interpretations match specification: * - Used in the match field of a symbol interpretation to specify * the conditions under which an interpretation is used. */ #define XkbSI_LevelOneOnly (0x80) #define XkbSI_OpMask (0x7f) #define XkbSI_NoneOf (0) #define XkbSI_AnyOfOrNone (1) #define XkbSI_AnyOf (2) #define XkbSI_AllOf (3) #define XkbSI_Exactly (4) /* * Indicator map flags: * - Used in the flags field of an indicator map to indicate the * conditions under which and indicator can be changed and the * effects of changing the indicator. */ #define XkbIM_NoExplicit (1L << 7) #define XkbIM_NoAutomatic (1L << 6) #define XkbIM_LEDDrivesKB (1L << 5) /* * Indicator map component specifications: * - Used by the 'which_groups' and 'which_mods' fields of an indicator * map to specify which keyboard components should be used to drive * the indicator. */ #define XkbIM_UseBase (1L << 0) #define XkbIM_UseLatched (1L << 1) #define XkbIM_UseLocked (1L << 2) #define XkbIM_UseEffective (1L << 3) #define XkbIM_UseCompat (1L << 4) #define XkbIM_UseNone 0 #define XkbIM_UseAnyGroup (XkbIM_UseLatched|XkbIM_UseLocked|XkbIM_UseEffective) #define XkbIM_UseAnyMods (XkbIM_UseAnyGroup|XkbIM_UseCompat|XkbIM_UseBase) /* * Compatibility Map Compontents: * - Specifies the components to be allocated in XkbAllocCompatMap. */ #define XkbSymInterpMask (1<<0) #define XkbGroupCompatMask (1<<1) #define XkbAllCompatMask (0x3) /* * Names component mask: * - Specifies the names to be loaded or changed for the GetNames and * SetNames requests. * - Specifies the names that have changed in a NamesNotify event. * - Specifies the names components to be allocated by XkbAllocNames. */ #define XkbKeycodesNameMask (1<<0) #define XkbGeometryNameMask (1<<1) #define XkbSymbolsNameMask (1<<2) #define XkbPhysSymbolsNameMask (1<<3) #define XkbTypesNameMask (1<<4) #define XkbCompatNameMask (1<<5) #define XkbKeyTypeNamesMask (1<<6) #define XkbKTLevelNamesMask (1<<7) #define XkbIndicatorNamesMask (1<<8) #define XkbKeyNamesMask (1<<9) #define XkbKeyAliasesMask (1<<10) #define XkbVirtualModNamesMask (1<<11) #define XkbGroupNamesMask (1<<12) #define XkbRGNamesMask (1<<13) #define XkbComponentNamesMask (0x3f) #define XkbAllNamesMask (0x3fff) /* * GetByName components: * - Specifies desired or necessary components to GetKbdByName request. * - Reports the components that were found in a GetKbdByNameReply */ #define XkbGBN_TypesMask (1L << 0) #define XkbGBN_CompatMapMask (1L << 1) #define XkbGBN_ClientSymbolsMask (1L << 2) #define XkbGBN_ServerSymbolsMask (1L << 3) #define XkbGBN_SymbolsMask (XkbGBN_ClientSymbolsMask|XkbGBN_ServerSymbolsMask) #define XkbGBN_IndicatorMapMask (1L << 4) #define XkbGBN_KeyNamesMask (1L << 5) #define XkbGBN_GeometryMask (1L << 6) #define XkbGBN_OtherNamesMask (1L << 7) #define XkbGBN_AllComponentsMask (0xff) /* * ListComponents flags */ #define XkbLC_Hidden (1L << 0) #define XkbLC_Default (1L << 1) #define XkbLC_Partial (1L << 2) #define XkbLC_AlphanumericKeys (1L << 8) #define XkbLC_ModifierKeys (1L << 9) #define XkbLC_KeypadKeys (1L << 10) #define XkbLC_FunctionKeys (1L << 11) #define XkbLC_AlternateGroup (1L << 12) /* * X Input Extension Interactions * - Specifies the possible interactions between XKB and the X input * extension * - Used to request (XkbGetDeviceInfo) or change (XKbSetDeviceInfo) * XKB information about an extension device. * - Reports the list of supported optional features in the reply to * XkbGetDeviceInfo or in an XkbExtensionDeviceNotify event. * XkbXI_UnsupportedFeature is reported in XkbExtensionDeviceNotify * events to indicate an attempt to use an unsupported feature. */ #define XkbXI_KeyboardsMask (1L << 0) #define XkbXI_ButtonActionsMask (1L << 1) #define XkbXI_IndicatorNamesMask (1L << 2) #define XkbXI_IndicatorMapsMask (1L << 3) #define XkbXI_IndicatorStateMask (1L << 4) #define XkbXI_UnsupportedFeatureMask (1L << 15) #define XkbXI_AllFeaturesMask (0x001f) #define XkbXI_AllDeviceFeaturesMask (0x001e) #define XkbXI_IndicatorsMask (0x001c) #define XkbAllExtensionDeviceEventsMask (0x801f) /* * Per-Client Flags: * - Specifies flags to be changed by the PerClientFlags request. */ #define XkbPCF_DetectableAutoRepeatMask (1L << 0) #define XkbPCF_GrabsUseXKBStateMask (1L << 1) #define XkbPCF_AutoResetControlsMask (1L << 2) #define XkbPCF_LookupStateWhenGrabbed (1L << 3) #define XkbPCF_SendEventUsesXKBState (1L << 4) #define XkbPCF_AllFlagsMask (0x1F) /* * Debugging flags and controls */ #define XkbDF_DisableLocks (1<<0) #endif /* _XKB_H_ */ vnc_unixsrc/Xvnc/include/extensions/XIE.h0100664000076400007640000002524407120677563020052 0ustar constconst/* $XConsortium: XIE.h,v 1.5 94/04/17 20:11:11 mor Exp $ */ /****************************************************************************** Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. NOTICE This software is being provided by AGE Logic, Inc. under the following license. By obtaining, using and/or copying this software, you agree that you have read, understood, and will comply with these terms and conditions: Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee or royalty and to grant others any or all rights granted herein is hereby granted, provided that you agree to comply with the following copyright notice and statements, including the disclaimer, and that the same appears on all copies and derivative works of the software and documentation you make. "Copyright 1993, 1994 by AGE Logic, Inc." THIS SOFTWARE IS PROVIDED "AS IS". AGE LOGIC MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not limitation, AGE LOGIC MAKE NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE SOFTWARE DOES NOT INFRINGE THIRD-PARTY PROPRIETARY RIGHTS. AGE LOGIC SHALL BEAR NO LIABILITY FOR ANY USE OF THIS SOFTWARE. IN NO EVENT SHALL EITHER PARTY BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF PROFITS, REVENUE, DATA OR USE, INCURRED BY EITHER PARTY OR ANY THIRD PARTY, WHETHER IN AN ACTION IN CONTRACT OR TORT OR BASED ON A WARRANTY, EVEN IF AGE LOGIC LICENSEES HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. The name of AGE Logic, Inc. may not be used in advertising or publicity pertaining to this software without specific, written prior permission from AGE Logic. Title to this software shall at all times remain with AGE Logic, Inc. ******************************************************************************/ #ifndef _XIE_H_ #define _XIE_H_ /* Extension Name and version number */ #define xieExtName "XIE" #define xieMajorVersion 5 #define xieMinorVersion 0 #define xieEarliestMinorVersion 0 #define xieLatestMinorVersion 0 /* ServiceClass */ #ifdef XIE_DIS #define XIE_FULL 0 #else #define XIE_FULL 1 #endif #define xieValFull 1 #define xieValDIS 2 /* Limits */ #define xieValMaxBands 3 /* Alignment */ #define xieValAlignable 1 #define xieValArbitrary 2 /* ArithmeticOp */ #define xieValAdd 1 #define xieValSub 2 #define xieValSubRev 3 #define xieValMul 4 #define xieValDiv 5 #define xieValDivRev 6 #define xieValMin 7 #define xieValMax 8 #define xieValGamma 9 /* ColorAllocTechnique */ #define xieValColorAllocDefault 0 #define xieValColorAllocAll 2 #define xieValColorAllocMatch 4 #define xieValColorAllocRequantize 6 /* Colorspace conversions */ #define xieValRGBToCIELab 2 #define xieValRGBToCIEXYZ 4 #define xieValRGBToYCbCr 6 #define xieValRGBToYCC 8 #define xieValCIELabToRGB 2 #define xieValCIEXYZToRGB 4 #define xieValYCbCrToRGB 6 #define xieValYCCToRGB 8 /* CompareOp */ #define xieValLT 1 #define xieValLE 2 #define xieValEQ 3 #define xieValNE 4 #define xieValGT 5 #define xieValGE 6 /* ConstrainTechnique */ #define xieValConstrainClipScale 2 #define xieValConstrainHardClip 4 /* ConvolveTechnique */ #define xieValConvolveDefault 0 #define xieValConvolveConstant 2 #define xieValConvolveReplicate 4 /* DataClass */ #define xieValSingleBand 1 #define xieValTripleBand 2 /* DataType */ #define xieValConstrained 1 #define xieValUnconstrained 2 /* DecodeTechnique */ #define xieValDecodeUncompressedSingle 2 /* bitonal & grayscale */ #define xieValDecodeUncompressedTriple 3 /* color */ #define xieValDecodeG31D 4 /* FAX */ #define xieValDecodeG32D 6 /* FAX */ #define xieValDecodeG42D 8 /* FAX */ #define xieValDecodeJPEGBaseline 10 /* grayscale & color */ #define xieValDecodeJPEGLossless 12 /* grayscale & color */ #define xieValDecodeTIFF2 14 /* TIFF modified G31D */ #define xieValDecodeTIFFPackBits 16 /* TIFF APPLE FORMAT */ /* DitherTechnique */ #define xieValDitherDefault 0 #define xieValDitherErrorDiffusion 2 #define xieValDitherOrdered 4 /* EncodeTechnique */ #define xieValEncodeServerChoice 1 /* (to photomaps) */ #define xieValEncodeUncompressedSingle 2 /* bitonal & grayscale */ #define xieValEncodeUncompressedTriple 3 /* color */ #define xieValEncodeG31D 4 /* FAX */ #define xieValEncodeG32D 6 /* FAX */ #define xieValEncodeG42D 8 /* FAX */ #define xieValEncodeJPEGBaseline 10 /* grayscale & color */ #define xieValEncodeJPEGLossless 12 /* grayscale & color */ #define xieValEncodeTIFF2 14 /* TIFF modified G31D */ #define xieValEncodeTIFFPackBits 16 /* TIFF APPLE FORMAT */ /* ServerChoice preference hints */ #define xieValPreferDefault 0 #define xieValPreferSpace 1 #define xieValPreferTime 2 /* JPEG-Lossless predictor */ #define xieValPredictorNone 0 #define xieValPredictorA 1 #define xieValPredictorB 2 #define xieValPredictorC 3 #define xieValPredictorABC 4 #define xieValPredictorABC2 5 #define xieValPredictorBAC2 6 #define xieValPredictorAB2 7 /* ExportNotify */ #define xieValDisable 1 #define xieValFirstData 2 #define xieValNewData 3 /* ExportState */ #define xieValExportDone 1 #define xieValExportMore 2 #define xieValExportEmpty 3 #define xieValExportError 4 /* GamutTechnique */ #define xieValGamutDefault 0 #define xieValGamutNone 1 #define xieValGamutClipRGB 2 /* GeometryTechnique */ #define xieValGeomDefault 0 #define xieValGeomAntialias 2 #define xieValGeomAntialiasByArea 4 #define xieValGeomAntialiasByLPF 6 #define xieValGeomBilinearInterp 8 #define xieValGeomGaussian 10 #define xieValGeomNearestNeighbor 12 /* NearestNeighbor modify */ #define xieValFavorDown 1 #define xieValFavorUp 2 #define xieValRoundNW 3 #define xieValRoundNE 4 #define xieValRoundSE 5 #define xieValRoundSW 6 /* HistogramShape */ #define xieValHistogramFlat 2 #define xieValHistogramGaussian 4 #define xieValHistogramHyperbolic 6 /* Interleave */ #define xieValBandByPixel 1 #define xieValBandByPlane 2 /* MathOp */ #define xieValExp 1 #define xieValLn 2 #define xieValLog2 3 #define xieValLog10 4 #define xieValSquare 5 #define xieValSqrt 6 /* Orientation */ #define xieValLSFirst 1 #define xieValMSFirst 2 /* PhotofloOutcome */ #define xieValFloSuccess 1 #define xieValFloAbort 2 #define xieValFloError 3 /* PhotofloState */ #define xieValInactive 1 #define xieValActive 2 #define xieValNonexistent 3 /* TechniqueGroup */ #define xieValDefault 0 #define xieValAll 1 #define xieValColorAlloc 2 #define xieValConstrain 4 #define xieValConvertFromRGB 6 #define xieValConvertToRGB 8 #define xieValConvolve 10 #define xieValDecode 12 #define xieValDither 14 #define xieValEncode 16 #define xieValGamut 18 #define xieValGeometry 20 #define xieValHistogram 22 #define xieValWhiteAdjust 24 #define xieValMaxTechGroup 24 /* WhiteAdjustTechnique */ #define xieValWhiteAdjustDefault 0 #define xieValWhiteAdjustNone 1 #define xieValWhiteAdjustCIELabShift 2 /* Photoflo elements */ #define xieElemImportClientLUT 1 #define xieElemImportClientPhoto 2 #define xieElemImportClientROI 3 #define xieElemImportDrawable 4 #define xieElemImportDrawablePlane 5 #define xieElemImportLUT 6 #define xieElemImportPhotomap 7 #define xieElemImportROI 8 #define xieElemArithmetic 9 #define xieElemBandCombine 10 #define xieElemBandExtract 11 #define xieElemBandSelect 12 #define xieElemBlend 13 #define xieElemCompare 14 #define xieElemConstrain 15 #define xieElemConvertFromIndex 16 #define xieElemConvertFromRGB 17 #define xieElemConvertToIndex 18 #define xieElemConvertToRGB 19 #define xieElemConvolve 20 #define xieElemDither 21 #define xieElemGeometry 22 #define xieElemLogical 23 #define xieElemMatchHistogram 24 #define xieElemMath 25 #define xieElemPasteUp 26 #define xieElemPoint 27 #define xieElemUnconstrain 28 #define xieElemExportClientHistogram 29 #define xieElemExportClientLUT 30 #define xieElemExportClientPhoto 31 #define xieElemExportClientROI 32 #define xieElemExportDrawable 33 #define xieElemExportDrawablePlane 34 #define xieElemExportLUT 35 #define xieElemExportPhotomap 36 #define xieElemExportROI 37 #define xieMaxElem 37 /* Event Codes */ #define xieEvnNoColorAlloc 0 #define xieEvnNoDecodeNotify 1 #define xieEvnNoExportAvailable 2 #define xieEvnNoImportObscured 3 #define xieEvnNoPhotofloDone 4 #define xieNumEvents 5 /* Error Codes */ #define xieErrNoColorList 0 #define xieErrNoLUT 1 #define xieErrNoPhotoflo 2 #define xieErrNoPhotomap 3 #define xieErrNoPhotospace 4 #define xieErrNoROI 5 #define xieErrNoFlo 6 #define xieNumErrors 7 /* Flo Error Codes */ #define xieErrNoFloAccess 1 #define xieErrNoFloAlloc 2 #define xieErrNoFloColormap 3 #define xieErrNoFloColorList 4 #define xieErrNoFloDomain 5 #define xieErrNoFloDrawable 6 #define xieErrNoFloElement 7 #define xieErrNoFloGC 8 #define xieErrNoFloID 9 #define xieErrNoFloLength 10 #define xieErrNoFloLUT 11 #define xieErrNoFloMatch 12 #define xieErrNoFloOperator 13 #define xieErrNoFloPhotomap 14 #define xieErrNoFloROI 15 #define xieErrNoFloSource 16 #define xieErrNoFloTechnique 17 #define xieErrNoFloValue 18 #define xieErrNoFloImplementation 19 #define xieNumFloErrors 19 #endif /* _XIE_H_ */ vnc_unixsrc/Xvnc/include/extensions/Printstr.h0100664000076400007640000005463607120677563021261 0ustar constconst/* $XConsortium: Printstr.h /main/2 1996/11/16 15:20:15 rws $ */ /****************************************************************************** ****************************************************************************** ** ** File: Printstr.h ** ** Description: Definitions needed by the server and library, but ** not clients. ** ** Print.h for server, library and clients. ** ****************************************************************************** ** ** (c) Copyright 1996 Hewlett-Packard Company ** (c) Copyright 1996 International Business Machines Corp. ** (c) Copyright 1996 Sun Microsystems, Inc. ** (c) Copyright 1996 Novell, Inc. ** (c) Copyright 1996 Digital Equipment Corp. ** (c) Copyright 1996 Fujitsu Limited ** (c) Copyright 1996 Hitachi, Ltd. ** ** Permission is hereby granted, free of charge, to any person obtaining a copy ** of this software and associated documentation files (the "Software"), to deal ** in the Software without restriction, including without limitation the rights ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ** copies of the Software, and to permit persons to whom the Software is ** furnished to do so, subject to the following conditions: ** ** The above copyright notice and this permission notice shall be included in ** all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ** ** Except as contained in this notice, the names of the copyright holders shall ** not be used in advertising or otherwise to promote the sale, use or other ** dealings in this Software without prior written authorization from said ** copyright holders. ** ****************************************************************************** *****************************************************************************/ #ifndef _XpPrintstr_H_ #define _XpPrintstr_H_ /* * NEED_EVENTS and NEED_REPLIES are hacks to limit the linker symbol-table * size. When function prototypes are needed from Print.h, this sets up * a cascading dependency on Printstr.h and eventually Xproto.h to provide * the event and reply struct definitions. */ #ifndef NEED_EVENTS #define NEED_EVENTS #endif /* NEED_EVENTS */ #define NEED_REPLIES #include #ifndef _XP_PRINT_SERVER_ #include #endif /* _XP_PRINT_SERVER_ */ /* * Pull in other definitions. Print.h will hide some things if we're * doing server side work. */ #include #include _XFUNCPROTOBEGIN /****************************************************************************** * * Protocol requests constants and alignment values * * Note: Xlib macro's expect X_ABC where ABC is the name of the * protocol request. */ #define X_PrintQueryVersion 0 #define X_PrintGetPrinterList 1 #define X_PrintCreateContext 2 #define X_PrintSetContext 3 #define X_PrintGetContext 4 #define X_PrintDestroyContext 5 #define X_PrintGetContextScreen 6 #define X_PrintStartJob 7 #define X_PrintEndJob 8 #define X_PrintStartDoc 9 #define X_PrintEndDoc 10 #define X_PrintPutDocumentData 11 #define X_PrintGetDocumentData 12 #define X_PrintStartPage 13 #define X_PrintEndPage 14 #define X_PrintSelectInput 15 #define X_PrintInputSelected 16 #define X_PrintGetAttributes 17 #define X_PrintSetAttributes 18 #define X_PrintGetOneAttribute 19 #define X_PrintRehashPrinterList 20 #define X_PrintGetPageDimensions 21 #define X_PrintQueryScreens 22 #define X_PrintSetImageResolution 23 #define X_PrintGetImageResolution 24 /******************************************************************** * * Protocol data types */ #define PCONTEXT CARD32 #define WINDOW CARD32 #define DRAWABLE CARD32 #define BITMASK CARD32 /****************************************************************************** * * Event wire struct definitions * * Note: Xlib macro's expect xABC struct names and sz_xABC size * constants where ABC is the name of the protocol request. */ /********************************************************************* * * Events. * * See Print.h for the protocol "type" values. */ typedef struct _xPrintPrintEvent { BYTE type; /* XPPrintNotify + extEntry->eventBase */ BYTE detail; /* XPStartJobNotify, XPEndJobNotify, XPStartDocNotify, XPEndDocNotify, XPStartPageNotify, XPEndPageNotify */ CARD16 sequenceNumber B16; PCONTEXT printContext B32; /* print context */ BOOL cancel; /* canceled flag */ CARD8 pad1; /* rest is unused */ CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xPrintPrintEvent; #define sz_xPrintPrintEvent 32; typedef struct _xPrintAttributeEvent { BYTE type; /* XPAttributeNotify + extEntry->eventBase */ BYTE detail; /* XPJobAttr, XPDocAttr, XPPageAttr, XPPrinterAttr, XPSpoolerAttr, XPMediumAttr, XPServerAttr */ CARD16 sequenceNumber B16; PCONTEXT printContext B32; /* print context */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xPrintAttributeEvent; #define sz_xPrintAttributeEvent 32; /********************************************************************* * * Requests */ typedef struct _PrintQueryVersion { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintQueryVersion */ CARD16 length B16; } xPrintQueryVersionReq; #define sz_xPrintQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of Xp protocol */ CARD16 minorVersion B16; /* minor version of Xp protocol */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xPrintQueryVersionReply; #define sz_xPrintQueryVersionReply 32 typedef struct _PrintGetPrinterList { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetPrinterList */ CARD16 length B16; CARD32 printerNameLen B32; /* length of printer name */ CARD32 localeLen B32; /* length of locale string */ /* variable portion ***************************************** STRING8 printerName; * printer name * BYTE pad(printerNameLen) * unused * STRING8 locale; * locale * BYTE pad(localeLen) * unused * ************************************************************/ } xPrintGetPrinterListReq; #define sz_xPrintGetPrinterListReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 listCount B32; /* of PRINTER recs below */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; /* variable portion ***************************************** CARD32 nameLen B32; * length of name in bytes * STRING8 name; * name * BYTE pad(nameLen) * unused * CARD32 descLen B32; * length of desc in bytes * STRING8 desc; * localized description * BYTE pad(descLen) * unused * ************************************************************/ } xPrintGetPrinterListReply; #define sz_xPrintGetPrinterListReply 32 typedef struct _PrintRehashPrinterList { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintRehashPrinterList */ CARD16 length B16; } xPrintRehashPrinterListReq; #define sz_xPrintRehashPrinterListReq 4 typedef struct _PrintCreateContext { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintInitSetContext */ CARD16 length B16; CARD32 contextID B32; /* ID for context */ CARD32 printerNameLen B32; /* length of printerName in bytes */ CARD32 localeLen B32; /* length of locale in bytes */ /* variable portion ***************************************** STRING8 printerName * printer name * BYTE pad(printerNameLen) * unused * STRING8 locale * locale * BYTE pad(locale) * unused * ************************************************************/ } xPrintCreateContextReq; #define sz_xPrintCreateContextReq 16 typedef struct _PrintSetContext { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintSetContext */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintSetContextReq; #define sz_xPrintSetContextReq 8 typedef struct _PrintGetContext { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetContext */ CARD16 length B16; } xPrintGetContextReq; #define sz_xPrintGetContextReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; PCONTEXT printContext B32; /* print context */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xPrintGetContextReply; #define sz_xPrintGetContextReply 32 typedef struct _PrintDestroyContext { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintDestroyContext */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintDestroyContextReq; #define sz_xPrintDestroyContextReq 8 typedef struct _PrintGetContextScreen { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetContextScreen */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintGetContextScreenReq; #define sz_xPrintGetContextScreenReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; WINDOW rootWindow; /* screenPtr represented as rootWin */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xPrintGetContextScreenReply; #define sz_xPrintGetContextScreenReply 32 typedef struct _PrintStartJob { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintStartJob */ CARD16 length B16; CARD8 saveData; /* save data boolean */ CARD8 pad1; CARD16 pad2 B16; } xPrintStartJobReq; #define sz_xPrintStartJobReq 8 typedef struct _PrintEndJob { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintEndJob */ CARD16 length B16; BOOL cancel; /* cancel boolean */ CARD8 pad1; CARD16 pad2 B16; } xPrintEndJobReq; #define sz_xPrintEndJobReq 8 typedef struct _PrintStartDoc { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintStartDoc */ CARD16 length B16; CARD8 type; /* type for document */ CARD8 pad1; CARD16 pad2 B16; } xPrintStartDocReq; #define sz_xPrintStartDocReq 8 typedef struct _PrintEndDoc { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintEndDoc */ CARD16 length B16; BOOL cancel; /* cancel boolean */ CARD8 pad1; CARD16 pad2 B16; } xPrintEndDocReq; #define sz_xPrintEndDocReq 8 typedef struct _PrintPutDocumentData { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintPutDocumentData */ CARD16 length B16; DRAWABLE drawable B32; /* target drawable */ CARD32 len_data B32; /* big len in bytes */ CARD16 len_fmt; /* len in bytes */ CARD16 len_options; /* len in bytes */ /* variable portion ***************************************** LISTofBYTE data; * data * BYTE pad(len_data) * unused * STRING8 doc_fmt; * ISO compliant desc of data type * BYTE pad(len_fmt) * unused * STRING8 options; * additional device-dependent desc * BYTE pad(len_options) * unused * ************************************************************/ } xPrintPutDocumentDataReq; #define sz_xPrintPutDocumentDataReq 16 typedef struct _PrintGetDocumentData { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetDocumentData */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ CARD32 maxBufferSize B32; /* maximum buffer size requested */ } xPrintGetDocumentDataReq; #define sz_xPrintGetDocumentDataReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 statusCode B32; /* status code for reply */ CARD32 finishedFlag B32; /* is this the last reply */ CARD32 dataLen B32; /* data length */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; /* variable portion ***************************************** LISTofBYTE data; * data * BYTE pad(count) * unused * ************************************************************/ } xPrintGetDocumentDataReply; #define sz_xPrintGetDocumentDataReply 32 typedef struct _PrintStartPage { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintStartPage */ CARD16 length B16; WINDOW window B32; /* window */ } xPrintStartPageReq; #define sz_xPrintStartPageReq 8 typedef struct _PrintEndPage { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintEndPage */ CARD16 length B16; BOOL cancel; /* cancel boolean */ CARD8 pad1; CARD16 pad2 B16; } xPrintEndPageReq; #define sz_xPrintEndPageReq 8 typedef struct _PrintSelectInput { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintSelectInput */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ BITMASK eventMask B32; } xPrintSelectInputReq; #define sz_xPrintSelectInputReq 12 typedef struct _PrintInputSelected { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintInputSelected */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintInputSelectedReq; #define sz_xPrintInputSelectedReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; BITMASK eventMask B32; /* your event mask */ BITMASK allEventsMask B32; /* all event mask */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xPrintInputSelectedReply; #define sz_xPrintInputSelectedReply 32 typedef struct _PrintGetAttributes { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetAttributes */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ CARD8 type; /* type */ CARD8 pad1; /* unused */ CARD16 pad2 B16; /* unused */ } xPrintGetAttributesReq; #define sz_xPrintGetAttributesReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 stringLen B32; /* length of xrm db string */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; /* variable portion ***************************************** STRING8 string; * xrm db as a string * BYTE pad(stringLen) * unused * ************************************************************/ } xPrintGetAttributesReply; #define sz_xPrintGetAttributesReply 32 typedef struct _PrintSetAttributes { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintSetAttributes */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ CARD32 stringLen B32; /* length of xrm db string */ CARD8 type; /* type */ CARD8 rule; /* replacement rule */ CARD16 pad1 B16; /* unused */ /* variable portion ***************************************** STRING8 string; * xrm db as a string * BYTE pad(stringLen) * unused * ************************************************************/ } xPrintSetAttributesReq; #define sz_xPrintSetAttributesReq 16 typedef struct _PrintGetOneAttribute { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetOneAttribute */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ CARD32 nameLen; /* length of name string */ CARD8 type; /* type */ CARD8 pad1; /* unused */ CARD16 pad2 B16; /* unused */ /* variable portion ***************************************** STRING8 name; * name as a string * BYTE pad(name) * unused * ************************************************************/ } xPrintGetOneAttributeReq; #define sz_xPrintGetOneAttributeReq 16 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 valueLen B32; /* length of value string */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; /* variable portion ***************************************** STRING8 value; * value as a string * BYTE pad(value) * unused * ************************************************************/ } xPrintGetOneAttributeReply; #define sz_xPrintGetOneAttributeReply 32 typedef struct _PrintGetPageDimensions { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetPageDimensions */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintGetPageDimensionsReq; #define sz_xPrintGetPageDimensionsReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 width; /* total pixel width */ CARD16 height; /* total pixel height */ CARD16 rx; /* reproducable x pixel offset */ CARD16 ry; /* reproducable y pixel offset */ CARD16 rwidth; /* reproducable x pixel width */ CARD16 rheight; /* reproducable y pixel width */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xPrintGetPageDimensionsReply; #define sz_xPrintGetPageDimensionsReply 32 typedef struct _PrintQueryScreens { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintQueryScreens */ CARD16 length B16; } xPrintQueryScreensReq; #define sz_xPrintQueryScreensReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 listCount; /* number of screens following */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; /* variable portion ***************************************** WINDOW rootWindow; * root window of screen * ************************************************************/ } xPrintQueryScreensReply; #define sz_xPrintQueryScreensReply 32 typedef struct _PrintSetImageResolution { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintSetImageResolution */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ CARD16 imageRes B16; /* image resolution */ CARD16 pad1 B16; } xPrintSetImageResolutionReq; #define sz_xPrintSetImageResolutionReq 12 typedef struct { BYTE type; /* X_Reply */ BOOL status; /* accepted or not */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 prevRes B16; /* previous resolution */ CARD16 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xPrintSetImageResolutionReply; #define sz_xPrintSetImageResolutionReply 32 typedef struct _PrintGetImageResolution { CARD8 reqType; /* always PrintReqCode */ CARD8 printReqType; /* always X_PrintGetImageResolution */ CARD16 length B16; PCONTEXT printContext B32; /* print context */ } xPrintGetImageResolutionReq; #define sz_xPrintGetImageResolutionReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 imageRes B16; /* image resolution */ CARD16 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xPrintGetImageResolutionReply; #define sz_xPrintGetImageResolutionReply 32 #ifndef _XP_PRINT_SERVER_ /*********************************************************************** * * Library-only definitions. */ extern XPHinterProc _xp_hinter_proc; extern char *_xp_hinter_desc; extern int _xp_hinter_init; #endif /* _XP_PRINT_SERVER_ */ #ifdef _XP_PRINT_SERVER_ /*********************************************************************** * * Server-only definitions shared between the extension and DDX layers. * */ /* * Internal return code used to indicate that the requesting * client has been suspended. */ #define Suspended 84 extern void XpRegisterPrinterScreen( ScreenPtr pScreen, int (*CreateContext)()); typedef struct _xpprintFuncs { int (*StartJob)(); /* pContext, client */ int (*EndJob)(); /* pContext, client */ int (*StartDoc)(); /* pContext, client */ int (*EndDoc)(); /* pContext, client */ int (*StartPage)(); /* pContext, pWin, client, exposures */ int (*EndPage)(); /* pContext, client */ int (*PutDocumentData)(); /* pContext,pDraw,pData,len_data,pFmt,len_fmt,pOpt,len_opt, client */ int (*GetDocumentData)(); /* pContext,pData,len_data,pFmt,len_fmt,pOpt,len_opt, client */ int (*DestroyContext)(); /* pContext, client */ char *(*GetAttributes)(); /* pContext, pool */ char *(*GetOneAttribute)(); /* pContext, pool, attr */ int (*SetAttributes)(); /* pContext, pool, attrs */ int (*AugmentAttributes)(); /* pContext, pool, attrs */ int (*GetMediumDimensions)(); /* pPrintContext, pWidth, pHeight */ int (*GetReproducibleArea)(); /* pPrintContext, pRect */ int (*SetImageResolution)(); /* pPrintContext, imageRes, pStatus */ } XpDriverFuncs, *XpDriverFuncsPtr; /* * Each print context is represented by one of the following structs * associated with a resource ID of type RTcontext . A pointer to * the context is placed in the Xp extension's devPrivates * element in each client * which establishes a context via * either initContext or setContext. * The context pointer is also placed in the struct indicated by the * RTpage resource associated with each StartPage'd window. */ typedef struct _XpContext { XID contextID; char *printerName; int screenNum; /* screen containing the printer */ struct _XpClient *clientHead; /* list of clients */ CARD32 state; VisualID pageWin; DevUnion *devPrivates; XpDriverFuncs funcs; ClientPtr clientSlept; int imageRes; } XpContextRec, *XpContextPtr; extern XpContextPtr XpGetPrintContext( ClientPtr client); #endif /* _XP_PRINT_SERVER_ */ _XFUNCPROTOEND #endif /* _XpPrintstr_H_ */ vnc_unixsrc/Xvnc/include/extensions/xf86vmode.h0100664000076400007640000001537407120677563021256 0ustar constconst/* $XFree86: xc/include/extensions/xf86vmode.h,v 3.20.2.1 1997/07/13 14:44:57 dawes Exp $ */ /* Copyright (c) 1995 Kaleb S. KEITHLEY Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Kaleb S. KEITHLEY shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Kaleb S. KEITHLEY */ /* $XConsortium: xf86vmode.h /main/9 1996/10/26 21:38:11 kaleb $ */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86VIDMODE_H_ #define _XF86VIDMODE_H_ #include #include #define X_XF86VidModeQueryVersion 0 #define X_XF86VidModeGetModeLine 1 #define X_XF86VidModeModModeLine 2 #define X_XF86VidModeSwitchMode 3 #define X_XF86VidModeGetMonitor 4 #define X_XF86VidModeLockModeSwitch 5 #define X_XF86VidModeGetAllModeLines 6 #define X_XF86VidModeAddModeLine 7 #define X_XF86VidModeDeleteModeLine 8 #define X_XF86VidModeValidateModeLine 9 #define X_XF86VidModeSwitchToMode 10 #define X_XF86VidModeGetViewPort 11 #define X_XF86VidModeSetViewPort 12 #ifdef XF86VIDMODE_EVENTS #define XF86VidModeNotify 0 #define XF86VidModeNumberEvents (XF86VidModeNotify + 1) #define XF86VidModeNotifyMask 0x00000001 #define XF86VidModeNonEvent 0 #define XF86VidModeModeChange 1 #else #define XF86VidModeNumberEvents 0 #endif #define XF86VidModeBadClock 0 #define XF86VidModeBadHTimings 1 #define XF86VidModeBadVTimings 2 #define XF86VidModeModeUnsuitable 3 #define XF86VidModeExtensionDisabled 4 #define XF86VidModeClientNotLocal 5 #define XF86VidModeZoomLocked 6 #define XF86VidModeNumberErrors (XF86VidModeZoomLocked + 1) #ifndef _XF86VIDMODE_SERVER_ typedef struct { unsigned short hdisplay; unsigned short hsyncstart; unsigned short hsyncend; unsigned short htotal; unsigned short vdisplay; unsigned short vsyncstart; unsigned short vsyncend; unsigned short vtotal; unsigned int flags; int privsize; #if defined(__cplusplus) || defined(c_plusplus) /* private is a C++ reserved word */ INT32 *c_private; #else INT32 *private; #endif } XF86VidModeModeLine; typedef struct { unsigned int dotclock; unsigned short hdisplay; unsigned short hsyncstart; unsigned short hsyncend; unsigned short htotal; unsigned short vdisplay; unsigned short vsyncstart; unsigned short vsyncend; unsigned short vtotal; unsigned int flags; int privsize; #if defined(__cplusplus) || defined(c_plusplus) /* private is a C++ reserved word */ INT32 *c_private; #else INT32 *private; #endif } XF86VidModeModeInfo; typedef struct { float hi; float lo; } XF86VidModeSyncRange; typedef struct { char* vendor; char* model; float EMPTY; unsigned char nhsync; XF86VidModeSyncRange* hsync; unsigned char nvsync; XF86VidModeSyncRange* vsync; } XF86VidModeMonitor; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent req */ Display *display; /* Display the event was read from */ Window root; /* root window of event screen */ int state; /* What happened */ int kind; /* What happened */ Bool forced; /* extents of new region */ Time time; /* event timestamp */ } XF86VidModeNotifyEvent; #define XF86VidModeSelectNextMode(disp, scr) \ XF86VidModeSwitchMode(disp, scr, 1) #define XF86VidModeSelectPrevMode(disp, scr) \ XF86VidModeSwitchMode(disp, scr, -1) _XFUNCPROTOBEGIN Bool XF86VidModeQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */ #endif ); Bool XF86VidModeQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_base */, int* /* error_base */ #endif ); Bool XF86VidModeGetModeLine( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int* /* dotclock */, XF86VidModeModeLine* /* modeline */ #endif ); Bool XF86VidModeGetAllModeLines( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int* /* modecount */, XF86VidModeModeInfo*** /* modelinesPtr */ #endif ); Bool XF86VidModeAddModeLine( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeModeInfo* /* new modeline */, XF86VidModeModeInfo* /* after modeline */ #endif ); Bool XF86VidModeDeleteModeLine( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeModeInfo* /* modeline */ #endif ); Bool XF86VidModeModModeLine( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeModeLine* /* modeline */ #endif ); Status XF86VidModeValidateModeLine( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeModeInfo* /* modeline */ #endif ); Bool XF86VidModeSwitchMode( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* zoom */ #endif ); Bool XF86VidModeSwitchToMode( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeModeInfo* /* modeline */ #endif ); Bool XF86VidModeLockModeSwitch( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* lock */ #endif ); Bool XF86VidModeGetMonitor( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, XF86VidModeMonitor* /* monitor */ #endif ); Bool XF86VidModeGetViewPort( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int* /* x return */, int* /* y return */ #endif ); Bool XF86VidModeSetViewPort( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* x */, int /* y */ #endif ); _XFUNCPROTOEND #endif #endif vnc_unixsrc/Xvnc/include/extensions/multibuf.h0100664000076400007640000002210107120677563021241 0ustar constconst/* * $XConsortium: multibuf.h,v 1.18 94/04/17 20:11:21 dpw Exp $ * $XFree86: xc/include/extensions/multibuf.h,v 3.0 1996/05/06 05:52:38 dawes Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _MULTIBUF_H_ #define _MULTIBUF_H_ #include #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering" #define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */ #define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */ #define X_MbufGetBufferVersion 0 #define X_MbufCreateImageBuffers 1 #define X_MbufDestroyImageBuffers 2 #define X_MbufDisplayImageBuffers 3 #define X_MbufSetMBufferAttributes 4 #define X_MbufGetMBufferAttributes 5 #define X_MbufSetBufferAttributes 6 #define X_MbufGetBufferAttributes 7 #define X_MbufGetBufferInfo 8 #define X_MbufCreateStereoWindow 9 #define X_MbufClearImageBufferArea 10 /* * update_action field */ #define MultibufferUpdateActionUndefined 0 #define MultibufferUpdateActionBackground 1 #define MultibufferUpdateActionUntouched 2 #define MultibufferUpdateActionCopied 3 /* * update_hint field */ #define MultibufferUpdateHintFrequent 0 #define MultibufferUpdateHintIntermittent 1 #define MultibufferUpdateHintStatic 2 /* * valuemask fields */ #define MultibufferWindowUpdateHint (1L << 0) #define MultibufferBufferEventMask (1L << 0) /* * mono vs. stereo and left vs. right */ #define MultibufferModeMono 0 #define MultibufferModeStereo 1 #define MultibufferSideMono 0 #define MultibufferSideLeft 1 #define MultibufferSideRight 2 /* * clobber state */ #define MultibufferUnclobbered 0 #define MultibufferPartiallyClobbered 1 #define MultibufferFullyClobbered 2 /* * event stuff */ #define MultibufferClobberNotifyMask 0x02000000 #define MultibufferUpdateNotifyMask 0x04000000 #define MultibufferClobberNotify 0 #define MultibufferUpdateNotify 1 #define MultibufferNumberEvents (MultibufferUpdateNotify + 1) #define MultibufferBadBuffer 0 #define MultibufferNumberErrors (MultibufferBadBuffer + 1) #ifndef _MULTIBUF_SERVER_ /* * Extra definitions that will only be needed in the client */ typedef XID Multibuffer; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ int send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Multibuffer buffer; /* buffer of event */ int state; /* see Clobbered constants above */ } XmbufClobberNotifyEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ int send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Multibuffer buffer; /* buffer of event */ } XmbufUpdateNotifyEvent; /* * per-window attributes that can be got */ typedef struct { int displayed_index; /* which buffer is being displayed */ int update_action; /* Undefined, Background, Untouched, Copied */ int update_hint; /* Frequent, Intermittent, Static */ int window_mode; /* Mono, Stereo */ int nbuffers; /* Number of buffers */ Multibuffer *buffers; /* Buffers */ } XmbufWindowAttributes; /* * per-window attributes that can be set */ typedef struct { int update_hint; /* Frequent, Intermittent, Static */ } XmbufSetWindowAttributes; /* * per-buffer attributes that can be got */ typedef struct { Window window; /* which window this belongs to */ unsigned long event_mask; /* events that have been selected */ int buffer_index; /* which buffer is this */ int side; /* Mono, Left, Right */ } XmbufBufferAttributes; /* * per-buffer attributes that can be set */ typedef struct { unsigned long event_mask; /* events that have been selected */ } XmbufSetBufferAttributes; /* * per-screen buffer info (there will be lists of them) */ typedef struct { VisualID visualid; /* visual usuable at this depth */ int max_buffers; /* most buffers for this visual */ int depth; /* depth of buffers to be created */ } XmbufBufferInfo; _XFUNCPROTOBEGIN extern Bool XmbufQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_base_return */, int* /* error_base_return */ #endif ); extern Status XmbufGetVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* major_version_return */, int* /* minor_version_return */ #endif ); extern int XmbufCreateBuffers( #if NeedFunctionPrototypes Display* /* dpy */, Window /* w */, int /* count */, int /* update_action */, int /* update_hint */, Multibuffer* /* buffers */ #endif ); extern void XmbufDestroyBuffers( #if NeedFunctionPrototypes Display* /* dpy */, Window /* window */ #endif ); extern void XmbufDisplayBuffers( #if NeedFunctionPrototypes Display* /* dpy */, int /* count */, Multibuffer* /* buffers */, int /* min_delay */, int /* max_delay */ #endif ); extern Status XmbufGetWindowAttributes( #if NeedFunctionPrototypes Display* /* dpy */, Window /* w */, XmbufWindowAttributes* /* attr */ #endif ); extern void XmbufChangeWindowAttributes( #if NeedFunctionPrototypes Display* /* dpy */, Window /* w */, unsigned long /* valuemask */, XmbufSetWindowAttributes* /* attr */ #endif ); extern Status XmbufGetBufferAttributes( #if NeedFunctionPrototypes Display* /* dpy */, Multibuffer /* b */, XmbufBufferAttributes* /* attr */ #endif ); extern void XmbufChangeBufferAttributes( #if NeedFunctionPrototypes Display* /* dpy */, Multibuffer /* b */, unsigned long /* valuemask */, XmbufSetBufferAttributes* /* attr */ #endif ); extern Status XmbufGetScreenInfo( #if NeedFunctionPrototypes Display* /* dpy */, Drawable /* d */, int* /* nmono_return */, XmbufBufferInfo** /* mono_info_return */, int* /* nstereo_return */, XmbufBufferInfo** /* stereo_info_return */ #endif ); extern Window XmbufCreateStereoWindow( #if NeedFunctionPrototypes Display* /* dpy */, Window /* parent */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, unsigned int /* border_width */, int /* depth */, unsigned int /* class */, Visual* /* visual */, unsigned long /* valuemask */, XSetWindowAttributes* /* attr */, Multibuffer* /* leftp */, Multibuffer* /* rightp */ #endif ); extern void XmbufClearBufferArea( #if NeedFunctionPrototypes Display* /* dpy */, Multibuffer /* buffer */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */, Bool /* exposures */ #endif ); _XFUNCPROTOEND #else typedef Bool (* mbInitFunc)(); struct _mbufScreen; /* declared in multibufst.h */ extern void RegisterMultibufferInit( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, Bool (* /* bufMultibufferInit */)( #if NeedNestedPrototypes ScreenPtr /* pScreen */, struct _mbufScreen * /* pMBScreen */ #endif ) #endif ); struct xMbufBufferInfo; /* declared in multibufst.h */ extern void RegisterDoubleBufferHardware( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* nInfo */, struct xMbufBufferInfo * /* pInfo */, DevUnion * /* frameBuffer */, DevUnion /* selectPlane */, void (* /* CopyBufferBitsFunc */ )(), void (* /* DrawSelectPlaneFunc */ )() #endif ); extern int CreateImageBuffers ( #if NeedFunctionPrototypes WindowPtr /* pWin */, int /* nbuf */, XID * /* ids */, int /* action */, int /* hint */ #endif ); extern void DestroyImageBuffers ( #if NeedFunctionPrototypes WindowPtr /* pWin */ #endif ); extern int DisplayImageBuffers ( #if NeedFunctionPrototypes XID * /* ids */, int /* nbuf */ #endif ); #endif /* _MULTIBUF_SERVER_ */ #endif /* _MULTIBUF_H_ */ vnc_unixsrc/Xvnc/include/extensions/XInput.h0100664000076400007640000007726707120677563020670 0ustar constconst/* $XConsortium: XInput.h,v 1.22 94/04/17 20:11:13 rws Exp $ */ /************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* Definitions used by the library and client */ #ifndef _XINPUT_H_ #define _XINPUT_H_ #ifndef _XLIB_H_ #include #endif #ifndef _XI_H_ #include "XI.h" #endif #define _deviceKeyPress 0 #define _deviceKeyRelease 1 #define _deviceButtonPress 0 #define _deviceButtonRelease 1 #define _deviceMotionNotify 0 #define _deviceFocusIn 0 #define _deviceFocusOut 1 #define _proximityIn 0 #define _proximityOut 1 #define _deviceStateNotify 0 #define _deviceMappingNotify 1 #define _changeDeviceNotify 2 #define FindTypeAndClass(d,type,_class,classid,offset) \ { int _i; XInputClassInfo *_ip; \ type = 0; _class = 0; \ for (_i=0, _ip= ((XDevice *) d)->classes; \ _i< ((XDevice *) d)->num_classes; \ _i++, _ip++) \ if (_ip->input_class == classid) \ {type = _ip->event_type_base + offset; \ _class = ((XDevice *) d)->device_id << 8 | type;}} #define DeviceKeyPress(d,type,_class) \ FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress) #define DeviceKeyRelease(d,type,_class) \ FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease) #define DeviceButtonPress(d,type,_class) \ FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress) #define DeviceButtonRelease(d,type,_class) \ FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease) #define DeviceMotionNotify(d,type,_class) \ FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify) #define DeviceFocusIn(d,type,_class) \ FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn) #define DeviceFocusOut(d,type,_class) \ FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut) #define ProximityIn(d,type,_class) \ FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn) #define ProximityOut(d,type,_class) \ FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut) #define DeviceStateNotify(d,type,_class) \ FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify) #define DeviceMappingNotify(d,type,_class) \ FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify) #define ChangeDeviceNotify(d,type,_class) \ FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify) #define DevicePointerMotionHint(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;} #define DeviceButton1Motion(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;} #define DeviceButton2Motion(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;} #define DeviceButton3Motion(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;} #define DeviceButton4Motion(d,type, _class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;} #define DeviceButton5Motion(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;} #define DeviceButtonMotion(d,type, _class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;} #define DeviceOwnerGrabButton(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;} #define DeviceButtonPressGrab(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;} #define NoExtensionEvent(d,type,_class) \ { _class = ((XDevice *) d)->device_id << 8 | _noExtensionEvent;} #define BadDevice(dpy,error) _xibaddevice(dpy, &error) #define BadClass(dpy,error) _xibadclass(dpy, &error) #define BadEvent(dpy,error) _xibadevent(dpy, &error) #define BadMode(dpy,error) _xibadmode(dpy, &error) #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error) /*************************************************************** * * DeviceKey events. These events are sent by input devices that * support input class Keys. * The location of the X pointer is reported in the coordinate * fields of the x,y and x_root,y_root fields. * */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ XID deviceid; Window root; /* root window event occured on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* x, y coordinates in event window */ int x_root; /* coordinates relative to root */ int y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int keycode; /* detail */ Bool same_screen; /* same screen flag */ unsigned int device_state; /* device key or button mask */ unsigned char axes_count; unsigned char first_axis; int axis_data[6]; } XDeviceKeyEvent; typedef XDeviceKeyEvent XDeviceKeyPressedEvent; typedef XDeviceKeyEvent XDeviceKeyReleasedEvent; /******************************************************************* * * DeviceButton events. These events are sent by extension devices * that support input class Buttons. * */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ XID deviceid; Window root; /* root window that the event occured on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* x, y coordinates in event window */ int x_root; /* coordinates relative to root */ int y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ Bool same_screen; /* same screen flag */ unsigned int device_state; /* device key or button mask */ unsigned char axes_count; unsigned char first_axis; int axis_data[6]; } XDeviceButtonEvent; typedef XDeviceButtonEvent XDeviceButtonPressedEvent; typedef XDeviceButtonEvent XDeviceButtonReleasedEvent; /******************************************************************* * * DeviceMotionNotify event. These events are sent by extension devices * that support input class Valuators. * */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ XID deviceid; Window root; /* root window that the event occured on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* x, y coordinates in event window */ int x_root; /* coordinates relative to root */ int y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ char is_hint; /* detail */ Bool same_screen; /* same screen flag */ unsigned int device_state; /* device key or button mask */ unsigned char axes_count; unsigned char first_axis; int axis_data[6]; } XDeviceMotionEvent; /******************************************************************* * * DeviceFocusChange events. These events are sent when the focus * of an extension device that can be focused is changed. * */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ XID deviceid; int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* * NotifyAncestor, NotifyVirtual, NotifyInferior, * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer, * NotifyPointerRoot, NotifyDetailNone */ Time time; } XDeviceFocusChangeEvent; typedef XDeviceFocusChangeEvent XDeviceFocusInEvent; typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent; /******************************************************************* * * ProximityNotify events. These events are sent by those absolute * positioning devices that are capable of generating proximity information. * */ typedef struct { int type; /* ProximityIn or ProximityOut */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; XID deviceid; Window root; Window subwindow; Time time; int x, y; int x_root, y_root; unsigned int state; Bool same_screen; unsigned int device_state; /* device key or button mask */ unsigned char axes_count; unsigned char first_axis; int axis_data[6]; } XProximityNotifyEvent; typedef XProximityNotifyEvent XProximityInEvent; typedef XProximityNotifyEvent XProximityOutEvent; /******************************************************************* * * DeviceStateNotify events are generated on EnterWindow and FocusIn * for those clients who have selected DeviceState. * */ typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; } XInputClass; typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; XID deviceid; Time time; int num_classes; char data[64]; } XDeviceStateNotifyEvent; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; unsigned char num_valuators; unsigned char mode; int valuators[6]; } XValuatorStatus; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; short num_keys; char keys[32]; } XKeyStatus; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; short num_buttons; char buttons[32]; } XButtonStatus; /******************************************************************* * * DeviceMappingNotify event. This event is sent when the key mapping, * modifier mapping, or button mapping of an extension device is changed. * */ typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* unused */ XID deviceid; Time time; int request; /* one of MappingModifier, MappingKeyboard, MappingPointer */ int first_keycode;/* first keycode */ int count; /* defines range of change w. first_keycode*/ } XDeviceMappingEvent; /******************************************************************* * * ChangeDeviceNotify event. This event is sent when an * XChangeKeyboard or XChangePointer request is made. * */ typedef struct { int type; unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* unused */ XID deviceid; Time time; int request; /* NewPointer or NewKeyboard */ } XChangeDeviceNotifyEvent; /******************************************************************* * * Control structures for input devices that support input class * Feedback. These are used by the XGetFeedbackControl and * XChangeFeedbackControl functions. * */ typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; } XFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int click; int percent; int pitch; int duration; int led_mask; int global_auto_repeat; char auto_repeats[32]; } XKbdFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int accelNum; int accelDenom; int threshold; } XPtrFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int resolution; int minVal; int maxVal; } XIntegerFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int max_symbols; int num_syms_supported; KeySym *syms_supported; } XStringFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int percent; int pitch; int duration; } XBellFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int led_values; int led_mask; } XLedFeedbackState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; } XFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int accelNum; int accelDenom; int threshold; } XPtrFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int click; int percent; int pitch; int duration; int led_mask; int led_value; int key; int auto_repeat_mode; } XKbdFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int num_keysyms; KeySym *syms_to_display; } XStringFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int int_to_display; } XIntegerFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int percent; int pitch; int duration; } XBellFeedbackControl; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; XID id; int led_mask; int led_values; } XLedFeedbackControl; /******************************************************************* * * Device control structures. * */ typedef struct { XID control; int length; } XDeviceControl; typedef struct { XID control; int length; int first_valuator; int num_valuators; int *resolutions; } XDeviceResolutionControl; typedef struct { XID control; int length; int num_valuators; int *resolutions; int *min_resolutions; int *max_resolutions; } XDeviceResolutionState; /******************************************************************* * * An array of XDeviceList structures is returned by the * XListInputDevices function. Each entry contains information * about one input device. Among that information is an array of * pointers to structures that describe the characteristics of * the input device. * */ typedef struct _XAnyClassinfo *XAnyClassPtr; typedef struct _XAnyClassinfo { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; } XAnyClassInfo; typedef struct _XDeviceInfo *XDeviceInfoPtr; typedef struct _XDeviceInfo { XID id; Atom type; char *name; int num_classes; int use; XAnyClassPtr inputclassinfo; } XDeviceInfo; typedef struct _XKeyInfo *XKeyInfoPtr; typedef struct _XKeyInfo { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; unsigned short min_keycode; unsigned short max_keycode; unsigned short num_keys; } XKeyInfo; typedef struct _XButtonInfo *XButtonInfoPtr; typedef struct _XButtonInfo { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; short num_buttons; } XButtonInfo; typedef struct _XAxisInfo *XAxisInfoPtr; typedef struct _XAxisInfo { int resolution; int min_value; int max_value; } XAxisInfo; typedef struct _XValuatorInfo *XValuatorInfoPtr; typedef struct _XValuatorInfo { #if defined(__cplusplus) || defined(c_plusplus) XID c_class; #else XID class; #endif int length; unsigned char num_axes; unsigned char mode; unsigned long motion_buffer; XAxisInfoPtr axes; } XValuatorInfo; /******************************************************************* * * An XDevice structure is returned by the XOpenDevice function. * It contains an array of pointers to XInputClassInfo structures. * Each contains information about a class of input supported by the * device, including a pointer to an array of data for each type of event * the device reports. * */ typedef struct { unsigned char input_class; unsigned char event_type_base; } XInputClassInfo; typedef struct { XID device_id; int num_classes; XInputClassInfo *classes; } XDevice; /******************************************************************* * * The following structure is used to return information for the * XGetSelectedExtensionEvents function. * */ typedef struct { XEventClass event_type; XID device; } XEventList; /******************************************************************* * * The following structure is used to return motion history data from * an input device that supports the input class Valuators. * This information is returned by the XGetDeviceMotionEvents function. * */ typedef struct { Time time; int *data; } XDeviceTimeCoord; /******************************************************************* * * Device state structure. * This is returned by the XQueryDeviceState request. * */ typedef struct { XID device_id; int num_classes; XInputClass *data; } XDeviceState; /******************************************************************* * * Note that the mode field is a bitfield that reports the Proximity * status of the device as well as the mode. The mode field should * be OR'd with the mask DeviceMode and compared with the values * Absolute and Relative to determine the mode, and should be OR'd * with the mask ProximityState and compared with the values InProximity * and OutOfProximity to determine the proximity state. * */ typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; unsigned char num_valuators; unsigned char mode; int *valuators; } XValuatorState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; short num_keys; char keys[32]; } XKeyState; typedef struct { #if defined(__cplusplus) || defined(c_plusplus) unsigned char c_class; #else unsigned char class; #endif unsigned char length; short num_buttons; char buttons[32]; } XButtonState; /******************************************************************* * * Function definitions. * */ _XFUNCPROTOBEGIN extern int XChangeKeyboardDevice( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */ #endif ); extern int XChangePointerDevice( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* xaxis */, int /* yaxis */ #endif ); extern int XGrabDevice( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Window /* grab_window */, Bool /* ownerEvents */, int /* event count */, XEventClass* /* event_list */, int /* this_device_mode */, int /* other_devices_mode */, Time /* time */ #endif ); extern int XUngrabDevice( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Time /* time */ #endif ); extern int XGrabDeviceKey( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned int /* key */, unsigned int /* modifiers */, XDevice* /* modifier_device */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_count */, XEventClass* /* event_list */, int /* this_device_mode */, int /* other_devices_mode */ #endif ); extern int XUngrabDeviceKey( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned int /* key */, unsigned int /* modifiers */, XDevice* /* modifier_dev */, Window /* grab_window */ #endif ); extern int XGrabDeviceButton( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned int /* button */, unsigned int /* modifiers */, XDevice* /* modifier_device */, Window /* grab_window */, Bool /* owner_events */, unsigned int /* event_count */, XEventClass* /* event_list */, int /* this_device_mode */, int /* other_devices_mode */ #endif ); extern int XUngrabDeviceButton( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned int /* button */, unsigned int /* modifiers */, XDevice* /* modifier_dev */, Window /* grab_window */ #endif ); extern int XAllowDeviceEvents( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* event_mode */, Time /* time */ #endif ); extern int XGetDeviceFocus( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Window* /* focus */, int* /* revert_to */, Time* /* time */ #endif ); extern int XSetDeviceFocus( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Window /* focus */, int /* revert_to */, Time /* time */ #endif ); extern XFeedbackState *XGetFeedbackControl( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int* /* num_feedbacks */ #endif ); extern int XFreeFeedbackList( #if NeedFunctionPrototypes XFeedbackState* /* list */ #endif ); extern int XChangeFeedbackControl( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned long /* mask */, XFeedbackControl* /* f */ #endif ); extern int XDeviceBell( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, XID /* feedbackclass */, XID /* feedbackid */, int /* percent */ #endif ); extern KeySym *XGetDeviceKeyMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, #if NeedWidePrototypes unsigned int /* first */, #else KeyCode /* first */, #endif int /* keycount */, int* /* syms_per_code */ #endif ); extern int XChangeDeviceKeyMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* first */, int /* syms_per_code */, KeySym* /* keysyms */, int /* count */ #endif ); extern XModifierKeymap *XGetDeviceModifierMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */ #endif ); extern int XSetDeviceModifierMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, XModifierKeymap* /* modmap */ #endif ); extern int XSetDeviceButtonMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned char* /* map[] */, int /* nmap */ #endif ); extern int XGetDeviceButtonMapping( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, unsigned char* /* map[] */, unsigned int /* nmap */ #endif ); extern XDeviceState *XQueryDeviceState( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */ #endif ); extern int XFreeDeviceState( #if NeedFunctionPrototypes XDeviceState* /* list */ #endif ); extern XExtensionVersion *XGetExtensionVersion( #if NeedFunctionPrototypes Display* /* display */, _Xconst char* /* name */ #endif ); extern XDeviceInfo *XListInputDevices( #if NeedFunctionPrototypes Display* /* display */, int* /* ndevices */ #endif ); extern int XFreeDeviceList( #if NeedFunctionPrototypes XDeviceInfo* /* list */ #endif ); extern XDevice *XOpenDevice( #if NeedFunctionPrototypes Display* /* display */, XID /* id */ #endif ); extern int XCloseDevice( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */ #endif ); extern int XSetDeviceMode( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* mode */ #endif ); extern int XSetDeviceValuators( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int* /* valuators */, int /* first_valuator */, int /* num_valuators */ #endif ); extern XDeviceControl *XGetDeviceControl( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* control */ #endif ); extern int XChangeDeviceControl( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, int /* control */, XDeviceControl* /* d */ #endif ); extern int XSelectExtensionEvent( #if NeedFunctionPrototypes Display* /* display */, Window /* w */, XEventClass* /* event_list */, int /* count */ #endif ); extern int XGetSelectedExtensionEvents( #if NeedFunctionPrototypes Display* /* display */, Window /* w */, int* /* this_client_count */, XEventClass** /* this_client_list */, int* /* all_clients_count */, XEventClass** /* all_clients_list */ #endif ); extern int XChangeDeviceDontPropagateList( #if NeedFunctionPrototypes Display* /* display */, Window /* window */, int /* count */, XEventClass* /* events */, int /* mode */ #endif ); extern XEventClass *XGetDeviceDontPropagateList( #if NeedFunctionPrototypes Display* /* display */, Window /* window */, int* /* count */ #endif ); extern Status XSendExtensionEvent( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Window /* dest */, Bool /* prop */, int /* count */, XEventClass* /* list */, XEvent* /* event */ #endif ); extern XDeviceTimeCoord *XGetDeviceMotionEvents( #if NeedFunctionPrototypes Display* /* display */, XDevice* /* device */, Time /* start */, Time /* stop */, int* /* nEvents */, int* /* mode */, int* /* axis_count */ #endif ); extern int XFreeDeviceMotionEvents( #if NeedFunctionPrototypes XDeviceTimeCoord* /* events */ #endif ); extern int XFreeDeviceControl( #if NeedFunctionPrototypes XDeviceControl* /* control */ #endif ); _XFUNCPROTOEND #endif /* _XINPUT_H_ */ vnc_unixsrc/Xvnc/include/extensions/lbximage.h0100664000076400007640000001031507120677563021206 0ustar constconst/* $XConsortium: lbximage.h /main/6 1996/11/04 16:48:27 rws $ */ /****************************************************************************** Copyright (c) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ******************************************************************************/ #ifndef _LBX_IMAGE_H_ #define _LBX_IMAGE_H_ typedef struct _LbxBitmapCompMethod { char *methodName; int inited; int methodOpCode; /* to be filled on reply from server */ int (*compInit)( #if NeedFunctionPrototypes void #endif ); int (*compFunc)( #if NeedFunctionPrototypes unsigned char * /* inbuf */, unsigned char * /* outbuf */, int /* outbufSize */, int /* image_bytes */, int /* pixels_per_line */, int /* padded_bytes_per_scanline */, int /* reverse_bits */, int * /* bytesCompressed */ #endif ); int (*decompFunc)( #if NeedFunctionPrototypes unsigned char * /* inbuf */, unsigned char * /* outbuf */, int /* image_bytes */, int /* pixels_per_line */, int /* padded_bytes_per_scanline */, int /* reverse_bits */ #endif ); } LbxBitmapCompMethod; #define LBX_MAX_DEPTHS 5 typedef struct _LbxPixmapCompMethod { char *methodName; unsigned formatMask; int depthCount; int depths[LBX_MAX_DEPTHS]; int inited; int methodOpCode; /* to be filled on reply from server */ int (*compInit)( #if NeedFunctionPrototypes void #endif ); int (*compFunc)( #if NeedFunctionPrototypes char * /* inbuf */, char * /* outbuf */, int /* outbufSize */, int /* format */, int /* depth */, int /* num_scan_lines */, int /* scan_line_size */, int * /* bytesCompressed */ #endif ); int (*decompFunc)( #if NeedFunctionPrototypes char * /* inbuf */, char * /* outbuf */, int /* num_scan_lines */, int /* scan_line_size */ #endif ); } LbxPixmapCompMethod; extern int LbxImageEncodePackBits ( #if NeedFunctionPrototypes char * /* inbuf */, char * /* outbuf */, int /* outbufSize */, int /* format */, int /* depth */, int /* num_scan_lines */, int /* scan_line_size */, int * /* bytesCompressed */ #endif ); extern int LbxImageEncodeFaxG42D ( #if NeedFunctionPrototypes unsigned char * /* inbuf */, unsigned char * /* outbuf */, int /* outbufSize */, int /* image_bytes */, int /* pixels_per_line */, int /* padded_bytes_per_scanline */, int /* reverse_bits */, int * /* bytesCompressed */ #endif ); extern int LbxImageDecodePackBits ( #if NeedFunctionPrototypes char * /* inbuf */, char * /* outbuf */, int /* num_scan_lines */, int /* scan_line_size */ #endif ); extern int LbxImageDecodeFaxG42D ( #if NeedFunctionPrototypes unsigned char * /* inbuf */, unsigned char * /* outbuf */, int /* image_bytes */, int /* pixels_per_line */, int /* padded_bytes_per_scanline */, int /* reverse_bits */ #endif ); #define LBX_IMAGE_COMPRESS_SUCCESS 0 #define LBX_IMAGE_COMPRESS_NO_SUPPORT 1 #define LBX_IMAGE_COMPRESS_BAD_MALLOC 2 #define LBX_IMAGE_COMPRESS_NOT_WORTH_IT 3 #endif /* _LBX_IMAGE_H_ */ vnc_unixsrc/Xvnc/include/extensions/shapestr.h0100664000076400007640000001563507120677563021261 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: shapestr.h,v 1.13 94/04/17 20:11:24 rws Exp $ */ #ifndef _SHAPESTR_H_ #define _SHAPESTR_H_ /* * Protocol requests constants and alignment values * These would really be in SHAPE's X.h and Xproto.h equivalents */ #include "shape.h" #define Window CARD32 #define Time CARD32 #define SHAPENAME "SHAPE" #define SHAPE_MAJOR_VERSION 1 /* current version numbers */ #define SHAPE_MINOR_VERSION 0 typedef struct _ShapeQueryVersion { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeQueryVersion */ CARD16 length B16; } xShapeQueryVersionReq; #define sz_xShapeQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of SHAPE protocol */ CARD16 minorVersion B16; /* minor version of SHAPE protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xShapeQueryVersionReply; #define sz_xShapeQueryVersionReply 32 typedef struct _ShapeRectangles { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeRectangles */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ CARD8 pad0; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; } xShapeRectanglesReq; /* followed by xRects */ #define sz_xShapeRectanglesReq 16 typedef struct _ShapeMask { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeMask */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD16 junk B16; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; CARD32 src B32; /* 1 bit pixmap */ } xShapeMaskReq; #define sz_xShapeMaskReq 20 typedef struct _ShapeCombine { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeCombine */ CARD16 length B16; CARD8 op; /* Set, ... */ CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 srcKind; /* ShapeBounding or ShapeClip */ CARD8 junk; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; Window src B32; } xShapeCombineReq; #define sz_xShapeCombineReq 20 typedef struct _ShapeOffset { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeOffset */ CARD16 length B16; CARD8 destKind; /* ShapeBounding or ShapeClip */ CARD8 junk1; /* not used */ CARD16 junk2 B16; /* not used */ Window dest B32; INT16 xOff B16; INT16 yOff B16; } xShapeOffsetReq; #define sz_xShapeOffsetReq 16 typedef struct _ShapeQueryExtents { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeQueryExtents */ CARD16 length B16; Window window B32; } xShapeQueryExtentsReq; #define sz_xShapeQueryExtentsReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD8 boundingShaped; /* window has bounding shape */ CARD8 clipShaped; /* window has clip shape */ CARD16 unused1 B16; INT16 xBoundingShape B16; /* extents of bounding shape */ INT16 yBoundingShape B16; CARD16 widthBoundingShape B16; CARD16 heightBoundingShape B16; INT16 xClipShape B16; /* extents of clip shape */ INT16 yClipShape B16; CARD16 widthClipShape B16; CARD16 heightClipShape B16; CARD32 pad1 B32; } xShapeQueryExtentsReply; #define sz_xShapeQueryExtentsReply 32 typedef struct _ShapeSelectInput { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeSelectInput */ CARD16 length B16; Window window B32; BYTE enable; /* xTrue -> send events */ BYTE pad1; CARD16 pad2 B16; } xShapeSelectInputReq; #define sz_xShapeSelectInputReq 12 typedef struct _ShapeNotify { BYTE type; /* always eventBase + ShapeNotify */ BYTE kind; /* either ShapeBounding or ShapeClip */ CARD16 sequenceNumber B16; Window window B32; INT16 x B16; INT16 y B16; /* extents of new shape */ CARD16 width B16; CARD16 height B16; Time time B32; /* time of change */ BYTE shaped; /* set when a shape actual exists */ BYTE pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xShapeNotifyEvent; #define sz_xShapeNotifyEvent 32 typedef struct _ShapeInputSelected { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeInputSelected */ CARD16 length B16; Window window B32; } xShapeInputSelectedReq; #define sz_xShapeInputSelectedReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 enabled; /* current status */ CARD16 sequenceNumber B16; CARD32 length B32; /* 0 */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xShapeInputSelectedReply; #define sz_xShapeInputSelectedReply 32 typedef struct _ShapeGetRectangles { CARD8 reqType; /* always ShapeReqCode */ CARD8 shapeReqType; /* always X_ShapeGetRectangles */ CARD16 length B16; Window window B32; CARD8 kind; /* ShapeBounding or ShapeClip */ CARD8 junk1; CARD16 junk2 B16; } xShapeGetRectanglesReq; #define sz_xShapeGetRectanglesReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */ CARD16 sequenceNumber B16; CARD32 length B32; /* not zero */ CARD32 nrects B32; /* number of rectangles */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xShapeGetRectanglesReply; /* followed by xRectangles */ #define sz_xShapeGetRectanglesReply 32 #undef Window #undef Time #endif /* _SHAPESTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/Print.h0100664000076400007640000004067407120677563020525 0ustar constconst/* $XConsortium: Print.h /main/3 1996/12/10 14:59:02 rws $ */ /****************************************************************************** ****************************************************************************** ** ** File: Print.h ** ** Description: Definitions needed by the server, library, and ** clients. Subportion restricted to library and ** clients. ** ** Server, Library, Client portion has: ** o All sz_* defines ** o Revision and Name defines ** o Common defines and constants (e.g. Keywords, Masks) ** o Extension version structure ** ** Library and client subportion has: ** o Convience Marcos ** o Client side data structures ** o Client side event structures (non wire) ** o Library function prototypes ** o some private stuff denoted with _whatever ** ** Printstr.h for server and library, but NOT clients. ** ****************************************************************************** ** ** (c) Copyright 1996 Hewlett-Packard Company ** (c) Copyright 1996 International Business Machines Corp. ** (c) Copyright 1996 Sun Microsystems, Inc. ** (c) Copyright 1996 Novell, Inc. ** (c) Copyright 1996 Digital Equipment Corp. ** (c) Copyright 1996 Fujitsu Limited ** (c) Copyright 1996 Hitachi, Ltd. ** ** Permission is hereby granted, free of charge, to any person obtaining a copy ** of this software and associated documentation files (the "Software"), to deal ** in the Software without restriction, including without limitation the rights ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ** copies of the Software, and to permit persons to whom the Software is ** furnished to do so, subject to the following conditions: ** ** The above copyright notice and this permission notice shall be included in ** all copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ** ** Except as contained in this notice, the names of the copyright holders shall ** not be used in advertising or otherwise to promote the sale, use or other ** dealings in this Software without prior written authorization from said ** copyright holders. ** ****************************************************************************** *****************************************************************************/ #ifndef _XpPrint_H_ #define _XpPrint_H_ #ifndef _XP_PRINT_SERVER_ #include #include #include #endif /* _XP_PRINT_SERVER_ */ #include _XFUNCPROTOBEGIN /****************************************************************************** * * Definitions used by the server, library and client. */ /******************************************************************** * * Naming and versioning information. */ #define XP_PRINTNAME "XpExtension" /* * Add a define below for each major extension release. */ #define XP_DONT_CHECK 0 #define XP_INITIAL_RELEASE 1 /* * For each single entry above, create one major/minor pair. */ #define XP_PROTO_MAJOR 1 #define XP_PROTO_MINOR 0 /* * Identify current version. */ #define XP_MAJOR_VERSION XP_PROTO_MAJOR #define XP_MINOR_VERSION XP_PROTO_MINOR /* * Misc version defines. */ #define XP_ABSENT 0 /* Prior to XP Print support */ #define XP_PRESENT 1 /* With XP Print support */ /******************************************************************** * * Xp Print Error codes. */ #define XP_ERRORS 3 /* number of error types */ #define XPBadContext 0 /* Print Context invalid or missing */ #define XPBadSequence 1 /* Illegal sequence of XP operations */ #define XPBadResourceID 2 /* X-resource not valid */ /******************************************************************** * * Xp Print Event masks and codes. * */ #define XP_EVENTS 2 /* number of event types */ #define XPNoEventMask 0 /* not an event - just a null mask */ #define XPPrintMask (1L<<0) #define XPAttributeMask (1L<<1) #define XPPrintNotify 0 /* contains "detail" - see below */ #define XPAttributeNotify 1 /* contains "detail" - see below */ #define XPStartJobNotify 0 /* value for "detail" in XPPrintNotify*/ #define XPEndJobNotify 1 #define XPStartDocNotify 2 #define XPEndDocNotify 3 #define XPStartPageNotify 4 #define XPEndPageNotify 5 /******************************************************************** * * Xp Print Attribute Object codes (subset of ISO DPA 10175). The * Xp Server can get and set any of the values, while the Xp Library * may only be able to set a subset of the attribute objects. * * note: the codes are also used as "detail" for XPAttributeNotify * * note: XPPageAttr is not defined in ISO DPA 10175. It is unique * to Xp, and its attributes are a proper subset of XPDocAttr. */ typedef unsigned char XPAttributes; /* type of Xp*Attr codes */ #define XP_ATTRIBUTES 5 /* those attrs currently supported */ #define XPJobAttr 1 /* get/set */ #define XPDocAttr 2 /* get/set */ #define XPPageAttr 3 /* get/set - subset of XPDocAttr */ #define XPPrinterAttr 4 /* get only (library) */ #define XPServerAttr 5 /* get only (library), no context needed */ /* * note: ISO DPA 10175 defines a number of "attribute objects", of * which POSIX 1387.4 and the SI Xp will only support a * subset. */ #define XPMediumAttr 6 /* DPA-Object Medium */ #define XPFontAttr 7 /* DPA-Object Font */ #define XPResAttr 8 /* DPA-Object Resource */ #define XPTransAttr 9 /* DPA-Object Transfer method */ #define XPDelAttr 10 /* DPA-Object Delivery method */ #define XPAuxSPkg 11 /* DPA-Object Auxiliary sheet package */ #define XPAuxS 12 /* DPA-Object Auxiliary sheet */ #define XPFinishAttr 13 /* DPA-Object Finishing */ #define XPOutputAttr 14 /* DPA-Object Output method */ #define XPImpAttr 15 /* DPA-Object Imposition */ #define XPSchedAttr 16 /* DPA-Object Scheduler */ #define XPIntJobAttr 17 /* DPA-Object Initial value job */ #define XPIntDocAttr 18 /* DPA-Object Initial value document */ #define XPResConAttr 19 /* DPA-Object Resource context */ /* * Replacement rules for XpSetAttributes */ typedef unsigned char XPAttrReplacement; #define XPAttrReplace 1 #define XPAttrMerge 2 /* * Return codes for XpGetDocumentData */ typedef unsigned char XPGetDocStatus; #define XPGetDocFinished 0 /* normal termination */ #define XPGetDocSecondConsumer 1 /* setup error */ #define XPGetDocError 2 /* runtime error, see generated error */ /* * Save data types for XpStartJob. */ typedef unsigned char XPSaveData; #define XPSpool 1 /* Job data sent to spooler */ #define XPGetData 2 /* Job data via XpGetDocumentData */ /* * Document types for XpStartDoc. */ typedef unsigned char XPDocumentType; #define XPDocNormal 1 /* Doc data handled by Xserver */ #define XPDocRaw 2 /* Doc data passed through Xserver */ /******************************************************************** * * Xp Print Property Names */ #ifndef _XP_PRINT_SERVER_ /****************************************************************************** * * Definitions used by the library and clients only. */ /******************************************************************* * * General API defines and such. */ /* * Print Context for XpInitContext and related calls. */ typedef XID XPContext; /* * Struct for XpGetPrinterList. */ typedef struct { char *name; /* name */ char *desc; /* localized description */ } XPPrinterRec, *XPPrinterList; /* * Typedefs for XpGetDocumentData */ typedef void (*XPSaveProc)( Display *display, XPContext context, unsigned char *data, unsigned int data_len, XPointer client_data); typedef void (*XPFinishProc)( Display *display, XPContext context, XPGetDocStatus status, XPointer client_data); /* * Typedefs for XpSetLocaleHinter and XpGetLocaleHinter */ typedef char * (*XPHinterProc)(); /******************************************************************* * * Extension version structures. * */ typedef struct { int present; short major_version; short minor_version; } XExtensionVersion; /******************************************************************** * * Event structs for clients. * * note: these events are relative to a print context, and * not to a window as in core X. */ typedef struct { int type; /* base + XPPrintNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ XPContext context; /* print context where operation was requested */ Bool cancel; /* was detailed event canceled */ int detail; /* XPStartJobNotify, XPEndJobNotify, XPStartDocNotify, XPEndDocNotify, XPStartPageNotify, XPEndPageNotify */ } XPPrintEvent; typedef struct { int type; /* base + XPAttributeNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ XPContext context; /* print context where operation was requested */ int detail; /* XPJobAttr, XPDocAttr, XPPageAttr, XPPrinterAttr, XPSpoolerAttr, XPMediumAttr, XPServerAttr */ } XPAttributeEvent; typedef struct { int type; /* base + XPDataReadyNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if from a SendEvent request */ Display *display; /* Display the event was read from */ XPContext context; /* print context where operation was requested */ unsigned long available; /* bytes available for retrieval */ } XPDataReadyEvent; /********************************************************** * * Function prototypes for library side. */ #if NeedFunctionPrototypes extern XPContext XpCreateContext ( Display *display, char *printer_name ); extern void XpSetContext ( Display *display, XPContext print_context ); extern XPContext XpGetContext ( Display *display ); extern void XpDestroyContext ( Display *display, XPContext print_context ); extern Screen *XpGetScreenOfContext ( Display *display, XPContext print_context ); extern Status XpGetPageDimensions ( Display *display, XPContext print_context, unsigned short *width, /* return value */ unsigned short *height, /* return value */ XRectangle *reproducible_area /* return value */ ); extern void XpStartJob ( Display *display, XPSaveData save_data ); extern void XpEndJob ( Display *display ); extern void XpCancelJob ( Display *display, Bool discard ); extern void XpStartDoc ( Display *display, XPDocumentType type ); extern void XpEndDoc ( Display *display ); extern void XpCancelDoc ( Display *display, Bool discard ); extern void XpPutDocumentData ( Display *display, Drawable drawable, unsigned char *data, int data_len, char *doc_fmt, char *options ); extern Status XpGetDocumentData ( Display *display, XPContext context, XPSaveProc save_proc, XPFinishProc finish_proc, XPointer client_data ); extern void XpStartPage ( Display *display, Window window ); extern void XpEndPage ( Display *display ); extern void XpCancelPage ( Display *display, Bool discard ); extern void XpSelectInput ( Display *display, XPContext print_context, unsigned long event_mask ); extern unsigned long XpInputSelected ( Display *display, XPContext print_context, unsigned long *all_events_mask ); extern Bool XpSetImageResolution ( Display *display, XPContext print_context, int image_res, int *prev_res ); extern int XpGetImageResolution ( Display *display, XPContext print_context ); extern char *XpGetAttributes ( Display *display, XPContext print_context, XPAttributes type ); extern void XpSetAttributes ( Display *display, XPContext print_context, XPAttributes type, char *pool, XPAttrReplacement replacement_rule ); extern char *XpGetOneAttribute ( Display *display, XPContext print_context, XPAttributes type, char *attribute_name ); extern XPPrinterList XpGetPrinterList ( Display *display, char *printer_name, int *list_count /* return value */ ); extern void XpFreePrinterList ( XPPrinterList printer_list ); extern void XpRehashPrinterList ( Display *display ); extern Status XpQueryVersion ( Display *display, short *major_version, /* return value */ short *minor_version /* return value */ ); extern Bool XpQueryExtension ( Display *display, int *event_base_return, /* return value */ int *error_base_return /* return value */ ); extern Screen **XpQueryScreens ( Display *display, int *list_count /* return value */ ); extern Status XpGetPdmStartParams ( Display *print_display, Window print_window, XPContext print_context, Display *video_display, Window video_window, Display **selection_display, /* return value */ Atom *selection, /* return value */ Atom *type, /* return value */ int *format, /* return value */ unsigned char **data, /* return value */ int *nelements /* return value */ ); extern Status XpGetAuthParams ( Display *print_display, Display *video_display, Display **selection_display, /* return value */ Atom *selection, /* return value */ Atom *target /* return value */ ); extern Status XpSendAuth ( Display *display, Window window ); extern Status XpSendOneTicket ( Display *display, Window window, Xauth *ticket, Bool more ); extern void XpSetLocaleHinter ( XPHinterProc hinter_proc, char *hinter_desc ); extern char *XpGetLocaleHinter ( XPHinterProc *hinter_proc ); extern char *XpGetLocaleNetString(); extern char *XpNotifyPdm ( Display *print_display, Window print_window, XPContext print_context, Display *video_display, Window video_window, Bool auth_flag ); #else extern XPContext XpCreateContext (); extern void XpSetContext (); extern XPContext XpGetContext (); extern void XpDestroyContext (); extern Screen *XpGetScreenOfContext (); extern Status XpGetPageDimensions (); extern void XpStartJob (); extern void XpEndJob (); extern void XpCancelJob (); extern void XpStartDoc (); extern void XpEndDoc (); extern void XpCancelDoc (); extern void XpPutDocumentData (); extern Status XpGetDocumentData (); extern void XpStartPage (); extern void XpEndPage (); extern void XpCancelPage (); extern void XpSelectInput (); extern unsigned long XpInputSelected (); extern Bool XpSetImageResolution (); extern int XpGetImageResolution (); extern char *XpGetAttributes (); extern void XpSetAttributes (); extern char *XpGetOneAttribute (); extern XPPrinterList XpGetPrinterList (); extern void XpFreePrinterList (); extern void XpRehashPrinterList (); extern Status XpQueryVersion (); extern Bool XpQueryExtension (); extern Screen **XpQueryScreens (); extern Status XpGetPdmStartParams (); extern Status XpGetAuthParams (); extern Status XpSendAuth (); extern Status XpSendOneTicket (); extern void XpSetLocaleHinter (); extern char *XpGetLocaleHinter (); extern char *XpGetLocaleNetString (); extern char *XpNotifyPdm (); #endif /* NeedFunctionPrototypes */ #endif /* _XP_PRINT_SERVER_ */ _XFUNCPROTOEND #endif /* _XpPrint_H_ */ vnc_unixsrc/Xvnc/include/extensions/extutil.h0100664000076400007640000001466407120677563021127 0ustar constconst/* * $XConsortium: extutil.h,v 1.15 94/10/07 15:36:33 kaleb Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Jim Fulton, MIT X Consortium * * Xlib Extension-Writing Utilities * * This package contains utilities for writing the client API for various * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND * ARE SUBJECT TO CHANGE! */ #ifndef _EXTUTIL_H_ #define _EXTUTIL_H_ /* * We need to keep a list of open displays since the Xlib display list isn't * public. We also have to per-display info in a separate block since it isn't * stored directly in the Display structure. */ typedef struct _XExtDisplayInfo { struct _XExtDisplayInfo *next; /* keep a linked list */ Display *display; /* which display this is */ XExtCodes *codes; /* the extension protocol codes */ XPointer data; /* extra data for extension to use */ } XExtDisplayInfo; typedef struct _XExtensionInfo { XExtDisplayInfo *head; /* start of list */ XExtDisplayInfo *cur; /* most recently used */ int ndisplays; /* number of displays */ } XExtensionInfo; typedef struct _XExtensionHooks { int (*create_gc)( #if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ #endif ); int (*copy_gc)( #if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ #endif ); int (*flush_gc)( #if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ #endif ); int (*free_gc)( #if NeedNestedPrototypes Display* /* display */, GC /* gc */, XExtCodes* /* codes */ #endif ); int (*create_font)( #if NeedNestedPrototypes Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ #endif ); int (*free_font)( #if NeedNestedPrototypes Display* /* display */, XFontStruct* /* fs */, XExtCodes* /* codes */ #endif ); int (*close_display)( #if NeedNestedPrototypes Display* /* display */, XExtCodes* /* codes */ #endif ); Bool (*wire_to_event)( #if NeedNestedPrototypes Display* /* display */, XEvent* /* re */, xEvent* /* event */ #endif ); Status (*event_to_wire)( #if NeedNestedPrototypes Display* /* display */, XEvent* /* re */, xEvent* /* event */ #endif ); int (*error)( #if NeedNestedPrototypes Display* /* display */, xError* /* err */, XExtCodes* /* codes */, int* /* ret_code */ #endif ); char *(*error_string)( #if NeedNestedPrototypes Display* /* display */, int /* code */, XExtCodes* /* codes */, char* /* buffer */, int /* nbytes */ #endif ); } XExtensionHooks; extern XExtensionInfo *XextCreateExtension( #if NeedFunctionPrototypes void #endif ); extern void XextDestroyExtension( #if NeedFunctionPrototypes XExtensionInfo* /* info */ #endif ); extern XExtDisplayInfo *XextAddDisplay( #if NeedFunctionPrototypes XExtensionInfo* /* extinfo */, Display* /* dpy */, char* /* ext_name */, XExtensionHooks* /* hooks */, int /* nevents */, XPointer /* data */ #endif ); extern int XextRemoveDisplay( #if NeedFunctionPrototypes XExtensionInfo* /* extinfo */, Display* /* dpy */ #endif ); extern XExtDisplayInfo *XextFindDisplay( #if NeedFunctionPrototypes XExtensionInfo* /* extinfo */, Display* /* dpy */ #endif ); #define XextHasExtension(i) ((i) && ((i)->codes)) #define XextCheckExtension(dpy,i,name,val) \ if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } #define XextSimpleCheckExtension(dpy,i,name) \ if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } /* * helper macros to generate code that is common to all extensions; caller * should prefix it with static if extension source is in one file; this * could be a utility function, but have to stack 6 unused arguments for * something that is called many, many times would be bad. */ #define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ XExtDisplayInfo *proc (dpy) \ register Display *dpy; \ { \ XExtDisplayInfo *dpyinfo; \ if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ return dpyinfo; \ } #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ int proc (dpy, codes) \ Display *dpy; \ XExtCodes *codes; \ { \ return XextRemoveDisplay (extinfo, dpy); \ } #define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ char *proc (dpy, code, codes, buf, n) \ Display *dpy; \ int code; \ XExtCodes *codes; \ char *buf; \ int n; \ { \ code -= codes->first_error; \ if (code >= 0 && code < nerr) { \ char tmp[256]; \ sprintf (tmp, "%s.%d", extname, code); \ XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ return buf; \ } \ return (char *)0; \ } #endif vnc_unixsrc/Xvnc/include/extensions/multibufst.h0100664000076400007640000004571707120677563021632 0ustar constconst/* * $XConsortium: multibufst.h,v 1.16 95/06/08 23:20:39 gildea Exp $ * $XFree86: xc/include/extensions/multibufst.h,v 3.1 1996/05/06 05:52:39 dawes Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _MULTIBUFST_H_ #define _MULTIBUFST_H_ /* * Protocol requests constants and alignment values */ #include "multibuf.h" #ifdef _MULTIBUF_SERVER_ #include "input.h" #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define MbufGetReq(name,req,info) GetReq (name, req); \ req->reqType = info->codes->major_opcode; \ req->mbufReqType = X_##name; #else #define MbufGetReq(name,req,info) GetReq (name, req); \ req->reqType = info->codes->major_opcode; \ req->mbufReqType = X_/**/name; #endif #define Window CARD32 #define Drawable CARD32 #define VisualID CARD32 #define Multibuffer CARD32 typedef struct xMbufBufferInfo { CARD32 visualID B32; /* associated visual */ CARD16 maxBuffers B16; /* maximum supported buffers */ CARD8 depth; /* depth of visual (redundant) */ CARD8 unused; } xMbufBufferInfo; #define sz_xMbufBufferInfo 8 typedef struct { BYTE type; BYTE unused; CARD16 sequenceNumber B16; CARD32 buffer B32; /* affected buffer */ BYTE state; /* current status */ CARD8 unused1; CARD16 unused2 B16; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; CARD32 unused7 B32; } xMbufClobberNotifyEvent; typedef struct { BYTE type; BYTE unused; CARD16 sequenceNumber B16; CARD32 buffer B32; /* affected buffer */ CARD32 timeStamp B32; /* update time */ CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; } xMbufUpdateNotifyEvent; typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferVersion */ CARD16 length B16; } xMbufGetBufferVersionReq; #define sz_xMbufGetBufferVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD8 majorVersion; /* major version of Multi-Buffering protocol */ CARD8 minorVersion; /* minor version of Multi-Buffering protocol */ CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xMbufGetBufferVersionReply; #define sz_xMbufGetBufferVersionReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */ CARD16 length B16; CARD32 window B32; /* associated window */ CARD8 updateAction; /* action at update */ CARD8 updateHint; /* hint as to frequency of updates */ CARD16 unused; } xMbufCreateImageBuffersReq; /* followed by buffer ids */ #define sz_xMbufCreateImageBuffersReq 12 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 numberBuffer B16; /* number successfully allocated */ CARD16 unused1 B16; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; CARD32 unused6 B32; } xMbufCreateImageBuffersReply; #define sz_xMbufCreateImageBuffersReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */ CARD16 length B16; CARD32 window B32; /* associated window */ } xMbufDestroyImageBuffersReq; #define sz_xMbufDestroyImageBuffersReq 8 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */ CARD16 length B16; CARD16 minDelay B16; /* minimum time between last update and now */ CARD16 maxDelay B16; /* maximum time between last update and now */ } xMbufDisplayImageBuffersReq; /* followed by list of buffers */ #define sz_xMbufDisplayImageBuffersReq 8 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */ CARD16 length B16; CARD32 window B32; /* associated window */ CARD32 valueMask B32; /* modified entries */ } xMbufSetMBufferAttributesReq; /* followed by values */ #define sz_xMbufSetMBufferAttributesReq 12 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */ CARD16 length B16; CARD32 window B32; /* associated window */ } xMbufGetMBufferAttributesReq; #define sz_xMbufGetMBufferAttributesReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 displayedBuffer B16; /* currently visible buffer */ CARD8 updateAction; CARD8 updateHint; CARD8 windowMode; CARD8 unused0; CARD16 unused1 B16; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; } xMbufGetMBufferAttributesReply; #define sz_xMbufGetMBufferAttributesReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */ CARD16 length B16; CARD32 buffer B32; CARD32 valueMask B32; } xMbufSetBufferAttributesReq; /* followed by values */ #define sz_xMbufSetBufferAttributesReq 12 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */ CARD16 length B16; CARD32 buffer B32; } xMbufGetBufferAttributesReq; #define sz_xMbufGetBufferAttributesReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD32 window B32; CARD32 eventMask B32; CARD16 bufferIndex B16; CARD8 side; CARD8 unused0; CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; } xMbufGetBufferAttributesReply; #define sz_xMbufGetBufferAttributesReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufGetBufferInfo */ CARD16 length B16; Drawable drawable B32; } xMbufGetBufferInfoReq; #define sz_xMbufGetBufferInfoReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; /* not used */ CARD16 sequenceNumber B16; CARD32 length B32; CARD16 normalInfo B16; CARD16 stereoInfo B16; CARD32 unused1 B32; CARD32 unused2 B32; CARD32 unused3 B32; CARD32 unused4 B32; CARD32 unused5 B32; } xMbufGetBufferInfoReply; /* followed by buffer infos */ #define sz_xMbufGetBufferInfoReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */ CARD16 length B16; CARD8 unused0; CARD8 unused1; CARD8 unused2; CARD8 depth; Window wid B32; Window parent B32; Multibuffer left B32; /* associated buffers */ Multibuffer right B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD16 borderWidth B16; CARD16 class B16; VisualID visual B32; CARD32 mask B32; } xMbufCreateStereoWindowReq; /* followed by value list */ #define sz_xMbufCreateStereoWindowReq 44 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */ CARD16 length B16; Multibuffer buffer B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD8 unused0; CARD8 unused1; CARD8 unused2; BOOL exposures; } xMbufClearImageBufferAreaReq; #define sz_xMbufClearImageBufferAreaReq 20 #undef Window #undef Drawable #undef VisualID #undef Multibuffer #ifdef _MULTIBUF_SERVER_ /* Macros for wrapping and unwrapping functions */ #define SWAP_FUNC_VECTOR(pSTRUCT1,pSTRUCT2,DATA_TYPE,FUNC_NAME) \ { \ DATA_TYPE (* tmpFn)(); \ \ tmpFn = pSTRUCT1->FUNC_NAME; \ pSTRUCT1->FUNC_NAME = pSTRUCT2->FUNC_NAME; \ pSTRUCT2->FUNC_NAME = tmpFn; \ } #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define WRAP_SCREEN_FUNC(pSCREEN,pPRIV,FUNC_NAME, PRIV_FUNC_NAME) \ { \ if ((pPRIV->funcsWrapped & FUNC_NAME##Mask) == 0) \ { \ pPRIV->FUNC_NAME = pSCREEN->FUNC_NAME; \ pSCREEN->FUNC_NAME = PRIV_FUNC_NAME; \ pPRIV->funcsWrapped |= FUNC_NAME##Mask; \ } \ } #define UNWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \ { \ SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \ pPRIV->funcsWrapped &= ~(FUNC_NAME##Mask); \ } #define REWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \ { \ if (MB_SCREEN_PRIV(pSCREEN)->mbufWindowCount) \ { \ SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \ pPRIV->funcsWrapped |= FUNC_NAME##Mask; \ } \ } #else #define WRAP_SCREEN_FUNC(pSCREEN,pPRIV,FUNC_NAME, PRIV_FUNC_NAME) \ { \ if ((pPRIV->funcsWrapped & FUNC_NAME/**/Mask) == 0) \ { \ pPRIV->FUNC_NAME = pSCREEN->FUNC_NAME; \ pSCREEN->FUNC_NAME = PRIV_FUNC_NAME; \ pPRIV->funcsWrapped |= FUNC_NAME/**/Mask; \ } \ } #define UNWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \ { \ SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \ pPRIV->funcsWrapped &= ~(FUNC_NAME/**/Mask); \ } #define REWRAP_SCREEN_FUNC(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME) \ { \ if (MB_SCREEN_PRIV(pSCREEN)->mbufWindowCount) \ { \ SWAP_FUNC_VECTOR(pSCREEN,pPRIV,DATA_TYPE,FUNC_NAME); \ pPRIV->funcsWrapped |= FUNC_NAME/**/Mask; \ } \ } #endif /* The _Multibuffer and _Multibuffers structures below refer to each other, * so we need this forward declaration */ typedef struct _Multibuffers *MultibuffersPtr; /* * per-Multibuffer data */ typedef struct _Multibuffer { MultibuffersPtr pMultibuffers; /* associated window data */ Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */ Mask otherEventMask; /* mask of all other clients event masks */ OtherClients *otherClients; /* other clients that want events */ int number; /* index of this buffer into array */ int side; /* always Mono */ int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */ PixmapPtr pPixmap; /* associated pixmap */ } MultibufferRec, *MultibufferPtr; /* * per-window data */ typedef struct _Multibuffers { WindowPtr pWindow; /* associated window */ int numMultibuffer; /* count of buffers */ int refcnt; /* ref count for delete */ int displayedMultibuffer; /* currently active buffer */ int updateAction; /* Undefined, Background, Untouched, Copied */ int updateHint; /* Frequent, Intermittent, Static */ int windowMode; /* always Mono */ TimeStamp lastUpdate; /* time of last update */ unsigned short width, height; /* last known window size */ short x, y; /* for static gravity */ MultibufferPtr buffers; /* array of numMultibuffer buffers */ } MultibuffersRec; /* * per-screen data */ typedef struct _MultibufferScreen { PositionWindowProcPtr PositionWindow; /* pWin, x,y */ } MultibufferScreenRec, *MultibufferScreenPtr; /* * per display-image-buffers request data. */ typedef struct _DisplayRequest { struct _DisplayRequest *next; TimeStamp activateTime; ClientPtr pClient; XID id; } DisplayRequestRec, *DisplayRequestPtr; #define DestroyWindowMask (1L<<0) #define PositionWindowMask (1L<<1) #define PostValidateTreeMask (1L<<2) #define ClipNotifyMask (1L<<3) #define WindowExposuresMask (1L<<4) #define CopyWindowMask (1L<<5) #define ClearToBackgroundMask (1L<<6) #define ChangeWindowAttributesMask (1L<<7) extern int MultibufferScreenIndex; extern int MultibufferWindowIndex; extern RESTYPE MultibufferDrawableResType; extern void MultibufferUpdate( /* pMbuffer, time */ #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */, CARD32 /* time */ #endif ); extern void MultibufferExpose( /* pMbuffer, pRegion */ #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */, RegionPtr /* pRegion */ #endif ); extern void MultibufferClobber( /* pMbuffer */ #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */ #endif ); typedef struct _mbufWindow *mbufWindowPtr; /* * per-buffer data */ #define MB_DISPLAYED_BUFFER(pMBWindow) \ ((pMBWindow)->buffers + (pMBWindow)->displayedMultibuffer) typedef struct _mbufBuffer { mbufWindowPtr pMBWindow; /* associated window data */ Mask eventMask; /* client event mask */ Mask otherEventMask; /* union of other clients' event masks */ OtherClientsPtr otherClients; /* other clients that want events */ int number; /* index of this buffer into array */ int side; /* stero side: always Mono */ int clobber; /* clober state */ DrawablePtr pDrawable; /* associated drawable */ } mbufBufferRec, *mbufBufferPtr; /* * per-window data */ #define MB_WINDOW_PRIV(pWin) \ ((mbufWindowPtr)((pWin)->devPrivates[MultibufferWindowIndex].ptr)) typedef struct _mbufWindow { WindowPtr pWindow; /* associated window */ int numMultibuffer; /* count of buffers */ mbufBufferPtr buffers; /* array of (numMultibuffer) buffers */ int displayedMultibuffer; /* currently active buffer */ int updateAction; /* Undefined, Background, Untouched, Copied */ int updateHint; /* Frequent, Intermittent, Static */ int windowMode; /* always Mono */ TimeStamp lastUpdate; /* time of last update */ short x, y; /* for static gravity */ unsigned short width, height; /* last known window size */ DevUnion devPrivate; } mbufWindowRec; /* * per-screen data */ #define MB_SCREEN_PRIV(pScreen) \ ((mbufScreenPtr)((pScreen)->devPrivates[MultibufferScreenIndex].ptr)) typedef struct _mbufScreen { long mbufWindowCount; /* count of multibuffered windows */ /* Wrap pScreen->DestroyWindow */ DestroyWindowProcPtr DestroyWindow; long funcsWrapped; /* flags which functions are wrapped */ /* Initialized by device-dependent section */ int nInfo; /* number of buffer info rec's */ xMbufBufferInfo *pInfo; /* buffer info (for Normal buffers) */ int (* CreateImageBuffers)( #if NeedNestedPrototypes WindowPtr /* pWin */, int /* nbuf */, XID * /* ids */, int /* action */, int /* hint */ #endif ); void (* DestroyImageBuffers)( #if NeedNestedPrototypes WindowPtr /* pWin */ #endif ); void (* DisplayImageBuffers)( #if NeedNestedPrototypes ScreenPtr /* pScreen */, mbufBufferPtr * /* ppMBBuffer */, mbufWindowPtr * /* ppMBWindow */, int /* nbuf */ #endif ); void (* ClearImageBufferArea)( #if NeedNestedPrototypes mbufBufferPtr /* pMBBuffer */, short /* x */, short /* y */, unsigned short /* width */, unsigned short /* height */, Bool /* exposures */ #endif ); Bool (* ChangeMBufferAttributes)( /* pMBWindow, vmask */ #if NeedNestedPrototypes /* FIXME */ #endif ); Bool (* ChangeBufferAttributes)( /* pMBBuffer, vmask */ #if NeedNestedPrototypes /* FIXME */ #endif ); void (* DeleteBufferDrawable)( #if NeedNestedPrototypes DrawablePtr /* pDrawable */ #endif ); void (* WrapScreenFuncs)( #if NeedNestedPrototypes ScreenPtr /* pScreen */ #endif ); void (* ResetProc)( #if NeedNestedPrototypes ScreenPtr /* pScreen */ #endif ); DevUnion devPrivate; } mbufScreenRec, *mbufScreenPtr; /* Privates to mbufScreenRec */ #ifdef _MULTIBUF_PIXMAP_ #define MB_SCREEN_PRIV_PIXMAP(pScreen) \ ((mbufPixmapPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr) typedef struct _mbufPixmapPriv { /* Pointers to wrapped functions */ PositionWindowProcPtr PositionWindow; /* pWin, x,y */ long funcsWrapped; /* flags which functions are wrapped */ } mbufPixmapPrivRec, *mbufPixmapPrivPtr; #endif /* _MULTIBUF_PIXMAP_ */ #ifdef _MULTIBUF_BUFFER_ extern int frameWindowPrivateIndex; #define MB_SCREEN_PRIV_BUFFER(pScreen) \ ((mbufBufferPrivPtr) MB_SCREEN_PRIV((pScreen))->devPrivate.ptr) typedef struct _mbufBufferPriv { DevUnion *frameBuffer; /* Array of screen framebuffers */ DevUnion selectPlane; /* Plane(s) that select displayed buffer */ /* * Note: subtractRgn and unionRgn may overlap. subtractRgn is a union * of all the old clipLists of the windows that are displaying * the backbuffer. unionRgn is the union of all the new clipLists * of the same windows. */ RegionRec backBuffer; /* Area of screen displaying back buffer */ RegionRec subtractRgn; /* Regions lost to backBuffer */ RegionRec unionRgn; /* Regions gained by backBuffer */ Bool rgnChanged; /* TRUE if "backBuffer" needs to be updated */ void (* CopyBufferBits)(); /* pMBWindow, srcBufferNum, dstBufferNum */ void (* DrawSelectPlane)(); /* pScreen, selectPlane, pRegion, bufferNum */ /* Pointers to wrapped functions */ PostValidateTreeProcPtr PostValidateTree; /* pParent, pChild, kind */ ClipNotifyProcPtr ClipNotify; /* pWin, dx, dy */ WindowExposuresProcPtr WindowExposures; /* pWin, pRegion */ CopyWindowProcPtr CopyWindow; /* pWin, oldPt, pOldRegion */ ClearToBackgroundProcPtr ClearToBackground; /* pWin, x,y,w,h, sendExpose */ ChangeWindowAttributesProcPtr ChangeWindowAttributes; /* pWin, vmask */ long funcsWrapped; /* flags which functions are wrapped */ unsigned inClearToBackground:1; /* used by WindowExposure */ } mbufBufferPrivRec, *mbufBufferPrivPtr; #endif /* _MULTIBUF_BUFFER_ */ #endif /* _MULTIBUF_SERVER_ */ #endif /* _MULTIBUFST_H_ */ vnc_unixsrc/Xvnc/include/extensions/shape.h0100664000076400007640000001210107120677563020511 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: shape.h,v 1.17 94/04/17 20:11:23 rws Exp $ */ #ifndef _SHAPE_H_ #define _SHAPE_H_ #include #define X_ShapeQueryVersion 0 #define X_ShapeRectangles 1 #define X_ShapeMask 2 #define X_ShapeCombine 3 #define X_ShapeOffset 4 #define X_ShapeQueryExtents 5 #define X_ShapeSelectInput 6 #define X_ShapeInputSelected 7 #define X_ShapeGetRectangles 8 #define ShapeSet 0 #define ShapeUnion 1 #define ShapeIntersect 2 #define ShapeSubtract 3 #define ShapeInvert 4 #define ShapeBounding 0 #define ShapeClip 1 #define ShapeNotifyMask (1L << 0) #define ShapeNotify 0 #define ShapeNumberEvents (ShapeNotify + 1) #ifndef _SHAPE_SERVER_ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came frome a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* window of event */ int kind; /* ShapeBounding or ShapeClip */ int x, y; /* extents of new region */ unsigned width, height; Time time; /* server timestamp when region changed */ Bool shaped; /* true if the region exists */ } XShapeEvent; _XFUNCPROTOBEGIN extern Bool XShapeQueryExtension ( #if NeedFunctionPrototypes Display* /* display */, int* /* event_base */, int* /* error_base */ #endif ); extern Status XShapeQueryVersion ( #if NeedFunctionPrototypes Display* /* display */, int* /* major_version */, int* /* minor_version */ #endif ); extern void XShapeCombineRegion ( #if NeedFunctionPrototypes Display* /* display */, Window /* dest */, int /* dest_kind */, int /* x_off */, int /* y_off */, Region /* region */, int /* op */ #endif ); extern void XShapeCombineRectangles ( #if NeedFunctionPrototypes Display* /* display */, Window /* dest */, int /* dest_kind */, int /* x_off */, int /* y_off */, XRectangle* /* rectangles */, int /* n_rects */, int /* op */, int /* ordering */ #endif ); extern void XShapeCombineMask ( #if NeedFunctionPrototypes Display* /* display */, Window /* dest */, int /* dest_kind */, int /* x_off */, int /* y_off */, Pixmap /* src */, int /* op */ #endif ); extern void XShapeCombineShape ( #if NeedFunctionPrototypes Display* /* display */, Window /* dest */, int /* dest_kind */, int /* x_off */, int /* y_off */, Window /* src */, int /* src_kind */, int /* op */ #endif ); extern void XShapeOffsetShape ( #if NeedFunctionPrototypes Display* /* display */, Window /* dest */, int /* dest_kind */, int /* x_off */, int /* y_off */ #endif ); extern Status XShapeQueryExtents ( #if NeedFunctionPrototypes Display* /* display */, Window /* window */, Bool* /* bounding_shaped */, int* /* x_bounding */, int* /* y_bounding */, unsigned int* /* w_bounding */, unsigned int* /* h_bounding */, Bool* /* clip_shaped */, int* /* x_clip */, int* /* y_clip */, unsigned int* /* w_clip */, unsigned int* /* h_clip */ #endif ); extern void XShapeSelectInput ( #if NeedFunctionPrototypes Display* /* display */, Window /* window */, unsigned long /* mask */ #endif ); extern unsigned long XShapeInputSelected ( #if NeedFunctionPrototypes Display* /* display */, Window /* window */ #endif ); extern XRectangle *XShapeGetRectangles ( #if NeedFunctionPrototypes Display* /* display */, Window /* window */, int /* kind */, int* /* count */, int* /* ordering */ #endif ); _XFUNCPROTOEND #endif /* _SHAPE_SERVER_ */ #endif /* _SHAPE_H_ */ vnc_unixsrc/Xvnc/include/extensions/bigreqstr.h0100664000076400007640000000404107120677563021417 0ustar constconst/* $XConsortium: bigreqstr.h /main/5 1995/10/30 15:53:46 mor $ */ /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define X_BigReqEnable 0 #define XBigReqNumberEvents 0 #define XBigReqNumberErrors 0 #define XBigReqExtensionName "BIG-REQUESTS" typedef struct { CARD8 reqType; /* always XBigReqCode */ CARD8 brReqType; /* always X_BigReqEnable */ CARD16 length B16; } xBigReqEnableReq; #define sz_xBigReqEnableReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 max_request_size B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xBigReqEnableReply; #define sz_xBigReqEnableReply 32 typedef struct { CARD8 reqType; CARD8 data; CARD16 zero B16; CARD32 length B32; } xBigReq; vnc_unixsrc/Xvnc/include/extensions/dpms.h0100664000076400007640000000317607120677563020370 0ustar constconst/***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * HISTORY */ /* * @(#)RCSfile: dpms.h,v Revision: 1.1.4.2 (DEC) Date: 1995/11/21 19:34:17 */ #define DPMSModeOn 0 #define DPMSModeStandby 1 #define DPMSModeSuspend 2 #define DPMSModeOff 3 vnc_unixsrc/Xvnc/include/extensions/MITMisc.h0100664000076400007640000000413507120677563020666 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */ /* $XConsortium: MITMisc.h,v 1.5 94/04/17 20:11:10 rws Exp $ */ #ifndef _XMITMISC_H_ #define _XMITMISC_H_ #include #define X_MITSetBugMode 0 #define X_MITGetBugMode 1 #define MITMiscNumberEvents 0 #define MITMiscNumberErrors 0 #ifndef _MITMISC_SERVER_ _XFUNCPROTOBEGIN Bool XMITMiscQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_basep */, int* /* error_basep */ #endif ); Status XMITMiscSetBugMode( #if NeedFunctionPrototypes Display* /* dpy */, Bool /* onOff */ #endif ); Bool XMITMiscGetBugMode( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); _XFUNCPROTOEND #endif #endif vnc_unixsrc/Xvnc/include/extensions/syncstr.h0100664000076400007640000003004707120677563021127 0ustar constconst/* $XConsortium: syncstr.h,v 1.4 94/04/17 20:11:27 rws Exp $ */ /* Copyright (c) 1991, 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "sync.h" #ifndef _SYNC_OS /* cover up types from sync.h to make sure they're the right size for * protocol packaging. These will be undef'ed after all the protocol * structures are defined. */ #define XSyncCounter CARD32 #define XSyncAlarm CARD32 /* * Initialize */ typedef struct _xSyncInitialize { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; } xSyncInitializeReq; #define sz_xSyncInitializeReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 majorVersion; CARD8 minorVersion; CARD16 pad B16; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncInitializeReply; #define sz_xSyncInitializeReply 32 /* * ListSystemCounters */ typedef struct _xSyncListSystemCounters { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncListSystemCountersReq; #define sz_xSyncListSystemCountersReq 4 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 nCounters B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncListSystemCountersReply; #define sz_xSyncListSystemCountersReply 32 typedef struct { XSyncCounter counter B32; INT32 resolution_hi B32; CARD32 resolution_lo B32; CARD16 name_length B16; } xSyncSystemCounter; #define sz_xSyncSystemCounter 14 /* * Create Counter */ typedef struct _xSyncCreateCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 initial_value_hi B32; CARD32 initial_value_lo B32; } xSyncCreateCounterReq; #define sz_xSyncCreateCounterReq 16 /* * Change Counter */ typedef struct _xSyncChangeCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncChangeCounterReq; #define sz_xSyncChangeCounterReq 16 /* * Set Counter */ typedef struct _xSyncSetCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter cid B32; INT32 value_hi B32; CARD32 value_lo B32; } xSyncSetCounterReq; #define sz_xSyncSetCounterReq 16 /* * Destroy Counter */ typedef struct _xSyncDestroyCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncDestroyCounterReq; #define sz_xSyncDestroyCounterReq 8 /* * Query Counter */ typedef struct _xSyncQueryCounterReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncCounter counter B32; } xSyncQueryCounterReq; #define sz_xSyncQueryCounterReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 value_hi B32; CARD32 value_lo B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xSyncQueryCounterReply; #define sz_xSyncQueryCounterReply 32 /* * Await */ typedef struct _xSyncAwaitReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; } xSyncAwaitReq; #define sz_xSyncAwaitReq 4 typedef struct _xSyncWaitCondition { XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 event_threshold_hi B32; CARD32 event_threshold_lo B32; } xSyncWaitCondition; #define sz_xSyncWaitCondition 28 /* * Create Alarm */ typedef struct _xSyncCreateAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm id B32; CARD32 valueMask B32; } xSyncCreateAlarmReq; #define sz_xSyncCreateAlarmReq 12 /* * Destroy Alarm */ typedef struct _xSyncDestroyAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncDestroyAlarmReq; #define sz_xSyncDestroyAlarmReq 8 /* * Query Alarm */ typedef struct _xSyncQueryAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; } xSyncQueryAlarmReq; #define sz_xSyncQueryAlarmReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; XSyncCounter counter B32; CARD32 value_type B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; CARD32 test_type B32; INT32 delta_hi B32; CARD32 delta_lo B32; BOOL events; BYTE state; BYTE pad0; BYTE pad1; } xSyncQueryAlarmReply; #define sz_xSyncQueryAlarmReply 40 /* * Change Alarm */ typedef struct _xSyncChangeAlarmReq { CARD8 reqType; CARD8 syncReqType; CARD16 length B16; XSyncAlarm alarm B32; CARD32 valueMask B32; } xSyncChangeAlarmReq; #define sz_xSyncChangeAlarmReq 12 /* * SetPriority */ typedef struct _xSyncSetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; INT32 priority B32; } xSyncSetPriorityReq; #define sz_xSyncSetPriorityReq 12 /* * Get Priority */ typedef struct _xSyncGetPriority{ CARD8 reqType; CARD8 syncReqType; CARD16 length B16; CARD32 id B32; /*XXX XID? */ } xSyncGetPriorityReq; #define sz_xSyncGetPriorityReq 8 typedef struct { BYTE type; CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; INT32 priority B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xSyncGetPriorityReply; #define sz_xSyncGetPriorityReply 32 /* * Events */ typedef struct _xSyncCounterNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncCounter counter B32; INT32 wait_value_hi B32; CARD32 wait_value_lo B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; CARD32 time B32; CARD16 count B16; BOOL destroyed; BYTE pad0; } xSyncCounterNotifyEvent; typedef struct _xSyncAlarmNotifyEvent { BYTE type; BYTE kind; CARD16 sequenceNumber B16; XSyncAlarm alarm B32; INT32 counter_value_hi B32; CARD32 counter_value_lo B32; INT32 alarm_value_hi B32; CARD32 alarm_value_lo B32; CARD32 time B32; CARD8 state; BYTE pad0; BYTE pad1; BYTE pad2; } xSyncAlarmNotifyEvent; #undef XSyncCounter #undef XSyncAlarm #endif /* _SYNC_OS */ #ifdef _SYNC_SERVER #define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */ typedef struct _SyncCounter { ClientPtr client; /* Owning client. 0 for system counters */ XSyncCounter id; /* resource ID */ CARD64 value; /* counter value */ struct _SyncTriggerList *pTriglist; /* list of triggers */ Bool beingDestroyed; /* in process of going away */ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */ } SyncCounter; /* * The System Counter interface */ typedef enum { XSyncCounterNeverChanges, XSyncCounterNeverIncreases, XSyncCounterNeverDecreases, XSyncCounterUnrestricted } SyncCounterType; typedef struct _SysCounterInfo { char *name; CARD64 resolution; CARD64 bracket_greater; CARD64 bracket_less; SyncCounterType counterType; /* how can this counter change */ void (*QueryValue)( #if NeedNestedPrototypes pointer /*pCounter*/, CARD64 * /*freshvalue*/ #endif ); void (*BracketValues)( #if NeedNestedPrototypes pointer /*pCounter*/, CARD64 * /*lessthan*/, CARD64 * /*greaterthan*/ #endif ); } SysCounterInfo; typedef struct _SyncTrigger { SyncCounter *pCounter; CARD64 wait_value; /* wait value */ unsigned int value_type; /* Absolute or Relative */ unsigned int test_type; /* transition or Comparision type */ CARD64 test_value; /* trigger event threshold value */ Bool (*CheckTrigger)( #if NeedNestedPrototypes struct _SyncTrigger * /*pTrigger*/, CARD64 /*newval*/ #endif ); void (*TriggerFired)( #if NeedNestedPrototypes struct _SyncTrigger * /*pTrigger*/ #endif ); void (*CounterDestroyed)( #if NeedNestedPrototypes struct _SyncTrigger * /*pTrigger*/ #endif ); } SyncTrigger; typedef struct _SyncTriggerList { SyncTrigger *pTrigger; struct _SyncTriggerList *next; } SyncTriggerList; typedef struct _SyncAlarmClientList { ClientPtr client; XID delete_id; struct _SyncAlarmClientList *next; } SyncAlarmClientList; typedef struct _SyncAlarm { SyncTrigger trigger; ClientPtr client; XSyncAlarm alarm_id; CARD64 delta; int events; int state; SyncAlarmClientList *pEventClients; } SyncAlarm; typedef struct { ClientPtr client; CARD32 delete_id; int num_waitconditions; } SyncAwaitHeader; typedef struct { SyncTrigger trigger; CARD64 event_threshold; SyncAwaitHeader *pHeader; } SyncAwait; typedef union { SyncAwaitHeader header; SyncAwait await; } SyncAwaitUnion; extern pointer SyncCreateSystemCounter( #if NeedFunctionPrototypes char * /* name */, CARD64 /* inital_value */, CARD64 /* resolution */, SyncCounterType /* change characterization */, void (* /*QueryValue*/ ) (), /* XXX prototype */ void (* /*BracketValues*/) () #endif ); extern void SyncChangeCounter( #if NeedFunctionPrototypes SyncCounter * /* pCounter*/, CARD64 /* new_value */ #endif ); extern void SyncDestroySystemCounter( #if NeedFunctionPrototypes pointer pCounter #endif ); extern void InitServertime(); #endif /* _SYNC_SERVER */ vnc_unixsrc/Xvnc/include/extensions/Xdbeproto.h0100664000076400007640000002115307120677563021366 0ustar constconst/* $XConsortium: Xdbeproto.h /main/3 1995/09/22 10:20:16 dpw $ */ /****************************************************************************** * * Copyright (c) 1994, 1995 Hewlett-Packard Company * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the Hewlett-Packard * Company shall not be used in advertising or otherwise to promote the * sale, use or other dealings in this Software without prior written * authorization from the Hewlett-Packard Company. * * Header file for Xlib-related DBE * *****************************************************************************/ #ifndef XDBE_PROTO_H #define XDBE_PROTO_H /* INCLUDES */ /* DEFINES */ /* Values for swap_action field of XdbeSwapInfo structure */ #define XdbeUndefined 0 #define XdbeBackground 1 #define XdbeUntouched 2 #define XdbeCopied 3 #ifdef NEED_DBE_PROTOCOL #define DBE_PROTOCOL_NAME "DOUBLE-BUFFER" /* Current version numbers */ #define DBE_MAJOR_VERSION 1 #define DBE_MINOR_VERSION 0 /* Used when adding extension; also used in Xdbe macros */ #define DbeNumberEvents 0 #define DbeBadBuffer 0 #define DbeNumberErrors (DbeBadBuffer + 1) /* Request values used in (S)ProcDbeDispatch() */ #define X_DbeGetVersion 0 #define X_DbeAllocateBackBufferName 1 #define X_DbeDeallocateBackBufferName 2 #define X_DbeSwapBuffers 3 #define X_DbeBeginIdiom 4 #define X_DbeEndIdiom 5 #define X_DbeGetVisualInfo 6 #define X_DbeGetBackBufferAttributes 7 typedef CARD8 xDbeSwapAction; typedef CARD32 xDbeBackBuffer; #endif /* NEED_DBE_PROTOCOL */ /* TYPEDEFS */ /* Client data types */ /* XdbeVisualInfo and XdbeScreenVisualInfo are defined in this file, * "Xdbeproto.h", rather than "Xdbe.h" because the server uses these data * types. */ typedef struct { VisualID visual; /* one visual ID that supports double-buffering */ int depth; /* depth of visual in bits */ int perflevel; /* performance level of visual */ } XdbeVisualInfo; typedef struct { int count; /* number of items in visual_depth */ XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ } XdbeScreenVisualInfo; /* Protocol data types */ #ifdef NEED_DBE_PROTOCOL typedef struct { CARD32 window B32; /* window */ xDbeSwapAction swapAction; /* swap action */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeSwapInfo; typedef struct { CARD32 visualID B32; /* associated visual */ CARD8 depth; /* depth of visual */ CARD8 perfLevel; /* performance level hint */ CARD16 pad1 B16; } xDbeVisInfo; #define sz_xDbeVisInfo 8 typedef struct { CARD32 n B32; /* number of visual info items in list */ } xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */ typedef struct { CARD32 window B32; /* window */ } xDbeBufferAttributes; /* Requests and replies */ typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */ CARD16 length B16; /* request length: (2) */ CARD8 majorVersion; /* client-major-version */ CARD8 minorVersion; /* client-minor-version */ CARD16 unused B16; /* unused */ } xDbeGetVersionReq; #define sz_xDbeGetVersionReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD8 majorVersion; /* server-major-version */ CARD8 minorVersion; /* server-minor-version */ CARD16 pad1 B16; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xDbeGetVersionReply; #define sz_xDbeGetVersionReply 32 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */ CARD16 length B16; /* request length: (4) */ CARD32 window B32; /* window */ xDbeBackBuffer buffer B32; /* back buffer name */ xDbeSwapAction swapAction; /* swap action hint */ CARD8 pad1; /* unused */ CARD16 pad2 B16; } xDbeAllocateBackBufferNameReq; #define sz_xDbeAllocateBackBufferNameReq 16 typedef struct { CARD8 reqType; /* major-opcode: codes->major_opcode */ CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeDeallocateBackBufferNameReq; #define sz_xDbeDeallocateBackBufferNameReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */ CARD16 length B16; /* request length: (2+2n) */ CARD32 n B32; /* n, number of window/swap action pairs */ } xDbeSwapBuffersReq; /* followed by n window/swap action pairs */ #define sz_xDbeSwapBuffersReq 8 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */ CARD16 length B16; /* request length: (1) */ } xDbeBeginIdiomReq; #define sz_xDbeBeginIdiomReq 4 typedef struct { CARD8 reqType; /* major-opcode: always codes->major_opcode */ CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */ CARD16 length B16; /* request length: (1) */ } xDbeEndIdiomReq; #define sz_xDbeEndIdiomReq 4 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */ CARD16 length B16; /* request length: (2+n) */ CARD32 n B32; /* n, number of drawables in list */ } xDbeGetVisualInfoReq; /* followed by n drawables */ #define sz_xDbeGetVisualInfoReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length */ CARD32 m; /* m, number of visual infos in list */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetVisualInfoReply; /* followed by m visual infos */ #define sz_xDbeGetVisualInfoReply 32 typedef struct { CARD8 reqType; /* always codes->major_opcode */ CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */ CARD16 length B16; /* request length: (2) */ xDbeBackBuffer buffer B32; /* back buffer name */ } xDbeGetBackBufferAttributesReq; #define sz_xDbeGetBackBufferAttributesReq 8 typedef struct { BYTE type; /* Reply: X_Reply (1) */ CARD8 unused; /* unused */ CARD16 sequenceNumber B16; /* sequence number */ CARD32 length B32; /* reply length: (0) */ CARD32 attributes; /* attributes */ CARD32 pad1 B32; /* unused */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xDbeGetBackBufferAttributesReply; #define sz_xDbeGetBackBufferAttributesReply 32 #endif /* NEED_DBE_PROTOCOL */ #endif /* XDBE_PROTO_H */ vnc_unixsrc/Xvnc/include/extensions/lbxzlib.h0100664000076400007640000000354607120677563021074 0ustar constconst/* $XConsortium: lbxzlib.h /main/2 1996/10/27 15:39:45 rws $ */ /* * Copyright 1993 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Dale Tonogai, Network Computing Devices */ #ifndef _ZLIB_H_ #define _ZLIB_H_ #define ZLIB_STRCOMP_OPT "XC-ZLIB" #define ZLIB_STRCOMP_OPT_LEN 7 #define ZLIB_PACKET_HDRLEN 2 #define ZLIB_MAX_DATALEN 0xfff #define ZLIB_MAX_PLAIN 270 #define ZLIB_MAX_OUTLEN (ZLIB_MAX_PLAIN << 1) #define ZLIB_COMPRESS_FLAG 0x80 #define ZLIB_DATALEN_MASK 0x0f #define ZLIB_PUT_PKTHDR(p, len, compflag) \ { \ (p)[0] = ((unsigned)(len)) >> 8 | ((compflag) ? ZLIB_COMPRESS_FLAG : 0);\ (p)[1] = (len) & 0xff; \ } #define ZLIB_GET_DATALEN(p) \ ((((unsigned)((p)[0] & ZLIB_DATALEN_MASK)) << 8) | (unsigned)(p)[1]) #define ZLIB_COMPRESSED(p) ((p)[0] & ZLIB_COMPRESS_FLAG) #endif /* _ZLIB_H_ */ vnc_unixsrc/Xvnc/include/extensions/XTest.h0100664000076400007640000001065607120677563020475 0ustar constconst/* $XConsortium: XTest.h,v 1.9 94/04/17 20:11:18 rws Exp $ */ /* $XFree86: xc/include/extensions/XTest.h,v 3.0 1996/12/12 09:12:53 dawes Exp $ */ /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XTEST_H_ #define _XTEST_H_ #include #define X_XTestGetVersion 0 #define X_XTestCompareCursor 1 #define X_XTestFakeInput 2 #define X_XTestGrabControl 3 #define XTestNumberEvents 0 #define XTestNumberErrors 0 #define XTestMajorVersion 2 #define XTestMinorVersion 2 #define XTestExtensionName "XTEST" #ifndef _XTEST_SERVER_ #include _XFUNCPROTOBEGIN Bool XTestQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_basep */, int* /* error_basep */, int* /* majorp */, int* /* minorp */ #endif ); Bool XTestCompareCursorWithWindow( #if NeedFunctionPrototypes Display* /* dpy */, Window /* window */, Cursor /* cursor */ #endif ); Bool XTestCompareCurrentCursorWithWindow( #if NeedFunctionPrototypes Display* /* dpy */, Window /* window */ #endif ); extern int XTestFakeKeyEvent( #if NeedFunctionPrototypes Display* /* dpy */, unsigned int /* keycode */, Bool /* is_press */, unsigned long /* delay */ #endif ); extern int XTestFakeButtonEvent( #if NeedFunctionPrototypes Display* /* dpy */, unsigned int /* button */, Bool /* is_press */, unsigned long /* delay */ #endif ); extern int XTestFakeMotionEvent( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* x */, int /* y */, unsigned long /* delay */ #endif ); extern int XTestFakeRelativeMotionEvent( #if NeedFunctionPrototypes Display* /* dpy */, int /* x */, int /* y */, unsigned long /* delay */ #endif ); extern int XTestFakeDeviceKeyEvent( #if NeedFunctionPrototypes Display* /* dpy */, XDevice* /* dev */, unsigned int /* keycode */, Bool /* is_press */, int* /* axes */, int /* n_axes */, unsigned long /* delay */ #endif ); extern int XTestFakeDeviceButtonEvent( #if NeedFunctionPrototypes Display* /* dpy */, XDevice* /* dev */, unsigned int /* button */, Bool /* is_press */, int* /* axes */, int /* n_axes */, unsigned long /* delay */ #endif ); extern int XTestFakeProximityEvent( #if NeedFunctionPrototypes Display* /* dpy */, XDevice* /* dev */, Bool /* in_prox */, int* /* axes */, int /* n_axes */, unsigned long /* delay */ #endif ); extern int XTestFakeDeviceMotionEvent( #if NeedFunctionPrototypes Display* /* dpy */, XDevice* /* dev */, Bool /* is_relative */, int /* first_axis */, int* /* axes */, int /* n_axes */, unsigned long /* delay */ #endif ); extern int XTestGrabControl( #if NeedFunctionPrototypes Display* /* dpy */, Bool /* impervious */ #endif ); void XTestSetGContextOfGC( #if NeedFunctionPrototypes GC /* gc */, GContext /* gid */ #endif ); void XTestSetVisualIDOfVisual( #if NeedFunctionPrototypes Visual* /* visual */, VisualID /* visualid */ #endif ); Status XTestDiscard( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); _XFUNCPROTOEND #endif /* _XTEST_SERVER_ */ #endif vnc_unixsrc/Xvnc/include/extensions/recordstr.h0100664000076400007640000002005407120677563021426 0ustar constconst/* #ifndef lint $XConsortium: recordstr.h /main/2 1996/01/09 18:15:19 gildea $ static char sccsid[ ] = "@(#) recordstr.h 1.5 6/5/95 12:37:44"; #endif */ /*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ #include "record.h" #define RECORD_NAME "RECORD" #define RECORD_MAJOR_VERSION 1 #define RECORD_MINOR_VERSION 13 #define RECORD_LOWEST_MAJOR_VERSION 1 #define RECORD_LOWEST_MINOR_VERSION 12 /* only difference between 1.12 and 1.13 is byte order of device events, which the library doesn't deal with. */ /********************************************************* * * Protocol request constants * */ #define X_RecordQueryVersion 0 /* First request from client */ #define X_RecordCreateContext 1 /* Create client RC */ #define X_RecordRegisterClients 2 /* Add to client RC */ #define X_RecordUnregisterClients 3 /* Delete from client RC */ #define X_RecordGetContext 4 /* Query client RC */ #define X_RecordEnableContext 5 /* Enable interception and reporting */ #define X_RecordDisableContext 6 /* Disable interception and reporting */ #define X_RecordFreeContext 7 /* Free client RC */ #define RecordNumErrors (XRecordBadContext + 1) #define RecordNumEvents 0L #define sz_XRecordRange 32 #define sz_XRecordClientInfo 12 #define sz_XRecordState 16 #define sz_XRecordDatum 32 #define XRecordGlobaldef #define XRecordGlobalref extern #define RecordMaxEvent (128L-1L) #define RecordMinDeviceEvent (2L) #define RecordMaxDeviceEvent (6L) #define RecordMaxError (256L-1L) #define RecordMaxCoreRequest (128L-1L) #define RecordMaxExtRequest (256L-1L) #define RecordMinExtRequest (129L-1L) #define RECORD_RC CARD32 #define RECORD_XIDBASE CARD32 #define RECORD_CLIENTSPEC CARD32 #define RECORD_ELEMENT_HEADER CARD8 typedef RECORD_CLIENTSPEC RecordClientSpec, *RecordClientSpecPtr; typedef struct { CARD8 first; CARD8 last; } RECORD_RANGE8; typedef struct { CARD16 first B16; CARD16 last B16; } RECORD_RANGE16; typedef struct { RECORD_RANGE8 majorCode; RECORD_RANGE16 minorCode; } RECORD_EXTRANGE; typedef struct { RECORD_RANGE8 coreRequests; RECORD_RANGE8 coreReplies; RECORD_EXTRANGE extRequests; RECORD_EXTRANGE extReplies; RECORD_RANGE8 deliveredEvents; RECORD_RANGE8 deviceEvents; RECORD_RANGE8 errors; BOOL clientStarted; BOOL clientDied; } RECORDRANGE; #define sz_RECORDRANGE 24 /* typedef RECORDRANGE xRecordRange, *xRecordRangePtr; #define sz_xRecordRange 24 */ /* Cannot have structures within structures going over the wire */ typedef struct { CARD8 coreRequestsFirst; CARD8 coreRequestsLast; CARD8 coreRepliesFirst; CARD8 coreRepliesLast; CARD8 extRequestsMajorFirst; CARD8 extRequestsMajorLast; CARD16 extRequestsMinorFirst B16; CARD16 extRequestsMinorLast B16; CARD8 extRepliesMajorFirst; CARD8 extRepliesMajorLast; CARD16 extRepliesMinorFirst B16; CARD16 extRepliesMinorLast B16; CARD8 deliveredEventsFirst; CARD8 deliveredEventsLast; CARD8 deviceEventsFirst; CARD8 deviceEventsLast; CARD8 errorsFirst; CARD8 errorsLast; BOOL clientStarted; BOOL clientDied; } xRecordRange; #define sz_xRecordRange 24 typedef struct { RECORD_CLIENTSPEC clientResource B32; CARD32 nRanges B32; /* LISTofRECORDRANGE */ } RECORD_CLIENT_INFO; typedef RECORD_CLIENT_INFO xRecordClientInfo; /* * Initialize */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; CARD16 majorVersion B16; CARD16 minorVersion B16; } xRecordQueryVersionReq; #define sz_xRecordQueryVersionReq 8 typedef struct { CARD8 type; CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; CARD16 minorVersion B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xRecordQueryVersionReply; #define sz_xRecordQueryVersionReply 32 /* * Create RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordCreateContextReq; #define sz_xRecordCreateContextReq 20 /* * Add to RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 nRanges B32; /* LISTofRECORD_CLIENTSPEC */ /* LISTofRECORDRANGE */ } xRecordRegisterClientsReq; #define sz_xRecordRegisterClientsReq 20 /* * Delete from RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; CARD32 nClients B32; /* LISTofRECORD_CLIENTSPEC */ } xRecordUnregisterClientsReq; #define sz_xRecordUnregisterClientsReq 12 /* * Query RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordGetContextReq; #define sz_xRecordGetContextReq 8 typedef struct { CARD8 type; BOOL enabled; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; CARD8 pad; CARD16 pad0 B16; CARD32 nClients B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* LISTofCLIENT_INFO */ /* intercepted-clients */ } xRecordGetContextReply; #define sz_xRecordGetContextReply 32 /* * Enable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordEnableContextReq; #define sz_xRecordEnableContextReq 8 typedef struct { CARD8 type; CARD8 category; CARD16 sequenceNumber B16; CARD32 length B32; RECORD_ELEMENT_HEADER elementHeader; BOOL clientSwapped; CARD16 pad1 B16; RECORD_XIDBASE idBase B32; CARD32 serverTime B32; CARD32 recordedSequenceNumber B32; CARD32 pad3 B32; CARD32 pad4 B32; /* BYTE data; */ } xRecordEnableContextReply; #define sz_xRecordEnableContextReply 32 /* * Disable data interception */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordDisableContextReq; #define sz_xRecordDisableContextReq 8 /* * Free RC */ typedef struct { CARD8 reqType; CARD8 recordReqType; CARD16 length B16; RECORD_RC context B32; } xRecordFreeContextReq; #define sz_xRecordFreeContextReq 8 #undef RECORD_RC #undef RECORD_XIDBASE #undef RECORD_ELEMENT_HEADER #undef RECORD_CLIENTSPEC vnc_unixsrc/Xvnc/include/extensions/xf86dga.h0100664000076400007640000000627707120677563020701 0ustar constconst/* $XFree86: xc/include/extensions/xf86dga.h,v 3.5 1996/10/18 14:57:24 dawes Exp $ */ /* Copyright (c) 1995 Jon Tombs Copyright (c) 1995 XFree86 Inc */ #ifndef _XF86DGA_H_ #define _XF86DGA_H_ #include #define X_XF86DGAQueryVersion 0 #define X_XF86DGAGetVideoLL 1 #define X_XF86DGADirectVideo 2 #define X_XF86DGAGetViewPortSize 3 #define X_XF86DGASetViewPort 4 #define X_XF86DGAGetVidPage 5 #define X_XF86DGASetVidPage 6 #define X_XF86DGAInstallColormap 7 #define X_XF86DGAQueryDirectVideo 8 #define X_XF86DGAViewPortChanged 9 #define XF86DGADirectPresent 0x0001 #define XF86DGADirectGraphics 0x0002 #define XF86DGADirectMouse 0x0004 #define XF86DGADirectKeyb 0x0008 #define XF86DGAHasColormap 0x0100 #define XF86DGADirectColormap 0x0200 #define XF86DGANumberEvents 0 #define XF86DGAClientNotLocal 0 #define XF86DGANoDirectVideoMode 1 #define XF86DGAScreenNotActive 2 #define XF86DGADirectNotActivated 3 #define XF86DGANumberErrors (XF86DGADirectNotActivated + 1) #ifndef _XF86DGA_SERVER_ _XFUNCPROTOBEGIN Bool XF86DGAQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* majorVersion */, int* /* minorVersion */ #endif ); Bool XF86DGAQueryExtension( #if NeedFunctionPrototypes Display* /* dpy */, int* /* event_base */, int* /* error_base */ #endif ); Status XF86DGAGetVideoLL( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int * /* base addr */, int * /* width */, int * /* bank_size */, int * /* ram_size */ #endif ); Status XF86DGAGetVideo( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, char ** /* base addr */, int * /* width */, int * /* bank_size */, int * /* ram_size */ #endif ); Status XF86DGADirectVideo( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* enable */ #endif ); Status XF86DGADirectVideoLL( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* enable */ #endif ); Status XF86DGAGetViewPortSize( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int * /* width */, int * /* height */ #endif ); Status XF86DGASetViewPort( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int x /* X */, int y /* Y */ #endif ); Status XF86DGAGetVidPage( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int * /* vid page */ #endif ); Status XF86DGASetVidPage( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, int /* vid page */ #endif ); Status XF86DGAInstallColormap( #if NeedFunctionPrototypes Display* /* dpy */, int /* screen */, Colormap /*Colormap */ #endif ); int XF86DGAForkApp( #if NeedFunctionPrototypes int screen #endif ); Status XF86DGAQueryDirectVideo( #if NeedFunctionPrototypes Display * /* dpy */, int /* screen */, int * /* flags */ #endif ); Bool XF86DGAViewPortChanged( #if NeedFunctionPrototypes Display * /* dpy */, int /* screen */, int /* n */ #endif ); _XFUNCPROTOEND #endif /* _XF86DGA_SERVER_ */ #endif /* _XF86DGA_H_ */ vnc_unixsrc/Xvnc/include/extensions/Xagstr.h0100664000076400007640000001146107120677563020671 0ustar constconst/* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: Xagstr.h /main/3 1996/11/12 12:19:03 swick $ */ #ifndef _XAGSTR_H_ /* { */ #define _XAGSTR_H_ #include "Xag.h" #define XAppGroup CARD32 #define XAGNAME "XC-APPGROUP" #define XAG_MAJOR_VERSION 1 /* current version numbers */ #define XAG_MINOR_VERSION 0 #define XagWindowTypeX11 0 #define XagWindowTypeMacintosh 1 #define XagWindowTypeWin32 2 #define XagWindowTypeWin16 3 typedef struct _XagQueryVersion { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagQueryVersion */ CARD16 length B16; CARD16 client_major_version B16; CARD16 client_minor_version B16; } xXagQueryVersionReq; #define sz_xXagQueryVersionReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; CARD16 server_major_version B16; CARD16 server_minor_version B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXagQueryVersionReply; #define sz_xXagQueryVersionReply 32 /* Set AppGroup Attributes masks */ #define XagSingleScreenMask 1 << XagNsingleScreen #define XagDefaultRootMask 1 << XagNdefaultRoot #define XagRootVisualMask 1 << XagNrootVisual #define XagDefaultColormapMask 1 << XagNdefaultColormap #define XagBlackPixelMask 1 << XagNblackPixel #define XagWhitePixelMask 1 << XagNwhitePixel #define XagAppGroupLeaderMask 1 << XagNappGroupLeader typedef struct _XagCreate { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagCreate */ CARD16 length B16; XAppGroup app_group B32; CARD32 attrib_mask B32; /* LISTofVALUE follows */ } xXagCreateReq; #define sz_xXagCreateReq 12 typedef struct _XagDestroy { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagDestroy */ CARD16 length B16; XAppGroup app_group B32; } xXagDestroyReq; #define sz_xXagDestroyReq 8 typedef struct _XagGetAttr { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagGetAttr */ CARD16 length B16; XAppGroup app_group B32; } xXagGetAttrReq; #define sz_xXagGetAttrReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; Window default_root B32; VisualID root_visual B32; Colormap default_colormap B32; CARD32 black_pixel B32; CARD32 white_pixel B32; BOOL single_screen; BOOL app_group_leader; CARD16 pad2 B16; } xXagGetAttrReply; #define sz_xXagGetAttrReply 32 typedef struct _XagQuery { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagQuery */ CARD16 length B16; CARD32 resource B32; } xXagQueryReq; #define sz_xXagQueryReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequence_number B16; CARD32 length B32; XAppGroup app_group B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXagQueryReply; #define sz_xXagQueryReply 32 typedef struct _XagCreateAssoc { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagCreateAssoc */ CARD16 length B16; Window window B32; CARD16 window_type B16; CARD16 system_window_len B16; /* LISTofCARD8 follows */ } xXagCreateAssocReq; #define sz_xXagCreateAssocReq 12 typedef struct _XagDestroyAssoc { CARD8 reqType; /* always XagReqCode */ CARD8 xagReqType; /* always X_XagDestroyAssoc */ CARD16 length B16; Window window B32; } xXagDestroyAssocReq; #define sz_xXagDestroyAssocReq 8 #undef XAppGroup #endif /* } _XAGSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/XKBproto.h0100664000076400007640000007435407120677563021143 0ustar constconst/* $XConsortium: XKBproto.h /main/22 1996/09/28 16:18:24 rws $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Silicon Graphics not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Silicon Graphics makes no representation about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef _XKBPROTO_H_ #define _XKBPROTO_H_ #include #include #define Window CARD32 #define Atom CARD32 #define Time CARD32 #define KeyCode CARD8 #define KeySym CARD32 #define XkbPaddedSize(n) ((((unsigned int)(n)+3) >> 2) << 2) typedef struct _xkbUseExtension { CARD8 reqType; CARD8 xkbReqType; /* always X_KBUseExtension */ CARD16 length B16; CARD16 wantedMajor B16; CARD16 wantedMinor B16; } xkbUseExtensionReq; #define sz_xkbUseExtensionReq 8 typedef struct _xkbUseExtensionReply { BYTE type; /* X_Reply */ BOOL supported; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 serverMajor B16; CARD16 serverMinor B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbUseExtensionReply; #define sz_xkbUseExtensionReply 32 typedef struct _xkbSelectEvents { CARD8 reqType; CARD8 xkbReqType; /* X_KBSelectEvents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 affectWhich B16; CARD16 clear B16; CARD16 selectAll B16; CARD16 affectMap B16; CARD16 map B16; } xkbSelectEventsReq; #define sz_xkbSelectEventsReq 16 typedef struct _xkbBell { CARD8 reqType; CARD8 xkbReqType; /* X_KBBell */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 bellClass B16; CARD16 bellID B16; INT8 percent; BOOL forceSound; BOOL eventOnly; CARD8 pad1; INT16 pitch B16; INT16 duration B16; CARD16 pad2 B16; Atom name B32; Window window B32; } xkbBellReq; #define sz_xkbBellReq 28 typedef struct _xkbGetState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetStateReq; #define sz_xkbGetStateReq 8 typedef struct _xkbGetStateReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; CARD8 lockedGroup; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD8 pad1; CARD16 ptrBtnState B16; CARD16 pad2 B16; CARD32 pad3 B32; } xkbGetStateReply; #define sz_xkbGetStateReply 32 typedef struct _xkbLatchLockState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBLatchLockState */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectModLocks; CARD8 modLocks; BOOL lockGroup; CARD8 groupLock; CARD8 affectModLatches; CARD8 modLatches; CARD8 pad; BOOL latchGroup; INT16 groupLatch B16; } xkbLatchLockStateReq; #define sz_xkbLatchLockStateReq 16 typedef struct _xkbGetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; } xkbGetControlsReq; #define sz_xkbGetControlsReq 8 typedef struct _xkbGetControlsReply { BYTE type; /* X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 mkDfltBtn; CARD8 numGroups; CARD8 groupsWrap; CARD8 internalMods; CARD8 ignoreLockMods; CARD8 internalRealMods; CARD8 ignoreLockRealMods; CARD8 pad1; CARD16 internalVMods B16; CARD16 ignoreLockVMods B16; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axOptions B16; CARD16 axTimeout B16; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; CARD16 pad2 B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD32 enabledCtrls B32; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbGetControlsReply; #define sz_xkbGetControlsReply 92 typedef struct _xkbSetControls { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetControls */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 affectInternalMods; CARD8 internalMods; CARD8 affectIgnoreLockMods; CARD8 ignoreLockMods; CARD16 affectInternalVMods B16; CARD16 internalVMods B16; CARD16 affectIgnoreLockVMods B16; CARD16 ignoreLockVMods B16; CARD8 mkDfltBtn; CARD8 groupsWrap; CARD16 axOptions B16; CARD16 pad1 B16; CARD32 affectEnabledCtrls B32; CARD32 enabledCtrls B32; CARD32 changeCtrls B32; CARD16 repeatDelay B16; CARD16 repeatInterval B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD16 mkDelay B16; CARD16 mkInterval B16; CARD16 mkTimeToMax B16; CARD16 mkMaxSpeed B16; INT16 mkCurve B16; CARD16 axTimeout B16; CARD32 axtCtrlsMask B32; CARD32 axtCtrlsValues B32; CARD16 axtOptsMask B16; CARD16 axtOptsValues B16; BYTE perKeyRepeat[XkbPerKeyBitArraySize]; } xkbSetControlsReq; #define sz_xkbSetControlsReq 100 typedef struct _xkbKTMapEntryWireDesc { BOOL active; CARD8 mask; CARD8 level; CARD8 realMods; CARD16 virtualMods B16; CARD16 pad B16; } xkbKTMapEntryWireDesc; #define sz_xkbKTMapEntryWireDesc 8 typedef struct _xkbKTSetMapEntryWireDesc { CARD8 level; CARD8 realMods; CARD16 virtualMods B16; } xkbKTSetMapEntryWireDesc; #define sz_xkbKTSetMapEntryWireDesc 4 typedef struct _xkbModsWireDesc { CARD8 mask; /* GetMap only */ CARD8 realMods; CARD16 virtualMods B16; } xkbModsWireDesc; #define sz_xkbModsWireDesc 4 typedef struct _xkbKeyTypeWireDesc { CARD8 mask; CARD8 realMods; CARD16 virtualMods B16; CARD8 numLevels; CARD8 nMapEntries; BOOL preserve; CARD8 pad; } xkbKeyTypeWireDesc; #define sz_xkbKeyTypeWireDesc 8 typedef struct _xkbSymMapWireDesc { CARD8 ktIndex[XkbNumKbdGroups]; CARD8 groupInfo; CARD8 width; CARD16 nSyms B16; } xkbSymMapWireDesc; #define sz_xkbSymMapWireDesc 8 typedef struct _xkbVModMapWireDesc { KeyCode key; CARD8 pad; CARD16 vmods B16; } xkbVModMapWireDesc; #define sz_xkbVModMapWireDesc 4 typedef struct _xkbBehaviorWireDesc { CARD8 key; CARD8 type; CARD8 data; CARD8 pad; } xkbBehaviorWireDesc; #define sz_xkbBehaviorWireDesc 4 typedef struct _xkbActionWireDesc { CARD8 type; CARD8 data[7]; } xkbActionWireDesc; #define sz_xkbActionWireDesc 8 typedef struct _xkbGetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 full B16; CARD16 partial B16; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD16 virtualMods B16; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 pad1 B16; } xkbGetMapReq; #define sz_xkbGetMapReq 28 typedef struct _xkbGetMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 pad1 B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD16 present B16; CARD8 firstType; CARD8 nTypes; CARD8 totalTypes; KeyCode firstKeySym; CARD16 totalSyms B16; CARD8 nKeySyms; KeyCode firstKeyAct; CARD16 totalActs B16; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD8 pad2; CARD16 virtualMods B16; } xkbGetMapReply; #define sz_xkbGetMapReply 40 #define XkbSetMapResizeTypes (1L<<0) #define XkbSetMapRecomputeActions (1L<<1) #define XkbSetMapAllFlags (0x3) typedef struct _xkbSetMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 present B16; CARD16 flags B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; CARD16 totalSyms B16; KeyCode firstKeyAct; CARD8 nKeyActs; CARD16 totalActs B16; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; CARD8 totalKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; CARD8 totalKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; CARD8 totalModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD8 totalVModMapKeys; CARD16 virtualMods B16; } xkbSetMapReq; #define sz_xkbSetMapReq 36 typedef struct _xkbSymInterpretWireDesc { CARD32 sym B32; CARD8 mods; CARD8 match; CARD8 virtualMod; CARD8 flags; xkbActionWireDesc act; } xkbSymInterpretWireDesc; #define sz_xkbSymInterpretWireDesc 16 typedef struct _xkbGetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 groups; BOOL getAllSI; CARD16 firstSI B16; CARD16 nSI B16; } xkbGetCompatMapReq; #define sz_xkbGetCompatMapReq 12 typedef struct _xkbGetCompatMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 groups; CARD8 pad1; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetCompatMapReply; #define sz_xkbGetCompatMapReply 32 typedef struct _xkbSetCompatMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetCompatMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 pad1; BOOL recomputeActions; BOOL truncateSI; CARD8 groups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 pad2 B16; } xkbSetCompatMapReq; #define sz_xkbSetCompatMapReq 16 typedef struct _xkbGetIndicatorState { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorState */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; } xkbGetIndicatorStateReq; #define sz_xkbGetIndicatorStateReq 8 typedef struct _xkbGetIndicatorStateReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 state B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorStateReply; #define sz_xkbGetIndicatorStateReply 32 typedef struct _xkbGetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetIndicatorMapReq; #define sz_xkbGetIndicatorMapReq 12 typedef struct _xkbGetIndicatorMapReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; CARD32 realIndicators B32; CARD8 nIndicators; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbGetIndicatorMapReply; #define sz_xkbGetIndicatorMapReply 32 typedef struct _xkbIndicatorMapWireDesc { CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbIndicatorMapWireDesc; #define sz_xkbIndicatorMapWireDesc 12 typedef struct _xkbSetIndicatorMap { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetIndicatorMap */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 which B32; } xkbSetIndicatorMapReq; #define sz_xkbSetIndicatorMapReq 12 typedef struct _xkbGetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBGetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; } xkbGetNamedIndicatorReq; #define sz_xkbGetNamedIndicatorReq 16 typedef struct _xkbGetNamedIndicatorReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom indicator B32; BOOL found; BOOL on; BOOL realIndicator; CARD8 ndx; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 mods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; BOOL supported; CARD8 pad1; CARD16 pad2 B16; } xkbGetNamedIndicatorReply; #define sz_xkbGetNamedIndicatorReply 32 typedef struct _xkbSetNamedIndicator { CARD8 reqType; CARD8 xkbReqType; /* X_KBSetNamedIndicator */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 ledClass B16; CARD16 ledID B16; CARD16 pad1 B16; Atom indicator B32; BOOL setState; BOOL on; BOOL setMap; BOOL createMap; CARD8 pad2; CARD8 flags; CARD8 whichGroups; CARD8 groups; CARD8 whichMods; CARD8 realMods; CARD16 virtualMods B16; CARD32 ctrls B32; } xkbSetNamedIndicatorReq; #define sz_xkbSetNamedIndicatorReq 32 typedef struct _xkbGetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; CARD32 which B32; } xkbGetNamesReq; #define sz_xkbGetNamesReq 12 typedef struct _xkbGetNamesReply { BYTE type; BYTE deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 which B32; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 nTypes; CARD8 groupNames; CARD16 virtualMods B16; KeyCode firstKey; CARD8 nKeys; CARD32 indicators B32; CARD8 nRadioGroups; CARD8 nKeyAliases; CARD16 nKTLevels B16; CARD32 pad3 B32; } xkbGetNamesReply; #define sz_xkbGetNamesReply 32 typedef struct _xkbSetNames { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetNames */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 virtualMods B16; CARD32 which B32; CARD8 firstType; CARD8 nTypes; CARD8 firstKTLevel; CARD8 nKTLevels; CARD32 indicators B32; CARD8 groupNames; CARD8 nRadioGroups; KeyCode firstKey; CARD8 nKeys; CARD8 nKeyAliases; CARD8 pad1; CARD16 totalKTLevelNames B16; } xkbSetNamesReq; #define sz_xkbSetNamesReq 28 typedef struct _xkbPointWireDesc { INT16 x B16; INT16 y B16; } xkbPointWireDesc; #define sz_xkbPointWireDesc 4 typedef struct _xkbOutlineWireDesc { CARD8 nPoints; CARD8 cornerRadius; CARD16 pad B16; } xkbOutlineWireDesc; #define sz_xkbOutlineWireDesc 4 typedef struct _xkbShapeWireDesc { Atom name B32; CARD8 nOutlines; CARD8 primaryNdx; CARD8 approxNdx; CARD8 pad; } xkbShapeWireDesc; #define sz_xkbShapeWireDesc 8 typedef struct _xkbSectionWireDesc { Atom name B32; INT16 top B16; INT16 left B16; CARD16 width B16; CARD16 height B16; INT16 angle B16; CARD8 priority; CARD8 nRows; CARD8 nDoodads; CARD8 nOverlays; CARD16 pad B16; } xkbSectionWireDesc; #define sz_xkbSectionWireDesc 20 typedef struct _xkbRowWireDesc { INT16 top B16; INT16 left B16; CARD8 nKeys; BOOL vertical; CARD16 pad B16; } xkbRowWireDesc; #define sz_xkbRowWireDesc 8 typedef struct _xkbKeyWireDesc { CARD8 name[XkbKeyNameLength]; INT16 gap B16; CARD8 shapeNdx; CARD8 colorNdx; } xkbKeyWireDesc; #define sz_xkbKeyWireDesc 8 typedef struct _xkbOverlayWireDesc { Atom name B32; CARD8 nRows; CARD8 pad1; CARD16 pad2 B16; } xkbOverlayWireDesc; #define sz_xkbOverlayWireDesc 8 typedef struct _xkbOverlayRowWireDesc { CARD8 rowUnder; CARD8 nKeys; CARD16 pad1 B16; } xkbOverlayRowWireDesc; #define sz_xkbOverlayRowWireDesc 4 typedef struct _xkbOverlayKeyWireDesc { CARD8 over[XkbKeyNameLength]; CARD8 under[XkbKeyNameLength]; } xkbOverlayKeyWireDesc; #define sz_xkbOverlayKeyWireDesc 8 typedef struct _xkbShapeDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbShapeDoodadWireDesc; #define sz_xkbShapeDoodadWireDesc 20 typedef struct _xkbTextDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD16 width B16; CARD16 height B16; CARD8 colorNdx; CARD8 pad1; CARD16 pad2 B16; } xkbTextDoodadWireDesc; #define sz_xkbTextDoodadWireDesc 20 typedef struct _xkbIndicatorDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 shapeNdx; CARD8 onColorNdx; CARD8 offColorNdx; CARD8 pad1; CARD32 pad2 B32; } xkbIndicatorDoodadWireDesc; #define sz_xkbIndicatorDoodadWireDesc 20 typedef struct _xkbLogoDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD8 colorNdx; CARD8 shapeNdx; CARD16 pad1 B16; CARD32 pad2 B32; } xkbLogoDoodadWireDesc; #define sz_xkbLogoDoodadWireDesc 20 typedef struct _xkbAnyDoodadWireDesc { Atom name B32; CARD8 type; CARD8 priority; INT16 top B16; INT16 left B16; INT16 angle B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbAnyDoodadWireDesc; #define sz_xkbAnyDoodadWireDesc 20 typedef union _xkbDoodadWireDesc { xkbAnyDoodadWireDesc any; xkbShapeDoodadWireDesc shape; xkbTextDoodadWireDesc text; xkbIndicatorDoodadWireDesc indicator; xkbLogoDoodadWireDesc logo; } xkbDoodadWireDesc; #define sz_xkbDoodadWireDesc 20 typedef struct _xkbGetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad B16; Atom name B32; } xkbGetGeometryReq; #define sz_xkbGetGeometryReq 12 typedef struct _xkbGetGeometryReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; Atom name B32; BOOL found; CARD8 pad; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nShapes B16; CARD16 nSections B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; } xkbGetGeometryReply; #define sz_xkbGetGeometryReply 32 typedef struct _xkbSetGeometry { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetGeometry */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 nShapes; CARD8 nSections; Atom name B32; CARD16 widthMM B16; CARD16 heightMM B16; CARD16 nProperties B16; CARD16 nColors B16; CARD16 nDoodads B16; CARD16 nKeyAliases B16; CARD8 baseColorNdx; CARD8 labelColorNdx; CARD16 pad B16; } xkbSetGeometryReq; #define sz_xkbSetGeometryReq 28 typedef struct _xkbPerClientFlags { CARD8 reqType; CARD8 xkbReqType;/* always X_KBPerClientFlags */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 pad1 B16; CARD32 change B32; CARD32 value B32; CARD32 ctrlsToChange B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; } xkbPerClientFlagsReq; #define sz_xkbPerClientFlagsReq 28 typedef struct _xkbPerClientFlagsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 supported B32; CARD32 value B32; CARD32 autoCtrls B32; CARD32 autoCtrlValues B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbPerClientFlagsReply; #define sz_xkbPerClientFlagsReply 32 typedef struct _xkbListComponents { CARD8 reqType; CARD8 xkbReqType; /* always X_KBListComponents */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 maxNames B16; } xkbListComponentsReq; #define sz_xkbListComponentsReq 8 typedef struct _xkbListComponentsReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 nKeymaps B16; CARD16 nKeycodes B16; CARD16 nTypes B16; CARD16 nCompatMaps B16; CARD16 nSymbols B16; CARD16 nGeometries B16; CARD16 extra B16; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbListComponentsReply; #define sz_xkbListComponentsReply 32 typedef struct _xkbGetKbdByName { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetKbdByName */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 need B16; /* combination of XkbGBN_* */ CARD16 want B16; /* combination of XkbGBN_* */ BOOL load; CARD8 pad; } xkbGetKbdByNameReq; #define sz_xkbGetKbdByNameReq 12 typedef struct _xkbGetKbdByNameReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; KeyCode minKeyCode; KeyCode maxKeyCode; BOOL loaded; BOOL newKeyboard; CARD16 found B16; /* combination of XkbGBN_* */ CARD16 reported B16; /* combination of XkbAllComponents */ CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbGetKbdByNameReply; #define sz_xkbGetKbdByNameReply 32 typedef struct _xkbDeviceLedsWireDesc { CARD16 ledClass B16; CARD16 ledID B16; CARD32 namesPresent B32; CARD32 mapsPresent B32; CARD32 physIndicators B32; CARD32 state B32; } xkbDeviceLedsWireDesc; #define sz_xkbDeviceLedsWireDesc 20 typedef struct _xkbGetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBGetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD16 wanted B16; BOOL allBtns; CARD8 firstBtn; CARD8 nBtns; CARD8 pad; CARD16 ledClass B16; CARD16 ledID B16; } xkbGetDeviceInfoReq; #define sz_xkbGetDeviceInfoReq 16 typedef struct _xkbGetDeviceInfoReply { CARD8 type; /* always X_Reply */ CARD8 deviceID; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 present B16; CARD16 supported B16; CARD16 unsupported B16; CARD16 nDeviceLedFBs B16; CARD8 firstBtnWanted; CARD8 nBtnsWanted; CARD8 firstBtnRtrn; CARD8 nBtnsRtrn; CARD8 totalBtns; BOOL hasOwnState; CARD16 dfltKbdFB B16; CARD16 dfltLedFB B16; CARD16 pad B16; Atom devType B32; } xkbGetDeviceInfoReply; #define sz_xkbGetDeviceInfoReply 32 typedef struct _xkbSetDeviceInfo { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDeviceInfo */ CARD16 length B16; CARD16 deviceSpec B16; CARD8 firstBtn; CARD8 nBtns; CARD16 change B16; CARD16 nDeviceLedFBs B16; } xkbSetDeviceInfoReq; #define sz_xkbSetDeviceInfoReq 12 typedef struct _xkbSetDebuggingFlags { CARD8 reqType; CARD8 xkbReqType; /* always X_KBSetDebuggingFlags */ CARD16 length B16; CARD16 msgLength B16; CARD16 pad B16; CARD32 affectFlags B32; CARD32 flags B32; CARD32 affectCtrls B32; CARD32 ctrls B32; } xkbSetDebuggingFlagsReq; #define sz_xkbSetDebuggingFlagsReq 24 typedef struct _xkbSetDebuggingFlagsReply { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 currentFlags B32; CARD32 currentCtrls B32; CARD32 supportedFlags B32; CARD32 supportedCtrls B32; CARD32 pad1 B32; CARD32 pad2 B32; } xkbSetDebuggingFlagsReply; #define sz_xkbSetDebuggingFlagsReply 32 /* * X KEYBOARD EXTENSION EVENT STRUCTURES */ typedef struct _xkbAnyEvent { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xkbAnyEvent; #define sz_xkbAnyEvent 32 typedef struct _xkbNewKeyboardNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 oldDeviceID; KeyCode minKeyCode; KeyCode maxKeyCode; KeyCode oldMinKeyCode; KeyCode oldMaxKeyCode; CARD8 requestMajor; CARD8 requestMinor; CARD16 changed B16; CARD8 detail; CARD8 pad1; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbNewKeyboardNotify; #define sz_xkbNewKeyboardNotify 32 typedef struct _xkbMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 ptrBtnActions; CARD16 changed B16; KeyCode minKeyCode; KeyCode maxKeyCode; CARD8 firstType; CARD8 nTypes; KeyCode firstKeySym; CARD8 nKeySyms; KeyCode firstKeyAct; CARD8 nKeyActs; KeyCode firstKeyBehavior; CARD8 nKeyBehaviors; KeyCode firstKeyExplicit; CARD8 nKeyExplicit; KeyCode firstModMapKey; CARD8 nModMapKeys; KeyCode firstVModMapKey; CARD8 nVModMapKeys; CARD16 virtualMods B16; CARD16 pad1 B16; } xkbMapNotify; #define sz_xkbMapNotify 32 typedef struct _xkbStateNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 mods; CARD8 baseMods; CARD8 latchedMods; CARD8 lockedMods; CARD8 group; INT16 baseGroup B16; INT16 latchedGroup B16; CARD8 lockedGroup; CARD8 compatState; CARD8 grabMods; CARD8 compatGrabMods; CARD8 lookupMods; CARD8 compatLookupMods; CARD16 ptrBtnState B16; CARD16 changed B16; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; } xkbStateNotify; #define sz_xkbStateNotify 32 typedef struct _xkbControlsNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 numGroups; CARD16 pad1 B16; CARD32 changedControls B32; CARD32 enabledControls B32; CARD32 enabledControlChanges B32; KeyCode keycode; CARD8 eventType; CARD8 requestMajor; CARD8 requestMinor; CARD32 pad2 B32; } xkbControlsNotify; #define sz_xkbControlsNotify 32 typedef struct _xkbIndicatorNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 pad2 B16; CARD32 state B32; CARD32 changed B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xkbIndicatorNotify; #define sz_xkbIndicatorNotify 32 typedef struct _xkbNamesNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 changed B16; CARD8 firstType; CARD8 nTypes; CARD8 firstLevelName; CARD8 nLevelNames; CARD8 pad2; CARD8 nRadioGroups; CARD8 nAliases; CARD8 changedGroupNames; CARD16 changedVirtualMods B16; CARD8 firstKey; CARD8 nKeys; CARD32 changedIndicators B32; CARD32 pad3 B32; } xkbNamesNotify; #define sz_xkbNamesNotify 32 typedef struct _xkbCompatMapNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 changedGroups; CARD16 firstSI B16; CARD16 nSI B16; CARD16 nTotalSI B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbCompatMapNotify; #define sz_xkbCompatMapNotify 32 typedef struct _xkbBellNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 bellClass; CARD8 bellID; CARD8 percent; CARD16 pitch B16; CARD16 duration B16; Atom name B32; Window window B32; BOOL eventOnly; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; } xkbBellNotify; #define sz_xkbBellNotify 32 typedef struct _xkbActionMessage { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; BOOL press; BOOL keyEventFollows; CARD8 mods; CARD8 group; CARD8 message[8]; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; } xkbActionMessage; #define sz_xkbActionMessage 32 typedef struct _xkbAccessXNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; KeyCode keycode; CARD16 detail B16; CARD16 slowKeysDelay B16; CARD16 debounceDelay B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xkbAccessXNotify; #define sz_xkbAccessXNotify 32 typedef struct _xkbExtensionDeviceNotify { BYTE type; BYTE xkbType; CARD16 sequenceNumber B16; Time time B32; CARD8 deviceID; CARD8 pad1; CARD16 reason B16; CARD16 ledClass B16; CARD16 ledID B16; CARD32 ledsDefined B32; CARD32 ledState B32; CARD8 firstBtn; CARD8 nBtns; CARD16 supported B16; CARD16 unsupported B16; CARD16 pad3 B16; } xkbExtensionDeviceNotify; #define sz_xkbExtensionDeviceNotify 32 typedef struct _xkbEvent { union { xkbAnyEvent any; xkbNewKeyboardNotify new_kbd; xkbMapNotify map; xkbStateNotify state; xkbControlsNotify ctrls; xkbIndicatorNotify indicators; xkbNamesNotify names; xkbCompatMapNotify compat; xkbBellNotify bell; xkbActionMessage message; xkbAccessXNotify accessx; xkbExtensionDeviceNotify device; } u; } xkbEvent; #define sz_xkbEvent 32 #undef Window #undef Atom #undef Time #undef KeyCode #undef KeySym #endif /* _XKBPROTO_H_ */ vnc_unixsrc/Xvnc/include/extensions/Xagsrv.h0100664000076400007640000000457007120677563020676 0ustar constconst/* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: Xagsrv.h /main/7 1996/11/22 14:48:37 kaleb $ */ #ifndef _XAGSRV_H_ #define _XAGSRV_H_ extern void XagExtensionInit( #if NeedFunctionPrototypes void #endif ); extern void XagConnectionInfo( #if NeedFunctionPrototypes ClientPtr /* client */, xConnSetupPrefix** /* conn_prefix */, char** /* conn_info */, int* /* num_screens */ #endif ); extern VisualID XagRootVisual( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern Colormap XagDefaultColormap( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern ClientPtr XagLeader( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern void XagCallClientStateChange( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern Bool XagIsControlledRoot ( #if NeedFunctionPrototypes ClientPtr /* client */, WindowPtr /* pParent */ #endif ); extern XID XagId ( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern void XagGetDeltaInfo ( #if NeedFunctionPrototypes ClientPtr /* client */, CARD32* /* buf */ #endif ); #endif /* _XAGSRV_H_ */ vnc_unixsrc/Xvnc/include/extensions/lbxbufstr.h0100664000076400007640000000314307120677563021432 0ustar constconst/* $XConsortium: lbxbufstr.h /main/8 1996/11/15 21:33:20 rws $ */ /* * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name Network Computing Devices, Inc. not be * used in advertising or publicity pertaining to distribution of this * software without specific, written prior permission. * * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC., * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, * DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND * REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * */ #ifndef _BUFFERSTR_H_ #define _BUFFERSTR_H_ #include "lbxbuf.h" /* * ZLIB Input/Output buffer */ typedef struct _zlibbuffer { char *bufbase; char *bufend; char *bufptr; int bufcnt; } ZlibBuffer; #define BYTES_AVAIL(inbuf, len) \ (((inbuf)->bufcnt >= (len)) ? (inbuf)->bufptr : NULL) #endif /* _BUFFERSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/sync.h0100664000076400007640000003443407120677563020402 0ustar constconst/* $XConsortium: sync.h,v 1.6 94/04/17 20:11:26 dpw Exp $ */ /* Copyright (c) 1991, 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /*********************************************************** Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef _SYNC_H_ #define _SYNC_H_ #define SYNC_NAME "SYNC" #define SYNC_MAJOR_VERSION 3 #define SYNC_MINOR_VERSION 0 #define X_SyncInitialize 0 #define X_SyncListSystemCounters 1 #define X_SyncCreateCounter 2 #define X_SyncSetCounter 3 #define X_SyncChangeCounter 4 #define X_SyncQueryCounter 5 #define X_SyncDestroyCounter 6 #define X_SyncAwait 7 #define X_SyncCreateAlarm 8 #define X_SyncChangeAlarm 9 #define X_SyncQueryAlarm 10 #define X_SyncDestroyAlarm 11 #define X_SyncSetPriority 12 #define X_SyncGetPriority 13 #define XSyncCounterNotify 0 #define XSyncAlarmNotify 1 #define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify) #define XSyncNumberEvents 2L #define XSyncBadCounter 0L #define XSyncBadAlarm 1L #define XSyncNumberErrors (XSyncBadAlarm + 1) /* * Flags for Alarm Attributes */ #define XSyncCACounter (1L<<0) #define XSyncCAValueType (1L<<1) #define XSyncCAValue (1L<<2) #define XSyncCATestType (1L<<3) #define XSyncCADelta (1L<<4) #define XSyncCAEvents (1L<<5) /* * Constants for the value_type argument of various requests */ typedef enum { XSyncAbsolute, XSyncRelative } XSyncValueType; /* * Alarm Test types */ typedef enum { XSyncPositiveTransition, XSyncNegativeTransition, XSyncPositiveComparison, XSyncNegativeComparison } XSyncTestType; /* * Alarm state constants */ typedef enum { XSyncAlarmActive, XSyncAlarmInactive, XSyncAlarmDestroyed } XSyncAlarmState; typedef XID XSyncCounter; typedef XID XSyncAlarm; typedef struct _XSyncValue { int hi; unsigned int lo; } XSyncValue; /* * Macros/functions for manipulating 64 bit values */ /* have to put these prototypes before the corresponding macro definitions */ extern void XSyncIntToValue( #if NeedFunctionPrototypes XSyncValue* /*pv*/, int /*i*/ #endif ); extern void XSyncIntsToValue( #if NeedFunctionPrototypes XSyncValue* /*pv*/, unsigned int /*l*/, int /*h*/ #endif ); extern Bool XSyncValueGreaterThan( #if NeedFunctionPrototypes XSyncValue /*a*/, XSyncValue /*b*/ #endif ); extern Bool XSyncValueLessThan( #if NeedFunctionPrototypes XSyncValue /*a*/, XSyncValue /*b*/ #endif ); extern Bool XSyncValueGreaterOrEqual( #if NeedFunctionPrototypes XSyncValue /*a*/, XSyncValue /*b*/ #endif ); extern Bool XSyncValueLessOrEqual( #if NeedFunctionPrototypes XSyncValue /*a*/, XSyncValue /*b*/ #endif ); extern Bool XSyncValueEqual( #if NeedFunctionPrototypes XSyncValue /*a*/, XSyncValue /*b*/ #endif ); extern Bool XSyncValueIsNegative( #if NeedFunctionPrototypes XSyncValue /*v*/ #endif ); extern Bool XSyncValueIsZero( #if NeedFunctionPrototypes XSyncValue /*a*/ #endif ); extern Bool XSyncValueIsPositive( #if NeedFunctionPrototypes XSyncValue /*v*/ #endif ); extern unsigned int XSyncValueLow32( #if NeedFunctionPrototypes XSyncValue /*v*/ #endif ); extern int XSyncValueHigh32( #if NeedFunctionPrototypes XSyncValue /*v*/ #endif ); extern void XSyncValueAdd( #if NeedFunctionPrototypes XSyncValue* /*presult*/, XSyncValue /*a*/, XSyncValue /*b*/, int* /*poverflow*/ #endif ); extern void XSyncValueSubtract( #if NeedFunctionPrototypes XSyncValue* /*presult*/, XSyncValue /*a*/, XSyncValue /*b*/, int* /*poverflow*/ #endif ); extern void XSyncMaxValue( #if NeedFunctionPrototypes XSyncValue* /*pv*/ #endif ); extern void XSyncMinValue( #if NeedFunctionPrototypes XSyncValue* /*pv*/ #endif ); /* The _XSync macros below are for library internal use only. They exist * so that if we have to make a fix, we can change it in this one place * and have both the macro and function variants inherit the fix. */ #define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i)) #define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h)) #define _XSyncValueGreaterThan(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo)) #define _XSyncValueLessThan(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo)) #define _XSyncValueGreaterOrEqual(a, b)\ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo)) #define _XSyncValueLessOrEqual(a, b)\ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo)) #define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi) #define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0) #define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0) #define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1) #define _XSyncValueLow32(v) ((v).lo) #define _XSyncValueHigh32(v) ((v).hi) #define _XSyncValueAdd(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo + (b).lo);\ ((presult)->hi = (a).hi + (b).hi);\ if (t>(presult)->lo) (presult)->hi++;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncValueSubtract(presult,a,b,poverflow) {\ int t = (a).lo;\ Bool signa = XSyncValueIsNegative(a);\ Bool signb = XSyncValueIsNegative(b);\ ((presult)->lo = (a).lo - (b).lo);\ ((presult)->hi = (a).hi - (b).hi);\ if (t>(presult)->lo) (presult)->hi--;\ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\ } #define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff) #define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0) /* * These are the publically usable macros. If you want the function version * of one of these, just #undef the macro to uncover the function. * (This is the same convention that the ANSI C library uses.) */ #define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i) #define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h) #define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b) #define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b) #define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b) #define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b) #define XSyncValueEqual(a, b) _XSyncValueEqual(a, b) #define XSyncValueIsNegative(v) _XSyncValueIsNegative(v) #define XSyncValueIsZero(a) _XSyncValueIsZero(a) #define XSyncValueIsPositive(v) _XSyncValueIsPositive(v) #define XSyncValueLow32(v) _XSyncValueLow32(v) #define XSyncValueHigh32(v) _XSyncValueHigh32(v) #define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow) #define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow) #define XSyncMaxValue(pv) _XSyncMaxValue(pv) #define XSyncMinValue(pv) _XSyncMinValue(pv) #ifndef _SYNC_SERVER typedef struct _XSyncSystemCounter { char *name; /* null-terminated name of system counter */ XSyncCounter counter; /* counter id of this system counter */ XSyncValue resolution; /* resolution of this system counter */ } XSyncSystemCounter; typedef struct { XSyncCounter counter; /* counter to trigger on */ XSyncValueType value_type; /* absolute/relative */ XSyncValue wait_value; /* value to compare counter to */ XSyncTestType test_type; /* pos/neg comparison/transtion */ } XSyncTrigger; typedef struct { XSyncTrigger trigger; /* trigger for await */ XSyncValue event_threshold; /* send event if past threshold */ } XSyncWaitCondition; typedef struct { XSyncTrigger trigger; XSyncValue delta; Bool events; XSyncAlarmState state; } XSyncAlarmAttributes; /* * Events */ typedef struct { int type; /* event base + XSyncCounterNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSyncCounter counter; /* counter involved in await */ XSyncValue wait_value; /* value being waited for */ XSyncValue counter_value; /* counter value when this event was sent */ Time time; /* milliseconds */ int count; /* how many more events to come */ Bool destroyed; /* True if counter was destroyed */ } XSyncCounterNotifyEvent; typedef struct { int type; /* event base + XSyncCounterNotify */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ XSyncAlarm alarm; /* alarm that triggered */ XSyncValue counter_value; /* value that triggered the alarm */ XSyncValue alarm_value; /* test value of trigger in alarm */ Time time; /* milliseconds */ XSyncAlarmState state; /* new state of alarm */ } XSyncAlarmNotifyEvent; /* * Errors */ typedef struct { int type; Display *display; /* Display the event was read from */ XSyncAlarm alarm; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error base + XSyncBadAlarm */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XSyncAlarmError; typedef struct { int type; Display *display; /* Display the event was read from */ XSyncCounter counter; /* resource id */ unsigned long serial; /* serial number of failed request */ unsigned char error_code; /* error base + XSyncBadCounter */ unsigned char request_code; /* Major op-code of failed request */ unsigned char minor_code; /* Minor op-code of failed request */ } XSyncCounterError; /* * Prototypes */ extern Status XSyncQueryExtension( #if NeedFunctionPrototypes Display* /*dpy*/, int* /*event_base_return*/, int* /*error_base_return*/ #endif ); extern Status XSyncInitialize( #if NeedFunctionPrototypes Display* /*dpy*/, int* /*major_version_return*/, int* /*minor_version_return*/ #endif ); extern XSyncSystemCounter *XSyncListSystemCounters( #if NeedFunctionPrototypes Display* /*dpy*/, int* /*n_counters_return*/ #endif ); extern void XSyncFreeSystemCounterList( #if NeedFunctionPrototypes XSyncSystemCounter* /*list*/ #endif ); extern XSyncCounter XSyncCreateCounter( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncValue /*initial_value*/ #endif ); extern Status XSyncSetCounter( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue /*value*/ #endif ); extern Status XSyncChangeCounter( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue /*value*/ #endif ); extern Status XSyncDestroyCounter( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncCounter /*counter*/ #endif ); extern Status XSyncQueryCounter( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncCounter /*counter*/, XSyncValue* /*value_return*/ #endif ); extern Status XSyncAwait( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncWaitCondition* /*wait_list*/, int /*n_conditions*/ #endif ); extern XSyncAlarm XSyncCreateAlarm( #if NeedFunctionPrototypes Display* /*dpy*/, unsigned long /*values_mask*/, XSyncAlarmAttributes* /*values*/ #endif ); extern Status XSyncDestroyAlarm( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncAlarm /*alarm*/ #endif ); extern Status XSyncQueryAlarm( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncAlarm /*alarm*/, XSyncAlarmAttributes* /*values_return*/ #endif ); extern Status XSyncChangeAlarm( #if NeedFunctionPrototypes Display* /*dpy*/, XSyncAlarm /*alarm*/, unsigned long /*values_mask*/, XSyncAlarmAttributes* /*values*/ #endif ); extern Status XSyncSetPriority( #if NeedFunctionPrototypes Display* /*dpy*/, XID /*client_resource_id*/, int /*priority*/ #endif ); extern Status XSyncGetPriority( #if NeedFunctionPrototypes Display* /*dpy*/, XID /*client_resource_id*/, int* /*return_priority*/ #endif ); #endif /* _SYNC_SERVER */ #endif /* _SYNC_H_ */ vnc_unixsrc/Xvnc/include/extensions/lbxstr.h0100664000076400007640000005710107120677563020740 0ustar constconst/* $XConsortium: lbxstr.h /main/27 1996/12/15 21:24:11 rws $ */ /* * Copyright 1992 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of NCD. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. NCD. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #ifndef _LBXSTR_H_ #define _LBXSTR_H_ #include "XLbx.h" #define LBXNAME "LBX" #define LBX_MAJOR_VERSION 1 #define LBX_MINOR_VERSION 0 typedef struct { BOOL success; /* TRUE */ BOOL changeType; CARD16 majorVersion B16, minorVersion B16; CARD16 length B16; /* 1/4 additional bytes in setup info */ CARD32 tag B32; } xLbxConnSetupPrefix; typedef struct _LbxQueryVersion { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryVersion */ CARD16 length B16; } xLbxQueryVersionReq; #define sz_xLbxQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of LBX protocol */ CARD16 minorVersion B16; /* minor version of LBX protocol */ CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxQueryVersionReply; #define sz_xLbxQueryVersionReply 32 typedef struct _LbxStartProxy { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxStartProxy */ CARD16 length B16; } xLbxStartProxyReq; #define sz_xLbxStartProxyReq 4 typedef struct _LbxStopProxy { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxStopProxy */ CARD16 length B16; } xLbxStopProxyReq; #define sz_xLbxStopProxyReq 4 typedef struct _LbxSwitch { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxSwitch */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxSwitchReq; #define sz_xLbxSwitchReq 8 typedef struct _LbxNewClient { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxNewClient */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxNewClientReq; #define sz_xLbxNewClientReq 8 typedef struct _LbxCloseClient { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxCloseClient */ CARD16 length B16; CARD32 client B32; /* new client */ } xLbxCloseClientReq; #define sz_xLbxCloseClientReq 8 typedef struct _LbxModifySequence { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxModifySequence */ CARD16 length B16; CARD32 adjust B32; } xLbxModifySequenceReq; #define sz_xLbxModifySequenceReq 8 typedef struct _LbxAllowMotion { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxAllowMotion */ CARD16 length B16; CARD32 num B32; } xLbxAllowMotionReq; #define sz_xLbxAllowMotionReq 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGrabCmap */ CARD16 length B16; Colormap cmap B32; } xLbxGrabCmapReq; #define sz_xLbxGrabCmapReq 8 #define LBX_SMART_GRAB 0x80 #define LBX_AUTO_RELEASE 0x40 #define LBX_3CHANNELS 0x20 #define LBX_2BYTE_PIXELS 0x10 #define LBX_RGB_BITS_MASK 0x0f #define LBX_LIST_END 0 #define LBX_PIXEL_PRIVATE 1 #define LBX_PIXEL_SHARED 2 #define LBX_PIXEL_RANGE_PRIVATE 3 #define LBX_PIXEL_RANGE_SHARED 4 #define LBX_NEXT_CHANNEL 5 typedef struct { BYTE type; /* X_Reply */ CARD8 flags; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad0 B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B16; } xLbxGrabCmapReply; #define sz_xLbxGrabCmapReply 32 #define sz_xLbxGrabCmapReplyHdr 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxReleaseCmap */ CARD16 length B16; Colormap cmap B32; } xLbxReleaseCmapReq; #define sz_xLbxReleaseCmapReq 8 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxAllocColor */ CARD16 length B16; Colormap cmap B32; CARD32 pixel B32; CARD16 red B16, green B16, blue B16; CARD16 pad B16; } xLbxAllocColorReq; #define sz_xLbxAllocColorReq 20 typedef struct _LbxIncrementPixel { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxIncrementPixel */ CARD16 length B16; CARD32 cmap B32; CARD32 pixel B32; } xLbxIncrementPixelReq; #define sz_xLbxIncrementPixelReq 12 typedef struct _LbxDelta { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxDelta */ CARD16 length B16; CARD8 diffs; /* number of diffs */ CARD8 cindex; /* cache index */ /* list of diffs follows */ } xLbxDeltaReq; #define sz_xLbxDeltaReq 6 typedef struct _LbxGetModifierMapping { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetModifierMapping */ CARD16 length B16; } xLbxGetModifierMappingReq; #define sz_xLbxGetModifierMappingReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 keyspermod; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxGetModifierMappingReply; #define sz_xLbxGetModifierMappingReply 32 typedef struct _LbxGetKeyboardMapping { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */ CARD16 length B16; KeyCode firstKeyCode; CARD8 count; CARD16 pad1 B16; } xLbxGetKeyboardMappingReq; #define sz_xLbxGetKeyboardMappingReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 keysperkeycode; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxGetKeyboardMappingReply; #define sz_xLbxGetKeyboardMappingReply 32 typedef struct _LbxQueryFont { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryFont */ CARD16 length B16; CARD32 fid B32; } xLbxQueryFontReq; #define sz_xLbxQueryFontReq 8 typedef struct _LbxInternAtoms { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxInternAtoms */ CARD16 length B16; CARD16 num B16; } xLbxInternAtomsReq; #define sz_xLbxInternAtomsReq 6 typedef struct { BYTE type; /* X_Reply */ CARD8 unused; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 atomsStart B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxInternAtomsReply; #define sz_xLbxInternAtomsReply 32 #define sz_xLbxInternAtomsReplyHdr 8 typedef struct _LbxGetWinAttrAndGeom { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */ CARD16 length B16; CARD32 id B32; /* window id */ } xLbxGetWinAttrAndGeomReq; #define sz_xLbxGetWinAttrAndGeomReq 8 typedef struct { BYTE type; /* X_Reply */ CARD8 backingStore; CARD16 sequenceNumber B16; CARD32 length B32; /* NOT 0; this is an extra-large reply */ VisualID visualID B32; #if defined(__cplusplus) || defined(c_plusplus) CARD16 c_class B16; #else CARD16 class B16; #endif CARD8 bitGravity; CARD8 winGravity; CARD32 backingBitPlanes B32; CARD32 backingPixel B32; BOOL saveUnder; BOOL mapInstalled; CARD8 mapState; BOOL override; Colormap colormap B32; CARD32 allEventMasks B32; CARD32 yourEventMask B32; CARD16 doNotPropagateMask B16; CARD16 pad1 B16; Window root B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD16 borderWidth B16; CARD8 depth; CARD8 pad2; } xLbxGetWinAttrAndGeomReply; #define sz_xLbxGetWinAttrAndGeomReply 60 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxSync */ CARD16 length B16; } xLbxSyncReq; #define sz_xLbxSyncReq 4 typedef struct { BYTE type; /* X_Reply */ CARD8 pad0; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxSyncReply; #define sz_xLbxSyncReply 32 /* an LBX squished charinfo packs the data in a CARD32 as follows */ #define LBX_WIDTH_SHIFT 26 #define LBX_LEFT_SHIFT 20 #define LBX_RIGHT_SHIFT 13 #define LBX_ASCENT_SHIFT 7 #define LBX_DESCENT_SHIFT 0 #define LBX_WIDTH_BITS 6 #define LBX_LEFT_BITS 6 #define LBX_RIGHT_BITS 7 #define LBX_ASCENT_BITS 6 #define LBX_DESCENT_BITS 7 #define LBX_WIDTH_MASK 0xfc000000 #define LBX_LEFT_MASK 0x03f00000 #define LBX_RIGHT_MASK 0x000fe000 #define LBX_ASCENT_MASK 0x00001f80 #define LBX_DESCENT_MASK 0x0000007f #define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1))) typedef struct { CARD32 metrics B32; } xLbxCharInfo; /* note that this is identical to xQueryFontReply except for missing * first 2 words */ typedef struct { xCharInfo minBounds; /* XXX do we need to leave this gunk? */ #ifndef WORD64 CARD32 walign1 B32; #endif xCharInfo maxBounds; #ifndef WORD64 CARD32 walign2 B32; #endif CARD16 minCharOrByte2 B16, maxCharOrByte2 B16; CARD16 defaultChar B16; CARD16 nFontProps B16; /* followed by this many xFontProp structures */ CARD8 drawDirection; CARD8 minByte1, maxByte1; BOOL allCharsExist; INT16 fontAscent B16, fontDescent B16; CARD32 nCharInfos B32; /* followed by this many xLbxCharInfo structures */ } xLbxFontInfo; typedef struct { BYTE type; /* X_Reply */ CARD8 compression; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* X_QueryFont sticks much of the data in the base reply packet, * but we hope that it won't be needed, (and it won't fit in 32 bytes * with the tag anyways) * * if any additional data is needed, its sent in a xLbxFontInfo */ } xLbxQueryFontReply; #define sz_xLbxQueryFontReply 32 typedef struct _LbxChangeProperty { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxChangeProperty */ CARD16 length B16; Window window B32; Atom property B32; Atom type B32; CARD8 format; CARD8 mode; BYTE pad[2]; CARD32 nUnits B32; } xLbxChangePropertyReq; #define sz_xLbxChangePropertyReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 pad; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 tag B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxChangePropertyReply; #define sz_xLbxChangePropertyReply 32 typedef struct _LbxGetProperty { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetProperty */ CARD16 length B16; Window window B32; Atom property B32; Atom type B32; CARD8 delete; BYTE pad[3]; CARD32 longOffset B32; CARD32 longLength B32; } xLbxGetPropertyReq; #define sz_xLbxGetPropertyReq 28 typedef struct { BYTE type; /* X_Reply */ CARD8 format; CARD16 sequenceNumber B16; CARD32 length B32; Atom propertyType B32; CARD32 bytesAfter B32; CARD32 nItems B32; CARD32 tag B32; CARD32 pad1 B32; CARD32 pad2 B32; } xLbxGetPropertyReply; #define sz_xLbxGetPropertyReply 32 typedef struct _LbxTagData { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxTagData */ CARD16 length B16; XID tag B32; CARD32 real_length B32; /* data */ } xLbxTagDataReq; #define sz_xLbxTagDataReq 12 typedef struct _LbxInvalidateTag { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxInvalidateTag */ CARD16 length B16; CARD32 tag B32; } xLbxInvalidateTagReq; #define sz_xLbxInvalidateTagReq 8 typedef struct _LbxPutImage { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxPutImage */ CARD16 length B16; CARD8 compressionMethod; CARD8 cacheEnts; CARD8 bitPacked; /* rest is variable */ } xLbxPutImageReq; #define sz_xLbxPutImageReq 7 typedef struct { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxGetImage */ CARD16 length B16; Drawable drawable B32; INT16 x B16, y B16; CARD16 width B16, height B16; CARD32 planeMask B32; CARD8 format; CARD8 pad1; CARD16 pad2 B16; } xLbxGetImageReq; #define sz_xLbxGetImageReq 24 typedef struct { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 lbxLength B32; CARD32 xLength B32; VisualID visual B32; CARD8 compressionMethod; CARD8 pad1; CARD16 pad2 B16; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxGetImageReply; #define sz_xLbxGetImageReply 32 /* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment, LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */ #define GFX_CACHE_SIZE 15 #define GFXdCacheEnt(e) ((e) & 0xf) #define GFXgCacheEnt(e) (((e) >> 4) & 0xf) #define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4)) #define GFXCacheNone 0xf typedef struct _LbxPolyPoint { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; CARD8 padBytes; } xLbxPolyPointReq; #define sz_xLbxPolyPointReq 6 typedef xLbxPolyPointReq xLbxPolyLineReq; typedef xLbxPolyPointReq xLbxPolySegmentReq; typedef xLbxPolyPointReq xLbxPolyRectangleReq; typedef xLbxPolyPointReq xLbxPolyArcReq; typedef xLbxPolyPointReq xLbxPolyFillRectangleReq; typedef xLbxPolyPointReq xLbxPolyFillArcReq; #define sz_xLbxPolyLineReq sz_xLbxPolyPointReq #define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq #define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq #define sz_xLbxPolyArcReq sz_xLbxPolyPointReq #define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq #define sz_xLbxPolyFillArc sz_xLbxPolyPointReq typedef struct _LbxFillPoly { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; BYTE shape; CARD8 padBytes; } xLbxFillPolyReq; #define sz_xLbxFillPolyReq 7 typedef struct _LbxCopyArea { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 srcCache; /* source drawable */ CARD8 cacheEnts; /* dest drawable and gc */ /* followed by encoded src x, src y, dst x, dst y, width, height */ } xLbxCopyAreaReq; #define sz_xLbxCopyAreaReq 6 typedef struct _LbxCopyPlane { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD32 bitPlane B32; CARD8 srcCache; /* source drawable */ CARD8 cacheEnts; /* dest drawable and gc */ /* followed by encoded src x, src y, dst x, dst y, width, height */ } xLbxCopyPlaneReq; #define sz_xLbxCopyPlaneReq 10 typedef struct _LbxPolyText { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; /* followed by encoded src x, src y coordinates and text elts */ } xLbxPolyTextReq; #define sz_xLbxPolyTextReq 5 typedef xLbxPolyTextReq xLbxPolyText8Req; typedef xLbxPolyTextReq xLbxPolyText16Req; #define sz_xLbxPolyTextReq 5 #define sz_xLbxPolyText8Req 5 #define sz_xLbxPolyText16Req 5 typedef struct _LbxImageText { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; CARD16 length B16; CARD8 cacheEnts; CARD8 nChars; /* followed by encoded src x, src y coordinates and string */ } xLbxImageTextReq; typedef xLbxImageTextReq xLbxImageText8Req; typedef xLbxImageTextReq xLbxImageText16Req; #define sz_xLbxImageTextReq 6 #define sz_xLbxImageText8Req 6 #define sz_xLbxImageText16Req 6 typedef struct { CARD8 offset; CARD8 diff; } xLbxDiffItem; #define sz_xLbxDiffItem 2 typedef struct { BYTE type; /* X_Reply */ CARD8 nOpts; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 optDataStart B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxStartReply; #define sz_xLbxStartReply 32 #define sz_xLbxStartReplyHdr 8 typedef struct _LbxQueryExtension { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxQueryExtension */ CARD16 length B16; CARD32 nbytes B32; } xLbxQueryExtensionReq; #define sz_xLbxQueryExtensionReq 8 typedef struct _LbxQueryExtensionReply { BYTE type; /* X_Reply */ CARD8 numReqs; CARD16 sequenceNumber B16; CARD32 length B32; BOOL present; CARD8 major_opcode; CARD8 first_event; CARD8 first_error; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; /* reply & event generating requests */ } xLbxQueryExtensionReply; #define sz_xLbxQueryExtensionReply 32 typedef struct _LbxBeginLargeRequest { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */ CARD16 length B16; CARD32 largeReqLength B32; } xLbxBeginLargeRequestReq; #define sz_BeginLargeRequestReq 8 typedef struct _LbxLargeRequestData { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxLargeRequestData */ CARD16 length B16; /* followed by LISTofCARD8 data */ } xLbxLargeRequestDataReq; #define sz_LargeRequestDataReq 4 typedef struct _LbxEndLargeRequest { CARD8 reqType; /* always LbxReqCode */ CARD8 lbxReqType; /* always X_LbxEndLargeRequest */ CARD16 length B16; } xLbxEndLargeRequestReq; #define sz_EndLargeRequestReq 4 typedef struct _LbxSwitchEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxSwitchEvent */ CARD16 pad B16; CARD32 client B32; } xLbxSwitchEvent; #define sz_xLbxSwitchEvent 8 typedef struct _LbxCloseEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxCloseEvent */ CARD16 sequenceNumber B16; CARD32 client B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxCloseEvent; #define sz_xLbxCloseEvent 32 typedef struct _LbxInvalidateTagEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxInvalidateTagEvent */ CARD16 sequenceNumber B16; CARD32 tag B32; CARD32 tagType B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxInvalidateTagEvent; #define sz_xLbxInvalidateTagEvent 32 typedef struct _LbxSendTagDataEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxSendTagDataEvent */ CARD16 sequenceNumber B16; CARD32 tag B32; CARD32 tagType B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xLbxSendTagDataEvent; #define sz_xLbxSendTagDataEvent 32 typedef struct _LbxListenToOneEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxListenToOneEvent */ CARD16 sequenceNumber B16; CARD32 client B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxListenToOneEvent; #define sz_xLbxListenToOneEvent 32 typedef struct _LbxListenToAllEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxListenToAllEvent */ CARD16 sequenceNumber B16; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; CARD32 pad7 B32; } xLbxListenToAllEvent; #define sz_xLbxListenToOneEvent 32 typedef struct _LbxReleaseCmapEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxReleaseCmapEvent */ CARD16 sequenceNumber B16; Colormap colormap B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xLbxReleaseCmapEvent; #define sz_xLbxReleaseCmapEvent 32 typedef struct _LbxFreeCellsEvent { BYTE type; /* always eventBase + LbxEvent */ BYTE lbxType; /* LbxFreeCellsEvent */ CARD16 sequenceNumber B16; Colormap colormap B32; CARD32 pixelStart B32; CARD32 pixelEnd B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xLbxFreeCellsEvent; #define sz_xLbxFreeCellsEvent 32 /* * squished X event sizes. If these change, be sure to update lbxquish.c * and unsquish.c appropriately * * lbxsz_* is the padded squished length * lbxupsz_* is the unpadded squished length */ #define lbxsz_KeyButtonEvent 32 #define lbxupsz_KeyButtonEvent 31 #define lbxsz_EnterLeaveEvent 32 #define lbxupsz_EnterLeaveEvent 32 #define lbxsz_FocusEvent 12 #define lbxupsz_FocusEvent 9 #define lbxsz_KeymapEvent 32 #define lbxupsz_KeymapEvent 32 #define lbxsz_ExposeEvent 20 #define lbxupsz_ExposeEvent 18 #define lbxsz_GfxExposeEvent 24 #define lbxupsz_GfxExposeEvent 21 #define lbxsz_NoExposeEvent 12 #define lbxupsz_NoExposeEvent 11 #define lbxsz_VisibilityEvent 12 #define lbxupsz_VisibilityEvent 9 #define lbxsz_CreateNotifyEvent 24 #define lbxupsz_CreateNotifyEvent 23 #define lbxsz_DestroyNotifyEvent 12 #define lbxupsz_DestroyNotifyEvent 12 #define lbxsz_UnmapNotifyEvent 16 #define lbxupsz_UnmapNotifyEvent 13 #define lbxsz_MapNotifyEvent 16 #define lbxupsz_MapNotifyEvent 13 #define lbxsz_MapRequestEvent 12 #define lbxupsz_MapRequestEvent 12 #define lbxsz_ReparentEvent 24 #define lbxupsz_ReparentEvent 21 #define lbxsz_ConfigureNotifyEvent 28 #define lbxupsz_ConfigureNotifyEvent 27 #define lbxsz_ConfigureRequestEvent 28 #define lbxupsz_ConfigureRequestEvent 28 #define lbxsz_GravityEvent 16 #define lbxupsz_GravityEvent 16 #define lbxsz_ResizeRequestEvent 12 #define lbxupsz_ResizeRequestEvent 12 #define lbxsz_CirculateEvent 20 #define lbxupsz_CirculateEvent 17 #define lbxsz_PropertyEvent 20 #define lbxupsz_PropertyEvent 17 #define lbxsz_SelectionClearEvent 16 #define lbxupsz_SelectionClearEvent 16 #define lbxsz_SelectionRequestEvent 28 #define lbxupsz_SelectionRequestEvent 28 #define lbxsz_SelectionNotifyEvent 24 #define lbxupsz_SelectionNotifyEvent 24 #define lbxsz_ColormapEvent 16 #define lbxupsz_ColormapEvent 14 #define lbxsz_MappingNotifyEvent 8 #define lbxupsz_MappingNotifyEvent 7 #define lbxsz_ClientMessageEvent 32 #define lbxupsz_ClientMessageEvent 32 #define lbxsz_UnknownEvent 32 #ifdef DEBUG #define DBG_SWITCH 0x00000001 #define DBG_CLOSE 0x00000002 #define DBG_IO 0x00000004 #define DBG_READ_REQ 0x00000008 #define DBG_LEN 0x00000010 #define DBG_BLOCK 0x00000020 #define DBG_CLIENT 0x00000040 #define DBG_DELTA 0x00000080 extern int lbxDebug; #define DBG(n,m) if (lbxDebug & (n)) { fprintf m; } else #else #define DBG(n,m) #endif #endif /* _LBXSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/record.h0100664000076400007640000001352207120677563020677 0ustar constconst/* $XConsortium: record.h /main/4 1996/01/31 20:28:22 dpw $ */ /*************************************************************************** * Copyright 1995 Network Computing Devices * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Network Computing Devices * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **************************************************************************/ #ifndef _RECORD_H_ #define _RECORD_H_ #define XRecordBadContext 0 /* Not a valid RC */ /* * Constants for arguments of various requests */ #define XRecordFromServerTime 0x01 #define XRecordFromClientTime 0x02 #define XRecordFromClientSequence 0x04 #define XRecordCurrentClients 1 #define XRecordFutureClients 2 #define XRecordAllClients 3 #define XRecordFromServer 0 #define XRecordFromClient 1 #define XRecordClientStarted 2 #define XRecordClientDied 3 #define XRecordStartOfData 4 #define XRecordEndOfData 5 typedef unsigned long XRecordClientSpec; #ifndef _XRECORD_SERVER_ typedef unsigned long XRecordContext; typedef struct { unsigned char first; unsigned char last; } XRecordRange8; typedef struct { unsigned short first; unsigned short last; } XRecordRange16; typedef struct { XRecordRange8 ext_major; XRecordRange16 ext_minor; } XRecordExtRange; typedef struct { XRecordRange8 core_requests; /* core X requests */ XRecordRange8 core_replies; /* core X replies */ XRecordExtRange ext_requests; /* extension requests */ XRecordExtRange ext_replies; /* extension replies */ XRecordRange8 delivered_events; /* delivered core and ext events */ XRecordRange8 device_events; /* all core and ext device events */ XRecordRange8 errors; /* core X and ext errors */ Bool client_started; /* connection setup reply */ Bool client_died; /* notice of client disconnect */ } XRecordRange; typedef struct { XRecordClientSpec client; unsigned long nranges; XRecordRange **ranges; } XRecordClientInfo; typedef struct { Bool enabled; int datum_flags; unsigned long nclients; XRecordClientInfo **client_info; } XRecordState; typedef struct { XID id_base; Time server_time; unsigned long client_seq; int category; Bool client_swapped; unsigned char *data; unsigned long data_len; /* in 4-byte units */ } XRecordInterceptData; _XFUNCPROTOBEGIN /********************************************************* * * Prototypes * */ XID XRecordIdBaseMask( #if NeedFunctionPrototypes Display *dpy #endif ); extern Status XRecordQueryVersion( #if NeedFunctionPrototypes Display* /* dpy */, int* /* cmajor_return */, int* /* cminor_return */ #endif ); extern XRecordContext XRecordCreateContext( #if NeedFunctionPrototypes Display* /* dpy */, int /* datum_flags */, XRecordClientSpec* /* clients */, int /* nclients */, XRecordRange** /* ranges */, int /* nranges */ #endif ); extern XRecordRange *XRecordAllocRange( #if NeedFunctionPrototypes void #endif ); extern Status XRecordRegisterClients( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */, int /* datum_flags */, XRecordClientSpec* /* clients */, int /* nclients */, XRecordRange** /* ranges */, int /* nranges */ #endif ); extern Status XRecordUnregisterClients( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */, XRecordClientSpec* /* clients */, int /* nclients */ #endif ); extern Status XRecordGetContext( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */, XRecordState** /* state_return */ #endif ); extern void XRecordFreeState( #if NeedFunctionPrototypes XRecordState* /* state */ #endif ); typedef void (*XRecordInterceptProc) ( #if NeedFunctionPrototypes XPointer /* closure */, XRecordInterceptData* /* recorded_data */ #endif ); extern Status XRecordEnableContext( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */, XRecordInterceptProc /* callback */, XPointer /* closure */ #endif ); extern Status XRecordEnableContextAsync( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */, XRecordInterceptProc /* callback */, XPointer /* closure */ #endif ); extern void XRecordProcessReplies( #if NeedFunctionPrototypes Display* /* dpy */ #endif ); extern void XRecordFreeData( #if NeedFunctionPrototypes XRecordInterceptData* /* data */ #endif ); extern Status XRecordDisableContext( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */ #endif ); extern Status XRecordFreeContext( #if NeedFunctionPrototypes Display* /* dpy */, XRecordContext /* context */ #endif ); _XFUNCPROTOEND #endif /* _XRECORD_SERVER_ */ #endif /* _RECORD_H_ */ vnc_unixsrc/Xvnc/include/extensions/XI.h0100664000076400007640000002052707120677563017744 0ustar constconst/* $XConsortium: XI.h /main/16 1995/12/05 11:17:30 dpw $ */ /************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, California. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* Definitions used by the server, library and client */ #ifndef _XI_H_ #define _XI_H_ #define sz_xGetExtensionVersionReq 8 #define sz_xGetExtensionVersionReply 32 #define sz_xListInputDevicesReq 4 #define sz_xListInputDevicesReply 32 #define sz_xOpenDeviceReq 8 #define sz_xOpenDeviceReply 32 #define sz_xCloseDeviceReq 8 #define sz_xSetDeviceModeReq 8 #define sz_xSetDeviceModeReply 32 #define sz_xSelectExtensionEventReq 12 #define sz_xGetSelectedExtensionEventsReq 8 #define sz_xGetSelectedExtensionEventsReply 32 #define sz_xChangeDeviceDontPropagateListReq 12 #define sz_xGetDeviceDontPropagateListReq 8 #define sz_xGetDeviceDontPropagateListReply 32 #define sz_xGetDeviceMotionEventsReq 16 #define sz_xGetDeviceMotionEventsReply 32 #define sz_xChangeKeyboardDeviceReq 8 #define sz_xChangeKeyboardDeviceReply 32 #define sz_xChangePointerDeviceReq 8 #define sz_xChangePointerDeviceReply 32 #define sz_xGrabDeviceReq 20 #define sz_xGrabDeviceReply 32 #define sz_xUngrabDeviceReq 12 #define sz_xGrabDeviceKeyReq 20 #define sz_xGrabDeviceKeyReply 32 #define sz_xUngrabDeviceKeyReq 16 #define sz_xGrabDeviceButtonReq 20 #define sz_xGrabDeviceButtonReply 32 #define sz_xUngrabDeviceButtonReq 16 #define sz_xAllowDeviceEventsReq 12 #define sz_xGetDeviceFocusReq 8 #define sz_xGetDeviceFocusReply 32 #define sz_xSetDeviceFocusReq 16 #define sz_xGetFeedbackControlReq 8 #define sz_xGetFeedbackControlReply 32 #define sz_xChangeFeedbackControlReq 12 #define sz_xGetDeviceKeyMappingReq 8 #define sz_xGetDeviceKeyMappingReply 32 #define sz_xChangeDeviceKeyMappingReq 8 #define sz_xGetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReq 8 #define sz_xSetDeviceModifierMappingReply 32 #define sz_xGetDeviceButtonMappingReq 8 #define sz_xGetDeviceButtonMappingReply 32 #define sz_xSetDeviceButtonMappingReq 8 #define sz_xSetDeviceButtonMappingReply 32 #define sz_xQueryDeviceStateReq 8 #define sz_xQueryDeviceStateReply 32 #define sz_xSendExtensionEventReq 16 #define sz_xDeviceBellReq 8 #define sz_xSetDeviceValuatorsReq 8 #define sz_xSetDeviceValuatorsReply 32 #define sz_xGetDeviceControlReq 8 #define sz_xGetDeviceControlReply 32 #define sz_xChangeDeviceControlReq 8 #define sz_xChangeDeviceControlReply 32 #define INAME "XInputExtension" #define XI_KEYBOARD "KEYBOARD" #define XI_MOUSE "MOUSE" #define XI_TABLET "TABLET" #define XI_TOUCHSCREEN "TOUCHSCREEN" #define XI_TOUCHPAD "TOUCHPAD" #define XI_BARCODE "BARCODE" #define XI_BUTTONBOX "BUTTONBOX" #define XI_KNOB_BOX "KNOB_BOX" #define XI_ONE_KNOB "ONE_KNOB" #define XI_NINE_KNOB "NINE_KNOB" #define XI_TRACKBALL "TRACKBALL" #define XI_QUADRATURE "QUADRATURE" #define XI_ID_MODULE "ID_MODULE" #define XI_SPACEBALL "SPACEBALL" #define XI_DATAGLOVE "DATAGLOVE" #define XI_EYETRACKER "EYETRACKER" #define XI_CURSORKEYS "CURSORKEYS" #define XI_FOOTMOUSE "FOOTMOUSE" #define Dont_Check 0 #define XInput_Initial_Release 1 #define XInput_Add_XDeviceBell 2 #define XInput_Add_XSetDeviceValuators 3 #define XInput_Add_XChangeDeviceControl 4 #define XI_Absent 0 #define XI_Present 1 #define XI_Initial_Release_Major 1 #define XI_Initial_Release_Minor 0 #define XI_Add_XDeviceBell_Major 1 #define XI_Add_XDeviceBell_Minor 1 #define XI_Add_XSetDeviceValuators_Major 1 #define XI_Add_XSetDeviceValuators_Minor 2 #define XI_Add_XChangeDeviceControl_Major 1 #define XI_Add_XChangeDeviceControl_Minor 3 #define DEVICE_RESOLUTION 1 #define NoSuchExtension 1 #define COUNT 0 #define CREATE 1 #define NewPointer 0 #define NewKeyboard 1 #define XPOINTER 0 #define XKEYBOARD 1 #define UseXKeyboard 0xFF #define IsXPointer 0 #define IsXKeyboard 1 #define IsXExtensionDevice 2 #define AsyncThisDevice 0 #define SyncThisDevice 1 #define ReplayThisDevice 2 #define AsyncOtherDevices 3 #define AsyncAll 4 #define SyncAll 5 #define FollowKeyboard 3 #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif #define DvAccelNum (1L << 0) #define DvAccelDenom (1L << 1) #define DvThreshold (1L << 2) #define DvKeyClickPercent (1L<<0) #define DvPercent (1L<<1) #define DvPitch (1L<<2) #define DvDuration (1L<<3) #define DvLed (1L<<4) #define DvLedMode (1L<<5) #define DvKey (1L<<6) #define DvAutoRepeatMode (1L<<7) #define DvString (1L << 0) #define DvInteger (1L << 0) #define DeviceMode (1L << 0) #define Relative 0 #define Absolute 1 #define ProximityState (1L << 1) #define InProximity (0L << 1) #define OutOfProximity (1L << 1) #define AddToList 0 #define DeleteFromList 1 #define KeyClass 0 #define ButtonClass 1 #define ValuatorClass 2 #define FeedbackClass 3 #define ProximityClass 4 #define FocusClass 5 #define OtherClass 6 #define KbdFeedbackClass 0 #define PtrFeedbackClass 1 #define StringFeedbackClass 2 #define IntegerFeedbackClass 3 #define LedFeedbackClass 4 #define BellFeedbackClass 5 #define _devicePointerMotionHint 0 #define _deviceButton1Motion 1 #define _deviceButton2Motion 2 #define _deviceButton3Motion 3 #define _deviceButton4Motion 4 #define _deviceButton5Motion 5 #define _deviceButtonMotion 6 #define _deviceButtonGrab 7 #define _deviceOwnerGrabButton 8 #define _noExtensionEvent 9 #define XI_BadDevice 0 #define XI_BadEvent 1 #define XI_BadMode 2 #define XI_DeviceBusy 3 #define XI_BadClass 4 /* Make XEventClass be a CARD32 for 64 bit servers. Don't affect client * definition of XEventClass since that would be a library interface change. * See the top of X.h for more _XSERVER64 magic. */ #ifdef _XSERVER64 typedef CARD32 XEventClass; #else typedef unsigned long XEventClass; #endif /******************************************************************* * * Extension version structure. * */ typedef struct { int present; short major_version; short minor_version; } XExtensionVersion; #endif /* _XI_H_ */ vnc_unixsrc/Xvnc/include/extensions/saver.h0100664000076400007640000000365207120677563020544 0ustar constconst/* * $XConsortium: saver.h,v 1.5 94/04/17 20:59:33 rws Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _SAVER_H_ #define _SAVER_H_ #define ScreenSaverName "MIT-SCREEN-SAVER" #define ScreenSaverPropertyName "_MIT_SCREEN_SAVER_ID" #define ScreenSaverNotifyMask 0x00000001 #define ScreenSaverCycleMask 0x00000002 #define ScreenSaverMajorVersion 1 #define ScreenSaverMinorVersion 0 #define ScreenSaverOff 0 #define ScreenSaverOn 1 #define ScreenSaverCycle 2 #define ScreenSaverDisabled 3 #define ScreenSaverBlanked 0 #define ScreenSaverInternal 1 #define ScreenSaverExternal 2 #define ScreenSaverNotify 0 #define ScreenSaverNumberEvents 1 #endif /* _SAVER_H_ */ vnc_unixsrc/Xvnc/include/extensions/shmstr.h0100664000076400007640000001377707120677563020755 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _SHMSTR_H_ #define _SHMSTR_H_ /* $XConsortium: shmstr.h,v 1.9 94/04/17 20:11:25 rws Exp $ */ /* $XFree86: xc/include/extensions/shmstr.h,v 3.0 1996/05/06 05:52:42 dawes Exp $ */ #include "XShm.h" #define ShmSeg CARD32 #define Drawable CARD32 #define VisualID CARD32 #define GContext CARD32 #define Pixmap CARD32 #define SHMNAME "MIT-SHM" #define SHM_MAJOR_VERSION 1 /* current version numbers */ #define SHM_MINOR_VERSION 1 #ifdef _XSHM_SERVER_ #if NeedFunctionPrototypes #define XSHM_PUT_IMAGE_ARGS \ DrawablePtr /* dst */, \ GCPtr /* pGC */, \ int /* depth */, \ unsigned int /* format */, \ int /* w */, \ int /* h */, \ int /* sx */, \ int /* sy */, \ int /* sw */, \ int /* sh */, \ int /* dx */, \ int /* dy */, \ char * /* data */ #else #define XSHM_PUT_IMAGE_ARGS /* nothing */ #endif #if NeedFunctionPrototypes #define XSHM_CREATE_PIXMAP_ARGS \ ScreenPtr /* pScreen */, \ int /* width */, \ int /* height */, \ int /* depth */, \ char * /* addr */ #else #define XSHM_CREATE_PIXMAP_ARGS /* nothing */ #endif typedef struct _ShmFuncs { PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS); void (* PutImage)(XSHM_PUT_IMAGE_ARGS); } ShmFuncs, *ShmFuncsPtr; #endif typedef struct _ShmQueryVersion { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmQueryVersion */ CARD16 length B16; } xShmQueryVersionReq; #define sz_xShmQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL sharedPixmaps; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of SHM protocol */ CARD16 minorVersion B16; /* minor version of SHM protocol */ CARD16 uid B16; CARD16 gid B16; CARD8 pixmapFormat; CARD8 pad0; CARD16 pad1 B16; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; } xShmQueryVersionReply; #define sz_xShmQueryVersionReply 32 typedef struct _ShmAttach { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmAttach */ CARD16 length B16; ShmSeg shmseg B32; CARD32 shmid B32; BOOL readOnly; BYTE pad0; CARD16 pad1 B16; } xShmAttachReq; #define sz_xShmAttachReq 16 typedef struct _ShmDetach { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmDetach */ CARD16 length B16; ShmSeg shmseg B32; } xShmDetachReq; #define sz_xShmDetachReq 8 typedef struct _ShmPutImage { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmPutImage */ CARD16 length B16; Drawable drawable B32; GContext gc B32; CARD16 totalWidth B16; CARD16 totalHeight B16; CARD16 srcX B16; CARD16 srcY B16; CARD16 srcWidth B16; CARD16 srcHeight B16; INT16 dstX B16; INT16 dstY B16; CARD8 depth; CARD8 format; CARD8 sendEvent; CARD8 bpad; ShmSeg shmseg B32; CARD32 offset B32; } xShmPutImageReq; #define sz_xShmPutImageReq 40 typedef struct _ShmGetImage { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmGetImage */ CARD16 length B16; Drawable drawable B32; INT16 x B16; INT16 y B16; CARD16 width B16; CARD16 height B16; CARD32 planeMask B32; CARD8 format; CARD8 pad0; CARD8 pad1; CARD8 pad2; ShmSeg shmseg B32; CARD32 offset B32; } xShmGetImageReq; #define sz_xShmGetImageReq 32 typedef struct _ShmGetImageReply { BYTE type; /* X_Reply */ CARD8 depth; CARD16 sequenceNumber B16; CARD32 length B32; VisualID visual B32; CARD32 size B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; CARD32 pad3 B32; } xShmGetImageReply; #define sz_xShmGetImageReply 32 typedef struct _ShmCreatePixmap { CARD8 reqType; /* always ShmReqCode */ CARD8 shmReqType; /* always X_ShmCreatePixmap */ CARD16 length B16; Pixmap pid B32; Drawable drawable B32; CARD16 width B16; CARD16 height B16; CARD8 depth; CARD8 pad0; CARD8 pad1; CARD8 pad2; ShmSeg shmseg B32; CARD32 offset B32; } xShmCreatePixmapReq; #define sz_xShmCreatePixmapReq 28 typedef struct _ShmCompletion { BYTE type; /* always eventBase + ShmCompletion */ BYTE bpad0; CARD16 sequenceNumber B16; Drawable drawable B32; CARD16 minorEvent B16; BYTE majorEvent; BYTE bpad1; ShmSeg shmseg B32; CARD32 offset B32; CARD32 pad0 B32; CARD32 pad1 B32; CARD32 pad2 B32; } xShmCompletionEvent; #define sz_xShmCompletionEvent 32 #undef ShmSeg #undef Drawable #undef VisualID #undef GContext #undef Pixmap #endif /* _SHMSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/lbxbuf.h0100664000076400007640000000321007120677563020674 0ustar constconst/* $XConsortium: lbxbuf.h /main/7 1996/11/15 21:33:12 rws $ */ /* * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name Network Computing Devices, Inc. not be * used in advertising or publicity pertaining to distribution of this * software without specific, written prior permission. * * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC., * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, * DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND * REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * */ #ifndef _BUFFER_H_ #define _BUFFER_H_ #define INBUFFER_SIZE (1 << 13) /* 8K */ #define OUTBUFFER_SIZE (1 << 12) /* 4K */ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif typedef struct _zlibbuffer *ZlibBufferPtr; extern int InitZlibBuffer(); extern void FreeZlibBuffer(); extern char *ReserveOutBuf(); #endif /* _BUFFER_H_ */ vnc_unixsrc/Xvnc/include/extensions/xf86mscstr.h0100664000076400007640000001035007120677563021444 0ustar constconst/* $XFree86: xc/include/extensions/xf86mscstr.h,v 3.5.2.3 1998/02/24 19:05:45 hohndel Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86MISCSTR_H_ #define _XF86MISCSTR_H_ #include "xf86misc.h" #define XF86MISCNAME "XFree86-Misc" #define XF86MISC_MAJOR_VERSION 0 /* current version numbers */ #define XF86MISC_MINOR_VERSION 4 typedef struct _XF86MiscQueryVersion { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscQueryVersion */ CARD16 length B16; } xXF86MiscQueryVersionReq; #define sz_xXF86MiscQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XFree86-Misc */ CARD16 minorVersion B16; /* minor version of XFree86-Misc */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86MiscQueryVersionReply; #define sz_xXF86MiscQueryVersionReply 32 #ifdef _XF86MISC_SAVER_COMPAT_ typedef struct _XF86MiscGetSaver { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetSaver */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86MiscGetSaverReq; #define sz_xXF86MiscGetSaverReq 8 typedef struct _XF86MiscSetSaver { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetSaver */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 suspendTime B32; CARD32 offTime B32; } xXF86MiscSetSaverReq; #define sz_xXF86MiscSetSaverReq 16 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 suspendTime B32; CARD32 offTime B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86MiscGetSaverReply; #define sz_xXF86MiscGetSaverReply 32 #endif typedef struct _XF86MiscGetMouseSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetMouseSettings */ CARD16 length B16; } xXF86MiscGetMouseSettingsReq; #define sz_xXF86MiscGetMouseSettingsReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 mousetype B32; CARD32 baudrate B32; CARD32 samplerate B32; CARD32 resolution B32; CARD32 buttons B32; BOOL emulate3buttons; BOOL chordmiddle; CARD16 pad2 B16; CARD32 emulate3timeout B32; CARD32 flags B32; CARD32 devnamelen B32; /* strlen(device)+1 */ } xXF86MiscGetMouseSettingsReply; #define sz_xXF86MiscGetMouseSettingsReply 44 typedef struct _XF86MiscGetKbdSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscGetKbdSettings */ CARD16 length B16; } xXF86MiscGetKbdSettingsReq; #define sz_xXF86MiscGetKbdSettingsReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 kbdtype B32; CARD32 rate B32; CARD32 delay B32; BOOL servnumlock; BOOL pad2; CARD16 pad3 B16; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86MiscGetKbdSettingsReply; #define sz_xXF86MiscGetKbdSettingsReply 32 typedef struct _XF86MiscSetMouseSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetMouseSettings */ CARD16 length B16; CARD32 mousetype B32; CARD32 baudrate B32; CARD32 samplerate B32; CARD32 resolution B32; CARD32 buttons B32; BOOL emulate3buttons; BOOL chordmiddle; CARD16 pad2 B16; CARD32 emulate3timeout B32; CARD32 flags B32; } xXF86MiscSetMouseSettingsReq; #define sz_xXF86MiscSetMouseSettingsReq 36 typedef struct _XF86MiscSetKbdSettings { CARD8 reqType; /* always XF86MiscReqCode */ CARD8 xf86miscReqType; /* always X_XF86MiscSetKbdSettings */ CARD16 length B16; CARD32 kbdtype B32; CARD32 rate B32; CARD32 delay B32; BOOL servnumlock; BOOL pad1; CARD16 pad2 B16; } xXF86MiscSetKbdSettingsReq; #define sz_xXF86MiscSetKbdSettingsReq 20 #endif /* _XF86MISCSTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/xf86vmstr.h0100664000076400007640000002025107120677563021305 0ustar constconst/* $XFree86: xc/include/extensions/xf86vmstr.h,v 3.18.2.1 1997/05/25 14:13:37 dawes Exp $ */ /* Copyright (c) 1995 Kaleb S. KEITHLEY Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Kaleb S. KEITHLEY shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Kaleb S. KEITHLEY */ /* $XConsortium: xf86vmstr.h /main/10 1996/10/26 21:38:17 kaleb $ */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #ifndef _XF86VIDMODESTR_H_ #define _XF86VIDMODESTR_H_ #include "xf86vmode.h" #define XF86VIDMODENAME "XFree86-VidModeExtension" #define XF86VIDMODE_MAJOR_VERSION 0 /* current version numbers */ #define XF86VIDMODE_MINOR_VERSION 8 /* * major version 0 == uses parameter-to-wire functions in XFree86 libXxf86vm. * major version 1 == uses parameter-to-wire functions hard-coded in xvidtune * client. */ typedef struct _XF86VidModeQueryVersion { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeQueryVersion */ CARD16 length B16; } xXF86VidModeQueryVersionReq; #define sz_xXF86VidModeQueryVersionReq 4 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD16 majorVersion B16; /* major version of XF86VidMode */ CARD16 minorVersion B16; /* minor version of XF86VidMode */ CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeQueryVersionReply; #define sz_xXF86VidModeQueryVersionReply 32 typedef struct _XF86VidModeGetModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD16 screen B16; CARD16 pad B16; } xXF86VidModeGetModeLineReq, xXF86VidModeGetAllModeLinesReq, xXF86VidModeGetMonitorReq, xXF86VidModeGetViewPortReq; #define sz_xXF86VidModeGetModeLineReq 8 #define sz_xXF86VidModeGetAllModeLinesReq 8 #define sz_xXF86VidModeGetMonitorReq 8 #define sz_xXF86VidModeGetViewPortReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86VidModeGetModeLineReply; #define sz_xXF86VidModeGetModeLineReply 36 typedef struct { CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86VidModeModeInfo; typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 modecount B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeGetAllModeLinesReply; #define sz_xXF86VidModeGetAllModeLinesReply 32 typedef struct _XF86VidModeAddModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeAddMode */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; CARD32 after_dotclock B32; CARD16 after_hdisplay B16; CARD16 after_hsyncstart B16; CARD16 after_hsyncend B16; CARD16 after_htotal B16; CARD16 after_vdisplay B16; CARD16 after_vsyncstart B16; CARD16 after_vsyncend B16; CARD16 after_vtotal B16; CARD32 after_flags B32; } xXF86VidModeAddModeLineReq; #define sz_xXF86VidModeAddModeLineReq 60 typedef struct _XF86VidModeModModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeModModeLine */ CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86VidModeModModeLineReq; #define sz_xXF86VidModeModModeLineReq 32 typedef struct _XF86VidModeValidateModeLine { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; CARD16 length B16; CARD32 screen B32; /* could be CARD16 but need the pad */ CARD32 dotclock B32; CARD16 hdisplay B16; CARD16 hsyncstart B16; CARD16 hsyncend B16; CARD16 htotal B16; CARD16 vdisplay B16; CARD16 vsyncstart B16; CARD16 vsyncend B16; CARD16 vtotal B16; CARD32 flags B32; CARD32 privsize B32; } xXF86VidModeDeleteModeLineReq, xXF86VidModeValidateModeLineReq, xXF86VidModeSwitchToModeReq; #define sz_xXF86VidModeDeleteModeLineReq 36 #define sz_xXF86VidModeValidateModeLineReq 36 #define sz_xXF86VidModeSwitchToModeReq 36 typedef struct _XF86VidModeSwitchMode { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSwitchMode */ CARD16 length B16; CARD16 screen B16; CARD16 zoom B16; } xXF86VidModeSwitchModeReq; #define sz_xXF86VidModeSwitchModeReq 8 typedef struct _XF86VidModeLockModeSwitch { CARD8 reqType; /* always XF86VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeLockModeSwitch */ CARD16 length B16; CARD16 screen B16; CARD16 lock B16; } xXF86VidModeLockModeSwitchReq; #define sz_xXF86VidModeLockModeSwitchReq 8 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 status B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeValidateModeLineReply; #define sz_xXF86VidModeValidateModeLineReply 32 typedef struct { BYTE type; /* X_Reply */ BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD8 vendorLength; CARD8 modelLength; CARD8 nhsync; CARD8 nvsync; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; CARD32 pad6 B32; } xXF86VidModeGetMonitorReply; #define sz_xXF86VidModeGetMonitorReply 32 typedef struct { BYTE type; BOOL pad1; CARD16 sequenceNumber B16; CARD32 length B32; CARD32 x B32; CARD32 y B32; CARD32 pad2 B32; CARD32 pad3 B32; CARD32 pad4 B32; CARD32 pad5 B32; } xXF86VidModeGetViewPortReply; #define sz_xXF86VidModeGetViewPortReply 32 typedef struct _XF86VidModeSetViewPort { CARD8 reqType; /* always VidModeReqCode */ CARD8 xf86vidmodeReqType; /* always X_XF86VidModeSetViewPort */ CARD16 length B16; CARD16 screen B16; CARD16 pad B16; CARD32 x B32; CARD32 y B32; } xXF86VidModeSetViewPortReq; #define sz_xXF86VidModeSetViewPortReq 16 #endif /* _XF86VIDMODESTR_H_ */ vnc_unixsrc/Xvnc/include/extensions/Xext.h0100664000076400007640000000347007120677563020352 0ustar constconst/* * $XConsortium: Xext.h,v 1.4 94/04/17 20:11:18 keith Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XEXT_H_ #define _XEXT_H_ #include _XFUNCPROTOBEGIN extern int (*XSetExtensionErrorHandler( #if NeedFunctionPrototypes int (*handler)( #if NeedNestedPrototypes Display *, char *, char * #endif ) #endif ))(); extern int XMissingExtension( #if NeedFunctionPrototypes Display* /* dpy */, _Xconst char* /* ext_name */ #endif ); _XFUNCPROTOEND #define X_EXTENSION_UNKNOWN "unknown" #define X_EXTENSION_MISSING "missing" #endif /* _XEXT_H_ */ vnc_unixsrc/Xvnc/include/Xwinsock.h0100664000076400007640000000347507120677563017035 0ustar constconst/* $XConsortium: Xwinsock.h /main/1 1996/11/13 14:43:47 lehors $ */ /* Copyright (C) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft- ware"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following condi- tions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * This header file has for sole purpose to allow to include winsock.h * without getting any name conflicts with our code. * Conflicts come from the fact that including winsock.h actually pulls * in the whole Windows API... */ #define BOOL wBOOL #undef Status #define Status wStatus #define ATOM wATOM #define FreeResource wFreeResource #include #undef Status #define Status int #undef BOOL #undef ATOM #undef FreeResource #undef CreateWindowA #undef RT_FONT #undef RT_CURSOR vnc_unixsrc/Xvnc/include/Xw32defs.h0100664000076400007640000000321407120677563016624 0ustar constconst/* $XConsortium: Xw32defs.h /main/5 1996/11/13 14:43:44 lehors $ */ #ifndef _XW32DEFS_H #define _XW32DEFS_H typedef char *caddr_t; #define access _access #define alloca _alloca #define chdir _chdir #define chmod _chmod #define close _close #define creat _creat #define dup _dup #define dup2 _dup2 #define environ _environ #define execl _execl #define execle _execle #define execlp _execlp #define execlpe _execlpe #define execv _execv #define execve _execve #define execvp _execvp #define execvpe _execvpe #define fdopen _fdopen #define fileno _fileno #define fstat _fstat #define getcwd _getcwd #define getpid _getpid #define hypot _hypot #define isascii __isascii #define isatty _isatty #define lseek _lseek #define mkdir _mkdir #define mktemp _mktemp #define open _open #define putenv _putenv #define read _read #define rmdir _rmdir #define sleep(x) _sleep((x) * 1000) #define stat _stat #define sys_errlist _sys_errlist #define sys_nerr _sys_nerr #define umask _umask #define unlink _unlink #define write _write #define random rand #define srandom srand #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY #define O_RDWR _O_RDWR #define O_APPEND _O_APPEND #define O_CREAT _O_CREAT #define O_TRUNC _O_TRUNC #define O_EXCL _O_EXCL #define O_TEXT _O_TEXT #define O_BINARY _O_BINARY #define O_RAW _O_BINARY #define S_IFMT _S_IFMT #define S_IFDIR _S_IFDIR #define S_IFCHR _S_IFCHR #define S_IFREG _S_IFREG #define S_IREAD _S_IREAD #define S_IWRITE _S_IWRITE #define S_IEXEC _S_IEXEC #define F_OK 0 #define X_OK 1 #define W_OK 2 #define R_OK 4 #endif vnc_unixsrc/Xvnc/include/Xfuncs.h0100664000076400007640000000643507120677563016475 0ustar constconst/* * $XConsortium: Xfuncs.h,v 1.16 94/12/01 16:25:53 kaleb Exp $ * $XFree86: xc/include/Xfuncs.h,v 3.2 1995/01/28 15:42:03 dawes Exp $ * * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * */ #ifndef _XFUNCS_H_ #define _XFUNCS_H_ #include /* the old Xfuncs.h, for pre-R6 */ #ifdef X_USEBFUNCS void bcopy(); void bzero(); int bcmp(); #else #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII) && !defined(apollo)) || defined(SVR4) || defined(hpux) || defined(_IBMR2) || defined(_SEQUENT_) #include #define _XFUNCS_H_INCLUDED_STRING_H #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) #define bzero(b,len) memset(b, 0, (size_t)(len)) #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len)) #else #ifdef sgi #include #else #ifdef SYSV #include void bcopy(); #define bzero(b,len) memset(b, 0, len) #define bcmp(b1,b2,len) memcmp(b1, b2, len) #else #ifdef __EMX__ #include #define _XFUNCS_H_INCLUDED_STRING_H /* bcopy, bcmp, bzero declared */ #else /* bsd */ void bcopy(); void bzero(); int bcmp(); #endif #endif /* SYSV */ #endif /* sgi */ #endif /* __STDC__ and relatives */ #endif /* X_USEBFUNCS */ /* the new Xfuncs.h */ #if !defined(X_NOT_STDC_ENV) && (!defined(sun) || defined(SVR4)) /* the ANSI C way */ #ifndef _XFUNCS_H_INCLUDED_STRING_H #include #endif #undef bzero #define bzero(b,len) memset(b,0,len) #else /* else X_NOT_STDC_ENV or SunOS 4 */ #if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__) #include #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #if defined(SYSV) && defined(_XBCOPYFUNC) #undef memmove #define memmove(dst,src,len) _XBCOPYFUNC((char *)(src),(char *)(dst),(int)(len)) #define _XNEEDBCOPYFUNC #endif #else /* else vanilla BSD */ #define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcpy(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len)) #define memcmp(b1,b2,len) bcmp((char *)(b1),(char *)(b2),(int)(len)) #endif /* SYSV else */ #endif /* ! X_NOT_STDC_ENV else */ #endif /* _XFUNCS_H_ */ vnc_unixsrc/Xvnc/include/Xfuncproto.h0100664000076400007640000000550107120677563017367 0ustar constconst/* $XConsortium: Xfuncproto.h,v 1.9 95/06/08 23:20:39 gildea Exp $ */ /* * Copyright (c) 1989, 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * */ /* Definitions to make function prototypes manageable */ #ifndef _XFUNCPROTO_H_ #define _XFUNCPROTO_H_ #ifndef NeedFunctionPrototypes #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) #define NeedFunctionPrototypes 1 #else #define NeedFunctionPrototypes 0 #endif #endif /* NeedFunctionPrototypes */ #ifndef NeedVarargsPrototypes #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&2) #define NeedVarargsPrototypes 1 #else #define NeedVarargsPrototypes 0 #endif #endif /* NeedVarargsPrototypes */ #if NeedFunctionPrototypes #ifndef NeedNestedPrototypes #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&8) #define NeedNestedPrototypes 1 #else #define NeedNestedPrototypes 0 #endif #endif /* NeedNestedPrototypes */ #ifndef _Xconst #if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4) #define _Xconst const #else #define _Xconst #endif #endif /* _Xconst */ #ifndef NeedWidePrototypes #ifdef NARROWPROTO #define NeedWidePrototypes 0 #else #define NeedWidePrototypes 1 /* default to make interropt. easier */ #endif #endif /* NeedWidePrototypes */ #endif /* NeedFunctionPrototypes */ #ifndef _XFUNCPROTOBEGIN #ifdef __cplusplus /* for C++ V2.0 */ #define _XFUNCPROTOBEGIN extern "C" { /* do not leave open across includes */ #define _XFUNCPROTOEND } #else #define _XFUNCPROTOBEGIN #define _XFUNCPROTOEND #endif #endif /* _XFUNCPROTOBEGIN */ #endif /* _XFUNCPROTO_H_ */ vnc_unixsrc/Xvnc/include/X.h0100664000076400007640000004647407120677563015445 0ustar constconst/* * $XConsortium: X.h,v 1.69 94/04/17 20:10:48 dpw Exp $ */ /* Definitions for the X window system likely to be used by applications */ #ifndef X_H #define X_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 typedef unsigned long XID; typedef unsigned long Mask; typedef unsigned long Atom; typedef unsigned long VisualID; typedef unsigned long Time; #else #include typedef CARD32 XID; typedef CARD32 Mask; typedef CARD32 Atom; typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; typedef XID Font; typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #define None 0L /* universal null resource or null atom */ #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0L /* destination window in SendEvent */ #define InputFocus 1L /* destination window in SendEvent */ #define PointerRoot 1L /* focus window in SetInputFocus */ #define AnyPropertyType 0L /* special Atom, passed to GetProperty */ #define AnyKey 0L /* special Key Code, passed to GrabKey */ #define AnyButton 0L /* special Button Code, passed to GrabButton */ #define AllTemporary 0L /* special Resource ID passed to KillClient */ #define CurrentTime 0L /* special Time */ #define NoSymbol 0L /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask (1L<<0) #define KeyReleaseMask (1L<<1) #define ButtonPressMask (1L<<2) #define ButtonReleaseMask (1L<<3) #define EnterWindowMask (1L<<4) #define LeaveWindowMask (1L<<5) #define PointerMotionMask (1L<<6) #define PointerMotionHintMask (1L<<7) #define Button1MotionMask (1L<<8) #define Button2MotionMask (1L<<9) #define Button3MotionMask (1L<<10) #define Button4MotionMask (1L<<11) #define Button5MotionMask (1L<<12) #define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) #define ExposureMask (1L<<15) #define VisibilityChangeMask (1L<<16) #define StructureNotifyMask (1L<<17) #define ResizeRedirectMask (1L<<18) #define SubstructureNotifyMask (1L<<19) #define SubstructureRedirectMask (1L<<20) #define FocusChangeMask (1L<<21) #define PropertyChangeMask (1L<<22) #define ColormapChangeMask (1L<<23) #define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define LASTEvent 35 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) #define ControlMask (1<<2) #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask (1<<8) #define Button2Mask (1<<9) #define Button3Mask (1<<10) #define Button4Mask (1<<11) #define Button5Mask (1<<12) #define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 #define FamilyDECnet 1 #define FamilyChaos 2 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap (1L<<0) #define CWBackPixel (1L<<1) #define CWBorderPixmap (1L<<2) #define CWBorderPixel (1L<<3) #define CWBitGravity (1L<<4) #define CWWinGravity (1L<<5) #define CWBackingStore (1L<<6) #define CWBackingPlanes (1L<<7) #define CWBackingPixel (1L<<8) #define CWOverrideRedirect (1L<<9) #define CWSaveUnder (1L<<10) #define CWEventMask (1L<<11) #define CWDontPropagate (1L<<12) #define CWColormap (1L<<13) #define CWCursor (1L<<14) /* ConfigureWindow structure */ #define CWX (1<<0) #define CWY (1<<1) #define CWWidth (1<<2) #define CWHeight (1<<3) #define CWBorderWidth (1<<4) #define CWSibling (1<<5) #define CWStackMode (1<<6) /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction (1L<<0) #define GCPlaneMask (1L<<1) #define GCForeground (1L<<2) #define GCBackground (1L<<3) #define GCLineWidth (1L<<4) #define GCLineStyle (1L<<5) #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) #define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) #define GCTileStipYOrigin (1L<<13) #define GCFont (1L<<14) #define GCSubwindowMode (1L<<15) #define GCGraphicsExposures (1L<<16) #define GCClipXOrigin (1L<<17) #define GCClipYOrigin (1L<<18) #define GCClipMask (1L<<19) #define GCDashOffset (1L<<20) #define GCDashList (1L<<21) #define GCArcMode (1L<<22) #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed (1<<0) #define DoGreen (1<<1) #define DoBlue (1<<2) /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent (1L<<0) #define KBBellPercent (1L<<1) #define KBBellPitch (1L<<2) #define KBBellDuration (1L<<3) #define KBLed (1L<<4) #define KBLedMode (1L<<5) #define KBKey (1L<<6) #define KBAutoRepeatMode (1L<<7) #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ vnc_unixsrc/Xvnc/include/Sunkeysym.h0100664000076400007640000001021107120677563017221 0ustar constconst/* $XConsortium: Sunkeysym.h,v 1.5 94/04/17 20:10:47 rws Exp $ */ /************************************************************ Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1991 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the name of Sun not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun makes no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***********************************************************/ /* * Floating Accent */ #define SunXK_FA_Grave 0x1005FF00 #define SunXK_FA_Circum 0x1005FF01 #define SunXK_FA_Tilde 0x1005FF02 #define SunXK_FA_Acute 0x1005FF03 #define SunXK_FA_Diaeresis 0x1005FF04 #define SunXK_FA_Cedilla 0x1005FF05 /* * Miscellaneous Functions */ #define SunXK_F36 0x1005FF10 /* Labeled F11 */ #define SunXK_F37 0x1005FF11 /* Labeled F12 */ #define SunXK_Sys_Req 0x1005FF60 #define SunXK_Print_Screen 0x0000FF61 /* Same as XK_Print */ /* * International & Multi-Key Character Composition */ #define SunXK_Compose 0x0000FF20 /* Same as XK_Multi_key */ #define SunXK_AltGraph 0x0000FF7E /* Same as XK_Mode_switch */ /* * Cursor Control */ #define SunXK_PageUp 0x0000FF55 /* Same as XK_Prior */ #define SunXK_PageDown 0x0000FF56 /* Same as XK_Next */ /* * Open Look Functions */ #define SunXK_Undo 0x0000FF65 /* Same as XK_Undo */ #define SunXK_Again 0x0000FF66 /* Same as XK_Redo */ #define SunXK_Find 0x0000FF68 /* Same as XK_Find */ #define SunXK_Stop 0x0000FF69 /* Same as XK_Cancel */ #define SunXK_Props 0x1005FF70 #define SunXK_Front 0x1005FF71 #define SunXK_Copy 0x1005FF72 #define SunXK_Open 0x1005FF73 #define SunXK_Paste 0x1005FF74 #define SunXK_Cut 0x1005FF75 #define SunXK_PowerSwitch 0x1005FF76 #define SunXK_AudioLowerVolume 0x1005FF77 #define SunXK_AudioMute 0x1005FF78 #define SunXK_AudioRaiseVolume 0x1005FF79 #define SunXK_VideoDegauss 0x1005FF7A #define SunXK_VideoLowerBrightness 0x1005FF7B #define SunXK_VideoRaiseBrightness 0x1005FF7C #define SunXK_PowerSwitchShift 0x1005FF7D vnc_unixsrc/Xvnc/include/bitmaps/0040775000076400007640000000000010616336466016506 5ustar constconstvnc_unixsrc/Xvnc/include/bitmaps/wide_weave0100664000076400007640000000044507120677563020552 0ustar constconst#define wide_weave_width 16 #define wide_weave_height 16 static char wide_weave_bits[] = { 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, 0x11, 0x11, 0xa3, 0xa3, 0xc7, 0xc7, 0x8b, 0x8b, 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, 0x11, 0x11, 0xa3, 0xa3, 0xc7, 0xc7, 0x8b, 0x8b}; vnc_unixsrc/Xvnc/include/bitmaps/left_ptr0100664000076400007640000000052107120677563020245 0ustar constconst#define left_ptr_width 16 #define left_ptr_height 16 #define left_ptr_x_hot 3 #define left_ptr_y_hot 1 static char left_ptr_bits[] = { 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01, 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/Imakefile0100664000076400007640000000173107120677563020320 0ustar constconstXCOMM $XConsortium: Imakefile /main/32 1996/09/28 16:17:53 rws $ HEADERS = \ 1x1 \ 2x2 \ black \ boxes \ calculator \ cntr_ptr \ cntr_ptrmsk \ cross_weave \ dimple1 \ dimple3 \ dot \ dropbar7 \ dropbar8 \ escherknot \ flagdown \ flagup \ flipped_gray \ gray \ gray1 \ gray3 \ grid2 \ grid4 \ grid8 \ grid16 \ hlines2 \ hlines3 \ icon \ keyboard16 \ left_ptr \ left_ptrmsk \ letters \ light_gray \ mailempty \ mailemptymsk \ mailfull \ mailfullmsk \ mensetmanus \ menu6 \ menu8 \ menu10 \ menu12 \ menu16 \ noletters \ opendot \ opendotMask \ plaid \ right_ptr \ right_ptrmsk \ root_weave \ scales \ sipb \ star \ starMask \ stipple \ target \ terminal \ tie_fighter \ vlines2 \ vlines3 \ weird_size \ wide_weave \ wingdogs \ woman \ xfd_icon \ xlogo11 \ xlogo16 \ xlogo32 \ xlogo64 \ xsnow all:: BuildIncludes($(HEADERS),X11/bitmaps,../..) InstallMultipleFlags($(HEADERS),$(INCDIR)/X11/bitmaps,$(INSTINCFLAGS)) vnc_unixsrc/Xvnc/include/bitmaps/gray10100664000076400007640000000013207120677563017447 0ustar constconst#define gray1_width 2 #define gray1_height 2 static char gray1_bits[] = { 0x01, 0x02}; vnc_unixsrc/Xvnc/include/bitmaps/gray30100664000076400007640000000014607120677563017456 0ustar constconst#define gray3_width 4 #define gray3_height 4 static char gray3_bits[] = { 0x01, 0x00, 0x04, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/starMask0100664000076400007640000000052107120677563020213 0ustar constconst#define starMask_width 16 #define starMask_height 16 #define starMask_x_hot 7 #define starMask_y_hot 7 static char starMask_bits[] = { 0xc0, 0x01, 0xc0, 0x01, 0xdc, 0x1d, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xf8, 0x0f, 0xfc, 0x1f, 0xfc, 0x1f, 0xdc, 0x1d, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/light_gray0100664000076400007640000000015107120677563020556 0ustar constconst#define light_gray_width 4 #define light_gray_height 2 static char light_gray_bits[] = { 0x08, 0x02}; vnc_unixsrc/Xvnc/include/bitmaps/tie_fighter0100664000076400007640000000045007120677563020720 0ustar constconst#define tie_fighter_width 16 #define tie_fighter_height 16 static char tie_fighter_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x02, 0x40, 0xe2, 0x47, 0x3e, 0x7c, 0x12, 0x48, 0x3e, 0x7c, 0xe2, 0x47, 0x02, 0x40, 0x42, 0x42, 0x64, 0x26, 0x28, 0x14, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xlogo110100664000076400007640000000033307120677563017721 0ustar constconst#define xlogo11_width 11 #define xlogo11_height 11 static char xlogo11_bits[] = { 0x0f, 0x04, 0x0f, 0x02, 0x1e, 0x01, 0x3c, 0x01, 0xb8, 0x00, 0x58, 0x00, 0xe8, 0x00, 0xe4, 0x01, 0xc4, 0x03, 0xc2, 0x03, 0x81, 0x07 }; vnc_unixsrc/Xvnc/include/bitmaps/sipb0100664000076400007640000000162707120677563017373 0ustar constconst#define sipb_width 32 #define sipb_height 32 #define sipb_x_hot 12 #define sipb_y_hot 16 static char sipb_bits[] = { 0xbe, 0xdf, 0x03, 0x00, 0x22, 0x49, 0x04, 0x00, 0x04, 0x49, 0x04, 0x00, 0x08, 0x49, 0x04, 0x00, 0x10, 0xc9, 0x03, 0x00, 0x08, 0x49, 0x04, 0x00, 0x04, 0x49, 0x04, 0x00, 0x22, 0x49, 0x04, 0x00, 0x3e, 0xc9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfd, 0x1e, 0x00, 0x10, 0x49, 0x22, 0x00, 0x20, 0x48, 0x22, 0x00, 0x40, 0x48, 0x22, 0x00, 0x80, 0x48, 0x1e, 0x00, 0x40, 0x48, 0x22, 0x00, 0x20, 0x48, 0x22, 0x00, 0x10, 0x49, 0x22, 0x00, 0xf0, 0x49, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xlogo160100664000076400007640000000044507120677563017732 0ustar constconst#define xlogo16_width 16 #define xlogo16_height 16 static unsigned char xlogo16_bits[] = { 0x0f, 0x80, 0x1e, 0x80, 0x3c, 0x40, 0x78, 0x20, 0x78, 0x10, 0xf0, 0x08, 0xe0, 0x09, 0xc0, 0x05, 0xc0, 0x02, 0x40, 0x07, 0x20, 0x0f, 0x20, 0x1e, 0x10, 0x1e, 0x08, 0x3c, 0x04, 0x78, 0x02, 0xf0}; vnc_unixsrc/Xvnc/include/bitmaps/right_ptr0100664000076400007640000000052707120677563020436 0ustar constconst#define right_ptr_width 16 #define right_ptr_height 16 #define right_ptr_x_hot 12 #define right_ptr_y_hot 1 static char right_ptr_bits[] = { 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f, 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11, 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/hlines20100664000076400007640000000014007120677563017767 0ustar constconst#define hlines2_width 1 #define hlines2_height 2 static char hlines2_bits[] = { 0x01, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/weird_size0100664000076400007640000000025707120677563020600 0ustar constconst#define weird_size_width 7 #define weird_size_height 13 static char weird_size_bits[] = { 0x07, 0x05, 0x07, 0x01, 0x75, 0x45, 0x74, 0x44, 0x74, 0x00, 0x10, 0x38, 0x10}; vnc_unixsrc/Xvnc/include/bitmaps/mailfull0100664000076400007640000000354707120677563020246 0ustar constconst#define mailfull_width 48 #define mailfull_height 48 static unsigned char mailfull_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07, 0xc0, 0xff, 0xff, 0xff, 0x1f, 0x04, 0x40, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x40, 0x00, 0x00, 0x00, 0x57, 0x7d, 0x40, 0x1e, 0x00, 0x00, 0x55, 0x7d, 0x40, 0x00, 0x00, 0x00, 0xd5, 0x7d, 0x60, 0x02, 0x00, 0x00, 0x17, 0x7c, 0x70, 0x00, 0x7e, 0x00, 0x10, 0x7c, 0x78, 0x00, 0x00, 0x00, 0x10, 0x7e, 0x7c, 0x00, 0x1e, 0x00, 0x10, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x90, 0x7f, 0x7e, 0x00, 0x3e, 0x07, 0xd0, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x6f, 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x67, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x86, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc6, 0xaf, 0xaa, 0xaa, 0xea, 0x7a, 0xe6, 0x57, 0x55, 0x55, 0x75, 0x7d, 0xf6, 0xaf, 0xaa, 0xaa, 0xea, 0x7e, 0xfe, 0x57, 0x55, 0x55, 0x75, 0x7f, 0xfe, 0xaf, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0xee, 0x9c, 0x37, 0x60, 0x00, 0x06, 0xfe, 0x36, 0x33, 0x60, 0x00, 0x06, 0xd6, 0x3e, 0x33, 0x60, 0x00, 0x06, 0xc6, 0xb6, 0xf7, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/escherknot0100664000076400007640000010272507120677563020604 0ustar constconst#define escherknot_width 216 #define escherknot_height 208 static char escherknot_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x6f, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3a, 0x13, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x02, 0x51, 0x71, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2f, 0x20, 0xd9, 0x88, 0x9b, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x82, 0xac, 0x44, 0x4e, 0x1c, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x40, 0x02, 0x44, 0x60, 0xe2, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x25, 0x09, 0x90, 0x22, 0x13, 0xb7, 0x9a, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x40, 0x10, 0x89, 0x18, 0xe3, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x08, 0x01, 0x10, 0xc8, 0xa8, 0xd5, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x80, 0x20, 0x40, 0x82, 0x00, 0x66, 0x9c, 0xec, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x24, 0x12, 0x93, 0x5b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x12, 0x80, 0x04, 0x01, 0x00, 0x80, 0x19, 0x33, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x80, 0x00, 0x20, 0x08, 0x12, 0xc4, 0x68, 0x26, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x04, 0x24, 0x00, 0x01, 0x40, 0x24, 0x8c, 0xcd, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x80, 0x49, 0x10, 0x90, 0x00, 0x21, 0x20, 0x08, 0x11, 0x43, 0xd9, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xff, 0xff, 0x0b, 0x00, 0x60, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x30, 0xb9, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x97, 0x04, 0x08, 0xfe, 0x05, 0x30, 0x10, 0x12, 0x20, 0x20, 0x04, 0x00, 0x80, 0x48, 0x0c, 0xa3, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x92, 0x20, 0x49, 0x40, 0x3e, 0x0e, 0x82, 0x00, 0x84, 0x25, 0x01, 0x80, 0x00, 0x80, 0xc8, 0x34, 0xed, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x25, 0x01, 0x04, 0x01, 0x08, 0xd0, 0x17, 0x00, 0x80, 0x25, 0x01, 0xad, 0x04, 0x12, 0x20, 0x23, 0x4c, 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x48, 0x92, 0x20, 0x41, 0x92, 0x9e, 0x80, 0x24, 0x24, 0x29, 0x00, 0x04, 0x00, 0x10, 0x98, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4f, 0x10, 0x01, 0x90, 0x24, 0x40, 0x12, 0xf0, 0x00, 0x24, 0x41, 0x0b, 0xa9, 0x10, 0x00, 0x00, 0x04, 0xd9, 0x96, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x92, 0x48, 0x02, 0x04, 0x09, 0xc0, 0x84, 0x8f, 0x29, 0x2d, 0xf8, 0xa9, 0x02, 0x00, 0x00, 0x20, 0x90, 0xf4, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x24, 0x91, 0x04, 0x50, 0x22, 0x24, 0x1b, 0x12, 0x7a, 0x48, 0xca, 0x03, 0x21, 0x10, 0x00, 0x00, 0x48, 0x93, 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x24, 0x92, 0x20, 0x81, 0xda, 0x24, 0xc8, 0x16, 0xd0, 0xe7, 0x50, 0xd2, 0xbf, 0x03, 0x00, 0x80, 0x00, 0x30, 0x29, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x20, 0x80, 0x24, 0x41, 0x12, 0x2a, 0x41, 0xb2, 0x80, 0x33, 0x0e, 0x7e, 0x88, 0x1c, 0x01, 0x00, 0xa0, 0x24, 0x69, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x82, 0x44, 0x11, 0x24, 0x09, 0x90, 0xa4, 0x4d, 0xd2, 0x92, 0x9e, 0xd3, 0x83, 0x6b, 0x62, 0x00, 0x00, 0x10, 0x22, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x42, 0x04, 0x92, 0x24, 0x6b, 0x53, 0x32, 0x59, 0x90, 0x16, 0xfa, 0xb4, 0xf4, 0xff, 0x0f, 0x01, 0x00, 0x90, 0x68, 0x4a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x24, 0x11, 0x24, 0x49, 0xda, 0x82, 0xc5, 0x92, 0xd2, 0xd0, 0x9e, 0x1e, 0x00, 0x78, 0x0a, 0x00, 0x00, 0x05, 0xd2, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x44, 0xb2, 0x65, 0xea, 0x49, 0x9e, 0x2c, 0x4b, 0x1a, 0xd2, 0xeb, 0xe3, 0xff, 0xc7, 0x09, 0x00, 0x20, 0x68, 0xff, 0xd6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x90, 0x40, 0x92, 0x24, 0x09, 0x5f, 0xd2, 0x64, 0x59, 0x72, 0x56, 0x7f, 0xfd, 0xdf, 0x1f, 0x12, 0x00, 0x20, 0x49, 0x92, 0xde, 0x01, 0x00, 0x00, 0x00, 0x80, 0x41, 0x92, 0x4c, 0x92, 0x24, 0x25, 0xc9, 0x8b, 0x2e, 0xcb, 0x92, 0x4b, 0x5a, 0x2f, 0x75, 0xf4, 0x04, 0x00, 0x00, 0x41, 0xf6, 0x74, 0x01, 0x00, 0x00, 0x00, 0x40, 0x49, 0x02, 0x00, 0xba, 0xb6, 0xfd, 0x49, 0xf8, 0x74, 0x6d, 0x4b, 0x72, 0xed, 0xdb, 0xff, 0xcf, 0x53, 0x00, 0x00, 0x48, 0xb6, 0xd7, 0x03, 0x00, 0x00, 0x00, 0x60, 0x48, 0x10, 0xc9, 0x93, 0x24, 0x00, 0x7b, 0xc3, 0xa6, 0x69, 0x58, 0x5a, 0xfb, 0xfa, 0xa5, 0xbe, 0x16, 0x00, 0x00, 0x92, 0xa4, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x30, 0x01, 0x20, 0x5d, 0xa2, 0xfe, 0x7f, 0x01, 0x4f, 0x1a, 0xcd, 0x6b, 0x6a, 0xa9, 0x5f, 0xff, 0xf3, 0x24, 0x01, 0x40, 0xc0, 0xb4, 0xf4, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x88, 0x84, 0x89, 0xb6, 0x00, 0x24, 0x7d, 0x69, 0xf2, 0x34, 0xad, 0x99, 0x2d, 0xf7, 0xff, 0x9f, 0x4b, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x07, 0x00, 0x00, 0x00, 0x06, 0x91, 0x24, 0xe9, 0xa4, 0xfd, 0xa5, 0xa9, 0x4b, 0x93, 0xe7, 0x34, 0x63, 0xf9, 0xfc, 0xd5, 0xef, 0x16, 0x00, 0x40, 0x90, 0xb4, 0xbd, 0x07, 0x00, 0x00, 0x00, 0x6a, 0x80, 0x4c, 0x96, 0xbe, 0x2d, 0xfd, 0x2f, 0x7c, 0x5e, 0x9c, 0x67, 0xad, 0xa5, 0xfd, 0xff, 0xbf, 0x29, 0x00, 0x00, 0x92, 0x76, 0xed, 0x06, 0x00, 0x00, 0x00, 0x05, 0x12, 0x48, 0x53, 0x25, 0x65, 0x25, 0xf4, 0xe5, 0xd3, 0x72, 0x9c, 0x35, 0xdf, 0xf6, 0x7f, 0xf5, 0x56, 0x00, 0x00, 0x92, 0xa4, 0xed, 0x0f, 0x00, 0x00, 0x80, 0x49, 0x20, 0x59, 0x38, 0xec, 0xff, 0xff, 0xad, 0x2f, 0x5d, 0xd3, 0x33, 0xe6, 0x24, 0xed, 0xff, 0xdf, 0x2d, 0x01, 0x40, 0x80, 0x24, 0xbd, 0x07, 0x00, 0x00, 0xc0, 0x48, 0x24, 0x49, 0x87, 0x37, 0x21, 0xa0, 0xbd, 0xf4, 0x79, 0x4f, 0xc7, 0x9c, 0xde, 0xf6, 0xff, 0xff, 0x5b, 0x08, 0x00, 0x92, 0xfc, 0xe9, 0x0e, 0x00, 0x00, 0x20, 0x89, 0x40, 0xd3, 0xf4, 0x49, 0xff, 0xff, 0xe7, 0x2f, 0xcf, 0x79, 0x9c, 0x53, 0xb2, 0x35, 0xff, 0xff, 0x37, 0x00, 0x40, 0x90, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x30, 0x91, 0x49, 0x32, 0x2d, 0xff, 0x6b, 0xb7, 0xbd, 0xbc, 0x3c, 0xef, 0x79, 0xce, 0xde, 0xd6, 0xfd, 0xff, 0x9f, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x0b, 0x00, 0x00, 0x30, 0x11, 0x89, 0x8c, 0xcb, 0x5b, 0xba, 0xaf, 0xf6, 0xd7, 0xe7, 0x35, 0xe7, 0x59, 0xb3, 0xfb, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x80, 0xe4, 0xb9, 0x1f, 0x00, 0x00, 0x48, 0x22, 0x91, 0x66, 0x79, 0xeb, 0xff, 0xff, 0xdf, 0xbe, 0xbe, 0xe7, 0x8c, 0x75, 0x6b, 0x4a, 0xfa, 0xbf, 0x7f, 0x00, 0x00, 0x82, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x4c, 0x22, 0xb2, 0x79, 0x5e, 0xfa, 0x5b, 0xa9, 0xfd, 0xeb, 0xf5, 0x9c, 0x3d, 0xc6, 0xcc, 0xee, 0xed, 0x01, 0xf8, 0x00, 0x40, 0x82, 0xb6, 0xa9, 0x1b, 0x00, 0x00, 0x94, 0x64, 0x66, 0x8e, 0xd3, 0x97, 0xfe, 0xff, 0xd7, 0xdf, 0x9f, 0x7b, 0xf3, 0x3c, 0x35, 0x59, 0x6b, 0x00, 0x70, 0x00, 0x00, 0x40, 0xe4, 0xed, 0x1e, 0x00, 0x00, 0x92, 0xc4, 0x34, 0xf3, 0xfc, 0xfd, 0x5f, 0xad, 0x7d, 0xfa, 0x7a, 0xce, 0x8e, 0xb3, 0x76, 0x2f, 0xfd, 0x00, 0xe0, 0x04, 0x00, 0x9a, 0x26, 0xaf, 0x1e, 0x00, 0x00, 0x13, 0x88, 0xcc, 0xb5, 0x3f, 0xbf, 0xff, 0xff, 0xd7, 0xef, 0xef, 0xbd, 0x79, 0x6a, 0xde, 0xec, 0xab, 0x01, 0xc0, 0x00, 0x00, 0x40, 0xb6, 0xbd, 0x1b, 0x00, 0x00, 0x05, 0x91, 0xeb, 0x5c, 0xeb, 0xeb, 0xff, 0xff, 0xff, 0x7e, 0xef, 0x6b, 0xef, 0xcd, 0x99, 0xb3, 0xe4, 0x07, 0x80, 0x00, 0x40, 0x49, 0xb2, 0xe5, 0x1a, 0x00, 0x80, 0x20, 0x32, 0xb1, 0xe7, 0x79, 0x7f, 0xf7, 0xff, 0xfd, 0xeb, 0xbd, 0xfe, 0x2c, 0x3d, 0x6b, 0xb6, 0xaf, 0x06, 0x80, 0x00, 0x00, 0x41, 0x96, 0xfe, 0x1e, 0x00, 0x80, 0x44, 0xb2, 0x9b, 0xf9, 0xde, 0xff, 0xff, 0xff, 0x7f, 0xbf, 0xf7, 0xbb, 0xb3, 0x77, 0xce, 0xce, 0xb6, 0x0d, 0x80, 0x01, 0x00, 0x49, 0xf2, 0x94, 0x1f, 0x00, 0x40, 0x49, 0x44, 0xe6, 0x9e, 0x77, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xf7, 0x7e, 0xd6, 0xbc, 0xd9, 0xba, 0x3b, 0x80, 0x00, 0x00, 0x64, 0x93, 0xf7, 0x1b, 0x00, 0x40, 0x89, 0xec, 0x7e, 0x67, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xdb, 0x99, 0x33, 0x37, 0xd3, 0x36, 0x80, 0x01, 0x80, 0x24, 0xda, 0xd6, 0x1e, 0x00, 0x20, 0x90, 0x99, 0x99, 0x7b, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbd, 0x37, 0x63, 0xf3, 0x66, 0xdb, 0x7a, 0x80, 0x00, 0x00, 0x24, 0x59, 0xde, 0x1f, 0x00, 0x60, 0x12, 0xb3, 0xf7, 0xdd, 0xfb, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xf7, 0xfe, 0x6e, 0xce, 0xdd, 0x6d, 0xd7, 0x80, 0x00, 0x80, 0x20, 0xcb, 0xfb, 0x1f, 0x00, 0x10, 0x20, 0x6e, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xde, 0xdb, 0x9b, 0x99, 0xb3, 0x5d, 0x6b, 0x81, 0x00, 0x40, 0x96, 0x59, 0x6a, 0x1f, 0x00, 0x98, 0xc4, 0xe4, 0xdf, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x6f, 0x7b, 0x37, 0x7f, 0xb3, 0xdd, 0x83, 0x00, 0x00, 0xb0, 0xed, 0xef, 0x1d, 0x00, 0x10, 0x88, 0x9e, 0xdd, 0xcd, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xed, 0x6c, 0xe6, 0xcc, 0x76, 0x6d, 0xc1, 0x00, 0x40, 0x91, 0x24, 0x7b, 0x1f, 0x00, 0x08, 0xd1, 0xf1, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xbd, 0xbf, 0xd9, 0xdd, 0xdd, 0xb6, 0x47, 0x00, 0x00, 0xd8, 0xb4, 0xad, 0x1f, 0x00, 0x24, 0x24, 0x6f, 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xb7, 0x9d, 0x33, 0xd9, 0x96, 0x4e, 0x00, 0x20, 0x49, 0xf7, 0xfd, 0x1e, 0x00, 0x48, 0xe4, 0xac, 0xb9, 0xdd, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xdd, 0x76, 0xb6, 0xb7, 0xfd, 0x7a, 0x00, 0x00, 0x44, 0x96, 0xb7, 0x1f, 0x00, 0x02, 0x9a, 0xbe, 0x6f, 0x77, 0xff, 0xff, 0x7f, 0x61, 0xd9, 0xff, 0xff, 0xff, 0xfd, 0xdd, 0x66, 0xed, 0x66, 0x5b, 0x37, 0x00, 0x90, 0x64, 0xb9, 0xf6, 0x1f, 0x00, 0x02, 0xc9, 0xf3, 0xee, 0xfd, 0xff, 0xff, 0x2f, 0x24, 0x4f, 0xfe, 0xff, 0xff, 0x7f, 0x37, 0xdb, 0xcd, 0x7c, 0xff, 0x3a, 0x00, 0x88, 0x24, 0xdb, 0xde, 0x1a, 0x00, 0x13, 0x31, 0x6f, 0xbb, 0xdf, 0xff, 0xff, 0x21, 0xa0, 0x64, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0x96, 0xbb, 0x9b, 0xa5, 0x1d, 0x00, 0x60, 0x32, 0xe9, 0xdb, 0x0f, 0x00, 0x65, 0xe6, 0x3c, 0xfb, 0xf6, 0xff, 0x7f, 0x10, 0xa4, 0xb5, 0x9d, 0xfe, 0xdf, 0xdf, 0xdd, 0x6d, 0x32, 0xb3, 0x7d, 0x0d, 0x00, 0x0b, 0x93, 0x7c, 0x7b, 0x0f, 0x00, 0x89, 0xdc, 0xb3, 0xed, 0xfb, 0xff, 0x1f, 0x10, 0x90, 0x92, 0xd9, 0xfe, 0x7f, 0xff, 0x77, 0xdb, 0xee, 0x6e, 0xdb, 0x0e, 0x00, 0x20, 0xdd, 0x66, 0x6f, 0x0f, 0x80, 0x91, 0x5a, 0xfb, 0xbe, 0xef, 0xff, 0x0f, 0x10, 0xda, 0x92, 0xee, 0xff, 0xff, 0xff, 0xf7, 0xb7, 0xcd, 0xee, 0xde, 0x07, 0x00, 0x24, 0x49, 0xb6, 0xed, 0x0f, 0x00, 0x12, 0x6b, 0xcd, 0xf3, 0xbe, 0xff, 0x07, 0x08, 0x48, 0xda, 0x76, 0xb7, 0xff, 0xff, 0xdd, 0x6e, 0xba, 0x99, 0x65, 0x03, 0x40, 0x92, 0xe4, 0xba, 0xbd, 0x0e, 0x80, 0x62, 0xed, 0x7d, 0x5f, 0xf7, 0xff, 0x01, 0x08, 0x28, 0xc9, 0x26, 0xbb, 0xff, 0xff, 0xff, 0x99, 0xb7, 0xbb, 0x7d, 0x03, 0x00, 0x89, 0x64, 0xdb, 0xf6, 0x07, 0x40, 0x0c, 0x35, 0xe7, 0x79, 0xdd, 0xff, 0x01, 0x84, 0xa5, 0x7d, 0xba, 0xdd, 0xfe, 0x7f, 0xbf, 0xbf, 0x6d, 0x76, 0xdb, 0x01, 0x00, 0x48, 0x36, 0xdb, 0xd6, 0x07, 0xc0, 0x88, 0xb4, 0xb6, 0xbf, 0xff, 0x7f, 0x00, 0x0c, 0x24, 0x44, 0xdb, 0xed, 0xff, 0xdf, 0xef, 0x6e, 0xdb, 0x6e, 0xb7, 0x00, 0x80, 0x44, 0x93, 0xed, 0x5b, 0x07, 0x40, 0x91, 0xd2, 0xfa, 0xfc, 0xf6, 0x7f, 0x00, 0x02, 0xb4, 0x35, 0xd9, 0xef, 0xff, 0xff, 0xfb, 0xef, 0xb6, 0xc9, 0xe4, 0x00, 0x10, 0x24, 0xd9, 0x6d, 0xfb, 0x03, 0x00, 0x27, 0xfe, 0xd3, 0xd6, 0xdb, 0x3f, 0x00, 0xa2, 0x94, 0xb4, 0xdb, 0x7c, 0xff, 0xff, 0xbf, 0xd9, 0xad, 0xdb, 0x7d, 0x00, 0x40, 0x32, 0xd9, 0xb6, 0xef, 0x03, 0x60, 0xe4, 0x5a, 0x5f, 0x5f, 0xff, 0x1f, 0x00, 0x02, 0x52, 0x92, 0xec, 0xb6, 0xff, 0xff, 0xef, 0xff, 0x6d, 0xb6, 0x3b, 0x00, 0x28, 0x90, 0xcc, 0xbe, 0xfd, 0x03, 0xa0, 0x88, 0xeb, 0xf9, 0xfd, 0xf5, 0x1f, 0x00, 0x82, 0x53, 0xbb, 0x6d, 0xf7, 0xff, 0xf9, 0xff, 0x6f, 0xdb, 0x6d, 0x1b, 0x00, 0x04, 0xc9, 0x66, 0xdb, 0x57, 0x03, 0xa0, 0x52, 0xaf, 0xa7, 0x97, 0xff, 0x0f, 0x00, 0x51, 0x48, 0xda, 0x66, 0xdb, 0xff, 0xf8, 0xdf, 0xed, 0xbe, 0xed, 0x0e, 0x00, 0x92, 0x64, 0x32, 0xeb, 0xf6, 0x01, 0x20, 0x63, 0xbd, 0xbc, 0xfc, 0xfa, 0x0f, 0x00, 0x09, 0x20, 0x89, 0x3e, 0xff, 0xff, 0xe0, 0x7f, 0xdf, 0x6f, 0xdb, 0x07, 0x00, 0x01, 0x24, 0xbb, 0xed, 0xfe, 0x01, 0xa0, 0xce, 0xf5, 0xf6, 0xdb, 0xdf, 0x07, 0x00, 0x41, 0xad, 0x5f, 0xf2, 0xed, 0xff, 0xc0, 0xff, 0xbf, 0xdd, 0x92, 0x03, 0x00, 0x44, 0xb2, 0xd9, 0x7d, 0xfb, 0x01, 0xe0, 0xaa, 0xdf, 0x9b, 0x7f, 0xfb, 0x07, 0x80, 0x28, 0x21, 0x64, 0xbb, 0x7f, 0x7f, 0x80, 0xff, 0xf6, 0xbb, 0xee, 0x03, 0x80, 0x22, 0x99, 0xed, 0xb6, 0xff, 0x00, 0x90, 0xb8, 0x5e, 0x5b, 0x6b, 0xed, 0x03, 0x00, 0x01, 0xa6, 0x6d, 0xdb, 0xf6, 0x7f, 0x00, 0xff, 0xff, 0xf6, 0xcd, 0x00, 0x40, 0x10, 0xc9, 0x6c, 0xff, 0xf7, 0x00, 0xa0, 0xe3, 0x72, 0xeb, 0xef, 0xff, 0x03, 0x80, 0xe0, 0x90, 0x24, 0xdb, 0xbd, 0x3f, 0x00, 0xfe, 0xdb, 0x6f, 0xfb, 0x00, 0x00, 0x89, 0x4c, 0xb6, 0xd9, 0x7e, 0x00, 0x70, 0xaf, 0xaf, 0x6f, 0xb5, 0xde, 0x03, 0x80, 0x94, 0x92, 0xb6, 0xf9, 0xf6, 0x3f, 0x00, 0xfc, 0xbf, 0xdd, 0x7b, 0x00, 0x10, 0x48, 0x26, 0xb3, 0xdf, 0x7f, 0x00, 0x70, 0xd8, 0xae, 0xfd, 0xff, 0xf7, 0x03, 0x80, 0x00, 0xd2, 0x36, 0xcf, 0xdf, 0x3f, 0x00, 0xb8, 0x6d, 0xdf, 0x16, 0x00, 0x48, 0x44, 0xb2, 0xfb, 0x6c, 0x3f, 0x00, 0x50, 0x75, 0xfd, 0xa5, 0xd5, 0xfe, 0x01, 0x40, 0xd1, 0x12, 0xa2, 0x7d, 0xfb, 0x1f, 0x00, 0xf0, 0xff, 0xbf, 0x0d, 0x00, 0x20, 0x12, 0x9b, 0xcd, 0xf6, 0x3f, 0x00, 0x90, 0xd5, 0xa7, 0xfd, 0x77, 0xab, 0x03, 0x40, 0x1c, 0xc8, 0xbe, 0x6d, 0xfb, 0x1f, 0x00, 0xe0, 0xff, 0xee, 0x07, 0x00, 0x04, 0x91, 0xc9, 0x7e, 0xbf, 0x1f, 0x00, 0x30, 0x57, 0xbf, 0xa6, 0xde, 0xfd, 0x01, 0x40, 0x40, 0x6b, 0xd3, 0x6e, 0xef, 0x0f, 0x00, 0xc0, 0xeb, 0x7d, 0x03, 0x00, 0x90, 0xc8, 0x6c, 0x76, 0xfb, 0x0f, 0x00, 0x70, 0x5c, 0xe5, 0xf7, 0xfa, 0xeb, 0x01, 0x40, 0x50, 0x49, 0x92, 0xf4, 0xfd, 0x0f, 0x00, 0xc0, 0xff, 0xdb, 0x01, 0x80, 0x44, 0x44, 0x66, 0xbb, 0x6f, 0x0f, 0x00, 0xd0, 0xf1, 0x95, 0xf6, 0x6f, 0xad, 0x01, 0x40, 0x08, 0x78, 0xdb, 0xb6, 0xef, 0x0f, 0x00, 0x00, 0xdf, 0xd6, 0x00, 0x00, 0x20, 0x32, 0xb3, 0xdb, 0xfd, 0x0f, 0x00, 0x10, 0xd7, 0xf7, 0xb6, 0xd8, 0xeb, 0x03, 0x20, 0x43, 0x27, 0xd9, 0xb6, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0x7e, 0x00, 0x40, 0x12, 0x93, 0xd9, 0xec, 0xb6, 0x07, 0x00, 0x70, 0x55, 0xdd, 0xf6, 0x6f, 0xbb, 0x01, 0x40, 0x28, 0xa1, 0x6f, 0xb6, 0xb7, 0x0f, 0x00, 0x00, 0xde, 0x1f, 0x00, 0x80, 0x88, 0xd8, 0xcc, 0x66, 0xff, 0x03, 0x00, 0x70, 0xf4, 0xf5, 0xdb, 0xaa, 0xee, 0x01, 0x60, 0x28, 0x2d, 0x49, 0xf7, 0xf6, 0x07, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x08, 0x48, 0x66, 0x6e, 0xfb, 0xef, 0x03, 0x00, 0xd0, 0xd5, 0xdf, 0x52, 0xff, 0xda, 0x03, 0x20, 0xa3, 0xa5, 0xd9, 0xb2, 0xff, 0x07, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x20, 0x22, 0x33, 0x37, 0xbf, 0xfd, 0x01, 0x00, 0x70, 0x5f, 0xf7, 0xfe, 0xab, 0x6b, 0x02, 0xa0, 0xa8, 0xb4, 0x6d, 0xdf, 0xf6, 0x07, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x12, 0x33, 0x11, 0xd9, 0xdd, 0xff, 0x01, 0x00, 0x70, 0x75, 0xd5, 0x52, 0xea, 0x8a, 0x03, 0x20, 0x84, 0x36, 0x69, 0xba, 0xdb, 0x07, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x81, 0xc8, 0xcc, 0xdd, 0xed, 0xff, 0x00, 0x00, 0x60, 0xd5, 0xdf, 0xf6, 0xae, 0x6b, 0x03, 0x00, 0xa1, 0xa4, 0x6d, 0xdf, 0xfe, 0x07, 0x00, 0x00, 0x60, 0x00, 0x40, 0x44, 0xc6, 0xcc, 0x64, 0xb7, 0xfd, 0x00, 0x00, 0xe0, 0x55, 0xf7, 0xd6, 0xea, 0xba, 0x07, 0x20, 0x94, 0x94, 0x6d, 0xfb, 0xdb, 0x07, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x32, 0x76, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x60, 0x7d, 0xd5, 0xb6, 0x3f, 0xaf, 0x06, 0xa0, 0xa4, 0x95, 0x6c, 0x9b, 0xee, 0x07, 0x00, 0x00, 0x18, 0x00, 0x10, 0x92, 0x15, 0x73, 0xbb, 0xd9, 0x3f, 0x00, 0x00, 0xe0, 0xf5, 0xff, 0xf7, 0x6a, 0xa9, 0x06, 0x80, 0xa2, 0xb4, 0x6d, 0xfb, 0xfb, 0x07, 0x00, 0x00, 0x04, 0x00, 0x84, 0x88, 0xc8, 0x99, 0xdd, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0x8b, 0xff, 0x96, 0x6a, 0xb6, 0x0a, 0xa0, 0x94, 0x96, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x00, 0x03, 0x08, 0x20, 0x60, 0x66, 0xec, 0xee, 0xb6, 0x1d, 0x00, 0x00, 0xc0, 0x7e, 0xa5, 0xf4, 0xab, 0x55, 0x0d, 0x20, 0xe7, 0xd4, 0x6d, 0xdb, 0xfb, 0x07, 0x00, 0x80, 0x00, 0x00, 0x09, 0x12, 0x33, 0x67, 0x77, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xfa, 0xff, 0xb7, 0x7a, 0x55, 0x19, 0x90, 0x91, 0xd4, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x40, 0x00, 0x81, 0x04, 0x88, 0x91, 0x3b, 0xbb, 0xfd, 0x0f, 0x00, 0x00, 0xc0, 0xab, 0xbf, 0xed, 0x4e, 0xbb, 0x32, 0x20, 0x94, 0x96, 0x6c, 0xff, 0xfa, 0x03, 0x00, 0x30, 0x40, 0x20, 0x20, 0x64, 0xcc, 0xdc, 0xdd, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xeb, 0xea, 0xfd, 0xd5, 0xaa, 0x2a, 0x20, 0xd7, 0xb0, 0x6d, 0x93, 0xef, 0x07, 0x00, 0x08, 0x00, 0x08, 0x01, 0x23, 0xee, 0xee, 0xee, 0xfb, 0x03, 0x00, 0x00, 0xc0, 0xfe, 0xff, 0x2d, 0xdd, 0x6a, 0x49, 0xd0, 0x90, 0x9a, 0x64, 0xdf, 0xea, 0x07, 0x00, 0x03, 0x80, 0x40, 0x8c, 0x98, 0x33, 0xb3, 0xbb, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xa5, 0x7b, 0x6d, 0xa7, 0x56, 0xc5, 0xa0, 0x94, 0x94, 0x6f, 0xd3, 0xbb, 0x07, 0x80, 0x10, 0x0c, 0x12, 0x40, 0xc6, 0xb9, 0xdb, 0xfb, 0xfd, 0x01, 0x00, 0x00, 0x80, 0x97, 0xee, 0xdf, 0xba, 0x54, 0x1a, 0xa1, 0xe5, 0xd2, 0x64, 0x7e, 0xee, 0x07, 0x60, 0x02, 0x80, 0x00, 0x31, 0x62, 0xcc, 0xdc, 0xee, 0x7f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xdb, 0xaa, 0xb5, 0x8a, 0x86, 0x98, 0x96, 0x6d, 0x9b, 0xea, 0x07, 0x98, 0x00, 0x22, 0x44, 0x88, 0x39, 0x77, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x7d, 0x77, 0xba, 0x7b, 0x2d, 0x55, 0x3c, 0xa6, 0xb4, 0x6c, 0xf6, 0xaf, 0x07, 0x07, 0x90, 0x88, 0x20, 0x42, 0x9c, 0xbb, 0xbb, 0xbb, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x4b, 0xbd, 0xbf, 0x55, 0x53, 0xa5, 0xb2, 0xa1, 0xb4, 0xc9, 0x9f, 0xda, 0xcf, 0x28, 0x24, 0x42, 0x08, 0x31, 0xe6, 0xcc, 0xdd, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xef, 0xb7, 0xbd, 0xde, 0x12, 0xd1, 0xac, 0x95, 0x4d, 0xf2, 0x56, 0x9f, 0x88, 0x80, 0x10, 0xc2, 0x9c, 0x73, 0x77, 0xef, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xfb, 0xed, 0xeb, 0x35, 0x95, 0x72, 0xa2, 0x35, 0xcd, 0xb6, 0xd6, 0x2f, 0x21, 0x24, 0x04, 0x31, 0xc6, 0x98, 0x33, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0x7f, 0x5b, 0xab, 0x2d, 0x28, 0x23, 0x65, 0xd9, 0xb6, 0x55, 0x5f, 0x88, 0x08, 0x43, 0x0c, 0x61, 0xde, 0xdd, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0x4d, 0xd7, 0x4d, 0x4a, 0xa5, 0x29, 0x2d, 0xdb, 0xbe, 0x55, 0x1f, 0x22, 0x42, 0x28, 0xc2, 0x39, 0xe7, 0xee, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x7f, 0xfb, 0xb6, 0xb6, 0x95, 0x70, 0x2e, 0xa5, 0xd9, 0x24, 0x5d, 0x5f, 0x8a, 0x28, 0x88, 0x31, 0x9e, 0x39, 0x73, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xec, 0xb7, 0xdf, 0x6c, 0xb5, 0x65, 0x26, 0xa3, 0x39, 0x9b, 0xfc, 0x85, 0x5d, 0x21, 0x04, 0x63, 0x1c, 0xe6, 0xdd, 0xbd, 0xfb, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xb8, 0xfa, 0xb6, 0x6f, 0x4d, 0x9a, 0x28, 0x59, 0x4d, 0xd3, 0x2f, 0xf5, 0x3f, 0x8c, 0xd1, 0x18, 0xc6, 0x31, 0xf6, 0xdd, 0xfe, 0xff, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xb9, 0xb6, 0x25, 0xe1, 0x4d, 0x69, 0xba, 0x6c, 0xad, 0x3c, 0x41, 0x14, 0x84, 0xe9, 0x9e, 0x37, 0xf7, 0xff, 0xff, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x70, 0x5d, 0x3d, 0x9f, 0x3d, 0x6d, 0x26, 0x52, 0x59, 0xb6, 0x6d, 0xab, 0x7f, 0x14, 0x82, 0xe1, 0x39, 0xe6, 0xdd, 0xfb, 0xff, 0xbf, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0xf6, 0x6f, 0x77, 0xcd, 0x92, 0xd0, 0x52, 0x4b, 0xb3, 0x49, 0x0b, 0x3a, 0x41, 0x61, 0x38, 0x9e, 0x73, 0xee, 0xdc, 0xff, 0xff, 0xfd, 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd7, 0x65, 0xda, 0x66, 0x63, 0x9d, 0xf2, 0x36, 0x7b, 0x6a, 0x7f, 0x14, 0x18, 0x8e, 0xe7, 0xd9, 0x7b, 0xff, 0xff, 0xef, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xdd, 0xb6, 0xc9, 0x4c, 0x46, 0x9a, 0x64, 0xcb, 0x5b, 0xed, 0x06, 0xc6, 0xe3, 0x71, 0xde, 0xbd, 0xff, 0xff, 0x7f, 0xff, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x7f, 0xff, 0x59, 0x37, 0x75, 0xbb, 0x96, 0x66, 0xdb, 0x56, 0xf7, 0xe0, 0xf2, 0x74, 0x9e, 0x77, 0xef, 0xfd, 0xff, 0xeb, 0xed, 0x03, 0x00, 0x00, 0x00, 0xc0, 0xea, 0xdf, 0xb3, 0xdb, 0xde, 0xc6, 0x81, 0xb0, 0x6c, 0xba, 0xb4, 0xf6, 0x38, 0x18, 0x3c, 0xe7, 0x9c, 0xfb, 0xff, 0x7f, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf7, 0x6e, 0x66, 0xd9, 0x99, 0xac, 0xa4, 0xcd, 0x96, 0xa5, 0xea, 0x03, 0xa7, 0xcf, 0x79, 0xef, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0xef, 0xdf, 0x6f, 0xef, 0x72, 0x65, 0xd9, 0xb6, 0xad, 0xe8, 0xc1, 0xe1, 0xf1, 0xbe, 0x7b, 0xef, 0xff, 0xdf, 0x7a, 0xfb, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5f, 0xdd, 0x9d, 0xac, 0x99, 0x84, 0x29, 0xcd, 0x3c, 0x4f, 0x9d, 0x7d, 0x3c, 0x9e, 0xe7, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xef, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x77, 0x7b, 0x33, 0xe7, 0x5a, 0x49, 0x9b, 0x65, 0x59, 0x75, 0x07, 0x97, 0xf7, 0xbb, 0xef, 0xff, 0xff, 0xdb, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf7, 0x3f, 0xe7, 0xcf, 0x9c, 0x51, 0x4d, 0xb0, 0x6d, 0x4b, 0xc9, 0xd3, 0xf5, 0x79, 0xfe, 0xfb, 0xff, 0xff, 0xdb, 0xda, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xde, 0xdd, 0xf3, 0x4d, 0x52, 0x36, 0xcb, 0xd2, 0x3a, 0x7e, 0x3c, 0xde, 0xe7, 0xbe, 0xff, 0x7f, 0xda, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xfb, 0xdd, 0x73, 0x8f, 0xa5, 0x9a, 0xe6, 0xd9, 0xb6, 0xe2, 0x4e, 0xc7, 0xf7, 0xfd, 0xff, 0xff, 0xff, 0xf7, 0xf6, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x7f, 0xee, 0x79, 0xb2, 0xb2, 0x2c, 0x9f, 0xb6, 0x54, 0xfe, 0xfb, 0x79, 0xbf, 0xff, 0xff, 0x5f, 0xda, 0xff, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xf7, 0xbf, 0xe7, 0x4b, 0xb4, 0x69, 0xd3, 0x2c, 0x25, 0xbd, 0xbc, 0xcf, 0xf7, 0xfd, 0xff, 0xd7, 0xf6, 0xfe, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xbf, 0x9d, 0xf1, 0x3e, 0x57, 0x25, 0xcb, 0xb6, 0x6d, 0xa9, 0xb5, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xd5, 0xda, 0xd6, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xfb, 0xcf, 0xf5, 0x25, 0x65, 0xd9, 0x66, 0x5b, 0x4a, 0xfa, 0xf9, 0x7e, 0xff, 0xff, 0xff, 0xf6, 0xd6, 0xdf, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0x3e, 0xf7, 0x9f, 0x5b, 0x92, 0x6c, 0xdb, 0x52, 0xe5, 0xbe, 0xdf, 0xff, 0xff, 0xbf, 0x51, 0xda, 0xfa, 0x7f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7b, 0x9f, 0xe7, 0x4c, 0xb3, 0x4d, 0xd3, 0x54, 0xd9, 0xe7, 0xfb, 0xff, 0xff, 0x5f, 0xdc, 0xfa, 0xdf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0xe7, 0xf9, 0x3a, 0xd3, 0xa6, 0xe9, 0xb6, 0xa5, 0xca, 0xf9, 0xfd, 0xff, 0xff, 0x83, 0x42, 0xd2, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xfd, 0xbf, 0xef, 0x4f, 0xd5, 0x64, 0xdb, 0x26, 0x4d, 0x30, 0x7f, 0xff, 0xff, 0xff, 0x91, 0xda, 0xdb, 0xda, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xff, 0x7d, 0xbe, 0xb5, 0x6d, 0x97, 0x6d, 0x93, 0x56, 0xdf, 0xff, 0xff, 0x7f, 0x81, 0x4a, 0xda, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xef, 0xeb, 0xbb, 0xa6, 0x4d, 0x73, 0xcd, 0x92, 0xaa, 0xfe, 0xff, 0xff, 0x1f, 0x01, 0x6a, 0x5b, 0xfb, 0xfb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xbf, 0x5f, 0x3b, 0xdb, 0x36, 0xbb, 0x26, 0x4c, 0xf9, 0xff, 0xff, 0x0f, 0xa3, 0x2a, 0xe9, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xff, 0xff, 0xfe, 0xfe, 0xcc, 0x91, 0xec, 0x93, 0x6d, 0x93, 0xf2, 0xff, 0xff, 0x03, 0x00, 0x6a, 0x6d, 0x6f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x6f, 0x76, 0xb6, 0xcd, 0x76, 0xc9, 0x2a, 0xe9, 0xff, 0xff, 0x00, 0x02, 0x24, 0xed, 0xf9, 0xed, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xdf, 0xff, 0xd9, 0x66, 0x9b, 0x6c, 0x93, 0x54, 0xc5, 0xff, 0x3f, 0x00, 0x01, 0x95, 0xb5, 0xaf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xfd, 0xae, 0x7d, 0xde, 0x6d, 0xf6, 0xa1, 0x8a, 0xff, 0x0f, 0x00, 0x81, 0x90, 0xb4, 0xfd, 0xfd, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xcd, 0xb2, 0xdb, 0x2c, 0xcb, 0x54, 0xfe, 0x01, 0x00, 0x01, 0xd2, 0xb6, 0xb7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x39, 0xdb, 0x76, 0xb3, 0x4b, 0xb6, 0x0a, 0xfe, 0x00, 0x00, 0x01, 0x48, 0xda, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xcf, 0xb9, 0x6d, 0xb6, 0xd9, 0xa5, 0x75, 0x1c, 0x00, 0x80, 0x80, 0x20, 0xdb, 0xda, 0xbe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x77, 0x96, 0xd9, 0x26, 0xb3, 0x4d, 0x82, 0x11, 0x00, 0x80, 0x80, 0x24, 0x6d, 0xff, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xbb, 0x67, 0xdb, 0xdd, 0x36, 0xd9, 0x54, 0x60, 0x00, 0xc0, 0x00, 0x92, 0x65, 0x6b, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x4f, 0x7d, 0x96, 0xd9, 0x6c, 0x36, 0xad, 0xc2, 0x00, 0x60, 0x00, 0xc8, 0xb6, 0x6d, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xc8, 0x76, 0xbb, 0xcb, 0x64, 0x52, 0x02, 0x03, 0x10, 0x00, 0x64, 0xda, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x5f, 0xd7, 0x4d, 0x33, 0x99, 0xdd, 0x96, 0x04, 0x2c, 0x1c, 0x40, 0x22, 0xdb, 0xb6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xdf, 0xb5, 0xed, 0xe6, 0x36, 0x9b, 0x6c, 0x29, 0xf0, 0x03, 0x00, 0x99, 0x6c, 0xfb, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x35, 0xbb, 0xec, 0x76, 0x33, 0x91, 0x02, 0x00, 0x00, 0x00, 0x64, 0x67, 0xdf, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xbf, 0x6f, 0x9b, 0x9d, 0xc9, 0xce, 0x36, 0x49, 0x00, 0x00, 0x00, 0x93, 0xb1, 0xdd, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xff, 0x6a, 0x76, 0xbb, 0xdd, 0xd9, 0x64, 0x12, 0x01, 0x00, 0x40, 0x98, 0xdd, 0x6d, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x66, 0x73, 0x33, 0xbb, 0x9d, 0x4d, 0x00, 0x00, 0x00, 0x63, 0xe6, 0xf6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xed, 0xfd, 0xee, 0xee, 0x36, 0x73, 0x2b, 0x04, 0x00, 0xa0, 0x38, 0x75, 0xbf, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xd9, 0xec, 0xce, 0x66, 0x66, 0x66, 0x22, 0x04, 0x00, 0xc6, 0x99, 0xbb, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xb3, 0xdb, 0xb9, 0xcd, 0xc9, 0x88, 0x89, 0x00, 0x68, 0x31, 0xee, 0xdd, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbe, 0xbb, 0x9b, 0x3f, 0xbb, 0x33, 0x23, 0x04, 0x00, 0x8c, 0xf3, 0xee, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x67, 0x76, 0x77, 0xb2, 0x66, 0xce, 0x0c, 0xd1, 0xd6, 0xe3, 0x79, 0xf7, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfd, 0xef, 0xe6, 0xee, 0xce, 0x9c, 0x31, 0x16, 0x00, 0x3c, 0x9e, 0xfb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x9f, 0xdb, 0xdc, 0x9d, 0x99, 0x33, 0xc6, 0xc1, 0xff, 0x8f, 0xe7, 0xbb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf7, 0xbd, 0xbb, 0x33, 0x7b, 0xee, 0x18, 0x1e, 0x50, 0xf0, 0xf9, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7b, 0xf7, 0x77, 0xf7, 0xe6, 0x9c, 0xe3, 0xf0, 0x4d, 0xff, 0x7c, 0xef, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x76, 0x7f, 0xcf, 0x9e, 0x73, 0x8f, 0x07, 0xff, 0x0b, 0xdf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xee, 0xcd, 0xdd, 0x9d, 0x7b, 0xf7, 0x7c, 0x7a, 0x00, 0xf0, 0xe7, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0xbf, 0xdd, 0x7b, 0x6b, 0x9e, 0xf3, 0xe1, 0xff, 0xff, 0x7d, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xb7, 0xbb, 0x7b, 0xee, 0x79, 0x8f, 0x0f, 0xfa, 0x2f, 0xff, 0xf7, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff, 0x77, 0xef, 0xdd, 0x77, 0x7c, 0xfe, 0x02, 0xe8, 0xcf, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xef, 0xee, 0xdd, 0xb3, 0xcf, 0xf3, 0xf1, 0xff, 0xff, 0xf9, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfb, 0xff, 0xbf, 0xef, 0xbe, 0xcf, 0x8f, 0xfe, 0x5f, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xbf, 0xbb, 0xf7, 0xde, 0x79, 0x3e, 0xff, 0x52, 0xd2, 0xdf, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xef, 0xef, 0xef, 0x3c, 0xef, 0xf9, 0xf8, 0xff, 0xff, 0xf7, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xee, 0xdc, 0xf7, 0xfe, 0xe7, 0x97, 0xfe, 0xff, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xef, 0xbf, 0x3e, 0xff, 0xda, 0xf6, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xbf, 0xf7, 0xfe, 0xf7, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xde, 0xbd, 0xef, 0xfb, 0xd7, 0xff, 0xbf, 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x7d, 0xbf, 0xff, 0xd2, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xef, 0xfb, 0xfd, 0xfd, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xef, 0xbe, 0xf7, 0xef, 0xef, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xdf, 0xbf, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xfe, 0xff, 0xfb, 0xf7, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfd, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; vnc_unixsrc/Xvnc/include/bitmaps/hlines30100664000076400007640000000014607120677563017776 0ustar constconst#define hlines3_width 1 #define hlines3_height 3 static char hlines3_bits[] = { 0x00, 0x01, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/cntr_ptrmsk0100664000076400007640000000045007120677563020775 0ustar constconst#define cntr_ptrmsk_width 16 #define cntr_ptrmsk_height 16 static char cntr_ptrmsk_bits[] = { 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03}; vnc_unixsrc/Xvnc/include/bitmaps/1x10100664000076400007640000000042007120677563017035 0ustar constconst#define 1x1_width 16 #define 1x1_height 16 static char 1x1_bits[] = { 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55}; vnc_unixsrc/Xvnc/include/bitmaps/black0100664000076400007640000000042607120677563017506 0ustar constconst#define black_width 16 #define black_height 16 static char black_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; vnc_unixsrc/Xvnc/include/bitmaps/right_ptrmsk0100664000076400007640000000045307120677563021147 0ustar constconst#define right_ptrmsk_width 16 #define right_ptrmsk_height 16 static char right_ptrmsk_bits[] = { 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f, 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b, 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/noletters0100664000076400007640000000354107120677563020452 0ustar constconst#define noletters_width 48 #define noletters_height 48 static char noletters_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x78, 0x0e, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x1e, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x0f, 0x38, 0x38, 0x00, 0x00, 0x80, 0x07, 0x38, 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x1c, 0x04, 0x00, 0xe0, 0x41, 0x70, 0x1c, 0x04, 0x00, 0xf0, 0x40, 0x70, 0x1c, 0x74, 0x00, 0x78, 0x4e, 0x70, 0x0e, 0x04, 0x00, 0x3c, 0x4a, 0xe0, 0x0e, 0x74, 0x03, 0x1e, 0x4a, 0xe0, 0x0e, 0x04, 0x00, 0x0f, 0x4e, 0xe0, 0x0e, 0x04, 0x80, 0x07, 0x40, 0xe0, 0x0e, 0x04, 0xf8, 0x0f, 0x40, 0xe0, 0x0e, 0x04, 0xe0, 0x01, 0x40, 0xe0, 0x0e, 0x04, 0xf8, 0x00, 0x40, 0xe0, 0x0e, 0x04, 0x78, 0x00, 0x40, 0xe0, 0x0e, 0x04, 0xfc, 0xf3, 0x40, 0xe0, 0x1c, 0x04, 0x1e, 0x00, 0x40, 0x70, 0x1c, 0x04, 0x0f, 0x00, 0x40, 0x70, 0x1c, 0x84, 0x07, 0x00, 0x40, 0x70, 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x38, 0xe0, 0x01, 0x00, 0x00, 0x38, 0x38, 0xf0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x78, 0x00, 0x00, 0x00, 0x1c, 0xf0, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0xe0, 0x1e, 0x00, 0x00, 0x00, 0x0e, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00, 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/woman0100664000076400007640000001125207120677563017552 0ustar constconst#define sorceress_width 75 #define sorceress_height 75 static char sorceress_bits[] = { 0xfc, 0x7e, 0x40, 0x20, 0x90, 0x00, 0x07, 0x80, 0x23, 0x00, 0x00, 0xc6, 0xc1, 0x41, 0x98, 0xb8, 0x01, 0x07, 0x66, 0x00, 0x15, 0x9f, 0x03, 0x47, 0x8c, 0xc6, 0xdc, 0x7b, 0xcc, 0x00, 0xb0, 0x71, 0x0e, 0x4d, 0x06, 0x66, 0x73, 0x8e, 0x8f, 0x01, 0x18, 0xc4, 0x39, 0x4b, 0x02, 0x23, 0x0c, 0x04, 0x1e, 0x03, 0x0c, 0x08, 0xc7, 0xef, 0x08, 0x30, 0x06, 0x07, 0x1c, 0x02, 0x06, 0x30, 0x18, 0xae, 0xc8, 0x98, 0x3f, 0x78, 0x20, 0x06, 0x02, 0x20, 0x60, 0xa0, 0xc4, 0x1d, 0xc0, 0xff, 0x41, 0x04, 0xfa, 0x63, 0x80, 0xa1, 0xa4, 0x3d, 0x00, 0x84, 0xbf, 0x04, 0x0f, 0x06, 0xfc, 0xa1, 0x34, 0x6b, 0x01, 0x1c, 0xc9, 0x05, 0x06, 0xc7, 0x06, 0xbe, 0x11, 0x1e, 0x43, 0x30, 0x91, 0x05, 0xc3, 0x61, 0x02, 0x30, 0x1b, 0x30, 0xcc, 0x20, 0x11, 0x00, 0xc1, 0x3c, 0x03, 0x20, 0x0a, 0x00, 0xe8, 0x60, 0x21, 0x00, 0x61, 0x1b, 0xc1, 0x63, 0x08, 0xf0, 0xc6, 0xc7, 0x21, 0x03, 0xf8, 0x08, 0xe1, 0xcf, 0x0a, 0xfc, 0x4d, 0x99, 0x43, 0x07, 0x3c, 0x0c, 0xf1, 0x9f, 0x0b, 0xfc, 0x5b, 0x81, 0x47, 0x02, 0x16, 0x04, 0x31, 0x1c, 0x0b, 0x1f, 0x17, 0x89, 0x4d, 0x06, 0x1a, 0x04, 0x31, 0x38, 0x02, 0x07, 0x56, 0x89, 0x49, 0x04, 0x0b, 0x04, 0xb1, 0x72, 0x82, 0xa1, 0x54, 0x9a, 0x49, 0x04, 0x1d, 0x66, 0x50, 0xe7, 0xc2, 0xf0, 0x54, 0x9a, 0x58, 0x04, 0x0d, 0x62, 0xc1, 0x1f, 0x44, 0xfc, 0x51, 0x90, 0x90, 0x04, 0x86, 0x63, 0xe0, 0x74, 0x04, 0xef, 0x31, 0x1a, 0x91, 0x00, 0x02, 0xe2, 0xc1, 0xfd, 0x84, 0xf9, 0x30, 0x0a, 0x91, 0x00, 0x82, 0xa9, 0xc0, 0xb9, 0x84, 0xf9, 0x31, 0x16, 0x81, 0x00, 0x42, 0xa9, 0xdb, 0x7f, 0x0c, 0xff, 0x1c, 0x16, 0x11, 0x00, 0x02, 0x28, 0x0b, 0x07, 0x08, 0x60, 0x1c, 0x02, 0x91, 0x00, 0x46, 0x29, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x16, 0x11, 0x02, 0x06, 0x29, 0x04, 0x00, 0x00, 0x00, 0x10, 0x16, 0x91, 0x06, 0xa6, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x24, 0x91, 0x04, 0x86, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x27, 0x93, 0x04, 0x96, 0x4a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x02, 0x91, 0x04, 0x86, 0x4a, 0x0c, 0x00, 0x00, 0x00, 0x1e, 0x23, 0x93, 0x04, 0x56, 0x88, 0x08, 0x00, 0x00, 0x00, 0x90, 0x21, 0x93, 0x04, 0x52, 0x0a, 0x09, 0x80, 0x01, 0x00, 0xd0, 0x21, 0x95, 0x04, 0x57, 0x0a, 0x0f, 0x80, 0x27, 0x00, 0xd8, 0x20, 0x9d, 0x04, 0x5d, 0x08, 0x1c, 0x80, 0x67, 0x00, 0xe4, 0x01, 0x85, 0x04, 0x79, 0x8a, 0x3f, 0x00, 0x00, 0x00, 0xf4, 0x11, 0x85, 0x06, 0x39, 0x08, 0x7d, 0x00, 0x00, 0x18, 0xb7, 0x10, 0x81, 0x03, 0x29, 0x12, 0xcb, 0x00, 0x7e, 0x30, 0x28, 0x00, 0x85, 0x03, 0x29, 0x10, 0xbe, 0x81, 0xff, 0x27, 0x0c, 0x10, 0x85, 0x03, 0x29, 0x32, 0xfa, 0xc1, 0xff, 0x27, 0x94, 0x11, 0x85, 0x03, 0x28, 0x20, 0x6c, 0xe1, 0xff, 0x07, 0x0c, 0x01, 0x85, 0x01, 0x28, 0x62, 0x5c, 0xe3, 0x8f, 0x03, 0x4e, 0x91, 0x80, 0x05, 0x39, 0x40, 0xf4, 0xc2, 0xff, 0x00, 0x9f, 0x91, 0x84, 0x05, 0x31, 0xc6, 0xe8, 0x07, 0x7f, 0x80, 0xcd, 0x00, 0xc4, 0x04, 0x31, 0x06, 0xc9, 0x0e, 0x00, 0xc0, 0x48, 0x88, 0xe0, 0x04, 0x79, 0x04, 0xdb, 0x12, 0x00, 0x30, 0x0c, 0xc8, 0xe4, 0x04, 0x6d, 0x06, 0xb6, 0x23, 0x00, 0x18, 0x1c, 0xc0, 0x84, 0x04, 0x25, 0x0c, 0xff, 0xc2, 0x00, 0x4e, 0x06, 0xb0, 0x80, 0x04, 0x3f, 0x8a, 0xb3, 0x83, 0xff, 0xc3, 0x03, 0x91, 0x84, 0x04, 0x2e, 0xd8, 0x0f, 0x3f, 0x00, 0x00, 0x5f, 0x83, 0x84, 0x04, 0x2a, 0x70, 0xfd, 0x7f, 0x00, 0x00, 0xc8, 0xc0, 0x84, 0x04, 0x4b, 0xe2, 0x2f, 0x01, 0x00, 0x08, 0x58, 0x60, 0x80, 0x04, 0x5b, 0x82, 0xff, 0x01, 0x00, 0x08, 0xd0, 0xa0, 0x84, 0x04, 0x72, 0x80, 0xe5, 0x00, 0x00, 0x08, 0xd2, 0x20, 0x44, 0x04, 0xca, 0x02, 0xff, 0x00, 0x00, 0x08, 0xde, 0xa0, 0x44, 0x04, 0x82, 0x02, 0x6d, 0x00, 0x00, 0x08, 0xf6, 0xb0, 0x40, 0x02, 0x82, 0x07, 0x3f, 0x00, 0x00, 0x08, 0x44, 0x58, 0x44, 0x02, 0x93, 0x3f, 0x1f, 0x00, 0x00, 0x30, 0x88, 0x4f, 0x44, 0x03, 0x83, 0x23, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x60, 0xe0, 0x07, 0xe3, 0x0f, 0xfe, 0x00, 0x00, 0x00, 0x70, 0x70, 0xe4, 0x07, 0xc7, 0x1b, 0xfe, 0x01, 0x00, 0x00, 0xe0, 0x3c, 0xe4, 0x07, 0xc7, 0xe3, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0x1f, 0xfc, 0x07, 0xc7, 0x03, 0xf8, 0x33, 0x00, 0xc0, 0xf0, 0x07, 0xff, 0x07, 0x87, 0x02, 0xfc, 0x43, 0x00, 0x60, 0xf0, 0xff, 0xff, 0x07, 0x8f, 0x06, 0xbe, 0x87, 0x00, 0x30, 0xf8, 0xff, 0xff, 0x07, 0x8f, 0x14, 0x9c, 0x8f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x9f, 0x8d, 0x8a, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 0xbf, 0x0b, 0x80, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x7f, 0x3a, 0x80, 0x3f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0xff, 0x20, 0xc0, 0x3f, 0x00, 0x80, 0xff, 0xff, 0xff, 0x07, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07, 0xff, 0x0f, 0xf8, 0xff, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0x40, 0xf0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0x41, 0xf0, 0xff, 0xff, 0xff, 0x07}; vnc_unixsrc/Xvnc/include/bitmaps/wingdogs0100664000076400007640000000156707120677563020262 0ustar constconst#define wingdogs_width 32 #define wingdogs_height 32 static char wingdogs_bits[] = { 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x20, 0x0f, 0x00, 0x00, 0x40, 0x3e, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x80, 0x84, 0xff, 0x00, 0xc0, 0x86, 0xff, 0x00, 0xc0, 0x07, 0xff, 0x21, 0xe0, 0x0f, 0xfe, 0x23, 0xf0, 0x0f, 0xfe, 0x23, 0xfc, 0x1d, 0xfe, 0x13, 0xfe, 0x39, 0xfc, 0x13, 0xff, 0x3f, 0xfc, 0x83, 0xff, 0x9f, 0xfc, 0xc1, 0xff, 0x0f, 0xfe, 0xe0, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x7f, 0xf6, 0xff, 0xff, 0x1f, 0xfb, 0xff, 0xff, 0x07, 0xf8, 0xfd, 0xff, 0x03, 0xbc, 0xf9, 0xff, 0x01, 0x3c, 0xf9, 0xff, 0x01, 0x3e, 0xf0, 0xf7, 0x00, 0x1f, 0xe0, 0x77, 0x00, 0x1f, 0x80, 0x77, 0x00, 0x8f, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x6e, 0x80, 0x07, 0x00, 0x7c, 0x80, 0x0d, 0x00, 0xf8, 0x80, 0x1f, 0x00, 0xf0, 0x01}; vnc_unixsrc/Xvnc/include/bitmaps/vlines20100664000076400007640000000013207120677563020006 0ustar constconst#define vlines2_width 2 #define vlines2_height 1 static char vlines2_bits[] = { 0x01}; vnc_unixsrc/Xvnc/include/bitmaps/letters0100664000076400007640000000353307120677563020116 0ustar constconst#define letters_width 48 #define letters_height 48 static char letters_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2e, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21, 0xa0, 0x03, 0x00, 0x00, 0x70, 0x21, 0x20, 0x00, 0x00, 0x00, 0x50, 0x21, 0xa0, 0x1f, 0x00, 0x00, 0x50, 0x21, 0x20, 0x00, 0x00, 0x00, 0x70, 0x21, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, 0xfa, 0x01, 0x00, 0x80, 0x0b, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0a, 0x21, 0xba, 0x01, 0x00, 0x80, 0x0a, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0b, 0x21, 0x3a, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0xc0, 0xfb, 0x03, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x3f, 0x02, 0xc0, 0xbd, 0x0f, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, 0x02, 0xc0, 0x7f, 0x7b, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/vlines30100664000076400007640000000013207120677563020007 0ustar constconst#define vlines3_width 3 #define vlines3_height 1 static char vlines3_bits[] = { 0x02}; vnc_unixsrc/Xvnc/include/bitmaps/target0100664000076400007640000000043107120677563017714 0ustar constconst#define target_width 16 #define target_height 16 static char target_bits[] = { 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xe0, 0x07, 0x90, 0x09, 0x88, 0x11, 0xc8, 0x13, 0x7e, 0x7e, 0x7e, 0x7e, 0xc8, 0x13, 0x88, 0x11, 0x90, 0x09, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/dot0100664000076400007640000000042007120677563017212 0ustar constconst#define dot_width 16 #define dot_height 16 static char dot_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xf0, 0x0f, 0xf0, 0x0f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/icon0100664000076400007640000000042307120677563017357 0ustar constconst#define icon_width 16 #define icon_height 16 static char icon_bits[] = { 0xff, 0xff, 0xab, 0xaa, 0x55, 0xd5, 0xab, 0xaa, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x55, 0xd5, 0xab, 0xaa, 0x55, 0xd5, 0xff, 0xff}; vnc_unixsrc/Xvnc/include/bitmaps/calculator0100664000076400007640000000237207120677563020565 0ustar constconst#define icon_width 28 #define icon_height 48 static char icon_bits[] = { 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x03, 0x00, 0x00, 0x0c, 0xd3, 0x5d, 0x5d, 0x0c, 0x13, 0x51, 0x45, 0x0c, 0xd3, 0xdd, 0xdd, 0x0d, 0x53, 0x10, 0x51, 0x0d, 0xd3, 0x1d, 0xdd, 0x0d, 0x03, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xa5, 0x94, 0x52, 0x0a, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xff, 0xde, 0x0b, 0xbd, 0x80, 0xd2, 0x0b, 0xbd, 0x80, 0xd2, 0x0b, 0xbd, 0xff, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xff, 0xff, 0xff, 0x0f}; vnc_unixsrc/Xvnc/include/bitmaps/cntr_ptr0100664000076400007640000000052107120677563020261 0ustar constconst#define cntr_ptr_width 16 #define cntr_ptr_height 16 #define cntr_ptr_x_hot 7 #define cntr_ptr_y_hot 1 static char cntr_ptr_bits[] = { 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xlogo640100664000076400007640000000633507120677563017741 0ustar constconst#define xlogo64_width 64 #define xlogo64_height 64 static unsigned char xlogo64_bits[] = { 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x0f, 0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x80, 0x0f, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x3e, 0x00, 0x00, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xe7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0xcf, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc3, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1f, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x80, 0x0f, 0x00, 0xf8, 0xff, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0x03, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0x03, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x1f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0xc0, 0x07, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x0f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0xf0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x3f, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff}; vnc_unixsrc/Xvnc/include/bitmaps/keyboard160100664000076400007640000000044507120677563020402 0ustar constconst#define keyboard16_width 16 #define keyboard16_height 16 static char keyboard16_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0xa8, 0x1a, 0x54, 0x35, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xsnow0100664000076400007640000024240607120677563017616 0ustar constconst#define xsnow_width 300 #define xsnow_height 350 static char xsnow_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x01, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x99, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9e, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x98, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x09, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x47, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xce, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6c, 0x0f, 0xef, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x07, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x03, 0x1e, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfc, 0x07, 0x7e, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x30, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0xef, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x71, 0xf0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfe, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x77, 0xf0, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x33, 0xf0, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xf0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xe0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xe0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9c, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x30, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x19, 0xe0, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x99, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xe0, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xf0, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x01, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xdf, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0xf6, 0xff, 0x03, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xfe, 0xff, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x1e, 0xce, 0x03, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x1f, 0x80, 0x07, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0xc3, 0x1f, 0x80, 0x1f, 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1c, 0xef, 0x0f, 0x80, 0xbf, 0xff, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x1e, 0xfc, 0x07, 0x80, 0xff, 0x8f, 0x7b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x02, 0x00, 0x00, 0x00, 0x40, 0xdb, 0x0f, 0xf8, 0x03, 0x00, 0xf7, 0x07, 0xff, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xb8, 0x0f, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x8d, 0x07, 0xfe, 0x01, 0x00, 0xfc, 0x03, 0x8e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x3d, 0xdc, 0x23, 0x00, 0x00, 0x00, 0x60, 0xef, 0x03, 0x7f, 0x07, 0x00, 0xfe, 0x80, 0xcf, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3e, 0x1f, 0xfc, 0xbd, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x8e, 0x7f, 0x0f, 0x00, 0xff, 0xc1, 0xfb, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1d, 0x0f, 0x58, 0xdc, 0x03, 0x00, 0x00, 0x00, 0x30, 0xfc, 0xef, 0x0f, 0x80, 0xbf, 0xc3, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xde, 0x1f, 0x7c, 0xbe, 0x01, 0x00, 0x00, 0x00, 0x10, 0xf0, 0xc3, 0x0f, 0xc0, 0x1f, 0x46, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x1d, 0xde, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x0f, 0xc0, 0x07, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x78, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x9e, 0xc3, 0x03, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xfe, 0xdf, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x7f, 0x03, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x39, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1e, 0xe0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1e, 0xe0, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1e, 0x60, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x1c, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1c, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x3c, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3c, 0x70, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3f, 0x70, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x39, 0x70, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x20, 0x30, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x67, 0x00, 0x00, 0x90, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xcf, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x1f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x3e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x7b, 0x78, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7d, 0x3e, 0xf8, 0xd3, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x1a, 0xf0, 0xb0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x3f, 0xf0, 0xf9, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x3b, 0x78, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0x39, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x1f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xcf, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x60, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xe0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0xc0, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xb6, 0x07, 0x00, 0xec, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xe7, 0x03, 0x00, 0xf8, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf3, 0x00, 0x00, 0x3c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xfe, 0x01, 0x00, 0x7e, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbc, 0x03, 0x00, 0xef, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x80, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0x40, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x11, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x60, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1a, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x08, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0x20, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0b, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x08, 0x04, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x0c, 0x9c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0d, 0xfc, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x60, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x0c, 0x7c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0xe0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x38, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x17, 0xc0, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x06, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x06, 0x78, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x78, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x7c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xc0, 0xfd, 0x7f, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbc, 0x07, 0x00, 0xee, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xc0, 0x87, 0xf9, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf6, 0x03, 0x00, 0xfc, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe0, 0x07, 0xf0, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe3, 0x01, 0x00, 0x78, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf4, 0xf0, 0x07, 0xf0, 0xc3, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xfb, 0x00, 0x00, 0x3e, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc7, 0xfb, 0x03, 0xf0, 0xf7, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbe, 0x03, 0x00, 0xef, 0x13, 0x00, 0x00, 0x00, 0x40, 0xbc, 0x87, 0xff, 0x00, 0xf0, 0xff, 0x73, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00, 0xd0, 0xf6, 0x03, 0xff, 0x00, 0xc0, 0xff, 0xe0, 0xdf, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xe3, 0x81, 0x3f, 0x00, 0x00, 0x7f, 0xc0, 0x33, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xfb, 0xc0, 0xef, 0x00, 0xc0, 0x3f, 0xf0, 0xf9, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbe, 0xf3, 0xff, 0x03, 0xe0, 0x3f, 0x78, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, 0xfb, 0x03, 0xf0, 0x77, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfc, 0xf0, 0x03, 0xf8, 0xc3, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xe0, 0x03, 0xf8, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xc0, 0x67, 0xf8, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x67, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xc0, 0xff, 0x6f, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xcc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x60, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x07, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x87, 0x07, 0x98, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x38, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x81, 0x07, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x3d, 0xbc, 0x47, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3e, 0x1f, 0xfc, 0x69, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0x0d, 0x78, 0xd8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0f, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xd6, 0x1f, 0xf8, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0f, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x1d, 0xbc, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x0f, 0xec, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xf8, 0x1c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x0e, 0x8c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x08, 0x04, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0e, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x39, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1c, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1e, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x19, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x67, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x09, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x78, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x08, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x09, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x03, 0x80, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xdb, 0x03, 0x00, 0xfb, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xf3, 0x01, 0x00, 0xbc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x79, 0x00, 0x00, 0x8f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xff, 0x00, 0x80, 0xdf, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xde, 0x01, 0xc0, 0x7b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x03, 0xc0, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x60, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x10, 0x00, 0x20, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x18, 0x00, 0xe0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1b, 0x00, 0xe0, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x19, 0x00, 0xe0, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0xe0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x00, 0xc0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0e, 0xd0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x00, 0xc0, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x08, 0x00, 0xc0, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0e, 0x58, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x0c, 0x00, 0xc0, 0xc3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x00, 0xc0, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x09, 0x88, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x87, 0xcf, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0xff, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xcf, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x78, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x1e, 0xfe, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe1, 0x78, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xfb, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xf7, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xb9, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xda, 0x7e, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xf0, 0x6f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3c, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0, 0xb9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x1f, 0xf8, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0xf8, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x77, 0xfe, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xbc, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe1, 0x7f, 0x07, 0x00, 0x00, 0x00, 0xf8, 0x7b, 0x1c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x1f, 0x0e, 0x00, 0x00, 0x00, 0xfc, 0xe1, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x38, 0x00, 0x00, 0x00, 0x7c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x70, 0x00, 0x00, 0x00, 0x3c, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xec, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x3f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x23, 0x00, 0x00, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc7, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x35, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x17, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x0f, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x10, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x0f, 0x00, 0xc0, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x18, 0x38, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x00, 0x60, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1b, 0xf8, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x19, 0xf8, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0e, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x18, 0x78, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1e, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x60, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x70, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x1f, 0x00, 0x70, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x0c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1c, 0x00, 0x70, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x0c, 0xf0, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x10, 0x00, 0x30, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x0f, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xf8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0xfb, 0xff, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0xff, 0xff, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0x0f, 0xf3, 0x01, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0x0f, 0xe0, 0x01, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xe8, 0xe1, 0x0f, 0xe0, 0x87, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8e, 0xf7, 0x07, 0xe0, 0xef, 0x7f, 0x18, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x78, 0x0f, 0xff, 0x01, 0xe0, 0xff, 0xe7, 0x1e, 0x01, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xed, 0x07, 0xfe, 0x01, 0x80, 0xff, 0xc1, 0xbf, 0x05, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc7, 0x03, 0x7f, 0x00, 0x00, 0xfe, 0x80, 0x67, 0x0e, 0x00, 0x00, 0x00, 0xe0, 0x06, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xf7, 0x81, 0xdf, 0x01, 0x80, 0x7f, 0xe0, 0xf3, 0x0d, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7c, 0xe7, 0xff, 0x07, 0xc0, 0x7f, 0xf0, 0x3e, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfe, 0xf7, 0x07, 0xe0, 0xef, 0x70, 0x18, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0xe1, 0x07, 0xf0, 0x87, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0x07, 0xf0, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0xcf, 0xf0, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0xff, 0xff, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0xff, 0xdf, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xef, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xdc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xff, 0x01, 0xf8, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x73, 0x00, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x7f, 0x00, 0x78, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x0f, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xde, 0x00, 0xdc, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x0f, 0x30, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x30, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0e, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1e, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1e, 0x98, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x1f, 0xd8, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1c, 0x18, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x41, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x10, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1c, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xc1, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x19, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xc1, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3d, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x33, 0x00, 0x00, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x77, 0x00, 0xf6, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x3d, 0x00, 0xbc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1e, 0x00, 0xde, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x37, 0x00, 0xf7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xb4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xc1, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xc1, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xc1, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/cross_weave0100664000076400007640000000045007120677563020747 0ustar constconst#define cross_weave_width 16 #define cross_weave_height 16 static char cross_weave_bits[] = { 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22}; vnc_unixsrc/Xvnc/include/bitmaps/dropbar70100664000076400007640000000016507120677563020152 0ustar constconst#define bar7_width 7 #define bar7_height 7 static char bar7_bits[] = { 0x00, 0x3f, 0x61, 0x61, 0x7f, 0x7e, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/mailfullmsk0100664000076400007640000000354707120677563020761 0ustar constconst#define mailfullmsk_width 48 #define mailfullmsk_height 48 static char mailfullmsk_bits[] = { 0x00, 0xe0, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/stipple0100664000076400007640000000020507120677563020105 0ustar constconst#define stipple_width 16 #define stipple_height 4 static char stipple_bits[] = { 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb}; vnc_unixsrc/Xvnc/include/bitmaps/dropbar80100664000076400007640000000020707120677563020150 0ustar constconst#define dropbar8_width 8 #define dropbar8_height 8 static char dropbar8_bits[] = { 0x00, 0x7f, 0xc1, 0xc1, 0xc1, 0xff, 0xfe, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xfd_icon0100664000076400007640000000353607120677563020230 0ustar constconst#define xfd_icon_width 48 #define xfd_icon_height 48 static char xfd_icon_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x81, 0x40, 0x20, 0x10, 0x08, 0x11, 0x9d, 0x5c, 0xa7, 0xd7, 0x0b, 0x29, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x7d, 0x9d, 0x42, 0xa9, 0xd7, 0x09, 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x45, 0x9d, 0x5c, 0xa7, 0x57, 0x08, 0x01, 0x81, 0x40, 0x20, 0x10, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/xlogo320100664000076400007640000000156407120677563017733 0ustar constconst#define xlogo32_width 32 #define xlogo32_height 32 static char xlogo32_bits[] = { 0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x00, 0xc0, 0xfc, 0x03, 0x00, 0x60, 0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18, 0xf0, 0x0f, 0x00, 0x0c, 0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x03, 0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00, 0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0xf8, 0x1b, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0x00, 0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x03, 0xfc, 0x03, 0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07, 0xc0, 0x00, 0xf0, 0x0f, 0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f, 0x18, 0x00, 0xc0, 0x3f, 0x0c, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff}; vnc_unixsrc/Xvnc/include/bitmaps/flagdown0100664000076400007640000000353607120677563020240 0ustar constconst#define flagdown_width 48 #define flagdown_height 48 static char flagdown_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x03, 0x00, 0x06, 0x06, 0x00, 0x80, 0x01, 0x00, 0x06, 0x07, 0x00, 0xc0, 0x1f, 0x00, 0x87, 0x07, 0x00, 0xe0, 0x7f, 0x80, 0xc7, 0x07, 0x00, 0x70, 0xe0, 0xc0, 0xe5, 0x07, 0x00, 0x38, 0x80, 0xe1, 0x74, 0x07, 0x00, 0x18, 0x80, 0x71, 0x3c, 0x07, 0x00, 0x0c, 0x00, 0x3b, 0x1e, 0x03, 0x00, 0x0c, 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x86, 0x1f, 0x8e, 0x07, 0x00, 0x00, 0x06, 0x06, 0xc6, 0x05, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x05, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x7f, 0x06, 0x00, 0x06, 0xe4, 0xff, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x06, 0x00, 0x00, 0x06, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, 0x00, 0x06, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x2f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x27, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0xf7, 0xbf, 0x8e, 0xfc, 0xdf, 0xf8, 0x9d, 0xeb, 0x9b, 0x76, 0xd2, 0x7a, 0x46, 0x30, 0xe2, 0x0f, 0xe1, 0x47, 0x55, 0x84, 0x48, 0x11, 0x84, 0x19}; vnc_unixsrc/Xvnc/include/bitmaps/mailempty0100664000076400007640000000355207120677563020436 0ustar constconst#define mailempty_width 48 #define mailempty_height 48 static unsigned char mailempty_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc0, 0xaf, 0xaa, 0xaa, 0xaa, 0x7a, 0xe0, 0x57, 0x55, 0x55, 0x55, 0x7d, 0xf0, 0xaf, 0xaa, 0xaa, 0xaa, 0x7e, 0xf8, 0x57, 0x55, 0x55, 0x55, 0x7f, 0xfc, 0xaf, 0xaa, 0xaa, 0xaa, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x06, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x86, 0xaf, 0xaa, 0xaa, 0xea, 0x7a, 0xc6, 0x57, 0x55, 0x55, 0x75, 0x7d, 0xe6, 0xaf, 0xaa, 0xaa, 0xea, 0x7e, 0xf6, 0x57, 0x55, 0x55, 0x75, 0x7f, 0xfe, 0xaf, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/flipped_gray0100664000076400007640000000015707120677563021100 0ustar constconst#define flipped_gray_width 4 #define flipped_gray_height 2 static char flipped_gray_bits[] = { 0x07, 0x0d}; vnc_unixsrc/Xvnc/include/bitmaps/menu100100664000076400007640000000031607120677563017535 0ustar constconst#define menu10_width 10 #define menu10_height 10 static char menu10_bits[] = { 0xfe, 0x01, 0x02, 0x01, 0x02, 0x03, 0x32, 0x03, 0x02, 0x03, 0x32, 0x03, 0x02, 0x03, 0x02, 0x03, 0xfe, 0x03, 0xf8, 0x03}; vnc_unixsrc/Xvnc/include/bitmaps/grid20100664000076400007640000000013207120677563017433 0ustar constconst#define grid2_width 2 #define grid2_height 2 static char grid2_bits[] = { 0x01, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/menu120100664000076400007640000000035707120677563017544 0ustar constconst#define menu12_width 12 #define menu12_height 12 static unsigned char menu12_bits[] = { 0xfe, 0x03, 0x02, 0x02, 0x02, 0x06, 0x72, 0x06, 0x02, 0x06, 0x72, 0x06, 0x02, 0x06, 0x72, 0x06, 0x02, 0x06, 0x02, 0x06, 0xfe, 0x07, 0xf8, 0x07}; vnc_unixsrc/Xvnc/include/bitmaps/opendot0100664000076400007640000000051407120677563020100 0ustar constconst#define opendot_width 16 #define opendot_height 16 #define opendot_x_hot 7 #define opendot_y_hot 7 static char opendot_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x60, 0x03, 0x20, 0x02, 0x60, 0x03, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/grid40100664000076400007640000000014607120677563017442 0ustar constconst#define grid4_width 4 #define grid4_height 4 static char grid4_bits[] = { 0x05, 0x00, 0x01, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/root_weave0100664000076400007640000000016507120677563020604 0ustar constconst#define root_weave_width 4 #define root_weave_height 4 static char root_weave_bits[] = { 0x07, 0x0d, 0x0b, 0x0e}; vnc_unixsrc/Xvnc/include/bitmaps/scales0100664000076400007640000000043107120677563017700 0ustar constconst#define scales_width 16 #define scales_height 16 static char scales_bits[] = { 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7, 0x01, 0x01, 0x01, 0x01, 0x82, 0x82, 0x7c, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7, 0x01, 0x01, 0x01, 0x01, 0x82, 0x82, 0x7c, 0x7c}; vnc_unixsrc/Xvnc/include/bitmaps/2x20100664000076400007640000000042007120677563017037 0ustar constconst#define 2x2_width 16 #define 2x2_height 16 static char 2x2_bits[] = { 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33}; vnc_unixsrc/Xvnc/include/bitmaps/menu160100664000076400007640000000043107120677563017541 0ustar constconst#define menu16_width 16 #define menu16_height 16 static char menu16_bits[] = { 0xfc, 0x1f, 0x04, 0x10, 0x04, 0x30, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, 0x04, 0x30, 0x04, 0x30, 0xfc, 0x3f, 0xf0, 0x3f}; vnc_unixsrc/Xvnc/include/bitmaps/terminal0100664000076400007640000000732607120677563020253 0ustar constconst/*****************************************************************************/ /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ /** Salt Lake City, Utah **/ /** **/ /** All Rights Reserved **/ /** **/ /** Permission to use, copy, modify, and distribute this software and **/ /** its documentation for any purpose and without fee is hereby **/ /** granted, provided that the above copyright notice appear in all **/ /** copies and that both that copyright notice and this permis- **/ /** sion notice appear in supporting documentation, and that the **/ /** name of Evans & Sutherland not be used in advertising or publi- **/ /** city pertaining to distribution of the software without specif- **/ /** ic, written prior permission. **/ /** **/ /** EVANS & SUTHERLAND DISCLAIMS ALL WARRANTIES WITH REGARD TO **/ /** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI- **/ /** TY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND BE LIABLE **/ /** FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAM- **/ /** AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, **/ /** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS **/ /** ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER- **/ /** FORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ #define xterm_width 48 #define xterm_height 48 static char xterm_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x05, 0x20, 0x01, 0x00, 0x00, 0x20, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, 0xa0, 0xfc, 0xff, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0xfc, 0x01, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0xfc, 0xff, 0x3f, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0xfc, 0x03, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0xfc, 0xff, 0x01, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0xfc, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x05, 0x20, 0x01, 0x00, 0x00, 0x20, 0x05, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0xa0, 0xaa, 0xaa, 0xaa, 0x2a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x80, 0x02, 0x50, 0x55, 0x55, 0x55, 0x95, 0x02, 0x08, 0x00, 0x00, 0x00, 0x40, 0x02, 0xa8, 0xaa, 0xaa, 0xaa, 0x4a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x20, 0x01, 0xb4, 0xff, 0xff, 0xff, 0xad, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/grid80100664000076400007640000000017607120677563017451 0ustar constconst#define grid8_width 8 #define grid8_height 8 static char grid8_bits[] = { 0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/boxes0100664000076400007640000000042607120677563017552 0ustar constconst#define boxes_width 16 #define boxes_height 16 static char boxes_bits[] = { 0x0f, 0x0f, 0x09, 0x09, 0x09, 0x09, 0x0f, 0x0f, 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x90, 0xf0, 0xf0, 0x0f, 0x0f, 0x09, 0x09, 0x09, 0x09, 0x0f, 0x0f, 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x90, 0xf0, 0xf0}; vnc_unixsrc/Xvnc/include/bitmaps/plaid0100664000076400007640000000103107120677563017514 0ustar constconst#define plaid_width 22 #define plaid_height 22 #define plaid_x_hot -1 #define plaid_y_hot -1 static char plaid_bits[] = { 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0xff, 0xff, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b}; vnc_unixsrc/Xvnc/include/bitmaps/opendotMask0100664000076400007640000000054007120677563020713 0ustar constconst#define opendotMask_width 16 #define opendotMask_height 16 #define opendotMask_x_hot 7 #define opendotMask_y_hot 7 static char opendotMask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/left_ptrmsk0100664000076400007640000000045007120677563020761 0ustar constconst#define left_ptrmsk_width 16 #define left_ptrmsk_height 16 static char left_ptrmsk_bits[] = { 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01, 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03, 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03}; vnc_unixsrc/Xvnc/include/bitmaps/menu60100664000076400007640000000017007120677563017460 0ustar constconst#define menu6_width 6 #define menu6_height 7 static char menu6_bits[] = { 0x1f, 0x31, 0x35, 0x35, 0x31, 0x3f, 0x1e}; vnc_unixsrc/Xvnc/include/bitmaps/dimple10100664000076400007640000000043407120677563017764 0ustar constconst#define dimple1_width 16 #define dimple1_height 16 static char dimple1_bits[] = { 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/menu80100664000076400007640000000017607120677563017470 0ustar constconst#define menu8_width 8 #define menu8_height 8 static char menu8_bits[] = { 0x7f, 0x41, 0xdd, 0xc1, 0xdd, 0xc1, 0xff, 0xfc}; vnc_unixsrc/Xvnc/include/bitmaps/grid160100664000076400007640000000043107120677563017522 0ustar constconst#define grid16_width 16 #define grid16_height 16 static char grid16_bits[] = { 0x55, 0x55, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/dimple30100664000076400007640000000043407120677563017766 0ustar constconst#define dimple3_width 16 #define dimple3_height 16 static char dimple3_bits[] = { 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/mensetmanus0100664000076400007640000004427707120677563021005 0ustar constconst#define mensetmanus_width 161 #define mensetmanus_height 145 static char mensetmanus_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x61, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x65, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x07, 0x80, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x6d, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xc7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x89, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0x5b, 0xdb, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x80, 0x83, 0x5b, 0xdb, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x5b, 0x1b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5b, 0x1b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x80, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x5b, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x6d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0x0b, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x83, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4b, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x79, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6b, 0xbf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x6d, 0xb7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xf7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xd7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0, 0xfe, 0xd7, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0xe0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd6, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xbf, 0x73, 0x80, 0x3b, 0x7c, 0x00, 0x00, 0x00, 0xf8, 0xe7, 0xd6, 0xef, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xb9, 0x73, 0xc0, 0x3b, 0xf0, 0x01, 0x00, 0x00, 0xff, 0xc3, 0xbf, 0xe7, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xb8, 0x7f, 0xe0, 0x3b, 0xc0, 0x03, 0x00, 0xc0, 0xbf, 0xc7, 0xbf, 0xe7, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xb8, 0xff, 0xf8, 0x3b, 0x80, 0x07, 0x00, 0xe0, 0x61, 0x87, 0xfd, 0xe7, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0xb8, 0xf3, 0xff, 0x3b, 0x00, 0x0f, 0x00, 0x78, 0x60, 0x8e, 0xf1, 0x67, 0xc7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xb8, 0xc3, 0x8f, 0x7b, 0x00, 0x0e, 0x00, 0x38, 0xe0, 0x8c, 0x03, 0x66, 0x87, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xb8, 0x03, 0x83, 0x7b, 0x00, 0x1e, 0x00, 0x1c, 0xe0, 0x1d, 0x03, 0x76, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xb8, 0xe3, 0x8f, 0xbb, 0x01, 0x39, 0x00, 0x1e, 0xe0, 0x3b, 0x03, 0xf6, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xb8, 0xe3, 0x8f, 0x3b, 0xc6, 0x38, 0x00, 0x17, 0xe0, 0x73, 0x07, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0b, 0xb8, 0xe7, 0x8e, 0x3b, 0x38, 0x78, 0x00, 0x13, 0xe0, 0x77, 0x06, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x12, 0x3c, 0xff, 0xce, 0x3b, 0x00, 0x78, 0x80, 0x13, 0x60, 0xef, 0x0e, 0xfe, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, 0x00, 0x70, 0x22, 0x3e, 0xfc, 0xfe, 0x39, 0x00, 0xe8, 0x80, 0x61, 0x60, 0xce, 0x0f, 0xfe, 0x00, 0x00, 0x60, 0xf8, 0x00, 0x00, 0x00, 0x70, 0xc2, 0x39, 0xf8, 0x7e, 0x38, 0x00, 0xc8, 0xc0, 0x81, 0x71, 0xde, 0x0f, 0xfe, 0x00, 0x00, 0x60, 0x88, 0x00, 0x00, 0x00, 0x70, 0x04, 0x38, 0xe0, 0x0e, 0x38, 0x00, 0xc4, 0xc0, 0x01, 0x7e, 0xbc, 0x1f, 0xfe, 0x00, 0x00, 0x60, 0x88, 0x00, 0x00, 0x00, 0x78, 0x04, 0x38, 0xe0, 0x0e, 0x38, 0x00, 0xc4, 0xc1, 0x01, 0x60, 0x3c, 0x1f, 0xfe, 0x00, 0x00, 0x60, 0x84, 0x0f, 0x00, 0x00, 0x78, 0x08, 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x82, 0xe1, 0x01, 0x60, 0x74, 0x3e, 0xfe, 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0xb8, 0x10, 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x81, 0xe1, 0x00, 0x60, 0xe4, 0x3e, 0xfe, 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0x98, 0x20, 0x38, 0xf8, 0x3f, 0x38, 0x80, 0x80, 0xe1, 0x01, 0x60, 0xc4, 0x3c, 0xfe, 0x00, 0x00, 0x60, 0x24, 0x0c, 0x00, 0x00, 0x1c, 0xc1, 0x39, 0x3c, 0x78, 0x38, 0x40, 0x80, 0x61, 0x01, 0x60, 0xc4, 0x79, 0xfe, 0x00, 0x00, 0x60, 0x22, 0x32, 0x00, 0x00, 0x1c, 0x01, 0x3e, 0x1c, 0xf0, 0x38, 0xf0, 0x9f, 0x61, 0x01, 0x60, 0x84, 0x7b, 0xee, 0x00, 0x00, 0x60, 0x12, 0x21, 0x00, 0x00, 0x1c, 0x02, 0x38, 0x0e, 0xe7, 0xf8, 0x3f, 0xe0, 0x61, 0x00, 0x60, 0x04, 0xf7, 0xce, 0x00, 0x00, 0x60, 0x92, 0x10, 0x00, 0x00, 0x1c, 0x04, 0x38, 0x06, 0xff, 0x38, 0x40, 0x80, 0x61, 0x02, 0x60, 0x04, 0xe7, 0xcf, 0x00, 0x00, 0x60, 0x8a, 0x18, 0x00, 0x00, 0x1c, 0x18, 0x38, 0x07, 0xf0, 0x38, 0x00, 0x81, 0x61, 0x02, 0x60, 0x04, 0xee, 0xcf, 0xff, 0x03, 0x60, 0x49, 0xe4, 0x00, 0x00, 0x1c, 0x70, 0x38, 0x07, 0xe7, 0x38, 0x00, 0x82, 0x61, 0x04, 0x60, 0x04, 0xdc, 0xcf, 0x01, 0x04, 0x60, 0x25, 0x42, 0x00, 0x00, 0x1c, 0xfe, 0x3f, 0x03, 0xff, 0x38, 0x00, 0x84, 0x61, 0x08, 0x60, 0x04, 0xfc, 0xcf, 0xf8, 0xff, 0x60, 0x95, 0x31, 0x00, 0x00, 0xfc, 0x01, 0xff, 0x03, 0xf0, 0xf8, 0x1f, 0x88, 0x61, 0x10, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe1, 0x53, 0x0c, 0x00, 0x00, 0x38, 0xf0, 0xff, 0x03, 0xef, 0xf8, 0x7f, 0x90, 0x61, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xe3, 0x2b, 0xfe, 0x00, 0x00, 0x18, 0xf8, 0xff, 0x03, 0xff, 0x7c, 0xf0, 0x90, 0x61, 0x00, 0x3e, 0x36, 0xe3, 0xe1, 0x00, 0x00, 0xe3, 0x9f, 0x60, 0x00, 0x00, 0x38, 0x3c, 0x00, 0x03, 0xf0, 0x1f, 0xe0, 0xa0, 0xe1, 0x00, 0x30, 0x22, 0xe2, 0xc0, 0x00, 0xff, 0xe3, 0x7f, 0x18, 0x00, 0x00, 0x38, 0x0e, 0x00, 0x07, 0xe7, 0x07, 0xc0, 0xe1, 0xc1, 0x00, 0x18, 0x22, 0xe2, 0xc0, 0x00, 0x00, 0xe1, 0x1f, 0x07, 0x00, 0x00, 0x38, 0x06, 0x00, 0x07, 0xef, 0x01, 0xc0, 0xc1, 0xc1, 0x01, 0x16, 0x24, 0xe2, 0xc0, 0x01, 0xff, 0xe1, 0xff, 0x00, 0x00, 0x00, 0x70, 0x07, 0x00, 0x0e, 0xf8, 0x00, 0x80, 0xc3, 0xc0, 0xf1, 0x11, 0x24, 0xe4, 0xc0, 0x03, 0xe0, 0xe1, 0x7f, 0x00, 0x00, 0x00, 0x70, 0x07, 0x00, 0x1e, 0x3c, 0x00, 0x80, 0xe3, 0x80, 0x0f, 0x10, 0x24, 0xe4, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x63, 0x80, 0x01, 0x08, 0x44, 0xe4, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x73, 0x80, 0x03, 0x08, 0x44, 0xe4, 0xc0, 0xfc, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x33, 0x00, 0x03, 0x08, 0x44, 0xe4, 0xe0, 0xcc, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x78, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x07, 0x04, 0x44, 0xe8, 0x70, 0xcc, 0x01, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x3e, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x0e, 0x04, 0x44, 0xe8, 0x38, 0xcc, 0x81, 0xe7, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x1c, 0x02, 0x44, 0xf8, 0x1e, 0xcc, 0xe1, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x23, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x38, 0x01, 0x42, 0xfc, 0x0f, 0xcc, 0xf1, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0xf0, 0x39, 0x00, 0x00, 0xe0, 0x03, 0x00, 0xf0, 0x00, 0xc2, 0xff, 0x07, 0xcc, 0x7f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7c, 0x0e, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xe0, 0x03, 0xe2, 0xe7, 0x07, 0xcc, 0x1f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xbf, 0x23, 0xe0, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x1f, 0xff, 0x64, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3c, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x64, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0x1f, 0x78, 0x7c, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x20, 0x64, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0x33, 0x1c, 0x38, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x6c, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x3e, 0x0e, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x68, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xf8, 0x87, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x78, 0xf8, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf8, 0xff, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xf8, 0xff, 0x0e, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xf8, 0xe1, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x68, 0x06, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x68, 0x06, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x68, 0x06, 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x68, 0x06, 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x68, 0x06, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x1e, 0x00, 0x00, 0x00, 0x58, 0x00, 0x6c, 0x0e, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x30, 0xe0, 0x0e, 0x38, 0x1e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x64, 0x0e, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x70, 0xe0, 0x0e, 0x1c, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x1e, 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xe0, 0xe1, 0x0e, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0xef, 0xce, 0x07, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xff, 0xfe, 0x03, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x7e, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xfc, 0xfe, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x66, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xe0, 0x1e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x66, 0xe6, 0xcc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x62, 0x86, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x86, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xfc, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x8e, 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x78, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0xfe, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f, 0xff, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xe0, 0x01, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x8f, 0x07, 0x9e, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xe0, 0x07, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x30, 0x00, 0xc0, 0xff, 0x3f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x38, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x9c, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, 0x30, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x30, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x3c, 0x00, 0x30, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x7e, 0x00, 0x70, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0f, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xe7, 0x00, 0x70, 0xbc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xe3, 0x00, 0x60, 0x1e, 0x07, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc1, 0x01, 0xe0, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x80, 0x03, 0xe0, 0x03, 0x1e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xe0, 0x1b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0x07, 0xe0, 0x01, 0x1c, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xc0, 0x1b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0f, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0e, 0x1e, 0xc0, 0x71, 0xf8, 0x00, 0x00, 0x00, 0x78, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1f, 0x1e, 0xc0, 0xf9, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; vnc_unixsrc/Xvnc/include/bitmaps/gray0100664000076400007640000000012707120677563017372 0ustar constconst#define gray_width 2 #define gray_height 2 static char gray_bits[] = { 0x01, 0x02}; vnc_unixsrc/Xvnc/include/bitmaps/star0100664000076400007640000000047507120677563017407 0ustar constconst#define star_width 16 #define star_height 16 #define star_x_hot 7 #define star_y_hot 7 static char star_bits[] = { 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x88, 0x08, 0x90, 0x04, 0xa0, 0x02, 0x40, 0x01, 0x3e, 0x3e, 0x40, 0x01, 0xa0, 0x02, 0x90, 0x04, 0x88, 0x08, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/mailemptymsk0100664000076400007640000000354107120677563021147 0ustar constconst#define mailemask_width 48 #define mailemask_height 48 static char mailemask_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00}; vnc_unixsrc/Xvnc/include/bitmaps/flagup0100664000076400007640000000353007120677563017707 0ustar constconst#define flagup_width 48 #define flagup_height 48 static char flagup_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00, 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00, 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00, 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00, 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00, 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00, 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00, 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00, 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00, 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00, 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a, 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a, 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a, 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a, 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a, 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; vnc_unixsrc/Xvnc/include/HPkeysym.h0100664000076400007640000001401007120677563016764 0ustar constconst/* $XConsortium: HPkeysym.h,v 1.14 94/04/17 20:30:20 rws Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Hewlett Packard or Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. */ #define hpXK_ClearLine 0x1000FF6F #define hpXK_InsertLine 0x1000FF70 #define hpXK_DeleteLine 0x1000FF71 #define hpXK_InsertChar 0x1000FF72 #define hpXK_DeleteChar 0x1000FF73 #define hpXK_BackTab 0x1000FF74 #define hpXK_KP_BackTab 0x1000FF75 #define hpXK_Modelock1 0x1000FF48 #define hpXK_Modelock2 0x1000FF49 #define hpXK_Reset 0x1000FF6C #define hpXK_System 0x1000FF6D #define hpXK_User 0x1000FF6E #define hpXK_mute_acute 0x100000A8 #define hpXK_mute_grave 0x100000A9 #define hpXK_mute_asciicircum 0x100000AA #define hpXK_mute_diaeresis 0x100000AB #define hpXK_mute_asciitilde 0x100000AC #define hpXK_lira 0x100000AF #define hpXK_guilder 0x100000BE #define hpXK_Ydiaeresis 0x100000EE #define hpXK_IO 0x100000EE #define hpXK_longminus 0x100000F6 #define hpXK_block 0x100000FC #ifndef _OSF_Keysyms #define _OSF_Keysyms #define osfXK_Copy 0x1004FF02 #define osfXK_Cut 0x1004FF03 #define osfXK_Paste 0x1004FF04 #define osfXK_BackTab 0x1004FF07 #define osfXK_BackSpace 0x1004FF08 #define osfXK_Clear 0x1004FF0B #define osfXK_Escape 0x1004FF1B #define osfXK_AddMode 0x1004FF31 #define osfXK_PrimaryPaste 0x1004FF32 #define osfXK_QuickPaste 0x1004FF33 #define osfXK_PageLeft 0x1004FF40 #define osfXK_PageUp 0x1004FF41 #define osfXK_PageDown 0x1004FF42 #define osfXK_PageRight 0x1004FF43 #define osfXK_Activate 0x1004FF44 #define osfXK_MenuBar 0x1004FF45 #define osfXK_Left 0x1004FF51 #define osfXK_Up 0x1004FF52 #define osfXK_Right 0x1004FF53 #define osfXK_Down 0x1004FF54 #define osfXK_EndLine 0x1004FF57 #define osfXK_BeginLine 0x1004FF58 #define osfXK_EndData 0x1004FF59 #define osfXK_BeginData 0x1004FF5A #define osfXK_PrevMenu 0x1004FF5B #define osfXK_NextMenu 0x1004FF5C #define osfXK_PrevField 0x1004FF5D #define osfXK_NextField 0x1004FF5E #define osfXK_Select 0x1004FF60 #define osfXK_Insert 0x1004FF63 #define osfXK_Undo 0x1004FF65 #define osfXK_Menu 0x1004FF67 #define osfXK_Cancel 0x1004FF69 #define osfXK_Help 0x1004FF6A #define osfXK_SelectAll 0x1004FF71 #define osfXK_DeselectAll 0x1004FF72 #define osfXK_Reselect 0x1004FF73 #define osfXK_Extend 0x1004FF74 #define osfXK_Restore 0x1004FF78 #define osfXK_Delete 0x1004FFFF #endif /* _OSF_Keysyms */ /************************************************************** * The use of the following macros is deprecated. * They are listed below only for backwards compatibility. */ #define XK_Reset 0x1000FF6C #define XK_System 0x1000FF6D #define XK_User 0x1000FF6E #define XK_ClearLine 0x1000FF6F #define XK_InsertLine 0x1000FF70 #define XK_DeleteLine 0x1000FF71 #define XK_InsertChar 0x1000FF72 #define XK_DeleteChar 0x1000FF73 #define XK_BackTab 0x1000FF74 #define XK_KP_BackTab 0x1000FF75 #define XK_Ext16bit_L 0x1000FF76 #define XK_Ext16bit_R 0x1000FF77 #define XK_mute_acute 0x100000a8 #define XK_mute_grave 0x100000a9 #define XK_mute_asciicircum 0x100000aa #define XK_mute_diaeresis 0x100000ab #define XK_mute_asciitilde 0x100000ac #define XK_lira 0x100000af #define XK_guilder 0x100000be #define XK_Ydiaeresis 0x100000ee #define XK_IO 0x100000ee #define XK_longminus 0x100000f6 #define XK_block 0x100000fc vnc_unixsrc/Xvnc/include/Xos.h0100664000076400007640000001615307120677563015776 0ustar constconst/* * $XConsortium: Xos.h /main/70 1996/11/15 16:00:41 kaleb $ * $XFree86: xc/include/Xos.h,v 3.21.2.1 1998/01/23 12:35:11 dawes Exp $ * * Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * The X Window System is a Trademark of X Consortium. * */ /* This is a collection of things to try and minimize system dependencies * in a "signficant" number of source files. */ #ifndef _XOS_H_ #define _XOS_H_ #include /* * Get major data types (esp. caddr_t) */ #ifdef USG #ifndef __TYPES__ #ifdef CRAY #define word word_t #endif /* CRAY */ #include /* forgot to protect it... */ #define __TYPES__ #endif /* __TYPES__ */ #else /* USG */ #if defined(_POSIX_SOURCE) && (defined(MOTOROLA) || defined(AMOEBA)) #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #else #include #endif #endif /* USG */ /* * Just about everyone needs the strings routines. We provide both forms here, * index/rindex and strchr/strrchr, so any systems that don't provide them all * need to have #defines here. * * NOTE: The following ISN'T true for this XFree86 version of this file. * * These macros are defined this way, rather than, e.g.: * #defined index(s,c) strchr(s,c) * because someone might be using them as function pointers, and such * a change would break compatibility for anyone who's relying on them * being the way they currently are. So we're stuck with them this way, * which can be really inconvenient. :-( */ #ifndef X_NOT_STDC_ENV #include #ifdef __STDC__ #ifndef index #define index(s,c) (strchr((s),(c))) #endif #ifndef rindex #define rindex(s,c) (strrchr((s),(c))) #endif #else #ifndef index #define index strchr #endif #ifndef rindex #define rindex strrchr #endif #endif #else #ifdef SYSV #if defined(clipper) || defined(__clipper__) #include #endif #include #define index strchr #define rindex strrchr #else #include #define strchr index #define strrchr rindex #endif #endif /* X_NOT_STDC_ENV */ /* * strerror() */ #if (defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) #ifndef strerror extern char *sys_errlist[]; extern int sys_nerr; #define strerror(n) \ (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") #endif #endif /* * Get open(2) constants */ #ifdef X_NOT_POSIX #include #if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(i386) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__) #include #endif #ifdef WIN32 #include #else #include #endif #else /* X_NOT_POSIX */ #if !defined(_POSIX_SOURCE) && defined(macII) #define _POSIX_SOURCE #include #include #undef _POSIX_SOURCE #else #include #include #endif #endif /* X_NOT_POSIX else */ #ifdef CSRG_BASED #include #include #endif /* CSRG_BASED */ /* * Get struct timeval */ #ifdef SYSV #ifndef USL #include #endif #include #ifdef CRAY #undef word #endif /* CRAY */ #if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__) struct timeval { long tv_sec; long tv_usec; }; #ifndef USL_SHARELIB struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* USL_SHARELIB */ #endif /* USG */ #ifdef _SEQUENT_ struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif /* _SEQUENT_ */ #else /* not SYSV */ #if defined(_ANSI_SOURCE) && defined(__bsdi__) #undef _ANSI_SOURCE #include #define _ANSI_SOURCE #endif #if defined(_POSIX_SOURCE) && defined(SVR4) /* need to omit _POSIX_SOURCE in order to get what we want in SVR4 */ #undef _POSIX_SOURCE #include #define _POSIX_SOURCE #else /* defined(_POSIX_SOURCE) && defined(SVR4) */ #ifdef WIN32 #include #if !defined(_WINSOCKAPI_) && !defined(_WILLWINSOCK_) struct timeval { long tv_sec; /* seconds */ long tv_usec; /* and microseconds */ }; #endif #include #define gettimeofday(t) \ { \ struct _timeb _gtodtmp; \ _ftime (&_gtodtmp); \ (t)->tv_sec = _gtodtmp.time; \ (t)->tv_usec = _gtodtmp.millitm * 1000; \ } #else /* WIN32 */ #ifdef _SEQUENT_ #include #else /* _SEQUENT_ */ #ifdef AMOEBA #include #include #else /* AMOEBA */ #ifdef MINIX #include #else /* !MINIX */ #ifndef Lynx #include #else #include #endif /* Lynx */ #endif /* MINIX */ #endif /* AMOEBA */ #endif /* _SEQUENT_ */ #endif /* WIN32 else */ #endif /* defined(_POSIX_SOURCE) && defined(SVR4) */ #endif /* SYSV */ /* define X_GETTIMEOFDAY macro, a portable gettimeofday() */ #if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */ #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #else #if defined(SVR4) || defined(VMS) || defined(WIN32) #define X_GETTIMEOFDAY(t) gettimeofday(t) #else #define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0) #endif #endif /* XPG4 else */ #ifdef MINIX #include #include #include #include #include struct sockaddr { u16_t sa_family; char sa_data[14]; }; struct sockaddr_in { u16_t sin_family; u16_t sin_port; struct { ipaddr_t s_addr; } sin_addr; char sin_zero[8]; }; struct in_addr { ipaddr_t s_addr; }; typedef char *caddr_t; typedef unsigned char u_char; #endif /* MINIX */ #ifdef __EMX__ typedef unsigned long fd_mask; #endif /* use POSIX name for signal */ #if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC) #define SIGCHLD SIGCLD #endif #ifdef ISC #include #include #define NGROUPS 16 #endif #if defined(ISC) || defined(__EMX__) /* * Some OS's may not have this */ #define X_NO_SYS_UN 1 struct sockaddr_un { short sun_family; char sun_path[108]; }; #endif #endif /* _XOS_H_ */ vnc_unixsrc/Xvnc/include/Xosdefs.h0100664000076400007640000000625007120677563016635 0ustar constconst/* * O/S-dependent (mis)feature macro definitions * * $XConsortium: Xosdefs.h /main/16 1996/09/28 16:17:29 rws $ * $XFree86: xc/include/Xosdefs.h,v 3.11 1996/12/23 05:58:09 dawes Exp $ * Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef _XOSDEFS_H_ #define _XOSDEFS_H_ /* * X_NOT_STDC_ENV means does not have ANSI C header files. Lack of this * symbol does NOT mean that the system has stdarg.h. * * X_NOT_POSIX means does not have POSIX header files. Lack of this * symbol does NOT mean that the POSIX environment is the default. * You may still have to define _POSIX_SOURCE to get it. */ #ifdef NOSTDHDRS #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef sony #if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) #define X_NOT_POSIX #endif #endif #ifdef UTEK #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef vax #ifndef ultrix /* assume vanilla BSD */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef luna #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef Mips #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef USL #ifdef SYSV /* (release 3.2) */ #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #endif #ifdef i386 #ifdef SYSV #if !(defined(ISC) && defined(_POSIX_SOURCE)) #ifndef SCO #ifndef _SCO_DS /* SCO 5.0 has SVR4 header files */ #define X_NOT_POSIX #endif #define X_NOT_STDC_ENV #endif #endif /* !(defined(ISC) && defined(_POSIX_SOURCE)) */ #endif #endif #ifdef MOTOROLA #ifdef SYSV #define X_NOT_STDC_ENV #endif #endif #ifdef sun #ifdef SVR4 /* define this to whatever it needs to be */ #define X_POSIX_C_SOURCE 199300L #endif #endif #ifdef WIN32 #ifndef _POSIX_ #define X_NOT_POSIX #endif #endif #if defined(nec_ews_svr2) || defined(SX) || defined(PC_UX) #define X_NOT_POSIX #define X_NOT_STDC_ENV #endif #ifdef __EMX__ #define USGISH /* EMX claims to be ANSI, so X_NOT_STDC_ENV does not hold */ /* could have been provided as std flags as well */ #define X_WCHAR #define X_LOCALE #endif #endif /* _XOSDEFS_H_ */ vnc_unixsrc/Xvnc/include/keysym.h0100664000076400007640000000515107120677563016542 0ustar constconst/* $XConsortium: keysym.h,v 1.15 94/04/17 20:10:55 rws Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* default keysyms */ #define XK_MISCELLANY #define XK_XKB_KEYS #define XK_LATIN1 #define XK_LATIN2 #define XK_LATIN3 #define XK_LATIN4 #define XK_GREEK #include vnc_unixsrc/Xvnc/include/Xthreads.h0100664000076400007640000002451707120677563017012 0ustar constconst/* * $XConsortium: Xthreads.h /main/35 1996/12/04 10:23:02 lehors $ * $XFree86: xc/include/Xthreads.h,v 3.3 1996/12/23 05:58:11 dawes Exp $ * * Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * */ #ifndef _XTHREADS_H_ #define _XTHREADS_H_ /* Redefine these to XtMalloc/XtFree or whatever you want before including * this header file. */ #ifndef xmalloc #define xmalloc malloc #endif #ifndef xfree #define xfree free #endif #ifdef CTHREADS #include typedef cthread_t xthread_t; typedef struct condition xcondition_rec; typedef struct mutex xmutex_rec; #define xthread_init() cthread_init() #define xthread_self cthread_self #define xthread_fork(func,closure) cthread_fork(func,closure) #define xthread_yield() cthread_yield() #define xthread_exit(v) cthread_exit(v) #define xthread_set_name(t,str) cthread_set_name(t,str) #define xmutex_init(m) mutex_init(m) #define xmutex_clear(m) mutex_clear(m) #define xmutex_lock(m) mutex_lock(m) #define xmutex_unlock(m) mutex_unlock(m) #define xmutex_set_name(m,str) mutex_set_name(m,str) #define xcondition_init(cv) condition_init(cv) #define xcondition_clear(cv) condition_clear(cv) #define xcondition_wait(cv,m) condition_wait(cv,m) #define xcondition_signal(cv) condition_signal(cv) #define xcondition_broadcast(cv) condition_broadcast(cv) #define xcondition_set_name(cv,str) condition_set_name(cv,str) #else /* !CTHREADS */ #if defined(SVR4) && !defined(__sgi) #include #include #ifndef LINE_MAX #define LINE_MAX 2048 #endif typedef thread_t xthread_t; typedef thread_key_t xthread_key_t; typedef cond_t xcondition_rec; typedef mutex_t xmutex_rec; #define xthread_self thr_self #define xthread_fork(func,closure) thr_create(NULL,0,func,closure,THR_NEW_LWP|THR_DETACHED,NULL) #define xthread_yield() thr_yield() #define xthread_exit(v) thr_exit(v) #define xthread_key_create(kp,d) thr_keycreate(kp,d) #ifdef sun #define xthread_key_delete(k) 0 #else #define xthread_key_delete(k) thr_keydelete(k) #endif #define xthread_set_specific(k,v) thr_setspecific(k,v) #define xthread_get_specific(k,vp) thr_getspecific(k,vp) #define XMUTEX_INITIALIZER {0} #define xmutex_init(m) mutex_init(m,USYNC_THREAD,0) #define xmutex_clear(m) mutex_destroy(m) #define xmutex_lock(m) mutex_lock(m) #define xmutex_unlock(m) mutex_unlock(m) #define xcondition_init(cv) cond_init(cv,USYNC_THREAD,0) #define xcondition_clear(cv) cond_destroy(cv) #define xcondition_wait(cv,m) cond_wait(cv,m) #define xcondition_signal(cv) cond_signal(cv) #define xcondition_broadcast(cv) cond_broadcast(cv) #else /* !SVR4 */ #ifdef WIN32 #define BOOL wBOOL #ifdef Status #undef Status #define Status wStatus #endif #include #ifdef Status #undef Status #define Status int #endif #undef BOOL typedef DWORD xthread_t; typedef DWORD xthread_key_t; struct _xthread_waiter { HANDLE sem; struct _xthread_waiter *next; }; typedef struct { CRITICAL_SECTION cs; struct _xthread_waiter *waiters; } xcondition_rec; typedef CRITICAL_SECTION xmutex_rec; #define xthread_init() _Xthread_init() #define xthread_self GetCurrentThreadId #define xthread_fork(func,closure) { \ DWORD _tmptid; \ CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, (LPVOID)closure, 0, \ &_tmptid); \ } #define xthread_yield() Sleep(0) #define xthread_exit(v) ExitThread((DWORD)(v)) #define xthread_key_create(kp,d) *(kp) = TlsAlloc() #define xthread_key_delete(k) TlsFree(k) #define xthread_set_specific(k,v) TlsSetValue(k,v) #define xthread_get_specific(k,vp) TlsGetValue(k) #define xmutex_init(m) InitializeCriticalSection(m) #define xmutex_clear(m) DeleteCriticalSection(m) #define _XMUTEX_NESTS #define xmutex_lock(m) EnterCriticalSection(m) #define xmutex_unlock(m) LeaveCriticalSection(m) #define xcondition_init(cv) { \ InitializeCriticalSection(&(cv)->cs); \ (cv)->waiters = NULL; \ } #define xcondition_clear(cv) DeleteCriticalSection(&(cv)->cs) extern struct _xthread_waiter *_Xthread_waiter(); #define xcondition_wait(cv,m) { \ struct _xthread_waiter *_tmpthr = _Xthread_waiter(); \ EnterCriticalSection(&(cv)->cs); \ _tmpthr->next = (cv)->waiters; \ (cv)->waiters = _tmpthr; \ LeaveCriticalSection(&(cv)->cs); \ LeaveCriticalSection(m); \ WaitForSingleObject(_tmpthr->sem, INFINITE); \ EnterCriticalSection(m); \ } #define xcondition_signal(cv) { \ EnterCriticalSection(&(cv)->cs); \ if ((cv)->waiters) { \ ReleaseSemaphore((cv)->waiters->sem, 1, NULL); \ (cv)->waiters = (cv)->waiters->next; \ } \ LeaveCriticalSection(&(cv)->cs); \ } #define xcondition_broadcast(cv) { \ struct _xthread_waiter *_tmpthr; \ EnterCriticalSection(&(cv)->cs); \ for (_tmpthr = (cv)->waiters; _tmpthr; _tmpthr = _tmpthr->next) \ ReleaseSemaphore(_tmpthr->sem, 1, NULL); \ (cv)->waiters = NULL; \ LeaveCriticalSection(&(cv)->cs); \ } #else /* !WIN32 */ #ifdef USE_TIS_SUPPORT /* * TIS support is intended for thread safe libraries. * This should not be used for general client programming. */ #include typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; #define xthread_self tis_self #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } #define xthread_yield() pthread_yield_np() #define xthread_exit(v) pthread_exit(v) #define xthread_key_create(kp,d) tis_key_create(kp,d) #define xthread_key_delete(k) tis_key_delete(k) #define xthread_set_specific(k,v) tis_setspecific(k,v) #define xthread_get_specific(k,vp) *(vp) = tis_getspecific(k) #define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define xmutex_init(m) tis_mutex_init(m) #define xmutex_clear(m) tis_mutex_destroy(m) #define xmutex_lock(m) tis_mutex_lock(m) #define xmutex_unlock(m) tis_mutex_unlock(m) #define xcondition_init(c) tis_cond_init(c) #define xcondition_clear(c) tis_cond_destroy(c) #define xcondition_wait(c,m) tis_cond_wait(c,m) #define xcondition_signal(c) tis_cond_signal(c) #define xcondition_broadcast(c) tis_cond_broadcast(c) #else #include #ifndef LINE_MAX #define LINE_MAX 2048 #endif typedef pthread_t xthread_t; typedef pthread_key_t xthread_key_t; typedef pthread_cond_t xcondition_rec; typedef pthread_mutex_t xmutex_rec; #define xthread_self pthread_self #define xthread_yield() pthread_yield() #define xthread_exit(v) pthread_exit(v) #define xthread_set_specific(k,v) pthread_setspecific(k,v) #define xmutex_clear(m) pthread_mutex_destroy(m) #define xmutex_lock(m) pthread_mutex_lock(m) #define xmutex_unlock(m) pthread_mutex_unlock(m) #ifndef XPRE_STANDARD_API #define xthread_key_create(kp,d) pthread_key_create(kp,d) #define xthread_key_delete(k) pthread_key_delete(k) #define xthread_get_specific(k,vp) *(vp) = pthread_getspecific(k) #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,NULL,func,closure); } #define XMUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define xmutex_init(m) pthread_mutex_init(m, NULL) #define xcondition_init(c) pthread_cond_init(c, NULL) #else /* XPRE_STANDARD_API */ #define xthread_key_create(kp,d) pthread_keycreate(kp,d) #define xthread_key_delete(k) 0 #define xthread_get_specific(k,vp) pthread_getspecific(k,vp) #define xthread_fork(func,closure) { pthread_t _tmpxthr; \ pthread_create(&_tmpxthr,pthread_attr_default,func,closure); } #define xmutex_init(m) pthread_mutex_init(m, pthread_mutexattr_default) #define xcondition_init(c) pthread_cond_init(c, pthread_condattr_default) #endif /* XPRE_STANDARD_API */ #define xcondition_clear(c) pthread_cond_destroy(c) #define xcondition_wait(c,m) pthread_cond_wait(c,m) #define xcondition_signal(c) pthread_cond_signal(c) #define xcondition_broadcast(c) pthread_cond_broadcast(c) #if defined(_DECTHREADS_) || defined(linux) static xthread_t _X_no_thread_id; #define xthread_have_id(id) !pthread_equal(id, _X_no_thread_id) #define xthread_clear_id(id) id = _X_no_thread_id #define xthread_equal(id1,id2) pthread_equal(id1, id2) #endif /* _DECTHREADS_ || linux */ #if _CMA_VENDOR_ == _CMA__IBM #ifdef DEBUG /* too much of a hack to enable normally */ /* see also cma__obj_set_name() */ #define xmutex_set_name(m,str) ((char**)(m)->field1)[5] = (str) #define xcondition_set_name(cv,str) ((char**)(cv)->field1)[5] = (str) #endif /* DEBUG */ #endif /* _CMA_VENDOR_ == _CMA__IBM */ #endif /* USE_TIS_SUPPORT */ #endif /* WIN32 */ #endif /* SVR4 */ #endif /* CTHREADS */ typedef xcondition_rec *xcondition_t; typedef xmutex_rec *xmutex_t; #ifndef xcondition_malloc #define xcondition_malloc() (xcondition_t)xmalloc(sizeof(xcondition_rec)) #endif #ifndef xcondition_free #define xcondition_free(c) xfree((char *)c) #endif #ifndef xmutex_malloc #define xmutex_malloc() (xmutex_t)xmalloc(sizeof(xmutex_rec)) #endif #ifndef xmutex_free #define xmutex_free(m) xfree((char *)m) #endif #ifndef xthread_have_id #define xthread_have_id(id) id #endif #ifndef xthread_clear_id #define xthread_clear_id(id) id = 0 #endif #ifndef xthread_equal #define xthread_equal(id1,id2) ((id1) == (id2)) #endif /* aids understood by some debuggers */ #ifndef xthread_set_name #define xthread_set_name(t,str) #endif #ifndef xmutex_set_name #define xmutex_set_name(m,str) #endif #ifndef xcondition_set_name #define xcondition_set_name(cv,str) #endif #endif /* _XTHREADS_H_ */ vnc_unixsrc/Xvnc/include/Xalloca.h0100664000076400007640000001232207120677563016602 0ustar constconst/* $XConsortium: Xalloca.h /main/6 1996/09/28 16:17:22 rws $ */ /* Copyright (c) 1995 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * The purpose of this header is to define the macros ALLOCATE_LOCAL and * DEALLOCATE_LOCAL appropriately for the platform being compiled on. * These macros are used to make fast, function-local memory allocations. * Their characteristics are as follows: * * void *ALLOCATE_LOCAL(int size) * Returns a pointer to size bytes of memory, or NULL if the allocation * failed. The memory must be freed with DEALLOCATE_LOCAL before the * function that made the allocation returns. You should not ask for * large blocks of memory with this function, since on many platforms * the memory comes from the stack, which may have limited size. * * void DEALLOCATE_LOCAL(void *) * Frees the memory allocated by ALLOCATE_LOCAL. Omission of this * step may be harmless on some platforms, but will result in * memory leaks or worse on others. * * Before including this file, you should define two macros, * ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK, that have the * same characteristics as ALLOCATE_LOCAL and DEALLOCATE_LOCAL. The * header uses the fallbacks if it doesn't know a "better" way to define * ALLOCATE_LOCAL and DEALLOCATE_LOCAL. Typical usage would be: * * #define ALLOCATE_LOCAL_FALLBACK(_size) malloc(_size) * #define DEALLOCATE_LOCAL_FALLBACK(_ptr) free(_ptr) * #include "Xalloca.h" */ #ifndef XALLOCA_H #define XALLOCA_H 1 #ifdef INCLUDE_ALLOCA_H # include #endif #ifndef NO_ALLOCA /* * os-dependent definition of local allocation and deallocation * If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK * for ALLOCATE/DEALLOCATE_LOCAL then you add that in here. */ # if defined(__HIGHC__) # ifndef NCR extern char *alloca(); # if HCVERSION < 21003 # define ALLOCATE_LOCAL(size) alloca((int)(size)) pragma on(alloca); # else /* HCVERSION >= 21003 */ # define ALLOCATE_LOCAL(size) _Alloca((int)(size)) # endif /* HCVERSION < 21003 */ # else /* NCR */ # define ALLOCATE_LOCAL(size) alloca(size) # endif # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # endif /* defined(__HIGHC__) */ # ifdef __GNUC__ # ifndef alloca # define alloca __builtin_alloca # endif /* !alloca */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # else /* ! __GNUC__ */ /* * warning: old mips alloca (pre 2.10) is unusable, new one is built in * Test is easy, the new one is named __builtin_alloca and comes * from alloca.h which #defines alloca. */ # ifndef NCR # if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(USL) || defined(alloca) /* * Some System V boxes extract alloca.o from /lib/libPW.a; if you * decide that you don't want to use alloca, you might want to fix it here. */ /* alloca might be a macro taking one arg (hi, Sun!), so give it one. */ # ifndef __sgi /* IRIX 5/6 has definition */ # define __Xnullarg /* as nothing */ # ifndef X_NOT_STDC_ENV extern void *alloca(__Xnullarg); # else extern char *alloca(__Xnullarg); # endif # endif /* __sgi */ # define ALLOCATE_LOCAL(size) alloca((int)(size)) # define DEALLOCATE_LOCAL(ptr) /* as nothing */ # endif /* who does alloca */ # endif /* NCR */ # endif /* __GNUC__ */ #endif /* NO_ALLOCA */ #if !defined(ALLOCATE_LOCAL) # if defined(ALLOCATE_LOCAL_FALLBACK) && defined(DEALLOCATE_LOCAL_FALLBACK) # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK(_size) # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK(_ptr) # else /* no fallbacks supplied; error */ # define ALLOCATE_LOCAL(_size) ALLOCATE_LOCAL_FALLBACK undefined! # define DEALLOCATE_LOCAL(_ptr) DEALLOCATE_LOCAL_FALLBACK undefined! # endif /* defined(ALLOCATE_LOCAL_FALLBACK && DEALLOCATE_LOCAL_FALLBACK) */ #endif /* !defined(ALLOCATE_LOCAL) */ #endif /* XALLOCA_H */ vnc_unixsrc/Xvnc/include/Xprotostr.h0100664000076400007640000000570007120677563017245 0ustar constconst/* $XConsortium: Xprotostr.h,v 1.5 94/04/17 20:10:53 rws Exp $ */ #ifndef XPROTOSTRUCTS_H #define XPROTOSTRUCTS_H /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include /* Used by PolySegment */ typedef struct _xSegment { INT16 x1 B16, y1 B16, x2 B16, y2 B16; } xSegment; /* POINT */ typedef struct _xPoint { INT16 x B16, y B16; } xPoint; typedef struct _xRectangle { INT16 x B16, y B16; CARD16 width B16, height B16; } xRectangle; /* ARC */ typedef struct _xArc { INT16 x B16, y B16; CARD16 width B16, height B16; INT16 angle1 B16, angle2 B16; } xArc; #endif /* XPROTOSTRUCTS_H */ vnc_unixsrc/Xvnc/include/Xmd.h0100664000076400007640000001521710543216033015735 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef XMD_H #define XMD_H 1 /* $XConsortium: Xmd.h,v 1.49 95/06/08 23:20:39 gildea Exp $ */ /* $XFree86: xc/include/Xmd.h,v 3.4 1996/12/31 04:15:20 dawes Exp $ */ /* * Xmd.h: MACHINE DEPENDENT DECLARATIONS. */ /* * Special per-machine configuration flags. */ #ifdef CRAY #define WORD64 /* 64-bit architecture */ #endif #if defined(__alpha) || defined(__alpha__) || defined(__x86_64__) #define LONG64 /* 32/64-bit architecture */ #endif #ifdef __sgi #if (_MIPS_SZLONG == 64) #define LONG64 #endif #endif /* * Stuff to handle large architecture machines; the constants were generated * on a 32-bit machine and must coorespond to the protocol. */ #ifdef WORD64 #define MUSTCOPY #endif /* WORD64 */ /* * Definition of macro used to set constants for size of network structures; * machines with preprocessors that can't handle all of the sz_ symbols * can define this macro to be sizeof(x) if and only if their compiler doesn't * pad out structures (esp. the xTextElt structure which contains only two * one-byte fields). Network structures should always define sz_symbols. * * The sz_ prefix is used instead of something more descriptive so that the * symbols are no more than 32 characters long (which causes problems for some * compilers and preprocessors). * * The extra indirection in the __STDC__ case is to get macro arguments to * expand correctly before the concatenation, rather than afterward. */ #if ((defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)) && !defined(UNIXCPP)) || defined(ANSICPP) #define _SIZEOF(x) sz_##x #define SIZEOF(x) _SIZEOF(x) #else #define SIZEOF(x) sz_/**/x #endif /* if ANSI C compiler else not */ /* * Bitfield suffixes for the protocol structure elements, if you * need them. Note that bitfields are not guarranteed to be signed * (or even unsigned) according to ANSI C. */ #ifdef WORD64 typedef long INT64; typedef unsigned long CARD64; #define B32 :32 #define B16 :16 #ifdef UNSIGNEDBITFIELDS typedef unsigned int INT32; typedef unsigned int INT16; #else #ifdef __STDC__ typedef signed int INT32; typedef signed int INT16; #else typedef int INT32; typedef int INT16; #endif #endif #else #define B32 #define B16 #ifdef LONG64 typedef long INT64; typedef int INT32; #else typedef long INT32; #endif typedef short INT16; #endif #if defined(__STDC__) || defined(sgi) || defined(AIXV3) typedef signed char INT8; #else typedef char INT8; #endif #ifdef LONG64 typedef unsigned long CARD64; typedef unsigned int CARD32; #else typedef unsigned long CARD32; #endif typedef unsigned short CARD16; typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; #ifndef __EMX__ typedef CARD8 BYTE; typedef CARD8 BOOL; #else /* * This is bad style, but the central include file declares them * as well */ #define BYTE CARD8 #define BOOL CARD8 #endif /* * definitions for sign-extending bitfields on 64-bit architectures */ #if defined(WORD64) && defined(UNSIGNEDBITFIELDS) #define cvtINT8toInt(val) (((val) & 0x00000080) ? ((val) | 0xffffffffffffff00) : (val)) #define cvtINT16toInt(val) (((val) & 0x00008000) ? ((val) | 0xffffffffffff0000) : (val)) #define cvtINT32toInt(val) (((val) & 0x80000000) ? ((val) | 0xffffffff00000000) : (val)) #define cvtINT8toShort(val) cvtINT8toInt(val) #define cvtINT16toShort(val) cvtINT16toInt(val) #define cvtINT32toShort(val) cvtINT32toInt(val) #define cvtINT8toLong(val) cvtINT8toInt(val) #define cvtINT16toLong(val) cvtINT16toInt(val) #define cvtINT32toLong(val) cvtINT32toInt(val) #else #define cvtINT8toInt(val) (val) #define cvtINT16toInt(val) (val) #define cvtINT32toInt(val) (val) #define cvtINT8toShort(val) (val) #define cvtINT16toShort(val) (val) #define cvtINT32toShort(val) (val) #define cvtINT8toLong(val) (val) #define cvtINT16toLong(val) (val) #define cvtINT32toLong(val) (val) #endif /* WORD64 and UNSIGNEDBITFIELDS */ #ifdef MUSTCOPY /* * This macro must not cast or else pointers will get aligned and be wrong */ #define NEXTPTR(p,t) (((char *) p) + SIZEOF(t)) #else /* else not MUSTCOPY, this is used for 32-bit machines */ /* * this version should leave result of type (t *), but that should only be * used when not in MUSTCOPY */ #define NEXTPTR(p,t) (((t *)(p)) + 1) #endif /* MUSTCOPY - used machines whose C structs don't line up with proto */ #endif /* XMD_H */ vnc_unixsrc/Xvnc/include/Xatom.h0100664000076400007640000000472607120677563016320 0ustar constconst#ifndef XATOM_H #define XATOM_H 1 /* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #define XA_PRIMARY ((Atom) 1) #define XA_SECONDARY ((Atom) 2) #define XA_ARC ((Atom) 3) #define XA_ATOM ((Atom) 4) #define XA_BITMAP ((Atom) 5) #define XA_CARDINAL ((Atom) 6) #define XA_COLORMAP ((Atom) 7) #define XA_CURSOR ((Atom) 8) #define XA_CUT_BUFFER0 ((Atom) 9) #define XA_CUT_BUFFER1 ((Atom) 10) #define XA_CUT_BUFFER2 ((Atom) 11) #define XA_CUT_BUFFER3 ((Atom) 12) #define XA_CUT_BUFFER4 ((Atom) 13) #define XA_CUT_BUFFER5 ((Atom) 14) #define XA_CUT_BUFFER6 ((Atom) 15) #define XA_CUT_BUFFER7 ((Atom) 16) #define XA_DRAWABLE ((Atom) 17) #define XA_FONT ((Atom) 18) #define XA_INTEGER ((Atom) 19) #define XA_PIXMAP ((Atom) 20) #define XA_POINT ((Atom) 21) #define XA_RECTANGLE ((Atom) 22) #define XA_RESOURCE_MANAGER ((Atom) 23) #define XA_RGB_COLOR_MAP ((Atom) 24) #define XA_RGB_BEST_MAP ((Atom) 25) #define XA_RGB_BLUE_MAP ((Atom) 26) #define XA_RGB_DEFAULT_MAP ((Atom) 27) #define XA_RGB_GRAY_MAP ((Atom) 28) #define XA_RGB_GREEN_MAP ((Atom) 29) #define XA_RGB_RED_MAP ((Atom) 30) #define XA_STRING ((Atom) 31) #define XA_VISUALID ((Atom) 32) #define XA_WINDOW ((Atom) 33) #define XA_WM_COMMAND ((Atom) 34) #define XA_WM_HINTS ((Atom) 35) #define XA_WM_CLIENT_MACHINE ((Atom) 36) #define XA_WM_ICON_NAME ((Atom) 37) #define XA_WM_ICON_SIZE ((Atom) 38) #define XA_WM_NAME ((Atom) 39) #define XA_WM_NORMAL_HINTS ((Atom) 40) #define XA_WM_SIZE_HINTS ((Atom) 41) #define XA_WM_ZOOM_HINTS ((Atom) 42) #define XA_MIN_SPACE ((Atom) 43) #define XA_NORM_SPACE ((Atom) 44) #define XA_MAX_SPACE ((Atom) 45) #define XA_END_SPACE ((Atom) 46) #define XA_SUPERSCRIPT_X ((Atom) 47) #define XA_SUPERSCRIPT_Y ((Atom) 48) #define XA_SUBSCRIPT_X ((Atom) 49) #define XA_SUBSCRIPT_Y ((Atom) 50) #define XA_UNDERLINE_POSITION ((Atom) 51) #define XA_UNDERLINE_THICKNESS ((Atom) 52) #define XA_STRIKEOUT_ASCENT ((Atom) 53) #define XA_STRIKEOUT_DESCENT ((Atom) 54) #define XA_ITALIC_ANGLE ((Atom) 55) #define XA_X_HEIGHT ((Atom) 56) #define XA_QUAD_WIDTH ((Atom) 57) #define XA_WEIGHT ((Atom) 58) #define XA_POINT_SIZE ((Atom) 59) #define XA_RESOLUTION ((Atom) 60) #define XA_COPYRIGHT ((Atom) 61) #define XA_NOTICE ((Atom) 62) #define XA_FONT_NAME ((Atom) 63) #define XA_FAMILY_NAME ((Atom) 64) #define XA_FULL_NAME ((Atom) 65) #define XA_CAP_HEIGHT ((Atom) 66) #define XA_WM_CLASS ((Atom) 67) #define XA_WM_TRANSIENT_FOR ((Atom) 68) #define XA_LAST_PREDEFINED ((Atom) 68) #endif /* XATOM_H */ vnc_unixsrc/Xvnc/programs/0040775000076400007640000000000010616336466015256 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/0040775000076400007640000000000010616336473016712 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/os/0040775000076400007640000000000010616336467017336 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/os/connection.c0100664000076400007640000010076107615745017021643 0ustar constconst/* $TOG: connection.c /main/156 1997/06/05 18:43:01 sekhar $ */ /*********************************************************** Copyright (c) 1987, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/Xserver/os/connection.c,v 3.25.2.2 1997/07/05 15:55:45 dawes Exp $ */ /***************************************************************** * Stuff to create connections --- OS dependent * * EstablishNewConnections, CreateWellKnownSockets, ResetWellKnownSockets, * CloseDownConnection, CheckConnections, AddEnabledDevice, * RemoveEnabledDevice, OnlyListToOneClient, * ListenToAllClients, * * (WaitForSomething is in its own file) * * In this implementation, a client socket table is not kept. * Instead, what would be the index into the table is just the * file descriptor of the socket. This won't work for if the * socket ids aren't small nums (0 - 2^8) * *****************************************************************/ #ifdef WIN32 #include #endif #include "X.h" #include "Xproto.h" #include #include #ifdef X_NOT_STDC_ENV extern int errno; #endif #include #include #ifndef WIN32 #ifndef MINIX #ifndef Lynx #include #else #include #endif #endif #ifdef hpux #include #include #endif #ifdef AIXV3 #include #endif #ifdef MINIX #include #define select(n,r,w,x,t) nbio_select(n,r,w,x,t) #endif #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) extern __const__ int _nfiles; #endif #if defined(TCPCONN) || defined(STREAMSCONN) # include /*================================================================ BEGIN ORL VNC modification include arpa/inet.h for inet_ntoa function prototype */ #include /* END ORL VNC modification ================================================================*/ # ifndef hpux # ifdef apollo # ifndef NO_TCP_H # include # endif # else # ifdef CSRG_BASED # include # endif # ifndef __EMX__ # include # endif # endif # endif #endif #ifdef AMTCPCONN #include #include #include #endif #if !defined(AMOEBA) && !defined(_MINIX) && !defined(__EMX__) #ifndef Lynx #include #else #include #endif #endif #endif /* WIN32 */ #include "misc.h" /* for typedef of pointer */ #include #include "osdep.h" #include "opaque.h" #include "dixstruct.h" #ifdef XAPPGROUP #include "extensions/Xagsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #ifdef LBX #include "lbxserve.h" #endif #ifdef X_NOT_POSIX #define Pid_t int #else #define Pid_t pid_t #endif #ifdef DNETCONN #include #endif /* DNETCONN */ extern char *display; /* The display number */ int lastfdesc; /* maximum file descriptor */ fd_set WellKnownConnections; /* Listener mask */ fd_set EnabledDevices; /* mask for input devices that are on */ fd_set AllSockets; /* select on this */ fd_set AllClients; /* available clients */ fd_set LastSelectMask; /* mask returned from last select call */ fd_set ClientsWithInput; /* clients with FULL requests in buffer */ fd_set ClientsWriteBlocked; /* clients who cannot receive output */ fd_set OutputPending; /* clients with reply/event data ready to go */ int MaxClients = MAXSOCKS; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ Bool PartialNetwork; /* continue even if unable to bind all addrs */ char *protNoListen; /* don't listen on this protocol */ static Pid_t ParentProcess; static Bool debug_conns = FALSE; fd_set IgnoredClientsWithInput; static fd_set GrabImperviousClients; static fd_set SavedAllClients; static fd_set SavedAllSockets; static fd_set SavedClientsWithInput; int GrabInProgress = 0; #ifndef WIN32 int ConnectionTranslation[MAXSOCKS]; #else /* SPAM ALERT !!! * On NT fds are not between 0 and MAXSOCKS, they are unrelated, and there is * not even a known maximum value, so use something quite arbitrary for now. * This is clearly boggus and another form of storage which doesn't use the fd * as a direct index should really be implemented for NT. */ #define MAXFD 500 int ConnectionTranslation[MAXFD]; #endif XtransConnInfo *ListenTransConns = NULL; int *ListenTransFds = NULL; int ListenTransCount; extern int auditTrailLevel; static void ErrorConnMax( #if NeedFunctionPrototypes XtransConnInfo /* trans_conn */ #endif ); #ifndef LBX static #endif void CloseDownFileDescriptor( #if NeedFunctionPrototypes #ifdef LBX ClientPtr client #else register OsCommPtr /*oc*/ #endif #endif ); #ifdef LBX extern int LbxFlushClient(); extern void LbxCloseClient(); #endif /* LBX */ static XtransConnInfo lookup_trans_conn (fd) int fd; { if (ListenTransFds) { int i; for (i = 0; i < ListenTransCount; i++) if (ListenTransFds[i] == fd) return ListenTransConns[i]; } return (NULL); } #ifdef XDMCP void XdmcpOpenDisplay(), XdmcpInit(), XdmcpReset(), XdmcpCloseDisplay(); #endif /***************** * CreateWellKnownSockets * At initialization, create the sockets to listen on for new clients. *****************/ void CreateWellKnownSockets() { int request, i; int partial; char port[20]; FD_ZERO(&AllSockets); FD_ZERO(&AllClients); FD_ZERO(&LastSelectMask); FD_ZERO(&ClientsWithInput); #ifndef WIN32 for (i=0; i MAXSOCKS) { lastfdesc = MAXSOCKS; if (debug_conns) ErrorF( "GOT TO END OF SOCKETS %d\n", MAXSOCKS); } FD_ZERO (&WellKnownConnections); sprintf (port, "%d", atoi (display)); if (protNoListen) if (_XSERVTransNoListen(protNoListen)) { FatalError ("Failed to disable listen for %s", protNoListen); } if ((_XSERVTransMakeAllCOTSServerListeners (port, &partial, &ListenTransCount, &ListenTransConns) >= 0) && (ListenTransCount >= 1)) { if (!PartialNetwork && partial) { FatalError ("Failed to establish all listening sockets"); } else { ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { int fd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); ListenTransFds[i] = fd; FD_SET (fd, &WellKnownConnections); if (!_XSERVTransIsLocal (ListenTransConns[i])) { DefineSelf (fd); } } } } if (!XFD_ANYSET (&WellKnownConnections)) FatalError ("Cannot establish any listening sockets - Make sure an X server isn't already running"); #ifndef WIN32 OsSignal (SIGPIPE, SIG_IGN); OsSignal (SIGHUP, AutoResetServer); #endif OsSignal (SIGINT, GiveUp); OsSignal (SIGTERM, GiveUp); XFD_COPYSET (&WellKnownConnections, &AllSockets); ResetHosts(display); /* * Magic: If SIGUSR1 was set to SIG_IGN when * the server started, assume that either * * a- The parent process is ignoring SIGUSR1 * * or * * b- The parent process is expecting a SIGUSR1 * when the server is ready to accept connections * * In the first case, the signal will be harmless, * in the second case, the signal will be quite * useful */ #ifndef WIN32 if (OsSignal (SIGUSR1, SIG_IGN) == SIG_IGN) RunFromSmartParent = TRUE; ParentProcess = getppid (); if (RunFromSmartParent) { if (ParentProcess > 0) { kill (ParentProcess, SIGUSR1); } } #endif #ifdef XDMCP XdmcpInit (); #endif } void ResetWellKnownSockets () { int i; ResetOsBuffers(); for (i = 0; i < ListenTransCount; i++) { int status = _XSERVTransResetListener (ListenTransConns[i]); if (status != TRANS_RESET_NOOP) { if (status == TRANS_RESET_FAILURE) { /* * ListenTransConns[i] freed by xtrans. * Remove it from out list. */ FD_CLR (ListenTransFds[i], &WellKnownConnections); ListenTransFds[i] = ListenTransFds[ListenTransCount - 1]; ListenTransConns[i] = ListenTransConns[ListenTransCount - 1]; ListenTransCount -= 1; i -= 1; } else if (status == TRANS_RESET_NEW_FD) { /* * A new file descriptor was allocated (the old one was closed) */ int newfd = _XSERVTransGetConnectionNumber (ListenTransConns[i]); FD_CLR (ListenTransFds[i], &WellKnownConnections); ListenTransFds[i] = newfd; FD_SET(newfd, &WellKnownConnections); } } } ResetAuthorization (); ResetHosts(display); /* * See above in CreateWellKnownSockets about SIGUSR1 */ #ifndef WIN32 if (RunFromSmartParent) { if (ParentProcess > 0) { kill (ParentProcess, SIGUSR1); } } #endif /* * restart XDMCP */ #ifdef XDMCP XdmcpReset (); #endif } static void AuthAudit (client, letin, saddr, len, proto_n, auth_proto, auth_id) ClientPtr client; Bool letin; struct sockaddr *saddr; int len; unsigned short proto_n; char *auth_proto; int auth_id; { char addr[128]; char *out = addr; if (!((OsCommPtr)client->osPrivate)->trans_conn) { strcpy(addr, "LBX proxy at "); out += strlen(addr); } if (!len) strcpy(out, "local host"); else switch (saddr->sa_family) { case AF_UNSPEC: #if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) case AF_UNIX: #endif strcpy(out, "local host"); break; #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) case AF_INET: sprintf(out, "IP %s port %d", inet_ntoa(((struct sockaddr_in *) saddr)->sin_addr), ntohs(((struct sockaddr_in *) saddr)->sin_port)); break; #endif #ifdef DNETCONN case AF_DECnet: sprintf(out, "DN %s", dnet_ntoa(&((struct sockaddr_dn *) saddr)->sdn_add)); break; #endif #ifdef AMRPCCONN case FamilyAmoeba: sprintf(addr, "AM %s", saddr); break; #endif #if defined(AMTCPCONN) && !(defined(TCPCONN) || defined(STREAMSCONN)) case AF_INET: sprintf(addr, "AMIP %s", inet_ntoa(*((ipaddr_t *) saddr))); break; #endif default: strcpy(out, "unknown address"); } if (letin) AuditF("client %d connected from %s\n", client->index, addr); else AuditF("client %d rejected from %s\n", client->index, addr); if (proto_n) AuditF(" Auth name: %.*s ID: %d\n", proto_n, auth_proto, auth_id); } XID AuthorizationIDOfClient(client) ClientPtr client; { if (client->osPrivate) return ((OsCommPtr)client->osPrivate)->auth_id; else return None; } /***************************************************************** * ClientAuthorized * * Sent by the client at connection setup: * typedef struct _xConnClientPrefix { * CARD8 byteOrder; * BYTE pad; * CARD16 majorVersion, minorVersion; * CARD16 nbytesAuthProto; * CARD16 nbytesAuthString; * } xConnClientPrefix; * * It is hoped that eventually one protocol will be agreed upon. In the * mean time, a server that implements a different protocol than the * client expects, or a server that only implements the host-based * mechanism, will simply ignore this information. * *****************************************************************/ char * ClientAuthorized(client, proto_n, auth_proto, string_n, auth_string) ClientPtr client; char *auth_proto, *auth_string; unsigned int proto_n, string_n; { register OsCommPtr priv; Xtransaddr *from = NULL; int family; int fromlen; XID auth_id; char *reason = NULL; XtransConnInfo trans_conn; auth_id = CheckAuthorization (proto_n, auth_proto, string_n, auth_string, client, &reason); priv = (OsCommPtr)client->osPrivate; trans_conn = priv->trans_conn; #ifdef LBX if (!trans_conn) { ClientPtr lbxpc = LbxProxyClient(priv->proxy); trans_conn = ((OsCommPtr)lbxpc->osPrivate)->trans_conn; if (auth_id == (XID) ~0L && !GetAccessControl()) auth_id = ((OsCommPtr)lbxpc->osPrivate)->auth_id; #ifdef XCSECURITY else if (auth_id != (XID) ~0L && !SecuritySameLevel(lbxpc, auth_id)) { auth_id = (XID) ~0L; reason = "Client trust level differs from that of LBX Proxy"; } #endif } #endif if (auth_id == (XID) ~0L) { if ( #ifdef XCSECURITY (proto_n == 0 || strncmp (auth_proto, XSecurityAuthorizationName, proto_n) != 0) && #endif _XSERVTransGetPeerAddr (trans_conn, &family, &fromlen, &from) != -1) { #ifdef AMRPCCONN /* Amoeba RPC connections are already checked by the capability. */ if (family == FamilyAmoeba) { auth_id = (XID) 0; } else #endif if ( #ifdef LBX !priv->trans_conn || #endif InvalidHost ((struct sockaddr *) from, fromlen)) AuthAudit(client, FALSE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); else { auth_id = (XID) 0; if (auditTrailLevel > 1) AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); } xfree ((char *) from); } if (auth_id == (XID) ~0L) if (reason) return reason; else return "Client is not authorized to connect to Server"; } else if (auditTrailLevel > 1) { if (_XSERVTransGetPeerAddr (trans_conn, &family, &fromlen, &from) != -1) { AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); xfree ((char *) from); } } priv->auth_id = auth_id; priv->conn_time = 0; #ifdef XDMCP /* indicate to Xdmcp protocol that we've opened new client */ XdmcpOpenDisplay(priv->fd); #endif /* XDMCP */ #ifdef XAPPGROUP if (ClientStateCallback) XagCallClientStateChange (client); #endif /* At this point, if the client is authorized to change the access control * list, we should getpeername() information, and add the client to * the selfhosts list. It's not really the host machine, but the * true purpose of the selfhosts list is to see who may change the * access control list. */ return((char *)NULL); } static ClientPtr #ifdef LBX AllocNewConnection (trans_conn, fd, conn_time, Flush, Close, proxy) #else AllocNewConnection (trans_conn, fd, conn_time) #endif XtransConnInfo trans_conn; int fd; CARD32 conn_time; #ifdef LBX int (*Flush)(); void (*Close)(); LbxProxyPtr proxy; #endif { OsCommPtr oc; ClientPtr client; if ( #ifdef LBX trans_conn && #endif #ifndef WIN32 fd >= lastfdesc #else XFD_SETCOUNT(&AllClients) >= MaxClients #endif ) return NullClient; oc = (OsCommPtr)xalloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; oc->fd = fd; oc->input = (ConnectionInputPtr)NULL; oc->output = (ConnectionOutputPtr)NULL; oc->auth_id = None; oc->conn_time = conn_time; #ifdef LBX oc->proxy = proxy; oc->Flush = Flush; oc->Close = Close; oc->largereq = (ConnectionInputPtr) NULL; #endif if (!(client = NextAvailableClient((pointer)oc))) { xfree (oc); return NullClient; } #ifdef LBX if (trans_conn) #endif { ConnectionTranslation[fd] = client->index; if (GrabInProgress) { FD_SET(fd, &SavedAllClients); FD_SET(fd, &SavedAllSockets); } else { FD_SET(fd, &AllClients); FD_SET(fd, &AllSockets); } } return client; } #ifdef LBX int ClientConnectionNumber (client) ClientPtr client; { OsCommPtr oc = (OsCommPtr) client->osPrivate; return oc->fd; } ClientPtr AllocLbxClientConnection (client, proxy) ClientPtr client; LbxProxyPtr proxy; { OsCommPtr oc = (OsCommPtr) client->osPrivate; return AllocNewConnection ((XtransConnInfo)NULL, oc->fd, GetTimeInMillis(), LbxFlushClient, LbxCloseClient, proxy); } void LbxProxyConnection (client, proxy) ClientPtr client; LbxProxyPtr proxy; { OsCommPtr oc = (OsCommPtr) client->osPrivate; FlushClient(client, oc, (char *)NULL, 0); oc->proxy = proxy; oc->Flush = LbxFlushClient; oc->Close = LbxCloseClient; LbxPrimeInput(client, proxy); } #endif /***************** * EstablishNewConnections * If anyone is waiting on listened sockets, accept them. * Returns a mask with indices of new clients. Updates AllClients * and AllSockets. *****************/ /*ARGSUSED*/ Bool EstablishNewConnections(clientUnused, closure) ClientPtr clientUnused; pointer closure; { #ifndef WIN32 fd_mask readyconnections; /* mask of listeners that are ready */ #else fd_set readyconnections; /* set of listeners that are ready */ #endif int curconn; /* fd of listener that's ready */ register int newconn; /* fd of new client */ CARD32 connect_time; register int i; register ClientPtr client; register OsCommPtr oc; fd_set tmask; #ifndef AMOEBA XFD_ANDSET (&tmask, (fd_set*)closure, &WellKnownConnections); #ifndef WIN32 readyconnections = tmask.fds_bits[0]; if (!readyconnections) return TRUE; #else XFD_COPYSET(&tmask, &readyconnections); if (!XFD_ANYSET(&readyconnections)) return TRUE; #endif connect_time = GetTimeInMillis(); /* kill off stragglers */ for (i=1; iosPrivate); if (oc && (oc->conn_time != 0) && (connect_time - oc->conn_time) >= TimeOutValue || client->noClientException != Success && !client->clientGone) CloseDownClient(client); } } #else /* AMOEBA */ /* EstablishNewConnections is only called when there is one new * connection waiting on the first transport. */ readyconnections = 1; #endif /* AMOEBA */ #ifndef WIN32 while (readyconnections) #else for (i = 0; i < XFD_SETCOUNT(&readyconnections); i++) #endif { XtransConnInfo trans_conn, new_trans_conn; int status; #ifndef WIN32 curconn = ffs (readyconnections) - 1; readyconnections &= ~(1 << curconn); #else curconn = XFD_FD(&readyconnections, i); #endif if ((trans_conn = lookup_trans_conn (curconn)) == NULL) continue; if ((new_trans_conn = _XSERVTransAccept (trans_conn, &status)) == NULL) continue; newconn = _XSERVTransGetConnectionNumber (new_trans_conn); _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1); if (!AllocNewConnection (new_trans_conn, newconn, connect_time #ifdef LBX , StandardFlushClient, CloseDownFileDescriptor, (LbxProxyPtr)NULL #endif )) { ErrorConnMax(new_trans_conn); _XSERVTransClose(new_trans_conn); } } return TRUE; } #define NOROOM "Maximum number of clients reached" /************ * ErrorConnMax * Fail a connection due to lack of client or file descriptor space ************/ static void ErrorConnMax(trans_conn) XtransConnInfo trans_conn; { register int fd = _XSERVTransGetConnectionNumber (trans_conn); xConnSetupPrefix csp; char pad[3]; struct iovec iov[3]; char byteOrder = 0; int whichbyte = 1; #ifndef AMOEBA struct timeval waittime; fd_set mask; /* if these seems like a lot of trouble to go to, it probably is */ waittime.tv_sec = BOTIMEOUT / MILLI_PER_SECOND; waittime.tv_usec = (BOTIMEOUT % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); FD_ZERO(&mask); FD_SET(fd, &mask); (void)Select(fd + 1, &mask, NULL, NULL, &waittime); #endif /* try to read the byte-order of the connection */ (void)_XSERVTransRead(trans_conn, &byteOrder, 1); if ((byteOrder == 'l') || (byteOrder == 'B')) { csp.success = xFalse; csp.lengthReason = sizeof(NOROOM) - 1; csp.length = (sizeof(NOROOM) + 2) >> 2; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (((*(char *) &whichbyte) && (byteOrder == 'B')) || (!(*(char *) &whichbyte) && (byteOrder == 'l'))) { swaps(&csp.majorVersion, whichbyte); swaps(&csp.minorVersion, whichbyte); swaps(&csp.length, whichbyte); } iov[0].iov_len = sz_xConnSetupPrefix; iov[0].iov_base = (char *) &csp; iov[1].iov_len = csp.lengthReason; iov[1].iov_base = NOROOM; iov[2].iov_len = (4 - (csp.lengthReason & 3)) & 3; iov[2].iov_base = pad; (void)_XSERVTransWritev(trans_conn, iov, 3); } } /************ * CloseDownFileDescriptor: * Remove this file descriptor and it's I/O buffers, etc. ************/ #ifdef LBX void CloseDownFileDescriptor(client) ClientPtr client; #else static void CloseDownFileDescriptor(oc) register OsCommPtr oc; #endif { #ifdef LBX register OsCommPtr oc = (OsCommPtr) client->osPrivate; #endif int connection = oc->fd; if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); } #ifdef LBX ConnectionTranslation[connection] = 0; #else FreeOsBuffers(oc); #endif FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); FD_CLR(connection, &ClientsWithInput); FD_CLR(connection, &GrabImperviousClients); if (GrabInProgress) { FD_CLR(connection, &SavedAllSockets); FD_CLR(connection, &SavedAllClients); FD_CLR(connection, &SavedClientsWithInput); } FD_CLR(connection, &ClientsWriteBlocked); if (!XFD_ANYSET(&ClientsWriteBlocked)) AnyClientsWriteBlocked = FALSE; FD_CLR(connection, &OutputPending); #ifndef LBX xfree(oc); #endif } /***************** * CheckConections * Some connection has died, go find which one and shut it down * The file descriptor has been closed, but is still in AllClients. * If would truly be wonderful if select() would put the bogus * file descriptors in the exception mask, but nooooo. So we have * to check each and every socket individually. *****************/ void CheckConnections() { #ifndef WIN32 fd_mask mask; #endif fd_set tmask; register int curclient, curoff; int i; struct timeval notime; int r; #ifdef WIN32 fd_set savedAllClients; #endif #ifndef AMOEBA notime.tv_sec = 0; notime.tv_usec = 0; #ifndef WIN32 for (i=0; iosPrivate; if (oc->output && oc->output->count) FlushClient(client, oc, (char *)NULL, 0); #ifdef XDMCP XdmcpCloseDisplay(oc->fd); #endif #ifndef LBX CloseDownFileDescriptor(oc); #else (*oc->Close) (client); FreeOsBuffers(oc); xfree(oc); #endif client->osPrivate = (pointer)NULL; if (auditTrailLevel > 1) AuditF("client %d disconnected\n", client->index); } AddEnabledDevice(fd) int fd; { FD_SET(fd, &EnabledDevices); FD_SET(fd, &AllSockets); } RemoveEnabledDevice(fd) int fd; { FD_CLR(fd, &EnabledDevices); FD_CLR(fd, &AllSockets); } /***************** * OnlyListenToOneClient: * Only accept requests from one client. Continue to handle new * connections, but don't take any protocol requests from the new * ones. Note that if GrabInProgress is set, EstablishNewConnections * needs to put new clients into SavedAllSockets and SavedAllClients. * Note also that there is no timeout for this in the protocol. * This routine is "undone" by ListenToAllClients() *****************/ OnlyListenToOneClient(client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; if (! GrabInProgress) { XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput); XFD_ANDSET(&ClientsWithInput, &ClientsWithInput, &GrabImperviousClients); if (FD_ISSET(connection, &SavedClientsWithInput)) { FD_CLR(connection, &SavedClientsWithInput); FD_SET(connection, &ClientsWithInput); } XFD_UNSET(&SavedClientsWithInput, &GrabImperviousClients); XFD_COPYSET(&AllSockets, &SavedAllSockets); XFD_COPYSET(&AllClients, &SavedAllClients); XFD_UNSET(&AllSockets, &AllClients); XFD_ANDSET(&AllClients, &AllClients, &GrabImperviousClients); FD_SET(connection, &AllClients); XFD_ORSET(&AllSockets, &AllSockets, &AllClients); GrabInProgress = client->index; } } /**************** * ListenToAllClients: * Undoes OnlyListentToOneClient() ****************/ ListenToAllClients() { if (GrabInProgress) { XFD_ORSET(&AllSockets, &AllSockets, &SavedAllSockets); XFD_ORSET(&AllClients, &AllClients, &SavedAllClients); XFD_ORSET(&ClientsWithInput, &ClientsWithInput, &SavedClientsWithInput); GrabInProgress = 0; } } /**************** * IgnoreClient * Removes one client from input masks. * Must have cooresponding call to AttendClient. ****************/ IgnoreClient (client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; #ifdef LBX LbxClientPtr lbxClient = LbxClient(client); #endif isItTimeToYield = TRUE; #ifdef LBX if (lbxClient) { lbxClient->ignored = TRUE; return; } #endif if (!GrabInProgress || FD_ISSET(connection, &AllClients)) { if (FD_ISSET (connection, &ClientsWithInput)) FD_SET(connection, &IgnoredClientsWithInput); else FD_CLR(connection, &IgnoredClientsWithInput); FD_CLR(connection, &ClientsWithInput); FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); FD_CLR(connection, &LastSelectMask); } else { if (FD_ISSET (connection, &SavedClientsWithInput)) FD_SET(connection, &IgnoredClientsWithInput); else FD_CLR(connection, &IgnoredClientsWithInput); FD_CLR(connection, &SavedClientsWithInput); FD_CLR(connection, &SavedAllSockets); FD_CLR(connection, &SavedAllClients); } } /**************** * AttendClient * Adds one client back into the input masks. ****************/ AttendClient (client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; #ifdef LBX LbxClientPtr lbxClient = LbxClient(client); if (lbxClient) { lbxClient->ignored = FALSE; return; } #endif if (!GrabInProgress || GrabInProgress == client->index || FD_ISSET(connection, &GrabImperviousClients)) { FD_SET(connection, &AllClients); FD_SET(connection, &AllSockets); FD_SET(connection, &LastSelectMask); if (FD_ISSET (connection, &IgnoredClientsWithInput)) FD_SET(connection, &ClientsWithInput); } else { FD_SET(connection, &SavedAllClients); FD_SET(connection, &SavedAllSockets); if (FD_ISSET(connection, &IgnoredClientsWithInput)) FD_SET(connection, &SavedClientsWithInput); } } /* make client impervious to grabs; assume only executing client calls this */ MakeClientGrabImpervious(client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; FD_SET(connection, &GrabImperviousClients); if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = CLIENT_IMPERVIOUS; CallCallbacks(&ServerGrabCallback, &grabinfo); } } /* make client pervious to grabs; assume only executing client calls this */ MakeClientGrabPervious(client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; int connection = oc->fd; FD_CLR(connection, &GrabImperviousClients); if (GrabInProgress && (GrabInProgress != client->index)) { if (FD_ISSET(connection, &ClientsWithInput)) { FD_SET(connection, &SavedClientsWithInput); FD_CLR(connection, &ClientsWithInput); } FD_CLR(connection, &AllSockets); FD_CLR(connection, &AllClients); isItTimeToYield = TRUE; } if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = CLIENT_PERVIOUS; CallCallbacks(&ServerGrabCallback, &grabinfo); } } #ifdef AIXV3 static fd_set pendingActiveClients; static BOOL reallyGrabbed; /**************** * DontListenToAnybody: * Don't listen to requests from any clients. Continue to handle new * connections, but don't take any protocol requests from anybody. * We have to take care if there is already a grab in progress, though. * Undone by PayAttentionToClientsAgain. We also have to be careful * not to accept any more input from the currently dispatched client. * we do this be telling dispatch it is time to yield. * We call this when the server loses access to the glass * (user hot-keys away). This looks like a grab by the * server itself, but gets a little tricky if there is already * a grab in progress. ******************/ void DontListenToAnybody() { if (!GrabInProgress) { XFD_COPYSET(&ClientsWithInput, &SavedClientsWithInput); XFD_COPYSET(&AllSockets, &SavedAllSockets); XFD_COPYSET(&AllClients, &SavedAllClients); GrabInProgress = TRUE; reallyGrabbed = FALSE; } else { XFD_COPYSET(&AllClients, &pendingActiveClients); reallyGrabbed = TRUE; } FD_ZERO(&ClientsWithInput); XFD_UNSET(&AllSockets, &AllClients); FD_ZERO(&AllClients); isItTimeToYield = TRUE; } void PayAttentionToClientsAgain() { if (reallyGrabbed) { XFD_ORSET(&AllSockets, &AllSockets, &pendingActiveClients); XFD_ORSET(&AllClients, &AllClients, &pendingActiveClients); } else { ListenToAllClients(); } reallyGrabbed = FALSE; } #endif vnc_unixsrc/Xvnc/programs/Xserver/os/utils.c0100664000076400007640000010432407536107216020636 0ustar constconst/* $TOG: utils.c /main/128 1997/06/01 13:50:39 sekhar $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, Copyright 1994 Quarterdeck Office Systems. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital and Quarterdeck not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL AND QUARTERDECK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $XFree86: xc/programs/Xserver/os/utils.c,v 3.27.2.6 1998/02/20 15:13:58 robin Exp $ */ #ifdef WIN32 #include #endif #include "Xos.h" #include #include "misc.h" #include "X.h" #include "input.h" #include "opaque.h" #ifdef X_POSIX_C_SOURCE #define _POSIX_C_SOURCE X_POSIX_C_SOURCE #include #undef _POSIX_C_SOURCE #else #if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #endif #if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) #include #endif #if defined(AIXV3) || defined(HPUX_10) # include #endif #include #include #include /* for isspace */ #if NeedVarargsPrototypes #include #endif #ifdef AMOEBA #include "osdep.h" #include #include static mutex print_lock; #endif #if defined(__STDC__) || defined(AMOEBA) /* DHD: SVR4.0 has a prototype for abs() in stdlib.h */ /* DHD: might be better to move this include higher up? */ #ifdef abs #undef abs #endif #ifndef NOSTDHDRS #include /* for malloc() */ #endif #endif extern char *display; extern CARD32 defaultScreenSaverTime; /* for parsing command line */ extern CARD32 defaultScreenSaverInterval; extern int defaultScreenSaverBlanking; extern int defaultBackingStore; extern Bool disableBackingStore; extern Bool disableSaveUnders; extern Bool PartialNetwork; #ifndef NOLOGOHACK extern int logoScreenSaver; #endif #ifdef RLIMIT_DATA extern int limitDataSpace; #endif #ifdef RLIMIT_STACK extern int limitStackSpace; #endif #ifdef RLIMIT_NOFILE extern int limitNoFile; #endif extern int defaultColorVisualClass; extern Bool permitOldBugs; extern int monitorResolution; extern Bool defeatAccessControl; #ifdef SERVER_LOCK static Bool nolock = FALSE; #endif extern char* protNoListen; Bool CoreDump; Bool noTestExtensions; int auditTrailLevel = 1; void ddxUseMsg(); #if NeedVarargsPrototypes void VErrorF(char*, va_list); #endif #ifdef DEBUG #ifndef SPECIAL_MALLOC #define MEMBUG #endif #endif #ifdef MEMBUG #define MEM_FAIL_SCALE 100000 long Memory_fail = 0; #ifdef linux #include /* for random() */ #endif #endif #ifdef sgi int userdefinedfontpath = 0; #endif /* sgi */ Bool Must_have_memory = FALSE; char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ OsSigHandlerPtr OsSignal(sig, handler) int sig; OsSigHandlerPtr handler; { #ifdef X_NOT_POSIX return signal(sig, handler); #else struct sigaction act, oact; sigemptyset(&act.sa_mask); if (handler != SIG_IGN) sigaddset(&act.sa_mask, sig); act.sa_flags = 0; act.sa_handler = handler; sigaction(sig, &act, &oact); return oact.sa_handler; #endif } #include extern int errno; #ifdef SERVER_LOCK /* * Explicit support for a server lock file like the ones used for UUCP. * For architectures with virtual terminals that can run more than one * server at a time. This keeps the servers from stomping on each other * if the user forgets to give them different display numbers. */ #ifndef __EMX__ #define LOCK_DIR "/tmp" #define LOCK_TMP_PREFIX "/.tX" #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" #else #define LOCK_TMP_PREFIX "/xf86$" #define LOCK_PREFIX "/xf86_" #define LOCK_SUFFIX ".lck" #endif #ifdef _MINIX #include /* For PATH_MAX */ #endif #ifdef __EMX__ #define link rename #endif #ifndef PATH_MAX #ifndef Lynx #include #else #include #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif static Bool StillLocking = FALSE; static char LockFile[PATH_MAX]; /* * LockServer -- * Check if the server lock file exists. If so, check if the PID * contained inside is valid. If so, then die. Otherwise, create * the lock file containing the PID. */ void LockServer() { #ifndef AMOEBA char tmp[PATH_MAX], pid_str[12]; int lfd, i, haslock, l_pid, t; char *tmppath = NULL; int len; if (nolock) return; /* * Path names */ #ifndef __EMX__ tmppath = LOCK_DIR; #else /* OS/2 uses TMP directory, must also prepare for 8.3 names */ tmppath = getenv("TMP"); if (!tmppath) FatalError("No TMP dir found\n"); #endif len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) : strlen(LOCK_TMP_PREFIX); len += strlen(tmppath) + strlen(display) + strlen(LOCK_SUFFIX) + 1; if (len > sizeof(LockFile)) FatalError("Display name `%s' is too long\n"); (void)sprintf(tmp, "%s" LOCK_TMP_PREFIX "%s" LOCK_SUFFIX, tmppath, display); (void)sprintf(LockFile, "%s" LOCK_PREFIX "%s" LOCK_SUFFIX, tmppath, display); /* * Create a temporary file containing our PID. Attempt three times * to create the file. */ StillLocking = TRUE; i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); if (lfd < 0) { unlink(tmp); i = 0; do { i++; lfd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0644); if (lfd < 0) sleep(2); else break; } while (i < 3); } if (lfd < 0) FatalError("Could not create lock file in %s\n", tmp); (void) sprintf(pid_str, "%10d\n", getpid()); (void) write(lfd, pid_str, 11); #ifndef __EMX__ #ifndef USE_CHMOD (void) fchmod(lfd, 0444); #else (void) chmod(tmp, 0444); #endif #endif (void) close(lfd); /* * OK. Now the tmp file exists. Try three times to move it in place * for the lock. */ i = 0; haslock = 0; while ((!haslock) && (i++ < 3)) { haslock = (link(tmp,LockFile) == 0); if (haslock) { /* * We're done. */ break; } else { /* * Read the pid from the existing file */ lfd = open(LockFile, O_RDONLY); if (lfd < 0) { unlink(tmp); FatalError("Can't read lock file %s\n", LockFile); } pid_str[0] = '\0'; if (read(lfd, pid_str, 11) != 11) { /* * Bogus lock file. */ unlink(LockFile); close(lfd); continue; } pid_str[11] = '\0'; sscanf(pid_str, "%d", &l_pid); close(lfd); /* * Now try to kill the PID to see if it exists. */ errno = 0; t = kill(l_pid, 0); if ((t< 0) && (errno == ESRCH)) { /* * Stale lock file. */ unlink(LockFile); continue; } else if (((t < 0) && (errno == EPERM)) || (t == 0)) { /* * Process is still active. */ unlink(tmp); FatalError("Server is already active for display %s\n%s %s\n%s\n", display, "\tIf this server is no longer running, remove", LockFile, "\tand start again."); } } } unlink(tmp); if (!haslock) FatalError("Could not create server lock file: %s\n", LockFile); StillLocking = FALSE; #endif /* !AMOEBA */ } /* * UnlockServer -- * Remove the server lock file. */ void UnlockServer() { #ifndef AMOEBA if (nolock) return; if (!StillLocking){ #ifdef __EMX__ (void) chmod(LockFile,S_IREAD|S_IWRITE); #endif /* __EMX__ */ (void) unlink(LockFile); } #endif } #endif /* SERVER_LOCK */ /* Force connections to close on SIGHUP from init */ /*ARGSUSED*/ SIGVAL AutoResetServer (sig) int sig; { dispatchException |= DE_RESET; isItTimeToYield = TRUE; #ifdef GPROF chdir ("/tmp"); exit (0); #endif #if defined(SYSV) && defined(X_NOT_POSIX) OsSignal (SIGHUP, AutoResetServer); #endif #ifdef AMOEBA WakeUpMainThread(); #endif } /* Force connections to close and then exit on SIGTERM, SIGINT */ /*ARGSUSED*/ SIGVAL GiveUp(sig) int sig; { dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; #if defined(SYSV) && defined(X_NOT_POSIX) if (sig) OsSignal(sig, SIG_IGN); #endif #ifdef AMOEBA WakeUpMainThread(); #endif } #if __GNUC__ static void AbortServer() __attribute__((noreturn)); #endif static void AbortServer() { extern void AbortDDX(); OsCleanup(); AbortDDX(); fflush(stderr); #ifdef AMOEBA IOPCleanUp(); #endif if (CoreDump) abort(); exit (1); } void Error(str) char *str; { #ifdef AMOEBA mu_lock(&print_lock); #endif perror(str); #ifdef AMOEBA mu_unlock(&print_lock); #endif } #ifndef DDXTIME CARD32 GetTimeInMillis() { #ifndef AMOEBA struct timeval tp; X_GETTIMEOFDAY(&tp); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); #else return sys_milli(); #endif } #endif AdjustWaitForDelay (waitTime, newdelay) pointer waitTime; unsigned long newdelay; { static struct timeval delay_val; struct timeval **wt = (struct timeval **) waitTime; unsigned long olddelay; if (*wt == NULL) { delay_val.tv_sec = newdelay / 1000; delay_val.tv_usec = 1000 * (newdelay % 1000); *wt = &delay_val; } else { olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000; if (newdelay < olddelay) { (*wt)->tv_sec = newdelay / 1000; (*wt)->tv_usec = 1000 * (newdelay % 1000); } } } void UseMsg() { #if !defined(AIXrt) && !defined(AIX386) #ifndef AMOEBA ErrorF("use: X [:] [option]\n"); #else ErrorF("use: X [[]:] [option]\n"); #endif ErrorF("-a # mouse acceleration (pixels)\n"); ErrorF("-ac disable access control restrictions\n"); #ifdef MEMBUG ErrorF("-alloc int chance alloc should fail\n"); #endif ErrorF("-audit int set audit trail level\n"); ErrorF("-auth file select authorization file\n"); ErrorF("bc enable bug compatibility\n"); ErrorF("-bs disable any backing store support\n"); ErrorF("-c turns off key-click\n"); ErrorF("c # key-click volume (0-100)\n"); ErrorF("-cc int default color visual class\n"); ErrorF("-co file color database file\n"); #if 0 ErrorF("-config file read options from file\n"); #endif ErrorF("-core generate core dump on fatal error\n"); ErrorF("-dpi int screen resolution in dots per inch\n"); #ifdef DPMSExtension ErrorF("dpms enables VESA DPMS monitor control\n"); ErrorF("-dpms disables VESA DPMS monitor control\n"); #endif ErrorF("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n"); ErrorF("-f # bell base (0-100)\n"); ErrorF("-fc string cursor font\n"); ErrorF("-fn string default font name\n"); ErrorF("-fp string default font path\n"); ErrorF("-help prints message with these options\n"); ErrorF("-I ignore all remaining arguments\n"); #ifdef RLIMIT_DATA ErrorF("-ld int limit data space to N Kb\n"); #endif #ifdef RLIMIT_NOFILE ErrorF("-lf int limit number of open files to N\n"); #endif #ifdef RLIMIT_STACK ErrorF("-ls int limit stack space to N Kb\n"); #endif #ifdef SERVER_LOCK ErrorF("-nolock disable the locking mechanism\n"); #endif #ifndef NOLOGOHACK ErrorF("-logo enable logo in screen saver\n"); ErrorF("nologo disable logo in screen saver\n"); #endif ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-p # screen-saver pattern duration (minutes)\n"); ErrorF("-pn accept failure to listen on all ports\n"); ErrorF("-nopn reject failure to listen on all ports\n"); ErrorF("-r turns off auto-repeat\n"); ErrorF("r turns on auto-repeat \n"); ErrorF("-s # screen-saver timeout (minutes)\n"); #ifdef XCSECURITY ErrorF("-sp file security policy file\n"); #endif ErrorF("-su disable any save under support\n"); ErrorF("-t # mouse threshold (pixels)\n"); ErrorF("-terminate terminate at server reset\n"); ErrorF("-to # connection time out\n"); ErrorF("-tst disable testing extensions\n"); ErrorF("ttyxx server started from init on /dev/ttyxx\n"); ErrorF("v video blanking for screen-saver\n"); ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); ErrorF("-x string loads named extension at init time \n"); #ifdef AMOEBA ErrorF("-tcp capability specify TCP/IP server capability\n"); #endif #ifdef XDMCP XdmcpUseMsg(); #endif #endif /* !AIXrt && ! AIX386 */ #ifdef XKB XkbUseMsg(); #endif ddxUseMsg(); } /* * This function parses the command line. Handles device-independent fields * and allows ddx to handle additional fields. It is not allowed to modify * argc or any of the strings pointed to by argv. */ void ProcessCommandLine ( argc, argv ) int argc; char *argv[]; { int i, skip; #ifdef AMOEBA mu_init(&print_lock); #endif defaultKeyboardControl.autoRepeat = TRUE; #ifdef PART_NET PartialNetwork = TRUE; #endif for ( i = 1; i < argc; i++ ) { /* call ddx first, so it can peek/override if it wants */ if(skip = ddxProcessArgument(argc, argv, i)) { i += (skip - 1); } else if(argv[i][0] == ':') { /* initialize display */ display = argv[i]; display++; } #ifdef AMOEBA else if (strchr(argv[i], ':') != NULL) { char *p; XServerHostName = argv[i]; if ((p = strchr(argv[i], ':')) != NULL) { *p++ = '\0'; display = p; } } else if (strcmp( argv[i], "-tcp") == 0) { if (++i < argc) XTcpServerName = argv[i]; else UseMsg(); } #endif /* AMOEBA */ else if ( strcmp( argv[i], "-a") == 0) { if(++i < argc) defaultPointerControl.num = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-ac") == 0) { defeatAccessControl = TRUE; } #ifdef MEMBUG else if ( strcmp( argv[i], "-alloc") == 0) { if(++i < argc) Memory_fail = atoi(argv[i]); else UseMsg(); } #endif else if ( strcmp( argv[i], "-audit") == 0) { if(++i < argc) auditTrailLevel = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-auth") == 0) { if(++i < argc) InitAuthorization (argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "bc") == 0) permitOldBugs = TRUE; else if ( strcmp( argv[i], "-bs") == 0) disableBackingStore = TRUE; else if ( strcmp( argv[i], "c") == 0) { if(++i < argc) defaultKeyboardControl.click = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-c") == 0) { defaultKeyboardControl.click = 0; } else if ( strcmp( argv[i], "-cc") == 0) { if(++i < argc) defaultColorVisualClass = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-co") == 0) { if(++i < argc) rgbPath = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-core") == 0) CoreDump = TRUE; else if ( strcmp( argv[i], "-dpi") == 0) { if(++i < argc) monitorResolution = atoi(argv[i]); else UseMsg(); } #ifdef DPMSExtension else if ( strcmp( argv[i], "dpms") == 0) DPMSEnabledSwitch = TRUE; else if ( strcmp( argv[i], "-dpms") == 0) DPMSDisabledSwitch = TRUE; #endif else if ( strcmp( argv[i], "-deferglyphs") == 0) { if(++i >= argc || !ParseGlyphCachingMode(argv[i])) UseMsg(); } else if ( strcmp( argv[i], "-f") == 0) { if(++i < argc) defaultKeyboardControl.bell = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-fc") == 0) { if(++i < argc) defaultCursorFont = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-fn") == 0) { if(++i < argc) defaultTextFont = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-fp") == 0) { if(++i < argc) { #ifdef sgi userdefinedfontpath = 1; #endif /* sgi */ defaultFontPath = argv[i]; } else UseMsg(); } else if ( strcmp( argv[i], "-help") == 0) { UseMsg(); exit(0); } #ifdef XKB else if ( (skip=XkbProcessArguments(argc,argv,i))!=0 ) { if (skip>0) i+= skip-1; else UseMsg(); } #endif #ifdef RLIMIT_DATA else if ( strcmp( argv[i], "-ld") == 0) { if(++i < argc) { limitDataSpace = atoi(argv[i]); if (limitDataSpace > 0) limitDataSpace *= 1024; } else UseMsg(); } #endif #ifdef RLIMIT_NOFILE else if ( strcmp( argv[i], "-lf") == 0) { if(++i < argc) limitNoFile = atoi(argv[i]); else UseMsg(); } #endif #ifdef RLIMIT_STACK else if ( strcmp( argv[i], "-ls") == 0) { if(++i < argc) { limitStackSpace = atoi(argv[i]); if (limitStackSpace > 0) limitStackSpace *= 1024; } else UseMsg(); } #endif #ifdef SERVER_LOCK else if ( strcmp ( argv[i], "-nolock") == 0) { nolock = TRUE; } #endif #ifndef NOLOGOHACK else if ( strcmp( argv[i], "-logo") == 0) { logoScreenSaver = 1; } else if ( strcmp( argv[i], "nologo") == 0) { logoScreenSaver = 0; } #endif else if ( strcmp( argv[i], "-nolisten") == 0) { if(++i < argc) protNoListen = argv[i]; else UseMsg(); } else if ( strcmp( argv[i], "-p") == 0) { if(++i < argc) defaultScreenSaverInterval = ((CARD32)atoi(argv[i])) * MILLI_PER_MIN; else UseMsg(); } else if ( strcmp( argv[i], "-pn") == 0) PartialNetwork = TRUE; else if ( strcmp( argv[i], "-nopn") == 0) PartialNetwork = FALSE; else if ( strcmp( argv[i], "r") == 0) defaultKeyboardControl.autoRepeat = TRUE; else if ( strcmp( argv[i], "-r") == 0) defaultKeyboardControl.autoRepeat = FALSE; else if ( strcmp( argv[i], "-s") == 0) { if(++i < argc) defaultScreenSaverTime = ((CARD32)atoi(argv[i])) * MILLI_PER_MIN; else UseMsg(); } else if ( strcmp( argv[i], "-su") == 0) disableSaveUnders = TRUE; else if ( strcmp( argv[i], "-t") == 0) { if(++i < argc) defaultPointerControl.threshold = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-terminate") == 0) { extern Bool terminateAtReset; terminateAtReset = TRUE; } else if ( strcmp( argv[i], "-to") == 0) { if(++i < argc) TimeOutValue = ((CARD32)atoi(argv[i])) * MILLI_PER_SECOND; else UseMsg(); } else if ( strcmp( argv[i], "-tst") == 0) { noTestExtensions = TRUE; } else if ( strcmp( argv[i], "v") == 0) defaultScreenSaverBlanking = PreferBlanking; else if ( strcmp( argv[i], "-v") == 0) defaultScreenSaverBlanking = DontPreferBlanking; else if ( strcmp( argv[i], "-wm") == 0) defaultBackingStore = WhenMapped; else if ( strcmp( argv[i], "-x") == 0) { if(++i >= argc) UseMsg(); /* For U**x, which doesn't support dynamic loading, there's nothing * to do when we see a -x. Either the extension is linked in or * it isn't */ } else if ( strcmp( argv[i], "-I") == 0) { /* ignore all remaining arguments */ break; } else if (strncmp (argv[i], "tty", 3) == 0) { /* just in case any body is interested */ dev_tty_from_init = argv[i]; } #ifdef XDMCP else if ((skip = XdmcpOptions(argc, argv, i)) != i) { i = skip - 1; } #endif #ifdef XPRINT else if ((skip = XprintOptions(argc, argv, i)) != i) { i = skip - 1; } #endif #ifdef XCSECURITY else if ((skip = XSecurityOptions(argc, argv, i)) != i) { i = skip - 1; } #endif #if defined(AIXV3) && ! defined(AIXV4) else if ( strcmp( argv[i], "-timeout") == 0) { if(++i < argc) SelectWaitTime = atoi(argv[i]); else UseMsg(); } else if ( strcmp( argv[i], "-sync") == 0) { SyncOn++; } #endif else { ErrorF("Unrecognized option: %s\n", argv[i]); UseMsg(); exit (1); } } } #if 0 static void InsertFileIntoCommandLine(resargc, resargv, prefix_argc, prefix_argv, filename, suffix_argc, suffix_argv) int *resargc; char ***resargv; int prefix_argc; char **prefix_argv; char *filename; int suffix_argc; char **suffix_argv; { struct stat st; FILE *f; char *p; char *q; int insert_argc; char *buf; int len; int i; f = fopen(filename, "r"); if (!f) FatalError("Can't open option file %s\n", filename); fstat(fileno(f), &st); buf = (char *) xalloc((unsigned) st.st_size + 1); if (!buf) FatalError("Out of Memory\n"); len = fread(buf, 1, (unsigned) st.st_size, f); fclose(f); if (len < 0) FatalError("Error reading option file %s\n", filename); buf[len] = '\0'; p = buf; q = buf; insert_argc = 0; while (*p) { while (isspace(*p)) p++; if (!*p) break; if (*p == '#') { while (*p && *p != '\n') p++; } else { while (*p && !isspace(*p)) *q++ = *p++; /* Since p and q might still be pointing at the same place, we */ /* need to step p over the whitespace now before we add the null. */ if (*p) p++; *q++ = '\0'; insert_argc++; } } buf = (char *) xrealloc(buf, q - buf); if (!buf) FatalError("Out of memory reallocing option buf\n"); *resargc = prefix_argc + insert_argc + suffix_argc; *resargv = (char **) xalloc((*resargc + 1) * sizeof(char *)); memcpy(*resargv, prefix_argv, prefix_argc * sizeof(char *)); p = buf; for (i = 0; i < insert_argc; i++) { (*resargv)[prefix_argc + i] = p; p += strlen(p) + 1; } memcpy(*resargv + prefix_argc + insert_argc, suffix_argv, suffix_argc * sizeof(char *)); (*resargv)[*resargc] = NULL; } /* end InsertFileIntoCommandLine */ void ExpandCommandLine(pargc, pargv) int *pargc; char ***pargv; { int i; for (i = 1; i < *pargc; i++) { if ( (0 == strcmp((*pargv)[i], "-config")) && (i < (*pargc - 1)) ) { InsertFileIntoCommandLine(pargc, pargv, i, *pargv, (*pargv)[i+1], /* filename */ *pargc - i - 2, *pargv + i + 2); i--; } } } /* end ExpandCommandLine */ #endif #if defined(TCPCONN) || defined(STREAMSCONN) #ifndef WIN32 #include #endif #endif /* Implement a simple-minded font authorization scheme. The authorization name is "hp-hostname-1", the contents are simply the host name. */ int set_font_authorizations(authorizations, authlen, client) char **authorizations; int *authlen; pointer client; { #define AUTHORIZATION_NAME "hp-hostname-1" #if defined(TCPCONN) || defined(STREAMSCONN) static char result[1024]; static char *p = NULL; if (p == NULL) { char hname[1024], *hnameptr; struct hostent *host; int len; gethostname(hname, 1024); host = gethostbyname(hname); if (host == NULL) hnameptr = hname; else hnameptr = host->h_name; p = result; *p++ = sizeof(AUTHORIZATION_NAME) >> 8; *p++ = sizeof(AUTHORIZATION_NAME) & 0xff; *p++ = (len = strlen(hnameptr) + 1) >> 8; *p++ = (len & 0xff); memmove(p, AUTHORIZATION_NAME, sizeof(AUTHORIZATION_NAME)); p += sizeof(AUTHORIZATION_NAME); memmove(p, hnameptr, len); p += len; } *authlen = p - result; *authorizations = result; return 1; #else /* TCPCONN */ return 0; #endif /* TCPCONN */ } /* XALLOC -- X's internal memory allocator. Why does it return unsigned * long * instead of the more common char *? Well, if you read K&R you'll * see they say that alloc must return a pointer "suitable for conversion" * to whatever type you really want. In a full-blown generic allocator * there's no way to solve the alignment problems without potentially * wasting lots of space. But we have a more limited problem. We know * we're only ever returning pointers to structures which will have to * be long word aligned. So we are making a stronger guarantee. It might * have made sense to make Xalloc return char * to conform with people's * expectations of malloc, but this makes lint happier. */ #ifndef INTERNAL_MALLOC unsigned long * Xalloc (amount) unsigned long amount; { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); #endif register pointer ptr; if ((long)amount <= 0) { return (unsigned long *)NULL; } /* aligned extra on long word boundary */ amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); #ifdef MEMBUG if (!Must_have_memory && Memory_fail && ((random() % MEM_FAIL_SCALE) < Memory_fail)) return (unsigned long *)NULL; #endif if (ptr = (pointer)malloc(amount)) { return (unsigned long *)ptr; } if (Must_have_memory) FatalError("Out of memory"); return (unsigned long *)NULL; } /***************** * XNFalloc * "no failure" realloc, alternate interface to Xalloc w/o Must_have_memory *****************/ unsigned long * XNFalloc (amount) unsigned long amount; { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); #endif register pointer ptr; if ((long)amount <= 0) { return (unsigned long *)NULL; } /* aligned extra on long word boundary */ amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); ptr = (pointer)malloc(amount); if (!ptr) { FatalError("Out of memory"); } return ((unsigned long *)ptr); } /***************** * Xcalloc *****************/ unsigned long * Xcalloc (amount) unsigned long amount; { unsigned long *ret; ret = Xalloc (amount); if (ret) bzero ((char *) ret, (int) amount); return ret; } /***************** * Xrealloc *****************/ unsigned long * Xrealloc (ptr, amount) register pointer ptr; unsigned long amount; { #if !defined(__STDC__) && !defined(AMOEBA) char *malloc(); char *realloc(); #endif #ifdef MEMBUG if (!Must_have_memory && Memory_fail && ((random() % MEM_FAIL_SCALE) < Memory_fail)) return (unsigned long *)NULL; #endif if ((long)amount <= 0) { if (ptr && !amount) free(ptr); return (unsigned long *)NULL; } amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1); if (ptr) ptr = (pointer)realloc((char *)ptr, amount); else ptr = (pointer)malloc(amount); if (ptr) return (unsigned long *)ptr; if (Must_have_memory) FatalError("Out of memory"); return (unsigned long *)NULL; } /***************** * XNFrealloc * "no failure" realloc, alternate interface to Xrealloc w/o Must_have_memory *****************/ unsigned long * XNFrealloc (ptr, amount) register pointer ptr; unsigned long amount; { if (( ptr = (pointer)Xrealloc( ptr, amount ) ) == NULL) { FatalError( "Out of memory" ); } return ((unsigned long *)ptr); } /***************** * Xfree * calls free *****************/ void Xfree(ptr) register pointer ptr; { if (ptr) free((char *)ptr); } void OsInitAllocator () { #ifdef MEMBUG static int been_here; /* Check the memory system after each generation */ if (been_here) CheckMemory (); else been_here = 1; #endif } #endif void AuditPrefix(f) char *f; { #ifdef X_NOT_STDC_ENV long tm; #else time_t tm; #endif char *autime, *s; if (*f != ' ') { time(&tm); autime = ctime(&tm); if (s = strchr(autime, '\n')) *s = '\0'; if (s = strrchr(argvGlobal[0], '/')) s++; else s = argvGlobal[0]; ErrorF("AUDIT: %s: %d %s: ", autime, getpid(), s); } } /*VARARGS1*/ void AuditF( #if NeedVarargsPrototypes char * f, ...) #else f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ char *f; char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; #endif { #if NeedVarargsPrototypes va_list args; #endif AuditPrefix(f); #if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); #else ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); #endif } /*VARARGS1*/ void FatalError( #if NeedVarargsPrototypes char *f, ...) #else f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ char *f; char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; #endif { #if NeedVarargsPrototypes va_list args; #endif ErrorF("\nFatal server error:\n"); #if NeedVarargsPrototypes va_start(args, f); VErrorF(f, args); va_end(args); #else ErrorF(f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); #endif ErrorF("\n"); #ifdef DDXOSFATALERROR OsVendorFatalError(); #endif AbortServer(); /*NOTREACHED*/ } #if NeedVarargsPrototypes void VErrorF(f, args) char *f; va_list args; { vfprintf(stderr, f, args); } #endif /*VARARGS1*/ void ErrorF( #if NeedVarargsPrototypes char * f, ...) #else f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9) /* limit of ten args */ char *f; char *s0, *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9; #endif { #if NeedVarargsPrototypes va_list args; va_start(args, f); VErrorF(f, args); va_end(args); #else #ifdef AMOEBA mu_lock(&print_lock); #endif fprintf( stderr, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9); #ifdef AMOEBA mu_unlock(&print_lock); #endif #endif } #if !defined(WIN32) && !defined(__EMX__) /* * "safer" versions of system(3), popen(3) and pclose(3) which give up * all privs before running a command. * * This is based on the code in FreeBSD 2.2 libc. */ int System(command) char *command; { int pid, p; void (*csig)(); int status; if (!command) return(1); #ifdef SIGCHLD csig = signal(SIGCHLD, SIG_DFL); #endif ErrorF("System: `%s'\n", command); switch (pid = fork()) { case -1: /* error */ p = -1; case 0: /* child */ setgid(getgid()); setuid(getuid()); execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); default: /* parent */ do { p = waitpid(pid, &status, 0); } while (p == -1 && errno == EINTR); } #ifdef SIGCHLD signal(SIGCHLD, csig); #endif return p == -1 ? -1 : status; } static struct pid { struct pid *next; FILE *fp; int pid; } *pidlist; pointer Popen(command, type) char *command; char *type; { struct pid *cur; FILE *iop; int pdes[2], pid; void (*csig)(); if (command == NULL || type == NULL) return NULL; if ((*type != 'r' && *type != 'w') || type[1]) return NULL; if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { xfree(cur); return NULL; } switch (pid = fork()) { case -1: /* error */ close(pdes[0]); close(pdes[1]); xfree(cur); return NULL; case 0: /* child */ setgid(getgid()); setuid(getuid()); if (*type == 'r') { if (pdes[1] != 1) { /* stdout */ dup2(pdes[1], 1); close(pdes[1]); } close(pdes[0]); } else { if (pdes[0] != 0) { /* stdin */ dup2(pdes[0], 0); close(pdes[0]); } close(pdes[1]); } execl("/bin/sh", "sh", "-c", command, (char *)NULL); _exit(127); } /* parent */ if (*type == 'r') { iop = fdopen(pdes[0], type); close(pdes[1]); } else { iop = fdopen(pdes[1], type); close(pdes[0]); } cur->fp = iop; cur->pid = pid; cur->next = pidlist; pidlist = cur; #if 0 ErrorF("Popen: `%s', fp = %p\n", command, iop); #endif return iop; } int Pclose(iop) pointer iop; { struct pid *cur, *last; int omask; int pstat; int pid; #if 0 ErrorF("Pclose: fp = %p\n", iop); #endif fclose(iop); for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next) if (cur->fp = iop) break; if (cur == NULL) return -1; do { pid = waitpid(cur->pid, &pstat, 0); } while (pid == -1 && errno == EINTR); if (last == NULL) pidlist = cur->next; else last->next = cur->next; xfree(cur); return pid == -1 ? -1 : pstat; } #endif /* !WIN32 && !__EMX__ */ vnc_unixsrc/Xvnc/programs/Xserver/os/access.c0100664000076400007640000010024407120677563020742 0ustar constconst/* $XConsortium: access.c /main/68 1996/12/15 22:57:09 rws $ */ /* $XFree86: xc/programs/Xserver/os/access.c,v 3.18.2.4 1998/02/21 06:07:16 robin Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifdef WIN32 #include #endif #include #include #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "site.h" #include #include #ifndef WIN32 #if !defined(AMOEBA) && !defined(MINIX) #ifdef ESIX #include #else #ifndef Lynx #include #else #include #endif #endif #include #else #ifdef AMOEBA #define port am_port_t #include #include #include #include #include #include #include #include #include #include #include #include #include #undef port #endif #endif /* AMOEBA || MINIX */ #include #if defined(TCPCONN) || defined(STREAMSCONN) || defined(ISC) || defined(SCO) #include #endif /* TCPCONN || STREAMSCONN || ISC || SCO */ #ifdef DNETCONN #include #include #endif #if !defined(AMOEBA) #ifdef hpux # include # ifdef HAS_IFREQ # include # endif #else #if defined(SVR4) || (defined(SYSV) && defined(i386)) || defined(MINIX) # include #endif #if defined(SYSV) && defined(i386) # include # ifdef ISC # include # include # endif /* ISC */ #endif #ifdef ESIX # include #else #ifndef MINIX # include #endif #endif #endif /* hpux */ #endif /* !AMOEBA */ #ifdef SVR4 #ifndef SCO #include #endif #include #endif #ifdef ESIX #include #else #if !defined(AMOEBA) && !defined(MINIX) #include #else #ifdef AMOEBA #include #endif #ifdef MINIX #include #include #define INADDR_BROADCAST 0xFFFFFFFF #endif #endif /* AMOEBA || MINIX */ #endif /* ESIX */ #ifdef CSRG_BASED #include #if (BSD >= 199103) #define VARIABLE_IFREQ #endif #endif #if defined(Lynx) && defined(BSD44SOCKETS) #define VARIABLE_IFREQ #endif #endif /* WIN32 */ #ifndef PATH_MAX #ifndef Lynx #include #else #include #endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #endif #include "dixstruct.h" #include "osdep.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif Bool defeatAccessControl = FALSE; #define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len) #define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len) #define addrEqual(fam, address, length, host) \ ((fam) == (host)->family &&\ (length) == (host)->len &&\ !acmp (address, (host)->addr, length)) static int ConvertAddr( #if NeedFunctionPrototypes struct sockaddr */*saddr*/, int */*len*/, pointer */*addr*/ #endif ); static int CheckAddr( #if NeedFunctionPrototypes int /*family*/, pointer /*pAddr*/, unsigned /*length*/ #endif ); static Bool NewHost( #if NeedFunctionPrototypes int /*family*/, pointer /*addr*/, int /*len*/ #endif ); typedef struct _host { short family; short len; unsigned char *addr; struct _host *next; } HOST; #define MakeHost(h,l) (h)=(HOST *) xalloc(sizeof *(h)+(l));\ (h)->addr=(unsigned char *) ((h) + 1); #define FreeHost(h) xfree(h) static HOST *selfhosts = NULL; static HOST *validhosts = NULL; static int AccessEnabled = DEFAULT_ACCESS_CONTROL; static int LocalHostEnabled = FALSE; static int UsingXdmcp = FALSE; /* * called when authorization is not enabled to add the * local host to the access list */ void EnableLocalHost () { if (!UsingXdmcp) { LocalHostEnabled = TRUE; AddLocalHosts (); } } /* * called when authorization is enabled to keep us secure */ void DisableLocalHost () { HOST *self; LocalHostEnabled = FALSE; for (self = selfhosts; self; self = self->next) (void) RemoveHost ((ClientPtr)NULL, self->family, self->len, (pointer)self->addr); } /* * called at init time when XDMCP will be used; xdmcp always * adds local hosts manually when needed */ void AccessUsingXdmcp () { UsingXdmcp = TRUE; LocalHostEnabled = FALSE; } #if ((defined(SVR4) && !defined(SCO325) && !defined(sun) && !defined(NCR)) || defined(ISC)) && defined(SIOCGIFCONF) /* Deal with different SIOCGIFCONF ioctl semantics on these OSs */ static int ifioctl (fd, cmd, arg) int fd; int cmd; char *arg; { struct strioctl ioc; int ret; bzero((char *) &ioc, sizeof(ioc)); ioc.ic_cmd = cmd; ioc.ic_timout = 0; if (cmd == SIOCGIFCONF) { ioc.ic_len = ((struct ifconf *) arg)->ifc_len; ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf; #ifdef ISC /* SIOCGIFCONF is somewhat brain damaged on ISC. The argument * buffer must contain the ifconf structure as header. Ifc_req * is also not a pointer but a one element array of ifreq * structures. On return this array is extended by enough * ifreq fields to hold all interfaces. The return buffer length * is placed in the buffer header. */ ((struct ifconf *) ioc.ic_dp)->ifc_len = ioc.ic_len - sizeof(struct ifconf); #endif } else { ioc.ic_len = sizeof(struct ifreq); ioc.ic_dp = arg; } ret = ioctl(fd, I_STR, (char *) &ioc); if (ret >= 0 && cmd == SIOCGIFCONF) #ifdef SVR4 ((struct ifconf *) arg)->ifc_len = ioc.ic_len; #endif #ifdef ISC { ((struct ifconf *) arg)->ifc_len = ((struct ifconf *)ioc.ic_dp)->ifc_len; ((struct ifconf *) arg)->ifc_buf = (caddr_t)((struct ifconf *)ioc.ic_dp)->ifc_req; } #endif return(ret); } #else /* ((SVR4 && !sun) || ISC) && SIOCGIFCONF */ #define ifioctl ioctl #endif /* ((SVR4 && !sun) || ISC) && SIOCGIFCONF */ /* * DefineSelf (fd): * * Define this host for access control. Find all the hosts the OS knows about * for this fd and add them to the selfhosts list. */ #ifdef WINTCP /* NCR Wollongong based TCP */ #include #include #include #include #include #include #include #include #include void DefineSelf (fd) int fd; { /* * The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the * socket IO calls that most other drivers seem to like. Because of * this, this routine must be special cased for NCR. Eventually, * this will be cleared up. */ struct ipb ifnet; struct in_ifaddr ifaddr; struct strioctl str; unsigned char *addr; register HOST *host; int family, len; if ((fd = open ("/dev/ip", O_RDWR, 0 )) < 0) Error ("Getting interface configuration (1)"); /* Indicate that we want to start at the begining */ ifnet.ib_next = (struct ipb *) 1; while (ifnet.ib_next) { str.ic_cmd = IPIOC_GETIPB; str.ic_timout = 0; str.ic_len = sizeof (struct ipb); str.ic_dp = (char *) &ifnet; if (ioctl (fd, (int) I_STR, (char *) &str) < 0) { close (fd); Error ("Getting interface configuration (2)"); } ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist; str.ic_cmd = IPIOC_GETINADDR; str.ic_timout = 0; str.ic_len = sizeof (struct in_ifaddr); str.ic_dp = (char *) &ifaddr; if (ioctl (fd, (int) I_STR, (char *) &str) < 0) { close (fd); Error ("Getting interface configuration (3)"); } len = sizeof(struct sockaddr_in); family = ConvertAddr (IA_SIN(&ifaddr), &len, (pointer *)&addr); if (family == -1 || family == FamilyLocal) continue; for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (host) continue; MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP { struct sockaddr broad_addr; /* * If this isn't an Internet Address, don't register it. */ if (family != FamilyInternet) continue; /* * ignore 'localhost' entries as they're not useful * on the other end of the wire */ if (len == 4 && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) continue; XdmcpRegisterConnection (family, (char *)addr, len); #define IA_BROADADDR(ia) ((struct sockaddr_in *)(&((struct in_ifaddr *)ia)->ia_broadaddr)) XdmcpRegisterBroadcastAddress ( (struct sockaddr_in *) IA_BROADADDR(&ifaddr)); #undef IA_BROADADDR } #endif /* XDMCP */ } close(fd); /* * add something of FamilyLocalHost */ for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } } #else /* WINTCP */ #if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) void DefineSelf (fd) int fd; { #if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN) && !defined(MNX_TCPCONN) return; #else register int n; int len; caddr_t addr; int family; register HOST *host; struct utsname name; register struct hostent *hp; union { struct sockaddr sa; struct sockaddr_in in; } saddr; struct sockaddr_in *inetaddr; struct sockaddr_in broad_addr; /* Why not use gethostname()? Well, at least on my system, I've had to * make an ugly kernel patch to get a name longer than 8 characters, and * uname() lets me access to the whole string (it smashes release, you * see), whereas gethostname() kindly truncates it for me. */ uname(&name); hp = gethostbyname (name.nodename); if (hp != NULL) { saddr.sa.sa_family = hp->h_addrtype; inetaddr = (struct sockaddr_in *) (&(saddr.sa)); acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length); len = sizeof(saddr.sa); family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr); if ( family != -1 && family != FamilyLocal ) { for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (!host) { /* add this host to the host list. */ MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy ( addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP /* * If this is an Internet Address, but not the localhost * address (127.0.0.1), register it. */ if (family == FamilyInternet && !(len == 4 && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) ) { XdmcpRegisterConnection (family, (char *)addr, len); broad_addr = *inetaddr; ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = htonl (INADDR_BROADCAST); XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); } #endif /* XDMCP */ } } } /* * now add a host of family FamilyLocalHost... */ for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } #endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN && !MNX_TCPCONN */ } #else #ifdef VARIABLE_IFREQ #define ifr_size(p) (sizeof (struct ifreq) + \ (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) #define ifraddr_size(a) (a.sa_len) #else #define ifr_size(p) (sizeof (struct ifreq)) #define ifraddr_size(a) (sizeof (a)) #endif void DefineSelf (fd) int fd; { char buf[2048], *cp, *cplim; struct ifconf ifc; register int n; int len; unsigned char * addr; int family; register HOST *host; register struct ifreq *ifr; #ifdef DNETCONN struct dn_naddr *dnaddr = getnodeadd(); /* * AF_DECnet may not be listed in the interface list. Instead use * the supported library call to find out the local address (if any). */ if (dnaddr) { addr = (unsigned char *) dnaddr; len = dnaddr->a_len + sizeof(dnaddr->a_len); family = FamilyDECnet; for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (!host) { MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } } } #endif ifc.ifc_len = sizeof (buf); ifc.ifc_buf = buf; if (ifioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0) Error ("Getting interface configuration (4)"); #ifdef ISC #define IFC_IFC_REQ (struct ifreq *) ifc.ifc_buf #else #define IFC_IFC_REQ ifc.ifc_req #endif cplim = (char *) IFC_IFC_REQ + ifc.ifc_len; for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) { ifr = (struct ifreq *) cp; len = ifraddr_size (ifr->ifr_addr); #ifdef DNETCONN /* * DECnet was handled up above. */ if (ifr->ifr_addr.sa_family == AF_DECnet) continue; #endif /* DNETCONN */ family = ConvertAddr (&ifr->ifr_addr, &len, (pointer *)&addr); if (family == -1 || family == FamilyLocal) continue; #ifdef DEF_SELF_DEBUG if (family == FamilyInternet) ErrorF("Xserver: DefineSelf(): ifname = %s, addr = %d.%d.%d.%d\n", ifr->ifr_name, addr[0], addr[1], addr[2], addr[3]); #endif for (host = selfhosts; host && !addrEqual (family, addr, len, host); host = host->next) ; if (host) continue; MakeHost(host,len) if (host) { host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #ifdef XDMCP { struct sockaddr broad_addr; /* * If this isn't an Internet Address, don't register it. */ if (family != FamilyInternet) continue; /* * ignore 'localhost' entries as they're not useful * on the other end of the wire */ if (len == 4 && addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) continue; XdmcpRegisterConnection (family, (char *)addr, len); broad_addr = ifr->ifr_addr; ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = htonl (INADDR_BROADCAST); #ifdef SIOCGIFBRDADDR { struct ifreq broad_req; broad_req = *ifr; if (ifioctl (fd, SIOCGIFFLAGS, (char *) &broad_req) != -1 && (broad_req.ifr_flags & IFF_BROADCAST) && (broad_req.ifr_flags & IFF_UP) ) { broad_req = *ifr; if (ifioctl (fd, SIOCGIFBRDADDR, &broad_req) != -1) broad_addr = broad_req.ifr_addr; else continue; } else continue; } #endif #ifdef DEF_SELF_DEBUG ErrorF("Xserver: DefineSelf(): ifname = %s, baddr = %s\n", ifr->ifr_name, inet_ntoa(((struct sockaddr_in *) &broad_addr)->sin_addr)); #endif XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); } #endif } /* * add something of FamilyLocalHost */ for (host = selfhosts; host && !addrEqual(FamilyLocalHost, "", 0, host); host = host->next); if (!host) { MakeHost(host, 0); if (host) { host->family = FamilyLocalHost; host->len = 0; acopy("", host->addr, 0); host->next = selfhosts; selfhosts = host; } } } #endif /* hpux && !HAS_IFREQ */ #endif /* WINTCP */ #ifdef XDMCP void AugmentSelf(from, len) pointer from; int len; { int family; pointer addr; register HOST *host; family = ConvertAddr(from, &len, (pointer *)&addr); if (family == -1 || family == FamilyLocal) return; for (host = selfhosts; host; host = host->next) { if (addrEqual(family, addr, len, host)) return; } MakeHost(host,len) if (!host) return; host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = selfhosts; selfhosts = host; } #endif void AddLocalHosts () { HOST *self; for (self = selfhosts; self; self = self->next) (void) NewHost (self->family, self->addr, self->len); } /* Reset access control list to initial hosts */ void ResetHosts (display) char *display; { register HOST *host; char lhostname[120], ohostname[120]; char *hostname = ohostname; char fname[PATH_MAX + 1]; int fnamelen; FILE *fd; char *ptr; int i, hostlen; #ifndef AMOEBA union { struct sockaddr sa; #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) struct sockaddr_in in; #endif /* TCPCONN || STREAMSCONN */ #ifdef DNETCONN struct sockaddr_dn dn; #endif } saddr; #endif /* AMOEBA */ #ifdef DNETCONN struct nodeent *np; struct dn_naddr dnaddr, *dnaddrp, *dnet_addr(); #endif #ifdef K5AUTH krb5_principal princ; krb5_data kbuf; #endif int family; pointer addr; int len; register struct hostent *hp; AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL; LocalHostEnabled = FALSE; while (host = validhosts) { validhosts = host->next; FreeHost (host); } #ifndef __EMX__ #define ETC_HOST_PREFIX "/etc/X" #define ETC_HOST_SUFFIX ".hosts" #else #define ETC_HOST_PREFIX "/XFree86/lib/X11/X" #define ETC_HOST_SUFFIX ".hosts" #endif /* __EMX__ */ fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + strlen(display) + 1; if (fnamelen > sizeof(fname)) FatalError("Display name `%s' is too long\n"); sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display); #ifdef __EMX__ strcpy(fname, (char*)__XOS2RedirRoot(fname)); #endif /* __EMX__ */ if (fd = fopen (fname, "r")) { while (fgets (ohostname, sizeof (ohostname), fd)) { if (*ohostname == '#') continue; if (ptr = strchr(ohostname, '\n')) *ptr = 0; #ifdef __EMX__ if (ptr = strchr(ohostname, '\r')) *ptr = 0; #endif hostlen = strlen(ohostname) + 1; for (i = 0; i < hostlen; i++) lhostname[i] = tolower(ohostname[i]); hostname = ohostname; if (!strncmp("local:", lhostname, 6)) { family = FamilyLocalHost; NewHost(family, "", 0); } #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) else if (!strncmp("inet:", lhostname, 5)) { family = FamilyInternet; hostname = ohostname + 5; } #endif #ifdef DNETCONN else if (!strncmp("dnet:", lhostname, 5)) { family = FamilyDECnet; hostname = ohostname + 5; } #endif #ifdef SECURE_RPC else if (!strncmp("nis:", lhostname, 4)) { family = FamilyNetname; hostname = ohostname + 4; } #endif #ifdef K5AUTH else if (!strncmp("krb:", lhostname, 4)) { family = FamilyKrb5Principal; hostname = ohostname + 4; } #endif #ifdef DNETCONN if ((family == FamilyDECnet) || (ptr = strchr(hostname, ':')) && (*(ptr + 1) == ':') && !(*ptr = '\0')) /* bash trailing colons if necessary */ { /* node name (DECnet names end in "::") */ dnaddrp = dnet_addr(hostname); if (!dnaddrp && (np = getnodebyname (hostname))) { /* node was specified by name */ saddr.sa.sa_family = np->n_addrtype; len = sizeof(saddr.sa); if (ConvertAddr (&saddr.sa, &len, (pointer *)&addr) == FamilyDECnet) { bzero ((char *) &dnaddr, sizeof (dnaddr)); dnaddr.a_len = np->n_length; acopy (np->n_addr, dnaddr.a_addr, np->n_length); dnaddrp = &dnaddr; } } if (dnaddrp) (void) NewHost(FamilyDECnet, (pointer)dnaddrp, (int)(dnaddrp->a_len + sizeof(dnaddrp->a_len))); } else #endif /* DNETCONN */ #ifdef K5AUTH if (family == FamilyKrb5Principal) { krb5_parse_name(hostname, &princ); XauKrb5Encode(princ, &kbuf); (void) NewHost(FamilyKrb5Principal, kbuf.data, kbuf.length); krb5_free_principal(princ); } else #endif #ifdef SECURE_RPC if ((family == FamilyNetname) || (strchr(hostname, '@'))) { SecureRPCInit (); (void) NewHost (FamilyNetname, hostname, strlen (hostname)); } else #endif /* SECURE_RPC */ #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) { /* host name */ if (family == FamilyInternet && (hp = gethostbyname (hostname)) || (hp = gethostbyname (hostname))) { saddr.sa.sa_family = hp->h_addrtype; len = sizeof(saddr.sa); if ((family = ConvertAddr (&saddr.sa, &len, (pointer *)&addr)) != -1) { #ifdef h_addr /* new 4.3bsd version of gethostent */ char **list; /* iterate over the addresses */ for (list = hp->h_addr_list; *list; list++) (void) NewHost (family, (pointer)*list, len); #else (void) NewHost (family, (pointer)hp->h_addr, len); #endif } } } #endif /* TCPCONN || STREAMSCONN */ family = FamilyWild; } fclose (fd); } } /* Is client on the local host */ Bool LocalClient(client) ClientPtr client; { int alen, family, notused; Xtransaddr *from = NULL; pointer addr; register HOST *host; #ifdef XCSECURITY /* untrusted clients can't change host access */ if (client->trustLevel != XSecurityClientTrusted) { SecurityAudit("client %d attempted to change host access\n", client->index); return FALSE; } #endif #ifdef LBX if (!((OsCommPtr)client->osPrivate)->trans_conn) return FALSE; #endif if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn, ¬used, &alen, &from)) { family = ConvertAddr ((struct sockaddr *) from, &alen, (pointer *)&addr); if (family == -1) { xfree ((char *) from); return FALSE; } if (family == FamilyLocal) { xfree ((char *) from); return TRUE; } for (host = selfhosts; host; host = host->next) { if (addrEqual (family, addr, alen, host)) return TRUE; } xfree ((char *) from); } return FALSE; } static Bool AuthorizedClient(client) ClientPtr client; { if (!client || defeatAccessControl) return TRUE; return LocalClient(client); } /* Add a host to the access control list. This is the external interface * called from the dispatcher */ int AddHost (client, family, length, pAddr) ClientPtr client; int family; unsigned length; /* of bytes in pAddr */ pointer pAddr; { int len; if (!AuthorizedClient(client)) return(BadAccess); switch (family) { case FamilyLocalHost: len = length; LocalHostEnabled = TRUE; break; #ifdef K5AUTH case FamilyKrb5Principal: len = length; break; #endif #ifdef SECURE_RPC case FamilyNetname: len = length; SecureRPCInit (); break; #endif case FamilyInternet: case FamilyDECnet: case FamilyChaos: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; return (BadValue); } break; case FamilyLocal: default: client->errorValue = family; return (BadValue); } if (NewHost (family, pAddr, len)) return Success; return BadAlloc; } Bool #if NeedFunctionPrototypes ForEachHostInFamily ( int family, Bool (*func)( #if NeedNestedPrototypes unsigned char * /* addr */, short /* len */, pointer /* closure */ #endif ), pointer closure) #else ForEachHostInFamily (family, func, closure) int family; Bool (*func)(); pointer closure; #endif { HOST *host; for (host = validhosts; host; host = host->next) if (family == host->family && func (host->addr, host->len, closure)) return TRUE; return FALSE; } /* Add a host to the access control list. This is the internal interface * called when starting or resetting the server */ static Bool NewHost (family, addr, len) int family; pointer addr; int len; { register HOST *host; for (host = validhosts; host; host = host->next) { if (addrEqual (family, addr, len, host)) return TRUE; } MakeHost(host,len) if (!host) return FALSE; host->family = family; host->len = len; acopy(addr, host->addr, len); host->next = validhosts; validhosts = host; return TRUE; } /* Remove a host from the access control list */ int RemoveHost (client, family, length, pAddr) ClientPtr client; int family; unsigned length; /* of bytes in pAddr */ pointer pAddr; { int len; register HOST *host, **prev; if (!AuthorizedClient(client)) return(BadAccess); switch (family) { case FamilyLocalHost: len = length; LocalHostEnabled = FALSE; break; #ifdef K5AUTH case FamilyKrb5Principal: len = length; break; #endif #ifdef SECURE_RPC case FamilyNetname: len = length; break; #endif case FamilyInternet: case FamilyDECnet: case FamilyChaos: if ((len = CheckAddr (family, pAddr, length)) < 0) { client->errorValue = length; return(BadValue); } break; case FamilyLocal: default: client->errorValue = family; return(BadValue); } for (prev = &validhosts; (host = *prev) && (!addrEqual (family, pAddr, len, host)); prev = &host->next) ; if (host) { *prev = host->next; FreeHost (host); } return (Success); } /* Get all hosts in the access control list */ int GetHosts (data, pnHosts, pLen, pEnabled) pointer *data; int *pnHosts; int *pLen; BOOL *pEnabled; { int len; register int n = 0; register unsigned char *ptr; register HOST *host; int nHosts = 0; *pEnabled = AccessEnabled ? EnableAccess : DisableAccess; for (host = validhosts; host; host = host->next) { nHosts++; n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry); } if (n) { *data = ptr = (pointer) xalloc (n); if (!ptr) { return(BadAlloc); } for (host = validhosts; host; host = host->next) { len = host->len; ((xHostEntry *)ptr)->family = host->family; ((xHostEntry *)ptr)->length = len; ptr += sizeof(xHostEntry); acopy (host->addr, ptr, len); ptr += ((len + 3) >> 2) << 2; } } else { *data = NULL; } *pnHosts = nHosts; *pLen = n; return(Success); } /* Check for valid address family and length, and return address length. */ /*ARGSUSED*/ static int CheckAddr (family, pAddr, length) int family; pointer pAddr; unsigned length; { int len; switch (family) { #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) || defined(MNX_TCPCONN) case FamilyInternet: #if !defined(AMOEBA) if (length == sizeof (struct in_addr)) #else if (length == sizeof(ipaddr_t)) #endif len = length; else len = -1; break; #endif #ifdef DNETCONN case FamilyDECnet: { struct dn_naddr *dnaddr = (struct dn_naddr *) pAddr; if ((length < sizeof(dnaddr->a_len)) || (length < dnaddr->a_len + sizeof(dnaddr->a_len))) len = -1; else len = dnaddr->a_len + sizeof(dnaddr->a_len); if (len > sizeof(struct dn_naddr)) len = -1; } break; #endif default: len = -1; } return (len); } /* Check if a host is not in the access control list. * Returns 1 if host is invalid, 0 if we've found it. */ InvalidHost (saddr, len) #ifndef AMOEBA_ORIG register struct sockaddr *saddr; #else register ipaddr_t *saddr; #endif int len; { int family; pointer addr; register HOST *selfhost, *host; if (!AccessEnabled) /* just let them in */ return(0); family = ConvertAddr (saddr, &len, (pointer *)&addr); if (family == -1) return 1; if (family == FamilyLocal) { if (!LocalHostEnabled) { /* * check to see if any local address is enabled. This * implicitly enables local connections. */ for (selfhost = selfhosts; selfhost; selfhost=selfhost->next) { for (host = validhosts; host; host=host->next) { if (addrEqual (selfhost->family, selfhost->addr, selfhost->len, host)) return 0; } } return 1; } else return 0; } for (host = validhosts; host; host = host->next) { if (addrEqual (family, addr, len, host)) return (0); } return (1); } static int ConvertAddr (saddr, len, addr) #ifndef AMOEBA_ORIG register struct sockaddr *saddr; #else register ipaddr_t *saddr; #endif int *len; pointer *addr; { #ifndef AMOEBA if (*len == 0) return (FamilyLocal); switch (saddr->sa_family) { case AF_UNSPEC: #if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) case AF_UNIX: #endif return FamilyLocal; #if defined(TCPCONN) || defined(STREAMSCONN) || defined(MNX_TCPCONN) case AF_INET: *len = sizeof (struct in_addr); *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr); return FamilyInternet; #endif #ifdef DNETCONN case AF_DECnet: { struct sockaddr_dn *sdn = (struct sockaddr_dn *) saddr; *len = sdn->sdn_nodeaddrl + sizeof(sdn->sdn_nodeaddrl); *addr = (pointer) &(sdn->sdn_add); } return FamilyDECnet; #endif #ifdef CHAOSCONN case AF_CHAOS: { not implemented } return FamilyChaos; #endif default: return -1; } #else /* AMOEBA */ if (*len == 0) return -1; *len = sizeof (ipaddr_t); *addr = (pointer) saddr; return FamilyInternet; #endif /* AMOEBA */ } int ChangeAccessControl(client, fEnabled) ClientPtr client; int fEnabled; { if (!AuthorizedClient(client)) return BadAccess; AccessEnabled = fEnabled; return Success; } /* returns FALSE if xhost + in effect, else TRUE */ int GetAccessControl() { return AccessEnabled; } vnc_unixsrc/Xvnc/programs/Xserver/os/auth.c0100664000076400007640000002235507120677563020450 0ustar constconst/* $XConsortium: auth.c /main/27 1996/12/02 10:22:41 lehors $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * authorization hooks for the server * Author: Keith Packard, MIT X Consortium */ #ifdef K5AUTH # include #endif # include "X.h" # include "Xauth.h" # include "misc.h" # include "dixstruct.h" # include # include #ifdef XCSECURITY #define _SECURITY_SERVER # include "extensions/security.h" #endif #ifdef WIN32 #include "Xw32defs.h" #endif struct protocol { unsigned short name_length; char *name; int (*Add)(); /* new authorization data */ XID (*Check)(); /* verify client authorization data */ int (*Reset)(); /* delete all authorization data entries */ XID (*ToID)(); /* convert cookie to ID */ int (*FromID)(); /* convert ID to cookie */ int (*Remove)(); /* remove a specific cookie */ #ifdef XCSECURITY XID (*Generate)(); #endif }; extern int MitAddCookie (); extern XID MitCheckCookie (); extern int MitResetCookie (); extern XID MitToID (); extern int MitFromID (), MitRemoveCookie (); extern XID MitGenerateCookie(); #ifdef HASXDMAUTH extern int XdmAddCookie (); extern XID XdmCheckCookie (); extern int XdmResetCookie (); extern XID XdmToID (); extern int XdmFromID (), XdmRemoveCookie (); #endif #ifdef SECURE_RPC extern int SecureRPCAdd(); extern XID SecureRPCCheck(); extern int SecureRPCReset(); extern XID SecureRPCToID(); extern int SecureRPCFromID(), SecureRPCRemove(); #endif #ifdef K5AUTH extern int K5Add(); extern XID K5Check(); extern int K5Reset(); extern XID K5ToID(); extern int K5FromID(), K5Remove(); #endif extern XID AuthSecurityCheck(); static struct protocol protocols[] = { { (unsigned short) 18, "MIT-MAGIC-COOKIE-1", MitAddCookie, MitCheckCookie, MitResetCookie, MitToID, MitFromID, MitRemoveCookie, #ifdef XCSECURITY MitGenerateCookie #endif }, #ifdef HASXDMAUTH { (unsigned short) 19, "XDM-AUTHORIZATION-1", XdmAddCookie, XdmCheckCookie, XdmResetCookie, XdmToID, XdmFromID, XdmRemoveCookie, #ifdef XCSECURITY NULL #endif }, #endif #ifdef SECURE_RPC { (unsigned short) 9, "SUN-DES-1", SecureRPCAdd, SecureRPCCheck, SecureRPCReset, SecureRPCToID, SecureRPCFromID,SecureRPCRemove, #ifdef XCSECURITY NULL #endif }, #endif #ifdef K5AUTH { (unsigned short) 14, "MIT-KERBEROS-5", K5Add, K5Check, K5Reset, K5ToID, K5FromID, K5Remove, #ifdef XCSECURITY NULL #endif }, #endif #ifdef XCSECURITY { (unsigned short) XSecurityAuthorizationNameLen, XSecurityAuthorizationName, NULL, AuthSecurityCheck, NULL, NULL, NULL, NULL, NULL }, #endif }; # define NUM_AUTHORIZATION (sizeof (protocols) /\ sizeof (struct protocol)) /* * Initialize all classes of authorization by reading the * specified authorization file */ static char *authorization_file = (char *)NULL; static Bool ShouldLoadAuth = TRUE; void InitAuthorization (file_name) char *file_name; { authorization_file = file_name; } int LoadAuthorization () { FILE *f; Xauth *auth; int i; int count = 0; ShouldLoadAuth = FALSE; if (!authorization_file) return 0; f = fopen (authorization_file, "r"); if (!f) return 0; while (auth = XauReadAuth (f)) { for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == auth->name_length && memcmp (protocols[i].name, auth->name, (int) auth->name_length) == 0 && protocols[i].Add) { ++count; (*protocols[i].Add) (auth->data_length, auth->data, FakeClientID(0)); } } XauDisposeAuth (auth); } fclose (f); return count; } #ifdef XDMCP /* * XdmcpInit calls this function to discover all authorization * schemes supported by the display */ void RegisterAuthorizations () { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) XdmcpRegisterAuthorization (protocols[i].name, (int)protocols[i].name_length); } #endif XID CheckAuthorization (name_length, name, data_length, data, client, reason) unsigned int name_length; char *name; unsigned int data_length; char *data; ClientPtr client; char **reason; /* failure message. NULL for default msg */ { int i; struct stat buf; static time_t lastmod = 0; if (!authorization_file || stat(authorization_file, &buf)) { lastmod = 0; ShouldLoadAuth = TRUE; /* stat lost, so force reload */ } else if (buf.st_mtime > lastmod) { lastmod = buf.st_mtime; ShouldLoadAuth = TRUE; } if (ShouldLoadAuth) { if (LoadAuthorization()) DisableLocalHost(); /* got at least one */ else EnableLocalHost (); } if (name_length) for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0) { return (*protocols[i].Check) (data_length, data, client, reason); } } return (XID) ~0L; } void ResetAuthorization () { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) if (protocols[i].Reset) (*protocols[i].Reset)(); ShouldLoadAuth = TRUE; } XID AuthorizationToID (name_length, name, data_length, data) unsigned short name_length; char *name; unsigned short data_length; char *data; { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].ToID) { return (*protocols[i].ToID) (data_length, data); } } return (XID) ~0L; } int AuthorizationFromID (id, name_lenp, namep, data_lenp, datap) XID id; unsigned short *name_lenp; char **namep; unsigned short *data_lenp; char **datap; { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].FromID && (*protocols[i].FromID) (id, data_lenp, datap)) { *name_lenp = protocols[i].name_length; *namep = protocols[i].name; return 1; } } return 0; } int RemoveAuthorization (name_length, name, data_length, data) unsigned short name_length; char *name; unsigned short data_length; char *data; { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Remove) { return (*protocols[i].Remove) (data_length, data); } } return 0; } int AddAuthorization (name_length, name, data_length, data) unsigned int name_length; char *name; unsigned int data_length; char *data; { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Add) { return (*protocols[i].Add) (data_length, data, FakeClientID(0)); } } return 0; } #ifdef XCSECURITY XID GenerateAuthorization(name_length, name, data_length, data, data_length_return, data_return) unsigned int name_length; char *name; unsigned int data_length; char *data; unsigned int *data_length_return; char **data_return; { int i; for (i = 0; i < NUM_AUTHORIZATION; i++) { if (protocols[i].name_length == name_length && memcmp (protocols[i].name, name, (int) name_length) == 0 && protocols[i].Generate) { return (*protocols[i].Generate) (data_length, data, FakeClientID(0), data_length_return, data_return); } } return -1; } /* A random number generator that is more unpredictable than that shipped with some systems. This code is taken from the C standard. */ static unsigned long int next = 1; static int xdm_rand() { next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768; } static void xdm_srand(seed) unsigned int seed; { next = seed; } void GenerateRandomData (len, buf) int len; char *buf; { static int seed; int value; int i; seed += GetTimeInMillis(); xdm_srand (seed); for (i = 0; i < len; i++) { value = xdm_rand (); buf[i] ^= (value & 0xff00) >> 8; } /* XXX add getrusage, popen("ps -ale") */ } #endif /* XCSECURITY */ vnc_unixsrc/Xvnc/programs/Xserver/os/k5auth.c0100664000076400007640000005012507120677563020704 0ustar constconst/* $XConsortium: k5auth.c,v 1.9 95/04/06 16:10:29 mor Exp $ */ /* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.2 1996/05/10 07:02:15 dawes Exp $ */ /* Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Kerberos V5 authentication scheme * Author: Tom Yu * * Mostly snarfed wholesale from the user_user demo in the * krb5 distribution. (At least the checking part) */ #include #include #ifdef TCPCONN #include #endif #ifdef DNETCONN #include #endif #include #include /* 9/93: krb5.h leaks some symbols */ #undef BITS32 #undef xfree #include #include "X.h" #include "os.h" #include "osdep.h" #include "Xproto.h" #include "Xfuncs.h" #include "dixstruct.h" #include #include "Xauth.h" extern int (*k5_Vector[256])(); extern int SendConnSetup(); extern char *display; /* need this to generate rcache name */ static XID krb5_id = ~0L; static krb5_principal srvname = NULL; /* service name */ static char *ccname = NULL; static char *ktname = NULL; /* key table name */ static char kerror[256]; /* * tgt_keyproc: * * extract session key from a credentials struct */ krb5_error_code tgt_keyproc(keyprocarg, principal, vno, key) krb5_pointer keyprocarg; krb5_principal principal; krb5_kvno vno; krb5_keyblock **key; { krb5_creds *creds = (krb5_creds *)keyprocarg; return krb5_copy_keyblock(&creds->keyblock, key); } /* * k5_cmpenc: * * compare "encoded" principals */ Bool k5_cmpenc(pname, plen, buf) unsigned char *pname; short plen; krb5_data *buf; { return (plen == buf->length && memcmp(pname, buf->data, plen) == 0); } /* * K5Check: * * This is stage 0 of the krb5 authentication protocol. It * goes through the current credentials cache and extracts the * primary principal and tgt to send to the client, or as * appropriate, extracts from a keytab. * * The packet sent to the client has the following format: * * CARD8 reqType = 2 * CARD8 data = 0 * CARD16 length = total length of packet (in 32 bit units) * CARD16 plen = length of encoded principal following * STRING8 princ = encoded principal * STRING8 ticket = server tgt * * For client-server authentication, the packet is as follows: * * CARD8 reqType = 3 * CARD8 data = 0 * CARD16 length = total length * STRING8 princ = encoded principal of server */ XID K5Check(data_length, data, client, reason) unsigned short data_length; char *data; ClientPtr client; char **reason; { krb5_error_code retval; CARD16 tlen; krb5_principal sprinc, cprinc; krb5_ccache cc; krb5_creds *creds; char *outbuf, *cp; krb5_data princ; register char n; xReq prefix; if (krb5_id == ~0L) return ~0L; if (!ccname && !srvname) return ~0L; if (ccname) { if ((creds = (krb5_creds *)malloc(sizeof(krb5_creds))) == NULL) return ~0L; if (retval = krb5_cc_resolve(ccname, &cc)) return ~0L; bzero((char*)creds, sizeof (krb5_creds)); if (retval = krb5_cc_get_principal(cc, &cprinc)) { krb5_free_creds(creds); krb5_cc_close(cc); return ~0L; } creds->client = cprinc; if (retval = krb5_build_principal_ext(&sprinc, krb5_princ_realm(creds->client)->length, krb5_princ_realm(creds->client)->data, 6, "krbtgt", krb5_princ_realm(creds->client)->length, krb5_princ_realm(creds->client)->data, 0)) { krb5_free_creds(creds); krb5_cc_close(cc); return ~0L; } creds->server = sprinc; retval = krb5_get_credentials(KRB5_GC_CACHED, cc, creds); krb5_cc_close(cc); if (retval) { krb5_free_creds(creds); return ~0L; } if (retval = XauKrb5Encode(cprinc, &princ)) { krb5_free_creds(creds); return ~0L; } tlen = sz_xReq + 2 + princ.length + creds->ticket.length; prefix.reqType = 2; /* opcode = authenticate user-to-user */ } else if (srvname) { if (retval = XauKrb5Encode(srvname, &princ)) { return ~0L; } tlen = sz_xReq + princ.length; prefix.reqType = 3; /* opcode = authenticate client-server */ } prefix.data = 0; /* stage = 0 */ prefix.length = (tlen + 3) >> 2; /* round up to nearest multiple of 4 bytes */ if (client->swapped) { swaps(&prefix.length, n); } if ((cp = outbuf = (char *)malloc(tlen)) == NULL) { if (ccname) { krb5_free_creds(creds); } free(princ.data); return ~0L; } memcpy(cp, &prefix, sz_xReq); cp += sz_xReq; if (ccname) { memcpy(cp, &princ.length, 2); if (client->swapped) { swaps((CARD16 *)cp, n); } cp += 2; } memcpy(cp, princ.data, princ.length); cp += princ.length; free(princ.data); /* we don't need that anymore */ if (ccname) memcpy(cp, creds->ticket.data, creds->ticket.length); WriteToClient(client, tlen, outbuf); free(outbuf); client->requestVector = k5_Vector; /* hack in our dispatch vector */ client->clientState = ClientStateAuthenticating; if (ccname) { ((OsCommPtr)client->osPrivate)->authstate.srvcreds = (pointer)creds; /* save tgt creds */ ((OsCommPtr)client->osPrivate)->authstate.ktname = NULL; ((OsCommPtr)client->osPrivate)->authstate.srvname = NULL; } if (srvname) { ((OsCommPtr)client->osPrivate)->authstate.srvcreds = NULL; ((OsCommPtr)client->osPrivate)->authstate.ktname = (pointer)ktname; ((OsCommPtr)client->osPrivate)->authstate.srvname = (pointer)srvname; } ((OsCommPtr)client->osPrivate)->authstate.stageno = 1; /* next stage is 1 */ return krb5_id; } /* * k5_stage1: * * This gets called out of the dispatcher after K5Check frobs with the * client->requestVector. It accepts the ap_req from the client and verifies * it. In addition, if the client has set AP_OPTS_MUTUAL_REQUIRED, it then * sends an ap_rep to the client to achieve mutual authentication. * * client stage1 packet format is as follows: * * CARD8 reqType = 1 * CARD8 data = ignored * CARD16 length = total length * STRING8 data = the actual ap_req * * stage2 packet sent back to client for mutual authentication: * * CARD8 reqType = 2 * CARD8 data = 2 * CARD16 length = total length * STRING8 data = the ap_rep */ int k5_stage1(client) register ClientPtr client; { long addrlen; krb5_error_code retval, retval2; register char n; struct sockaddr cli_net_addr; xReq prefix; krb5_principal cprinc; krb5_data buf; krb5_creds *creds = (krb5_creds *)((OsCommPtr)client->osPrivate)->authstate.srvcreds; krb5_keyblock *skey; krb5_address cli_addr, **localaddrs = NULL; krb5_tkt_authent *authdat; krb5_ap_rep_enc_part rep; krb5_int32 ctime, cusec; krb5_rcache rcache = NULL; char *cachename = NULL, *rc_type = NULL, *rc_base = "rcX", *kt = NULL; REQUEST(xReq); if (((OsCommPtr)client->osPrivate)->authstate.stageno != 1) { if (creds) krb5_free_creds(creds); return(SendConnSetup(client, "expected Krb5 stage1 packet")); } addrlen = sizeof (cli_net_addr); if (getpeername(((OsCommPtr)client->osPrivate)->fd, &cli_net_addr, &addrlen) == -1) { if (creds) krb5_free_creds(creds); return(SendConnSetup(client, "Krb5 stage1: getpeername failed")); } if (cli_net_addr.sa_family == AF_UNSPEC #if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) || cli_net_addr.sa_family == AF_UNIX #endif ) /* assume local host */ { krb5_os_localaddr(&localaddrs); if (!localaddrs || !localaddrs[0]) { if (creds) krb5_free_creds(creds); return(SendConnSetup(client, "Krb5 failed to get localaddrs")); } cli_addr.addrtype = localaddrs[0]->addrtype; cli_addr.length = localaddrs[0]->length; cli_addr.contents = localaddrs[0]->contents; } else { cli_addr.addrtype = cli_net_addr.sa_family; /* the values are compatible */ switch (cli_net_addr.sa_family) { #ifdef TCPCONN case AF_INET: cli_addr.length = sizeof (struct in_addr); cli_addr.contents = (krb5_octet *)&((struct sockaddr_in *)&cli_net_addr)->sin_addr; break; #endif #ifdef DNETCONN case AF_DECnet: cli_addr.length = sizeof (struct dn_naddr); cli_addr.contents = (krb5_octet *)&((struct sockaddr_dn *)&cli_net_addr)->sdn_add; break; #endif default: if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); sprintf(kerror, "Krb5 stage1: unknown address family %d from getpeername", cli_net_addr.sa_family); return(SendConnSetup(client, kerror)); } } if ((rcache = (krb5_rcache)malloc(sizeof(*rcache))) == NULL) { if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); return(SendConnSetup(client, "malloc bombed for krb5_rcache")); } if ((rc_type = krb5_rc_default_type()) == NULL) rc_type = "dfl"; if (retval = krb5_rc_resolve_type(&rcache, rc_type)) { if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); free(rcache); strcpy(kerror, "krb5_rc_resolve_type failed: "); strncat(kerror, error_message(retval), 231); return(SendConnSetup(client, kerror)); } if ((cachename = (char *)malloc(strlen(rc_base) + strlen(display) + 1)) == NULL) { if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); free(rcache); return(SendConnSetup(client, "Krb5: malloc bombed for cachename")); } strcpy(cachename, rc_base); strcat(cachename, display); if (retval = krb5_rc_resolve(rcache, cachename)) { if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); free(rcache); free(cachename); strcpy(kerror, "krb5_rc_resolve failed: "); strncat(kerror, error_message(retval), 236); return(SendConnSetup(client, kerror)); } free(cachename); if (krb5_rc_recover(rcache)) { extern krb5_deltat krb5_clockskew; if (retval = krb5_rc_initialize(rcache, krb5_clockskew)) { if (localaddrs) krb5_free_addresses(localaddrs); if (creds) krb5_free_creds(creds); if (retval2 = krb5_rc_close(rcache)) { strcpy(kerror, "krb5_rc_close failed: "); strncat(kerror, error_message(retval2), 238); return(SendConnSetup(client, kerror)); } free(rcache); strcpy(kerror, "krb5_rc_initialize failed: "); strncat(kerror, error_message(retval), 233); return(SendConnSetup(client, kerror)); } } buf.length = (stuff->length << 2) - sz_xReq; buf.data = (char *)stuff + sz_xReq; if (creds) { retval = krb5_rd_req(&buf, NULL, /* don't bother with server name */ &cli_addr, NULL, /* no fetchfrom */ tgt_keyproc, creds, /* credentials as arg to keyproc */ rcache, &authdat); krb5_free_creds(creds); } else if (kt = (char *)((OsCommPtr)client->osPrivate)->authstate.ktname) { retval = krb5_rd_req(&buf, srvname, &cli_addr, kt, NULL, NULL, rcache, &authdat); ((OsCommPtr)client->osPrivate)->authstate.ktname = NULL; } else { if (localaddrs) krb5_free_addresses(localaddrs); return(SendConnSetup(client, "Krb5: neither srvcreds nor ktname set")); } if (localaddrs) krb5_free_addresses(localaddrs); if (rcache) { if (retval2 = krb5_rc_close(rcache)) { strcpy(kerror, "krb5_rc_close failed (2): "); strncat(kerror, error_message(retval2), 230); return(SendConnSetup(client, kerror)); } free(rcache); } if (retval) { strcpy(kerror, "Krb5: Bad application request: "); strncat(kerror, error_message(retval), 224); return(SendConnSetup(client, kerror)); } cprinc = authdat->ticket->enc_part2->client; skey = authdat->ticket->enc_part2->session; if (XauKrb5Encode(cprinc, &buf)) { krb5_free_tkt_authent(authdat); return(SendConnSetup(client, "XauKrb5Encode bombed")); } /* * Now check to see if the principal we got is one that we want to let in */ if (ForEachHostInFamily(FamilyKrb5Principal, k5_cmpenc, (pointer)&buf)) { free(buf.data); /* * The following deals with sending an ap_rep to the client to * achieve mutual authentication. The client sends back a stage 3 * packet if all is ok. */ if (authdat->ap_options | AP_OPTS_MUTUAL_REQUIRED) { /* * stage 2: send ap_rep to client */ if (retval = krb5_us_timeofday(&ctime, &cusec)) { krb5_free_tkt_authent(authdat); strcpy(kerror, "error in krb5_us_timeofday: "); strncat(kerror, error_message(retval), 234); return(SendConnSetup(client, kerror)); } rep.ctime = ctime; rep.cusec = cusec; rep.subkey = NULL; rep.seq_number = 0; if (retval = krb5_mk_rep(&rep, skey, &buf)) { krb5_free_tkt_authent(authdat); strcpy(kerror, "error in krb5_mk_rep: "); strncat(kerror, error_message(retval), 238); return(SendConnSetup(client, kerror)); } prefix.reqType = 2; /* opcode = authenticate */ prefix.data = 2; /* stage = 2 */ prefix.length = (buf.length + sz_xReq + 3) >> 2; if (client->swapped) { swaps(&prefix.length, n); } WriteToClient(client, sz_xReq, (char *)&prefix); WriteToClient(client, buf.length, buf.data); free(buf.data); krb5_free_tkt_authent(authdat); ((OsCommPtr)client->osPrivate)->authstate.stageno = 3; /* expect stage3 packet */ return(Success); } else { free(buf.data); krb5_free_tkt_authent(authdat); return(SendConnSetup(client, NULL)); /* success! */ } } else { char *kname; krb5_free_tkt_authent(authdat); free(buf.data); retval = krb5_unparse_name(cprinc, &kname); if (retval == 0) { sprintf(kerror, "Principal \"%s\" is not authorized to connect", kname); if (kname) free(kname); return(SendConnSetup(client, kerror)); } else return(SendConnSetup(client,"Principal is not authorized to connect to Server")); } } /* * k5_stage3: * * Get the short ack packet from the client. This packet can conceivably * be expanded to allow for switching on end-to-end encryption. * * stage3 packet format: * * CARD8 reqType = 3 * CARD8 data = ignored (for now) * CARD16 length = should be zero */ int k5_stage3(client) register ClientPtr client; { REQUEST(xReq); if (((OsCommPtr)client->osPrivate)->authstate.stageno != 3) { return(SendConnSetup(client, "expected Krb5 stage3 packet")); } else return(SendConnSetup(client, NULL)); /* success! */ } k5_bad(client) register ClientPtr client; { if (((OsCommPtr)client->osPrivate)->authstate.srvcreds) krb5_free_creds((krb5_creds *)((OsCommPtr)client->osPrivate)->authstate.srvcreds); sprintf(kerror, "unrecognized Krb5 auth packet %d, expecting %d", ((xReq *)client->requestBuffer)->reqType, ((OsCommPtr)client->osPrivate)->authstate.stageno); return(SendConnSetup(client, kerror)); } /* * K5Add: * * Takes the name of a credentials cache and resolves it. Also adds the * primary principal of the ccache to the acl. * * Now will also take a service name. */ int K5Add(data_length, data, id) unsigned short data_length; char *data; XID id; { krb5_principal princ; krb5_error_code retval; krb5_keytab_entry tmp_entry; krb5_keytab keytab; krb5_kvno kvno = 0; krb5_ccache cc; char *nbuf, *cp; krb5_data kbuf; int i, ktlen; krb5_init_ets(); /* can't think of a better place to put it */ krb5_id = ~0L; if (data_length < 3) return 0; if ((nbuf = (char *)malloc(data_length - 2)) == NULL) return 0; memcpy(nbuf, data + 3, data_length - 3); nbuf[data_length - 3] = '\0'; if (ccname) { free(ccname); ccname = NULL; } if (srvname) { krb5_free_principal(srvname); srvname = NULL; } if (ktname) { free(ktname); ktname = NULL; } if (!strncmp(data, "UU:", 3)) { if (retval = krb5_cc_resolve(nbuf, &cc)) { ErrorF("K5Add: krb5_cc_resolve of \"%s\" failed: %s\n", nbuf, error_message(retval)); free(nbuf); return 0; } if (cc && !(retval = krb5_cc_get_principal(cc, &princ))) { if (XauKrb5Encode(princ, &kbuf)) { free(nbuf); krb5_free_principal(princ); krb5_cc_close(cc); return 0; } if (krb5_cc_close(cc)) return 0; AddHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data); krb5_free_principal(princ); free(kbuf.data); ccname = nbuf; krb5_id = id; return 1; } else { ErrorF("K5Add: getting principal from cache \"%s\" failed: %s\n", nbuf, error_message(retval)); } } else if (!strncmp(data, "CS:", 3)) { if ((cp = strchr(nbuf, ',')) == NULL) { free(nbuf); return 0; } *cp = '\0'; /* gross but it works :-) */ ktlen = strlen(cp + 1); if ((ktname = (char *)malloc(ktlen + 1)) == NULL) { free(nbuf); return 0; } strcpy(ktname, cp + 1); retval = krb5_sname_to_principal(NULL, /* NULL for hostname uses local host name*/ nbuf, KRB5_NT_SRV_HST, &srvname); free(nbuf); if (retval) { free(ktname); ktname = NULL; return 0; } if (retval = krb5_kt_resolve(ktname, &keytab)) { free(ktname); ktname = NULL; krb5_free_principal(srvname); srvname = NULL; return 0; } retval = krb5_kt_get_entry(keytab, srvname, kvno, &tmp_entry); krb5_kt_free_entry(&tmp_entry); if (retval) { free(ktname); ktname = NULL; krb5_free_principal(srvname); srvname = NULL; return 0; } if (XauKrb5Encode(srvname, &kbuf)) { free(ktname); ktname = NULL; krb5_free_principal(srvname); srvname = NULL; return 0; } AddHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data); krb5_id = id; return 1; } else { ErrorF("K5Add: credentials cache name \"%.*s\" in auth file: unknown type\n", data_length, data); } return 0; } /* * K5Reset: * * Reset krb5_id, also nuke the current principal from the acl. */ int K5Reset() { krb5_principal princ; krb5_error_code retval; krb5_ccache cc; krb5_data kbuf; int i; if (ccname) { if (retval = krb5_cc_resolve(ccname, &cc)) { free(ccname); ccname = NULL; } if (cc && !(retval = krb5_cc_get_principal(cc, &princ))) { if (XauKrb5Encode(princ, &kbuf)) return 1; RemoveHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data); krb5_free_principal(princ); free(kbuf.data); if (krb5_cc_close(cc)) return 1; free(ccname); ccname = NULL; } } if (srvname) { if (XauKrb5Encode(srvname, &kbuf)) return 1; RemoveHost(NULL, FamilyKrb5Principal, kbuf.length, kbuf.data); krb5_free_principal(srvname); free(kbuf.data); srvname = NULL; } if (ktname) { free(ktname); ktname = NULL; } krb5_id = ~0L; return 0; } XID K5ToID(data_length, data) unsigned short data_length; char *data; { return krb5_id; } int K5FromID(id, data_lenp, datap) XID id; unsigned short *data_lenp; char **datap; { return 0; } int K5Remove(data_length, data) unsigned short data_length; char *data; { return 0; } vnc_unixsrc/Xvnc/programs/Xserver/os/decompress.c0100664000076400007640000002230507120677563021646 0ustar constconst/* $XConsortium: decompress.c,v 1.5 94/04/17 20:26:57 dpw Exp $ */ /* Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * decompress - cat a compressed file */ #include #ifdef TEST #define xalloc(s) malloc(s) #define xfree(s) free(s) typedef char *FID; #include #include #include #else #include "Xos.h" #include "misc.h" #endif #define BITS 16 /* * a code_int must be able to hold 2**BITS values of type int, and also -1 */ #if BITS > 15 typedef long int code_int; #else typedef int code_int; #endif typedef long int count_int; #ifdef NO_UCHAR typedef char char_type; #else typedef unsigned char char_type; #endif /* UCHAR */ static char_type magic_header[] = { "\037\235" }; /* 1F 9D */ /* Defines for third byte of header */ #define BIT_MASK 0x1f #define BLOCK_MASK 0x80 /* Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is a fourth header byte (for expansion). */ #define INIT_BITS 9 /* initial number of bits/code */ #ifdef COMPATIBLE /* But wrong! */ # define MAXCODE(n_bits) (1 << (n_bits) - 1) #else # define MAXCODE(n_bits) ((1 << (n_bits)) - 1) #endif /* COMPATIBLE */ static code_int getcode(); /* * the next two codes should not be changed lightly, as they must not * lie within the contiguous general code space. */ #define FIRST 257 /* first free entry */ #define CLEAR 256 /* table clear output code */ #define STACK_SIZE 8192 typedef struct _compressedFILE { FILE *file; char_type *stackp; code_int oldcode; char_type finchar; int block_compress; int maxbits; code_int maxcode, maxmaxcode; code_int free_ent; int clear_flg; int n_bits; /* bit buffer */ int offset, size; char_type buf[BITS]; char_type de_stack[STACK_SIZE]; char_type *tab_suffix; unsigned short *tab_prefix; } CompressedFile; static int hsize_table[] = { 5003, /* 12 bits - 80% occupancy */ 9001, /* 13 bits - 91% occupancy */ 18013, /* 14 bits - 91% occupancy */ 35023, /* 15 bits - 94% occupancy */ 69001 /* 16 bits - 95% occupancy */ }; FID CompressedFontFileInit (f) FILE *f; { int code; int maxbits; int hsize; CompressedFile *file; int extra; if ((getc(f) != (magic_header[0] & 0xFF)) || (getc(f) != (magic_header[1] & 0xFF))) { return 0; } code = getc (f); maxbits = code & BIT_MASK; if (maxbits > BITS || maxbits < 12) return 0; hsize = hsize_table[maxbits - 12]; extra = (1 << maxbits) * sizeof (char_type) + hsize * sizeof (unsigned short); file = (CompressedFile *) xalloc (sizeof (CompressedFile) + extra); if (!file) return 0; file->file = f; file->maxbits = maxbits; file->block_compress = code & BLOCK_MASK; file->maxmaxcode = 1 << file->maxbits; file->tab_suffix = (char_type *) &file[1]; file->tab_prefix = (unsigned short *) (file->tab_suffix + file->maxmaxcode); /* * As above, initialize the first 256 entries in the table. */ file->maxcode = MAXCODE(file->n_bits = INIT_BITS); for ( code = 255; code >= 0; code-- ) { file->tab_prefix[code] = 0; file->tab_suffix[code] = (char_type) code; } file->free_ent = ((file->block_compress) ? FIRST : 256 ); file->clear_flg = 0; file->offset = 0; file->size = 0; file->stackp = file->de_stack; file->finchar = file->oldcode = getcode (file); if (file->oldcode != -1) *file->stackp++ = file->finchar; return (FID) file; } FILE * CompressedFontFileDone (fid) FID fid; { CompressedFile *file; FILE *f; file = (CompressedFile *) fid; f = file->file; xfree (file); return f; } #define getdcchar(file) ((file)->stackp > (file)->de_stack ? (*--((file)->stackp)) : _filldcbuf (file)) _filldcbuf (file) CompressedFile *file; { register char_type *stackp; register code_int code, incode; if (file->stackp > file->de_stack) return *--file->stackp; if (file->oldcode == -1) return EOF; stackp = file->stackp; code = getcode (file); if (code == -1) return EOF; if ( (code == CLEAR) && file->block_compress ) { for ( code = 255; code >= 0; code-- ) file->tab_prefix[code] = 0; file->clear_flg = 1; file->free_ent = FIRST - 1; if ( (code = getcode (file)) == -1 ) /* O, untimely death! */ return EOF; } incode = code; /* * Special case for KwKwK string. */ if ( code >= file->free_ent ) { *stackp++ = file->finchar; code = file->oldcode; } /* * Generate output characters in reverse order */ while ( code >= 256 ) { *stackp++ = file->tab_suffix[code]; code = file->tab_prefix[code]; } file->finchar = file->tab_suffix[code]; /* * Generate the new entry. */ if ( (code=file->free_ent) < file->maxmaxcode ) { file->tab_prefix[code] = (unsigned short)file->oldcode; file->tab_suffix[code] = file->finchar; file->free_ent = code+1; } /* * Remember previous code. */ file->oldcode = incode; file->stackp = stackp; return file->finchar; } /***************************************************************** * TAG( getcode ) * * Read one code from the standard input. If EOF, return -1. * Inputs: * stdin * Outputs: * code or -1 is returned. */ static char_type rmask[9] = {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; static code_int getcode(file) CompressedFile *file; { register code_int code; register int r_off, bits; register char_type *bp = file->buf; register FILE *fp; if ( file->clear_flg > 0 || file->offset >= file->size || file->free_ent > file->maxcode ) { /* * If the next entry will be too big for the current code * size, then we must increase the size. This implies reading * a new buffer full, too. */ if ( file->free_ent > file->maxcode ) { file->n_bits++; if ( file->n_bits == file->maxbits ) file->maxcode = file->maxmaxcode; /* won't get any bigger now */ else file->maxcode = MAXCODE(file->n_bits); } if ( file->clear_flg > 0) { file->maxcode = MAXCODE (file->n_bits = INIT_BITS); file->clear_flg = 0; } bits = file->n_bits; fp = file->file; while (bits > 0 && (code = getc (fp)) != EOF) { *bp++ = code; --bits; } bp = file->buf; if (bits == file->n_bits) return -1; /* end of file */ file->size = file->n_bits - bits; file->offset = 0; /* Round size down to integral number of codes */ file->size = (file->size << 3) - (file->n_bits - 1); } r_off = file->offset; bits = file->n_bits; /* * Get to the first byte. */ bp += (r_off >> 3); r_off &= 7; /* Get first part (low order bits) */ #ifdef NO_UCHAR code = ((*bp++ >> r_off) & rmask[8 - r_off]) & 0xff; #else code = (*bp++ >> r_off); #endif /* NO_UCHAR */ bits -= (8 - r_off); r_off = 8 - r_off; /* now, offset into code word */ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */ if ( bits >= 8 ) { #ifdef NO_UCHAR code |= (*bp++ & 0xff) << r_off; #else code |= *bp++ << r_off; #endif /* NO_UCHAR */ r_off += 8; bits -= 8; } /* high order bits. */ code |= (*bp & rmask[bits]) << r_off; file->offset += file->n_bits; return code; } CompressedFontFileRead (buf, itemsize, nitems, fid) char *buf; unsigned itemsize; unsigned nitems; FID fid; { CompressedFile *file; int c; int nbytes; file = (CompressedFile *) fid; nbytes = nitems * itemsize; while (nbytes) { if ((c = getdcchar (file)) == EOF) break; *buf++ = c; --nbytes; } return nitems - nbytes / itemsize; } CompressedFontFileSkip (bytes, fid) unsigned bytes; FID fid; { int c; while (bytes-- && ((c = getdcchar((CompressedFile *)fid)) != EOF)) ; return c; } #ifdef TEST main () { CompressedFile *input; int c; input = (CompressedFile *) CompressedFontFileInit (stdin); while ((c = getdcchar (input)) != -1) putchar (c); } #endif vnc_unixsrc/Xvnc/programs/Xserver/os/Imakefile0100664000076400007640000001054207120677563021147 0ustar constconstXCOMM $XConsortium: Imakefile /main/84 1996/12/15 21:26:59 rws $ XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.18.2.2 1998/02/21 06:07:15 robin Exp $ #include /* * If you have any extra files to be put into the library, define them here. */ #ifdef HPArchitecture #define OtherSources hpsocket.c #define OtherObjects hpsocket.o #endif #ifdef AmoebaArchitecture #define OtherSources iopreader.c #define OtherObjects iopreader.o #endif /* * do not modify the following two definitions */ #ifndef OtherSources #define OtherSources #endif #ifndef OtherObjects #define OtherObjects #endif #if HasXdmAuth XDMAUTHDEFS = -DHASXDMAUTH XDMAUTHOBJS = xdmauth.o XDMAUTHSRCS = xdmauth.c #else XDMAUTHDEFS = XDMAUTHOBJS = XDMAUTHSCRS = #endif #if HasSecureRPC RPCDEFS = -DSECURE_RPC RPCOBJS = rpcauth.o RPCSRCS = rpcauth.c #else RPCDEFS = RPCOBJS = RPCSRCS = #endif #if HasKrb5 KRB5OBJS = k5auth.o k5encode.o KRB5SRCS = k5auth.c k5encode.c #endif #if HasBSD44Sockets SOCK_DEFINES = -DBSD44SOCKETS #endif #if BuildLBX LBX_SRCS = lbxio.c LBX_OBJS = lbxio.o #else LBX_SRCS = LBX_OBJS = #endif BOOTSTRAPCFLAGS = SRCS = WaitFor.c access.c connection.c io.c oscolor.c \ osinit.c utils.c auth.c mitauth.c secauth.c $(XDMAUTHSRCS) \ $(RPCSRCS) $(KRB5SRCS) xdmcp.c decompress.c OtherSources \ transport.c xalloc.c $(LBX_SRCS) OBJS = WaitFor.o access.o connection.o io.o oscolor.o \ osinit.o utils.o auth.o mitauth.o secauth.o $(XDMAUTHOBJS) \ $(RPCOBJS) $(KRB5OBJS) xdmcp.o decompress.o OtherObjects \ transport.o xalloc.o $(LBX_OBJS) #if SpecialMalloc MEM_DEFINES = -DSPECIAL_MALLOC #endif /* SpecialMalloc */ #if UseInternalMalloc MEM_DEFINES = -DINTERNAL_MALLOC #endif #if UseMemLeak MEM_DEFINES = -DMEMBUG #endif #if UseRgbTxt RGB_DEFINES = -DUSE_RGB_TXT #endif DBM_DEFINES = NdbmDefines ADM_DEFINES = -DADMPATH=\"$(ADMDIR)/X\%smsgs\" EXT_DEFINES = ExtensionDefines XDMCP_DEFINES = ServerXdmcpDefines OS_DEFINES = ServerOSDefines KRB5_DEFINES = Krb5Defines DEFINES = -DXSERV_t -DTRANS_SERVER ConnectionFlags $(MEM_DEFINES) $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) $(KRB5_DEFINES) $(RGB_DEFINES) INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(TOP)/lib/Xau -I../lbx Krb5Includes DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) $(TRANS_INCLUDES) ConnectionFlags LINTLIBS = ../dix/llib-ldix.ln #ifdef NEED_ALLOCA_FROM_LIBPW PWLIB = /lib/libPW.a #endif /* NEED_ALLOCA_FROM_LIBPW */ NormalLibraryObjectRule() NormalLibraryTarget(os,$(OBJS)) LintLibraryTarget(os,$(SRCS)) NormalLintTarget($(SRCS)) #ifdef NEED_ALLOCA_FROM_LIBPW XCOMM XCOMM And this one is to get the version of alloca that lives in /lib/libPW.a XCOMM without getting all of the rest of the stuff in there. XCOMM alloca.o: $(PWLIB) rm -f alloca.o ar x $(PWLIB) alloca.o #endif /* NEED_ALLOCA_FROM_LIBPW */ SpecialCObjectRule(access,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(auth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmauth,$(ICONFIGFILES),$(XDMCP_DEFINES)) SpecialCObjectRule(xdmcp,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(transport,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES)) LinkSourceFile(transport.c,$(TRANSCOMMSRC)) SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES)) SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES)) #if BuildLBX SpecialCObjectRule(lbxio,$(ICONFIGFILES),$(EXT_DEFINES)) #endif SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES)) SpecialCObjectRule(xalloc,$(ICONFIGFILES),NullParameter) #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) $(RM) $@ cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c #else SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES)) #endif #if UseXserverWrapper AllTarget(wrapper.o) WRAPPER_DEFINES = -DXSERVER_PATH=\"$(BINDIR)/X\" SpecialCObjectRule(wrapper,NullParameter,$(WRAPPER_DEFINES)) #endif #if HasKrb5 LinkSourceFile(k5encode.c,$(XAUTHSRC)) #endif InstallLinkKitLibrary(os,$(LINKKITDIR)/lib) DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/os/osinit.c0100664000076400007640000001277307506774717021026 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: osinit.c /main/45 1996/12/02 10:23:13 lehors $ */ /* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.12 1997/01/18 06:58:02 dawes Exp $ */ #include #include "X.h" #include "os.h" #include "osdep.h" #include "Xos.h" #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN #else #define PATH_MAX 1024 #endif #endif #if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) #include #endif #if defined(AIXV3) || defined(HPUX_10) #include #endif #ifndef ADMPATH #define ADMPATH "/usr/adm/X%smsgs" #endif extern char *display; #ifdef RLIMIT_DATA int limitDataSpace = -1; #endif #ifdef RLIMIT_STACK int limitStackSpace = -1; #endif #ifdef RLIMIT_NOFILE int limitNoFile = -1; #endif Bool OsDelayInitColors = FALSE; void OsInit() { #ifndef AMOEBA static Bool been_here = FALSE; char fname[PATH_MAX]; #ifdef macII set42sig(); #endif if (!been_here) { #if !defined(MINIX) && !defined(SCO) fclose(stdin); fclose(stdout); #endif /* hack test to decide where to log errors */ if (write (2, fname, 0)) { FILE *err; sprintf (fname, ADMPATH, display); /* * uses stdio to avoid os dependencies here, * a real os would use * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666) */ if (!(err = fopen (fname, "a+"))) err = fopen ("/dev/null", "w"); if (err && (fileno(err) != 2)) { dup2 (fileno (err), 2); fclose (err); } #if defined(SYSV) || defined(SVR4) || defined(MINIX) || defined(__EMX__) || defined(WIN32) { static char buf[BUFSIZ]; setvbuf (stderr, buf, _IOLBF, BUFSIZ); } #else setlinebuf(stderr); #endif } #ifndef X_NOT_POSIX if (getpgrp () == 0) setpgid (0, 0); #else #if !defined(SYSV) && !defined(WIN32) if (getpgrp (0) == 0) setpgrp (0, getpid ()); #endif #endif #ifdef RLIMIT_DATA if (limitDataSpace >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_DATA, &rlim)) { if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max)) rlim.rlim_cur = limitDataSpace; else rlim.rlim_cur = rlim.rlim_max; (void)setrlimit(RLIMIT_DATA, &rlim); } } #endif #ifdef RLIMIT_STACK if (limitStackSpace >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_STACK, &rlim)) { if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max)) rlim.rlim_cur = limitStackSpace; else rlim.rlim_cur = rlim.rlim_max; (void)setrlimit(RLIMIT_STACK, &rlim); } } #endif #ifdef RLIMIT_NOFILE if (limitNoFile >= 0) { struct rlimit rlim; if (!getrlimit(RLIMIT_NOFILE, &rlim)) { if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max)) rlim.rlim_cur = limitNoFile; else rlim.rlim_cur = rlim.rlim_max; if (rlim.rlim_cur > MAXSOCKS) rlim.rlim_cur = MAXSOCKS; (void)setrlimit(RLIMIT_NOFILE, &rlim); } } #endif #ifdef SERVER_LOCK LockServer(); #endif been_here = TRUE; } #endif /* AMOEBA */ TimerInit(); #ifdef DDXOSINIT OsVendorInit(); #endif OsInitAllocator(); if (!OsDelayInitColors) OsInitColors(); } void OsCleanup() { #ifdef SERVER_LOCK UnlockServer(); #endif } vnc_unixsrc/Xvnc/programs/Xserver/os/rpcauth.c0100664000076400007640000001177307615756245021163 0ustar constconst/* $XConsortium: rpcauth.c,v 1.9 94/04/17 20:27:06 gildea Exp $ */ /* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.0 1995/07/07 15:46:07 dawes Exp $ */ /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * SUN-DES-1 authentication mechanism * Author: Mayank Choudhary, Sun Microsystems */ #ifdef SECURE_RPC #include #include "X.h" #include "Xauth.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include #ifdef ultrix #include #include #endif static enum auth_stat why; static char * authdes_ezdecode(inmsg, len) char *inmsg; int len; { struct rpc_msg msg; char cred_area[MAX_AUTH_BYTES]; char verf_area[MAX_AUTH_BYTES]; char *temp_inmsg; struct svc_req r; bool_t res0, res1; XDR xdr; SVCXPRT xprt; temp_inmsg = (char *) xalloc(len); memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); memset((char *)&r, 0, sizeof(r)); memset(cred_area, 0, sizeof(cred_area)); memset(verf_area, 0, sizeof(verf_area)); msg.rm_call.cb_cred.oa_base = cred_area; msg.rm_call.cb_verf.oa_base = verf_area; why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); if ((r.rq_clntcred = (caddr_t) xalloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; /* decode into msg */ res0 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_cred)); res1 = xdr_opaque_auth(&xdr, &(msg.rm_call.cb_verf)); if ( ! (res0 && res1) ) goto bad2; /* do the authentication */ r.rq_cred = msg.rm_call.cb_cred; /* read by opaque stuff */ if (r.rq_cred.oa_flavor != AUTH_DES) { why = AUTH_TOOWEAK; goto bad2; } #ifdef SVR4 if ((why = __authenticate(&r, &msg)) != AUTH_OK) { #else if ((why = _authenticate(&r, &msg)) != AUTH_OK) { #endif goto bad2; } return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name); bad2: xfree(r.rq_clntcred); bad1: return ((char *)0); /* ((struct authdes_cred *) NULL); */ } static XID rpc_id = (XID) ~0L; static Bool CheckNetName (addr, len, closure) unsigned char *addr; int len; pointer closure; { return (len == strlen ((char *) closure) && strncmp ((char *) addr, (char *) closure, len) == 0); } static char rpc_error[MAXNETNAMELEN+50]; XID SecureRPCCheck (data_length, data, client, reason) register unsigned short data_length; char *data; ClientPtr client; char **reason; { char *fullname; if (rpc_id == (XID) ~0L) { *reason = "Secure RPC authorization not initialized"; } else { fullname = authdes_ezdecode(data, data_length); if (fullname == (char *)0) { sprintf(rpc_error, "Unable to authenticate secure RPC client (why=%d)", why); *reason = rpc_error; } else { if (ForEachHostInFamily (FamilyNetname, CheckNetName, (pointer) fullname)) return rpc_id; else { sprintf(rpc_error, "Principal \"%s\" is not authorized to connect", fullname); *reason = rpc_error; } } } return (XID) ~0L; } SecureRPCInit () { if (rpc_id == ~0L) AddAuthorization (9, "SUN-DES-1", 0, (char *) 0); } int SecureRPCAdd (data_length, data, id) unsigned short data_length; char *data; XID id; { if (data_length) AddHost ((pointer) 0, FamilyNetname, data_length, data); rpc_id = id; } int SecureRPCReset () { rpc_id = (XID) ~0L; } XID SecureRPCToID (data_length, data) unsigned short data_length; char *data; { return rpc_id; } SecureRPCFromID (id, data_lenp, datap) XID id; unsigned short *data_lenp; char **datap; { return 0; } SecureRPCRemove (data_length, data) unsigned short data_length; char *data; { return 0; } #endif /* SECURE_RPC */ vnc_unixsrc/Xvnc/programs/Xserver/os/io.c0100664000076400007640000010055207120677563020112 0ustar constconst/*********************************************************** Copyright (c) 1987, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: io.c /main/72 1996/12/27 15:40:56 rws $ */ /* $XFree86: xc/programs/Xserver/os/io.c,v 3.15 1997/01/18 06:58:00 dawes Exp $ */ /***************************************************************** * i/o functions * * WriteToClient, ReadRequestFromClient * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ #ifdef WIN32 #include #endif #include #include #ifdef X_NOT_STDC_ENV extern int errno; #endif #include "Xmd.h" #include #if !defined(AMOEBA) && !defined(MINIX) && !defined(__EMX__) && !defined(WIN32) #ifndef Lynx #include #else #include #endif #endif #include "X.h" #define NEED_REPLIES #include "Xproto.h" #include "os.h" #include "Xpoll.h" #include "osdep.h" #include "opaque.h" #include "dixstruct.h" #include "misc.h" #ifdef LBX #include "lbxserve.h" #endif CallbackListPtr ReplyCallback; CallbackListPtr FlushCallback; /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #ifndef __EMX__ #if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) #else #ifdef EAGAIN #define ETEST(err) (err == EAGAIN) #else #define ETEST(err) (err == EWOULDBLOCK) #endif #endif #else /* __EMX__ Writing to full pipes may return ENOSPC */ #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC) #endif extern fd_set ClientsWithInput, IgnoredClientsWithInput, AllClients; extern fd_set ClientsWriteBlocked; extern fd_set OutputPending; extern int ConnectionTranslation[]; extern Bool NewOutputPending; extern Bool AnyClientsWriteBlocked; Bool CriticalOutputPending; int timesThisConnection = 0; ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; OsCommPtr AvailableInput = (OsCommPtr)NULL; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) #ifdef BIGREQS #include "bigreqstr.h" #define get_big_req_len(req,cli) ((cli)->swapped ? \ lswapl(((xBigReq *)(req))->length) : \ ((xBigReq *)(req))->length) #endif #define MAX_TIMES_PER 10 /* * A lot of the code in this file manipulates a ConnectionInputPtr: * * ----------------------------------------------- * |------- bufcnt ------->| | | * | |- gotnow ->| | | * | |-------- needed ------>| | * |-----------+--------- size --------+---------->| * ----------------------------------------------- * ^ ^ * | | * buffer bufptr * * buffer is a pointer to the start of the buffer. * bufptr points to the start of the current request. * bufcnt counts how many bytes are in the buffer. * size is the size of the buffer in bytes. * * In several of the functions, gotnow and needed are local variables * that do the following: * * gotnow is the number of bytes of the request that we're * trying to read that are currently in the buffer. * Typically, gotnow = (buffer + bufcnt) - bufptr * * needed = the length of the request that we're trying to * read. Watch out: needed sometimes counts bytes and sometimes * counts CARD32's. */ /***************************************************************** * ReadRequestFromClient * Returns one request in client->requestBuffer. The request * length will be in client->req_len. Return status is: * * > 0 if successful, specifies length in bytes of the request * = 0 if entire request is not yet available * < 0 if client should be terminated * * The request returned must be contiguous so that it can be * cast in the dispatcher to the correct request type. Because requests * are variable length, ReadRequestFromClient() must look at the first 4 * or 8 bytes of a request to determine the length (the request length is * in the 3rd and 4th bytes of the request unless it is a Big Request * (see the Big Request Extension), in which case the 3rd and 4th bytes * are zero and the following 4 bytes are the request length. * * Note: in order to make the server scheduler (WaitForSomething()) * "fair", the ClientsWithInput mask is used. This mask tells which * clients have FULL requests left in their buffers. Clients with * partial requests require a read. Basically, client buffers * are drained before select() is called again. But, we can't keep * reading from a client that is sending buckets of data (or has * a partial request) because others clients need to be scheduled. *****************************************************************/ #define YieldControl() \ { isItTimeToYield = TRUE; \ timesThisConnection = 0; } #define YieldControlNoInput() \ { YieldControl(); \ FD_CLR(fd, &ClientsWithInput); } #define YieldControlDeath() \ { timesThisConnection = 0; } #if defined(LBX) || defined(LBX_COMPAT) int StandardReadRequestFromClient(client) ClientPtr client; #else int ReadRequestFromClient(client) ClientPtr client; #endif { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; register int gotnow, needed; int result; register xReq *request; Bool need_header; #ifdef BIGREQS Bool move_header; #endif /* If an input buffer was empty, either free it if it is too big * or link it into our list of free input buffers. This means that * different clients can share the same input buffer (at different * times). This was done to save memory. */ if (AvailableInput) { if (AvailableInput != oc) { register ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { xfree(aci->buffer); xfree(aci); } else { aci->next = FreeInputs; FreeInputs = aci; } AvailableInput->input = (ConnectionInputPtr)NULL; } AvailableInput = (OsCommPtr)NULL; } /* make sure we have an input buffer */ if (!oci) { if (oci = FreeInputs) { FreeInputs = oci->next; } else if (!(oci = AllocateInputBuffer())) { YieldControlDeath(); return -1; } oc->input = oci; } /* advance to start of next request */ oci->bufptr += oci->lenLastReq; need_header = FALSE; #ifdef BIGREQS move_header = FALSE; #endif gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if (gotnow < sizeof(xReq)) { /* We don't have an entire xReq yet. Can't tell how big * the request will be until we get the whole xReq. */ needed = sizeof(xReq); need_header = TRUE; } else { /* We have a whole xReq. We can tell how big the whole * request will be unless it is a Big Request. */ request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { /* It's a Big Request. */ move_header = TRUE; if (gotnow < sizeof(xBigReq)) { /* Still need more data to tell just how big. */ needed = sizeof(xBigReq) >> 2; /* needed is in CARD32s now */ need_header = TRUE; } else needed = get_big_req_len(request, client); } #endif client->req_len = needed; needed <<= 2; /* needed is in bytes now */ } if (gotnow < needed) { /* Need to read more data, either so that we can get a * complete xReq (if need_header is TRUE), a complete * xBigReq (if move_header is TRUE), or the rest of the * request (if need_header and move_header are both FALSE). */ oci->lenLastReq = 0; if (needed > MAXBUFSIZE) { /* request is too big for us to handle */ YieldControlDeath(); return -1; } if ((gotnow == 0) || ((oci->bufptr - oci->buffer + needed) > oci->size)) { /* no data, or the request is too big to fit in the buffer */ if ((gotnow > 0) && (oci->bufptr != oci->buffer)) /* save the data we've already read */ memmove(oci->buffer, oci->bufptr, gotnow); if (needed > oci->size) { /* make buffer bigger to accomodate request */ char *ibuf; ibuf = (char *)xrealloc(oci->buffer, needed); if (!ibuf) { YieldControlDeath(); return -1; } oci->size = needed; oci->buffer = ibuf; } oci->bufptr = oci->buffer; oci->bufcnt = gotnow; } /* XXX this is a workaround. This function is sometimes called * after the trans_conn has been freed. In this case trans_conn * will be null. Really ought to restructure things so that we * never get here in those circumstances. */ if (!oc->trans_conn) { /* treat as if an error occured on the read, which is what * used to happen */ YieldControlDeath(); return -1; } #ifdef LBX if (oc->proxy && oc->proxy->compHandle) result = (*oc->proxy->streamOpts.streamCompRead)(fd, (unsigned char *)oci->buffer + oci->bufcnt, oci->size - oci->bufcnt); else #endif result = _XSERVTransRead(oc->trans_conn, oci->buffer + oci->bufcnt, oci->size - oci->bufcnt); if (result <= 0) { if ((result < 0) && ETEST(errno)) { #if defined(SVR4) && defined(i386) && !defined(sun) #if defined(LBX) && 0 /* * For LBX connections, we can get a valid EWOULDBLOCK * There is probably a better way of distinguishing LBX * connections, but this works. (DHD) */ extern int LbxRead(); if (oc->Read == LbxRead) #else if (0) #endif #endif { YieldControlNoInput(); return 0; } } YieldControlDeath(); return -1; } oci->bufcnt += result; gotnow += result; /* free up some space after huge requests */ if ((oci->size > BUFWATERMARK) && (oci->bufcnt < BUFSIZE) && (needed < BUFSIZE)) { char *ibuf; ibuf = (char *)xrealloc(oci->buffer, BUFSIZE); if (ibuf) { oci->size = BUFSIZE; oci->buffer = ibuf; oci->bufptr = ibuf + oci->bufcnt - gotnow; } } if (need_header && gotnow >= needed) { /* We wanted an xReq, now we've gotten it. */ request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { move_header = TRUE; if (gotnow < sizeof(xBigReq)) needed = sizeof(xBigReq) >> 2; else needed = get_big_req_len(request, client); } #endif client->req_len = needed; needed <<= 2; } if (gotnow < needed) { /* Still don't have enough; punt. */ YieldControlNoInput(); return 0; } } if (needed == 0) { #ifdef BIGREQS if (client->big_requests) needed = sizeof(xBigReq); else #endif needed = sizeof(xReq); } oci->lenLastReq = needed; /* * Check to see if client has at least one whole request in the * buffer beyond the request we're returning to the caller. * If there is only a partial request, treat like buffer * is empty so that select() will be called again and other clients * can get into the queue. */ gotnow -= needed; if (gotnow >= sizeof(xReq)) { request = (xReq *)(oci->bufptr + needed); if (gotnow >= (result = (get_req_len(request, client) << 2)) #ifdef BIGREQS && (result || (client->big_requests && (gotnow >= sizeof(xBigReq) && gotnow >= (get_big_req_len(request, client) << 2)))) #endif ) FD_SET(fd, &ClientsWithInput); else YieldControlNoInput(); } else { if (!gotnow) AvailableInput = oc; YieldControlNoInput(); } if (++timesThisConnection >= MAX_TIMES_PER) YieldControl(); #ifdef BIGREQS if (move_header) { request = (xReq *)oci->bufptr; oci->bufptr += (sizeof(xBigReq) - sizeof(xReq)); *(xReq *)oci->bufptr = *request; oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq)); client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2; } #endif client->requestBuffer = (pointer)oci->bufptr; return needed; } /***************************************************************** * InsertFakeRequest * Splice a consed up (possibly partial) request in as the next request. * **********************/ Bool InsertFakeRequest(client, data, count) ClientPtr client; char *data; int count; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; register int gotnow, moveup; if (AvailableInput) { if (AvailableInput != oc) { register ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { xfree(aci->buffer); xfree(aci); } else { aci->next = FreeInputs; FreeInputs = aci; } AvailableInput->input = (ConnectionInputPtr)NULL; } AvailableInput = (OsCommPtr)NULL; } if (!oci) { if (oci = FreeInputs) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; oc->input = oci; } oci->bufptr += oci->lenLastReq; oci->lenLastReq = 0; gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if ((gotnow + count) > oci->size) { char *ibuf; ibuf = (char *)xrealloc(oci->buffer, gotnow + count); if (!ibuf) return(FALSE); oci->size = gotnow + count; oci->buffer = ibuf; oci->bufptr = ibuf + oci->bufcnt - gotnow; } moveup = count - (oci->bufptr - oci->buffer); if (moveup > 0) { if (gotnow > 0) memmove(oci->bufptr + moveup, oci->bufptr, gotnow); oci->bufptr += moveup; oci->bufcnt += moveup; } memmove(oci->bufptr - count, data, count); oci->bufptr -= count; gotnow += count; if ((gotnow >= sizeof(xReq)) && (gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2))) FD_SET(fd, &ClientsWithInput); else YieldControlNoInput(); return(TRUE); } /***************************************************************** * ResetRequestFromClient * Reset to reexecute the current request, and yield. * **********************/ ResetCurrentRequest(client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; register xReq *request; int gotnow, needed; #ifdef LBX Bool part; LbxClientPtr lbxClient = LbxClient(client); if (lbxClient) { LbxSetForBlock(lbxClient); if (!oci) { AppendFakeRequest(client, client->requestBuffer, client->req_len << 2); return; } } #endif if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; oci->lenLastReq = 0; gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if (gotnow < sizeof(xReq)) { YieldControlNoInput(); } else { request = (xReq *)oci->bufptr; needed = get_req_len(request, client); #ifdef BIGREQS if (!needed && client->big_requests) { oci->bufptr -= sizeof(xBigReq) - sizeof(xReq); *(xReq *)oci->bufptr = *request; ((xBigReq *)oci->bufptr)->length = client->req_len; if (client->swapped) { char n; swapl(&((xBigReq *)oci->bufptr)->length, n); } } #endif if (gotnow >= (needed << 2)) { if (FD_ISSET(fd, &AllClients)) { FD_SET(fd, &ClientsWithInput); } else { FD_SET(fd, &IgnoredClientsWithInput); } YieldControl(); } else YieldControlNoInput(); } } /***************************************************************** * PeekNextRequest and SkipRequests were implemented to support DBE * idioms, but can certainly be used outside of DBE. There are two * related macros in os.h, ReqLen and CastxReq. See the porting * layer document for more details. * **********************/ /***************************************************************** * PeekNextRequest * lets you look ahead at the unexecuted requests in a * client's request buffer. * * Note: this implementation of PeekNextRequest ignores the * readmore parameter. * **********************/ xReqPtr PeekNextRequest(req, client, readmore) xReqPtr req; /* request we're starting from */ ClientPtr client; /* client whose requests we're skipping */ Bool readmore; /* attempt to read more if next request isn't there? */ { register ConnectionInputPtr oci = ((OsCommPtr)client->osPrivate)->input; xReqPtr pnextreq; int needed, gotnow, reqlen; if (!oci) return NULL; if (!req) { /* caller wants the request after the one currently being executed */ pnextreq = (xReqPtr) (((CARD32 *)client->requestBuffer) + client->req_len); } else { /* caller wants the request after the one specified by req */ reqlen = get_req_len(req, client); #ifdef BIGREQS if (!reqlen) reqlen = get_big_req_len(req, client); #endif pnextreq = (xReqPtr)(((char *)req) + (reqlen << 2)); } /* see how much of the next request we have available */ gotnow = oci->bufcnt - (((char *)pnextreq) - oci->buffer); if (gotnow < sizeof(xReq)) return NULL; needed = get_req_len(pnextreq, client) << 2; #ifdef BIGREQS if (!needed) { /* it's a big request */ if (gotnow < sizeof(xBigReq)) return NULL; needed = get_big_req_len(pnextreq, client) << 2; } #endif /* if we have less than we need, return NULL */ return (gotnow < needed) ? NULL : pnextreq; } /***************************************************************** * SkipRequests * lets you skip over some of the requests in a client's * request buffer. Presumably the caller has used PeekNextRequest * to examine the requests being skipped and has performed whatever * actions they dictate. * **********************/ CallbackListPtr SkippedRequestsCallback = NULL; void SkipRequests(req, client, numskipped) xReqPtr req; /* last request being skipped */ ClientPtr client; /* client whose requests we're skipping */ int numskipped; /* how many requests we're skipping */ { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int reqlen; /* see if anyone wants to snoop the skipped requests */ if (SkippedRequestsCallback) { SkippedRequestInfoRec skipinfo; skipinfo.req = req; skipinfo.client = client; skipinfo.numskipped = numskipped; CallCallbacks(&SkippedRequestsCallback, &skipinfo); } /* adjust the sequence number */ client->sequence += numskipped; /* twiddle the oci to skip over the requests */ reqlen = get_req_len(req, client); #ifdef BIGREQS if (!reqlen) reqlen = get_big_req_len(req, client); #endif reqlen <<= 2; oci->bufptr = (char *)req; oci->lenLastReq = reqlen; /* see if any requests left in the buffer */ if ( ((char *)req + reqlen) == (oci->buffer + oci->bufcnt) ) { /* no requests; mark input buffer as available and client * as having no input */ int fd = oc->fd; AvailableInput = oc; YieldControlNoInput(); } } /* lookup table for adding padding bytes to data that is read from or written to the X socket. */ static int padlength[4] = {0, 3, 2, 1}; /******************** * FlushClient() * If the client isn't keeping up with us, then we try to continue * buffering the data and set the apropriate bit in ClientsWritable * (which is used by WaitFor in the select). If the connection yields * a permanent error, or we can't allocate any more space, we then * close the connection. * **********************/ int #ifdef LBX StandardFlushClient(who, oc, extraBuf, extraCount) #else FlushClient(who, oc, extraBuf, extraCount) #endif ClientPtr who; OsCommPtr oc; char *extraBuf; int extraCount; /* do not modify... returned below */ { register ConnectionOutputPtr oco = oc->output; int connection = oc->fd; XtransConnInfo trans_conn = oc->trans_conn; struct iovec iov[3]; static char padBuffer[3]; long written; long padsize; long notWritten; long todo; if (!oco) return 0; written = 0; padsize = padlength[extraCount & 3]; notWritten = oco->count + extraCount + padsize; todo = notWritten; while (notWritten) { long before = written; /* amount of whole thing written */ long remain = todo; /* amount to try this time, <= notWritten */ int i = 0; long len; /* You could be very general here and have "in" and "out" iovecs * and write a loop without using a macro, but what the heck. This * translates to: * * how much of this piece is new? * if more new then we are trying this time, clamp * if nothing new * then bump down amount already written, for next piece * else put new stuff in iovec, will need all of next piece * * Note that todo had better be at least 1 or else we'll end up * writing 0 iovecs. */ #define InsertIOV(pointer, length) \ len = (length) - before; \ if (len > remain) \ len = remain; \ if (len <= 0) { \ before = (-len); \ } else { \ iov[i].iov_len = len; \ iov[i].iov_base = (pointer) + before; \ i++; \ remain -= len; \ before = 0; \ } InsertIOV ((char *)oco->buf, oco->count) InsertIOV (extraBuf, extraCount) InsertIOV (padBuffer, padsize) errno = 0; if (trans_conn && (len = _XSERVTransWritev(trans_conn, iov, i)) >= 0) { written += len; notWritten -= len; todo = notWritten; } else if (ETEST(errno) #ifdef SUNSYSV /* check for another brain-damaged OS bug */ || (errno == 0) #endif #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ || ((errno == EMSGSIZE) && (todo == 1)) #endif ) { /* If we've arrived here, then the client is stuffed to the gills and not ready to accept more. Make a note of it and buffer the rest. */ FD_SET(connection, &ClientsWriteBlocked); AnyClientsWriteBlocked = TRUE; if (written < oco->count) { if (written > 0) { oco->count -= written; memmove((char *)oco->buf, (char *)oco->buf + written, oco->count); written = 0; } } else { written -= oco->count; oco->count = 0; } if (notWritten > oco->size) { unsigned char *obuf; obuf = (unsigned char *)xrealloc(oco->buf, notWritten + BUFSIZE); if (!obuf) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; MarkClientException(who); oco->count = 0; return(-1); } oco->size = notWritten + BUFSIZE; oco->buf = obuf; } /* If the amount written extended into the padBuffer, then the difference "extraCount - written" may be less than 0 */ if ((len = extraCount - written) > 0) memmove ((char *)oco->buf + oco->count, extraBuf + written, len); oco->count = notWritten; /* this will include the pad */ /* return only the amount explicitly requested */ return extraCount; } #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ else if (errno == EMSGSIZE) { todo >>= 1; } #endif else { if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; } MarkClientException(who); oco->count = 0; return(-1); } } /* everything was flushed out */ oco->count = 0; /* check to see if this client was write blocked */ if (AnyClientsWriteBlocked) { FD_CLR(oc->fd, &ClientsWriteBlocked); if (! XFD_ANYSET(&ClientsWriteBlocked)) AnyClientsWriteBlocked = FALSE; } if (oco->size > BUFWATERMARK) { xfree(oco->buf); xfree(oco); } else { oco->next = FreeOutputs; FreeOutputs = oco; } oc->output = (ConnectionOutputPtr)NULL; return extraCount; /* return only the amount explicitly requested */ } /******************** * FlushAllOutput() * Flush all clients with output. However, if some client still * has input in the queue (more requests), then don't flush. This * will prevent the output queue from being flushed every time around * the round robin queue. Now, some say that it SHOULD be flushed * every time around, but... * **********************/ void FlushAllOutput() { register int index, base, mask; OsCommPtr oc; register ClientPtr client; Bool newoutput = NewOutputPending; #ifdef WIN32 fd_set newOutputPending; #endif if (FlushCallback) CallCallbacks(&FlushCallback, NULL); if (!newoutput) return; /* * It may be that some client still has critical output pending, * but he is not yet ready to receive it anyway, so we will * simply wait for the select to tell us when he's ready to receive. */ CriticalOutputPending = FALSE; NewOutputPending = FALSE; #ifndef WIN32 for (base = 0; base < howmany(XFD_SETSIZE, NFDBITS); base++) { mask = OutputPending.fds_bits[ base ]; OutputPending.fds_bits[ base ] = 0; while (mask) { index = ffs(mask) - 1; mask &= ~lowbit(mask); if ((index = ConnectionTranslation[(base << 5) + index]) == 0) continue; client = clients[index]; if (client->clientGone) continue; oc = (OsCommPtr)client->osPrivate; if ( #ifdef LBX !oc->proxy && #endif FD_ISSET(oc->fd, &ClientsWithInput)) { FD_SET(oc->fd, &OutputPending); /* set the bit again */ NewOutputPending = TRUE; } else (void)FlushClient(client, oc, (char *)NULL, 0); } } #else /* WIN32 */ FD_ZERO(&newOutputPending); for (base = 0; base < XFD_SETCOUNT(&OutputPending); base++) { index = XFD_FD(&OutputPending, base); if ((index = ConnectionTranslation[index]) == 0) continue; client = clients[index]; if (client->clientGone) continue; oc = (OsCommPtr)client->osPrivate; if ( #ifdef LBX !oc->proxy && #endif FD_ISSET(oc->fd, &ClientsWithInput)) { FD_SET(oc->fd, &newOutputPending); /* set the bit again */ NewOutputPending = TRUE; } else (void)FlushClient(client, oc, (char *)NULL, 0); } XFD_COPYSET(&newOutputPending, &OutputPending); #endif /* WIN32 */ } void FlushIfCriticalOutputPending() { if (CriticalOutputPending) FlushAllOutput(); } void SetCriticalOutputPending() { CriticalOutputPending = TRUE; } /***************** * WriteToClient * Copies buf into ClientPtr.buf if it fits (with padding), else * flushes ClientPtr.buf and buf to client. As of this writing, * every use of WriteToClient is cast to void, and the result * is ignored. Potentially, this could be used by requests * that are sending several chunks of data and want to break * out of a loop on error. Thus, we will leave the type of * this routine as int. *****************/ int WriteToClient (who, count, buf) ClientPtr who; char *buf; int count; { OsCommPtr oc = (OsCommPtr)who->osPrivate; register ConnectionOutputPtr oco = oc->output; int padBytes; if (!count) return(0); if (!oco) { if (oco = FreeOutputs) { FreeOutputs = oco->next; } else if (!(oco = AllocateOutputBuffer())) { if (oc->trans_conn) { _XSERVTransDisconnect(oc->trans_conn); _XSERVTransClose(oc->trans_conn); oc->trans_conn = NULL; } MarkClientException(who); return -1; } oc->output = oco; } padBytes = padlength[count & 3]; if(ReplyCallback) { ReplyInfoRec replyinfo; replyinfo.client = who; replyinfo.replyData = buf; replyinfo.dataLenBytes = count + padBytes; if (who->replyBytesRemaining) { /* still sending data of an earlier reply */ who->replyBytesRemaining -= count + padBytes; replyinfo.startOfReply = FALSE; replyinfo.bytesRemaining = who->replyBytesRemaining; CallCallbacks((&ReplyCallback), (pointer)&replyinfo); } else if (who->clientState == ClientStateRunning && buf[0] == X_Reply) { /* start of new reply */ CARD32 replylen; unsigned long bytesleft; char n; replylen = ((xGenericReply *)buf)->length; if (who->swapped) swapl(&replylen, n); bytesleft = (replylen * 4) + SIZEOF(xReply) - count - padBytes; replyinfo.startOfReply = TRUE; replyinfo.bytesRemaining = who->replyBytesRemaining = bytesleft; CallCallbacks((&ReplyCallback), (pointer)&replyinfo); } } if (oco->count + count + padBytes > oco->size) { FD_CLR(oc->fd, &OutputPending); CriticalOutputPending = FALSE; NewOutputPending = FALSE; return FlushClient(who, oc, buf, count); } NewOutputPending = TRUE; FD_SET(oc->fd, &OutputPending); memmove((char *)oco->buf + oco->count, buf, count); oco->count += count + padBytes; return(count); } ConnectionInputPtr AllocateInputBuffer() { register ConnectionInputPtr oci; oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); if (!oci) return (ConnectionInputPtr)NULL; oci->buffer = (char *)xalloc(BUFSIZE); if (!oci->buffer) { xfree(oci); return (ConnectionInputPtr)NULL; } oci->size = BUFSIZE; oci->bufptr = oci->buffer; oci->bufcnt = 0; oci->lenLastReq = 0; return oci; } ConnectionOutputPtr AllocateOutputBuffer() { register ConnectionOutputPtr oco; oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); if (!oco) return (ConnectionOutputPtr)NULL; oco->buf = (unsigned char *) xalloc(BUFSIZE); if (!oco->buf) { xfree(oco); return (ConnectionOutputPtr)NULL; } oco->size = BUFSIZE; oco->count = 0; #ifdef LBX oco->nocompress = FALSE; #endif return oco; } void FreeOsBuffers(oc) OsCommPtr oc; { register ConnectionInputPtr oci; register ConnectionOutputPtr oco; if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; if (oci = oc->input) { if (FreeInputs) { xfree(oci->buffer); xfree(oci); } else { FreeInputs = oci; oci->next = (ConnectionInputPtr)NULL; oci->bufptr = oci->buffer; oci->bufcnt = 0; oci->lenLastReq = 0; } } if (oco = oc->output) { if (FreeOutputs) { xfree(oco->buf); xfree(oco); } else { FreeOutputs = oco; oco->next = (ConnectionOutputPtr)NULL; oco->count = 0; } } #ifdef LBX if (oci = oc->largereq) { xfree(oci->buffer); xfree(oci); } #endif } void ResetOsBuffers() { register ConnectionInputPtr oci; register ConnectionOutputPtr oco; while (oci = FreeInputs) { FreeInputs = oci->next; xfree(oci->buffer); xfree(oci); } while (oco = FreeOutputs) { FreeOutputs = oco->next; xfree(oco->buf); xfree(oco); } } vnc_unixsrc/Xvnc/programs/Xserver/os/xdmauth.c0100664000076400007640000002700707120677563021160 0ustar constconst/* $XConsortium: xdmauth.c,v 1.14 95/07/10 21:18:07 gildea Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * XDM-AUTHENTICATION-1 (XDMCP authentication) and * XDM-AUTHORIZATION-1 (client authorization) protocols * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "Xtrans.h" #include "os.h" #include "osdep.h" #include "dixstruct.h" #ifdef HASXDMAUTH static Bool authFromXDMCP; #ifdef XDMCP #include "Xmd.h" #undef REQUEST #include "Xdmcp.h" /* XDM-AUTHENTICATION-1 */ static XdmAuthKeyRec privateKey; static char XdmAuthenticationName[] = "XDM-AUTHENTICATION-1"; #define XdmAuthenticationNameLen (sizeof XdmAuthenticationName - 1) static XdmAuthKeyRec rho; static Bool XdmAuthenticationValidator (privateData, incomingData, packet_type) ARRAY8Ptr privateData, incomingData; xdmOpCode packet_type; { XdmAuthKeyPtr incoming; XdmcpUnwrap (incomingData->data, &privateKey, incomingData->data,incomingData->length); switch (packet_type) { case ACCEPT: if (incomingData->length != 8) return FALSE; incoming = (XdmAuthKeyPtr) incomingData->data; XdmcpDecrementKey (incoming); return XdmcpCompareKeys (incoming, &rho); } return FALSE; } static Bool XdmAuthenticationGenerator (privateData, outgoingData, packet_type) ARRAY8Ptr privateData, outgoingData; xdmOpCode packet_type; { outgoingData->length = 0; outgoingData->data = 0; switch (packet_type) { case REQUEST: if (XdmcpAllocARRAY8 (outgoingData, 8)) XdmcpWrap (&rho, &privateKey, outgoingData->data, 8); } return TRUE; } static Bool XdmAuthenticationAddAuth (name_len, name, data_len, data) int name_len, data_len; char *name, *data; { Bool ret; XdmcpUnwrap (data, &privateKey, data, data_len); authFromXDMCP = TRUE; ret = AddAuthorization (name_len, name, data_len, data); authFromXDMCP = FALSE; return ret; } #define atox(c) ('0' <= c && c <= '9' ? c - '0' : \ 'a' <= c && c <= 'f' ? c - 'a' + 10 : \ 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1) static int HexToBinary (in, out, len) char *out, *in; int len; { int top, bottom; while (len > 0) { top = atox(in[0]); if (top == -1) return 0; bottom = atox(in[1]); if (bottom == -1) return 0; *out++ = (top << 4) | bottom; in += 2; len -= 2; } if (len) return 0; *out++ = '\0'; return 1; } void XdmAuthenticationInit (cookie, cookie_len) char *cookie; int cookie_len; { bzero (privateKey.data, 8); if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2)) { if (cookie_len > 2 + 2 * 8) cookie_len = 2 + 2 * 8; HexToBinary (cookie + 2, (char *)privateKey.data, cookie_len - 2); } else { if (cookie_len > 7) cookie_len = 7; memmove (privateKey.data + 1, cookie, cookie_len); } XdmcpGenerateKey (&rho); XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen, &rho, sizeof (rho), XdmAuthenticationValidator, XdmAuthenticationGenerator, XdmAuthenticationAddAuth); } #endif /* XDMCP */ /* XDM-AUTHORIZATION-1 */ typedef struct _XdmAuthorization { struct _XdmAuthorization *next; XdmAuthKeyRec rho; XdmAuthKeyRec key; XID id; } XdmAuthorizationRec, *XdmAuthorizationPtr; static XdmAuthorizationPtr xdmAuth; typedef struct _XdmClientAuth { struct _XdmClientAuth *next; XdmAuthKeyRec rho; char client[6]; long time; } XdmClientAuthRec, *XdmClientAuthPtr; static XdmClientAuthPtr xdmClients; static long clockOffset; static Bool gotClock; #define TwentyMinutes (20 * 60) #define TwentyFiveMinutes (25 * 60) static Bool XdmClientAuthCompare (a, b) XdmClientAuthPtr a, b; { int i; if (!XdmcpCompareKeys (&a->rho, &b->rho)) return FALSE; for (i = 0; i < 6; i++) if (a->client[i] != b->client[i]) return FALSE; return a->time == b->time; } static void XdmClientAuthDecode (plain, auth) unsigned char *plain; XdmClientAuthPtr auth; { int i, j; j = 0; for (i = 0; i < 8; i++) { auth->rho.data[i] = plain[j]; ++j; } for (i = 0; i < 6; i++) { auth->client[i] = plain[j]; ++j; } auth->time = 0; for (i = 0; i < 4; i++) { auth->time |= plain[j] << ((3 - i) << 3); j++; } } static void XdmClientAuthTimeout (now) long now; { XdmClientAuthPtr client, next, prev; prev = 0; for (client = xdmClients; client; client=next) { next = client->next; if (abs (now - client->time) > TwentyFiveMinutes) { if (prev) prev->next = next; else xdmClients = next; xfree (client); } else prev = client; } } static XdmClientAuthPtr XdmAuthorizationValidate (plain, length, rho, xclient, reason) unsigned char *plain; int length; XdmAuthKeyPtr rho; ClientPtr xclient; char **reason; { XdmClientAuthPtr client, existing; long now; int i; if (length != (192 / 8)) { if (reason) *reason = "Bad XDM authorization key length"; return NULL; } client = (XdmClientAuthPtr) xalloc (sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); if (!XdmcpCompareKeys (&client->rho, rho)) { xfree (client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key value"; return NULL; } for (i = 18; i < 24; i++) if (plain[i] != 0) { xfree (client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key value"; return NULL; } if (xclient) { int family, addr_len; Xtransaddr *addr; if (_XSERVTransGetPeerAddr(((OsCommPtr)xclient->osPrivate)->trans_conn, &family, &addr_len, &addr) == 0 && _XSERVTransConvertAddress(&family, &addr_len, &addr) == 0) { #ifdef TCPCONN if (family == FamilyInternet && memcmp((char *)addr, client->client, 4) != 0) { xfree (client); xfree (addr); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key value"; return NULL; } #endif xfree (addr); } } now = time(0); if (!gotClock) { clockOffset = client->time - now; gotClock = TRUE; } now += clockOffset; XdmClientAuthTimeout (now); if (abs (client->time - now) > TwentyMinutes) { xfree (client); if (reason) *reason = "Excessive XDM-AUTHORIZATION-1 time offset"; return NULL; } for (existing = xdmClients; existing; existing=existing->next) { if (XdmClientAuthCompare (existing, client)) { xfree (client); if (reason) *reason = "XDM authorization key matches an existing client!"; return NULL; } } return client; } int XdmAddCookie (data_length, data, id) unsigned short data_length; char *data; XID id; { XdmAuthorizationPtr new; unsigned char *rho_bits, *key_bits; switch (data_length) { case 16: /* auth from files is 16 bytes long */ if (authFromXDMCP) { /* R5 xdm sent bogus authorization data in the accept packet, * but we can recover */ rho_bits = rho.data; key_bits = (unsigned char *) data; key_bits[0] = '\0'; } else { rho_bits = (unsigned char *) data; key_bits = (unsigned char *) (data + 8); } break; case 8: /* auth from XDMCP is 8 bytes long */ rho_bits = rho.data; key_bits = (unsigned char *) data; break; default: return 0; } /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; new = (XdmAuthorizationPtr) xalloc (sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; xdmAuth = new; memmove (new->key.data, key_bits, (int) 8); memmove (new->rho.data, rho_bits, (int) 8); new->id = id; return 1; } XID XdmCheckCookie (cookie_length, cookie, xclient, reason) unsigned short cookie_length; char *cookie; ClientPtr xclient; char **reason; { XdmAuthorizationPtr auth; XdmClientAuthPtr client; unsigned char *plain; /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; plain = (unsigned char *) xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap (cookie, &auth->key, plain, cookie_length); if (client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) { client->next = xdmClients; xdmClients = client; xfree (plain); return auth->id; } } xfree (plain); return (XID) -1; } int XdmResetCookie () { XdmAuthorizationPtr auth, next_auth; XdmClientAuthPtr client, next_client; for (auth = xdmAuth; auth; auth=next_auth) { next_auth = auth->next; xfree (auth); } xdmAuth = 0; for (client = xdmClients; client; client=next_client) { next_client = client->next; xfree (client); } xdmClients = (XdmClientAuthPtr) 0; return 1; } XID XdmToID (cookie_length, cookie) unsigned short cookie_length; char *cookie; { XdmAuthorizationPtr auth; XdmClientAuthPtr client; unsigned char *plain; plain = (unsigned char *) xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap (cookie, &auth->key, plain, cookie_length); if (client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) { xfree (client); xfree (cookie); return auth->id; } } xfree (cookie); return (XID) -1; } int XdmFromID (id, data_lenp, datap) XID id; unsigned short *data_lenp; char **datap; { XdmAuthorizationPtr auth; for (auth = xdmAuth; auth; auth=auth->next) { if (id == auth->id) { *data_lenp = 16; *datap = (char *) &auth->rho; return 1; } } return 0; } int XdmRemoveCookie (data_length, data) unsigned short data_length; char *data; { XdmAuthorizationPtr auth, prev; XdmAuthKeyPtr key_bits, rho_bits; prev = 0; switch (data_length) { case 16: rho_bits = (XdmAuthKeyPtr) data; key_bits = (XdmAuthKeyPtr) (data + 8); break; case 8: rho_bits = ρ key_bits = (XdmAuthKeyPtr) data; break; default: return 0; } for (auth = xdmAuth; auth; auth=auth->next) { if (XdmcpCompareKeys (rho_bits, &auth->rho) && XdmcpCompareKeys (key_bits, &auth->key)) { if (prev) prev->next = auth->next; else xdmAuth = auth->next; xfree (auth); return 1; } } return 0; } #endif vnc_unixsrc/Xvnc/programs/Xserver/os/iopreader.c0100664000076400007640000000777307120677563021470 0ustar constconst/* $XConsortium: iopreader.c,v 1.2 94/04/12 17:24:33 dpw Exp $ */ /* Copyright (c) 1987 by the Regents of the University of California * Copyright (c) 1994 by the Vrije Universiteit, Amsterdam. * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies. The University of California * and the Vrije Universiteit make no representations about * the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. */ #ifdef AMOEBA /* * iopreader.c * */ #define port am_port_t #include #include #include #include #include #include #undef port #include "osdep.h" #define DEVREADER_STACK 8000 #define MAXEVENTQUEUE 32 capability iopcap; static mutex lock; static semaphore empty, filled; static IOPEvent event_queue[MAXEVENTQUEUE]; static int event_qin, event_qout; void IOPCleanUp(); static void IOPServerReader(); /* * Initialize the IOP server */ void InitializeIOPServerReader() { capability hostcap; errstat err; /* * Initialize event queue */ event_qin = event_qout = 0; sema_init(&empty, MAXEVENTQUEUE); sema_init(&filled, 0); mu_init(&lock); /* * Get IOP capability, and enable the server */ if (XServerHostName == NULL) FatalError("No hostname, no screen\n"); if ((err = host_lookup(XServerHostName, &hostcap)) != STD_OK || (err = dir_lookup(&hostcap, DEF_IOPSVRNAME, &iopcap)) != STD_OK) { FatalError("Cannot find IOP server for %s: %s\n", XServerHostName, err_why(err)); } /* * Enable IOP server */ if ((err = iop_enable(&iopcap)) != STD_OK) FatalError("iop_enable failed (%s)\n", err_why(err)); /* * Start IOP reader thread */ atexit(IOPCleanUp); if (thread_newthread(IOPServerReader, DEVREADER_STACK, 0, 0) <= 0) FatalError("Cannot start IOP reader thread\n"); } /* * IOP clean up, actuall disable the IOP server. Its the IOP's own choice * what do do (perhaps restore the screen?). */ void IOPCleanUp() { errstat err; if ((err = iop_disable(&iopcap)) != STD_OK) ErrorF("iop_disable failed (%s)\n", err_why(err)); } /* * This threads polls the IOP server for events. Once an event (or a * number of events) are read, they are queued up using a traditional * producer/consumer approach. */ static void IOPServerReader() { IOPEvent queue[MAXEVENTQUEUE-1]; int nevents, i; errstat err; WaitForInitialization(); #ifdef XDEBUG if (amDebug) ErrorF("IOPServerReader() running ...\n"); #endif for (;;) { do { nevents = MAXEVENTQUEUE - 1; err = iop_getevents(&iopcap, queue, &nevents); if (err != STD_OK) { if (err != RPC_FAILURE) { ErrorF("iop_getevents failed (%s)\n", err_why(err)); } nevents = 0; } } while (nevents <= 0); /* store event(s) in the global event queue */ sema_mdown(&empty, nevents); mu_lock(&lock); for (i = 0; i < nevents; i++) { event_queue[event_qin] = queue[i]; event_qin = (event_qin + 1) % MAXEVENTQUEUE; } mu_unlock(&lock); sema_mup(&filled, nevents); WakeUpMainThread(); } } /* * Return the number of IOP events waiting */ int AmoebaEventsAvailable() { return sema_level(&filled); } /* * Get the IOP events from the queue. ``size'' is the maximum the * requestor cares to handle, the actual size read is returned as * result. */ int AmoebaGetEvents(queue, size) IOPEvent *queue; int size; { int nevents, i; if (sema_level(&filled) <= 0) return 0; if ((nevents = sema_level(&filled)) > size) nevents = size; sema_mdown(&filled, nevents); mu_lock(&lock); for (i = 0; i < nevents; i++) { queue[i] = event_queue[event_qout]; event_qout = (event_qout + 1) % MAXEVENTQUEUE; } mu_unlock(&lock); sema_mup(&empty, nevents); return nevents; } #endif /* AMOEBA */ vnc_unixsrc/Xvnc/programs/Xserver/os/xdmcp.c0100664000076400007640000010355607120677563020625 0ustar constconst/* $XConsortium: xdmcp.c /main/34 1996/12/02 10:23:29 lehors $ */ /* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.9 1997/01/18 06:58:04 dawes Exp $ */ /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of N.C.D. not be used in advertising or * publicity pertaining to distribution of the software without specific, * written prior permission. N.C.D. makes no representations about the * suitability of this software for any purpose. It is provided "as is" * without express or implied warranty. * */ #ifdef WIN32 /* avoid conflicting definitions */ #define BOOL wBOOL #define ATOM wATOM #define FreeResource wFreeResource #include #undef BOOL #undef ATOM #undef FreeResource #undef CreateWindowA #undef RT_FONT #undef RT_CURSOR #endif #include "Xos.h" #if !defined(MINIX) && !defined(WIN32) #ifndef Lynx #include #include #else #include #endif #include #include #else #if defined(MINIX) #include #include #include #include #include #include #include #endif #endif #include #include "X.h" #include "Xmd.h" #include "misc.h" #include "Xpoll.h" #include "osdep.h" #include "input.h" #include "dixstruct.h" #include "opaque.h" #ifdef STREAMSCONN #include #include #include #endif #ifdef XDMCP #undef REQUEST #include "Xdmcp.h" extern char *display; extern fd_set EnabledDevices; extern fd_set AllClients; extern char *defaultDisplayClass; static int xdmcpSocket, sessionSocket; static xdmcp_states state; static struct sockaddr_in req_sockaddr; static int req_socklen; static CARD32 SessionID; static CARD32 timeOutTime; static int timeOutRtx; static CARD32 defaultKeepaliveDormancy = XDM_DEF_DORMANCY; static CARD32 keepaliveDormancy = XDM_DEF_DORMANCY; static CARD16 DisplayNumber; static xdmcp_states XDM_INIT_STATE = XDM_OFF; #ifdef HASXDMAUTH static char *xdmAuthCookie; #endif static XdmcpBuffer buffer; static struct sockaddr_in ManagerAddress; static void get_xdmcp_sock( #if NeedFunctionPrototypes void #endif ); static void send_query_msg( #if NeedFunctionPrototypes void #endif ); static void recv_willing_msg( #if NeedFunctionPrototypes struct sockaddr_in */*from*/, int /*fromlen*/, unsigned /*length*/ #endif ); static void send_request_msg( #if NeedFunctionPrototypes void #endif ); static void recv_accept_msg( #if NeedFunctionPrototypes unsigned /*length*/ #endif ); static void recv_decline_msg( #if NeedFunctionPrototypes unsigned /*length*/ #endif ); static void send_manage_msg( #if NeedFunctionPrototypes void #endif ); static void recv_refuse_msg( #if NeedFunctionPrototypes unsigned /*length*/ #endif ); static void recv_failed_msg( #if NeedFunctionPrototypes unsigned /*length*/ #endif ); static void send_keepalive_msg( #if NeedFunctionPrototypes void #endif ); static void recv_alive_msg( #if NeedFunctionPrototypes unsigned /*length*/ #endif ); static XdmcpFatal( #if NeedFunctionPrototypes char */*type*/, ARRAY8Ptr /*status*/ #endif ); static XdmcpWarning( #if NeedFunctionPrototypes char */*str*/ #endif ); static get_manager_by_name( #if NeedFunctionPrototypes int /*argc*/, char **/*argv*/, int /*i*/ #endif ); static void receive_packet( #if NeedFunctionPrototypes void #endif ); static send_packet( #if NeedFunctionPrototypes void #endif ); extern int XdmcpDeadSession( #if NeedFunctionPrototypes char */*reason*/ #endif ); static void timeout( #if NeedFunctionPrototypes void #endif ); static restart( #if NeedFunctionPrototypes void #endif ); static void XdmcpBlockHandler( #if NeedFunctionPrototypes pointer /*data*/, struct timeval **/*wt*/, pointer /*LastSelectMask*/ #endif ); static void XdmcpWakeupHandler( #if NeedFunctionPrototypes pointer /*data*/, int /*i*/, pointer /*LastSelectMask*/ #endif ); void XdmcpRegisterManufacturerDisplayID( #if NeedFunctionPrototypes char * /*name*/, int /*length*/ #endif ); #ifdef MINIX static void read_cb( #if NeedFunctionPrototypes nbio_ref_t /*ref*/, int /*res*/, int /*err*/ #endif ); #endif static short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; XdmcpUseMsg () { ErrorF("-query host-name contact named host for XDMCP\n"); ErrorF("-broadcast broadcast for XDMCP\n"); ErrorF("-indirect host-name contact named host for indirect XDMCP\n"); ErrorF("-port port-num UDP port number to send messages to\n"); ErrorF("-once Terminate server after one session\n"); ErrorF("-class display-class specify display class to send in manage\n"); #ifdef HASXDMAUTH ErrorF("-cookie xdm-auth-bits specify the magic cookie for XDMCP\n"); #endif ErrorF("-displayID display-id manufacturer display ID for request\n"); } int XdmcpOptions(argc, argv, i) int argc, i; char **argv; { if (strcmp(argv[i], "-query") == 0) { get_manager_by_name(argc, argv, ++i); XDM_INIT_STATE = XDM_QUERY; AccessUsingXdmcp (); return (i + 1); } if (strcmp(argv[i], "-broadcast") == 0) { XDM_INIT_STATE = XDM_BROADCAST; AccessUsingXdmcp (); return (i + 1); } if (strcmp(argv[i], "-indirect") == 0) { get_manager_by_name(argc, argv, ++i); XDM_INIT_STATE = XDM_INDIRECT; AccessUsingXdmcp (); return (i + 1); } if (strcmp(argv[i], "-port") == 0) { ++i; xdm_udp_port = atoi(argv[i]); return (i + 1); } if (strcmp(argv[i], "-once") == 0) { OneSession = TRUE; return (i + 1); } if (strcmp(argv[i], "-class") == 0) { ++i; defaultDisplayClass = argv[i]; return (i + 1); } #ifdef HASXDMAUTH if (strcmp(argv[i], "-cookie") == 0) { ++i; xdmAuthCookie = argv[i]; return (i + 1); } #endif if (strcmp(argv[i], "-displayID") == 0) { ++i; XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i])); return (i + 1); } return (i); } /* * This section is a collection of routines for * registering server-specific data with the XDMCP * state machine. */ /* * Save all broadcast addresses away so BroadcastQuery * packets get sent everywhere */ #define MAX_BROADCAST 10 static struct sockaddr_in BroadcastAddresses[MAX_BROADCAST]; static int NumBroadcastAddresses; void XdmcpRegisterBroadcastAddress (addr) struct sockaddr_in *addr; { struct sockaddr_in *bcast; if (NumBroadcastAddresses >= MAX_BROADCAST) return; bcast = &BroadcastAddresses[NumBroadcastAddresses++]; bzero (bcast, sizeof (struct sockaddr_in)); #ifdef BSD44SOCKETS bcast->sin_len = addr->sin_len; #endif bcast->sin_family = addr->sin_family; bcast->sin_port = htons (xdm_udp_port); bcast->sin_addr = addr->sin_addr; } /* * Each authentication type is registered here; Validator * will be called to check all access attempts using * the specified authentication type */ static ARRAYofARRAY8 AuthenticationNames, AuthenticationDatas; typedef struct _AuthenticationFuncs { Bool (*Validator)(); Bool (*Generator)(); Bool (*AddAuth)(); } AuthenticationFuncsRec, *AuthenticationFuncsPtr; static AuthenticationFuncsPtr AuthenticationFuncsList; void XdmcpRegisterAuthentication (name, namelen, data, datalen, Validator, Generator, AddAuth) char *name; int namelen; char *data; int datalen; Bool (*Validator)(); Bool (*Generator)(); Bool (*AddAuth)(); { int i; ARRAY8 AuthenticationName, AuthenticationData; static AuthenticationFuncsPtr newFuncs; if (!XdmcpAllocARRAY8 (&AuthenticationName, namelen)) return; if (!XdmcpAllocARRAY8 (&AuthenticationData, datalen)) { XdmcpDisposeARRAY8 (&AuthenticationName); return; } for (i = 0; i < namelen; i++) AuthenticationName.data[i] = name[i]; for (i = 0; i < datalen; i++) AuthenticationData.data[i] = data[i]; if (!(XdmcpReallocARRAYofARRAY8 (&AuthenticationNames, AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && (newFuncs = (AuthenticationFuncsPtr) xalloc ( (AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); return; } for (i = 0; i < AuthenticationNames.length - 1; i++) newFuncs[i] = AuthenticationFuncsList[i]; newFuncs[AuthenticationNames.length-1].Validator = Validator; newFuncs[AuthenticationNames.length-1].Generator = Generator; newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth; xfree (AuthenticationFuncsList); AuthenticationFuncsList = newFuncs; AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName; AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData; } /* * Select the authentication type to be used; this is * set by the manager of the host to be connected to. */ ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; ARRAY8Ptr AuthenticationName = &noAuthenticationName; ARRAY8Ptr AuthenticationData = &noAuthenticationData; AuthenticationFuncsPtr AuthenticationFuncs; void XdmcpSetAuthentication (name) ARRAY8Ptr name; { int i; for (i = 0; i < AuthenticationNames.length; i++) if (XdmcpARRAY8Equal (&AuthenticationNames.data[i], name)) { AuthenticationName = &AuthenticationNames.data[i]; AuthenticationData = &AuthenticationDatas.data[i]; AuthenticationFuncs = &AuthenticationFuncsList[i]; break; } } /* * Register the host address for the display */ static ARRAY16 ConnectionTypes; static ARRAYofARRAY8 ConnectionAddresses; static long xdmcpGeneration; void XdmcpRegisterConnection (type, address, addrlen) int type; char *address; int addrlen; { int i; CARD8 *newAddress; if (xdmcpGeneration != serverGeneration) { XdmcpDisposeARRAY16 (&ConnectionTypes); XdmcpDisposeARRAYofARRAY8 (&ConnectionAddresses); xdmcpGeneration = serverGeneration; } newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8)); if (!newAddress) return; if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) { xfree (newAddress); return; } if (!XdmcpReallocARRAYofARRAY8 (&ConnectionAddresses, ConnectionAddresses.length + 1)) { xfree (newAddress); return; } ConnectionTypes.data[ConnectionTypes.length - 1] = (CARD16) type; for (i = 0; i < addrlen; i++) newAddress[i] = address[i]; ConnectionAddresses.data[ConnectionAddresses.length-1].data = newAddress; ConnectionAddresses.data[ConnectionAddresses.length-1].length = addrlen; } /* * Register an Authorization Name. XDMCP advertises this list * to the manager. */ static ARRAYofARRAY8 AuthorizationNames; void XdmcpRegisterAuthorizations () { XdmcpDisposeARRAYofARRAY8 (&AuthorizationNames); RegisterAuthorizations (); } void XdmcpRegisterAuthorization (name, namelen) char *name; int namelen; { ARRAY8 authName; int i; authName.data = (CARD8 *) xalloc (namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) { xfree (authName.data); return; } for (i = 0; i < namelen; i++) authName.data[i] = (CARD8) name[i]; authName.length = namelen; AuthorizationNames.data[AuthorizationNames.length-1] = authName; } /* * Register the DisplayClass string */ ARRAY8 DisplayClass; void XdmcpRegisterDisplayClass (name, length) char *name; int length; { int i; XdmcpDisposeARRAY8 (&DisplayClass); if (!XdmcpAllocARRAY8 (&DisplayClass, length)) return; for (i = 0; i < length; i++) DisplayClass.data[i] = (CARD8) name[i]; } /* * Register the Manufacturer display ID */ ARRAY8 ManufacturerDisplayID; void XdmcpRegisterManufacturerDisplayID (name, length) char *name; int length; { int i; XdmcpDisposeARRAY8 (&ManufacturerDisplayID); if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) return; for (i = 0; i < length; i++) ManufacturerDisplayID.data[i] = (CARD8) name[i]; } /* * initialize XDMCP; create the socket, compute the display * number, set up the state machine */ void XdmcpInit() { state = XDM_INIT_STATE; #ifdef HASXDMAUTH if (xdmAuthCookie) XdmAuthenticationInit (xdmAuthCookie, strlen (xdmAuthCookie)); #endif if (state != XDM_OFF) { XdmcpRegisterAuthorizations(); XdmcpRegisterDisplayClass (defaultDisplayClass, strlen (defaultDisplayClass)); AccessUsingXdmcp(); RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler, (pointer) 0); timeOutRtx = 0; DisplayNumber = (CARD16) atoi(display); get_xdmcp_sock(); send_packet(); } } void XdmcpReset () { state = XDM_INIT_STATE; if (state != XDM_OFF) { RegisterBlockAndWakeupHandlers (XdmcpBlockHandler, XdmcpWakeupHandler, (pointer) 0); timeOutRtx = 0; send_packet(); } } /* * Called whenever a new connection is created; notices the * first connection and saves it to terminate the session * when it is closed */ void XdmcpOpenDisplay(sock) int sock; { if (state != XDM_AWAIT_MANAGE_RESPONSE) return; state = XDM_RUN_SESSION; sessionSocket = sock; } void XdmcpCloseDisplay(sock) int sock; { if ((state != XDM_RUN_SESSION && state != XDM_AWAIT_ALIVE_RESPONSE) || sessionSocket != sock) return; state = XDM_INIT_STATE; if (OneSession) dispatchException |= DE_TERMINATE; else dispatchException |= DE_RESET; isItTimeToYield = TRUE; } /* * called before going to sleep, this routine * may modify the timeout value about to be sent * to select; in this way XDMCP can do appropriate things * dynamically while starting up */ /*ARGSUSED*/ static void XdmcpBlockHandler(data, wt, pReadmask) pointer data; /* unused */ struct timeval **wt; pointer pReadmask; { fd_set *LastSelectMask = (fd_set*)pReadmask; CARD32 millisToGo, wtMillis; static struct timeval waittime; if (state == XDM_OFF) return; FD_SET(xdmcpSocket, LastSelectMask); if (timeOutTime == 0) return; millisToGo = GetTimeInMillis(); if (millisToGo < timeOutTime) millisToGo = timeOutTime - millisToGo; else millisToGo = 0; if (*wt == NULL) { waittime.tv_sec = (millisToGo) / 1000; waittime.tv_usec = 1000 * (millisToGo % 1000); *wt = &waittime; } else { wtMillis = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000; if (millisToGo < wtMillis) { (*wt)->tv_sec = (millisToGo) / 1000; (*wt)->tv_usec = 1000 * (millisToGo % 1000); } } } /* * called after select returns; this routine will * recognise when XDMCP packets await and * process them appropriately */ /*ARGSUSED*/ static void XdmcpWakeupHandler(data, i, pReadmask) pointer data; /* unused */ int i; pointer pReadmask; { fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesReadable; if (state == XDM_OFF) return; if (i > 0) { if (FD_ISSET(xdmcpSocket, LastSelectMask)) { receive_packet(); FD_CLR(xdmcpSocket, LastSelectMask); } XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices); if (XFD_ANYSET(&devicesReadable)) { if (state == XDM_AWAIT_USER_INPUT) restart(); else if (state == XDM_RUN_SESSION) keepaliveDormancy = defaultKeepaliveDormancy; } if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION) timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000; } else if (timeOutTime && GetTimeInMillis() >= timeOutTime) { if (state == XDM_RUN_SESSION) { state = XDM_KEEPALIVE; send_packet(); } else timeout(); } } /* * This routine should be called from the routine that drives the * user's host menu when the user selects a host */ XdmcpSelectHost(host_sockaddr, host_len, AuthenticationName) struct sockaddr_in *host_sockaddr; int host_len; ARRAY8Ptr AuthenticationName; { state = XDM_START_CONNECTION; memmove(&req_sockaddr, host_sockaddr, host_len); req_socklen = host_len; XdmcpSetAuthentication (AuthenticationName); send_packet(); } /* * !!! this routine should be replaced by a routine that adds * the host to the user's host menu. the current version just * selects the first host to respond with willing message. */ /*ARGSUSED*/ XdmcpAddHost(from, fromlen, AuthenticationName, hostname, status) struct sockaddr_in *from; ARRAY8Ptr AuthenticationName, hostname, status; { XdmcpSelectHost(from, fromlen, AuthenticationName); } /* * A message is queued on the socket; read it and * do the appropriate thing */ ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; static void receive_packet() { struct sockaddr_in from; int fromlen = sizeof(struct sockaddr_in); XdmcpHeader header; /* read message off socket */ if (!XdmcpFill (xdmcpSocket, &buffer, (struct sockaddr *) &from, &fromlen)) return; /* reset retransmission backoff */ timeOutRtx = 0; if (!XdmcpReadHeader (&buffer, &header)) return; if (header.version != XDM_PROTOCOL_VERSION) return; switch (header.opcode) { case WILLING: recv_willing_msg(&from, fromlen, header.length); break; case UNWILLING: XdmcpFatal("Manager unwilling", &UnwillingMessage); break; case ACCEPT: recv_accept_msg(header.length); break; case DECLINE: recv_decline_msg(header.length); break; case REFUSE: recv_refuse_msg(header.length); break; case FAILED: recv_failed_msg(header.length); break; case ALIVE: recv_alive_msg(header.length); break; } } /* * send the appropriate message given the current state */ static send_packet() { int rtx; switch (state) { case XDM_QUERY: case XDM_BROADCAST: case XDM_INDIRECT: send_query_msg(); break; case XDM_START_CONNECTION: send_request_msg(); break; case XDM_MANAGE: send_manage_msg(); break; case XDM_KEEPALIVE: send_keepalive_msg(); break; } rtx = (XDM_MIN_RTX << timeOutRtx); if (rtx > XDM_MAX_RTX) rtx = XDM_MAX_RTX; timeOutTime = GetTimeInMillis() + rtx * 1000; } /* * The session is declared dead for some reason; too many * timeouts, or Keepalive failure. */ XdmcpDeadSession (reason) char *reason; { ErrorF ("XDM: %s, declaring session dead\n", reason); state = XDM_INIT_STATE; isItTimeToYield = TRUE; dispatchException |= DE_RESET; timeOutTime = 0; timeOutRtx = 0; send_packet(); } /* * Timeout waiting for an XDMCP response. */ static void timeout() { timeOutRtx++; if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT ) { XdmcpDeadSession ("too many keepalive retransmissions"); return; } else if (timeOutRtx >= XDM_RTX_LIMIT) { ErrorF("XDM: too many retransmissions\n"); state = XDM_AWAIT_USER_INPUT; timeOutTime = 0; timeOutRtx = 0; return; } switch (state) { case XDM_COLLECT_QUERY: state = XDM_QUERY; break; case XDM_COLLECT_BROADCAST_QUERY: state = XDM_BROADCAST; break; case XDM_COLLECT_INDIRECT_QUERY: state = XDM_INDIRECT; break; case XDM_AWAIT_REQUEST_RESPONSE: state = XDM_START_CONNECTION; break; case XDM_AWAIT_MANAGE_RESPONSE: state = XDM_MANAGE; break; case XDM_AWAIT_ALIVE_RESPONSE: state = XDM_KEEPALIVE; break; } send_packet(); } static restart() { state = XDM_INIT_STATE; timeOutRtx = 0; send_packet(); } XdmcpCheckAuthentication (Name, Data, packet_type) ARRAY8Ptr Name, Data; int packet_type; { return (XdmcpARRAY8Equal (Name, AuthenticationName) && (AuthenticationName->length == 0 || (*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type))); } XdmcpAddAuthorization (name, data) ARRAY8Ptr name, data; { Bool (*AddAuth)(), AddAuthorization(); if (AuthenticationFuncs && AuthenticationFuncs->AddAuth) AddAuth = AuthenticationFuncs->AddAuth; else AddAuth = AddAuthorization; return (*AddAuth) ((unsigned short)name->length, (char *)name->data, (unsigned short)data->length, (char *)data->data); } /* * from here to the end of this file are routines private * to the state machine. */ static void get_xdmcp_sock() { #ifdef STREAMSCONN struct netconfig *nconf; if ((xdmcpSocket = t_open("/dev/udp", O_RDWR, 0)) < 0) { XdmcpWarning("t_open() of /dev/udp failed"); return; } if( t_bind(xdmcpSocket,NULL,NULL) < 0 ) { XdmcpWarning("UDP socket creation failed"); t_error("t_bind(xdmcpSocket) failed" ); t_close(xdmcpSocket); return; } /* * This part of the code looks contrived. It will actually fit in nicely * when the CLTS part of Xtrans is implemented. */ if( (nconf=getnetconfigent("udp")) == NULL ) { XdmcpWarning("UDP socket creation failed: getnetconfigent()"); t_unbind(xdmcpSocket); t_close(xdmcpSocket); return; } if( netdir_options(nconf, ND_SET_BROADCAST, xdmcpSocket, NULL) ) { XdmcpWarning("UDP set broadcast option failed: netdir_options()"); freenetconfigent(nconf); t_unbind(xdmcpSocket); t_close(xdmcpSocket); return; } freenetconfigent(nconf); #else #ifndef _MINIX int soopts = 1; if ((xdmcpSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) #else /* MINIX */ char *udp_device; int r, s_errno; nwio_udpopt_t udpopt; nbio_ref_t ref; udp_device= getenv("UDP_DEVICE"); if (udp_device == NULL) udp_device= UDP_DEVICE; xdmcpSocket= open(udp_device, O_RDWR); if (xdmcpSocket != -1) { udpopt.nwuo_flags= NWUO_COPY | NWUO_LP_SEL | NWUO_EN_LOC | NWUO_DI_BROAD | NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL | NWUO_DI_IPOPT; r= ioctl(xdmcpSocket, NWIOSUDPOPT, &udpopt); if (r == -1) { s_errno= errno; close(xdmcpSocket); xdmcpSocket= -1; errno= s_errno; } ioctl(xdmcpSocket, NWIOGUDPOPT, &udpopt); ErrorF("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", udpopt.nwuo_flags, udpopt.nwuo_locport, udpopt.nwuo_remport, udpopt.nwuo_locaddr, udpopt.nwuo_remaddr); } if (xdmcpSocket != -1) { fcntl(xdmcpSocket, F_SETFD, fcntl(xdmcpSocket, F_GETFD) | FD_ASYNCHIO); nbio_register(xdmcpSocket); ref.ref_int= xdmcpSocket; nbio_setcallback(xdmcpSocket, ASIO_READ, read_cb, ref); } if (xdmcpSocket == -1) #endif /* !MINIX */ XdmcpWarning("UDP socket creation failed"); #ifdef SO_BROADCAST else if (setsockopt(xdmcpSocket, SOL_SOCKET, SO_BROADCAST, (char *)&soopts, sizeof(soopts)) < 0) XdmcpWarning("UDP set broadcast socket-option failed"); #endif /* SO_BROADCAST */ #endif /* STREAMSCONN */ } static void send_query_msg() { XdmcpHeader header; Bool broadcast = FALSE; int i; header.version = XDM_PROTOCOL_VERSION; switch(state){ case XDM_QUERY: header.opcode = (CARD16) QUERY; state = XDM_COLLECT_QUERY; break; case XDM_BROADCAST: header.opcode = (CARD16) BROADCAST_QUERY; state = XDM_COLLECT_BROADCAST_QUERY; broadcast = TRUE; break; case XDM_INDIRECT: header.opcode = (CARD16) INDIRECT_QUERY; state = XDM_COLLECT_INDIRECT_QUERY; break; } header.length = 1; for (i = 0; i < AuthenticationNames.length; i++) header.length += 2 + AuthenticationNames.data[i].length; XdmcpWriteHeader (&buffer, &header); XdmcpWriteARRAYofARRAY8 (&buffer, &AuthenticationNames); if (broadcast) { int i; for (i = 0; i < NumBroadcastAddresses; i++) XdmcpFlush (xdmcpSocket, &buffer, &BroadcastAddresses[i], sizeof (struct sockaddr_in)); } else { XdmcpFlush (xdmcpSocket, &buffer, &ManagerAddress, sizeof (ManagerAddress)); } } static void recv_willing_msg(from, fromlen, length) struct sockaddr_in *from; int fromlen; unsigned length; { ARRAY8 authenticationName; ARRAY8 hostname; ARRAY8 status; authenticationName.data = 0; hostname.data = 0; status.data = 0; if (XdmcpReadARRAY8 (&buffer, &authenticationName) && XdmcpReadARRAY8 (&buffer, &hostname) && XdmcpReadARRAY8 (&buffer, &status)) { if (length == 6 + authenticationName.length + hostname.length + status.length) { switch (state) { case XDM_COLLECT_QUERY: XdmcpSelectHost(from, fromlen, &authenticationName); break; case XDM_COLLECT_BROADCAST_QUERY: case XDM_COLLECT_INDIRECT_QUERY: XdmcpAddHost(from, fromlen, &authenticationName, &hostname, &status); break; } } } XdmcpDisposeARRAY8 (&authenticationName); XdmcpDisposeARRAY8 (&hostname); XdmcpDisposeARRAY8 (&status); } static void send_request_msg() { XdmcpHeader header; int length; int i; ARRAY8 authenticationData; header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) REQUEST; length = 2; /* display number */ length += 1 + 2 * ConnectionTypes.length; /* connection types */ length += 1; /* connection addresses */ for (i = 0; i < ConnectionAddresses.length; i++) length += 2 + ConnectionAddresses.data[i].length; authenticationData.length = 0; authenticationData.data = 0; if (AuthenticationFuncs) { (*AuthenticationFuncs->Generator) (AuthenticationData, &authenticationData, REQUEST); } length += 2 + AuthenticationName->length; /* authentication name */ length += 2 + authenticationData.length; /* authentication data */ length += 1; /* authorization names */ for (i = 0; i < AuthorizationNames.length; i++) length += 2 + AuthorizationNames.data[i].length; length += 2 + ManufacturerDisplayID.length; /* display ID */ header.length = length; if (!XdmcpWriteHeader (&buffer, &header)) { XdmcpDisposeARRAY8 (&authenticationData); return; } XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteARRAY16 (&buffer, &ConnectionTypes); XdmcpWriteARRAYofARRAY8 (&buffer, &ConnectionAddresses); XdmcpWriteARRAY8 (&buffer, AuthenticationName); XdmcpWriteARRAY8 (&buffer, &authenticationData); XdmcpDisposeARRAY8 (&authenticationData); XdmcpWriteARRAYofARRAY8 (&buffer, &AuthorizationNames); XdmcpWriteARRAY8 (&buffer, &ManufacturerDisplayID); if (XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen)) state = XDM_AWAIT_REQUEST_RESPONSE; } static void recv_accept_msg(length) unsigned length; { CARD32 AcceptSessionID; ARRAY8 AcceptAuthenticationName, AcceptAuthenticationData; ARRAY8 AcceptAuthorizationName, AcceptAuthorizationData; if (state != XDM_AWAIT_REQUEST_RESPONSE) return; AcceptAuthenticationName.data = 0; AcceptAuthenticationData.data = 0; AcceptAuthorizationName.data = 0; AcceptAuthorizationData.data = 0; if (XdmcpReadCARD32 (&buffer, &AcceptSessionID) && XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationName) && XdmcpReadARRAY8 (&buffer, &AcceptAuthenticationData) && XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationName) && XdmcpReadARRAY8 (&buffer, &AcceptAuthorizationData)) { if (length == 12 + AcceptAuthenticationName.length + AcceptAuthenticationData.length + AcceptAuthorizationName.length + AcceptAuthorizationData.length) { if (!XdmcpCheckAuthentication (&AcceptAuthenticationName, &AcceptAuthenticationData, ACCEPT)) { XdmcpFatal ("Authentication Failure", &AcceptAuthenticationName); } /* permit access control manipulations from this host */ AugmentSelf (&req_sockaddr, req_socklen); /* if the authorization specified in the packet fails * to be acceptable, enable the local addresses */ if (!XdmcpAddAuthorization (&AcceptAuthorizationName, &AcceptAuthorizationData)) { AddLocalHosts (); } SessionID = AcceptSessionID; state = XDM_MANAGE; send_packet(); } } XdmcpDisposeARRAY8 (&AcceptAuthenticationName); XdmcpDisposeARRAY8 (&AcceptAuthenticationData); XdmcpDisposeARRAY8 (&AcceptAuthorizationName); XdmcpDisposeARRAY8 (&AcceptAuthorizationData); } static void recv_decline_msg(length) unsigned length; { ARRAY8 status, DeclineAuthenticationName, DeclineAuthenticationData; status.data = 0; DeclineAuthenticationName.data = 0; DeclineAuthenticationData.data = 0; if (XdmcpReadARRAY8 (&buffer, &status) && XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationName) && XdmcpReadARRAY8 (&buffer, &DeclineAuthenticationData)) { if (length == 6 + status.length + DeclineAuthenticationName.length + DeclineAuthenticationData.length && XdmcpCheckAuthentication (&DeclineAuthenticationName, &DeclineAuthenticationData, DECLINE)) { XdmcpFatal ("Session declined", &status); } } XdmcpDisposeARRAY8 (&status); XdmcpDisposeARRAY8 (&DeclineAuthenticationName); XdmcpDisposeARRAY8 (&DeclineAuthenticationData); } static void send_manage_msg() { XdmcpHeader header; header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) MANAGE; header.length = 8 + DisplayClass.length; if (!XdmcpWriteHeader (&buffer, &header)) return; XdmcpWriteCARD32 (&buffer, SessionID); XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteARRAY8 (&buffer, &DisplayClass); state = XDM_AWAIT_MANAGE_RESPONSE; XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen); } static void recv_refuse_msg(length) unsigned length; { CARD32 RefusedSessionID; if (state != XDM_AWAIT_MANAGE_RESPONSE) return; if (length != 4) return; if (XdmcpReadCARD32 (&buffer, &RefusedSessionID)) { if (RefusedSessionID == SessionID) { state = XDM_START_CONNECTION; send_packet(); } } } static void recv_failed_msg(length) unsigned length; { CARD32 FailedSessionID; ARRAY8 status; if (state != XDM_AWAIT_MANAGE_RESPONSE) return; status.data = 0; if (XdmcpReadCARD32 (&buffer, &FailedSessionID) && XdmcpReadARRAY8 (&buffer, &status)) { if (length == 6 + status.length && SessionID == FailedSessionID) { XdmcpFatal ("Session failed", &status); } } XdmcpDisposeARRAY8 (&status); } static void send_keepalive_msg() { XdmcpHeader header; header.version = XDM_PROTOCOL_VERSION; header.opcode = (CARD16) KEEPALIVE; header.length = 6; XdmcpWriteHeader (&buffer, &header); XdmcpWriteCARD16 (&buffer, DisplayNumber); XdmcpWriteCARD32 (&buffer, SessionID); state = XDM_AWAIT_ALIVE_RESPONSE; XdmcpFlush (xdmcpSocket, &buffer, &req_sockaddr, req_socklen); } static void recv_alive_msg (length) unsigned length; { CARD8 SessionRunning; CARD32 AliveSessionID; int dormancy; if (state != XDM_AWAIT_ALIVE_RESPONSE) return; if (length != 5) return; if (XdmcpReadCARD8 (&buffer, &SessionRunning) && XdmcpReadCARD32 (&buffer, &AliveSessionID)) { if (SessionRunning && AliveSessionID == SessionID) { /* backoff dormancy period */ state = XDM_RUN_SESSION; if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) > keepaliveDormancy * 1000) { keepaliveDormancy <<= 1; if (keepaliveDormancy > XDM_MAX_DORMANCY) keepaliveDormancy = XDM_MAX_DORMANCY; } timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000; } else { XdmcpDeadSession ("Alive respose indicates session dead"); } } } static XdmcpFatal (type, status) char *type; ARRAY8Ptr status; { FatalError ("XDMCP fatal error: %s %*.*s\n", type, status->length, status->length, status->data); } static XdmcpWarning(str) char *str; { ErrorF("XDMCP warning: %s\n", str); } static get_manager_by_name(argc, argv, i) int argc, i; char **argv; { struct hostent *hep; if (i == argc) { ErrorF("Xserver: missing host name in command line\n"); exit(1); } if (!(hep = gethostbyname(argv[i]))) { ErrorF("Xserver: unknown host: %s\n", argv[i]); exit(1); } #ifndef _MINIX if (hep->h_length == sizeof (struct in_addr)) #else if (hep->h_length == sizeof (ipaddr_t)) #endif { memmove(&ManagerAddress.sin_addr, hep->h_addr, hep->h_length); #ifdef BSD44SOCKETS ManagerAddress.sin_len = sizeof(ManagerAddress); #endif ManagerAddress.sin_family = AF_INET; ManagerAddress.sin_port = htons (xdm_udp_port); } else { ErrorF ("Xserver: host on strange network %s\n", argv[i]); exit (1); } } #ifdef MINIX static char read_buffer[XDM_MAX_MSGLEN+sizeof(udp_io_hdr_t)]; static int read_inprogress; static int read_size; int XdmcpFill (fd, buffer, from, fromlen) int fd; XdmcpBufferPtr buffer; XdmcpNetaddr from; /* return */ int *fromlen; /* return */ { int r; if (read_inprogress) return 0; if (read_size != 0) { r= read_size; read_size= 0; return MNX_XdmcpFill(fd, buffer, from, fromlen, read_buffer, r); } r= read(fd, read_buffer, sizeof(read_buffer)); if (r > 0) { return MNX_XdmcpFill(fd, buffer, from, fromlen, read_buffer, r); } else if (r == -1 && errno == EINPROGRESS) { read_inprogress= 1; nbio_inprogress(fd, ASIO_READ, 1 /* read */, 0 /* write */, 0 /* except */); return 0; } else FatalError("XdmcpFill: read failed: %s\n", r == 0 ? "EOF" : strerror(errno)); return 0; } static void read_cb(ref, res, err) nbio_ref_t ref; int res; int err; { if (res <= 0) { FatalError("xdmcp'read_cb: read failed: %s\n", res == 0 ? "EOF" : strerror(err)); } read_inprogress= 0; read_size= res; } #endif #else static int xdmcp_non_empty; /* avoid complaint by ranlib */ #endif /* XDMCP */ vnc_unixsrc/Xvnc/programs/Xserver/os/WaitFor.c0100664000076400007640000004736707120677563021074 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: WaitFor.c /main/55 1996/12/02 10:22:24 lehors $ */ /* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.11.2.3 1998/01/31 14:23:33 hohndel Exp $ */ /***************************************************************** * OS Dependent input routines: * * WaitForSomething * TimerForce, TimerSet, TimerCheck, TimerFree * *****************************************************************/ #ifdef WIN32 #include #endif #include "Xos.h" /* for strings, fcntl, time */ #include #ifdef X_NOT_STDC_ENV extern int errno; #endif #include #include "X.h" #include "misc.h" #ifdef MINIX #include #define select(n,r,w,x,t) nbio_select(n,r,w,x,t) #endif #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif #include #include "osdep.h" #include "dixstruct.h" #include "opaque.h" #ifdef DPMSExtension #include "dpms.h" extern void DPMSSet(); #endif extern fd_set AllSockets; extern fd_set AllClients; extern fd_set LastSelectMask; extern fd_set WellKnownConnections; extern fd_set EnabledDevices; extern fd_set ClientsWithInput; extern fd_set ClientsWriteBlocked; extern fd_set OutputPending; extern int ConnectionTranslation[]; extern Bool NewOutputPending; extern Bool AnyClientsWriteBlocked; extern WorkQueuePtr workQueue; #ifdef XTESTEXT1 /* * defined in xtestext1dd.c */ extern int playback_on; #endif /* XTESTEXT1 */ struct _OsTimerRec { OsTimerPtr next; CARD32 expires; OsTimerCallback callback; pointer arg; }; static void DoTimer(); static OsTimerPtr timers; /***************** * WaitForSomething: * Make the server suspend until there is * 1. data from clients or * 2. input events available or * 3. ddx notices something of interest (graphics * queue ready, etc.) or * 4. clients that have buffered replies/events are ready * * If the time between INPUT events is * greater than ScreenSaverTime, the display is turned off (or * saved, depending on the hardware). So, WaitForSomething() * has to handle this also (that's why the select() has a timeout. * For more info on ClientsWithInput, see ReadRequestFromClient(). * pClientsReady is an array to store ready client->index values into. *****************/ static INT32 timeTilFrob = 0; /* while screen saving */ #if !defined(AMOEBA) int WaitForSomething(pClientsReady) int *pClientsReady; { int i; struct timeval waittime, *wt; INT32 timeout; #ifdef DPMSExtension INT32 standbyTimeout, suspendTimeout, offTimeout; #endif fd_set clientsReadable; fd_set clientsWritable; int curclient; int selecterr; int nready; fd_set devicesReadable; CARD32 now; FD_ZERO(&clientsReadable); /* We need a while loop here to handle crashed connections and the screen saver timeout */ while (1) { /* deal with any blocked jobs */ if (workQueue) ProcessWorkQueue(); if (XFD_ANYSET (&ClientsWithInput)) { XFD_COPYSET (&ClientsWithInput, &clientsReadable); break; } #ifdef DPMSExtension if (ScreenSaverTime > 0 || DPMSEnabled || timers) #else if (ScreenSaverTime > 0 || timers) #endif now = GetTimeInMillis(); wt = NULL; if (timers) { while (timers && timers->expires <= now) DoTimer(timers, now, &timers); if (timers) { timeout = timers->expires - now; waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); wt = &waittime; } } #ifdef DPMSExtension if (ScreenSaverTime > 0 || (DPMSEnabled && (DPMSStandbyTime > 0 || DPMSSuspendTime > 0 || DPMSOffTime > 0))) #else if (ScreenSaverTime > 0) #endif { #ifdef DPMSExtension if (ScreenSaverTime > 0) timeout = (ScreenSaverTime - (now - lastDeviceEventTime.milliseconds)); if (DPMSStandbyTime > 0) standbyTimeout = (DPMSStandbyTime - (now - lastDeviceEventTime.milliseconds)); if (DPMSSuspendTime > 0) suspendTimeout = (DPMSSuspendTime - (now - lastDeviceEventTime.milliseconds)); if (DPMSOffTime > 0) offTimeout = (DPMSOffTime - (now - lastDeviceEventTime.milliseconds)); #else timeout = (ScreenSaverTime - (now - lastDeviceEventTime.milliseconds)); #endif /* DPMSExtension */ #ifdef DPMSExtension if (timeout <= 0 && ScreenSaverTime > 0) #else if (timeout <= 0) /* may be forced by AutoResetServer() */ #endif /* DPMSExtension */ { INT32 timeSinceSave; timeSinceSave = -timeout; if (timeSinceSave >= timeTilFrob && timeTilFrob >= 0) { ResetOsBuffers(); /* not ideal, but better than nothing */ SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive); #ifdef DPMSExtension if (ScreenSaverInterval > 0 && DPMSPowerLevel == DPMSModeOn) #else if (ScreenSaverInterval) #endif /* DPMSExtension */ /* round up to the next ScreenSaverInterval */ timeTilFrob = ScreenSaverInterval * ((timeSinceSave + ScreenSaverInterval) / ScreenSaverInterval); else timeTilFrob = -1; } timeout = timeTilFrob - timeSinceSave; } else { if (ScreenSaverTime > 0 && timeout > ScreenSaverTime) timeout = ScreenSaverTime; timeTilFrob = 0; } #ifdef DPMSExtension if (DPMSEnabled) { if (standbyTimeout > 0 && (timeout <= 0 || timeout > standbyTimeout)) timeout = standbyTimeout; if (suspendTimeout > 0 && (timeout <= 0 || timeout > suspendTimeout)) timeout = suspendTimeout; if (offTimeout > 0 && (timeout <= 0 || timeout > offTimeout)) timeout = offTimeout; } #endif if (timeout > 0 && (!wt || timeout < (timers->expires - now))) { waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); wt = &waittime; } #ifdef DPMSExtension /* don't bother unless it's switched on */ if (DPMSEnabled) { /* * If this mode's enabled, and if the time's come * and if we're still at a lesser mode, do it now. */ if (DPMSStandbyTime > 0) { if (standbyTimeout <= 0) { if (DPMSPowerLevel < DPMSModeStandby) { DPMSSet(DPMSModeStandby); } } } /* * and ditto. Note that since these modes can have the * same timeouts, they can happen at the same time. */ if (DPMSSuspendTime > 0) { if (suspendTimeout <= 0) { if (DPMSPowerLevel < DPMSModeSuspend) { DPMSSet(DPMSModeSuspend); } } } if (DPMSOffTime > 0) { if (offTimeout <= 0) { if (DPMSPowerLevel < DPMSModeOff) { DPMSSet(DPMSModeOff); } } } } #endif } XFD_COPYSET(&AllSockets, &LastSelectMask); BlockHandler((pointer)&wt, (pointer)&LastSelectMask); if (NewOutputPending) FlushAllOutput(); #ifdef XTESTEXT1 /* XXX how does this interact with new write block handling? */ if (playback_on) { wt = &waittime; XTestComputeWaitTime (&waittime); } #endif /* XTESTEXT1 */ /* keep this check close to select() call to minimize race */ if (dispatchException) i = -1; else if (AnyClientsWriteBlocked) { XFD_COPYSET(&ClientsWriteBlocked, &clientsWritable); i = Select (MAXSOCKS, &LastSelectMask, &clientsWritable, NULL, wt); } else i = Select (MAXSOCKS, &LastSelectMask, NULL, NULL, wt); selecterr = errno; WakeupHandler(i, (pointer)&LastSelectMask); #ifdef XTESTEXT1 if (playback_on) { i = XTestProcessInputAction (i, &waittime); } #endif /* XTESTEXT1 */ if (i <= 0) /* An error or timeout occurred */ { if (dispatchException) return 0; FD_ZERO(&clientsWritable); if (i < 0) if (selecterr == EBADF) /* Some client disconnected */ { CheckConnections (); if (! XFD_ANYSET (&AllClients)) return 0; } else if (selecterr == EINVAL) { FatalError("WaitForSomething(): select: errno=%d\n", selecterr); } else if (selecterr != EINTR) { ErrorF("WaitForSomething(): select: errno=%d\n", selecterr); } if (timers) { now = GetTimeInMillis(); while (timers && timers->expires <= now) DoTimer(timers, now, &timers); } if (*checkForInput[0] != *checkForInput[1]) return 0; } else { #ifdef WIN32 fd_set tmp_set; #endif if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable)) { NewOutputPending = TRUE; XFD_ORSET(&OutputPending, &clientsWritable, &OutputPending); XFD_UNSET(&ClientsWriteBlocked, &clientsWritable); if (! XFD_ANYSET(&ClientsWriteBlocked)) AnyClientsWriteBlocked = FALSE; } XFD_ANDSET(&devicesReadable, &LastSelectMask, &EnabledDevices); XFD_ANDSET(&clientsReadable, &LastSelectMask, &AllClients); #ifndef WIN32 if (LastSelectMask.fds_bits[0] & WellKnownConnections.fds_bits[0]) #else XFD_ANDSET(&tmp_set, &LastSelectMask, &WellKnownConnections); if (XFD_ANYSET(&tmp_set)) #endif QueueWorkProc(EstablishNewConnections, NULL, (pointer)&LastSelectMask); #ifdef DPMSExtension if (XFD_ANYSET (&devicesReadable) && (DPMSPowerLevel != DPMSModeOn)) DPMSSet(DPMSModeOn); #endif if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) break; } } nready = 0; if (XFD_ANYSET (&clientsReadable)) { #ifndef WIN32 for (i=0; ipriority; if (nready == 0 || client_priority > highest_priority) { /* Either we found the first client, or we found * a client whose priority is greater than all others * that have been found so far. Either way, we want * to initialize the list of clients to contain just * this client. */ pClientsReady[0] = client_index; highest_priority = client_priority; nready = 1; } /* the following if makes sure that multiple same-priority * clients get batched together */ else if (client_priority == highest_priority) #endif { pClientsReady[nready++] = client_index; } #ifndef WIN32 clientsReadable.fds_bits[i] &= ~(((fd_mask)1) << curclient); } #else FD_CLR(curclient, &clientsReadable); #endif } } return nready; } #if 0 /* * This is not always a macro. */ ANYSET(src) FdMask *src; { int i; for (i=0; ipriority; if (nready == 0 || client_priority > highest_priority) { pClientsReady[0] = client_index; highest_priority = client_priority; nready = 1; } else if (client_priority == highest_priority) #endif { pClientsReady[nready++] = client_index; } clientsReadable[i] &= ~(((FdMask)1) << curclient); } } break; } wt = -1; now = GetTimeInMillis(); if (timers) { while (timers && timers->expires <= now) DoTimer(timers, now, &timers); if (timers) { timeout = timers->expires - now; wt = timeout; } } if (ScreenSaverTime) { timeout = ScreenSaverTime - TimeSinceLastInputEvent(); if (timeout <= 0) { /* may be forced by AutoResetServer() */ long timeSinceSave; timeSinceSave = -timeout; if ((timeSinceSave >= timeTilFrob) && (timeTilFrob >= 0)) { SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive); if (ScreenSaverInterval) /* round up to the next ScreenSaverInterval */ timeTilFrob = ScreenSaverInterval * ((timeSinceSave + ScreenSaverInterval) / ScreenSaverInterval); else timeTilFrob = -1; } timeout = timeTilFrob - timeSinceSave; } else { if (timeout > ScreenSaverTime) timeout = ScreenSaverTime; timeTilFrob = 0; } if (wt < 0 || (timeTilFrob >= 0 && wt > timeout)) { wt = timeout; } } /* Check for new clients. We do this here and not in the listener * threads because we cannot be sure that dix is re-entrant, and * we need to call some dix routines during startup. */ if (nNewConns) { QueueWorkProc(EstablishNewConnections, NULL, (pointer) 0); } /* Call device dependent block handlers, which may want to * specify a different timeout (e.g. used for key auto-repeat). */ wtp = (struct timeval *) NULL; BlockHandler((pointer)&wtp, (pointer)NULL); if (wtp) wt = (wtp->tv_sec * 1000) + (wtp->tv_usec / 1000); if (NewOutputPending) FlushAllOutput(); /* TODO: XTESTEXT1 */ nready = AmFindReadyClients(pClientsReady, AllSockets); /* If we found some work, or the iop server has us informed about * new device events, we return. */ if (nready || AmoebaEventsAvailable()) break; if (dispatchException) return 0; /* Nothing interesting is available. Go to sleep with a timeout. * The other threads will wake us when needed. */ i = SleepMainThread(wt); /* Wake up any of the sleeping handlers */ WakeupHandler((unsigned long)0, (pointer)NULL); /* TODO: XTESTEXT1 */ if (dispatchException) return 0; if (i == -1) { /* An error or timeout occurred */ return 0; } } dbprintf(("WaitForSomething: %d clients ready\n", nready)); return nready; } #endif /* AMOEBA */ static void DoTimer(timer, now, prev) register OsTimerPtr timer; CARD32 now; OsTimerPtr *prev; { CARD32 newTime; *prev = timer->next; timer->next = NULL; newTime = (*timer->callback)(timer, now, timer->arg); if (newTime) TimerSet(timer, 0, newTime, timer->callback, timer->arg); } OsTimerPtr TimerSet(timer, flags, millis, func, arg) register OsTimerPtr timer; int flags; CARD32 millis; OsTimerCallback func; pointer arg; { register OsTimerPtr *prev; CARD32 now = GetTimeInMillis(); if (!timer) { timer = (OsTimerPtr)xalloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } else { for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; if (flags & TimerForceOld) (void)(*timer->callback)(timer, now, timer->arg); break; } } } if (!millis) return timer; if (!(flags & TimerAbsolute)) millis += now; timer->expires = millis; timer->callback = func; timer->arg = arg; if (millis <= now) { timer->next = NULL; millis = (*timer->callback)(timer, now, timer->arg); if (!millis) return timer; } for (prev = &timers; *prev && millis > (*prev)->expires; prev = &(*prev)->next) ; timer->next = *prev; *prev = timer; return timer; } Bool TimerForce(timer) register OsTimerPtr timer; { register OsTimerPtr *prev; register CARD32 newTime; for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { DoTimer(timer, GetTimeInMillis(), prev); return TRUE; } } return FALSE; } void TimerCancel(timer) register OsTimerPtr timer; { register OsTimerPtr *prev; if (!timer) return; for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; break; } } } void TimerFree(timer) register OsTimerPtr timer; { if (!timer) return; TimerCancel(timer); xfree(timer); } void TimerCheck() { register CARD32 now = GetTimeInMillis(); while (timers && timers->expires <= now) DoTimer(timers, now, &timers); } void TimerInit() { OsTimerPtr timer; while (timer = timers) { timers = timer->next; xfree(timer); } } vnc_unixsrc/Xvnc/programs/Xserver/os/mitauth.c0100664000076400007640000001037607120677563021162 0ustar constconst/* $XConsortium: mitauth.c /main/11 1996/10/28 22:56:36 dpw $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * MIT-MAGIC-COOKIE-1 authorization scheme * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "os.h" #include "dixstruct.h" static struct auth { struct auth *next; unsigned short len; char *data; XID id; } *mit_auth; int MitAddCookie (data_length, data, id) unsigned short data_length; char *data; XID id; { struct auth *new; new = (struct auth *) xalloc (sizeof (struct auth)); if (!new) return 0; new->data = (char *) xalloc ((unsigned) data_length); if (!new->data) { xfree(new); return 0; } new->next = mit_auth; mit_auth = new; memmove(new->data, data, (int) data_length); new->len = data_length; new->id = id; return 1; } XID MitCheckCookie (data_length, data, client, reason) unsigned short data_length; char *data; ClientPtr client; char **reason; { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (data_length == auth->len && memcmp (data, auth->data, (int) data_length) == 0) return auth->id; } *reason = "Invalid MIT-MAGIC-COOKIE-1 key"; return (XID) -1; } int MitResetCookie () { struct auth *auth, *next; for (auth = mit_auth; auth; auth=next) { next = auth->next; xfree (auth->data); xfree (auth); } mit_auth = 0; return 0; } XID MitToID (data_length, data) unsigned short data_length; char *data; { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (data_length == auth->len && memcmp (data, auth->data, data_length) == 0) return auth->id; } return (XID) -1; } int MitFromID (id, data_lenp, datap) XID id; unsigned short *data_lenp; char **datap; { struct auth *auth; for (auth = mit_auth; auth; auth=auth->next) { if (id == auth->id) { *data_lenp = auth->len; *datap = auth->data; return 1; } } return 0; } int MitRemoveCookie (data_length, data) unsigned short data_length; char *data; { struct auth *auth, *prev; prev = 0; for (auth = mit_auth; auth; prev = auth, auth=auth->next) { if (data_length == auth->len && memcmp (data, auth->data, data_length) == 0) { if (prev) prev->next = auth->next; else mit_auth = auth->next; xfree (auth->data); xfree (auth); return 1; } } return 0; } #ifdef XCSECURITY static char cookie[16]; /* 128 bits */ XID MitGenerateCookie (data_length, data, id, data_length_return, data_return) unsigned int data_length; char *data; XID id; unsigned int *data_length_return; char **data_return; { int i = 0; int status; while (data_length--) { cookie[i++] += *data++; if (i >= sizeof (cookie)) i = 0; } GenerateRandomData(sizeof (cookie), cookie); status = MitAddCookie(sizeof (cookie), cookie, id); if (!status) { id = -1; } else { *data_return = cookie; *data_length_return = sizeof (cookie); } return id; } #endif /* XCSECURITY */ vnc_unixsrc/Xvnc/programs/Xserver/os/lbxio.c0100664000076400007640000003301207120677563020614 0ustar constconst/*********************************************************** Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. Copyright 1996 X Consortium, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or MIT not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: lbxio.c /main/10 1996/12/16 23:03:30 rws $ */ /* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.8 1997/01/18 07:18:31 dawes Exp $ */ #include #include #ifdef X_NOT_STDC_ENV extern int errno; #endif #include "Xmd.h" #include #ifndef Lynx #include #ifndef __EMX__ #include #endif #else #include #endif #include "X.h" #include "Xproto.h" #include "os.h" #include "Xpoll.h" #include "osdep.h" #include "opaque.h" #include "dixstruct.h" #include "misc.h" #include "lbxserve.h" /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) #else #ifdef EAGAIN #define ETEST(err) (err == EAGAIN) #else #define ETEST(err) (err == EWOULDBLOCK) #endif #endif extern fd_set ClientsWithInput, IgnoredClientsWithInput; extern fd_set AllClients, AllSockets; extern fd_set ClientsWriteBlocked; extern fd_set OutputPending; extern int ConnectionTranslation[]; extern Bool NewOutputPending; extern Bool AnyClientsWriteBlocked; extern Bool CriticalOutputPending; extern int timesThisConnection; extern ConnectionInputPtr FreeInputs; extern ConnectionOutputPtr FreeOutputs; extern OsCommPtr AvailableInput; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) #define YieldControl() \ { isItTimeToYield = TRUE; \ timesThisConnection = 0; } #define YieldControlNoInput() \ { YieldControl(); \ FD_CLR(fd, &ClientsWithInput); } void SwitchClientInput (client, pending) ClientPtr client; Bool pending; { OsCommPtr oc = (OsCommPtr)client->osPrivate; ConnectionTranslation[oc->fd] = client->index; if (pending) FD_SET(oc->fd, &ClientsWithInput); else YieldControl(); } void LbxPrimeInput(client, proxy) ClientPtr client; LbxProxyPtr proxy; { OsCommPtr oc = (OsCommPtr)client->osPrivate; ConnectionInputPtr oci = oc->input; if (oci && proxy->compHandle) { char *extra = oci->bufptr + oci->lenLastReq; int left = oci->bufcnt + oci->buffer - extra; (*proxy->streamOpts.streamCompStuffInput)(oc->fd, (unsigned char *)extra, left); oci->bufcnt -= left; AvailableInput = oc; } } void AvailableClientInput (client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; if (FD_ISSET(oc->fd, &AllSockets)) FD_SET(oc->fd, &ClientsWithInput); } /***************************************************************** * AppendFakeRequest * Append a (possibly partial) request in as the last request. * **********************/ Bool AppendFakeRequest (client, data, count) ClientPtr client; char *data; int count; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; register int gotnow; if (!oci) { if (oci = FreeInputs) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; oc->input = oci; } else if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; /* do not free AvailableInput here, it could be proxy's */ oci->bufptr += oci->lenLastReq; oci->lenLastReq = 0; gotnow = oci->bufcnt + oci->buffer - oci->bufptr; if ((gotnow + count) > oci->size) { char *ibuf; ibuf = (char *)xrealloc(oci->buffer, gotnow + count); if (!ibuf) return(FALSE); oci->size = gotnow + count; oci->buffer = ibuf; oci->bufptr = ibuf + oci->bufcnt - gotnow; } if (oci->bufcnt + count > oci->size) { memmove(oci->buffer, oci->bufptr, gotnow); oci->bufcnt = gotnow; oci->bufptr = oci->buffer; } memmove(oci->bufptr + gotnow, data, count); oci->bufcnt += count; gotnow += count; if ((gotnow >= sizeof(xReq)) && (gotnow >= (int)(get_req_len((xReq *)oci->bufptr, client) << 2))) FD_SET(fd, &ClientsWithInput); else YieldControlNoInput(); return(TRUE); } static int LbxWrite(trans_conn, proxy, buf, len) XtransConnInfo trans_conn; LbxProxyPtr proxy; char *buf; int len; { struct iovec iov; int n; int notWritten; notWritten = len; iov.iov_base = buf; iov.iov_len = len; while (notWritten) { errno = 0; if (proxy->compHandle) n = (*proxy->streamOpts.streamCompWriteV)(proxy->fd, &iov, 1); else n = _XSERVTransWritev(trans_conn, &iov, 1); if (n >= 0) { iov.iov_base = (char *)iov.iov_base + n; notWritten -= n; iov.iov_len = notWritten; } else if (ETEST(errno) #ifdef SUNSYSV /* check for another brain-damaged OS bug */ || (errno == 0) #endif #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ || ((errno == EMSGSIZE) && (iov.iov_len == 1)) #endif ) break; #ifdef EMSGSIZE /* check for another brain-damaged OS bug */ else if (errno == EMSGSIZE) iov.iov_len >>= 1; #endif else return -1; } return len - notWritten; } static Bool LbxAppendOutput(proxy, client, oco) LbxProxyPtr proxy; ClientPtr client; ConnectionOutputPtr oco; { ConnectionOutputPtr noco = proxy->olast; LbxClientPtr lbxClient = LbxClient(client); if (!lbxClient) { xfree(oco->buf); xfree(oco); return TRUE; } if (noco) LbxReencodeOutput(client, (char *)noco->buf, &noco->count, (char *)oco->buf, &oco->count); else LbxReencodeOutput(client, (char *)NULL, (int *)NULL, (char *)oco->buf, &oco->count); if (!oco->count) { if (oco->size > BUFWATERMARK) { xfree(oco->buf); xfree(oco); } else { oco->next = FreeOutputs; FreeOutputs = oco; } return TRUE; } if ((lbxClient->id != proxy->cur_send_id) && proxy->lbxClients[0]) { xLbxSwitchEvent *ev; int n; if (!noco || (noco->size - noco->count) < sz_xLbxSwitchEvent) { if (noco = FreeOutputs) FreeOutputs = noco->next; else noco = AllocateOutputBuffer(); if (!noco) { MarkClientException(client); return FALSE; } noco->next = NULL; if (proxy->olast) proxy->olast->next = noco; else proxy->ofirst = noco; proxy->olast = noco; } ev = (xLbxSwitchEvent *) (noco->buf + noco->count); noco->count += sz_xLbxSwitchEvent; proxy->cur_send_id = lbxClient->id; ev->type = LbxEventCode; ev->lbxType = LbxSwitchEvent; ev->pad = 0; ev->client = proxy->cur_send_id; if (LbxProxyClient(proxy)->swapped) { swapl(&ev->client, n); } } oco->next = NULL; if (proxy->olast) proxy->olast->next = oco; else proxy->ofirst = oco; proxy->olast = oco; return TRUE; } static int LbxClientOutput(client, oc, extraBuf, extraCount, nocompress) ClientPtr client; OsCommPtr oc; char *extraBuf; int extraCount; Bool nocompress; { ConnectionOutputPtr oco; int len; if (oco = oc->output) { oc->output = NULL; if (!LbxAppendOutput(oc->proxy, client, oco)) return -1; } if (extraCount) { NewOutputPending = TRUE; FD_SET(oc->fd, &OutputPending); len = (extraCount + 3) & ~3; if ((oco = FreeOutputs) && (oco->size >= len)) FreeOutputs = oco->next; else { oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); if (!oco) { MarkClientException(client); return -1; } oco->size = len; if (oco->size < BUFSIZE) oco->size = BUFSIZE; oco->buf = (unsigned char *) xalloc(oco->size); if (!oco->buf) { xfree(oco); MarkClientException(client); return -1; } } oco->count = len; oco->nocompress = nocompress; memmove((char *)oco->buf, extraBuf, extraCount); if (!nocompress && oco->count < oco->size) oc->output = oco; else if (!LbxAppendOutput(oc->proxy, client, oco)) return -1; } return extraCount; } void LbxForceOutput(proxy) LbxProxyPtr proxy; { int i; LbxClientPtr lbxClient; OsCommPtr coc; ConnectionOutputPtr oco; for (i = proxy->maxIndex; i >= 0; i--) { /* proxy must be last */ lbxClient = proxy->lbxClients[i]; if (!lbxClient) continue; coc = (OsCommPtr)lbxClient->client->osPrivate; if (oco = coc->output) { coc->output = NULL; LbxAppendOutput(proxy, lbxClient->client, oco); } } } int LbxFlushClient(who, oc, extraBuf, extraCount) ClientPtr who; OsCommPtr oc; char *extraBuf; int extraCount; { LbxProxyPtr proxy; ConnectionOutputPtr oco; int n; XtransConnInfo trans_conn; if (extraBuf) return LbxClientOutput(who, oc, extraBuf, extraCount, FALSE); proxy = oc->proxy; if (!proxy->lbxClients[0]) return 0; LbxForceOutput(proxy); if (!proxy->compHandle) trans_conn = ((OsCommPtr)LbxProxyClient(proxy)->osPrivate)->trans_conn; while (oco = proxy->ofirst) { /* XXX bundle up into writev someday */ if (proxy->compHandle) { if (oco->nocompress) (*proxy->streamOpts.streamCompOff)(proxy->fd); n = LbxWrite(NULL, proxy, (char *)oco->buf, oco->count); if (oco->nocompress) (*proxy->streamOpts.streamCompOn)(proxy->fd); } else n = LbxWrite(trans_conn, proxy, (char *)oco->buf, oco->count); if (n < 0) { ClientPtr pclient = LbxProxyClient(proxy); if (proxy->compHandle) trans_conn = ((OsCommPtr)pclient->osPrivate)->trans_conn; _XSERVTransDisconnect(trans_conn); _XSERVTransClose(trans_conn); ((OsCommPtr)pclient->osPrivate)->trans_conn = NULL; MarkClientException(pclient); return 0; } else if (n == oco->count) { proxy->ofirst = oco->next; if (!proxy->ofirst) proxy->olast = NULL; if (oco->size > BUFWATERMARK) { xfree(oco->buf); xfree(oco); } else { oco->next = FreeOutputs; oco->count = 0; FreeOutputs = oco; } } else { if (n) { oco->count -= n; memmove((char *)oco->buf, (char *)oco->buf + n, oco->count); } break; } } if ((proxy->compHandle && (*proxy->streamOpts.streamCompFlush)(proxy->fd)) || proxy->ofirst) { FD_SET(proxy->fd, &ClientsWriteBlocked); AnyClientsWriteBlocked = TRUE; } return 0; } int UncompressedWriteToClient (who, count, buf) ClientPtr who; char *buf; int count; { return LbxClientOutput(who, (OsCommPtr)who->osPrivate, buf, count, TRUE); } LbxFreeOsBuffers(proxy) LbxProxyPtr proxy; { ConnectionOutputPtr oco; while (oco = proxy->ofirst) { proxy->ofirst = oco->next; xfree(oco->buf); xfree(oco); } } Bool AllocateLargeReqBuffer(client, size) ClientPtr client; int size; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci; if (!(oci = oc->largereq)) { if (oci = FreeInputs) FreeInputs = oci->next; else { oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); if (!oci) return FALSE; oci->buffer = NULL; oci->size = 0; } } if (oci->size < size) { char *ibuf; oci->size = size; if (size < BUFSIZE) oci->size = BUFSIZE; if (!(ibuf = (char *)xrealloc(oci->buffer, oci->size))) { xfree(oci->buffer); xfree(oci); oc->largereq = NULL; return FALSE; } oci->buffer = ibuf; } oci->bufptr = oci->buffer; oci->bufcnt = 0; oci->lenLastReq = size; oc->largereq = oci; return TRUE; } Bool AddToLargeReqBuffer(client, data, size) ClientPtr client; char *data; int size; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->largereq; if (!oci || (oci->bufcnt + size > oci->lenLastReq)) return FALSE; memcpy(oci->buffer + oci->bufcnt, data, size); oci->bufcnt += size; return TRUE; } static OsCommRec lbxAvailableInput; int PrepareLargeReqBuffer(client) ClientPtr client; { OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->largereq; if (!oci) return client->req_len << 2; oc->largereq = NULL; if (oci->bufcnt != oci->lenLastReq) { xfree(oci->buffer); xfree(oci); return client->req_len << 2; } client->requestBuffer = oci->buffer; client->req_len = oci->lenLastReq >> 2; oci->bufcnt = 0; oci->lenLastReq = 0; if (AvailableInput) { register ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { xfree(aci->buffer); xfree(aci); } else { aci->next = FreeInputs; FreeInputs = aci; } AvailableInput->input = (ConnectionInputPtr)NULL; } lbxAvailableInput.input = oci; AvailableInput = &lbxAvailableInput; return client->req_len << 2; } vnc_unixsrc/Xvnc/programs/Xserver/os/osdep.h0100664000076400007640000001422607120677563020624 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: osdep.h /main/42 1996/12/15 21:27:39 rws $ */ /* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.4 1996/12/23 07:09:58 dawes Exp $ */ #ifdef AMOEBA #include #define port am_port_t #include #include #include #include #include #include #include #include #include #include #undef port #endif #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 #define BUFWATERMARK 8192 #ifndef MAXBUFSIZE #define MAXBUFSIZE (1 << 22) #endif #include #ifndef sgi /* SGI defines OPEN_MAX in a useless way */ #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include #else #define _POSIX_SOURCE #include #undef _POSIX_SOURCE #endif #else /* X_NOT_POSIX */ #ifdef WIN32 #define _POSIX_ #include #undef _POSIX_ #endif #endif /* X_NOT_POSIX */ #endif #ifndef OPEN_MAX #ifdef SVR4 #define OPEN_MAX 128 #else #include #ifndef OPEN_MAX #if defined(NOFILE) && !defined(NOFILES_MAX) #define OPEN_MAX NOFILE #else #ifndef __EMX__ #define OPEN_MAX NOFILES_MAX #else #define OPEN_MAX 256 #endif #endif #endif #endif #endif #if OPEN_MAX <= 128 #define MAXSOCKS (OPEN_MAX - 1) #else #define MAXSOCKS 128 #endif #ifndef NULL #define NULL 0 #endif #ifdef AMOEBA #include "X.h" #include "misc.h" #define FamilyAmoeba 33 extern char *XServerHostName; /* X server host name */ extern char *XTcpServerName; /* TCP/IP server name */ extern int maxClient; /* Highest client# */ extern int nNewConns; /* # of new clients */ #endif /* AMOEBA */ typedef struct _connectionInput { struct _connectionInput *next; char *buffer; /* contains current client input */ char *bufptr; /* pointer to current start of data */ int bufcnt; /* count of bytes in buffer */ int lenLastReq; int size; } ConnectionInput, *ConnectionInputPtr; typedef struct _connectionOutput { struct _connectionOutput *next; int size; unsigned char *buf; int count; #ifdef LBX Bool nocompress; #endif } ConnectionOutput, *ConnectionOutputPtr; #ifdef K5AUTH typedef struct _k5_state { int stageno; /* current stage of auth protocol */ pointer srvcreds; /* server credentials */ pointer srvname; /* server principal name */ pointer ktname; /* key table: principal-key pairs */ pointer skey; /* session key */ } k5_state; #endif #ifdef LBX typedef struct _LbxProxy *OsProxyPtr; #endif typedef struct _osComm { int fd; ConnectionInputPtr input; ConnectionOutputPtr output; XID auth_id; /* authorization id */ #ifdef K5AUTH k5_state authstate; /* state of setup auth conversation */ #endif CARD32 conn_time; /* timestamp if not established, else 0 */ struct _XtransConnInfo *trans_conn; /* transport connection object */ #ifdef LBX OsProxyPtr proxy; ConnectionInputPtr largereq; void (*Close) (); int (*Flush) (); #endif } OsCommRec, *OsCommPtr; #ifdef LBX #define FlushClient(who, oc, extraBuf, extraCount) \ (*(oc)->Flush)(who, oc, extraBuf, extraCount) extern int StandardFlushClient( #if NeedFunctionPrototypes ClientPtr /*who*/, OsCommPtr /*oc*/, char* /*extraBuf*/, int /*extraCount*/ #endif ); #else extern int FlushClient( #if NeedFunctionPrototypes ClientPtr /*who*/, OsCommPtr /*oc*/, char* /*extraBuf*/, int /*extraCount*/ #endif ); #endif extern void FreeOsBuffers( #if NeedFunctionPrototypes OsCommPtr /*oc*/ #endif ); extern ConnectionInputPtr AllocateInputBuffer( #if NeedFunctionPrototypes void #endif ); extern ConnectionOutputPtr AllocateOutputBuffer( #if NeedFunctionPrototypes void #endif ); vnc_unixsrc/Xvnc/programs/Xserver/os/oscolor.c0100664000076400007640000001653207120677563021167 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: oscolor.c,v 1.23 94/04/17 20:27:04 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.2.4.1 1998/01/22 10:47:14 dawes Exp $ */ #ifndef USE_RGB_TXT #ifdef NDBM #include #else #ifdef SVR4 #include #else #include #endif #endif #include "rgb.h" #include "os.h" #include "opaque.h" /* Note that we are assuming there is only one database for all the screens. */ #ifdef NDBM DBM *rgb_dbm = (DBM *)NULL; #else int rgb_dbm = 0; #endif extern void CopyISOLatin1Lowered(); int OsInitColors() { if (!rgb_dbm) { #ifdef NDBM rgb_dbm = dbm_open(rgbPath, 0, 0); #else if (dbminit(rgbPath) == 0) rgb_dbm = 1; #endif if (!rgb_dbm) { ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath ); return FALSE; } } return TRUE; } /*ARGSUSED*/ int OsLookupColor(screen, name, len, pred, pgreen, pblue) int screen; char *name; unsigned len; unsigned short *pred, *pgreen, *pblue; { datum dbent; RGB rgb; char buf[64]; char *lowername; if(!rgb_dbm) return(0); /* we use xalloc here so that we can compile with cc without alloca * when otherwise using gcc */ if (len < sizeof(buf)) lowername = buf; else if (!(lowername = (char *)xalloc(len + 1))) return(0); CopyISOLatin1Lowered ((unsigned char *) lowername, (unsigned char *) name, (int)len); dbent.dptr = lowername; dbent.dsize = len; #ifdef NDBM dbent = dbm_fetch(rgb_dbm, dbent); #else dbent = fetch (dbent); #endif if (len >= sizeof(buf)) xfree(lowername); if(dbent.dptr) { memmove((char *) &rgb, dbent.dptr, sizeof (RGB)); *pred = rgb.red; *pgreen = rgb.green; *pblue = rgb.blue; return (1); } return(0); } #else /* USE_RGB_TXT */ /* * The dbm routines are a porting hassle. This implementation will do * the same thing by reading the rgb.txt file directly, which is much * more portable. */ #include #include "os.h" #include "opaque.h" #define HASHSIZE 511 typedef struct _dbEntry * dbEntryPtr; typedef struct _dbEntry { dbEntryPtr link; unsigned short red; unsigned short green; unsigned short blue; char name[1]; /* some compilers complain if [0] */ } dbEntry; extern void CopyISOLatin1Lowered(); static dbEntryPtr hashTab[HASHSIZE]; static dbEntryPtr lookup(name, len, create) char *name; int len; Bool create; { unsigned int h = 0, g; dbEntryPtr entry, *prev; char *str = name; if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL; CopyISOLatin1Lowered(name, str, len); name[len] = '\0'; for(str = name; *str; str++) { h = (h << 4) + *str; if ((g = h) & 0xf0000000) h ^= (g >> 24); h &= g; } h %= HASHSIZE; if ( entry = hashTab[h] ) { for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link ) if (! strcmp(name, entry->name) ) break; } else prev = &(hashTab[h]); if (!entry && create && (entry = (dbEntryPtr)xalloc(sizeof(dbEntry) +len))) { *prev = entry; entry->link = NULL; strcpy( entry->name, name ); } DEALLOCATE_LOCAL(name); return entry; } Bool OsInitColors() { FILE *rgb; char *path; char line[BUFSIZ]; char name[BUFSIZ]; int red, green, blue, lineno = 0; dbEntryPtr entry; static Bool was_here = FALSE; if (!was_here) { #ifndef __EMX__ path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5); strcpy(path, rgbPath); strcat(path, ".txt"); #else char *tmp = (char*)__XOS2RedirRoot(rgbPath); path = (char*)ALLOCATE_LOCAL(strlen(tmp) +5); strcpy(path, tmp); strcat(path, ".txt"); #endif if (!(rgb = fopen(path, "r"))) { ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath ); DEALLOCATE_LOCAL(path); return FALSE; } while(fgets(line, sizeof(line), rgb)) { lineno++; #ifndef __EMX__ if (sscanf(line,"%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4) #else if (sscanf(line,"%d %d %d %[^\n\r]\n", &red, &green, &blue, name) == 4) #endif { if (red >= 0 && red <= 0xff && green >= 0 && green <= 0xff && blue >= 0 && blue <= 0xff) { if (entry = lookup(name, strlen(name), TRUE)) { entry->red = (red * 65535) / 255; entry->green = (green * 65535) / 255; entry->blue = (blue * 65535) / 255; } } else ErrorF("Value out of range: %s:%d\n", path, lineno); } else if (*line && *line != '#' && *line != '!') ErrorF("Syntax Error: %s:%d\n", path, lineno); } fclose(rgb); DEALLOCATE_LOCAL(path); was_here = TRUE; } return TRUE; } Bool OsLookupColor(screen, name, len, pred, pgreen, pblue) int screen; char *name; unsigned len; unsigned short *pred, *pgreen, *pblue; { dbEntryPtr entry; if (entry = lookup(name, len, FALSE)) { *pred = entry->red; *pgreen = entry->green; *pblue = entry->blue; return TRUE; } return FALSE; } #endif /* USE_RGB_TXT */ vnc_unixsrc/Xvnc/programs/Xserver/os/hpsocket.c0100664000076400007640000000363207120677563021324 0ustar constconst/* $XConsortium: hpsocket.c,v 1.3 94/04/17 20:26:58 dpw Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * special socket routine for hp */ #include #include int set_socket_option (socket_id, option) int socket_id; char option; { int optlen = 1; char optval = 0x0; getsockopt (socket_id, SOL_SOCKET, option, &optval, &optlen); optval |= option; setsockopt (socket_id, SOL_SOCKET, option, &optval, 1); } int unset_socket_option (socket_id, option) int socket_id; char option; { int optlen = 1; char optval = 0x0; getsockopt (socket_id, SOL_SOCKET, option, &optval, &optlen); optval &= ~option; setsockopt (socket_id, SOL_SOCKET, option, &optval, 1); } vnc_unixsrc/Xvnc/programs/Xserver/os/wrapper.c0100664000076400007640000001405107120677563021161 0ustar constconst/* * X server wrapper. * * This wrapper makes some sanity checks on the command line arguments * and environment variables when run with euid == 0 && euid != uid. * If the checks fail, the wrapper exits with a message. * If they succeed, it exec's the Xserver. */ /* * Copyright (c) 1998 by The XFree86 Project, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject * to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE * OR OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of the XFree86 Project * shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written * authorization from the XFree86 Project. */ /* $XFree86: xc/programs/Xserver/os/wrapper.c,v 1.1.2.5 1998/02/27 15:28:59 dawes Exp $ */ /* This is normally set in the Imakefile */ #ifndef XSERVER_PATH #define XSERVER_PATH "/usr/X11R6/bin/X" #endif #include #include #include #include #include /* Neither of these should be required for XFree86 3.3.2 */ #ifndef REJECT_CONFIG #define REJECT_CONFIG 0 #endif #ifndef REJECT_XKBDIR #define REJECT_XKBDIR 0 #endif /* Consider LD* variables insecure ? */ #ifndef REMOVE_ENV_LD #define REMOVE_ENV_LD 1 #endif /* Remove long environment variables? */ #ifndef REMOVE_LONG_ENV #define REMOVE_LONG_ENV 1 #endif /* Check args and env only if running setuid (euid == 0 && euid != uid) ? */ #ifndef CHECK_EUID #define CHECK_EUID 1 #endif /* * Maybe the locale can be faked to make isprint(3) report that everything * is printable? Avoid it by default. */ #ifndef USE_ISPRINT #define USE_ISPRINT 0 #endif #define MAX_ARG_LENGTH 128 #define MAX_ENV_LENGTH 256 #define MAX_ENV_PATH_LENGTH 2048 #if USE_ISPRINT #include #define checkPrintable(c) isprint(c) #else #define checkPrintable(c) (((c) & 0x7f) >= 0x20 && ((c) & 0x7f) != 0x7f) #endif enum BadCode { NotBad = 0, UnsafeArg, ArgTooLong, UnprintableArg, EnvTooLong, InternalError }; #define ARGMSG \ "\nIf the arguments used are valid, and have been rejected incorrectly\n" \ "please send details of the arguments and why they are valid to\n" \ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" #define ENVMSG \ "\nIf the environment is valid, and have been rejected incorrectly\n" \ "please send details of the environment and why it is valid to\n" \ "XFree86@XFree86.org. In the meantime, you can start the Xserver as\n" \ "the \"super user\" (root).\n" int main(int argc, char **argv, char **envp) { enum BadCode bad = NotBad; int i, j; char *a, *e; #if CHECK_EUID if (geteuid() == 0 && getuid() != geteuid()) { #endif /* Check each argv[] */ for (i = 1; i < argc; i++) { /* Check for known bad arguments */ #if REJECT_CONFIG if (strcmp(argv[i], "-config") == 0) { bad = UnsafeArg; break; } #endif #if REJECT_XKBDIR if (strcmp(argv[i], "-xkbdir") == 0) { bad = UnsafeArg; break; } #endif if (strlen(argv[i]) > MAX_ARG_LENGTH) { bad = ArgTooLong; break; } a = argv[i]; while (*a) { if (checkPrintable(*a) == 0) { bad = UnprintableArg; break; } a++; } if (bad) break; } /* Check each envp[] */ if (!bad) for (i = 0; envp[i]; i++) { /* Check for bad environment variables and values */ #if REMOVE_ENV_LD while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) { for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } } #endif if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) { #if REMOVE_LONG_ENV for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } i--; #else char *eq; int len; eq = strchr(envp[i], '='); if (!eq) continue; len = eq - envp[i]; e = malloc(len + 1); if (!e) { bad = InternalError; break; } strncpy(e, envp[i], len); e[len] = 0; if (len >= 4 && (strcmp(e + len - 4, "PATH") == 0 || strcmp(e, "TERMCAP") == 0)) { if (strlen(envp[i]) > MAX_ENV_PATH_LENGTH) { bad = EnvTooLong; break; } else { free(e); } } else { bad = EnvTooLong; break; } #endif } } #if CHECK_EUID } #endif switch (bad) { case NotBad: execve(XSERVER_PATH, argv, envp); fprintf(stderr, "execve failed for %s (errno %d)\n", XSERVER_PATH, errno); break; case UnsafeArg: fprintf(stderr, "Command line argument number %d is unsafe\n", i); fprintf(stderr, ARGMSG); break; case ArgTooLong: fprintf(stderr, "Command line argument number %d is too long\n", i); fprintf(stderr, ARGMSG); break; case UnprintableArg: fprintf(stderr, "Command line argument number %d contains unprintable" " characters\n", i); fprintf(stderr, ARGMSG); break; case EnvTooLong: fprintf(stderr, "Environment variable `%s' is too long\n", e); fprintf(stderr, ENVMSG); break; case InternalError: fprintf(stderr, "Internal Error\n"); break; default: fprintf(stderr, "Unknown error\n"); fprintf(stderr, ARGMSG); fprintf(stderr, ENVMSG); break; } exit(1); } vnc_unixsrc/Xvnc/programs/Xserver/os/xalloc.c0100664000076400007640000004576607615756245021010 0ustar constconst/* Copyright (C) 1995 Pascal Haible. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL PASCAL HAIBLE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Pascal Haible shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Pascal Haible. */ /* $XFree86: xc/programs/Xserver/os/xalloc.c,v 3.12.2.1 1997/05/10 07:03:02 hohndel Exp $ */ /* Only used if INTERNAL_MALLOC is defined * - otherwise xalloc() in utils.c is used */ #ifdef INTERNAL_MALLOC #if defined(__STDC__) || defined(AMOEBA) #ifndef NOSTDHDRS #include /* for malloc() etc. */ #endif #else extern char *malloc(); extern char *calloc(); extern char *realloc(); #endif #include "Xos.h" #include "misc.h" #include "X.h" #ifdef XALLOC_LOG #include #endif extern Bool Must_have_memory; /* ***** New malloc approach for the X server ***** * Pascal Haible 1995 * * Some statistics about memory allocation of the X server * The test session included several clients of different size, including * xv, emacs and xpaint with a new canvas of 3000x2000, zoom 5. * All clients were running together. * A protocolling version of Xalloc recorded 318917 allocating actions * (191573 Xalloc, 85942 XNFalloc, 41438 Xrealloc, 279727 Xfree). * Results grouped by size, excluding the next lower size * (i.e. size=32 means 16=11k) are mmapped on xalloc, and unmapped on xfree, * so we don't need any free lists etc. * As this needs 2 system calls, we only do this for the quite * infrequent large (>=11k) blocks. * - instead of reinventing the wheel, we use system malloc for medium * sized blocks (>256, <11k). * - for small blocks (<=256) we use an other approach: * As we need many small blocks, and most ones for a short time, * we don't go through the system malloc: * for each fixed sizes a seperate list of free blocks is kept. * to KISS (Keep it Small and Simple), we don't free them * (not freeing a block of 32 bytes won't be worse than having fragmented * a larger area on allocation). * This way, we (almost) allways have a fitting free block right at hand, * and don't have to walk any lists. */ /* * structure layout of a allocated block * unsigned long size: * rounded up netto size for small and medium blocks * brutto size == mmap'ed area for large blocks * unsigned long DEBUG ? MAGIC : unused * .... data * ( unsigned long MAGIC2 ) only if SIZE_TAIL defined * */ /* use otherwise unused long in the header to store a magic */ /* shouldn't this be removed for production release ? */ #define XALLOC_DEBUG #ifdef XALLOC_DEBUG /* Xfree fills the memory with a certain pattern (currently 0xF0) */ /* this should really be removed for production release! */ #define XFREE_ERASES #endif /* this must be a multiple of SIZE_STEPS below */ #define MAX_SMALL 264 /* quite many blocks of 264 */ #define MIN_LARGE (11*1024) /* worst case is 25% loss with a page size of 4k */ /* SIZE_STEPS defines the granularity of size of small blocks - * this makes blocks align to that, too! */ #define SIZE_STEPS (sizeof(double)) #define SIZE_HEADER (2*sizeof(long)) /* = sizeof(double) for 32bit */ #ifdef XALLOC_DEBUG #if defined(__sparc__) || defined(__hppa__) #define SIZE_TAIL (2*sizeof(long)) /* = sizeof(double) for 32bit */ #else #define SIZE_TAIL (sizeof(long)) #endif #endif #undef TAIL_SIZE #ifdef SIZE_TAIL #define TAIL_SIZE SIZE_TAIL #else #define TAIL_SIZE 0 #endif #ifdef __alpha__ #define MAGIC 0x1404196414071968 #define MAGIC2 0x2515207525182079 #else #define MAGIC 0x14071968 #define MAGIC2 0x25182079 #endif /* To get some statistics about memory allocation */ #ifdef XALLOC_LOG #define XALLOC_LOG_FILE "/tmp/Xalloc.log" /* unsecure... */ #define LOG_BODY(_body) \ { FILE *f; \ f = fopen(XALLOC_LOG_FILE, "a"); \ if (NULL!=f) { \ _body; \ fclose(f); \ } \ } #if defined(linux) && defined(i386) #define LOG_ALLOC(_fun, _size, _ret) \ { unsigned long *from; \ __asm__("movl %%ebp,%0" : /*OUT*/ "=r" (from) : /*IN*/ ); \ LOG_BODY(fprintf(f, "%s\t%i\t%p\t[%lu]\n", _fun, _size, _ret, *(from+1))) \ } #else #define LOG_ALLOC(_fun, _size, _ret) \ LOG_BODY(fprintf(f, "%s\t%i\t%p\n", _fun, _size, _ret)) #endif #define LOG_REALLOC(_fun, _ptr, _size, _ret) \ LOG_BODY(fprintf(f, "%s\t%p\t%i\t%p\n", _fun, _ptr, _size, _ret)) #define LOG_FREE(_fun, _ptr) \ LOG_BODY(fprintf(f, "%s\t%p\n", _fun, _ptr)) #else #define LOG_ALLOC(_fun, _size, _ret) #define LOG_REALLOC(_fun, _ptr, _size, _ret) #define LOG_FREE(_fun, _ptr) #endif /* XALLOC_LOG */ static unsigned long *free_lists[MAX_SMALL/SIZE_STEPS]; /* * systems that support it should define HAS_MMAP_ANON or MMAP_DEV_ZERO * and include the appropriate header files for * mmap(), munmap(), PROT_READ, PROT_WRITE, MAP_PRIVATE, * PAGE_SIZE or _SC_PAGESIZE (and MAP_ANON for HAS_MMAP_ANON). * * systems that don't support MAP_ANON fall through to the 2 fold behaviour */ #if defined(linux) #define HAS_MMAP_ANON #include #include #include /* PAGE_SIZE */ #endif /* linux */ #if defined(CSRG_BASED) #define HAS_MMAP_ANON #define HAS_GETPAGESIZE #include #include #endif /* CSRG_BASED */ #if defined(SVR4) #define MMAP_DEV_ZERO #include #include #include #endif /* SVR4 */ #if defined(sun) && !defined(SVR4) /* SunOS */ #define MMAP_DEV_ZERO /* doesn't SunOS have MAP_ANON ?? */ #define HAS_GETPAGESIZE #include #include #endif /* sun && !SVR4 */ #ifdef XNO_SYSCONF #undef _SC_PAGESIZE #endif #if defined(HAS_MMAP_ANON) || defined (MMAP_DEV_ZERO) static int pagesize; #endif #ifdef MMAP_DEV_ZERO static int devzerofd = -1; #include #ifdef X_NOT_STDC_ENV extern int errno; #endif #endif unsigned long * Xalloc (amount) unsigned long amount; { register unsigned long *ptr; int indx; /* sanity checks */ /* zero size requested */ if (amount == 0) { LOG_ALLOC("Xalloc=0", amount, 0); return (unsigned long *)NULL; } /* negative size (or size > 2GB) - what do we do? */ if ((long)amount < 0) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc: Xalloc(<0)\n"); #else ErrorF("Xalloc warning: Xalloc(<0) ignored..\n"); #endif LOG_ALLOC("Xalloc<0", amount, 0); return (unsigned long *)NULL; } /* alignment check */ #if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) amount = (amount + (sizeof(long)-1)) & ~(sizeof(long)-1); #endif if (amount <= MAX_SMALL) { /* * small block */ /* pick a ready to use small chunk */ indx = (amount-1) / SIZE_STEPS; ptr = free_lists[indx]; if (NULL == ptr) { /* list empty - get 20 or 40 more */ /* amount = size rounded up */ amount = (indx+1) * SIZE_STEPS; ptr = (unsigned long *)calloc(1,(amount+SIZE_HEADER+TAIL_SIZE) * (amount<100 ? 40 : 20)); if (NULL!=ptr) { int i; unsigned long *p1, *p2; p2 = (unsigned long *)((char *)ptr + SIZE_HEADER); for (i=0; i<(amount<100 ? 40 : 20); i++) { p1 = p2; p1[-2] = amount; #ifdef XALLOC_DEBUG p1[-1] = MAGIC; #endif /* XALLOC_DEBUG */ #ifdef SIZE_TAIL *(unsigned long *)((unsigned char *)p1 + amount) = MAGIC2; #endif /* SIZE_TAIL */ p2 = (unsigned long *)((char *)p1 + SIZE_HEADER + amount + TAIL_SIZE); *(unsigned long **)p1 = p2; } /* last one has no next one */ *(unsigned long **)p1 = NULL; /* put the second in the list */ free_lists[indx] = (unsigned long *)((char *)ptr + SIZE_HEADER + amount + TAIL_SIZE + SIZE_HEADER); /* take the fist one */ ptr = (unsigned long *)((char *)ptr + SIZE_HEADER); LOG_ALLOC("Xalloc-S", amount, ptr); return ptr; } /* else fall through to 'Out of memory' */ } else { /* take that piece of mem out of the list */ free_lists[indx] = *((unsigned long **)ptr); /* already has size (and evtl. magic) filled in */ LOG_ALLOC("Xalloc-S", amount, ptr); return ptr; } #if defined(HAS_MMAP_ANON) || defined(MMAP_DEV_ZERO) } else if (amount >= MIN_LARGE) { /* * large block */ /* mmapped malloc */ /* round up amount */ amount += SIZE_HEADER + TAIL_SIZE; /* round up brutto amount to a multiple of the page size */ amount = (amount + pagesize-1) & ~(pagesize-1); #ifdef MMAP_DEV_ZERO ptr = (unsigned long *)mmap((caddr_t)0, (size_t)amount, PROT_READ | PROT_WRITE, MAP_PRIVATE, devzerofd, (off_t)0); #else ptr = (unsigned long *)mmap((caddr_t)0, (size_t)amount, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, (off_t)0); #endif if (-1!=(long)ptr) { ptr[0] = amount - SIZE_HEADER - TAIL_SIZE; #ifdef XALLOC_DEBUG ptr[1] = MAGIC; #endif /* XALLOC_DEBUG */ #ifdef SIZE_TAIL # ifdef __hppa__ /* reserved space for 2 * sizeof(long), so use correct one */ /* see SIZE_TAIL macro */ ((unsigned long *)((char *)ptr + amount))[-2] = MAGIC2; # else ((unsigned long *)((char *)ptr + amount))[-1] = MAGIC2; # endif /* __hppa__ */ #endif /* SIZE_TAIL */ ptr = (unsigned long *)((char *)ptr + SIZE_HEADER); LOG_ALLOC("Xalloc-L", amount, ptr); return ptr; } /* else fall through to 'Out of memory' */ #endif /* HAS_MMAP_ANON || MMAP_DEV_ZERO */ } else { /* * medium sized block */ /* 'normal' malloc() */ ptr=(unsigned long *)calloc(1,amount+SIZE_HEADER+TAIL_SIZE); if (ptr != (unsigned long *)NULL) { ptr[0] = amount; #ifdef XALLOC_DEBUG ptr[1] = MAGIC; #endif /* XALLOC_DEBUG */ #ifdef SIZE_TAIL *(unsigned long *)((char *)ptr + amount + SIZE_HEADER) = MAGIC2; #endif /* SIZE_TAIL */ ptr = (unsigned long *)((char *)ptr + SIZE_HEADER); LOG_ALLOC("Xalloc-M", amount, ptr); return ptr; } } if (Must_have_memory) FatalError("Out of memory"); LOG_ALLOC("Xalloc-oom", amount, 0); return (unsigned long *)NULL; } /***************** * XNFalloc * "no failure" realloc, alternate interface to Xalloc w/o Must_have_memory *****************/ unsigned long * XNFalloc (amount) unsigned long amount; { register unsigned long *ptr; /* zero size requested */ if (amount == 0) { LOG_ALLOC("XNFalloc=0", amount, 0); return (unsigned long *)NULL; } /* negative size (or size > 2GB) - what do we do? */ if ((long)amount < 0) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc: XNFalloc(<0)\n"); #else ErrorF("Xalloc warning: XNFalloc(<0) ignored..\n"); #endif LOG_ALLOC("XNFalloc<0", amount, 0); return (unsigned long *)NULL; } ptr = Xalloc(amount); if (!ptr) { FatalError("Out of memory"); } return ptr; } /***************** * Xcalloc *****************/ unsigned long * Xcalloc (amount) unsigned long amount; { unsigned long *ret; ret = Xalloc (amount); if (ret #if defined(HAS_MMAP_ANON) || defined(MMAP_DEV_ZERO) && (amount < MIN_LARGE) /* mmaped anonymous mem is already cleared */ #endif ) bzero ((char *) ret, (int) amount); return ret; } /***************** * Xrealloc *****************/ unsigned long * Xrealloc (ptr, amount) register pointer ptr; unsigned long amount; { register unsigned long *new_ptr; /* zero size requested */ if (amount == 0) { if (ptr) Xfree(ptr); LOG_REALLOC("Xrealloc=0", ptr, amount, 0); return (unsigned long *)NULL; } /* negative size (or size > 2GB) - what do we do? */ if ((long)amount < 0) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc: Xrealloc(<0)\n"); #else ErrorF("Xalloc warning: Xrealloc(<0) ignored..\n"); #endif if (ptr) Xfree(ptr); /* ?? */ LOG_REALLOC("Xrealloc<0", ptr, amount, 0); return (unsigned long *)NULL; } new_ptr = Xalloc(amount); if ( (new_ptr) && (ptr) ) { unsigned long old_size; old_size = ((unsigned long *)ptr)[-2]; #ifdef XALLOC_DEBUG if (MAGIC != ((unsigned long *)ptr)[-1]) { #ifdef FATALERRORS FatalError("Xalloc error: header corrupt in Xrealloc() :-(\n"); #else ErrorF("Xalloc error: header corrupt in Xrealloc() :-(\n"); #endif LOG_REALLOC("Xalloc error: header corrupt in Xrealloc() :-(", ptr, amount, 0); return (unsigned long *)NULL; } #endif /* XALLOC_DEBUG */ /* copy min(old size, new size) */ memcpy((char *)new_ptr, (char *)ptr, (amount < old_size ? amount : old_size)); } if (ptr) Xfree(ptr); if (new_ptr) { LOG_REALLOC("Xrealloc", ptr, amount, new_ptr); return new_ptr; } if (Must_have_memory) FatalError("Out of memory"); LOG_REALLOC("Xrealloc", ptr, amount, 0); return (unsigned long *)NULL; } /***************** * XNFrealloc * "no failure" realloc, alternate interface to Xrealloc w/o Must_have_memory *****************/ unsigned long * XNFrealloc (ptr, amount) register pointer ptr; unsigned long amount; { if (( ptr = (pointer)Xrealloc( ptr, amount ) ) == NULL) { FatalError( "Out of memory" ); } return ((unsigned long *)ptr); } /***************** * Xfree * calls free *****************/ void Xfree(ptr) register pointer ptr; { unsigned long size; unsigned long *pheader; /* free(NULL) IS valid :-( - and widely used throughout the server.. */ if (!ptr) return; pheader = (unsigned long *)((char *)ptr - SIZE_HEADER); #ifdef XALLOC_DEBUG if (MAGIC != pheader[1]) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc error: Header corrupt in Xfree() :-(\n"); #else ErrorF("Xalloc error: Header corrupt in Xfree() :-(\n"); #endif LOG_FREE("Xalloc error: Header corrupt in Xfree() :-(", ptr); return; } #endif /* XALLOC_DEBUG */ size = pheader[0]; if (size <= MAX_SMALL) { int indx; /* * small block */ #ifdef SIZE_TAIL if (MAGIC2 != *(unsigned long *)((char *)ptr + size)) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc error: Tail corrupt in Xfree() for small block (adr=0x%x, val=0x%x)\n",(char *)ptr + size,*(unsigned long *)((char *)ptr + size)); #else ErrorF("Xalloc error: Tail corrupt in Xfree() for small block (adr=0x%x, val=0x%x)\n",(char *)ptr + size,*(unsigned long *)((char *)ptr + size)); #endif LOG_FREE("Xalloc error: Tail corrupt in Xfree() for small block", ptr); return; } #endif /* SIZE_TAIL */ #ifdef XFREE_ERASES memset(ptr,0xF0,size); #endif /* XFREE_ERASES */ /* put this small block at the head of the list */ indx = (size-1) / SIZE_STEPS; *(unsigned long **)(ptr) = free_lists[indx]; free_lists[indx] = (unsigned long *)ptr; LOG_FREE("Xfree", ptr); return; #if defined(HAS_MMAP_ANON) || defined(MMAP_DEV_ZERO) } else if (size >= MIN_LARGE) { /* * large block */ #ifdef SIZE_TAIL if (MAGIC2 != ((unsigned long *)((char *)ptr + size))[0]) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc error: Tail corrupt in Xfree() for big block (adr=0x%x, val=0x%x)\n",(char *)ptr+size,((unsigned long *)((char *)ptr + size))[0]); #else ErrorF("Xalloc error: Tail corrupt in Xfree() for big block (adr=0x%x, val=0x%x)\n",(char *)ptr+size,((unsigned long *)((char *)ptr + size))[0]); #endif LOG_FREE("Xalloc error: Tail corrupt in Xfree() for big block", ptr); return; } size += SIZE_TAIL; #endif /* SIZE_TAIL */ LOG_FREE("Xfree", ptr); size += SIZE_HEADER; munmap((caddr_t)pheader, (size_t)size); /* no need to clear - mem is inaccessible after munmap.. */ #endif /* HAS_MMAP_ANON */ } else { /* * medium sized block */ #ifdef SIZE_TAIL if (MAGIC2 != *(unsigned long *)((char *)ptr + size)) { /* Diagnostic */ #ifdef FATALERRORS FatalError("Xalloc error: Tail corrupt in Xfree() for medium block (adr=0x%x, val=0x%x)\n",(char *)ptr + size,*(unsigned long *)((char *)ptr + size)); #else ErrorF("Xalloc error: Tail corrupt in Xfree() for medium block (adr=0x%x, val=0x%x)\n",(char *)ptr + size,*(unsigned long *)((char *)ptr + size)); #endif LOG_FREE("Xalloc error: Tail corrupt in Xfree() for medium block", ptr); return; } #endif /* SIZE_TAIL */ #ifdef XFREE_ERASES memset(pheader,0xF0,size+SIZE_HEADER); #endif /* XFREE_ERASES */ LOG_FREE("Xfree", ptr); free((char *)pheader); } } void OsInitAllocator () { static Bool beenhere = FALSE; if (beenhere) return; beenhere = TRUE; #if defined(HAS_MMAP_ANON) || defined (MMAP_DEV_ZERO) #if defined(_SC_PAGESIZE) /* || defined(linux) */ pagesize = sysconf(_SC_PAGESIZE); #else #ifdef HAS_GETPAGESIZE pagesize = getpagesize(); #else pagesize = PAGE_SIZE; #endif #endif #endif /* set up linked lists of free blocks */ bzero ((char *) free_lists, MAX_SMALL/SIZE_STEPS*sizeof(unsigned long *)); #ifdef MMAP_DEV_ZERO /* open /dev/zero on systems that have mmap, but not MAP_ANON */ if (devzerofd < 0) { if ((devzerofd = open("/dev/zero", O_RDWR, 0)) < 0) FatalError("OsInitAllocator: Cannot open /dev/zero (errno=%d)\n", errno); } #endif #ifdef XALLOC_LOG /* reset the log file to zero length */ { FILE *f; f = fopen(XALLOC_LOG_FILE, "w"); if (NULL!=f) fclose(f); } #endif } #else /* !INTERNAL_MALLOC */ /* This is to avoid an empty .o */ static int no_internal_xalloc; #endif /* INTERNAL_MALLOC */ vnc_unixsrc/Xvnc/programs/Xserver/os/genalloca.c0100664000076400007640000001201507120677563021424 0ustar constconst/* alloca -- (mostly) portable public-domain implementation -- D A Gwyn This implementation of the PWB library alloca() function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. It should work under any C implementation that uses an actual procedure stack (as opposed to a linked list of frames). There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca()-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ #ifndef lint static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */ #endif #ifdef emacs #include "config.h" #ifdef static /* actually, only want this if static is defined as "" -- this is for usg, in which emacs must undefine static in order to make unexec workable */ #ifndef STACK_DIRECTION you lose -- must know STACK_DIRECTION at compile-time #endif /* STACK_DIRECTION undefined */ #endif /* static */ #endif /* emacs */ #ifdef X3J11 typedef void *pointer; /* generic pointer type */ #else typedef char *pointer; /* generic pointer type */ #endif #define NULL 0 /* null pointer constant */ extern void Xfree(); extern pointer Xalloc(); /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #ifndef STACK_DIRECTION #define STACK_DIRECTION 0 /* direction unknown */ #endif #if STACK_DIRECTION != 0 #define STACK_DIR STACK_DIRECTION /* known at compile-time */ #else /* STACK_DIRECTION == 0; need run-time code */ static int stack_dir; /* 1 or -1 once known */ #define STACK_DIR stack_dir static void find_stack_direction (/* void */) { static char *addr = NULL; /* address of first `dummy', once known */ auto char dummy; /* to get stack address */ if (addr == NULL) { /* initial entry */ addr = &dummy; find_stack_direction (); /* recurse once */ } else /* second entry */ if (&dummy > addr) stack_dir = 1; /* stack grew upward */ else stack_dir = -1; /* stack grew downward */ } #endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca()ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc() alignment chunk size. The following default should work okay. */ #ifndef ALIGN_SIZE #define ALIGN_SIZE sizeof(double) #endif typedef union hdr { char align[ALIGN_SIZE]; /* to force sizeof(header) */ struct { union hdr *next; /* for chaining headers */ char *deep; /* for stack depth measure */ } h; } header; /* alloca( size ) returns a pointer to at least `size' bytes of storage which will be automatically reclaimed upon exit from the procedure that called alloca(). Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ static header *last_alloca_header = NULL; /* -> last alloca header */ pointer alloca (size) /* returns pointer to storage */ unsigned size; /* # bytes to allocate */ { auto char probe; /* probes stack depth: */ register char *depth = &probe; #if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* unknown growth direction */ find_stack_direction (); #endif /* Reclaim garbage, defined as all alloca()ed storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* traverses linked list */ for (hp = last_alloca_header; hp != NULL;) if (STACK_DIR > 0 && hp->h.deep > depth || STACK_DIR < 0 && hp->h.deep < depth) { register header *np = hp->h.next; Xfree ((pointer) hp); /* collect garbage */ hp = np; /* -> next header */ } else break; /* rest are not deeper */ last_alloca_header = hp; /* -> last valid storage */ } if (size == 0) return NULL; /* no allocation required */ /* Allocate combined header + user data storage. */ { register pointer new = Xalloc (sizeof (header) + size); if (!new) return NULL; /* address of header */ ((header *)new)->h.next = last_alloca_header; ((header *)new)->h.deep = depth; last_alloca_header = (header *)new; /* User storage begins just after header. */ return (pointer)((char *)new + sizeof(header)); } } vnc_unixsrc/Xvnc/programs/Xserver/os/secauth.c0100664000076400007640000001222707120677563021140 0ustar constconst/* $XConsortium: secauth.c /main/4 1996/11/27 16:57:14 swick $ */ /* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #include "os.h" #include "osdep.h" #include "dixstruct.h" /*================================================================ BEGIN ORL VNC modification Need function prototype for SecurityGetSitePolicyStrings even when XCSECURITY isn't defined */ /* REMOVE #ifdef XCSECURITY */ #define _SECURITY_SERVER #include "extensions/security.h" /* REMOVE #endif */ /* END ORL VNC modification ================================================================*/ static char InvalidPolicyReason[] = "invalid policy specification"; static char PolicyViolationReason[] = "policy violation"; static Bool AuthCheckSitePolicy(data_lengthP, dataP, client, reason) unsigned short *data_lengthP; char **dataP; ClientPtr client; char **reason; { char *policy = *dataP; int length; Bool permit; int nPolicies; char **sitePolicies; int nSitePolicies; Bool found = FALSE; if ((length = *data_lengthP) < 2) { *reason = InvalidPolicyReason; return FALSE; } permit = (*policy++ == 0); nPolicies = *policy++; length -= 2; sitePolicies = SecurityGetSitePolicyStrings(&nSitePolicies); while (nPolicies) { int strLen, sitePolicy; if (length == 0) { *reason = InvalidPolicyReason; return FALSE; } strLen = *policy++; if (--length < strLen) { *reason = InvalidPolicyReason; return FALSE; } if (!found) { for (sitePolicy = 0; sitePolicy < nSitePolicies; sitePolicy++) { char *testPolicy = sitePolicies[sitePolicy]; if ((strLen == strlen(testPolicy)) && (strncmp(policy, testPolicy, strLen) == 0)) { found = TRUE; /* need to continue parsing the policy... */ break; } } } policy += strLen; length -= strLen; nPolicies--; } if (found != permit) { *reason = PolicyViolationReason; return FALSE; } *data_lengthP = length; *dataP = policy; return TRUE; } XID AuthSecurityCheck (data_length, data, client, reason) unsigned short data_length; char *data; ClientPtr client; char **reason; { #ifdef XCSECURITY OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; xConnSetupPrefix csp; xReq freq; if (client->clientState == ClientStateCheckedSecurity) { *reason = "repeated security check not permitted"; return (XID) -1; } else if (data_length > 0) { char policy_mask = *data++; if (--data_length == 1) { *reason = InvalidPolicyReason; return (XID) -1; } if (policy_mask & 0x01) /* Extensions policy */ { /* AuthCheckExtensionPolicy(&data_length, &data, client, reason) */ *reason = "security policy not implemented"; return (XID) -1; } if (policy_mask & 0x02) /* Site policy */ { if (!AuthCheckSitePolicy(&data_length, &data, client, reason)) return (XID) -1; } if (data_length > 0) { /* did we consume the whole policy? */ *reason = InvalidPolicyReason; return (XID) -1; } } else if (!GetAccessControl()) { *reason = "server host access control is disabled"; return (XID) -1; } client->clientState = ClientStateCheckingSecurity; csp.success = 2 /* Authenticate */; csp.lengthReason = 0; csp.length = 0; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (client->swapped) WriteSConnSetupPrefix(client, &csp); else (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp); /* * Next time the client sends the real auth data, we want * ProcEstablishConnection to be called. */ freq.reqType = 1; freq.length = (sz_xReq + sz_xConnClientPrefix) >> 2; client->swapped = FALSE; if (!InsertFakeRequest(client, (char *)&freq, sz_xReq)) { *reason = "internal error"; return (XID) -1; } return (XID) 0; #else *reason = "method not supported"; return (XID) -1; #endif } vnc_unixsrc/Xvnc/programs/Xserver/include/0040775000076400007640000000000010616336467020340 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/include/opaque.h0100664000076400007640000000467707120677563022017 0ustar constconst/* $XConsortium: opaque.h,v 1.19 94/04/17 20:25:51 dpw Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.2.2.1 1997/06/01 12:33:43 dawes Exp $ */ #ifndef OPAQUE_H #define OPAQUE_H #include extern char *defaultFontPath; extern char *defaultTextFont; extern char *defaultCursorFont; extern char *rgbPath; extern int MaxClients; extern char isItTimeToYield; extern char dispatchException; /* bit values for dispatchException */ #define DE_RESET 1 #define DE_TERMINATE 2 #define DE_PRIORITYCHANGE 4 /* set when a client's priority changes */ extern CARD32 TimeOutValue; extern CARD32 ScreenSaverTime; extern CARD32 ScreenSaverInterval; extern int ScreenSaverBlanking; extern int ScreenSaverAllowExposures; extern int argcGlobal; extern char **argvGlobal; #if DPMSExtension extern CARD32 defaultDPMSStandbyTime; extern CARD32 defaultDPMSSuspendTime; extern CARD32 defaultDPMSOffTime; extern CARD32 DPMSStandbyTime; extern CARD32 DPMSSuspendTime; extern CARD32 DPMSOffTime; extern CARD16 DPMSPowerLevel; extern Bool defaultDPMSEnabled; extern Bool DPMSEnabled; extern Bool DPMSEnabledSwitch; extern Bool DPMSDisabledSwitch; extern Bool DPMSCapableFlag; #endif #endif /* OPAQUE_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/gc.h0100664000076400007640000001326107120677563021103 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: gc.h /main/16 1996/08/01 19:18:17 dpw $ */ #ifndef GC_H #define GC_H #include "misc.h" /* for Bool */ #include "X11/X.h" /* for GContext, Mask */ #include "X11/Xproto.h" #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ /* clientClipType field in GC */ #define CT_NONE 0 #define CT_PIXMAP 1 #define CT_REGION 2 #define CT_UNSORTED 6 #define CT_YSORTED 10 #define CT_YXSORTED 14 #define CT_YXBANDED 18 #define GCQREASON_VALIDATE 1 #define GCQREASON_CHANGE 2 #define GCQREASON_COPY_SRC 3 #define GCQREASON_COPY_DST 4 #define GCQREASON_DESTROY 5 #define GC_CHANGE_SERIAL_BIT (((unsigned long)1)<<31) #define GC_CALL_VALIDATE_BIT (1L<<30) #define GCExtensionInterest (1L<<29) #define DRAWABLE_SERIAL_BITS (~(GC_CHANGE_SERIAL_BIT)) #define MAX_SERIAL_NUM (1L<<28) #define NEXT_SERIAL_NUMBER ((++globalSerialNumber) > MAX_SERIAL_NUM ? \ (globalSerialNumber = 1): globalSerialNumber) typedef struct _GCInterest *GCInterestPtr; typedef struct _GC *GCPtr; typedef struct _GCOps *GCOpsPtr; extern void ValidateGC( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/ #endif ); extern int ChangeGC( #if NeedFunctionPrototypes GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/ #endif ); extern int DoChangeGC( #if NeedFunctionPrototypes GCPtr/*pGC*/, BITS32 /*mask*/, XID* /*pval*/, int /*fPointer*/ #endif ); typedef union { CARD32 val; pointer ptr; } ChangeGCVal, *ChangeGCValPtr; extern int dixChangeGC( #if NeedFunctionPrototypes ClientPtr /*client*/, GCPtr /*pGC*/, BITS32 /*mask*/, CARD32 * /*pval*/, ChangeGCValPtr /*pCGCV*/ #endif ); extern GCPtr CreateGC( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, BITS32 /*mask*/, XID* /*pval*/, int* /*pStatus*/ #endif ); extern int CopyGC( #if NeedFunctionPrototypes GCPtr/*pgcSrc*/, GCPtr/*pgcDst*/, BITS32 /*mask*/ #endif ); extern int FreeGC( #if NeedFunctionPrototypes pointer /*pGC*/, XID /*gid*/ #endif ); extern void SetGCMask( #if NeedFunctionPrototypes GCPtr /*pGC*/, Mask /*selectMask*/, Mask /*newDataMask*/ #endif ); extern GCPtr CreateScratchGC( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, unsigned /*depth*/ #endif ); extern void FreeGCperDepth( #if NeedFunctionPrototypes int /*screenNum*/ #endif ); extern Bool CreateGCperDepth( #if NeedFunctionPrototypes int /*screenNum*/ #endif ); extern Bool CreateDefaultStipple( #if NeedFunctionPrototypes int /*screenNum*/ #endif ); extern void FreeDefaultStipple( #if NeedFunctionPrototypes int /*screenNum*/ #endif ); extern int SetDashes( #if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned /*offset*/, unsigned /*ndash*/, unsigned char* /*pdash*/ #endif ); extern int VerifyRectOrder( #if NeedFunctionPrototypes int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/ #endif ); extern int SetClipRects( #if NeedFunctionPrototypes GCPtr /*pGC*/, int /*xOrigin*/, int /*yOrigin*/, int /*nrects*/, xRectangle* /*prects*/, int /*ordering*/ #endif ); extern GCPtr GetScratchGC( #if NeedFunctionPrototypes unsigned /*depth*/, ScreenPtr /*pScreen*/ #endif ); extern void FreeScratchGC( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); #endif /* GC_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/Imakefile0100664000076400007640000000404007120677563022145 0ustar constconstXCOMM $XConsortium: Imakefile,v 1.2 95/01/13 20:28:14 kaleb Exp $ XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.5.4.1 1997/05/12 12:52:39 hohndel Exp $ all:: InstallLinkKitNonExecFile(closure.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(colormap.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(colormapst.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cursor.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cursorstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(dix.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(dixfont.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(dixfontstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(dixstruct.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(extension.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(extnsionst.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(gc.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(gcstruct.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(input.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(inputstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(misc.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(miscstruct.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(opaque.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(os.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(pixmap.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(pixmapstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(property.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(resource.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(region.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(regionstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(screenint.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(scrnintstr.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(servermd.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(site.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(validate.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(window.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(windowstr.h,$(LINKKITDIR)/include) depend:: vnc_unixsrc/Xvnc/programs/Xserver/include/misc.h0100664000076400007640000002133307120677563021444 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Copyright 1992, 1993 Data General Corporation; Copyright 1992, 1993 OMRON Corporation Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that neither the name OMRON or DATA GENERAL be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission of the party whose name is to be used. Neither OMRON or DATA GENERAL make any representation about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. OMRON AND DATA GENERAL EACH DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OMRON OR DATA GENERAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: misc.h /main/28 1996/12/02 10:22:01 lehors $ */ /* $XFree86: xc/programs/Xserver/include/misc.h,v 3.5 1996/12/23 07:09:29 dawes Exp $ */ #ifndef MISC_H #define MISC_H 1 /* * X internal definitions * */ extern unsigned long globalSerialNumber; extern unsigned long serverGeneration; #include #include #include #include #ifndef NULL #ifndef X_NOT_STDC_ENV #include #else #define NULL 0 #endif #endif #ifndef MAXSCREENS #define MAXSCREENS 3 #endif #define MAXCLIENTS 128 #define MAXDITS 1 #define MAXEXTENSIONS 128 #define MAXFORMATS 8 #define MAXVISUALS_PER_SCREEN 50 #if NeedFunctionPrototypes typedef void *pointer; #else typedef unsigned char *pointer; #endif typedef int Bool; typedef unsigned long PIXEL; typedef unsigned long ATOM; #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #ifndef _XTYPEDEF_FONTPTR typedef struct _Font *FontPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_FONTPTR #endif #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in dix.h */ #define _XTYPEDEF_CLIENTPTR #endif #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef struct _xReq *xReqPtr; #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ #include /* for bcopy, bzero, and bcmp */ #define NullBox ((BoxPtr)0) #define MILLI_PER_MIN (1000 * 60) #define MILLI_PER_SECOND (1000) /* this next is used with None and ParentRelative to tell PaintWin() what to use to paint the background. Also used in the macro IS_VALID_PIXMAP */ #define USE_BACKGROUND_PIXEL 3 #define USE_BORDER_PIXEL 3 /* byte swap a 32-bit literal */ #define lswapl(x) ((((x) & 0xff) << 24) |\ (((x) & 0xff00) << 8) |\ (((x) & 0xff0000) >> 8) |\ (((x) >> 24) & 0xff)) /* byte swap a short literal */ #define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) #define min(a, b) (((a) < (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b)) #if !defined(AMOEBA) && !defined(__EMX__) #ifndef abs #define abs(a) ((a) > 0 ? (a) : -(a)) #endif #else /* AMOEBA || __EMX__ */ /* abs() is a function, not a macro; include the file declaring * it in case we haven't done that yet. */ #include #endif /* AMOEBA */ #ifndef Fabs #define Fabs(a) ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */ #endif #define sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) /* this assumes b > 0 */ #define modulus(a, b, d) if (((d) = (a) % (b)) < 0) (d) += (b) /* * return the least significant bit in x which is set * * This works on 1's complement and 2's complement machines. * If you care about the extra instruction on 2's complement * machines, change to ((x) & (-(x))) */ #define lowbit(x) ((x) & (~(x) + 1)) #ifndef MAXSHORT #define MAXSHORT 32767 #endif #ifndef MINSHORT #define MINSHORT -MAXSHORT #endif /* some macros to help swap requests, replies, and events */ #define LengthRestB(stuff) \ ((client->req_len << 2) - sizeof(*stuff)) #define LengthRestS(stuff) \ ((client->req_len << 1) - (sizeof(*stuff) >> 1)) #define LengthRestL(stuff) \ (client->req_len - (sizeof(*stuff) >> 2)) #define SwapRestS(stuff) \ SwapShorts((short *)(stuff + 1), LengthRestS(stuff)) #define SwapRestL(stuff) \ SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) /* byte swap a 32-bit value */ #define swapl(x, n) { \ n = ((char *) (x))[0];\ ((char *) (x))[0] = ((char *) (x))[3];\ ((char *) (x))[3] = n;\ n = ((char *) (x))[1];\ ((char *) (x))[1] = ((char *) (x))[2];\ ((char *) (x))[2] = n; } /* byte swap a short */ #define swaps(x, n) { \ n = ((char *) (x))[0];\ ((char *) (x))[0] = ((char *) (x))[1];\ ((char *) (x))[1] = n; } /* copy 32-bit value from src to dst byteswapping on the way */ #define cpswapl(src, dst) { \ ((char *)&(dst))[0] = ((char *) &(src))[3];\ ((char *)&(dst))[1] = ((char *) &(src))[2];\ ((char *)&(dst))[2] = ((char *) &(src))[1];\ ((char *)&(dst))[3] = ((char *) &(src))[0]; } /* copy short from src to dst byteswapping on the way */ #define cpswaps(src, dst) { \ ((char *) &(dst))[0] = ((char *) &(src))[1];\ ((char *) &(dst))[1] = ((char *) &(src))[0]; } extern void SwapLongs( #if NeedFunctionPrototypes CARD32 *list, unsigned long count #endif ); extern void SwapShorts( #if NeedFunctionPrototypes short *list, unsigned long count #endif ); extern void MakePredeclaredAtoms( #if NeedFunctionPrototypes void #endif ); extern int Ones( #if NeedFunctionPrototypes unsigned long /*mask*/ #endif ); typedef struct _xPoint *DDXPointPtr; typedef struct _Box *BoxPtr; typedef struct _xEvent *xEventPtr; typedef struct _xRectangle *xRectanglePtr; typedef struct _GrabRec *GrabPtr; /* typedefs from other places - duplicated here to minimize the amount * of unnecessary junk that one would normally have to include to get * these symbols defined */ #ifndef _XTYPEDEF_CHARINFOPTR typedef struct _CharInfo *CharInfoPtr; /* also in fonts/include/font.h */ #define _XTYPEDEF_CHARINFOPTR #endif #endif /* MISC_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/pixmap.h0100664000076400007640000000766307120677563022021 0ustar constconst/* $XConsortium: pixmap.h,v 5.6 94/04/17 20:25:53 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PIXMAP_H #define PIXMAP_H #include "misc.h" #include "screenint.h" /* types for Drawable */ #define DRAWABLE_WINDOW 0 #define DRAWABLE_PIXMAP 1 #define UNDRAWABLE_WINDOW 2 #define DRAWABLE_BUFFER 3 /* flags to PaintWindow() */ #define PW_BACKGROUND 0 #define PW_BORDER 1 #define NullPixmap ((PixmapPtr)0) typedef struct _Drawable *DrawablePtr; typedef struct _Pixmap *PixmapPtr; typedef union _PixUnion { PixmapPtr pixmap; unsigned long pixel; } PixUnion; #define SamePixUnion(a,b,isPixel)\ ((isPixel) ? (a).pixel == (b).pixel : (a).pixmap == (b).pixmap) #define EqualPixUnion(as, a, bs, b) \ ((as) == (bs) && (SamePixUnion (a, b, as))) #define OnScreenDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == DRAWABLE_BUFFER)) #define WindowDrawable(type) \ ((type == DRAWABLE_WINDOW) || (type == UNDRAWABLE_WINDOW)) extern PixmapPtr GetScratchPixmapHeader( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ #endif ); extern void FreeScratchPixmapHeader( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern Bool CreateScratchPixmapsForScreen( #if NeedFunctionPrototypes int /*scrnum*/ #endif ); extern void FreeScratchPixmapsForScreen( #if NeedFunctionPrototypes int /*scrnum*/ #endif ); extern PixmapPtr AllocatePixmap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*pixDataSize*/ #endif ); #endif /* PIXMAP_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/windowstr.h0100664000076400007640000002015407120677563022551 0ustar constconst/* $XConsortium: windowstr.h /main/36 1995/09/22 10:23:19 dpw $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef WINDOWSTRUCT_H #define WINDOWSTRUCT_H #include "window.h" #include "pixmapstr.h" #include "regionstr.h" #include "cursor.h" #include "property.h" #include "resource.h" /* for ROOT_WINDOW_ID_BASE */ #include "dix.h" #include "miscstruct.h" #include "X11/Xprotostr.h" #include "opaque.h" #define GuaranteeNothing 0 #define GuaranteeVisBack 1 #define SameBackground(as, a, bs, b) \ ((as) == (bs) && ((as) == None || \ (as) == ParentRelative || \ SamePixUnion(a,b,as == BackgroundPixel))) #define SameBorder(as, a, bs, b) \ EqualPixUnion(as, a, bs, b) typedef struct _WindowOpt { VisualID visual; /* default: same as parent */ CursorPtr cursor; /* default: window.cursorNone */ Colormap colormap; /* default: same as parent */ Mask dontPropagateMask; /* default: window.dontPropagate */ Mask otherEventMasks; /* default: 0 */ struct _OtherClients *otherClients; /* default: NULL */ struct _GrabRec *passiveGrabs; /* default: NULL */ PropertyPtr userProps; /* default: NULL */ unsigned long backingBitPlanes; /* default: ~0L */ unsigned long backingPixel; /* default: 0 */ #ifdef SHAPE RegionPtr boundingShape; /* default: NULL */ RegionPtr clipShape; /* default: NULL */ #endif #ifdef XINPUT struct _OtherInputMasks *inputMasks; /* default: NULL */ #endif } WindowOptRec, *WindowOptPtr; #define BackgroundPixel 2L #define BackgroundPixmap 3L typedef struct _Window { DrawableRec drawable; WindowPtr parent; /* ancestor chain */ WindowPtr nextSib; /* next lower sibling */ WindowPtr prevSib; /* next higher sibling */ WindowPtr firstChild; /* top-most child */ WindowPtr lastChild; /* bottom-most child */ RegionRec clipList; /* clipping rectangle for output */ RegionRec borderClip; /* NotClippedByChildren + border */ union _Validate *valdata; RegionRec winSize; RegionRec borderSize; DDXPointRec origin; /* position relative to parent */ unsigned short borderWidth; unsigned short deliverableEvents; Mask eventMask; PixUnion background; PixUnion border; pointer backStorage; /* null when BS disabled */ WindowOptPtr optional; unsigned backgroundState:2; /* None, Relative, Pixel, Pixmap */ unsigned borderIsPixel:1; unsigned cursorIsNone:1; /* else real cursor (might inherit) */ unsigned backingStore:2; unsigned saveUnder:1; unsigned DIXsaveUnder:1; unsigned bitGravity:4; unsigned winGravity:4; unsigned overrideRedirect:1; unsigned visibility:2; unsigned mapped:1; unsigned realized:1; /* ancestors are all mapped */ unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3;/* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ #ifdef NEED_DBE_BUF_BITS #define DBE_FRONT_BUFFER 1 #define DBE_BACK_BUFFER 0 unsigned dstBuffer:1; /* destination buffer for rendering */ unsigned srcBuffer:1; /* source buffer for rendering */ #endif DevUnion *devPrivates; } WindowRec; /* * Ok, a bunch of macros for accessing the optional record * fields (or filling the appropriate default value) */ extern Mask DontPropagateMasks[]; #define wTrackParent(w,field) ((w)->optional ? \ (w)->optional->field \ : FindWindowWithOptional(w)->optional->field) #define wUseDefault(w,field,def) ((w)->optional ? \ (w)->optional->field \ : def) #define wVisual(w) wTrackParent(w, visual) #define wCursor(w) ((w)->cursorIsNone ? None : wTrackParent(w, cursor)) #define wColormap(w) ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap)) #define wDontPropagateMask(w) wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate]) #define wOtherEventMasks(w) wUseDefault(w, otherEventMasks, 0) #define wOtherClients(w) wUseDefault(w, otherClients, NULL) #ifdef XINPUT #define wOtherInputMasks(w) wUseDefault(w, inputMasks, NULL) #else #define wOtherInputMasks(w) NULL #endif #define wPassiveGrabs(w) wUseDefault(w, passiveGrabs, NULL) #define wUserProps(w) wUseDefault(w, userProps, NULL) #define wBackingBitPlanes(w) wUseDefault(w, backingBitPlanes, ~0L) #define wBackingPixel(w) wUseDefault(w, backingPixel, 0) #ifdef SHAPE #define wBoundingShape(w) wUseDefault(w, boundingShape, NULL) #define wClipShape(w) wUseDefault(w, clipShape, NULL) #endif #define wClient(w) (clients[CLIENT_ID((w)->drawable.id)]) #define wBorderWidth(w) ((int) (w)->borderWidth) /* true when w needs a border drawn. */ #ifdef SHAPE #define HasBorder(w) ((w)->borderWidth || wClipShape(w)) #else #define HasBorder(w) ((w)->borderWidth) #endif typedef struct _ScreenSaverStuff { WindowPtr pWindow; XID wid; char blanked; Bool (*ExternalScreenSaver)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*xstate*/, Bool /*force*/ #endif ); } ScreenSaverStuffRec, *ScreenSaverStuffPtr; #define SCREEN_IS_BLANKED 0 #define SCREEN_ISNT_SAVED 1 #define SCREEN_IS_TILED 2 #define SCREEN_IS_BLACK 3 #define HasSaverWindow(i) (savedScreenInfo[i].pWindow != NullWindow) extern int screenIsSaved; extern ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; /* * this is the configuration parameter "NO_BACK_SAVE" * it means that any existant backing store should not * be used to implement save unders. */ #ifndef NO_BACK_SAVE #define DO_SAVE_UNDERS(pWin) ((pWin)->drawable.pScreen->saveUnderSupport ==\ USE_DIX_SAVE_UNDERS) /* * saveUnderSupport is set to this magic value when using DIXsaveUnders */ #define USE_DIX_SAVE_UNDERS 0x40 #endif extern int numSaveUndersViewable; extern int deltaSaveUndersViewable; #endif /* WINDOWSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/XIstubs.h0100664000076400007640000000520307120677563022110 0ustar constconst/* $XFree86: xc/programs/Xserver/include/XIstubs.h,v 3.1 1996/04/15 11:34:22 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef XI_STUBS_H #define XI_STUBS_H 1 int ChangeKeyboardDevice ( #if NeedFunctionPrototypes DeviceIntPtr /* old_dev */, DeviceIntPtr /* new_dev */ #endif ); int ChangePointerDevice ( #if NeedFunctionPrototypes DeviceIntPtr /* old_dev */, DeviceIntPtr /* new_dev */, unsigned char /* x */, unsigned char /* y */ #endif ); void CloseInputDevice ( #if NeedFunctionPrototypes DeviceIntPtr /* d */, ClientPtr /* client */ #endif ); void AddOtherInputDevices ( #if NeedFunctionPrototypes void #endif ); void OpenInputDevice ( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, ClientPtr /* client */, int * /* status */ #endif ); int SetDeviceMode ( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, int /* mode */ #endif ); int SetDeviceValuators ( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, int * /* valuators */, int /* first_valuator */, int /* num_valuators */ #endif ); int ChangeDeviceControl ( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, xDeviceCtl * /* control */ #endif ); #endif /* XI_STUBS_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dixfontstr.h0100664000076400007640000000672607120677563022726 0ustar constconst/* $XConsortium: dixfontstr.h,v 1.15 94/04/17 20:25:39 dpw Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIXFONTSTRUCT_H #define DIXFONTSTRUCT_H #include "servermd.h" #include "dixfont.h" #include "fontstruct.h" #include "closure.h" #define NEED_REPLIES #include "X11/Xproto.h" /* for xQueryFontReply */ #define FONTCHARSET(font) (font) #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field #define FONTMINBOUNDS(font,field) (font)->info.minbounds.field #define TERMINALFONT(font) (font)->info.terminalFont #define FONTASCENT(font) (font)->info.fontAscent #define FONTDESCENT(font) (font)->info.fontDescent #define FONTGLYPHS(font) 0 #define FONTCONSTMETRICS(font) (font)->info.constantMetrics #define FONTCONSTWIDTH(font) (font)->info.constantWidth #define FONTALLEXIST(font) (font)->info.allExist #define FONTFIRSTCOL(font) (font)->info.firstCol #define FONTLASTCOL(font) (font)->info.lastCol #define FONTFIRSTROW(font) (font)->info.firstRow #define FONTLASTROW(font) (font)->info.lastRow #define FONTDEFAULTCH(font) (font)->info.defaultCh #define FONTINKMIN(font) (&((font)->info.ink_minbounds)) #define FONTINKMAX(font) (&((font)->info.ink_maxbounds)) #define FONTPROPS(font) (font)->info.props #define FONTGLYPHBITS(base,pci) ((unsigned char *) (pci)->bits) #define FONTINFONPROPS(font) (font)->info.nprops /* some things haven't changed names, but we'll be careful anyway */ #define FONTREFCNT(font) (font)->refcnt /* * for linear char sets */ #define N1dChars(pfont) (FONTLASTCOL(pfont) - FONTFIRSTCOL(pfont) + 1) /* * for 2D char sets */ #define N2dChars(pfont) (N1dChars(pfont) * \ (FONTLASTROW(pfont) - FONTFIRSTROW(pfont) + 1)) #ifndef GLYPHPADBYTES #define GLYPHPADBYTES -1 #endif #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1 #define GLYPHWIDTHBYTESPADDED(pci) (GLYPHWIDTHBYTES(pci)) #define PADGLYPHWIDTHBYTES(w) (((w)+7)>>3) #endif #if GLYPHPADBYTES == 2 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+1) & ~0x1) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+1) & ~0x1) #endif #if GLYPHPADBYTES == 4 #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+3) & ~0x3) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+3) & ~0x3) #endif #if GLYPHPADBYTES == 8 /* for a cray? */ #define GLYPHWIDTHBYTESPADDED(pci) ((GLYPHWIDTHBYTES(pci)+7) & ~0x7) #define PADGLYPHWIDTHBYTES(w) (((((w)+7)>>3)+7) & ~0x7) #endif #endif /* DIXFONTSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/cursorstr.h0100664000076400007640000000660007120677563022557 0ustar constconst/* $XConsortium: cursorstr.h,v 1.8 94/04/17 20:25:35 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef CURSORSTRUCT_H #define CURSORSTRUCT_H #include "cursor.h" /* * device-independent cursor storage */ /* * source and mask point directly to the bits, which are in the server-defined * bitmap format. */ typedef struct _CursorBits { unsigned char *source; /* points to bits */ unsigned char *mask; /* points to bits */ unsigned short width, height, xhot, yhot; /* metrics */ int refcnt; /* can be shared */ pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ } CursorBits, *CursorBitsPtr; typedef struct _Cursor { CursorBitsPtr bits; unsigned short foreRed, foreGreen, foreBlue; /* device-independent color */ unsigned short backRed, backGreen, backBlue; /* device-independent color */ int refcnt; pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ } CursorRec; typedef struct _CursorMetric { unsigned short width, height, xhot, yhot; } CursorMetricRec; #endif /* CURSORSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dixevents.h0100664000076400007640000001207707120677563022527 0ustar constconst/* $XFree86: xc/programs/Xserver/include/dixevents.h,v 3.2 1996/12/24 02:27:27 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef DIXEVENTS_H #define DIXEVENTS_H extern Mask GetNextEventMask( #if NeedFunctionPrototypes void #endif ); extern void SetCriticalEvent( #if NeedFunctionPrototypes int /* event */ #endif ); extern void ConfineCursorToWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, Bool /* generateEvents */, Bool /* confineToScreen */ #endif ); extern CursorPtr GetSpriteCursor( #if NeedFunctionPrototypes void #endif ); extern int ProcAllowEvents( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int TryClientEvents ( #if NeedFunctionPrototypes ClientPtr /* client */, xEvent * /* pEvents */, int /* count */, Mask /* mask */, Mask /* filter */, GrabPtr /* grab */ #endif ); extern int MaybeDeliverEventsToClient( #if NeedFunctionPrototypes WindowPtr /* pWin */, xEvent * /* pEvents */, int /* count */, Mask /* filter */, ClientPtr /* dontClient */ #endif ); extern void WindowsRestructured( #if NeedFunctionPrototypes void #endif ); extern void NewCurrentScreen( #if NeedFunctionPrototypes ScreenPtr /* newScreen */, int /* x */, int /* y */ #endif ); extern int ProcWarpPointer( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern void #ifdef XKB CoreProcessKeyboardEvent ( #else ProcessKeyboardEvent ( #endif #if NeedFunctionPrototypes xEvent * /* xE */, DeviceIntPtr /* keybd */, int /* count */ #endif ); extern void #ifdef XKB CoreProcessPointerEvent ( #else ProcessPointerEvent ( #endif #if NeedFunctionPrototypes xEvent * /* xE */, DeviceIntPtr /* mouse */, int /* count */ #endif ); extern int EventSelectForWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */ #endif ); extern int EventSuppressForWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, Bool * /* checkOptional */ #endif ); extern int ProcSetInputFocus( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcGetInputFocus( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcGrabPointer( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcChangeActivePointerGrab( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcUngrabPointer( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcGrabKeyboard( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcUngrabKeyboard( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcQueryPointer( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcSendEvent( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcUngrabKey( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcGrabKey( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcGrabButton( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcUngrabButton( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ProcRecolorCursor( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); #endif /* DIXEVENTS_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/extension.h0100664000076400007640000000563607120677563022535 0ustar constconst/* $XConsortium: extension.h /main/9 1995/09/22 10:23:04 dpw $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef EXTENSION_H #define EXTENSION_H _XFUNCPROTOBEGIN extern unsigned short StandardMinorOpcode( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern unsigned short MinorOpcodeOfRequest( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void InitExtensions( #if NeedFunctionPrototypes int argc, char **argv #endif ); extern void CloseDownExtensions( #if NeedFunctionPrototypes void #endif ); _XFUNCPROTOEND #endif /* EXTENSION_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/os.h0100664000076400007640000003560507120677563021141 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: os.h /main/60 1996/12/15 21:25:13 rws $ */ /* $XFree86: xc/programs/Xserver/include/os.h,v 3.16.2.1 1998/01/22 10:47:13 dawes Exp $ */ #ifndef OS_H #define OS_H #include "misc.h" #define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size)) #define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr)) #include "Xalloca.h" #define NullFID ((FID) 0) #define SCREEN_SAVER_ON 0 #define SCREEN_SAVER_OFF 1 #define SCREEN_SAVER_FORCER 2 #define SCREEN_SAVER_CYCLE 3 #ifndef MAX_REQUEST_SIZE #define MAX_REQUEST_SIZE 65535 #endif #ifndef MAX_BIG_REQUEST_SIZE #define MAX_BIG_REQUEST_SIZE 1048575 #endif typedef pointer FID; typedef struct _FontPathRec *FontPathPtr; typedef struct _NewClientRec *NewClientPtr; #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) #define xalloc(size) Xalloc((unsigned long)(size)) #define xnfalloc(size) XNFalloc((unsigned long)(size)) #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size)) #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size)) #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size)) #define xfree(ptr) Xfree((pointer)(ptr)) #ifdef SCO #include #endif #ifndef X_NOT_STDC_ENV #include #else #ifdef SYSV #include #else #include #endif #endif /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */ #ifdef SIGNALRETURNSINT #define SIGVAL int #else #define SIGVAL void #endif extern Bool OsDelayInitColors; extern int WaitForSomething( #if NeedFunctionPrototypes int* /*pClientsReady*/ #endif ); #ifdef LBX #define ReadRequestFromClient(client) ((client)->readRequest(client)) extern int StandardReadRequestFromClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); #else extern int ReadRequestFromClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); #endif /* LBX */ extern Bool InsertFakeRequest( #if NeedFunctionPrototypes ClientPtr /*client*/, char* /*data*/, int /*count*/ #endif ); extern int ResetCurrentRequest( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void FlushAllOutput( #if NeedFunctionPrototypes void #endif ); extern void FlushIfCriticalOutputPending( #if NeedFunctionPrototypes void #endif ); extern void SetCriticalOutputPending( #if NeedFunctionPrototypes void #endif ); extern int WriteToClient( #if NeedFunctionPrototypes ClientPtr /*who*/, int /*count*/, char* /*buf*/ #endif ); extern void ResetOsBuffers( #if NeedFunctionPrototypes void #endif ); extern void CreateWellKnownSockets( #if NeedFunctionPrototypes void #endif ); extern void ResetWellKnownSockets( #if NeedFunctionPrototypes void #endif ); extern XID AuthorizationIDOfClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern char *ClientAuthorized( #if NeedFunctionPrototypes ClientPtr /*client*/, unsigned int /*proto_n*/, char* /*auth_proto*/, unsigned int /*string_n*/, char* /*auth_string*/ #endif ); extern Bool EstablishNewConnections( #if NeedFunctionPrototypes ClientPtr /*clientUnused*/, pointer /*closure*/ #endif ); extern void CheckConnections( #if NeedFunctionPrototypes void #endif ); extern void CloseDownConnection( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int AddEnabledDevice( #if NeedFunctionPrototypes int /*fd*/ #endif ); extern int RemoveEnabledDevice( #if NeedFunctionPrototypes int /*fd*/ #endif ); extern int OnlyListenToOneClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int ListenToAllClients( #if NeedFunctionPrototypes void #endif ); extern int IgnoreClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int AttendClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int MakeClientGrabImpervious( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int MakeClientGrabPervious( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void Error( #if NeedFunctionPrototypes char* /*str*/ #endif ); extern CARD32 GetTimeInMillis( #if NeedFunctionPrototypes void #endif ); extern int AdjustWaitForDelay( #if NeedFunctionPrototypes pointer /*waitTime*/, unsigned long /*newdelay*/ #endif ); typedef struct _OsTimerRec *OsTimerPtr; typedef CARD32 (*OsTimerCallback)( #if NeedFunctionPrototypes OsTimerPtr /* timer */, CARD32 /* time */, pointer /* arg */ #endif ); extern void TimerInit( #if NeedFunctionPrototypes void #endif ); extern Bool TimerForce( #if NeedFunctionPrototypes OsTimerPtr /* timer */ #endif ); #define TimerAbsolute (1<<0) #define TimerForceOld (1<<1) extern OsTimerPtr TimerSet( #if NeedFunctionPrototypes OsTimerPtr /* timer */, int /* flags */, CARD32 /* millis */, OsTimerCallback /* func */, pointer /* arg */ #endif ); extern void TimerCheck( #if NeedFunctionPrototypes void #endif ); extern void TimerCancel( #if NeedFunctionPrototypes OsTimerPtr /* pTimer */ #endif ); extern void TimerFree( #if NeedFunctionPrototypes OsTimerPtr /* pTimer */ #endif ); extern SIGVAL AutoResetServer( #if NeedFunctionPrototypes int /*sig*/ #endif ); extern SIGVAL GiveUp( #if NeedFunctionPrototypes int /*sig*/ #endif ); extern void UseMsg( #if NeedFunctionPrototypes void #endif ); extern void ProcessCommandLine( #if NeedFunctionPrototypes int /*argc*/, char* /*argv*/[] #endif ); extern unsigned long *Xalloc( #if NeedFunctionPrototypes unsigned long /*amount*/ #endif ); extern unsigned long *XNFalloc( #if NeedFunctionPrototypes unsigned long /*amount*/ #endif ); extern unsigned long *Xcalloc( #if NeedFunctionPrototypes unsigned long /*amount*/ #endif ); extern unsigned long *Xrealloc( #if NeedFunctionPrototypes pointer /*ptr*/, unsigned long /*amount*/ #endif ); extern unsigned long *XNFrealloc( #if NeedFunctionPrototypes pointer /*ptr*/, unsigned long /*amount*/ #endif ); extern void Xfree( #if NeedFunctionPrototypes pointer /*ptr*/ #endif ); extern void OsInitAllocator( #if NeedFunctionPrototypes void #endif ); typedef SIGVAL (*OsSigHandlerPtr)( #if NeedFunctionPrototypes int /* sig */ #endif ); extern OsSigHandlerPtr OsSignal( #if NeedFunctionPrototypes int /* sig */, OsSigHandlerPtr /* handler */ #endif ); extern int auditTrailLevel; extern void AuditF( #if NeedVarargsPrototypes char* /*f*/, ... #endif ); extern void FatalError( #if NeedVarargsPrototypes char* /*f*/, ... #endif ) #if __GNUC__ == 2 && __GNUC_MINOR__ > 4 __attribute((noreturn)) #endif ; extern void ErrorF( #if NeedVarargsPrototypes char* /*f*/, ... #endif ); #ifdef SERVER_LOCK extern void LockServer( #if NeedFunctionPrototypes void #endif ); extern void UnlockServer( #if NeedFunctionPrototypes void #endif ); #endif extern int OsLookupColor( #if NeedFunctionPrototypes int /*screen*/, char * /*name*/, unsigned /*len*/, unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/ #endif ); extern void OsInit( #if NeedFunctionPrototypes void #endif ); extern void OsCleanup( #if NeedFunctionPrototypes void #endif ); extern void OsVendorFatalError( #if NeedFunctionPrototypes void #endif ); extern void OsVendorInit( #if NeedFunctionPrototypes void #endif ); extern int OsInitColors( #if NeedFunctionPrototypes void #endif ); #if !defined(WIN32) && !defined(__EMX__) extern int System( #if NeedFunctionPrototypes char * #endif ); extern pointer Popen( #if NeedFunctionPrototypes char *, char * #endif ); extern int Pclose( #if NeedFunctionPrototypes pointer #endif ); #else #define System(a) system(a) #define Popen(a,b) popen(a,b) #define Pclose(a) pclose(a) #endif extern int AddHost( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*family*/, unsigned /*length*/, pointer /*pAddr*/ #endif ); extern Bool ForEachHostInFamily ( #if NeedFunctionPrototypes int /*family*/, Bool (* /*func*/ )( #if NeedNestedPrototypes unsigned char * /* addr */, short /* len */, pointer /* closure */ #endif ), pointer /*closure*/ #endif ); extern int RemoveHost( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*family*/, unsigned /*length*/, pointer /*pAddr*/ #endif ); extern int GetHosts( #if NeedFunctionPrototypes pointer * /*data*/, int * /*pnHosts*/, int * /*pLen*/, BOOL * /*pEnabled*/ #endif ); typedef struct sockaddr * sockaddrPtr; extern int InvalidHost( #if NeedFunctionPrototypes sockaddrPtr /*saddr*/, int /*len*/ #endif ); extern int LocalClient( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); extern int ChangeAccessControl( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*fEnabled*/ #endif ); extern int GetAccessControl( #if NeedFunctionPrototypes void #endif ); extern void AddLocalHosts( #if NeedFunctionPrototypes void #endif ); extern void ResetHosts( #if NeedFunctionPrototypes char *display #endif ); extern void EnableLocalHost( #if NeedFunctionPrototypes void #endif ); extern void DisableLocalHost( #if NeedFunctionPrototypes void #endif ); extern void AccessUsingXdmcp( #if NeedFunctionPrototypes void #endif ); extern void DefineSelf( #if NeedFunctionPrototypes int /*fd*/ #endif ); extern void AugmentSelf( #if NeedFunctionPrototypes pointer /*from*/, int /*len*/ #endif ); extern void InitAuthorization( #if NeedFunctionPrototypes char * /*filename*/ #endif ); extern int LoadAuthorization( #if NeedFunctionPrototypes void #endif ); extern void RegisterAuthorizations( #if NeedFunctionPrototypes void #endif ); extern XID CheckAuthorization( #if NeedFunctionPrototypes unsigned int /*namelength*/, char * /*name*/, unsigned int /*datalength*/, char * /*data*/, ClientPtr /*client*/, char ** /*reason*/ #endif ); extern void ResetAuthorization( #if NeedFunctionPrototypes void #endif ); extern int AddAuthorization( #if NeedFunctionPrototypes unsigned int /*name_length*/, char * /*name*/, unsigned int /*data_length*/, char * /*data*/ #endif ); extern XID GenerateAuthorization( #if NeedFunctionPrototypes unsigned int /* name_length */, char * /* name */, unsigned int /* data_length */, char * /* data */, unsigned int * /* data_length_return */, char ** /* data_return */ #endif ); extern void ExpandCommandLine( #if NeedFunctionPrototypes int * /*pargc*/, char *** /*pargv*/ #endif ); extern int ddxProcessArgument( #if NeedFunctionPrototypes int /*argc*/, char * /*argv*/ [], int /*i*/ #endif ); /* * idiom processing stuff */ xReqPtr PeekNextRequest( #if NeedFunctionPrototypes xReqPtr req, ClientPtr client, Bool readmore #endif ); void SkipRequests( #if NeedFunctionPrototypes xReqPtr req, ClientPtr client, int numskipped #endif ); /* int ReqLen(xReq *req, ClientPtr client) * Given a pointer to a *complete* request, return its length in bytes. * Note that if the request is a big request (as defined in the Big * Requests extension), the macro lies by returning 4 less than the * length that it actually occupies in the request buffer. This is so you * can blindly compare the length with the various sz_ constants * in Xproto.h without having to know/care about big requests. */ #define ReqLen(_pxReq, _client) \ ((_pxReq->length ? \ (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \ : ((_client->swapped ? \ lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \ ) << 2) /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr) * Cast the given request to one of type otherReqTypePtr to access * fields beyond the length field. */ #define CastxReq(_pxReq, otherReqTypePtr) \ (_pxReq->length ? (otherReqTypePtr)_pxReq \ : (otherReqTypePtr)(((CARD32*)_pxReq)+1)) /* stuff for SkippedRequestsCallback */ extern CallbackListPtr SkippedRequestsCallback; typedef struct { xReqPtr req; ClientPtr client; int numskipped; } SkippedRequestInfoRec; /* stuff for ReplyCallback */ extern CallbackListPtr ReplyCallback; typedef struct { ClientPtr client; pointer replyData; unsigned long dataLenBytes; unsigned long bytesRemaining; Bool startOfReply; } ReplyInfoRec; /* stuff for FlushCallback */ extern CallbackListPtr FlushCallback; #endif /* OS_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/swaprep.h0100664000076400007640000002350507120677563022175 0ustar constconst/* $XFree86: xc/programs/Xserver/include/swaprep.h,v 3.0 1996/04/15 11:34:34 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SWAPREP_H #define SWAPREP_H 1 void Swap32Write( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, CARD32 * /* pbuf */ #endif ); void CopySwap32Write( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, CARD32 * /* pbuf */ #endif ); void CopySwap16Write( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, short * /* pbuf */ #endif ); void SGenericReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGenericReply * /* pRep */ #endif ); void SGetWindowAttributesReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetWindowAttributesReply * /* pRep */ #endif ); void SGetGeometryReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetGeometryReply * /* pRep */ #endif ); void SQueryTreeReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryTreeReply * /* pRep */ #endif ); void SInternAtomReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xInternAtomReply * /* pRep */ #endif ); void SGetAtomNameReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetAtomNameReply * /* pRep */ #endif ); void SGetPropertyReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetPropertyReply * /* pRep */ #endif ); void SListPropertiesReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListPropertiesReply * /* pRep */ #endif ); void SGetSelectionOwnerReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetSelectionOwnerReply * /* pRep */ #endif ); void SQueryPointerReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryPointerReply * /* pRep */ #endif ); void SwapTimecoord( #if NeedFunctionPrototypes xTimecoord * /* pCoord */ #endif ); void SwapTimeCoordWrite( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xTimecoord * /* pRep */ #endif ); void SGetMotionEventsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetMotionEventsReply * /* pRep */ #endif ); void STranslateCoordsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xTranslateCoordsReply * /* pRep */ #endif ); void SGetInputFocusReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetInputFocusReply * /* pRep */ #endif ); void SQueryKeymapReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryKeymapReply * /* pRep */ #endif ); #ifdef LBX void SwapCharInfo( #if NeedFunctionPrototypes xCharInfo * /* pInfo */ #endif ); #endif #ifdef LBX void SwapFont( #if NeedFunctionPrototypes xQueryFontReply * /* pr */, Bool /* hasGlyphs */ #endif ); #endif void SQueryFontReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryFontReply * /* pRep */ #endif ); void SQueryTextExtentsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryTextExtentsReply * /* pRep */ #endif ); void SListFontsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListFontsReply * /* pRep */ #endif ); void SListFontsWithInfoReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListFontsWithInfoReply * /* pRep */ #endif ); void SGetFontPathReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetFontPathReply * /* pRep */ #endif ); void SGetImageReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetImageReply * /* pRep */ #endif ); void SListInstalledColormapsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListInstalledColormapsReply * /* pRep */ #endif ); void SAllocColorReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xAllocColorReply * /* pRep */ #endif ); void SAllocNamedColorReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xAllocNamedColorReply * /* pRep */ #endif ); void SAllocColorCellsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xAllocColorCellsReply * /* pRep */ #endif ); void SAllocColorPlanesReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xAllocColorPlanesReply * /* pRep */ #endif ); void SwapRGB( #if NeedFunctionPrototypes xrgb * /* prgb */ #endif ); void SQColorsExtend( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xrgb * /* prgb */ #endif ); void SQueryColorsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryColorsReply * /* pRep */ #endif ); void SLookupColorReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xLookupColorReply * /* pRep */ #endif ); void SQueryBestSizeReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xQueryBestSizeReply * /* pRep */ #endif ); void SListExtensionsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListExtensionsReply * /* pRep */ #endif ); void SGetKeyboardMappingReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetKeyboardMappingReply * /* pRep */ #endif ); void SGetPointerMappingReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetPointerMappingReply * /* pRep */ #endif ); void SGetModifierMappingReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetModifierMappingReply * /* pRep */ #endif ); void SGetKeyboardControlReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetKeyboardControlReply * /* pRep */ #endif ); void SGetPointerControlReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetPointerControlReply * /* pRep */ #endif ); void SGetScreenSaverReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xGetScreenSaverReply * /* pRep */ #endif ); void SLHostsExtend( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, char * /* buf */ #endif ); void SListHostsReply( #if NeedFunctionPrototypes ClientPtr /* pClient */, int /* size */, xListHostsReply * /* pRep */ #endif ); void SErrorEvent( #if NeedFunctionPrototypes xError * /* from */, xError * /* to */ #endif ); void SwapConnSetupInfo( #if NeedFunctionPrototypes char * /* pInfo */, char * /* pInfoTBase */ #endif ); void WriteSConnectionInfo( #if NeedFunctionPrototypes ClientPtr /* pClient */, unsigned long /* size */, char * /* pInfo */ #endif ); void SwapConnSetup( #if NeedFunctionPrototypes xConnSetup * /* pConnSetup */, xConnSetup * /* pConnSetupT */ #endif ); void SwapWinRoot( #if NeedFunctionPrototypes xWindowRoot * /* pRoot */, xWindowRoot * /* pRootT */ #endif ); void SwapVisual( #if NeedFunctionPrototypes xVisualType * /* pVis */, xVisualType * /* pVisT */ #endif ); void SwapConnSetupPrefix( #if NeedFunctionPrototypes xConnSetupPrefix * /* pcspFrom */, xConnSetupPrefix * /* pcspTo */ #endif ); void WriteSConnSetupPrefix( #if NeedFunctionPrototypes ClientPtr /* pClient */, xConnSetupPrefix * /* pcsp */ #endif ); #undef SWAPREP_PROC #if NeedFunctionPrototypes #define SWAPREP_PROC(func) void func(xEvent * /* from */, xEvent * /* to */) #else #define SWAPREP_PROC(func) void func(/* xEvent * from, xEvent * to */) #endif SWAPREP_PROC(SCirculateEvent); SWAPREP_PROC(SClientMessageEvent); SWAPREP_PROC(SColormapEvent); SWAPREP_PROC(SConfigureNotifyEvent); SWAPREP_PROC(SConfigureRequestEvent); SWAPREP_PROC(SCreateNotifyEvent); SWAPREP_PROC(SDestroyNotifyEvent); SWAPREP_PROC(SEnterLeaveEvent); SWAPREP_PROC(SExposeEvent); SWAPREP_PROC(SFocusEvent); SWAPREP_PROC(SGraphicsExposureEvent); SWAPREP_PROC(SGravityEvent); SWAPREP_PROC(SKeyButtonPtrEvent); SWAPREP_PROC(SKeymapNotifyEvent); SWAPREP_PROC(SMapNotifyEvent); SWAPREP_PROC(SMapRequestEvent); SWAPREP_PROC(SMappingEvent); SWAPREP_PROC(SNoExposureEvent); SWAPREP_PROC(SPropertyEvent); SWAPREP_PROC(SReparentEvent); SWAPREP_PROC(SResizeRequestEvent); SWAPREP_PROC(SSelectionClearEvent); SWAPREP_PROC(SSelectionNotifyEvent); SWAPREP_PROC(SSelectionRequestEvent); SWAPREP_PROC(SUnmapNotifyEvent); SWAPREP_PROC(SVisibilityEvent); #undef SWAPREP_PROC #endif /* SWAPREP_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/region.h0100664000076400007640000000500207120677563021767 0ustar constconst/* $XConsortium: region.h,v 1.5 94/04/17 20:25:59 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGION_H #define REGION_H #include "regionstr.h" #endif /* REGION_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/extinit.h0100664000076400007640000001007107120677563022172 0ustar constconst/* $XFree86: xc/programs/Xserver/include/extinit.h,v 3.1 1996/04/15 11:34:30 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * Interface of extinit.c */ #ifndef EXTINIT_H #define EXTINIT_H void XInputExtensionInit( #if NeedFunctionPrototypes void #endif ); int ProcIDispatch ( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); int SProcIDispatch( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); void SReplyIDispatch ( #if NeedFunctionPrototypes ClientPtr /* client */, int /* len */, xGrabDeviceReply * /* rep */ #endif ); void SEventIDispatch ( #if NeedFunctionPrototypes xEvent * /* from */, xEvent * /* to */ #endif ); void SEventDeviceValuator ( #if NeedFunctionPrototypes deviceValuator * /* from */, deviceValuator * /* to */ #endif ); void SEventFocus ( #if NeedFunctionPrototypes deviceFocus * /* from */, deviceFocus * /* to */ #endif ); void SDeviceStateNotifyEvent ( #if NeedFunctionPrototypes deviceStateNotify * /* from */, deviceStateNotify * /* to */ #endif ); void SDeviceKeyStateNotifyEvent ( #if NeedFunctionPrototypes deviceKeyStateNotify * /* from */, deviceKeyStateNotify * /* to */ #endif ); void SDeviceButtonStateNotifyEvent ( #if NeedFunctionPrototypes deviceButtonStateNotify * /* from */, deviceButtonStateNotify * /* to */ #endif ); void SChangeDeviceNotifyEvent ( #if NeedFunctionPrototypes changeDeviceNotify * /* from */, changeDeviceNotify * /* to */ #endif ); void SDeviceMappingNotifyEvent ( #if NeedFunctionPrototypes deviceMappingNotify * /* from */, deviceMappingNotify * /* to */ #endif ); void FixExtensionEvents ( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); void RestoreExtensionEvents ( #if NeedFunctionPrototypes void #endif ); void IResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* unused */ #endif ); void AssignTypeAndName ( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, Atom /* type */, char * /* name */ #endif ); void MakeDeviceTypeAtoms ( #if NeedFunctionPrototypes void #endif ); DeviceIntPtr LookupDeviceIntRec ( #if NeedFunctionPrototypes CARD8 /* id */ #endif ); void SetExclusiveAccess ( #if NeedFunctionPrototypes Mask /* mask */ #endif ); void AllowPropagateSuppress ( #if NeedFunctionPrototypes Mask /* mask */ #endif ); Mask GetNextExtEventMask ( #if NeedFunctionPrototypes void #endif ); void SetMaskForExtEvent( #if NeedFunctionPrototypes Mask /* mask */, int /* event */ #endif ); void SetEventInfo( #if NeedFunctionPrototypes Mask /* mask */, int /* constant */ #endif ); #endif /* EXTINIT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/property.h0100664000076400007640000000574607120677563022407 0ustar constconst/* $XConsortium: property.h,v 1.5 94/04/17 20:25:55 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PROPERTY_H #define PROPERTY_H typedef struct _Property *PropertyPtr; extern int ChangeWindowProperty( #if NeedFunctionPrototypes WindowPtr /*pWin*/, Atom /*property*/, Atom /*type*/, int /*format*/, int /*mode*/, unsigned long /*len*/, pointer /*value*/, Bool /*sendevent*/ #endif ); extern int DeleteProperty( #if NeedFunctionPrototypes WindowPtr /*pWin*/, Atom /*propName*/ #endif ); extern void DeleteAllWindowProperties( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); #endif /* PROPERTY_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/servermd.h0100664000076400007640000004534010543216033022324 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SERVERMD_H #define SERVERMD_H 1 /* $XConsortium: servermd.h /main/58 1996/12/02 10:22:09 lehors $ */ /* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.19.2.3 1997/07/28 14:17:34 dawes Exp $ */ /* * Machine dependent values: * GLYPHPADBYTES should be chosen with consideration for the space-time * trade-off. Padding to 0 bytes means that there is no wasted space * in the font bitmaps (both on disk and in memory), but that access of * the bitmaps will cause odd-address memory references. Padding to * 2 bytes would ensure even address memory references and would * be suitable for a 68010-class machine, but at the expense of wasted * space in the font bitmaps. Padding to 4 bytes would be good * for real 32 bit machines, etc. Be sure that you tell the font * compiler what kind of padding you want because its defines are * kept separate from this. See server/include/font.h for how * GLYPHPADBYTES is used. * * Along with this, you should choose an appropriate value for * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h. This * constant choses what kind of memory references are guarenteed during * font access; either 1, 2 or 4, for byte, word or longword access, * respectively. For instance, if you have decided to to have * GLYPHPADBYTES == 4, then it is pointless for you to have a * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already * guarenteed you that your fonts are longword aligned. On the other * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may * also decide that the computing involved in aligning the pointer is more * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1. * * Next, choose the tuning parameters which are appropriate for your * hardware; these modify the behaviour of the raw frame buffer code * in ddx/mfb and ddx/cfb. Defining these incorrectly will not cause * the server to run incorrectly, but defining these correctly will * cause some noticeable speed improvements: * * AVOID_MEMORY_READ - (8-bit cfb only) * When stippling pixels on the screen (polytext and pushpixels), * don't read long words from the display and mask in the * appropriate values. Rather, perform multiple byte/short/long * writes as appropriate. This option uses many more instructions * but runs much faster when the destination is much slower than * the CPU and at least 1 level of write buffer is availible (2 * is much better). Defined currently for SPARC and MIPS. * * FAST_CONSTANT_OFFSET_MODE - (cfb and mfb) * This define is used on machines which have no auto-increment * addressing mode, but do have an effectively free constant-offset * addressing mode. Currently defined for MIPS and SPARC, even though * I remember the cg6 as performing better without it (cg3 definitely * performs better with it). * * LARGE_INSTRUCTION_CACHE - * This define increases the number of times some loops are * unrolled. On 68020 machines (with 256 bytes of i-cache), * this define will slow execution down as instructions miss * the cache frequently. On machines with real i-caches, this * reduces loop overhead, causing a slight performance improvement. * Currently defined for MIPS and SPARC * * FAST_UNALIGNED_READS - * For machines with more memory bandwidth than CPU, this * define uses unaligned reads for 8-bit BitBLT instead of doing * aligned reads and combining the results with shifts and * logical-ors. Currently defined for 68020 and vax. * PLENTIFUL_REGISTERS - * For machines with > 20 registers. Currently used for * unrolling the text painting code a bit more. Currently * defined for MIPS. * SHARED_IDCACHE - * For non-Harvard RISC machines, those which share the same * CPU memory bus for instructions and data. This unrolls some * solid fill loops which are otherwise best left rolled up. * Currently defined for SPARC. */ #ifdef vax #define IMAGE_BYTE_ORDER LSBFirst /* Values for the VAX only */ #define BITMAP_BIT_ORDER LSBFirst #define GLYPHPADBYTES 1 #define GETLEFTBITS_ALIGNMENT 4 #define FAST_UNALIGNED_READS #endif /* vax */ #if (defined(Lynx) && defined(__powerpc__)) /* For now this is for Xvfb only */ #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #define LARGE_INSTRUCTION_CACHE #define FAST_CONSTANT_OFFSET_MODE #define PLENTIFUL_REGISTERS #define AVOID_MEMORY_READ #define FAST_MEMCPY #endif /* LynxOS PowerPC */ #if (defined(sun) && !(defined(i386) && defined(SVR4))) || \ (defined(AMOEBA) && (defined(sparc) || defined(mc68000))) || \ (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \ (defined(Lynx) && defined(__sparc__)) || \ ((defined(__NetBSD__) || defined(__OpenBSD__)) && \ (defined(__sparc__) || defined(__mc68000__))) #if defined(sun386) || defined(sun5) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */ # define BITMAP_BIT_ORDER LSBFirst #else # define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */ # define BITMAP_BIT_ORDER MSBFirst #endif #ifdef sparc # define AVOID_MEMORY_READ # define LARGE_INSTRUCTION_CACHE # define FAST_CONSTANT_OFFSET_MODE # define SHARED_IDCACHE #endif #ifdef mc68020 #define FAST_UNALIGNED_READS #endif #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #endif /* sun && !(i386 && SVR4) */ #if defined(AIXV3) #define IMAGE_BYTE_ORDER MSBFirst /* Values for the RISC/6000 */ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #define LARGE_INSTRUCTION_CACHE #define FAST_CONSTANT_OFFSET_MODE #define PLENTIFUL_REGISTERS #define AVOID_MEMORY_READ #define FAST_MEMCPY #endif /* AIXV3 */ #if defined(ibm032) || defined (ibm) #ifdef i386 # define IMAGE_BYTE_ORDER LSBFirst /* Value for PS/2 only */ #else # define IMAGE_BYTE_ORDER MSBFirst /* Values for the RT only*/ #endif #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 1 #define GETLEFTBITS_ALIGNMENT 4 /* ibm pcc doesn't understand pragmas. */ #ifdef i386 #define BITMAP_SCANLINE_UNIT 8 #endif #endif /* ibm */ #ifdef hpux #define IMAGE_BYTE_ORDER MSBFirst /* Values for the HP only */ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 2 /* to match product server */ #define GETLEFTBITS_ALIGNMENT 4 /* PA forces longs to 4 */ /* byte boundries */ #define AVOID_MEMORY_READ #define FAST_CONSTANT_OFFSET_MODE #define LARGE_INSTRUCTION_CACHE #define PLENTIFUL_REGISTERS #endif /* hpux */ #if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330) #define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #define FAST_UNALIGNED_READS #endif /* tektronix */ #ifdef macII #define IMAGE_BYTE_ORDER MSBFirst /* Values for the MacII only */ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 /* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */ #endif /* macII */ #if (defined(mips) || defined(__mips)) && !defined(sgi) #if defined(MIPSEL) || defined(__MIPSEL__) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */ # define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 # define GETLEFTBITS_ALIGNMENT 1 #else # define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */ # define BITMAP_BIT_ORDER MSBFirst # define GLYPHPADBYTES 4 # define GETLEFTBITS_ALIGNMENT 1 #endif #define AVOID_MEMORY_READ #define FAST_CONSTANT_OFFSET_MODE #define LARGE_INSTRUCTION_CACHE #define PLENTIFUL_REGISTERS #endif /* mips */ #if defined(__alpha) || defined(__alpha__) || defined(__alphaCross) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */ # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) # define BITMAP_BIT_ORDER MSBFirst # else # define BITMAP_BIT_ORDER LSBFirst # endif # if defined(XF86MONOVGA) || defined(XF86VGA16) # define BITMAP_SCANLINE_UNIT 8 # else /* pad scanline to a longword */ # define BITMAP_SCANLINE_UNIT 64 # endif # define BITMAP_SCANLINE_PAD 64 # define LOG2_BITMAP_PAD 6 # define LOG2_BYTES_PER_SCANLINE_PAD 3 # define GLYPHPADBYTES 4 # define GETLEFTBITS_ALIGNMENT 1 # define FAST_CONSTANT_OFFSET_MODE # define LARGE_INSTRUCTION_CACHE # define PLENTIFUL_REGISTERS /* Add for handling protocol XPutImage and XGetImage; see comment below */ #define INTERNAL_VS_EXTERNAL_PADDING #define BITMAP_SCANLINE_UNIT_PROTO 32 #define BITMAP_SCANLINE_PAD_PROTO 32 #define LOG2_BITMAP_PAD_PROTO 5 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2 #endif /* alpha */ #ifdef stellar #define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 4 #define IMAGE_BUFSIZE (64*1024) /* * Use SysV random number generator. */ #define random rand #endif /* stellar */ #ifdef luna #define IMAGE_BYTE_ORDER MSBFirst /* Values for the OMRON only*/ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #ifndef mc68000 #define FAST_CONSTANT_OFFSET_MODE #define AVOID_MEMORY_READ #define LARGE_INSTRUCTION_CACHE #define PLENTIFUL_REGISTERS #endif #endif /* luna */ #if ((defined(__s390__) || defined(__s390x__)) && defined(linux)) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #endif /* (__s390__ || __s390x__) && linux */ #if (defined(i386) && (defined(SVR4) || defined(SYSV) || (defined(sun) && defined(SVR4))) || defined(__bsdi__) || (defined(__NetBSD__) && defined(__i386__)) || (defined(__OpenBSD__) && defined(__i386__)) || defined(__FreeBSD__) || defined(MACH386) || (defined(linux) && !defined(__mc68000__)) || (defined(AMOEBA) && defined(i80386)) || defined(MINIX) || defined(__EMX__) || (defined(Lynx) && defined(__i386__))) #ifndef IMAGE_BYTE_ORDER #define IMAGE_BYTE_ORDER LSBFirst #endif #ifndef BITMAP_BIT_ORDER # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) # define BITMAP_BIT_ORDER MSBFirst # else # define BITMAP_BIT_ORDER LSBFirst # endif #endif #ifndef BITMAP_SCANLINE_UNIT # if defined(XF86MONOVGA) || defined(XF86VGA16) # define BITMAP_SCANLINE_UNIT 8 # endif #endif #ifndef GLYPHPADBYTES #define GLYPHPADBYTES 4 #endif #define GETLEFTBITS_ALIGNMENT 1 #define AVOID_MEMORY_READ #ifdef XSVGA #define AVOID_GLYPHBLT #define FAST_CONSTANT_OFFSET_MODE #define FAST_MEMCPY #define NO_ONE_RECT #endif /* Values for AMD Opteron and Intel 64 bit extensions. Copied from Alpha. */ #ifdef __x86_64__ # define BITMAP_SCANLINE_UNIT 64 # define BITMAP_SCANLINE_PAD 64 # define LOG2_BITMAP_PAD 6 # define LOG2_BYTES_PER_SCANLINE_PAD 3 /* Add for handling protocol XPutImage and XGetImage; see comment in * Alpha section. */ #define INTERNAL_VS_EXTERNAL_PADDING #define BITMAP_SCANLINE_UNIT_PROTO 32 #define BITMAP_SCANLINE_PAD_PROTO 32 #define LOG2_BITMAP_PAD_PROTO 5 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2 #endif #endif /* SVR4 / BSD / i386 */ #if defined (linux) && defined (__mc68000__) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define FAST_UNALIGNED_READS #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #endif /* linux/m68k */ #if defined (linux) && defined(__powerpc__) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #define LARGE_INSTRUCTION_CACHE #define FAST_CONSTANT_OFFSET_MODE #define PLENTIFUL_REGISTERS #define AVOID_MEMORY_READ #define FAST_MEMCPY #endif /* Linux/PPC */ #if defined(__MACH__) && defined(__POWERPC__) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 #define GETLEFTBITS_ALIGNMENT 1 #define LARGE_INSTRUCTION_CACHE #define FAST_CONSTANT_OFFSET_MODE #define PLENTIFUL_REGISTERS #define AVOID_MEMORY_READ #define FAST_MEMCPY #endif /* MACH/PPC */ #ifdef sgi #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #if (_MIPS_SZLONG == 64) # define GLYPHPADBYTES 4 # define GETLEFTBITS_ALIGNMENT 1 /* pad scanline to a longword */ #define BITMAP_SCANLINE_UNIT 64 #define BITMAP_SCANLINE_PAD 64 #define LOG2_BITMAP_PAD 6 #define LOG2_BYTES_PER_SCANLINE_PAD 3 /* Add for handling protocol XPutImage and XGetImage; see comment below */ #define INTERNAL_VS_EXTERNAL_PADDING #define BITMAP_SCANLINE_UNIT_PROTO 32 #define BITMAP_SCANLINE_PAD_PROTO 32 #define LOG2_BITMAP_PAD_PROTO 5 #define LOG2_BYTES_PER_SCANLINE_PAD_PROTO 2 #else #define GLYPHPADBYTES 2 #define GETLEFTBITS_ALIGNMENT 4 #endif #define AVOID_MEMORY_READ #define FAST_CONSTANT_OFFSET_MODE #define LARGE_INSTRUCTION_CACHE #define PLENTIFUL_REGISTERS #endif /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives * you) used and the number of times the ddx routine has to be called. * * for a 1024 x 864 bit monochrome screen with a 32 bit word we get * 8192/4 words per buffer * (1024/32) = 32 words per scanline * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen */ #ifndef IMAGE_BUFSIZE #define IMAGE_BUFSIZE 8192 #endif /* pad scanline to a longword */ #ifndef BITMAP_SCANLINE_UNIT #define BITMAP_SCANLINE_UNIT 32 #endif #ifndef BITMAP_SCANLINE_PAD #define BITMAP_SCANLINE_PAD 32 #define LOG2_BITMAP_PAD 5 #define LOG2_BYTES_PER_SCANLINE_PAD 2 #endif /* * This returns the number of padding units, for depth d and width w. * For bitmaps this can be calculated with the macros above. * Other depths require either grovelling over the formats field of the * screenInfo or hardwired constants. */ typedef struct _PaddingInfo { int padRoundUp; /* pixels per pad unit - 1 */ int padPixelsLog2; /* log 2 (pixels per pad unit) */ int padBytesLog2; /* log 2 (bytes per pad unit) */ int notPower2; /* bitsPerPixel not a power of 2 */ int bytesPerPixel; /* only set when notPower2 is TRUE */ } PaddingInfo; extern PaddingInfo PixmapWidthPaddingInfo[]; #define PixmapWidthInPadUnits(w, d) \ (PixmapWidthPaddingInfo[d].notPower2 ? \ (((int)(w) * PixmapWidthPaddingInfo[d].bytesPerPixel + \ PixmapWidthPaddingInfo[d].bytesPerPixel) >> \ PixmapWidthPaddingInfo[d].padBytesLog2) : \ ((int)((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \ PixmapWidthPaddingInfo[d].padPixelsLog2)) /* * Return the number of bytes to which a scanline of the given * depth and width will be padded. */ #define PixmapBytePad(w, d) \ (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2) #define BitmapBytePad(w) \ (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD) #ifdef INTERNAL_VS_EXTERNAL_PADDING /* This is defined if the server's internal padding is different from the padding * advertised in the protocol. The protocol does not allow for padding to * 64 bits, for example, so if the server wants to use 64 bit padding internally, * it has to advertise 32 bit padding and do padding fixups whenever images * cross the wire. (See ProcGetImage and ProcPutImage.) * * The macros and constants that end in Proto or PROTO refer to the advertised * padding, and the ones without Proto are for internal padding. */ extern PaddingInfo PixmapWidthPaddingInfoProto[]; #define PixmapWidthInPadUnitsProto(w, d) \ (PixmapWidthPaddingInfoProto[d].notPower2 ? \ (((int)(w) * PixmapWidthPaddingInfoProto[d].bytesPerPixel + \ PixmapWidthPaddingInfoProto[d].bytesPerPixel) >> \ PixmapWidthPaddingInfoProto[d].padBytesLog2) : \ ((int)((w) + PixmapWidthPaddingInfoProto[d].padRoundUp) >> \ PixmapWidthPaddingInfoProto[d].padPixelsLog2)) #define PixmapBytePadProto(w, d) \ (PixmapWidthInPadUnitsProto(w, d) << \ PixmapWidthPaddingInfoProto[d].padBytesLog2) #define BitmapBytePadProto(w) \ ((((w) + BITMAP_SCANLINE_PAD_PROTO - 1) >> LOG2_BITMAP_PAD_PROTO) \ << LOG2_BYTES_PER_SCANLINE_PAD_PROTO) #else /* protocol and internal padding is the same */ #define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d) #define PixmapBytePadProto(w, d) PixmapBytePad(w, d) #define BitmapBytePadProto(w) BitmapBytePad(w) #endif /* protocol vs. internal padding */ #endif /* SERVERMD_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/resource.h0100664000076400007640000001664207120677563022347 0ustar constconst/* $XConsortium: resource.h /main/23 1996/10/30 11:18:23 rws $ */ /*********************************************************** Copyright (c) 1987, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef RESOURCE_H #define RESOURCE_H 1 #include "misc.h" /***************************************************************** * STUFF FOR RESOURCES *****************************************************************/ /* classes for Resource routines */ typedef unsigned long RESTYPE; #define RC_VANILLA ((RESTYPE)0) #define RC_CACHED ((RESTYPE)1<<31) #define RC_DRAWABLE ((RESTYPE)1<<30) /* Use class RC_NEVERRETAIN for resources that should not be retained * regardless of the close down mode when the client dies. (A client's * event selections on objects that it doesn't own are good candidates.) * Extensions can use this too! */ #define RC_NEVERRETAIN ((RESTYPE)1<<29) #define RC_LASTPREDEF RC_NEVERRETAIN #define RC_ANY (~(RESTYPE)0) /* types for Resource routines */ #define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE) #define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE) #define RT_GC ((RESTYPE)3|RC_CACHED) #define RT_FONT ((RESTYPE)4) #define RT_CURSOR ((RESTYPE)5) #define RT_COLORMAP ((RESTYPE)6) #define RT_CMAPENTRY ((RESTYPE)7) #define RT_OTHERCLIENT ((RESTYPE)8|RC_NEVERRETAIN) #define RT_PASSIVEGRAB ((RESTYPE)9|RC_NEVERRETAIN) #define RT_LASTPREDEF ((RESTYPE)9) #define RT_NONE ((RESTYPE)0) /* bits and fields within a resource id */ #define CLIENTOFFSET 22 /* client field */ #define RESOURCE_ID_MASK 0x3FFFFF /* low 22 bits */ #define CLIENT_BITS(id) ((id) & 0x1fc00000) /* hi 7 bits */ #define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET)) #define SERVER_BIT 0x20000000 /* use illegal bit */ #ifdef INVALID #undef INVALID /* needed on HP/UX */ #endif /* Invalid resource id */ #define INVALID (0) #define BAD_RESOURCE 0xe0000000 typedef int (*DeleteType)( #if NeedNestedPrototypes pointer /*value*/, XID /*id*/ #endif ); typedef void (*FindResType)( #if NeedNestedPrototypes pointer /*value*/, XID /*id*/, pointer /*cdata*/ #endif ); extern RESTYPE CreateNewResourceType( #if NeedFunctionPrototypes DeleteType /*deleteFunc*/ #endif ); extern RESTYPE CreateNewResourceClass( #if NeedFunctionPrototypes void #endif ); extern Bool InitClientResources( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern XID FakeClientID( #if NeedFunctionPrototypes int /*client*/ #endif ); extern Bool AddResource( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*type*/, pointer /*value*/ #endif ); extern void FreeResource( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*skipDeleteFuncType*/ #endif ); extern void FreeResourceByType( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*type*/, Bool /*skipFree*/ #endif ); extern Bool ChangeResourceValue( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*rtype*/, pointer /*value*/ #endif ); extern void FindClientResourcesByType( #if NeedFunctionPrototypes ClientPtr /*client*/, RESTYPE /*type*/, FindResType /*func*/, pointer /*cdata*/ #endif ); extern void FreeClientNeverRetainResources( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void FreeClientResources( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void FreeAllResources( #if NeedFunctionPrototypes void #endif ); extern Bool LegalNewID( #if NeedFunctionPrototypes XID /*id*/, ClientPtr /*client*/ #endif ); extern pointer LookupIDByType( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*rtype*/ #endif ); extern pointer LookupIDByClass( #if NeedFunctionPrototypes XID /*id*/, RESTYPE /*classes*/ #endif ); /* These are the access modes that can be passed in the last parameter * to SecurityLookupIDByType/Class. The Security extension doesn't * currently make much use of these; they're mainly provided as an * example of what you might need for discretionary access control. * You can or these values together to indicate multiple modes * simultaneously. */ #define SecurityUnknownAccess 0 /* don't know intentions */ #define SecurityReadAccess (1<<0) /* inspecting the object */ #define SecurityWriteAccess (1<<1) /* changing the object */ #define SecurityDestroyAccess (1<<2) /* destroying the object */ #ifdef XCSECURITY extern pointer SecurityLookupIDByType( #if NeedFunctionPrototypes ClientPtr /*client*/, XID /*id*/, RESTYPE /*rtype*/, Mask /*access_mode*/ #endif ); extern pointer SecurityLookupIDByClass( #if NeedFunctionPrototypes ClientPtr /*client*/, XID /*id*/, RESTYPE /*classes*/, Mask /*access_mode*/ #endif ); #else /* not XCSECURITY */ #define SecurityLookupIDByType(client, id, rtype, access_mode) \ LookupIDByType(id, rtype) #define SecurityLookupIDByClass(client, id, classes, access_mode) \ LookupIDByClass(id, classes) #endif /* XCSECURITY */ extern void GetXIDRange( #if NeedFunctionPrototypes int /*client*/, Bool /*server*/, XID * /*minp*/, XID * /*maxp*/ #endif ); extern unsigned int GetXIDList( #if NeedFunctionPrototypes ClientPtr /*client*/, unsigned int /*count*/, XID * /*pids*/ #endif ); #endif /* RESOURCE_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/validate.h0100664000076400007640000000322207120677563022277 0ustar constconst/* $XConsortium: validate.h,v 5.4 94/04/17 20:26:11 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef VALIDATE_H #define VALIDATE_H #include "miscstruct.h" #include "regionstr.h" typedef enum { VTOther, VTStack, VTMove, VTUnmap, VTMap } VTKind; /* union _Validate is now device dependent; see mivalidate.h for an example */ typedef union _Validate *ValidatePtr; #define UnmapValData ((ValidatePtr)1) #endif /* VALIDATE_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dixstruct.h0100664000076400007640000001320607120677563022542 0ustar constconst/*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: dixstruct.h /main/43 1996/12/15 21:25:06 rws $ */ /* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.8 1996/12/24 02:27:28 dawes Exp $ */ #ifndef DIXSTRUCT_H #define DIXSTRUCT_H #include "dix.h" #include "resource.h" #include "cursor.h" #include "gc.h" #include "pixmap.h" #include /* * direct-mapped hash table, used by resource manager to store * translation from client ids to server addresses. */ #ifdef DEBUG #define MAX_REQUEST_LOG 100 #endif extern CallbackListPtr ClientStateCallback; typedef struct { ClientPtr client; xConnSetupPrefix *prefix; xConnSetup *setup; } NewClientInfoRec; typedef void (*ReplySwapPtr) ( #if NeedNestedPrototypes ClientPtr /* pClient */, int /* size */, void * /* pbuf */ #endif ); extern void ReplyNotSwappd ( #if NeedNestedPrototypes ClientPtr /* pClient */, int /* size */, void * /* pbuf */ #endif ); typedef enum {ClientStateInitial, ClientStateAuthenticating, ClientStateRunning, ClientStateRetained, ClientStateGone, ClientStateCheckingSecurity, ClientStateCheckedSecurity} ClientState; typedef struct _Client { int index; Mask clientAsMask; pointer requestBuffer; pointer osPrivate; /* for OS layer, including scheduler */ Bool swapped; ReplySwapPtr pSwapReplyFunc; XID errorValue; int sequence; int closeDownMode; int clientGone; int noClientException; /* this client died or needs to be * killed */ DrawablePtr lastDrawable; Drawable lastDrawableID; GCPtr lastGC; GContext lastGCID; pointer *saveSet; int numSaved; pointer screenPrivate[MAXSCREENS]; int (**requestVector) ( #if NeedNestedPrototypes ClientPtr /* pClient */ #endif ); CARD32 req_len; /* length of current request */ Bool big_requests; /* supports large requests */ int priority; ClientState clientState; DevUnion *devPrivates; #ifdef XKB unsigned short xkbClientFlags; unsigned short mapNotifyMask; unsigned short newKeyboardNotifyMask; unsigned short vMajor,vMinor; KeyCode minKC,maxKC; #endif #ifdef DEBUG unsigned char requestLog[MAX_REQUEST_LOG]; int requestLogIndex; #endif #ifdef LBX int (*readRequest)( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); #endif unsigned long replyBytesRemaining; #ifdef XCSECURITY XID authId; unsigned int trustLevel; pointer (* CheckAccess)( #if NeedNestedPrototypes ClientPtr /*pClient*/, XID /*id*/, RESTYPE /*classes*/, Mask /*access_mode*/, pointer /*resourceval*/ #endif ); #endif #ifdef XAPPGROUP struct _AppGroupRec* appgroup; #endif struct _FontResolution * (*fontResFunc) ( /* no need for font.h */ #if NeedNestedPrototypes ClientPtr /* pClient */, int * /* num */ #endif ); } ClientRec; /* This prototype is used pervasively in Xext, dix */ #if NeedFunctionPrototypes #define DISPATCH_PROC(func) int func(ClientPtr /* client */) #else #define DISPATCH_PROC(func) int func(/* ClientPtr client */) #endif typedef struct _WorkQueue { struct _WorkQueue *next; Bool (*function) ( #if NeedNestedPrototypes ClientPtr /* pClient */, pointer /* closure */ #endif ); ClientPtr client; pointer closure; } WorkQueueRec; extern TimeStamp currentTime; extern TimeStamp lastDeviceEventTime; extern int CompareTimeStamps( #if NeedFunctionPrototypes TimeStamp /*a*/, TimeStamp /*b*/ #endif ); extern TimeStamp ClientTimeToServerTime( #if NeedFunctionPrototypes CARD32 /*c*/ #endif ); typedef struct _CallbackRec { CallbackProcPtr proc; pointer data; Bool deleted; struct _CallbackRec *next; } CallbackRec, *CallbackPtr; typedef struct _CallbackList { CallbackFuncsRec funcs; int inCallback; Bool deleted; int numDeleted; CallbackPtr list; } CallbackListRec; /* proc vectors */ extern int (* InitialVector[3]) ( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); extern int (* ProcVector[256]) ( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); extern int (* SwappedProcVector[256]) ( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); #ifdef K5AUTH extern int (*k5_Vector[256])() = #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); #endif extern void (* ReplySwapVector[256]) (); extern int ProcBadRequest( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); #endif /* DIXSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/screenint.h0100664000076400007640000001064207120677563022504 0ustar constconst/* $XConsortium: screenint.h /main/6 1996/06/17 10:55:15 mor $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.2 1997/01/14 22:22:40 dawes Exp $ */ #ifndef SCREENINT_H #define SCREENINT_H #include "misc.h" typedef struct _PixmapFormat *PixmapFormatPtr; typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; extern void ResetScreenPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateScreenPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern void ResetWindowPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateWindowPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocateWindowPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); extern void ResetGCPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateGCPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocateGCPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); extern int AddScreen( #if NeedFunctionPrototypes Bool (* /*pfnInit*/)( #if NeedNestedPrototypes int /*index*/, ScreenPtr /*pScreen*/, int /*argc*/, char ** /*argv*/ #endif ), int /*argc*/, char** /*argv*/ #endif ); #ifdef PIXPRIV extern void ResetPixmapPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocatePixmapPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocatePixmapPrivate( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* index */, unsigned /* amount */ #endif ); #endif /* PIXPRIV */ extern void ResetColormapPrivates( #if NeedFunctionPrototypes void #endif ); typedef struct _ColormapRec *ColormapPtr; typedef int (*InitCmapPrivFunc)( #if NeedNestedPrototypes ColormapPtr #endif ); extern int AllocateColormapPrivateIndex( #if NeedFunctionPrototypes InitCmapPrivFunc /* initPrivFunc */ #endif ); #endif /* SCREENINT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/propertyst.h0100664000076400007640000000645207120677563022751 0ustar constconst/* $XConsortium: propertyst.h,v 1.5 94/04/17 20:25:56 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.0 1994/12/25 12:36:44 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PROPERTYSTRUCT_H #define PROPERTYSTRUCT_H #include "misc.h" #include "property.h" /* * PROPERTY -- property element */ typedef struct _Property { struct _Property *next; ATOM propertyName; ATOM type; /* ignored by server */ short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ pointer data; /* private to client */ #if defined(LBX) || defined(LBX_COMPAT) /* If space is at a premium and binary compatibility is not * an issue, you may want to put the owner_pid next to format * so that the two shorts pack together without padding. */ short owner_pid; /* proxy that has the data */ XID tag_id; #endif } PropertyRec; #endif /* PROPERTYSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/closestr.h0100664000076400007640000000767007120677563022357 0ustar constconst/* $XConsortium: closestr.h,v 1.10 95/05/19 19:18:55 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.0 1996/04/15 11:34:23 dawes Exp $ */ /* Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef CLOSESTR_H #define CLOSESTR_H #define NEED_REPLIES #include "Xproto.h" #include "closure.h" #include "dix.h" #include "misc.h" #include "gcstruct.h" /* closure structures */ /* OpenFont */ typedef struct _OFclosure { ClientPtr client; short current_fpe; short num_fpes; FontPathElementPtr *fpe_list; Mask flags; Bool slept; /* XXX -- get these from request buffer instead? */ char *origFontName; int origFontNameLen; XID fontid; char *fontname; int fnamelen; FontPtr non_cachable_font; } OFclosureRec; /* ListFontsWithInfo */ typedef struct _LFWIstate { char pattern[256]; /* max len of font name */ int patlen; int current_fpe; int max_names; Bool list_started; pointer private; } LFWIstateRec, *LFWIstatePtr; typedef struct _LFWIclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; xListFontsWithInfoReply *reply; int length; LFWIstateRec current; LFWIstateRec saved; int savedNumFonts; Bool haveSaved; Bool slept; char *savedName; } LFWIclosureRec; /* ListFonts */ typedef struct _LFclosure { ClientPtr client; int num_fpes; FontPathElementPtr *fpe_list; FontNamesPtr names; LFWIstateRec current; LFWIstateRec saved; Bool haveSaved; Bool slept; char *savedName; int savedNameLen; } LFclosureRec; /* PolyText */ typedef int (* PolyTextPtr)( #if NeedNestedPrototypes DrawablePtr /* pDraw */, GCPtr /* pGC */, int /* x */, int /* y */, int /* count */, void * /* chars or shorts */ #endif ); typedef struct _PTclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; unsigned char *pElt; unsigned char *endReq; unsigned char *data; int xorg; int yorg; CARD8 reqType; PolyTextPtr polyText; int itemSize; XID did; int err; Bool slept; } PTclosureRec; /* ImageText */ typedef void (* ImageTextPtr)( #if NeedNestedPrototypes DrawablePtr /* pDraw */, GCPtr /* pGC */, int /* x */, int /* y */, int /* count */, void * /* chars or shorts */ #endif ); typedef struct _ITclosure { ClientPtr client; DrawablePtr pDraw; GC *pGC; BYTE nChars; unsigned char *data; int xorg; int yorg; CARD8 reqType; ImageTextPtr imageText; int itemSize; XID did; Bool slept; } ITclosureRec; #endif /* CLOSESTR_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/gcstruct.h0100664000076400007640000002120407120677563022344 0ustar constconst/* $XConsortium: gcstruct.h,v 5.10 94/04/17 20:25:45 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef GCSTRUCT_H #define GCSTRUCT_H #include "gc.h" #include "miscstruct.h" #include "region.h" #include "pixmap.h" #include "screenint.h" #include "Xprotostr.h" /* * functions which modify the state of the GC */ typedef struct _GCFuncs { void (* ValidateGC)( #if NeedNestedPrototypes GCPtr /*pGC*/, unsigned long /*stateChanges*/, DrawablePtr /*pDrawable*/ #endif ); void (* ChangeGC)( #if NeedNestedPrototypes GCPtr /*pGC*/, unsigned long /*mask*/ #endif ); void (* CopyGC)( #if NeedNestedPrototypes GCPtr /*pGCSrc*/, unsigned long /*mask*/, GCPtr /*pGCDst*/ #endif ); void (* DestroyGC)( #if NeedNestedPrototypes GCPtr /*pGC*/ #endif ); void (* ChangeClip)( #if NeedNestedPrototypes GCPtr /*pGC*/, int /*type*/, pointer /*pvalue*/, int /*nrects*/ #endif ); void (* DestroyClip)( #if NeedNestedPrototypes GCPtr /*pGC*/ #endif ); void (* CopyClip)( #if NeedNestedPrototypes GCPtr /*pgcDst*/, GCPtr /*pgcSrc*/ #endif ); DevUnion devPrivate; } GCFuncs; /* * graphics operations invoked through a GC */ typedef struct _GCOps { void (* FillSpans)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); void (* SetSpans)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, char * /*psrc*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, int /*fSorted*/ #endif ); void (* PutImage)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pBits*/ #endif ); RegionPtr (* CopyArea)( #if NeedNestedPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*w*/, int /*h*/, int /*dstx*/, int /*dsty*/ #endif ); RegionPtr (* CopyPlane)( #if NeedNestedPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ #endif ); void (* PolyPoint)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); void (* Polylines)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); void (* PolySegment)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegs*/ #endif ); void (* PolyRectangle)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrects*/, xRectangle * /*pRects*/ #endif ); void (* PolyArc)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); void (* FillPolygon)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*pPts*/ #endif ); void (* PolyFillRect)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ #endif ); void (* PolyFillArc)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); int (* PolyText8)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ #endif ); int (* PolyText16)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ #endif ); void (* ImageText8)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ #endif ); void (* ImageText16)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ #endif ); void (* ImageGlyphBlt)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); void (* PolyGlyphBlt)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); void (* PushPixels)( #if NeedNestedPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDst*/, int /*w*/, int /*h*/, int /*x*/, int /*y*/ #endif ); #ifdef NEED_LINEHELPER void (* LineHelper)(); #endif DevUnion devPrivate; } GCOps; /* there is padding in the bit fields because the Sun compiler doesn't * force alignment to 32-bit boundaries. losers. */ typedef struct _GC { ScreenPtr pScreen; unsigned char depth; unsigned char alu; unsigned short lineWidth; unsigned short dashOffset; unsigned short numInDashList; unsigned char *dash; unsigned int lineStyle : 2; unsigned int capStyle : 2; unsigned int joinStyle : 2; unsigned int fillStyle : 2; unsigned int fillRule : 1; unsigned int arcMode : 1; unsigned int subWindowMode : 1; unsigned int graphicsExposures : 1; unsigned int clientClipType : 2; /* CT_ */ unsigned int miTranslate:1; /* should mi things translate? */ unsigned int tileIsPixel:1; /* tile is solid pixel */ unsigned int unused:16; /* see comment above */ unsigned long planemask; unsigned long fgPixel; unsigned long bgPixel; /* * alas -- both tile and stipple must be here as they * are independently specifiable */ PixUnion tile; PixmapPtr stipple; DDXPointRec patOrg; /* origin for (tile, stipple) */ struct _Font *font; DDXPointRec clipOrg; DDXPointRec lastWinOrg; /* position of window last validated */ pointer clientClip; unsigned long stateChanges; /* masked with GC_ */ unsigned long serialNumber; GCFuncs *funcs; GCOps *ops; DevUnion *devPrivates; } GC; #endif /* GCSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/input.h0100664000076400007640000002730207120677563021652 0ustar constconst/* $XConsortium: input.h /main/22 1996/09/25 00:50:39 dpw $ */ /* $XFree86: xc/programs/Xserver/include/input.h,v 3.4 1996/12/23 07:09:28 dawes Exp $ */ /************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef INPUT_H #define INPUT_H #include "misc.h" #include "screenint.h" #include "X11/Xmd.h" #include "X11/Xproto.h" #include "window.h" /* for WindowPtr */ #define DEVICE_INIT 0 #define DEVICE_ON 1 #define DEVICE_OFF 2 #define DEVICE_CLOSE 3 #define MAP_LENGTH 256 #define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */ #define NullGrab ((GrabPtr)NULL) #define PointerRootWin ((WindowPtr)PointerRoot) #define NoneWin ((WindowPtr)None) #define NullDevice ((DevicePtr)NULL) #ifndef FollowKeyboard #define FollowKeyboard 3 #endif #ifndef FollowKeyboardWin #define FollowKeyboardWin ((WindowPtr) FollowKeyboard) #endif #ifndef RevertToFollowKeyboard #define RevertToFollowKeyboard 3 #endif typedef unsigned long Leds; typedef struct _OtherClients *OtherClientsPtr; typedef struct _InputClients *InputClientsPtr; typedef struct _DeviceIntRec *DeviceIntPtr; typedef int (*DeviceProc)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, int /*what*/ #endif ); typedef void (*ProcessInputProc)( #if NeedNestedPrototypes xEventPtr /*events*/, DeviceIntPtr /*device*/, int /*count*/ #endif ); typedef struct _DeviceRec { pointer devicePrivate; ProcessInputProc processInputProc; /* current */ ProcessInputProc realInputProc; /* deliver */ ProcessInputProc enqueueInputProc; /* enqueue */ Bool on; /* used by DDX to keep state */ } DeviceRec, *DevicePtr; typedef struct { int click, bell, bell_pitch, bell_duration; Bool autoRepeat; unsigned char autoRepeats[32]; Leds leds; unsigned char id; } KeybdCtrl; typedef struct { KeySym *map; KeyCode minKeyCode, maxKeyCode; int mapWidth; } KeySymsRec, *KeySymsPtr; typedef struct { int num, den, threshold; unsigned char id; } PtrCtrl; typedef struct { int resolution, min_value, max_value; int integer_displayed; unsigned char id; } IntegerCtrl; typedef struct { int max_symbols, num_symbols_supported; int num_symbols_displayed; KeySym *symbols_supported; KeySym *symbols_displayed; unsigned char id; } StringCtrl; typedef struct { int percent, pitch, duration; unsigned char id; } BellCtrl; typedef struct { Leds led_values; Mask led_mask; unsigned char id; } LedCtrl; extern KeybdCtrl defaultKeyboardControl; extern PtrCtrl defaultPointerControl; #undef AddInputDevice extern DevicePtr AddInputDevice( #if NeedFunctionPrototypes DeviceProc /*deviceProc*/, Bool /*autoStart*/ #endif ); #define AddInputDevice(deviceProc, autoStart) \ _AddInputDevice(deviceProc, autoStart) extern DeviceIntPtr _AddInputDevice( #if NeedFunctionPrototypes DeviceProc /*deviceProc*/, Bool /*autoStart*/ #endif ); extern Bool EnableDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern Bool DisableDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern int InitAndStartDevices( #if NeedFunctionPrototypes void #endif ); extern void CloseDownDevices( #if NeedFunctionPrototypes void #endif ); extern void RemoveDevice( #if NeedFunctionPrototypes DeviceIntPtr /*dev*/ #endif ); extern int NumMotionEvents( #if NeedFunctionPrototypes void #endif ); #undef RegisterPointerDevice extern void RegisterPointerDevice( #if NeedFunctionPrototypes DevicePtr /*device*/ #endif ); #define RegisterPointerDevice(device) \ _RegisterPointerDevice(device) extern void _RegisterPointerDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); #undef RegisterKeyboardDevice extern void RegisterKeyboardDevice( #if NeedFunctionPrototypes DevicePtr /*device*/ #endif ); #define RegisterKeyboardDevice(device) \ _RegisterKeyboardDevice(device) extern void _RegisterKeyboardDevice( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); extern DevicePtr LookupKeyboardDevice( #if NeedFunctionPrototypes void #endif ); extern DevicePtr LookupPointerDevice( #if NeedFunctionPrototypes void #endif ); extern DevicePtr LookupDevice( #if NeedFunctionPrototypes int /* id */ #endif ); extern void QueryMinMaxKeyCodes( #if NeedFunctionPrototypes KeyCode* /*minCode*/, KeyCode* /*maxCode*/ #endif ); extern Bool SetKeySymsMap( #if NeedFunctionPrototypes KeySymsPtr /*dst*/, KeySymsPtr /*src*/ #endif ); extern Bool InitKeyClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[] #endif ); extern Bool InitButtonClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, int /*numButtons*/, CARD8* /*map*/ #endif ); typedef int (*ValuatorMotionProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*pdevice*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/ #endif ); extern Bool InitValuatorClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, int /*numAxes*/, ValuatorMotionProcPtr /* motionProc */, int /*numMotionEvents*/, int /*mode*/ #endif ); extern Bool InitFocusClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/ #endif ); typedef void (*BellProcPtr)( #if NeedNestedPrototypes int /*percent*/, DeviceIntPtr /*device*/, pointer /*ctrl*/, int #endif ); typedef void (*KbdCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, KeybdCtrl * /*ctrl*/ #endif ); extern Bool InitKbdFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/ #endif ); typedef void (*PtrCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, PtrCtrl * /*ctrl*/ #endif ); extern Bool InitPtrFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, PtrCtrlProcPtr /*controlProc*/ #endif ); typedef void (*StringCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, StringCtrl * /*ctrl*/ #endif ); extern Bool InitStringFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, StringCtrlProcPtr /*controlProc*/, int /*max_symbols*/, int /*num_symbols_supported*/, KeySym* /*symbols*/ #endif ); typedef void (*BellCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, BellCtrl * /*ctrl*/ #endif ); extern Bool InitBellFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, BellProcPtr /*bellProc*/, BellCtrlProcPtr /*controlProc*/ #endif ); typedef void (*LedCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, LedCtrl * /*ctrl*/ #endif ); extern Bool InitLedFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, LedCtrlProcPtr /*controlProc*/ #endif ); typedef void (*IntegerCtrlProcPtr)( #if NeedNestedPrototypes DeviceIntPtr /*device*/, IntegerCtrl * /*ctrl*/ #endif ); extern Bool InitIntegerFeedbackClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, IntegerCtrlProcPtr /*controlProc*/ #endif ); extern Bool InitPointerDeviceStruct( #if NeedFunctionPrototypes DevicePtr /*device*/, CARD8* /*map*/, int /*numButtons*/, ValuatorMotionProcPtr /*motionProc*/, PtrCtrlProcPtr /*controlProc*/, int /*numMotionEvents*/ #endif ); extern Bool InitKeyboardDeviceStruct( #if NeedFunctionPrototypes DevicePtr /*device*/, KeySymsPtr /*pKeySyms*/, CARD8 /*pModifiers*/[], BellProcPtr /*bellProc*/, KbdCtrlProcPtr /*controlProc*/ #endif ); extern void SendMappingNotify( #if NeedFunctionPrototypes unsigned int /*request*/, unsigned int /*firstKeyCode*/, unsigned int /*count*/, ClientPtr /* client */ #endif ); extern Bool BadDeviceMap( #if NeedFunctionPrototypes BYTE* /*buff*/, int /*length*/, unsigned /*low*/, unsigned /*high*/, XID* /*errval*/ #endif ); extern Bool AllModifierKeysAreUp( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, CARD8* /*map1*/, int /*per1*/, CARD8* /*map2*/, int /*per2*/ #endif ); extern void NoteLedState( #if NeedFunctionPrototypes DeviceIntPtr /*keybd*/, int /*led*/, Bool /*on*/ #endif ); extern void MaybeStopHint( #if NeedFunctionPrototypes DeviceIntPtr /*device*/, ClientPtr /*client*/ #endif ); extern void ProcessPointerEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/ #endif ); extern void ProcessKeyboardEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/ #endif ); #ifdef XKB extern void CoreProcessPointerEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*mouse*/, int /*count*/ #endif ); extern void CoreProcessKeyboardEvent( #if NeedFunctionPrototypes xEventPtr /*xE*/, DeviceIntPtr /*keybd*/, int /*count*/ #endif ); #endif extern Bool LegalModifier( #if NeedFunctionPrototypes unsigned int /*key*/, DevicePtr /*pDev*/ #endif ); extern void ProcessInputEvents( #if NeedFunctionPrototypes void #endif ); extern void InitInput( #if NeedFunctionPrototypes int /*argc*/, char ** /*argv*/ #endif ); #endif /* INPUT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/miscstruct.h0100664000076400007640000000566107120677563022717 0ustar constconst/* $XConsortium: miscstruct.h,v 5.5 94/04/17 20:25:50 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.0 1996/02/18 03:45:10 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 #include "misc.h" #include "X11/Xprotostr.h" typedef xPoint DDXPointRec; typedef struct _Box { short x1, y1, x2, y2; } BoxRec; typedef union _DevUnion { pointer ptr; long val; unsigned long uval; pointer (*fptr)( #if NeedFunctionPrototypes void #endif ); } DevUnion; #endif /* MISCSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/exevents.h0100664000076400007640000001542207120677563022354 0ustar constconst/* $XFree86: xc/programs/Xserver/include/exevents.h,v 3.1 1996/04/15 11:34:29 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /******************************************************************** * Interface of 'exevents.c' */ #ifndef EXEVENTS_H #define EXEVENTS_H void RegisterOtherDevice ( #if NeedFunctionPrototypes DeviceIntPtr /* device */ #endif ); void ProcessOtherEvent ( #if NeedFunctionPrototypes xEventPtr /* FIXME deviceKeyButtonPointer * xE */, DeviceIntPtr /* other */, int /* count */ #endif ); int InitProximityClassDeviceStruct( #if NeedFunctionPrototypes DeviceIntPtr /* dev */ #endif ); void InitValuatorAxisStruct( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, int /* axnum */, int /* minval */, int /* maxval */, int /* resolution */, int /* min_res */, int /* max_res */ #endif ); void DeviceFocusEvent( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, int /* type */, int /* mode */, int /* detail */, WindowPtr /* pWin */ #endif ); int GrabButton( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, BYTE /* this_device_mode */, BYTE /* other_devices_mode */, CARD16 /* modifiers */, DeviceIntPtr /* modifier_device */, CARD8 /* button */, Window /* grabWindow */, BOOL /* ownerEvents */, Cursor /* rcursor */, Window /* rconfineTo */, Mask /* eventMask */ #endif ); int GrabKey( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, BYTE /* this_device_mode */, BYTE /* other_devices_mode */, CARD16 /* modifiers */, DeviceIntPtr /* modifier_device */, CARD8 /* key */, Window /* grabWindow */, BOOL /* ownerEvents */, Mask /* mask */ #endif ); int SelectForWindow( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, Mask /* exclusivemasks */, Mask /* validmasks */ #endif ); int AddExtensionClient ( #if NeedFunctionPrototypes WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, int /* mskidx */ #endif ); void RecalculateDeviceDeliverableEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */ #endif ); int InputClientGone( #if NeedFunctionPrototypes WindowPtr /* pWin */, XID /* id */ #endif ); int SendEvent ( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* d */, Window /* dest */, Bool /* propagate */, xEvent * /* ev */, Mask /* mask */, int /* count */ #endif ); int SetButtonMapping ( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, int /* nElts */, BYTE * /* map */ #endif ); int SetModifierMapping( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, int /* len */, int /* rlen */, int /* numKeyPerModifier */, KeyCode * /* inputMap */, KeyClassPtr * /* k */ #endif ); void SendDeviceMappingNotify( #if NeedFunctionPrototypes CARD8 /* request, */, KeyCode /* firstKeyCode */, CARD8 /* count */, DeviceIntPtr /* dev */ #endif ); int ChangeKeyMapping( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, unsigned /* len */, int /* type */, KeyCode /* firstKeyCode */, CARD8 /* keyCodes */, CARD8 /* keySymsPerKeyCode */, KeySym * /* map */ #endif ); void DeleteWindowFromAnyExtEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */, Bool /* freeResources */ #endif ); void DeleteDeviceFromAnyExtEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */, DeviceIntPtr /* dev */ #endif ); int MaybeSendDeviceMotionNotifyHint ( #if NeedFunctionPrototypes deviceKeyButtonPointer * /* pEvents */, Mask /* mask */ #endif ); void CheckDeviceGrabAndHintWindow ( #if NeedFunctionPrototypes WindowPtr /* pWin */, int /* type */, deviceKeyButtonPointer * /* xE */, GrabPtr /* grab */, ClientPtr /* client */, Mask /* deliveryMask */ #endif ); Mask DeviceEventMaskForClient( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, WindowPtr /* pWin */, ClientPtr /* client */ #endif ); void MaybeStopDeviceHint( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, ClientPtr /* client */ #endif ); int DeviceEventSuppressForWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, ClientPtr /* client */, Mask /* mask */, int /* maskndx */ #endif ); #endif /* EXEVENTS_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dixgrabs.h0100664000076400007640000000413507120677563022315 0ustar constconst/* $XFree86: xc/programs/Xserver/include/dixgrabs.h,v 3.0 1996/04/15 11:34:27 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef DIXGRABS_H #define DIXGRABS_H 1 GrabPtr CreateGrab( #if NeedFunctionPrototypes int /* client */, DeviceIntPtr /* device */, WindowPtr /* window */, Mask /* eventMask */, Bool /* ownerEvents */, Bool /* keyboardMode */, Bool /* pointerMode */, DeviceIntPtr /* modDevice */, unsigned short /* modifiers */, int /* type */, KeyCode /* keybut */, WindowPtr /* confineTo */, CursorPtr /* cursor */ #endif ); int DeletePassiveGrab( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); Bool GrabMatchesSecond( #if NeedFunctionPrototypes GrabPtr /* pFirstGrab */, GrabPtr /* pSecondGrab */ #endif ); int AddPassiveGrabToList( #if NeedFunctionPrototypes GrabPtr /* pGrab */ #endif ); Bool DeletePassiveGrabFromList( #if NeedFunctionPrototypes GrabPtr /* pMinuendGrab */ #endif ); #endif /* DIXGRABS_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/site.h0100664000076400007640000001176207120677563021462 0ustar constconst/* $XConsortium: site.h /main/27 1996/12/09 17:52:19 kaleb $ */ /************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SITE_H #define SITE_H /* * The vendor string identifies the vendor responsible for the * server executable. */ #ifndef VENDOR_STRING #define VENDOR_STRING "X Consortium" #endif /* * The vendor release number identifies, for the purpose of submitting * traceable bug reports, the release number of software produced * by the vendor. */ #ifndef VENDOR_RELEASE #define VENDOR_RELEASE 6300 #endif /* * The following constants are provided solely as a last line of defense. The * normal build ALWAYS overrides them using a special rule given in * server/dix/Imakefile. If you want to change either of these constants, * you should set the DefaultFontPath or DefaultRGBDatabase configuration * parameters. * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! */ #ifndef COMPILEDDEFAULTFONTPATH #define COMPILEDDEFAULTFONTPATH "/usr/lib/X11/fonts/misc/" #endif #ifndef RGB_DB #define RGB_DB "/usr/lib/X11/rgb" #endif /* * The following constants contain default values for all of the variables * that can be initialized on the server command line or in the environment. */ #define COMPILEDDEFAULTFONT "fixed" #define COMPILEDCURSORFONT "cursor" #ifndef COMPILEDDISPLAYCLASS #define COMPILEDDISPLAYCLASS "MIT-unspecified" #endif #define DEFAULT_TIMEOUT 60 /* seconds */ #define DEFAULT_KEYBOARD_CLICK 0 #define DEFAULT_BELL 50 #define DEFAULT_BELL_PITCH 400 #define DEFAULT_BELL_DURATION 100 #ifdef XKB #define DEFAULT_AUTOREPEAT TRUE #else #define DEFAULT_AUTOREPEAT FALSE #endif #ifdef hpux #define DEFAULT_AUTOREPEATS {\ 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} #else #define DEFAULT_AUTOREPEATS {\ 0, 0, 0, 0, 0, 0, 0, 0,\ 0, 0, 0, 0, 0, 0, 0, 0,\ 0, 0, 0, 0, 0, 0, 0, 0,\ 0, 0, 0, 0, 0, 0, 0, 0 } #endif #define DEFAULT_LEDS 0x0 /* all off */ #define DEFAULT_LEDS_MASK 0xffffffff /* 32 */ #define DEFAULT_INT_RESOLUTION 1000 #define DEFAULT_INT_MIN_VALUE 0 #define DEFAULT_INT_MAX_VALUE 100 #define DEFAULT_INT_DISPLAYED 0 #define DEFAULT_PTR_NUMERATOR 2 #define DEFAULT_PTR_DENOMINATOR 1 #define DEFAULT_PTR_THRESHOLD 4 #define DEFAULT_SCREEN_SAVER_TIME (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_INTERVAL (10 * (60 * 1000)) #define DEFAULT_SCREEN_SAVER_BLANKING PreferBlanking #define DEFAULT_SCREEN_SAVER_EXPOSURES AllowExposures #ifndef NOLOGOHACK #define DEFAULT_LOGO_SCREEN_SAVER 1 #endif #ifndef DEFAULT_ACCESS_CONTROL #define DEFAULT_ACCESS_CONTROL TRUE #endif #endif /* SITE_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/window.h0100664000076400007640000001663407120677563022030 0ustar constconst/* $XConsortium: window.h /main/8 1996/03/21 13:35:33 mor $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef WINDOW_H #define WINDOW_H #include "misc.h" #include "region.h" #include "screenint.h" #include "X11/Xproto.h" #define TOTALLY_OBSCURED 0 #define UNOBSCURED 1 #define OBSCURED 2 #define VisibilityNotViewable 3 /* return values for tree-walking callback procedures */ #define WT_STOPWALKING 0 #define WT_WALKCHILDREN 1 #define WT_DONTWALKCHILDREN 2 #define WT_NOMATCH 3 #define NullWindow ((WindowPtr) 0) typedef struct _BackingStore *BackingStorePtr; typedef struct _Window *WindowPtr; typedef int (*VisitWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/, pointer /*data*/ #endif ); extern int TraverseTree( #if NeedFunctionPrototypes WindowPtr /*pWin*/, VisitWindowProcPtr /*func*/, pointer /*data*/ #endif ); extern int WalkTree( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, VisitWindowProcPtr /*func*/, pointer /*data*/ #endif ); extern WindowPtr AllocateWindow( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern Bool CreateRootWindow( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern void InitRootWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void ClippedRegionFromBox( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*Rgn*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); extern WindowPtr RealChildHead( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern WindowPtr CreateWindow( #if NeedFunctionPrototypes Window /*wid*/, WindowPtr /*pParent*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*bw*/, unsigned int /*class*/, Mask /*vmask*/, XID* /*vlist*/, int /*depth*/, ClientPtr /*client*/, VisualID /*visual*/, int* /*error*/ #endif ); extern int DeleteWindow( #if NeedFunctionPrototypes pointer /*pWin*/, XID /*wid*/ #endif ); extern void DestroySubwindows( #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/ #endif ); extern int ChangeWindowAttributes( #if NeedFunctionPrototypes WindowPtr /*pWin*/, Mask /*vmask*/, XID* /*vlist*/, ClientPtr /*client*/ #endif ); extern void GetWindowAttributes( #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/, xGetWindowAttributesReply* /* wa */ #endif ); extern RegionPtr CreateUnclippedWinSize( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void GravityTranslate( #if NeedFunctionPrototypes int /*x*/, int /*y*/, int /*oldx*/, int /*oldy*/, int /*dw*/, int /*dh*/, unsigned /*gravity*/, int* /*destx*/, int* /*desty*/ #endif ); extern int ConfigureWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, Mask /*mask*/, XID* /*vlist*/, ClientPtr /*client*/ #endif ); extern int CirculateWindow( #if NeedFunctionPrototypes WindowPtr /*pParent*/, int /*direction*/, ClientPtr /*client*/ #endif ); extern int ReparentWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pParent*/, int /*x*/, int /*y*/, ClientPtr /*client*/ #endif ); extern int MapWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/ #endif ); extern void MapSubwindows( #if NeedFunctionPrototypes WindowPtr /*pParent*/, ClientPtr /*client*/ #endif ); extern int UnmapWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, Bool /*fromConfigure*/ #endif ); extern void UnmapSubwindows( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void HandleSaveSet( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern Bool VisibleBoundingBoxFromPoint( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); extern Bool PointInWindowIsVisible( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/ #endif ); extern RegionPtr NotClippedByChildren( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void SendVisibilityNotify( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void SaveScreens( #if NeedFunctionPrototypes int /*on*/, int /*mode*/ #endif ); extern WindowPtr FindWindowWithOptional( #if NeedFunctionPrototypes WindowPtr /*w*/ #endif ); extern void CheckWindowOptionalNeed( #if NeedFunctionPrototypes WindowPtr /*w*/ #endif ); extern Bool MakeWindowOptional( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void DisposeWindowOptional( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern WindowPtr MoveWindowInStack( #if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pNextSib*/ #endif ); void SetWinSize( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); void SetBorderSize( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); void ResizeChildrenWinSize( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*dx*/, int /*dy*/, int /*dw*/, int /*dh*/ #endif ); #endif /* WINDOW_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/scrnintstr.h0100664000076400007640000005046407120677563022731 0ustar constconst/* $XConsortium: scrnintstr.h /main/32 1996/09/28 17:14:32 rws $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef SCREENINTSTRUCT_H #define SCREENINTSTRUCT_H #include "screenint.h" #include "miscstruct.h" #include "region.h" #include "pixmap.h" #include "gc.h" #include "colormap.h" #include "cursor.h" #include "validate.h" #include "window.h" #include "X11/Xproto.h" #include "dix.h" typedef struct _PixmapFormat { unsigned char depth; unsigned char bitsPerPixel; unsigned char scanlinePad; } PixmapFormatRec; typedef struct _Visual { VisualID vid; short class; short bitsPerRGBValue; short ColormapEntries; short nplanes;/* = log2 (ColormapEntries). This does not * imply that the screen has this many planes. * it may have more or fewer */ unsigned long redMask, greenMask, blueMask; int offsetRed, offsetGreen, offsetBlue; } VisualRec; typedef struct _Depth { unsigned char depth; short numVids; VisualID *vids; /* block of visual ids for this depth */ } DepthRec; /* * There is a typedef for each screen function pointer so that code that * needs to declare a screen function pointer (e.g. in a screen private * or as a local variable) can easily do so and retain full type checking. */ typedef Bool (* CloseScreenProcPtr)( #if NeedNestedPrototypes int /*index*/, ScreenPtr /*pScreen*/ #endif ); typedef void (* QueryBestSizeProcPtr)( #if NeedNestedPrototypes int /*class*/, unsigned short * /*pwidth*/, unsigned short * /*pheight*/, ScreenPtr /*pScreen*/ #endif ); typedef Bool (* SaveScreenProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*on*/ #endif ); typedef void (* GetImageProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ #endif ); typedef void (* GetSpansProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int* /*pwidth*/, int /*nspans*/, char * /*pdstStart*/ #endif ); typedef void (* PointerNonInterestBoxProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, BoxPtr /*pBox*/ #endif ); typedef void (* SourceValidateProcPtr)( #if NeedNestedPrototypes DrawablePtr /*pDrawable*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/ #endif ); typedef Bool (* CreateWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/ #endif ); typedef Bool (* DestroyWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/ #endif ); typedef Bool (* PositionWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, int /*x*/, int /*y*/ #endif ); typedef Bool (* ChangeWindowAttributesProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, unsigned long /*mask*/ #endif ); typedef Bool (* RealizeWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/ #endif ); typedef Bool (* UnrealizeWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/ #endif ); typedef int (* ValidateTreeProcPtr)( #if NeedNestedPrototypes WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/ #endif ); typedef void (* PostValidateTreeProcPtr)( #if NeedNestedPrototypes WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/ #endif ); typedef void (* WindowExposuresProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/ #endif ); typedef void (* PaintWindowBackgroundProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); typedef void (* PaintWindowBorderProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); typedef void (* CopyWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/ #endif ); typedef void (* ClearToBackgroundProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ #endif ); typedef void (* ClipNotifyProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, int /*dx*/, int /*dy*/ #endif ); typedef PixmapPtr (* CreatePixmapProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/ #endif ); typedef Bool (* DestroyPixmapProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPixmap*/ #endif ); typedef void (* SaveDoomedAreasProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/ #endif ); typedef RegionPtr (* RestoreAreasProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, RegionPtr /*prgnRestore*/ #endif ); typedef void (* ExposeCopyProcPtr)( #if NeedNestedPrototypes WindowPtr /*pSrc*/, DrawablePtr /*pDst*/, GCPtr /*pGC*/, RegionPtr /*prgnExposed*/, int /*srcx*/, int /*srcy*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ #endif ); typedef RegionPtr (* TranslateBackingStoreProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, int /*windx*/, int /*windy*/, RegionPtr /*oldClip*/, int /*oldx*/, int /*oldy*/ #endif ); typedef RegionPtr (* ClearBackingStoreProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ #endif ); typedef void (* DrawGuaranteeProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWindow*/, GCPtr /*pGC*/, int /*guarantee*/ #endif ); typedef Bool (* RealizeFontProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, FontPtr /*pFont*/ #endif ); typedef Bool (* UnrealizeFontProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, FontPtr /*pFont*/ #endif ); typedef void (* ConstrainCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, BoxPtr /*pBox*/ #endif ); typedef void (* CursorLimitsProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, BoxPtr /*pHotBox*/, BoxPtr /*pTopLeftBox*/ #endif ); typedef Bool (* DisplayCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef Bool (* RealizeCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef Bool (* UnrealizeCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); typedef void (* RecolorCursorProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, Bool /*displayed*/ #endif ); typedef Bool (* SetCursorPositionProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, Bool /*generateEvent*/ #endif ); typedef Bool (* CreateGCProcPtr)( #if NeedNestedPrototypes GCPtr /*pGC*/ #endif ); typedef Bool (* CreateColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* DestroyColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* InstallColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef void (* UninstallColormapProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/ #endif ); typedef int (* ListInstalledColormapsProcPtr) ( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, XID* /*pmaps */ #endif ); typedef void (* StoreColorsProcPtr)( #if NeedNestedPrototypes ColormapPtr /*pColormap*/, int /*ndef*/, xColorItem * /*pdef*/ #endif ); typedef void (* ResolveColorProcPtr)( #if NeedNestedPrototypes unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, VisualPtr /*pVisual*/ #endif ); typedef RegionPtr (* RegionCreateProcPtr)( #if NeedNestedPrototypes BoxPtr /*rect*/, int /*size*/ #endif ); typedef void (* RegionInitProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/ #endif ); typedef Bool (* RegionCopyProcPtr)( #if NeedNestedPrototypes RegionPtr /*dst*/, RegionPtr /*src*/ #endif ); typedef void (* RegionDestroyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef void (* RegionUninitProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef Bool (* IntersectProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); typedef Bool (* UnionProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); typedef Bool (* SubtractProcPtr)( #if NeedNestedPrototypes RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/ #endif ); typedef Bool (* InverseProcPtr)( #if NeedNestedPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/ #endif ); typedef void (* RegionResetProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, BoxPtr /*pBox*/ #endif ); typedef void (* TranslateRegionProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/ #endif ); typedef int (* RectInProcPtr)( #if NeedNestedPrototypes RegionPtr /*region*/, BoxPtr /*prect*/ #endif ); typedef Bool (* PointInRegionProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); typedef Bool (* RegionNotEmptyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef void (* RegionEmptyProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef BoxPtr (* RegionExtentsProcPtr)( #if NeedNestedPrototypes RegionPtr /*pReg*/ #endif ); typedef Bool (* RegionAppendProcPtr)( #if NeedNestedPrototypes RegionPtr /*dstrgn*/, RegionPtr /*rgn*/ #endif ); typedef Bool (* RegionValidateProcPtr)( #if NeedNestedPrototypes RegionPtr /*badreg*/, Bool* /*pOverlap*/ #endif ); typedef RegionPtr (* BitmapToRegionProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPix*/ #endif ); typedef RegionPtr (* RectsToRegionProcPtr)( #if NeedNestedPrototypes int /*nrects*/, xRectangle* /*prect*/, int /*ctype*/ #endif ); typedef void (* SendGraphicsExposeProcPtr)( #if NeedNestedPrototypes ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/ #endif ); typedef void (* ScreenBlockHandlerProcPtr)( #if NeedNestedPrototypes int /*screenNum*/, pointer /*blockData*/, struct timeval ** /*pTimeout*/, pointer /*pReadmask*/ #endif ); typedef void (* ScreenWakeupHandlerProcPtr)( #if NeedNestedPrototypes int /*screenNum*/, pointer /*wakeupData*/, unsigned long /*result*/, pointer /*pReadMask*/ #endif ); typedef Bool (* CreateScreenResourcesProcPtr)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/ #endif ); typedef Bool (* ModifyPixmapHeaderProcPtr)( #if NeedNestedPrototypes PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ #endif ); typedef void (* MarkWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/ #endif ); typedef Bool (* MarkOverlappedWindowsProcPtr)( #if NeedNestedPrototypes WindowPtr /*parent*/, WindowPtr /*firstChild*/, WindowPtr * /*pLayerWin*/ #endif ); typedef Bool (* ChangeSaveUnderProcPtr)( #if NeedNestedPrototypes WindowPtr /*pLayerWin*/, WindowPtr /*firstChild*/ #endif ); typedef void (* PostChangeSaveUnderProcPtr)( #if NeedNestedPrototypes WindowPtr /*pLayerWin*/, WindowPtr /*firstChild*/ #endif ); typedef void (* MoveWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, WindowPtr /*pSib*/, VTKind /*kind*/ #endif ); typedef void (* ResizeWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, WindowPtr /*pSib*/ #endif ); typedef WindowPtr (* GetLayerWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/ #endif ); typedef void (* HandleExposuresProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/ #endif ); typedef void (* ReparentWindowProcPtr)( #if NeedNestedPrototypes WindowPtr /*pWin*/, WindowPtr /*pPriorParent*/ #endif ); #ifdef SHAPE typedef void (* SetShapeProcPtr)( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); #endif /* SHAPE */ typedef void (* ChangeBorderWidthProcPtr)( #if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned int /*width*/ #endif ); typedef void (* MarkUnrealizedWindowProcPtr)( #if NeedFunctionPrototypes WindowPtr /*pChild*/, WindowPtr /*pWin*/, Bool /*fromConfigure*/ #endif ); typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; short width, height; short mmWidth, mmHeight; short numDepths; unsigned char rootDepth; DepthPtr allowedDepths; unsigned long rootVisual; unsigned long defColormap; short minInstalledCmaps, maxInstalledCmaps; char backingStoreSupport, saveUnderSupport; unsigned long whitePixel, blackPixel; unsigned long rgf; /* array of flags; she's -- HUNGARIAN */ GCPtr GCperDepth[MAXFORMATS+1]; /* next field is a stipple to use as default in a GC. we don't build default tiles of all depths because they are likely to be of a color different from the default fg pixel, so we don't win anything by building a standard one. */ PixmapPtr PixmapPerDepth[1]; pointer devPrivate; short numVisuals; VisualPtr visuals; int WindowPrivateLen; unsigned *WindowPrivateSizes; unsigned totalWindowSize; int GCPrivateLen; unsigned *GCPrivateSizes; unsigned totalGCSize; /* Random screen procedures */ CloseScreenProcPtr CloseScreen; QueryBestSizeProcPtr QueryBestSize; SaveScreenProcPtr SaveScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; PointerNonInterestBoxProcPtr PointerNonInterestBox; SourceValidateProcPtr SourceValidate; /* Window Procedures */ CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; WindowExposuresProcPtr WindowExposures; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; ClipNotifyProcPtr ClipNotify; /* Pixmap procedures */ CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; /* Backing store procedures */ SaveDoomedAreasProcPtr SaveDoomedAreas; RestoreAreasProcPtr RestoreAreas; ExposeCopyProcPtr ExposeCopy; TranslateBackingStoreProcPtr TranslateBackingStore; ClearBackingStoreProcPtr ClearBackingStore; DrawGuaranteeProcPtr DrawGuarantee; /* Font procedures */ RealizeFontProcPtr RealizeFont; UnrealizeFontProcPtr UnrealizeFont; /* Cursor Procedures */ ConstrainCursorProcPtr ConstrainCursor; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; UnrealizeCursorProcPtr UnrealizeCursor; RecolorCursorProcPtr RecolorCursor; SetCursorPositionProcPtr SetCursorPosition; /* GC procedures */ CreateGCProcPtr CreateGC; /* Colormap procedures */ CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; InstallColormapProcPtr InstallColormap; UninstallColormapProcPtr UninstallColormap; ListInstalledColormapsProcPtr ListInstalledColormaps; StoreColorsProcPtr StoreColors; ResolveColorProcPtr ResolveColor; /* Region procedures */ RegionCreateProcPtr RegionCreate; RegionInitProcPtr RegionInit; RegionCopyProcPtr RegionCopy; RegionDestroyProcPtr RegionDestroy; RegionUninitProcPtr RegionUninit; IntersectProcPtr Intersect; UnionProcPtr Union; SubtractProcPtr Subtract; InverseProcPtr Inverse; RegionResetProcPtr RegionReset; TranslateRegionProcPtr TranslateRegion; RectInProcPtr RectIn; PointInRegionProcPtr PointInRegion; RegionNotEmptyProcPtr RegionNotEmpty; RegionEmptyProcPtr RegionEmpty; RegionExtentsProcPtr RegionExtents; RegionAppendProcPtr RegionAppend; RegionValidateProcPtr RegionValidate; BitmapToRegionProcPtr BitmapToRegion; RectsToRegionProcPtr RectsToRegion; SendGraphicsExposeProcPtr SendGraphicsExpose; /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; ScreenWakeupHandlerProcPtr WakeupHandler; pointer blockData; pointer wakeupData; /* anybody can get a piece of this array */ DevUnion *devPrivates; CreateScreenResourcesProcPtr CreateScreenResources; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ #ifdef PIXPRIV int PixmapPrivateLen; unsigned *PixmapPrivateSizes; unsigned totalPixmapSize; #endif MarkWindowProcPtr MarkWindow; MarkOverlappedWindowsProcPtr MarkOverlappedWindows; ChangeSaveUnderProcPtr ChangeSaveUnder; PostChangeSaveUnderProcPtr PostChangeSaveUnder; MoveWindowProcPtr MoveWindow; ResizeWindowProcPtr ResizeWindow; GetLayerWindowProcPtr GetLayerWindow; HandleExposuresProcPtr HandleExposures; ReparentWindowProcPtr ReparentWindow; #ifdef SHAPE SetShapeProcPtr SetShape; #endif /* SHAPE */ ChangeBorderWidthProcPtr ChangeBorderWidth; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; } ScreenRec; typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; int bitmapScanlinePad; int bitmapBitOrder; int numPixmapFormats; PixmapFormatRec formats[MAXFORMATS]; int arraySize; int numScreens; ScreenPtr screens[MAXSCREENS]; int numVideoScreens; } ScreenInfo; extern ScreenInfo screenInfo; extern void InitOutput( #if NeedFunctionPrototypes ScreenInfo * /*pScreenInfo*/, int /*argc*/, char ** /*argv*/ #endif ); #endif /* SCREENINTSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/rgb.h0100664000076400007640000000503607120677563021265 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: rgb.h,v 1.4 94/04/17 20:26:04 jim Exp $ */ #ifndef RGB_H #define RGB_H typedef struct _RGB { unsigned short red, green, blue; } RGB; #endif /* RGB_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dixfont.h0100664000076400007640000002126507120677563022170 0ustar constconst/* $XConsortium: dixfont.h /main/21 1996/09/28 17:14:16 rws $ */ /* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.1 1996/12/23 07:09:25 dawes Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef DIXFONT_H #define DIXFONT_H 1 #include #include #include #define NullDIXFontProp ((DIXFontPropPtr)0) typedef struct _DIXFontProp *DIXFontPropPtr; extern int FontToXError( #if NeedFunctionPrototypes int /*err*/ #endif ); extern Bool SetDefaultFont( #if NeedFunctionPrototypes char * /*defaultfontname*/ #endif ); extern void QueueFontWakeup( #if NeedFunctionPrototypes FontPathElementPtr /*fpe*/ #endif ); extern void RemoveFontWakeup( #if NeedFunctionPrototypes FontPathElementPtr /*fpe*/ #endif ); extern void FontWakeup( #if NeedFunctionPrototypes pointer /*data*/, int /*count*/, pointer /*LastSelectMask*/ #endif ); extern int OpenFont( #if NeedFunctionPrototypes ClientPtr /*client*/, XID /*fid*/, Mask /*flags*/, unsigned /*lenfname*/, char * /*pfontname*/ #endif ); extern int CloseFont( #if NeedFunctionPrototypes pointer /*pfont*/, XID /*fid*/ #endif ); typedef struct _xQueryFontReply *xQueryFontReplyPtr; extern void QueryFont( #if NeedFunctionPrototypes FontPtr /*pFont*/, xQueryFontReplyPtr /*pReply*/, int /*nProtoCCIStructs*/ #endif ); extern int ListFonts( #if NeedFunctionPrototypes ClientPtr /*client*/, unsigned char * /*pattern*/, unsigned int /*length*/, unsigned int /*max_names*/ #endif ); int doListFontsWithInfo( #if NeedFunctionPrototypes ClientPtr /*client*/, LFWIclosurePtr /*c*/ #endif ); extern int doPolyText( #if NeedFunctionPrototypes ClientPtr /*client*/, PTclosurePtr /*c*/ #endif ); extern int PolyText( #if NeedFunctionPrototypes ClientPtr /*client*/, DrawablePtr /*pDraw*/, GCPtr /*pGC*/, unsigned char * /*pElt*/, unsigned char * /*endReq*/, int /*xorg*/, int /*yorg*/, int /*reqType*/, XID /*did*/ #endif ); extern int doImageText( #if NeedFunctionPrototypes ClientPtr /*client*/, ITclosurePtr /*c*/ #endif ); extern int ImageText( #if NeedFunctionPrototypes ClientPtr /*client*/, DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nChars*/, unsigned char * /*data*/, int /*xorg*/, int /*yorg*/, int /*reqType*/, XID /*did*/ #endif ); extern int SetFontPath( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*npaths*/, unsigned char * /*paths*/, int * /*error*/ #endif ); extern int SetDefaultFontPath( #if NeedFunctionPrototypes char * /*path*/ #endif ); extern unsigned char *GetFontPath( #if NeedFunctionPrototypes int * /*count*/, int * /*length*/ #endif ); extern int LoadGlyphs( #if NeedFunctionPrototypes ClientPtr /*client*/, FontPtr /*pfont*/, unsigned /*nchars*/, int /*item_size*/, unsigned char * /*data*/ #endif ); extern void DeleteClientFontStuff( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void InitFonts( #if NeedFunctionPrototypes void #endif ); extern int GetDefaultPointSize( #if NeedFunctionPrototypes void #endif ); extern FontResolutionPtr GetClientResolutions( #if NeedFunctionPrototypes int * /*num*/ #endif ); /* This is related to 'struct _FPEFunctions' in fonts/include/fontstruct.h */ extern int RegisterFPEFunctions( #if NeedFunctionPrototypes int (* /*name_func*/)( #if NeedNestedPrototypes char* /* name */ #endif ), int (* /*init_func*/)( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ), int (* /*free_func*/)( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ), int (* /*reset_func*/)( #if NeedNestedPrototypes FontPathElementPtr /* fpe */ #endif ), int (* /*open_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, int /* flags */, char* /* name */, int /* namelen */, fsBitmapFormat /* format */, fsBitmapFormatMask /* fmask */, unsigned long /* id (type XID or FSID) */, FontPtr* /* pFont */, char** /* aliasName */, FontPtr /* non_cachable_font */ #endif ), int (* /*close_func*/)( #if NeedNestedPrototypes FontPathElementPtr /* fpe */, FontPtr /* pFont */ #endif ), int (* /*list_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, FontNamesPtr /* names */ #endif ), int (* /*start_lfwi_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* patlen */, int /* maxnames */, pointer* /* privatep */ #endif ), int (* /*next_lfwi_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char** /* name */, int* /* namelen */, FontInfoPtr* /* info */, int* /* numFonts */, pointer /* private */ #endif ), int (* /*wakeup_func*/)( #if NeedNestedPrototypes FontPathElementPtr /* fpe */, unsigned long* /* LastSelectMask */ #endif ), int (* /*client_died*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */ #endif ), int (* /*load_glyphs*/)( #if NeedNestedPrototypes pointer /* client */, FontPtr /* pfont */, Bool /* range_flag */, unsigned int /* nchars */, int /* item_size */, unsigned char* /* data */ #endif ), int (* /*start_list_alias_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, pointer* /* privatep */ #endif ), int (* /*next_list_alias_func*/)( #if NeedNestedPrototypes pointer /* client */, FontPathElementPtr /* fpe */, char** /* namep */, int* /* namelenp */, char** /* resolvedp */, int* /* resolvedlenp */, pointer /* private */ #endif ), void (* /* set_path_func*/)( #if NeedFunctionPrototypes void #endif ) #endif ); extern void FreeFonts( #if NeedFunctionPrototypes void #endif ); extern FontPtr find_old_font( #if NeedFunctionPrototypes XID /*id*/ #endif ); extern Font GetNewFontClientID( #if NeedFunctionPrototypes void #endif ); extern int StoreFontClientFont( #if NeedFunctionPrototypes FontPtr /*pfont*/, Font /*id*/ #endif ); extern void DeleteFontClientID( #if NeedFunctionPrototypes Font /*id*/ #endif ); extern int client_auth_generation( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int init_fs_handlers( #if NeedFunctionPrototypes FontPathElementPtr /*fpe*/, BlockHandlerProcPtr /*block_handler*/ #endif ); extern void remove_fs_handlers( #if NeedFunctionPrototypes FontPathElementPtr /*fpe*/, BlockHandlerProcPtr /*block_handler*/, Bool /*all*/ #endif ); extern void GetGlyphs( #if NeedFunctionPrototypes FontPtr /*font*/, unsigned long /*count*/, unsigned char * /*chars*/, FontEncoding /*fontEncoding*/, unsigned long * /*glyphcount*/, CharInfoPtr * /*glyphs*/ #endif ); extern void QueryGlyphExtents( #if NeedFunctionPrototypes FontPtr /*pFont*/, CharInfoPtr * /*charinfo*/, unsigned long /*count*/, ExtentInfoPtr /*info*/ #endif ); extern Bool QueryTextExtents( #if NeedFunctionPrototypes FontPtr /*pFont*/, unsigned long /*count*/, unsigned char * /*chars*/, ExtentInfoPtr /*info*/ #endif ); extern Bool ParseGlyphCachingMode( #if NeedFunctionPrototypes char * /*str*/ #endif ); extern void InitGlyphCaching( #if NeedFunctionPrototypes void #endif ); extern void SetGlyphCachingMode( #if NeedFunctionPrototypes int /*newmode*/ #endif ); void ResetFontPrivateIndex( #if NeedFunctionPrototypes void #endif ); #endif /* DIXFONT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/regionstr.h0100664000076400007640000002500407120677563022524 0ustar constconst/* $XConsortium: regionstr.h,v 1.8 94/04/17 20:26:01 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H #include "miscstruct.h" /* Return values from RectIn() */ #define rgnOUT 0 #define rgnIN 1 #define rgnPART 2 #define NullRegion ((RegionPtr)0) /* * clip region */ typedef struct _RegData { long size; long numRects; /* BoxRec rects[size]; in memory but not explicitly declared */ } RegDataRec, *RegDataPtr; typedef struct _Region { BoxRec extents; RegDataPtr data; } RegionRec, *RegionPtr; extern BoxRec miEmptyBox; extern RegDataRec miEmptyData; #define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects) #define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1) #define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0) #define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \ : &(reg)->extents) #define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1)) #define REGION_BOX(reg,i) (®ION_BOXPTR(reg)[i]) #define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects) #define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1) #define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))) #ifdef NEED_SCREEN_REGIONS #define REGION_CREATE(_pScreen, _rect, _size) \ (*(_pScreen)->RegionCreate)(_rect, _size) #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ (*(_pScreen)->RegionInit)(_pReg, _rect, _size) #define REGION_COPY(_pScreen, dst, src) \ (*(_pScreen)->RegionCopy)(dst, src) #define REGION_DESTROY(_pScreen, _pReg) \ (*(_pScreen)->RegionDestroy)(_pReg) #define REGION_UNINIT(_pScreen, _pReg) \ (*(_pScreen)->RegionUninit)(_pReg) #define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Intersect)(newReg, reg1, reg2) #define REGION_UNION(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Union)(newReg, reg1, reg2) #define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ (*(_pScreen)->Subtract)(newReg, reg1, reg2) #define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ (*(_pScreen)->Inverse)(newReg, reg1, invRect) #define REGION_RESET(_pScreen, _pReg, _pBox) \ (*(_pScreen)->RegionReset)(_pReg, _pBox) #define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ (*(_pScreen)->TranslateRegion)(_pReg, _x, _y) #define RECT_IN_REGION(_pScreen, _pReg, prect) \ (*(_pScreen)->RectIn)(_pReg, prect) #define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ (*(_pScreen)->PointInRegion)(_pReg, _x, _y, prect) #define REGION_NOTEMPTY(_pScreen, _pReg) \ (*(_pScreen)->RegionNotEmpty)(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ (*(_pScreen)->RegionEmpty)(_pReg) #define REGION_EXTENTS(_pScreen, _pReg) \ (*(_pScreen)->RegionExtents)(_pReg) #define REGION_APPEND(_pScreen, dstrgn, rgn) \ (*(_pScreen)->RegionAppend)(dstrgn, rgn) #define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ (*(_pScreen)->RegionValidate)(badreg, pOverlap) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(_pScreen)->BitmapToRegion)(pPix) #define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ (*(_pScreen)->RectsToRegion)(nrects, prect, ctype) #else /* !NEED_SCREEN_REGIONS */ #define REGION_CREATE(_pScreen, _rect, _size) \ miRegionCreate(_rect, _size) #define REGION_COPY(_pScreen, dst, src) \ miRegionCopy(dst, src) #define REGION_DESTROY(_pScreen, _pReg) \ miRegionDestroy(_pReg) #define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ miIntersect(newReg, reg1, reg2) #define REGION_UNION(_pScreen, newReg, reg1, reg2) \ miUnion(newReg, reg1, reg2) #define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ miSubtract(newReg, reg1, reg2) #define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ miInverse(newReg, reg1, invRect) #define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ miTranslateRegion(_pReg, _x, _y) #define RECT_IN_REGION(_pScreen, _pReg, prect) \ miRectIn(_pReg, prect) #define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ miPointInRegion(_pReg, _x, _y, prect) #define REGION_APPEND(_pScreen, dstrgn, rgn) \ miRegionAppend(dstrgn, rgn) #define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ miRegionValidate(badreg, pOverlap) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */ #define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ miRectsToRegion(nrects, prect, ctype) #ifdef DONT_INLINE_REGION_OPS #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ miRegionInit(_pReg, _rect, _size) #define REGION_UNINIT(_pScreen, _pReg) \ miRegionUninit(_pReg) #define REGION_RESET(_pScreen, _pReg, _pBox) \ miRegionReset(_pReg, _pBox) #define REGION_NOTEMPTY(_pScreen, _pReg) \ miRegionNotEmpty(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ miRegionEmpty(_pReg) #define REGION_EXTENTS(_pScreen, _pReg) \ miRegionExtents(_pReg) #else /* inline certain simple region ops for performance */ #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ { \ if (_rect) \ { \ (_pReg)->extents = *(_rect); \ (_pReg)->data = (RegDataPtr)NULL; \ } \ else \ { \ (_pReg)->extents = miEmptyBox; \ if (((_size) > 1) && ((_pReg)->data = \ (RegDataPtr)xalloc(REGION_SZOF(_size)))) \ { \ (_pReg)->data->size = (_size); \ (_pReg)->data->numRects = 0; \ } \ else \ (_pReg)->data = &miEmptyData; \ } \ } #define REGION_UNINIT(_pScreen, _pReg) \ { \ if ((_pReg)->data && (_pReg)->data->size) xfree((_pReg)->data); \ } #define REGION_RESET(_pScreen, _pReg, _pBox) \ { \ (_pReg)->extents = *(_pBox); \ REGION_UNINIT(_pScreen, _pReg); \ (_pReg)->data = (RegDataPtr)NULL; \ } #define REGION_NOTEMPTY(_pScreen, _pReg) \ !REGION_NIL(_pReg) #define REGION_EMPTY(_pScreen, _pReg) \ { \ REGION_UNINIT(_pScreen, _pReg); \ (_pReg)->extents.x2 = (_pReg)->extents.x1; \ (_pReg)->extents.y2 = (_pReg)->extents.y1; \ (_pReg)->data = &miEmptyData; \ } #define REGION_EXTENTS(_pScreen, _pReg) \ &(_pReg)->extents #endif /* DONT_INLINE_REGION_OPS */ #endif /* NEED_SCREEN_REGIONS */ /* moved from mi.h */ extern RegionPtr miRegionCreate( #if NeedFunctionPrototypes BoxPtr /*rect*/, int /*size*/ #endif ); extern void miRegionInit( #if NeedFunctionPrototypes RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/ #endif ); extern void miRegionDestroy( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern void miRegionUninit( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern Bool miRegionCopy( #if NeedFunctionPrototypes RegionPtr /*dst*/, RegionPtr /*src*/ #endif ); extern Bool miIntersect( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); extern Bool miUnion( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/ #endif ); extern Bool miRegionAppend( #if NeedFunctionPrototypes RegionPtr /*dstrgn*/, RegionPtr /*rgn*/ #endif ); extern Bool miRegionValidate( #if NeedFunctionPrototypes RegionPtr /*badreg*/, Bool * /*pOverlap*/ #endif ); extern RegionPtr miRectsToRegion( #if NeedFunctionPrototypes int /*nrects*/, xRectanglePtr /*prect*/, int /*ctype*/ #endif ); extern Bool miSubtract( #if NeedFunctionPrototypes RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/ #endif ); extern Bool miInverse( #if NeedFunctionPrototypes RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/ #endif ); extern int miRectIn( #if NeedFunctionPrototypes RegionPtr /*region*/, BoxPtr /*prect*/ #endif ); extern void miTranslateRegion( #if NeedFunctionPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/ #endif ); extern void miRegionReset( #if NeedFunctionPrototypes RegionPtr /*pReg*/, BoxPtr /*pBox*/ #endif ); extern Bool miPointInRegion( #if NeedFunctionPrototypes RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/ #endif ); extern Bool miRegionNotEmpty( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern void miRegionEmpty( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern BoxPtr miRegionExtents( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); #endif /* REGIONSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/closure.h0100664000076400007640000000530507120677563022166 0ustar constconst/* $XConsortium: closure.h,v 1.3 94/04/17 20:25:31 gildea Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef CLOSURE_H #define CLOSURE_H 1 typedef struct _LFclosure *LFclosurePtr; typedef struct _LFWIclosure *LFWIclosurePtr; typedef struct _OFclosure *OFclosurePtr; typedef struct _PTclosure *PTclosurePtr; typedef struct _ITclosure *ITclosurePtr; #endif /* CLOSURE_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/colormap.h0100664000076400007640000001336107120677563022327 0ustar constconst/* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $XConsortium: colormap.h,v 1.28 94/04/17 20:25:32 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.2 1997/01/14 22:22:38 dawes Exp $ */ #ifndef CMAP_H #define CMAP_H 1 #include "X11/Xproto.h" #include "screenint.h" #include "window.h" /* these follow X.h's AllocNone and AllocAll */ #define CM_PSCREEN 2 #define CM_PWIN 3 /* Passed internally in colormap.c */ #define REDMAP 0 #define GREENMAP 1 #define BLUEMAP 2 #define PSEUDOMAP 3 #define AllocPrivate (-1) #define AllocTemporary (-2) #define DynamicClass 1 /* Values for the flags field of a colormap. These should have 1 bit set * and not overlap */ #define IsDefault 1 #define AllAllocated 2 #define BeingCreated 4 typedef CARD32 Pixel; typedef struct _CMEntry *EntryPtr; /* moved to screenint.h: typedef struct _ColormapRec *ColormapPtr */ typedef struct _colorResource *colorResourcePtr; extern int CreateColormap( #if NeedFunctionPrototypes Colormap /*mid*/, ScreenPtr /*pScreen*/, VisualPtr /*pVisual*/, ColormapPtr* /*ppcmap*/, int /*alloc*/, int /*client*/ #endif ); extern int FreeColormap( #if NeedFunctionPrototypes pointer /*pmap*/, XID /*mid*/ #endif ); extern int TellLostMap( #if NeedFunctionPrototypes WindowPtr /*pwin*/, pointer /* Colormap *pmid */ #endif ); extern int TellGainedMap( #if NeedFunctionPrototypes WindowPtr /*pwin*/, pointer /* Colormap *pmid */ #endif ); extern int CopyColormapAndFree( #if NeedFunctionPrototypes Colormap /*mid*/, ColormapPtr /*pSrc*/, int /*client*/ #endif ); extern int AllocColor( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, unsigned short* /*pred*/, unsigned short* /*pgreen*/, unsigned short* /*pblue*/, Pixel* /*pPix*/, int /*client*/ #endif ); extern void FakeAllocColor( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, xColorItem * /*item*/ #endif ); extern void FakeFreeColor( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, Pixel /*pixel*/ #endif ); typedef int (*ColorCompareProcPtr)( #if NeedNestedPrototypes EntryPtr /*pent*/, xrgb * /*prgb*/ #endif ); extern int FindColor( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, EntryPtr /*pentFirst*/, int /*size*/, xrgb* /*prgb*/, Pixel* /*pPixel*/, int /*channel*/, int /*client*/, ColorCompareProcPtr /*comp*/ #endif ); extern int QueryColors( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*count*/, Pixel* /*ppixIn*/, xrgb* /*prgbList*/ #endif ); extern int FreeClientPixels( #if NeedFunctionPrototypes pointer /*pcr*/, XID /*fakeid*/ #endif ); extern int AllocColorCells( #if NeedFunctionPrototypes int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*planes*/, Bool /*contig*/, Pixel* /*ppix*/, Pixel* /*masks*/ #endif ); extern int AllocColorPlanes( #if NeedFunctionPrototypes int /*client*/, ColormapPtr /*pmap*/, int /*colors*/, int /*r*/, int /*g*/, int /*b*/, Bool /*contig*/, Pixel* /*pixels*/, Pixel* /*prmask*/, Pixel* /*pgmask*/, Pixel* /*pbmask*/ #endif ); extern int FreeColors( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*client*/, int /*count*/, Pixel* /*pixels*/, Pixel /*mask*/ #endif ); extern int StoreColors( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*count*/, xColorItem* /*defs*/ #endif ); extern int IsMapInstalled( #if NeedFunctionPrototypes Colormap /*map*/, WindowPtr /*pWin*/ #endif ); #endif /* CMAP_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/cursor.h0100664000076400007640000001051607120677563022027 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cursor.h,v 1.22 94/04/17 20:25:34 dpw Exp $ */ #ifndef CURSOR_H #define CURSOR_H #include "misc.h" #include "screenint.h" #include "window.h" #define NullCursor ((CursorPtr)NULL) typedef struct _Cursor *CursorPtr; typedef struct _CursorMetric *CursorMetricPtr; extern CursorPtr rootCursor; extern int FreeCursor( #if NeedFunctionPrototypes pointer /*pCurs*/, XID /*cid*/ #endif ); extern CursorPtr AllocCursor( #if NeedFunctionPrototypes unsigned char* /*psrcbits*/, unsigned char* /*pmaskbits*/, CursorMetricPtr /*cm*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/ #endif ); extern int AllocGlyphCursor( #if NeedFunctionPrototypes Font /*source*/, unsigned int /*sourceChar*/, Font /*mask*/, unsigned int /*maskChar*/, unsigned /*foreRed*/, unsigned /*foreGreen*/, unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, unsigned /*backBlue*/, CursorPtr* /*ppCurs*/, ClientPtr /*client*/ #endif ); extern CursorPtr CreateRootCursor( #if NeedFunctionPrototypes char* /*pfilename*/, unsigned int /*glyph*/ #endif ); extern int ServerBitsFromGlyph( #if NeedFunctionPrototypes FontPtr /*pfont*/, unsigned int /*ch*/, register CursorMetricPtr /*cm*/, unsigned char ** /*ppbits*/ #endif ); extern Bool CursorMetricsFromGlyph( #if NeedFunctionPrototypes FontPtr /*pfont*/, unsigned /*ch*/, CursorMetricPtr /*cm*/ #endif ); extern void CheckCursorConfinement( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void NewCurrentScreen( #if NeedFunctionPrototypes ScreenPtr /*newScreen*/, int /*x*/, int /*y*/ #endif ); extern Bool PointerConfinedToScreen( #if NeedFunctionPrototypes void #endif ); extern void GetSpritePosition( #if NeedFunctionPrototypes int * /*px*/, int * /*py*/ #endif ); #endif /* CURSOR_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/extnsionst.h0100664000076400007640000001314607120677563022732 0ustar constconst/* $XConsortium: extnsionst.h /main/15 1996/08/01 19:18:11 dpw $ */ /* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.2 1996/12/23 07:09:27 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef EXTENSIONSTRUCT_H #define EXTENSIONSTRUCT_H #include "misc.h" #include "screenint.h" #include "extension.h" #include "gc.h" typedef struct _ExtensionEntry { int index; void (* CloseDown)( /* called at server shutdown */ #if NeedNestedPrototypes struct _ExtensionEntry * /* extension */ #endif ); char *name; /* extension name */ int base; /* base request number */ int eventBase; int eventLast; int errorBase; int errorLast; int num_aliases; char **aliases; pointer extPrivate; unsigned short (* MinorOpcode)( /* called for errors */ #if NeedNestedPrototypes ClientPtr /* client */ #endif ); #ifdef XCSECURITY Bool secure; /* extension visible to untrusted clients? */ #endif } ExtensionEntry; /* any attempt to declare the types of the parameters to the functions * in EventSwapVector fails. The functions take pointers to two events, * but the exact event types that are declared vary from one function * to another. You can't even put void *, void * (the ibm compiler * complains, anyway). */ typedef void (*EventSwapPtr) ( #if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR) xEvent *, xEvent * #endif ); extern EventSwapPtr EventSwapVector[128]; extern void NotImplemented ( /* FIXME: this may move to another file... */ #if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR) xEvent *, xEvent * #endif ); typedef void (* ExtensionLookupProc)( /*args indeterminate*/ #ifdef EXTENSION_PROC_ARGS EXTENSION_PROC_ARGS #endif ); typedef struct _ProcEntry { char *name; ExtensionLookupProc proc; } ProcEntryRec, *ProcEntryPtr; typedef struct _ScreenProcEntry { int num; ProcEntryPtr procList; } ScreenProcEntry; #define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \ pGC->VectorElement = NewRoutineAddress; #define GetGCValue(pGC, GCElement) (pGC->GCElement) extern ExtensionEntry *AddExtension( #if NeedFunctionPrototypes char* /*name*/, int /*NumEvents*/, int /*NumErrors*/, int (* /*MainProc*/)( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ), int (* /*SwappedMainProc*/)( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ), void (* /*CloseDownProc*/)( #if NeedNestedPrototypes ExtensionEntry * /*extension*/ #endif ), unsigned short (* /*MinorOpcodeProc*/)( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ) #endif /* NeedFunctionPrototypes */ ); extern Bool AddExtensionAlias( #if NeedFunctionPrototypes char* /*alias*/, ExtensionEntry * /*extension*/ #endif ); extern ExtensionLookupProc LookupProc( #if NeedFunctionPrototypes char* /*name*/, GCPtr /*pGC*/ #endif ); extern Bool RegisterProc( #if NeedFunctionPrototypes char* /*name*/, GCPtr /*pGC*/, ExtensionLookupProc /*proc*/ #endif ); extern Bool RegisterScreenProc( #if NeedFunctionPrototypes char* /*name*/, ScreenPtr /*pScreen*/, ExtensionLookupProc /*proc*/ #endif ); extern void DeclareExtensionSecurity( #if NeedFunctionPrototypes char * /*extname*/, Bool /*secure*/ #endif ); #endif /* EXTENSIONSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/colormapst.h0100664000076400007640000001024707120677563022676 0ustar constconst/* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $XConsortium: colormapst.h /main/4 1996/06/17 10:54:31 mor $ */ #ifndef CMAPSTRUCT_H #define CMAPSTRUCT_H 1 #include "colormap.h" #include "screenint.h" /* Shared color -- the color is used by AllocColorPlanes */ typedef struct { unsigned short color; short refcnt; } SHAREDCOLOR; /* LOCO -- a local color for a PseudoColor cell. DirectColor maps always * use the first value (called red) in the structure. What channel they * are really talking about depends on which map they are in. */ typedef struct { unsigned short red, green, blue; } LOCO; /* SHCO -- a shared color for a PseudoColor cell. Used with AllocColorPlanes. * DirectColor maps always use the first value (called red) in the structure. * What channel they are really talking about depends on which map they * are in. */ typedef struct { SHAREDCOLOR *red, *green, *blue; } SHCO; /* color map entry */ typedef struct _CMEntry { union { LOCO local; SHCO shco; } co; short refcnt; Bool fShared; } Entry; /* COLORMAPs can be used for either Direct or Pseudo color. PseudoColor * only needs one cell table, we arbitrarily pick red. We keep track * of that table with freeRed, numPixelsRed, and clientPixelsRed */ typedef struct _ColormapRec { VisualPtr pVisual; short class; /* PseudoColor or DirectColor */ long mid; /* client's name for colormap */ ScreenPtr pScreen; /* screen map is associated with */ short flags; /* 1 = IsDefault * 2 = AllAllocated */ int freeRed; int freeGreen; int freeBlue; int *numPixelsRed; int *numPixelsGreen; int *numPixelsBlue; Pixel **clientPixelsRed; Pixel **clientPixelsGreen; Pixel **clientPixelsBlue; Entry *red; Entry *green; Entry *blue; pointer devPriv; DevUnion *devPrivates; /* dynamic devPrivates added after devPriv already existed - must keep devPriv */ } ColormapRec; #endif /* COLORMAP_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/dix.h0100664000076400007640000005717110543216033021266 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: dix.h /main/44 1996/12/15 21:24:57 rws $ */ /* $XFree86: xc/programs/Xserver/include/dix.h,v 3.7 1996/12/31 04:17:46 dawes Exp $ */ #ifndef DIX_H #define DIX_H #include "gc.h" #include "window.h" #include "input.h" #define EARLIER -1 #define SAMETIME 0 #define LATER 1 #define NullClient ((ClientPtr) 0) #define REQUEST(type) \ register type *stuff = (type *)client->requestBuffer #define REQUEST_SIZE_MATCH(req)\ if ((sizeof(req) >> 2) != client->req_len)\ return(BadLength) #define REQUEST_AT_LEAST_SIZE(req) \ if ((sizeof(req) >> 2) > client->req_len )\ return(BadLength) #define REQUEST_FIXED_SIZE(req, n)\ if (((sizeof(req) >> 2) > client->req_len) || \ (((sizeof(req) + (n) + 3) >> 2) != client->req_len)) \ return(BadLength) #define LEGAL_NEW_RESOURCE(id,client)\ if (!LegalNewID(id,client)) \ {\ client->errorValue = id;\ return(BadIDChoice);\ } /* XXX if you are using this macro, you are probably not generating Match * errors where appropriate */ #define LOOKUP_DRAWABLE(did, client)\ ((client->lastDrawableID == did) ? \ client->lastDrawable : (DrawablePtr)LookupDrawable(did, client)) #ifdef XCSECURITY #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ if (client->lastDrawableID == did && !client->trustLevel)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ if (client->lastDrawableID == did && !client->trustLevel)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \ RC_DRAWABLE, mode);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ if (client->lastGCID == rid && !client->trustLevel)\ pGC = client->lastGC;\ else\ pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define VERIFY_DRAWABLE(pDraw, did, client)\ SECURITY_VERIFY_DRAWABLE(pDraw, did, client, SecurityUnknownAccess) #define VERIFY_GEOMETRABLE(pDraw, did, client)\ SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, SecurityUnknownAccess) #define VERIFY_GC(pGC, rid, client)\ SECURITY_VERIFY_GC(pGC, rid, client, SecurityUnknownAccess) #else /* not XCSECURITY */ #define VERIFY_DRAWABLE(pDraw, did, client)\ if (client->lastDrawableID == did)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ if (pDraw->type == UNDRAWABLE_WINDOW)\ return BadMatch;\ } #define VERIFY_GEOMETRABLE(pDraw, did, client)\ if (client->lastDrawableID == did)\ pDraw = client->lastDrawable;\ else \ {\ pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\ if (!pDraw) \ {\ client->errorValue = did; \ return BadDrawable;\ }\ } #define VERIFY_GC(pGC, rid, client)\ if (client->lastGCID == rid)\ pGC = client->lastGC;\ else\ pGC = (GC *)LookupIDByType(rid, RT_GC);\ if (!pGC)\ {\ client->errorValue = rid;\ return (BadGC);\ } #define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\ VERIFY_DRAWABLE(pDraw, did, client) #define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\ VERIFY_GEOMETRABLE(pDraw, did, client) #define SECURITY_VERIFY_GC(pGC, rid, client, mode)\ VERIFY_GC(pGC, rid, client) #endif /* XCSECURITY */ /* * We think that most hardware implementations of DBE will want * LookupID*(dbe_back_buffer_id) to return the window structure that the * id is a back buffer for. Since both front and back buffers will * return the same structure, you need to be able to distinguish * somewhere what kind of buffer (front/back) was being asked for, so * that ddx can render to the right place. That's the problem that the * following code solves. Note: we couldn't embed this in the LookupID* * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents * those functions by checking a one-element cache. That's why we're * mucking with VALIDATE_DRAWABLE_AND_GC. * * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window * structure will have two additional bits defined, srcBuffer and * dstBuffer, and their values will be maintained via the macros * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function * DbeValidateBuffer will be called any time the bits change to give you * a chance to do some setup. See the DBE code for more details on this * function. We put in these levels of conditionality so that you can do * just what you need to do, and no more. If neither of these defines * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will * be unchanged. dpw */ #if defined(NEED_DBE_BUF_BITS) #define SET_DBE_DSTBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE) #define SET_DBE_SRCBUF(_pDraw, _drawID) \ SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE) #if defined (NEED_DBE_BUF_VALIDATE) #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ int thisbuf = (_pDraw->id == _drawID);\ if (thisbuf != ((WindowPtr)_pDraw)->_whichBuffer)\ {\ ((WindowPtr)_pDraw)->_whichBuffer = thisbuf;\ DbeValidateBuffer((WindowPtr)_pDraw, _drawID, _dstbuf);\ }\ } #else /* want buffer bits, but don't need to call DbeValidateBuffer */ #define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ if (_pDraw->type == DRAWABLE_WINDOW)\ {\ ((WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\ } #endif /* NEED_DBE_BUF_VALIDATE */ #else /* don't want buffer bits in window */ #define SET_DBE_DSTBUF(_pDraw, _drawID) /**/ #define SET_DBE_SRCBUF(_pDraw, _drawID) /**/ #endif /* NEED_DBE_BUF_BITS */ #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ {\ SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, SecurityWriteAccess);\ SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityReadAccess);\ if ((pGC->depth != pDraw->depth) ||\ (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ client->lastDrawable = pDraw;\ client->lastDrawableID = drawID;\ client->lastGC = pGC;\ client->lastGCID = stuff->gc;\ }\ else\ {\ pGC = client->lastGC;\ pDraw = client->lastDrawable;\ }\ SET_DBE_DSTBUF(pDraw, drawID);\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); #define WriteReplyToClient(pClient, size, pReply) \ if ((pClient)->swapped) \ (*ReplySwapVector[((xReq *)(pClient)->requestBuffer)->reqType]) \ (pClient, (int)(size), pReply); \ else (void) WriteToClient(pClient, (int)(size), (char *)(pReply)); #define WriteSwappedDataToClient(pClient, size, pbuf) \ if ((pClient)->swapped) \ (*(pClient)->pSwapReplyFunc)(pClient, (int)(size), pbuf); \ else (void) WriteToClient (pClient, (int)(size), (char *)(pbuf)); typedef struct _TimeStamp *TimeStampPtr; #ifndef _XTYPEDEF_CLIENTPTR typedef struct _Client *ClientPtr; /* also in misc.h */ #define _XTYPEDEF_CLIENTPTR #endif typedef struct _WorkQueue *WorkQueuePtr; extern ClientPtr requestingClient; extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; #if !(defined(__alpha) || defined(__alpha__)) typedef long HWEventQueueType; #else typedef int HWEventQueueType; #endif typedef HWEventQueueType* HWEventQueuePtr; extern HWEventQueuePtr checkForInput[2]; typedef struct _TimeStamp { CARD32 months; /* really ~49.7 days */ CARD32 milliseconds; } TimeStamp; /* dispatch.c */ extern void SetInputCheck( #if NeedFunctionPrototypes HWEventQueuePtr /*c0*/, HWEventQueuePtr /*c1*/ #endif ); extern void CloseDownClient( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void UpdateCurrentTime( #if NeedFunctionPrototypes void #endif ); extern void UpdateCurrentTimeIf( #if NeedFunctionPrototypes void #endif ); extern void InitSelections( #if NeedFunctionPrototypes void #endif ); extern void FlushClientCaches( #if NeedFunctionPrototypes XID /*id*/ #endif ); extern int dixDestroyPixmap( #if NeedFunctionPrototypes pointer /*value*/, XID /*pid*/ #endif ); extern void CloseDownRetainedResources( #if NeedFunctionPrototypes void #endif ); extern void InitClient( #if NeedFunctionPrototypes ClientPtr /*client*/, int /*i*/, pointer /*ospriv*/ #endif ); extern ClientPtr NextAvailableClient( #if NeedFunctionPrototypes pointer /*ospriv*/ #endif ); extern void SendErrorToClient( #if NeedFunctionPrototypes ClientPtr /*client*/, unsigned int /*majorCode*/, unsigned int /*minorCode*/, XID /*resId*/, int /*errorCode*/ #endif ); extern void DeleteWindowFromAnySelections( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void MarkClientException( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern int GetGeometry( #if NeedFunctionPrototypes ClientPtr /*client*/, xGetGeometryReply* /* wa */ #endif ); /* dixutils.c */ extern void CopyISOLatin1Lowered( #if NeedFunctionPrototypes unsigned char * /*dest*/, unsigned char * /*source*/, int /*length*/ #endif ); #ifdef XCSECURITY extern WindowPtr SecurityLookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/ #endif ); extern pointer SecurityLookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/, Mask /*access_mode*/ #endif ); extern WindowPtr LookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern pointer LookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); #else extern WindowPtr LookupWindow( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern pointer LookupDrawable( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); #define SecurityLookupWindow(rid, client, access_mode) \ LookupWindow(rid, client) #define SecurityLookupDrawable(rid, client, access_mode) \ LookupDrawable(rid, client) #endif /* XCSECURITY */ extern ClientPtr LookupClient( #if NeedFunctionPrototypes XID /*rid*/, ClientPtr /*client*/ #endif ); extern void NoopDDA( #undef NeedVarargsPrototypes #if NeedVarargsPrototypes void *, ... #endif ); extern int AlterSaveSetForClient( #if NeedFunctionPrototypes ClientPtr /*client*/, WindowPtr /*pWin*/, unsigned /*mode*/ #endif ); extern void DeleteWindowFromAnySaveSet( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void BlockHandler( #if NeedFunctionPrototypes pointer /*pTimeout*/, pointer /*pReadmask*/ #endif ); extern void WakeupHandler( #if NeedFunctionPrototypes int /*result*/, pointer /*pReadmask*/ #endif ); typedef struct timeval ** OSTimePtr; typedef void (* BlockHandlerProcPtr)( #if NeedNestedPrototypes pointer /* blockData */, OSTimePtr /* pTimeout */, pointer /* pReadmask */ #endif ); typedef void (* WakeupHandlerProcPtr)( #if NeedNestedPrototypes pointer /* blockData */, int /* result */, pointer /* pReadmask */ #endif ); extern Bool RegisterBlockAndWakeupHandlers( #if NeedFunctionPrototypes BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, pointer /*blockData*/ #endif ); extern void RemoveBlockAndWakeupHandlers( #if NeedFunctionPrototypes BlockHandlerProcPtr /*blockHandler*/, WakeupHandlerProcPtr /*wakeupHandler*/, pointer /*blockData*/ #endif ); extern void InitBlockAndWakeupHandlers( #if NeedFunctionPrototypes void #endif ); extern void ProcessWorkQueue( #if NeedFunctionPrototypes void #endif ); extern Bool QueueWorkProc( #if NeedFunctionPrototypes Bool (* /*function*/)( #if NeedNestedPrototypes ClientPtr /*clientUnused*/, pointer /*closure*/ #endif ), ClientPtr /*client*/, pointer /*closure*/ #endif ); typedef Bool (* ClientSleepProcPtr)( #if NeedFunctionPrototypes ClientPtr /*client*/, pointer /*closure*/ #endif ); extern Bool ClientSleep( #if NeedFunctionPrototypes ClientPtr /*client*/, ClientSleepProcPtr /* function */, pointer /*closure*/ #endif ); extern Bool ClientSignal( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void ClientWakeup( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern Bool ClientIsAsleep( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); /* atom.c */ extern Atom MakeAtom( #if NeedFunctionPrototypes char * /*string*/, unsigned /*len*/, Bool /*makeit*/ #endif ); extern Bool ValidAtom( #if NeedFunctionPrototypes Atom /*atom*/ #endif ); extern char *NameForAtom( #if NeedFunctionPrototypes Atom /*atom*/ #endif ); extern void AtomError( #if NeedFunctionPrototypes void #endif ); extern void FreeAllAtoms( #if NeedFunctionPrototypes void #endif ); extern void InitAtoms( #if NeedFunctionPrototypes void #endif ); /* events.c */ extern void SetMaskForEvent( #if NeedFunctionPrototypes Mask /* mask */, int /* event */ #endif ); extern Bool PointerConfinedToScreen( #if NeedFunctionPrototypes void #endif ); extern Bool IsParent( #if NeedFunctionPrototypes WindowPtr /* maybeparent */, WindowPtr /* child */ #endif ); extern WindowPtr GetCurrentRootWindow( #if NeedFunctionPrototypes void #endif ); extern WindowPtr GetSpriteWindow( #if NeedFunctionPrototypes void #endif ); extern void GetSpritePosition( #if NeedFunctionPrototypes int * /* px */, int * /* py */ #endif ); extern void NoticeEventTime( #if NeedFunctionPrototypes xEventPtr /* xE */ #endif ); extern void EnqueueEvent( #if NeedFunctionPrototypes xEventPtr /* xE */, DeviceIntPtr /* device */, int /* count */ #endif ); extern void ComputeFreezes( #if NeedFunctionPrototypes void #endif ); extern void CheckGrabForSyncs( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, Bool /* thisMode */, Bool /* otherMode */ #endif ); extern void ActivatePointerGrab( #if NeedFunctionPrototypes DeviceIntPtr /* mouse */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* autoGrab */ #endif ); extern void DeactivatePointerGrab( #if NeedFunctionPrototypes DeviceIntPtr /* mouse */ #endif ); extern void ActivateKeyboardGrab( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, GrabPtr /* grab */, TimeStamp /* time */, Bool /* passive */ #endif ); extern void DeactivateKeyboardGrab( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */ #endif ); extern void AllowSome( #if NeedFunctionPrototypes ClientPtr /* client */, TimeStamp /* time */, DeviceIntPtr /* thisDev */, int /* newState */ #endif ); extern void ReleaseActiveGrabs( #if NeedFunctionPrototypes ClientPtr client #endif ); extern int DeliverEventsToWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, xEventPtr /* pEvents */, int /* count */, Mask /* filter */, GrabPtr /* grab */, int /* mskidx */ #endif ); extern int DeliverDeviceEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */, xEventPtr /* xE */, GrabPtr /* grab */, WindowPtr /* stopAt */, DeviceIntPtr /* dev */, int /* count */ #endif ); extern void DefineInitialRootWindow( #if NeedFunctionPrototypes WindowPtr /* win */ #endif ); extern void WindowHasNewCursor( #if NeedFunctionPrototypes WindowPtr /* pWin */ #endif ); extern Bool CheckDeviceGrabs( #if NeedFunctionPrototypes DeviceIntPtr /* device */, xEventPtr /* xE */, int /* checkFirst */, int /* count */ #endif ); extern void DeliverFocusedEvent( #if NeedFunctionPrototypes DeviceIntPtr /* keybd */, xEventPtr /* xE */, WindowPtr /* window */, int /* count */ #endif ); extern void DeliverGrabbedEvent( #if NeedFunctionPrototypes xEventPtr /* xE */, DeviceIntPtr /* thisDev */, Bool /* deactivateGrab */, int /* count */ #endif ); extern void RecalculateDeliverableEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */ #endif ); extern int OtherClientGone( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); extern void DoFocusEvents( #if NeedFunctionPrototypes DeviceIntPtr /* dev */, WindowPtr /* fromWin */, WindowPtr /* toWin */, int /* mode */ #endif ); extern int SetInputFocus( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, Window /* focusID */, CARD8 /* revertTo */, Time /* ctime */, Bool /* followOK */ #endif ); extern int GrabDevice( #if NeedFunctionPrototypes ClientPtr /* client */, DeviceIntPtr /* dev */, unsigned /* this_mode */, unsigned /* other_mode */, Window /* grabWindow */, unsigned /* ownerEvents */, Time /* ctime */, Mask /* mask */, CARD8 * /* status */ #endif ); extern void InitEvents( #if NeedFunctionPrototypes void #endif ); extern void DeleteWindowFromAnyEvents( #if NeedFunctionPrototypes WindowPtr /* pWin */, Bool /* freeResources */ #endif ); extern void CheckCursorConfinement( #if NeedFunctionPrototypes WindowPtr /* pWin */ #endif ); extern Mask EventMaskForClient( #if NeedFunctionPrototypes WindowPtr /* pWin */, ClientPtr /* client */ #endif ); extern int DeliverEvents( #if NeedFunctionPrototypes WindowPtr /*pWin*/, xEventPtr /*xE*/, int /*count*/, WindowPtr /*otherParent*/ #endif ); extern void WriteEventsToClient( #if NeedFunctionPrototypes ClientPtr /*pClient*/, int /*count*/, xEventPtr /*events*/ #endif ); extern int TryClientEvents( #if NeedFunctionPrototypes ClientPtr /*client*/, xEventPtr /*pEvents*/, int /*count*/, Mask /*mask*/, Mask /*filter*/, GrabPtr /*grab*/ #endif ); extern int EventSelectForWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/, Mask /*mask*/ #endif ); extern int EventSuppressForWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/, Mask /*mask*/, Bool * /*checkOptional*/ #endif ); extern int MaybeDeliverEventsToClient( #if NeedFunctionPrototypes WindowPtr /*pWin*/, xEventPtr /*pEvents*/, int /*count*/, Mask /*filter*/, ClientPtr /*dontClient*/ #endif ); extern void WindowsRestructured( #if NeedFunctionPrototypes void #endif ); extern void ResetClientPrivates( #if NeedFunctionPrototypes void #endif ); extern int AllocateClientPrivateIndex( #if NeedFunctionPrototypes void #endif ); extern Bool AllocateClientPrivate( #if NeedFunctionPrototypes int /*index*/, unsigned /*amount*/ #endif ); /* * callback manager stuff */ #ifndef _XTYPEDEF_CALLBACKLISTPTR typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ #define _XTYPEDEF_CALLBACKLISTPTR #endif typedef void (*CallbackProcPtr) ( #if NeedNestedPrototypes CallbackListPtr *, pointer, pointer #endif ); typedef Bool (*AddCallbackProcPtr) ( #if NeedNestedPrototypes CallbackListPtr *, CallbackProcPtr, pointer #endif ); typedef Bool (*DeleteCallbackProcPtr) ( #if NeedNestedPrototypes CallbackListPtr *, CallbackProcPtr, pointer #endif ); typedef void (*CallCallbacksProcPtr) ( #if NeedNestedPrototypes CallbackListPtr *, pointer #endif ); typedef void (*DeleteCallbackListProcPtr) ( #if NeedNestedPrototypes CallbackListPtr * #endif ); typedef struct _CallbackProcs { AddCallbackProcPtr AddCallback; DeleteCallbackProcPtr DeleteCallback; CallCallbacksProcPtr CallCallbacks; DeleteCallbackListProcPtr DeleteCallbackList; } CallbackFuncsRec, *CallbackFuncsPtr; extern Bool CreateCallbackList( #if NeedFunctionPrototypes CallbackListPtr * /*pcbl*/, CallbackFuncsPtr /*cbfuncs*/ #endif ); extern Bool AddCallback( #if NeedFunctionPrototypes CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, pointer /*data*/ #endif ); extern Bool DeleteCallback( #if NeedFunctionPrototypes CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, pointer /*data*/ #endif ); extern void CallCallbacks( #if NeedFunctionPrototypes CallbackListPtr * /*pcbl*/, pointer /*call_data*/ #endif ); extern void DeleteCallbackList( #if NeedFunctionPrototypes CallbackListPtr * /*pcbl*/ #endif ); extern void InitCallbackManager( #if NeedFunctionPrototypes void #endif ); /* * ServerGrabCallback stuff */ extern CallbackListPtr ServerGrabCallback; typedef enum {SERVER_GRABBED, SERVER_UNGRABBED, CLIENT_PERVIOUS, CLIENT_IMPERVIOUS } ServerGrabState; typedef struct { ClientPtr client; ServerGrabState grabstate; } ServerGrabInfoRec; /* * EventCallback stuff */ extern CallbackListPtr EventCallback; typedef struct { ClientPtr client; xEventPtr events; int count; } EventInfoRec; /* * DeviceEventCallback stuff */ extern CallbackListPtr DeviceEventCallback; typedef struct { xEventPtr events; int count; } DeviceEventInfoRec; #endif /* DIX_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/selection.h0100664000076400007640000000532607120677563022502 0ustar constconst/* $XConsortium: selection.h,v 1.3 94/04/17 20:26:07 jim Exp $ */ #ifndef SELECTION_H #define SELECTION_H 1 /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "dixstruct.h" /* * * Selection data structures */ typedef struct _Selection { Atom selection; TimeStamp lastTimeChanged; Window window; WindowPtr pWin; ClientPtr client; } Selection; #endif /* SELECTION_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/pixmapstr.h0100664000076400007640000000641407120677563022543 0ustar constconst/* $XConsortium: pixmapstr.h,v 5.6 94/04/17 20:25:54 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef PIXMAPSTRUCT_H #define PIXMAPSTRUCT_H #include "pixmap.h" #include "screenint.h" #include "miscstruct.h" typedef struct _Drawable { unsigned char type; /* DRAWABLE_ */ unsigned char class; /* specific to type */ unsigned char depth; unsigned char bitsPerPixel; unsigned long id; /* resource id */ short x; /* window: screen absolute, pixmap: 0 */ short y; /* window: screen absolute, pixmap: 0 */ unsigned short width; unsigned short height; ScreenPtr pScreen; unsigned long serialNumber; } DrawableRec; /* * PIXMAP -- device dependent */ typedef struct _Pixmap { DrawableRec drawable; int refcnt; int devKind; DevUnion devPrivate; #ifdef PIXPRIV DevUnion *devPrivates; /* real devPrivates like gcs & windows */ #endif } PixmapRec; #endif /* PIXMAPSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/include/inputstr.h0100664000076400007640000002271407120677563022405 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: inputstr.h /main/28 1996/09/25 00:51:24 dpw $ */ #ifndef INPUTSTRUCT_H #define INPUTSTRUCT_H #include "input.h" #include "window.h" #include "dixstruct.h" #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) #define SameClient(obj,client) \ (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) #define MAX_DEVICES 9 #define EMASKSIZE MAX_DEVICES /* Kludge: OtherClients and InputClients must be compatible, see code */ typedef struct _OtherClients { OtherClientsPtr next; XID resource; /* id for putting into resource manager */ Mask mask; } OtherClients; typedef struct _InputClients { InputClientsPtr next; XID resource; /* id for putting into resource manager */ Mask mask[EMASKSIZE]; } InputClients; typedef struct _OtherInputMasks { Mask deliverableEvents[EMASKSIZE]; Mask inputEvents[EMASKSIZE]; Mask dontPropagateMask[EMASKSIZE]; InputClientsPtr inputClients; } OtherInputMasks; /* * The following structure gets used for both active and passive grabs. For * active grabs some of the fields (e.g. modifiers) are not used. However, * that is not much waste since there aren't many active grabs (one per * keyboard/pointer device) going at once in the server. */ #define MasksPerDetailMask 8 /* 256 keycodes and 256 possible modifier combinations, but only 3 buttons. */ typedef struct _DetailRec { /* Grab details may be bit masks */ unsigned short exact; Mask *pMask; } DetailRec; typedef struct _GrabRec { GrabPtr next; /* for chain of passive grabs */ XID resource; DeviceIntPtr device; WindowPtr window; unsigned ownerEvents:1; unsigned keyboardMode:1; unsigned pointerMode:1; unsigned coreGrab:1; /* grab is on core device */ unsigned coreMods:1; /* modifiers are on core keyboard */ CARD8 type; /* event type */ DetailRec modifiersDetail; DeviceIntPtr modifierDevice; DetailRec detail; /* key or button */ WindowPtr confineTo; /* always NULL for keyboards */ CursorPtr cursor; /* always NULL for keyboards */ Mask eventMask; } GrabRec; typedef struct _KeyClassRec { CARD8 down[DOWN_LENGTH]; KeyCode *modifierKeyMap; KeySymsRec curKeySyms; int modifierKeyCount[8]; CARD8 modifierMap[MAP_LENGTH]; CARD8 maxKeysPerModifier; unsigned short state; unsigned short prev_state; #ifdef XKB struct _XkbSrvInfo *xkbInfo; #endif } KeyClassRec, *KeyClassPtr; typedef struct _AxisInfo { int resolution; int min_resolution; int max_resolution; int min_value; int max_value; } AxisInfo, *AxisInfoPtr; typedef struct _ValuatorClassRec { ValuatorMotionProcPtr GetMotionProc; int numMotionEvents; WindowPtr motionHintWindow; AxisInfoPtr axes; unsigned short numAxes; int *axisVal; CARD8 mode; } ValuatorClassRec, *ValuatorClassPtr; typedef struct _ButtonClassRec { CARD8 numButtons; CARD8 buttonsDown; /* number of buttons currently down */ unsigned short state; Mask motionMask; CARD8 down[DOWN_LENGTH]; CARD8 map[MAP_LENGTH]; #ifdef XKB union _XkbAction * xkb_acts; #endif } ButtonClassRec, *ButtonClassPtr; typedef struct _FocusClassRec { WindowPtr win; int revert; TimeStamp time; WindowPtr *trace; int traceSize; int traceGood; } FocusClassRec, *FocusClassPtr; typedef struct _ProximityClassRec { char pad; } ProximityClassRec, *ProximityClassPtr; typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr; typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr; typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr; typedef struct _StringFeedbackClassRec *StringFeedbackPtr; typedef struct _BellFeedbackClassRec *BellFeedbackPtr; typedef struct _LedFeedbackClassRec *LedFeedbackPtr; typedef struct _KbdFeedbackClassRec { BellProcPtr BellProc; KbdCtrlProcPtr CtrlProc; KeybdCtrl ctrl; KbdFeedbackPtr next; #ifdef XKB struct _XkbSrvLedInfo *xkb_sli; #endif } KbdFeedbackClassRec; typedef struct _PtrFeedbackClassRec { PtrCtrlProcPtr CtrlProc; PtrCtrl ctrl; PtrFeedbackPtr next; } PtrFeedbackClassRec; typedef struct _IntegerFeedbackClassRec { IntegerCtrlProcPtr CtrlProc; IntegerCtrl ctrl; IntegerFeedbackPtr next; } IntegerFeedbackClassRec; typedef struct _StringFeedbackClassRec { StringCtrlProcPtr CtrlProc; StringCtrl ctrl; StringFeedbackPtr next; } StringFeedbackClassRec; typedef struct _BellFeedbackClassRec { BellProcPtr BellProc; BellCtrlProcPtr CtrlProc; BellCtrl ctrl; BellFeedbackPtr next; } BellFeedbackClassRec; typedef struct _LedFeedbackClassRec { LedCtrlProcPtr CtrlProc; LedCtrl ctrl; LedFeedbackPtr next; #ifdef XKB struct _XkbSrvLedInfo *xkb_sli; #endif } LedFeedbackClassRec; /* states for devices */ #define NOT_GRABBED 0 #define THAWED 1 #define THAWED_BOTH 2 /* not a real state */ #define FREEZE_NEXT_EVENT 3 #define FREEZE_BOTH_NEXT_EVENT 4 #define FROZEN 5 /* any state >= has device frozen */ #define FROZEN_NO_EVENT 5 #define FROZEN_WITH_EVENT 6 #define THAW_OTHERS 7 typedef struct _DeviceIntRec { DeviceRec public; DeviceIntPtr next; TimeStamp grabTime; Bool startup; /* true if needs to be turned on at server intialization time */ DeviceProc deviceProc; /* proc(DevicePtr, DEVICE_xx). It is used to initialize, turn on, or turn off the device */ Bool inited; /* TRUE if INIT returns Success */ GrabPtr grab; /* the grabber - used by DIX */ struct { Bool frozen; int state; GrabPtr other; /* if other grab has this frozen */ xEvent *event; /* saved to be replayed */ int evcount; } sync; Atom type; char *name; CARD8 id; CARD8 activatingKey; Bool fromPassiveGrab; GrabRec activeGrab; void (*ActivateGrab) ( #if NeedNestedPrototypes DeviceIntPtr /*device*/, GrabPtr /*grab*/, TimeStamp /*time*/, Bool /*autoGrab*/ #endif ); void (*DeactivateGrab)( #if NeedNestedPrototypes DeviceIntPtr /*device*/ #endif ); KeyClassPtr key; ValuatorClassPtr valuator; ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; StringFeedbackPtr stringfeed; BellFeedbackPtr bell; LedFeedbackPtr leds; #ifdef XKB struct _XkbInterest * xkb_interest; #endif } DeviceIntRec; typedef struct { int numDevices; /* total number of devices */ DeviceIntPtr devices; /* all devices turned on */ DeviceIntPtr off_devices; /* all devices turned off */ DeviceIntPtr keyboard; /* the main one for the server */ DeviceIntPtr pointer; } InputInfo; extern InputInfo inputInfo; /* for keeping the events for devices grabbed synchronously */ typedef struct _QdEvent *QdEventPtr; typedef struct _QdEvent { QdEventPtr next; DeviceIntPtr device; ScreenPtr pScreen; /* what screen the pointer was on */ unsigned long months; /* milliseconds is in the event */ xEvent *event; int evcount; } QdEventRec; #endif /* INPUTSTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/dix/0040775000076400007640000000000010616336470017473 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/dix/dispatch.c0100664000076400007640000031233007120677563021444 0ustar constconst/* $XConsortium: dispatch.c /main/195 1996/12/15 21:24:40 rws $ */ /* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.7 1996/12/23 06:29:38 dawes Exp $ */ /************************************************************ Copyright (c) 1987, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #include "windowstr.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "selection.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "opaque.h" #include "input.h" #include "servermd.h" #include "extnsionst.h" #include "dixfont.h" #include "dispatch.h" #include "swaprep.h" #include "swapreq.h" #include "dixevents.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #ifdef XAPPGROUP #include "extensions/Xagsrv.h" #endif #define mskcnt ((MAXCLIENTS + 31) / 32) #define BITMASK(i) (1 << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) #define MASKWORD(buf, i) buf[MASKIDX(i)] #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) extern WindowPtr *WindowTable; extern xConnSetupPrefix connSetupPrefix; extern char *ConnectionInfo; Selection *CurrentSelections; int NumCurrentSelections; extern CARD32 defaultScreenSaverTime; extern CARD32 defaultScreenSaverInterval; extern int defaultScreenSaverBlanking; extern int defaultScreenSaverAllowExposures; static ClientPtr grabClient; #define GrabNone 0 #define GrabActive 1 #define GrabKickout 2 static int grabState = GrabNone; static long grabWaiters[mskcnt]; CallbackListPtr ServerGrabCallback = NULL; HWEventQueuePtr checkForInput[2]; extern int connBlockScreenStart; #ifdef XKB extern Bool noXkbExtension; #endif static void KillAllClients( #if NeedFunctionPrototypes void #endif ); static void DeleteClientFromAnySelections( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); #ifdef LBX extern unsigned long StandardRequestLength(); #endif static int nextFreeClientID; /* always MIN free client ID */ static int nClients; /* number of authorized clients */ CallbackListPtr ClientStateCallback; char dispatchException = 0; char isItTimeToYield; /* Various of the DIX function interfaces were not designed to allow * the client->errorValue to be set on BadValue and other errors. * Rather than changing interfaces and breaking untold code we introduce * a new global that dispatch can use. */ XID clientErrorValue; /* XXX this is a kludge */ #define SAME_SCREENS(a, b) (\ (a.pScreen == b.pScreen)) void SetInputCheck(c0, c1) HWEventQueuePtr c0, c1; { checkForInput[0] = c0; checkForInput[1] = c1; } void UpdateCurrentTime() { TimeStamp systime; /* To avoid time running backwards, we must call GetTimeInMillis before * calling ProcessInputEvents. */ systime.months = currentTime.months; systime.milliseconds = GetTimeInMillis(); if (systime.milliseconds < currentTime.milliseconds) systime.months++; if (*checkForInput[0] != *checkForInput[1]) ProcessInputEvents(); if (CompareTimeStamps(systime, currentTime) == LATER) currentTime = systime; } /* Like UpdateCurrentTime, but can't call ProcessInputEvents */ void UpdateCurrentTimeIf() { TimeStamp systime; systime.months = currentTime.months; systime.milliseconds = GetTimeInMillis(); if (systime.milliseconds < currentTime.milliseconds) systime.months++; if (*checkForInput[0] == *checkForInput[1]) currentTime = systime; } void InitSelections() { if (CurrentSelections) xfree(CurrentSelections); CurrentSelections = (Selection *)NULL; NumCurrentSelections = 0; } void FlushClientCaches(id) XID id; { int i; register ClientPtr client; client = clients[CLIENT_ID(id)]; if (client == NullClient) return ; for (i=0; ilastDrawableID == id) { client->lastDrawableID = WindowTable[0]->drawable.id; client->lastDrawable = (DrawablePtr)WindowTable[0]; } else if (client->lastGCID == id) { client->lastGCID = INVALID; client->lastGC = (GCPtr)NULL; } } } } #define MAJOROP ((xReq *)client->requestBuffer)->reqType void Dispatch() { register int *clientReady; /* array of request ready clients */ register int result; register ClientPtr client; register int nready; register HWEventQueuePtr* icheck = checkForInput; nextFreeClientID = 1; InitSelections(); nClients = 0; clientReady = (int *) ALLOCATE_LOCAL(sizeof(int) * MaxClients); if (!clientReady) return; while (!dispatchException) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } nready = WaitForSomething(clientReady); /***************** * Handle events in round robin fashion, doing input between * each round *****************/ while (!dispatchException && (--nready >= 0)) { client = clients[clientReady[nready]]; if (! client) { /* KillClient can cause this to happen */ continue; } /* GrabServer activation can cause this to be true */ if (grabState == GrabKickout) { grabState = GrabActive; break; } isItTimeToYield = FALSE; requestingClient = client; while (!isItTimeToYield) { if (*icheck[0] != *icheck[1]) { ProcessInputEvents(); FlushIfCriticalOutputPending(); } /* now, finally, deal with client requests */ result = ReadRequestFromClient(client); if (result <= 0) { if (result < 0) CloseDownClient(client); break; } client->sequence++; #ifdef DEBUG if (client->requestLogIndex == MAX_REQUEST_LOG) client->requestLogIndex = 0; client->requestLog[client->requestLogIndex] = MAJOROP; client->requestLogIndex++; #endif if (result > (MAX_BIG_REQUEST_SIZE << 2)) result = BadLength; else result = (* client->requestVector[MAJOROP])(client); if (result != Success) { if (client->noClientException != Success) CloseDownClient(client); else SendErrorToClient(client, MAJOROP, MinorOpcodeOfRequest(client), client->errorValue, result); break; } } FlushAllOutput(); requestingClient = NULL; } dispatchException &= ~DE_PRIORITYCHANGE; } KillAllClients(); DEALLOCATE_LOCAL(clientReady); dispatchException &= ~DE_RESET; } #undef MAJOROP /*ARGSUSED*/ int ProcBadRequest(client) ClientPtr client; { return (BadRequest); } int ProcCreateWindow(client) register ClientPtr client; { register WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); int result; int len; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, SecurityWriteAccess))) return BadWindow; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } pWin = CreateWindow(stuff->wid, pParent, stuff->x, stuff->y, stuff->width, stuff->height, stuff->borderWidth, stuff->class, stuff->mask, (XID *) &stuff[1], (int)stuff->depth, client, stuff->visual, &result); if (pWin) { Mask mask = pWin->eventMask; pWin->eventMask = 0; /* subterfuge in case AddResource fails */ if (!AddResource(stuff->wid, RT_WINDOW, (pointer)pWin)) return BadAlloc; pWin->eventMask = mask; } if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcChangeWindowAttributes(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); register int result; int len; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (len != Ones(stuff->valueMask)) return BadLength; result = ChangeWindowAttributes(pWin, stuff->valueMask, (XID *) &stuff[1], client); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcGetWindowAttributes(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); xGetWindowAttributesReply wa; REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); GetWindowAttributes(pWin, client, &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); return(client->noClientException); } int ProcDestroyWindow(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityDestroyAccess); if (!pWin) return(BadWindow); if (pWin->parent) FreeResource(stuff->id, RT_NONE); return(client->noClientException); } int ProcDestroySubwindows(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityDestroyAccess); if (!pWin) return(BadWindow); DestroySubwindows(pWin, client); return(client->noClientException); } int ProcChangeSaveSet(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xChangeSaveSetReq); register int result; REQUEST_SIZE_MATCH(xChangeSaveSetReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityReadAccess); if (!pWin) return(BadWindow); if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) { result = AlterSaveSetForClient(client, pWin, stuff->mode); if (client->noClientException != Success) return(client->noClientException); else return(result); } else { client->errorValue = stuff->mode; return( BadValue ); } } int ProcReparentWindow(client) register ClientPtr client; { register WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); register int result; REQUEST_SIZE_MATCH(xReparentWindowReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, SecurityWriteAccess); if (!pParent) return(BadWindow); if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && (pParent->drawable.depth != pWin->drawable.depth)) return BadMatch; if ((pWin->drawable.class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; result = ReparentWindow(pWin, pParent, (short)stuff->x, (short)stuff->y, client); if (client->noClientException != Success) return(client->noClientException); else return(result); } else return (BadMatch); } int ProcMapWindow(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int ProcMapSubwindows(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); } int ProcUnmapWindow(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException); } int ProcUnmapSubwindows(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); UnmapSubwindows(pWin); return(client->noClientException); } int ProcConfigureWindow(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xConfigureWindowReq); register int result; int len; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; result = ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcCirculateWindow(client) register ClientPtr client; { register WindowPtr pWin; REQUEST(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) { client->errorValue = stuff->direction; return BadValue; } pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException); } int GetGeometry(client, rep) register ClientPtr client; xGetGeometryReply *rep; { register DrawablePtr pDraw; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess); rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id; rep->depth = pDraw->depth; rep->width = pDraw->width; rep->height = pDraw->height; /* XXX - Because the pixmap-implementation of the multibuffer extension * may have the buffer-id's drawable resource value be a pointer * to the buffer's window instead of the buffer itself * (this happens if the buffer is the displayed buffer), * we also have to check that the id matches before we can * truly say that it is a DRAWABLE_WINDOW. */ if ((pDraw->type == UNDRAWABLE_WINDOW) || ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) { register WindowPtr pWin = (WindowPtr)pDraw; rep->x = pWin->origin.x - wBorderWidth (pWin); rep->y = pWin->origin.y - wBorderWidth (pWin); rep->borderWidth = pWin->borderWidth; } else /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */ { rep->x = rep->y = rep->borderWidth = 0; } return Success; } int ProcGetGeometry(client) register ClientPtr client; { xGetGeometryReply rep; int status; if ((status = GetGeometry(client, &rep)) != Success) return status; WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); return(client->noClientException); } int ProcQueryTree(client) register ClientPtr client; { xQueryTreeReply reply; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); reply.type = X_Reply; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.sequenceNumber = client->sequence; if (pWin->parent) reply.parent = pWin->parent->drawable.id; else reply.parent = (Window)None; pHead = RealChildHead(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) numChildren++; if (numChildren) { int curChild = 0; childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) childIDs[curChild++] = pChild->drawable.id; } reply.nChildren = numChildren; reply.length = (numChildren * sizeof(Window)) >> 2; WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply); if (numChildren) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); DEALLOCATE_LOCAL(childIDs); } return(client->noClientException); } int ProcInternAtom(client) register ClientPtr client; { Atom atom; char *tchar; REQUEST(xInternAtomReq); REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes); if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) { client->errorValue = stuff->onlyIfExists; return(BadValue); } tchar = (char *) &stuff[1]; atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists); if (atom != BAD_RESOURCE) { xInternAtomReply reply; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.atom = atom; WriteReplyToClient(client, sizeof(xInternAtomReply), &reply); return(client->noClientException); } else return (BadAlloc); } int ProcGetAtomName(client) register ClientPtr client; { char *str; xGetAtomNameReply reply; int len; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if ( (str = NameForAtom(stuff->id)) ) { len = strlen(str); reply.type = X_Reply; reply.length = (len + 3) >> 2; reply.sequenceNumber = client->sequence; reply.nameLength = len; WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply); (void)WriteToClient(client, len, str); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); } } #ifdef K5AUTH extern int k5_bad(); #endif int ProcSetSelectionOwner(client) register ClientPtr client; { WindowPtr pWin; TimeStamp time; REQUEST(xSetSelectionOwnerReq); REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); /* If the client's time stamp is in the future relative to the server's time stamp, do not set the selection, just return success. */ if (CompareTimeStamps(time, currentTime) == LATER) return Success; if (stuff->window != None) { pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityReadAccess); if (!pWin) return(BadWindow); } else pWin = (WindowPtr)None; if (ValidAtom(stuff->selection)) { int i = 0; /* * First, see if the selection is already set... */ while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if (i < NumCurrentSelections) { xEvent event; /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return success. */ if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged) == EARLIER) return Success; if (CurrentSelections[i].client && (!pWin || (CurrentSelections[i].client != client))) { event.u.u.type = SelectionClear; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = CurrentSelections[i].window; event.u.selectionClear.atom = CurrentSelections[i].selection; (void) TryClientEvents (CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); } } else { /* * It doesn't exist, so add it... */ Selection *newsels; if (i == 0) newsels = (Selection *)xalloc(sizeof(Selection)); else newsels = (Selection *)xrealloc(CurrentSelections, (NumCurrentSelections + 1) * sizeof(Selection)); if (!newsels) return BadAlloc; NumCurrentSelections++; CurrentSelections = newsels; CurrentSelections[i].selection = stuff->selection; } CurrentSelections[i].lastTimeChanged = time; CurrentSelections[i].window = stuff->window; CurrentSelections[i].pWin = pWin; CurrentSelections[i].client = (pWin ? client : NullClient); return (client->noClientException); } else { client->errorValue = stuff->selection; return (BadAtom); } } int ProcGetSelectionOwner(client) register ClientPtr client; { REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if (ValidAtom(stuff->id)) { int i; xGetSelectionOwnerReply reply; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->id) i++; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; if (i < NumCurrentSelections) reply.owner = CurrentSelections[i].window; else reply.owner = None; WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); } } int ProcConvertSelection(client) register ClientPtr client; { Bool paramsOkay; xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, SecurityReadAccess); if (!pWin) return(BadWindow); paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) paramsOkay &= ValidAtom(stuff->property); if (paramsOkay) { int i; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if ((i < NumCurrentSelections) && (CurrentSelections[i].window != None) #ifdef XCSECURITY && (!client->CheckAccess || (* client->CheckAccess)(client, CurrentSelections[i].window, RT_WINDOW, SecurityReadAccess, CurrentSelections[i].pWin)) #endif ) { event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.owner = CurrentSelections[i].window; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; if (TryClientEvents( CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab)) return (client->noClientException); } event.u.u.type = SelectionNotify; event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; (void) TryClientEvents(client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); return (client->noClientException); } else { client->errorValue = stuff->property; return (BadAtom); } } int ProcGrabServer(client) register ClientPtr client; { REQUEST_SIZE_MATCH(xReq); if (grabState != GrabNone && client != grabClient) { ResetCurrentRequest(client); client->sequence--; BITSET(grabWaiters, client->index); IgnoreClient(client); return(client->noClientException); } OnlyListenToOneClient(client); grabState = GrabKickout; grabClient = client; if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = SERVER_GRABBED; CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo); } return(client->noClientException); } static void #if NeedFunctionPrototypes UngrabServer(ClientPtr client) #else UngrabServer(client) ClientPtr client; #endif { int i; grabState = GrabNone; ListenToAllClients(); for (i = mskcnt; --i >= 0 && !grabWaiters[i]; ) ; if (i >= 0) { i <<= 5; while (!GETBIT(grabWaiters, i)) i++; BITCLEAR(grabWaiters, i); AttendClient(clients[i]); } if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = SERVER_UNGRABBED; CallCallbacks(&ServerGrabCallback, (pointer)&grabinfo); } } int ProcUngrabServer(client) register ClientPtr client; { REQUEST_SIZE_MATCH(xReq); UngrabServer(client); return(client->noClientException); } int ProcTranslateCoords(client) register ClientPtr client; { REQUEST(xTranslateCoordsReq); register WindowPtr pWin, pDst; xTranslateCoordsReply rep; REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, SecurityReadAccess); if (!pWin) return(BadWindow); pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); if (!pDst) return(BadWindow); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) { rep.sameScreen = xFalse; rep.child = None; rep.dstX = rep.dstY = 0; } else { INT16 x, y; rep.sameScreen = xTrue; rep.child = None; /* computing absolute coordinates -- adjust to destination later */ x = pWin->drawable.x + stuff->srcX; y = pWin->drawable.y + stuff->srcY; pWin = pDst->firstChild; while (pWin) { #ifdef SHAPE BoxRec box; #endif if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && (x < pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin)) && (y >= pWin->drawable.y - wBorderWidth (pWin)) && (y < pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin)) #ifdef SHAPE /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box)) #endif ) { rep.child = pWin->drawable.id; pWin = (WindowPtr) NULL; } else pWin = pWin->nextSib; } /* adjust to destination coordinates */ rep.dstX = x - pDst->drawable.x; rep.dstY = y - pDst->drawable.y; } WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); return(client->noClientException); } int ProcOpenFont(client) register ClientPtr client; { int err; REQUEST(xOpenFontReq); REQUEST_FIXED_SIZE(xOpenFontReq, stuff->nbytes); client->errorValue = stuff->fid; LEGAL_NEW_RESOURCE(stuff->fid, client); err = OpenFont(client, stuff->fid, (Mask) 0, stuff->nbytes, (char *)&stuff[1]); if (err == Success) { return(client->noClientException); } else return err; } int ProcCloseFont(client) register ClientPtr client; { FontPtr pFont; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, SecurityDestroyAccess); if ( pFont != (FontPtr)NULL) /* id was valid */ { FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadFont); } } int ProcQueryFont(client) register ClientPtr client; { xQueryFontReply *reply; FontPtr pFont; register GC *pGC; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, SecurityReadAccess); if (!pFont) { /* can't use VERIFY_GC because it might return BadGC */ pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, SecurityReadAccess); if (!pGC) { client->errorValue = stuff->id; return(BadFont); /* procotol spec says only error is BadFont */ } pFont = pGC->font; } { xCharInfo *pmax = FONTINKMAX(pFont); xCharInfo *pmin = FONTINKMIN(pFont); int nprotoxcistructs; int rlength; nprotoxcistructs = ( pmax->rightSideBearing == pmin->rightSideBearing && pmax->leftSideBearing == pmin->leftSideBearing && pmax->descent == pmin->descent && pmax->ascent == pmin->ascent && pmax->characterWidth == pmin->characterWidth) ? 0 : N2dChars(pFont); rlength = sizeof(xQueryFontReply) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); reply = (xQueryFontReply *)ALLOCATE_LOCAL(rlength); if(!reply) { return(BadAlloc); } reply->type = X_Reply; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->sequenceNumber = client->sequence; QueryFont( pFont, reply, nprotoxcistructs); WriteReplyToClient(client, rlength, reply); DEALLOCATE_LOCAL(reply); return(client->noClientException); } } int ProcQueryTextExtents(client) register ClientPtr client; { REQUEST(xQueryTextExtentsReq); xQueryTextExtentsReply reply; FontPtr pFont; GC *pGC; ExtentInfoRec info; unsigned long length; REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, SecurityReadAccess); if (!pFont) { pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, SecurityReadAccess); if (!pGC) { client->errorValue = stuff->fid; return(BadFont); } pFont = pGC->font; } length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2); length = length << 1; if (stuff->oddLength) { if (length == 0) return(BadLength); length--; } if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info)) return(BadAlloc); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.drawDirection = info.drawDirection; reply.fontAscent = info.fontAscent; reply.fontDescent = info.fontDescent; reply.overallAscent = info.overallAscent; reply.overallDescent = info.overallDescent; reply.overallWidth = info.overallWidth; reply.overallLeft = info.overallLeft; reply.overallRight = info.overallRight; WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply); return(client->noClientException); } int ProcListFonts(client) register ClientPtr client; { REQUEST(xListFontsReq); REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes); return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes, stuff->maxNames); } int ProcListFontsWithInfo(client) register ClientPtr client; { REQUEST(xListFontsWithInfoReq); REQUEST_FIXED_SIZE(xListFontsWithInfoReq, stuff->nbytes); return StartListFontsWithInfo(client, stuff->nbytes, (unsigned char *) &stuff[1], stuff->maxNames); } /*ARGSUSED*/ int dixDestroyPixmap(value, pid) pointer value; /* must conform to DeleteType */ XID pid; { PixmapPtr pPixmap = (PixmapPtr)value; return (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); } int ProcCreatePixmap(client) register ClientPtr client; { PixmapPtr pMap; register DrawablePtr pDraw; REQUEST(xCreatePixmapReq); DepthPtr pDepth; register int i; REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; LEGAL_NEW_RESOURCE(stuff->pid, client); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, SecurityReadAccess); if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i=0; ipScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: pMap = (PixmapPtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, stuff->width, stuff->height, stuff->depth); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) return(client->noClientException); } return (BadAlloc); } int ProcFreePixmap(client) register ClientPtr client; { PixmapPtr pMap; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, SecurityDestroyAccess); if (pMap) { FreeResource(stuff->id, RT_NONE); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadPixmap); } } int ProcCreateGC(client) register ClientPtr client; { int error; GC *pGC; register DrawablePtr pDraw; unsigned len; REQUEST(xCreateGCReq); REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client, SecurityReadAccess); len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error); if (error != Success) return error; if (!AddResource(stuff->gc, RT_GC, (pointer)pGC)) return (BadAlloc); return(client->noClientException); } int ProcChangeGC(client) register ClientPtr client; { GC *pGC; REQUEST(xChangeGCReq); int result; unsigned len; REQUEST_AT_LEAST_SIZE(xChangeGCReq); SECURITY_VERIFY_GC(pGC, stuff->gc, client, SecurityWriteAccess); len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcCopyGC(client) register ClientPtr client; { register GC *dstGC; register GC *pGC; int result; REQUEST(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq); SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, SecurityReadAccess); SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, SecurityWriteAccess); if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) return (BadMatch); result = CopyGC(pGC, dstGC, stuff->mask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcSetDashes(client) register ClientPtr client; { register GC *pGC; int result; REQUEST(xSetDashesReq); REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); if (stuff->nDashes == 0) { client->errorValue = 0; return BadValue; } SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes, (unsigned char *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(result); } } int ProcSetClipRectangles(client) register ClientPtr client; { int nr; int result; register GC *pGC; REQUEST(xSetClipRectanglesReq); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) && (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) { client->errorValue = stuff->ordering; return BadValue; } SECURITY_VERIFY_GC(pGC,stuff->gc, client, SecurityWriteAccess); nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq); if (nr & 4) return(BadLength); nr >>= 3; result = SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *)&stuff[1], (int)stuff->ordering); if (client->noClientException != Success) return(client->noClientException); else return(result); } int ProcFreeGC(client) register ClientPtr client; { register GC *pGC; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); SECURITY_VERIFY_GC(pGC, stuff->id, client, SecurityDestroyAccess); FreeResource(stuff->id, RT_NONE); return(client->noClientException); } int ProcClearToBackground(client) register ClientPtr client; { REQUEST(xClearAreaReq); register WindowPtr pWin; REQUEST_SIZE_MATCH(xClearAreaReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; return (BadMatch); } if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) { client->errorValue = stuff->exposures; return(BadValue); } (*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y, stuff->width, stuff->height, (Bool)stuff->exposures); return(client->noClientException); } int ProcCopyArea(client) register ClientPtr client; { register DrawablePtr pDst; register DrawablePtr pSrc; register GC *pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; REQUEST_SIZE_MATCH(xCopyAreaReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, SecurityReadAccess); if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else pSrc = pDst; SET_DBE_SRCBUF(pSrc, stuff->srcDrawable); pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); if (pGC->graphicsExposures) { (*pDst->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyArea, 0); if (pRgn) REGION_DESTROY(pDst->pScreen, pRgn); } return(client->noClientException); } int ProcCopyPlane(client) register ClientPtr client; { register DrawablePtr psrcDraw, pdstDraw; register GC *pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; REQUEST_SIZE_MATCH(xCopyPlaneReq); VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); if (stuff->dstDrawable != stuff->srcDrawable) { SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, SecurityReadAccess); if (pdstDraw->pScreen != psrcDraw->pScreen) { client->errorValue = stuff->dstDrawable; return (BadMatch); } } else psrcDraw = pdstDraw; SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable); /* Check to see if stuff->bitPlane has exactly ONE good bit set */ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) { client->errorValue = stuff->bitPlane; return(BadValue); } pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY, stuff->bitPlane); if (pGC->graphicsExposures) { (*pdstDraw->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0); if (pRgn) REGION_DESTROY(pdstDraw->pScreen, pRgn); } return(client->noClientException); } int ProcPolyPoint(client) register ClientPtr client; { int npoint; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyPointReq); REQUEST_AT_LEAST_SIZE(xPolyPointReq); if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint) (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint, (xPoint *) &stuff[1]); return (client->noClientException); } int ProcPolyLine(client) register ClientPtr client; { int npoint; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyLineReq); REQUEST_AT_LEAST_SIZE(xPolyLineReq); if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 1) (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint, (DDXPointPtr) &stuff[1]); return(client->noClientException); } int ProcPolySegment(client) register ClientPtr client; { int nsegs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if (nsegs & 4) return(BadLength); nsegs >>= 3; if (nsegs) (*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]); return (client->noClientException); } int ProcPolyRectangle (client) register ClientPtr client; { int nrects; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if (nrects & 4) return(BadLength); nrects >>= 3; if (nrects) (*pGC->ops->PolyRectangle)(pDraw, pGC, nrects, (xRectangle *) &stuff[1]); return(client->noClientException); } int ProcPolyArc(client) register ClientPtr client; { int narcs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if (narcs % sizeof(xArc)) return(BadLength); narcs /= sizeof(xArc); if (narcs) (*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]); return (client->noClientException); } int ProcFillPoly(client) register ClientPtr client; { int things; register GC *pGC; register DrawablePtr pDraw; REQUEST(xFillPolyReq); REQUEST_AT_LEAST_SIZE(xFillPolyReq); if ((stuff->shape != Complex) && (stuff->shape != Nonconvex) && (stuff->shape != Convex)) { client->errorValue = stuff->shape; return BadValue; } if ((stuff->coordMode != CoordModeOrigin) && (stuff->coordMode != CoordModePrevious)) { client->errorValue = stuff->coordMode; return BadValue; } VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (things) (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape, stuff->coordMode, things, (DDXPointPtr) &stuff[1]); return(client->noClientException); } int ProcPolyFillRectangle(client) register ClientPtr client; { int things; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if (things & 4) return(BadLength); things >>= 3; if (things) (*pGC->ops->PolyFillRect) (pDraw, pGC, things, (xRectangle *) &stuff[1]); return (client->noClientException); } int ProcPolyFillArc(client) register ClientPtr client; { int narcs; register GC *pGC; register DrawablePtr pDraw; REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return(BadLength); narcs /= sizeof(xArc); if (narcs) (*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]); return (client->noClientException); } /* 64-bit server notes: the protocol restricts padding of images to * 8-, 16-, or 32-bits. We would like to have 64-bits for the server * to use internally. Removes need for internal alignment checking. * All of the PutImage functions could be changed individually, but * as currently written, they call other routines which require things * to be 64-bit padded on scanlines, so we changed things here. * If an image would be padded differently for 64- versus 32-, then * copy each scanline to a 64-bit padded scanline. * Also, we need to make sure that the image is aligned on a 64-bit * boundary, even if the scanlines are padded to our satisfaction. */ int ProcPutImage(client) register ClientPtr client; { register GC *pGC; register DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ char *tmpImage; REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); if (stuff->format == XYBitmap) { if ((stuff->depth != 1) || (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad); #endif } else if (stuff->format == XYPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); length *= stuff->depth; #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad); lengthProto *= stuff->depth; #endif } else if (stuff->format == ZPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0)) return BadMatch; length = PixmapBytePad(stuff->width, stuff->depth); #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = PixmapBytePadProto(stuff->width, stuff->depth); #endif } else { client->errorValue = stuff->format; return BadValue; } #ifdef INTERNAL_VS_EXTERNAL_PADDING /* handle 64 bit case where protocol may pad to 32 and we want 64 */ if ( length != lengthProto ) { register int i; char * stuffptr, /* pointer into protocol data */ * tmpptr; /* new location to copy to */ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height))) return (BadAlloc); bzero(tmpImage,length*stuff->height); if ( stuff->format == XYPixmap ) { int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad); int lineBytesProto = BitmapBytePadProto(stuff->width + stuff->leftPad); int depth = stuff->depth; stuffptr = (char *)&stuff[1]; tmpptr = tmpImage; for ( i = 0; i < stuff->height*stuff->depth; stuffptr += lineBytesProto,tmpptr += lineBytes, i++) memmove(tmpptr,stuffptr,lineBytesProto); } else { for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage; i < stuff->height; stuffptr += lengthProto,tmpptr += length, i++) memmove(tmpptr,stuffptr,lengthProto); } } /* handle 64-bit case where stuff is not 64-bit aligned */ else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) { if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height))) return (BadAlloc); memmove(tmpImage,(char *)&stuff[1],length*stuff->height); } else tmpImage = (char *)&stuff[1]; #else tmpImage = (char *)&stuff[1]; lengthProto = length; #endif /* INTERNAL_VS_EXTERNAL_PADDING */ if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) + (sizeof(xPutImageReq) >> 2)) != client->req_len) return BadLength; (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->width, stuff->height, stuff->leftPad, stuff->format, tmpImage); #ifdef INTERNAL_VS_EXTERNAL_PADDING /* free up our temporary space if used */ if (tmpImage != (char *)&stuff[1]) DEALLOCATE_LOCAL(tmpImage); #endif /* INTERNAL_VS_EXTERNAL_PADDING */ return (client->noClientException); } int DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return) register ClientPtr client; Drawable drawable; int format; int x, y, width, height; Mask planemask; xGetImageReply **im_return; { register DrawablePtr pDraw; int nlines, linesPerBuf; register int linesDone; long widthBytesLine, length; #ifdef INTERNAL_VS_EXTERNAL_PADDING long widthBytesLineProto, lengthProto; #endif Mask plane; char *pBuf; xGetImageReply xgi; RegionPtr pVisibleRegion = NULL; if ((format != XYPixmap) && (format != ZPixmap)) { client->errorValue = format; return(BadValue); } SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ !((WindowPtr) pDraw)->realized || /* check for being on screen */ pDraw->x + x < 0 || pDraw->x + x + width > pDraw->pScreen->width || pDraw->y + y < 0 || pDraw->y + y + height > pDraw->pScreen->height || /* check for being inside of border */ x < - wBorderWidth((WindowPtr)pDraw) || x + width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || y < -wBorderWidth((WindowPtr)pDraw) || y + height > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height ) return(BadMatch); xgi.visual = wVisual (((WindowPtr) pDraw)); } else { if(x < 0 || x+width > (int)pDraw->width || y < 0 || y+height > (int)pDraw->height ) return(BadMatch); xgi.visual = None; } SET_DBE_SRCBUF(pDraw, drawable); xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(format == ZPixmap) { widthBytesLine = PixmapBytePad(width, pDraw->depth); length = widthBytesLine * height; #ifdef INTERNAL_VS_EXTERNAL_PADDING widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth); lengthProto = widthBytesLineProto * height; #endif } else { widthBytesLine = BitmapBytePad(width); plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = widthBytesLine * height * Ones(planemask & (plane | (plane - 1))); #ifdef INTERNAL_VS_EXTERNAL_PADDING widthBytesLineProto = BitmapBytePadProto(width); lengthProto = widthBytesLineProto * height * Ones(planemask & (plane | (plane - 1))); #endif } #ifdef INTERNAL_VS_EXTERNAL_PADDING xgi.length = lengthProto; #else xgi.length = length; #endif if (im_return) { pBuf = (char *)xalloc(sz_xGetImageReply + length); if (!pBuf) return (BadAlloc); if (widthBytesLine == 0) linesPerBuf = 0; else linesPerBuf = height; *im_return = (xGetImageReply *)pBuf; *(xGetImageReply *)pBuf = xgi; pBuf += sz_xGetImageReply; } else { xgi.length = (xgi.length + 3) >> 2; if (widthBytesLine == 0 || height == 0) linesPerBuf = 0; else if (widthBytesLine >= IMAGE_BUFSIZE) linesPerBuf = 1; else { linesPerBuf = IMAGE_BUFSIZE / widthBytesLine; if (linesPerBuf > height) linesPerBuf = height; } length = linesPerBuf * widthBytesLine; if (linesPerBuf < height) { /* we have to make sure intermediate buffers don't need padding */ while ((linesPerBuf > 1) && (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))) { linesPerBuf--; length -= widthBytesLine; } while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)) { linesPerBuf++; length += widthBytesLine; } } if(!(pBuf = (char *) ALLOCATE_LOCAL(length))) return (BadAlloc); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } #ifdef XCSECURITY if (client->trustLevel != XSecurityClientTrusted && pDraw->type == DRAWABLE_WINDOW) { pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) { REGION_TRANSLATE(pScreen, pVisibleRegion, -pDraw->x, -pDraw->y); } } #endif if (linesPerBuf == 0) { /* nothing to do */ } else if (format == ZPixmap) { linesDone = 0; while (height - linesDone > 0) { nlines = min(linesPerBuf, height - linesDone); (*pDraw->pScreen->GetImage) (pDraw, x, y + linesDone, width, nlines, format, planemask, (pointer) pBuf); #ifdef XCSECURITY if (pVisibleRegion) SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); #endif #ifdef INTERNAL_VS_EXTERNAL_PADDING /* for 64-bit server, convert image to pad to 32 bits */ if ( widthBytesLine != widthBytesLineProto ) { register char * bufPtr, * protoPtr; register int i; for (i = 1, bufPtr = pBuf + widthBytesLine, protoPtr = pBuf + widthBytesLineProto; i < nlines; bufPtr += widthBytesLine, protoPtr += widthBytesLineProto, i++) memmove(protoPtr, bufPtr, widthBytesLineProto); } #endif /* Note that this is NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ if (!im_return) /* Don't split me, gcc pukes when you do */ #ifdef INTERNAL_VS_EXTERNAL_PADDING (void)WriteToClient(client, (int)(nlines * widthBytesLineProto), pBuf); #else (void)WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); #endif linesDone += nlines; } } else /* XYPixmap */ { for (; plane; plane >>= 1) { if (planemask & plane) { linesDone = 0; while (height - linesDone > 0) { nlines = min(linesPerBuf, height - linesDone); (*pDraw->pScreen->GetImage) (pDraw, x, y + linesDone, width, nlines, format, plane, (pointer)pBuf); #ifdef XCSECURITY if (pVisibleRegion) SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y + linesDone, width, nlines, format, pBuf); #endif #ifdef INTERNAL_VS_EXTERNAL_PADDING /* for 64-bit server, convert image to pad to 32 bits */ if ( widthBytesLine != widthBytesLineProto ) { register char * bufPtr, * protoPtr; register int i; for (i = 1, bufPtr = pBuf + widthBytesLine, protoPtr = pBuf + widthBytesLineProto; i < nlines; bufPtr += widthBytesLine, protoPtr += widthBytesLineProto, i++) memmove(protoPtr, bufPtr, widthBytesLineProto); } #endif /* Note: NOT a call to WriteSwappedDataToClient, as we do NOT byte swap */ if (im_return) { #ifdef INTERNAL_VS_EXTERNAL_PADDING pBuf += nlines * widthBytesLineProto; #else pBuf += nlines * widthBytesLine; #endif } else /* Don't split me, gcc pukes when you do */ #ifdef INTERNAL_VS_EXTERNAL_PADDING (void)WriteToClient(client, (int)(nlines * widthBytesLineProto), pBuf); #else (void)WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); #endif linesDone += nlines; } } } } #ifdef XCSECURITY if (pVisibleRegion) REGION_DESTROY(pScreen, pVisibleRegion); #endif if (!im_return) DEALLOCATE_LOCAL(pBuf); return (client->noClientException); } int ProcGetImage(client) register ClientPtr client; { REQUEST(xGetImageReq); REQUEST_SIZE_MATCH(xGetImageReq); return DoGetImage(client, stuff->format, stuff->drawable, stuff->x, stuff->y, (int)stuff->width, (int)stuff->height, stuff->planeMask, (xGetImageReply **)NULL); } int ProcPolyText(client) register ClientPtr client; { int err; REQUEST(xPolyTextReq); DrawablePtr pDraw; GC *pGC; REQUEST_AT_LEAST_SIZE(xPolyTextReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = PolyText(client, pDraw, pGC, (unsigned char *)&stuff[1], ((unsigned char *) stuff) + (client->req_len << 2), stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcImageText8(client) register ClientPtr client; { int err; register DrawablePtr pDraw; register GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = ImageText(client, pDraw, pGC, stuff->nChars, (unsigned char *)&stuff[1], stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcImageText16(client) register ClientPtr client; { int err; register DrawablePtr pDraw; register GC *pGC; REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); err = ImageText(client, pDraw, pGC, stuff->nChars, (unsigned char *)&stuff[1], stuff->x, stuff->y, stuff->reqType, stuff->drawable); if (err == Success) { return(client->noClientException); } else return err; } int ProcCreateColormap(client) register ClientPtr client; { VisualPtr pVisual; ColormapPtr pmap; Colormap mid; register WindowPtr pWin; ScreenPtr pScreen; REQUEST(xCreateColormapReq); int i, result; REQUEST_SIZE_MATCH(xCreateColormapReq); if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll)) { client->errorValue = stuff->alloc; return(BadValue); } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityReadAccess); if (!pWin) return(BadWindow); pScreen = pWin->drawable.pScreen; for (i = 0, pVisual = pScreen->visuals; i < pScreen->numVisuals; i++, pVisual++) { if (pVisual->vid != stuff->visual) continue; result = CreateColormap(mid, pScreen, pVisual, &pmap, (int)stuff->alloc, client->index); if (client->noClientException != Success) return(client->noClientException); else return(result); } client->errorValue = stuff->visual; return(BadValue); } int ProcFreeColormap(client) register ClientPtr client; { ColormapPtr pmap; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, SecurityDestroyAccess); if (pmap) { /* Freeing a default colormap is a no-op */ if (!(pmap->flags & IsDefault)) FreeResource(stuff->id, RT_NONE); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcCopyColormapAndFree(client) register ClientPtr client; { Colormap mid; ColormapPtr pSrcMap; REQUEST(xCopyColormapAndFreeReq); int result; REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, RT_COLORMAP, SecurityReadAccess|SecurityWriteAccess)) ) { result = CopyColormapAndFree(mid, pSrcMap, client->index); if (client->noClientException != Success) return(client->noClientException); else return(result); } else { client->errorValue = stuff->srcCmap; return(BadColor); } } int ProcInstallColormap(client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, SecurityReadAccess); if (pcmp) { (*(pcmp->pScreen->InstallColormap)) (pcmp); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcUninstallColormap(client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, SecurityReadAccess); if (pcmp) { if(pcmp->mid != pcmp->pScreen->defColormap) (*(pcmp->pScreen->UninstallColormap)) (pcmp); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } int ProcListInstalledColormaps(client) register ClientPtr client; { xListInstalledColormapsReply *preply; int nummaps; WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); preply = (xListInstalledColormapsReply *) ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!preply) return(BadAlloc); preply->type = X_Reply; preply->sequenceNumber = client->sequence; nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) (pWin->drawable.pScreen, (Colormap *)&preply[1]); preply->nColormaps = nummaps; preply->length = nummaps; WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); DEALLOCATE_LOCAL(preply); return(client->noClientException); } int ProcAllocColor(client) register ClientPtr client; { ColormapPtr pmap; int retval; xAllocColorReply acr; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pmap) { #ifdef LBX /* * If the colormap is grabbed by a proxy, the server will have * to regain control over the colormap. This AllocColor request * will be handled after the server gets back the colormap control. */ if (LbxCheckColorRequest (client, pmap, (xReq *) stuff)) return Success; #endif acr.type = X_Reply; acr.length = 0; acr.sequenceNumber = client->sequence; acr.red = stuff->red; acr.green = stuff->green; acr.blue = stuff->blue; acr.pixel = 0; if( (retval = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, &acr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else return (retval); } WriteReplyToClient(client, sizeof(xAllocColorReply), &acr); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocNamedColor (client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { int retval; xAllocNamedColorReply ancr; #ifdef LBX /* * If the colormap is grabbed by a proxy, the server will have * to regain control over the colormap. This AllocNamedColor request * will be handled after the server gets back the colormap control. */ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff)) return Success; #endif ancr.type = X_Reply; ancr.length = 0; ancr.sequenceNumber = client->sequence; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) { ancr.screenRed = ancr.exactRed; ancr.screenGreen = ancr.exactGreen; ancr.screenBlue = ancr.exactBlue; ancr.pixel = 0; if( (retval = AllocColor(pcmp, &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue, &ancr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else return(retval); } WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr); return (client->noClientException); } else return(BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocColorCells (client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { xAllocColorCellsReply accr; int npixels, nmasks, retval; long length; Pixel *ppixels, *pmasks; #ifdef LBX /* * If the colormap is grabbed by a proxy, the server will have * to regain control over the colormap. This AllocColorCells request * will be handled after the server gets back the colormap control. */ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff)) return Success; #endif npixels = stuff->colors; if (!npixels) { client->errorValue = npixels; return (BadValue); } if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) { client->errorValue = stuff->contiguous; return (BadValue); } nmasks = stuff->planes; length = ((long)npixels + (long)nmasks) * sizeof(Pixel); ppixels = (Pixel *)ALLOCATE_LOCAL(length); if(!ppixels) return(BadAlloc); pmasks = ppixels + npixels; if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks, (Bool)stuff->contiguous, ppixels, pmasks)) ) { DEALLOCATE_LOCAL(ppixels); if (client->noClientException != Success) return(client->noClientException); else return(retval); } accr.type = X_Reply; accr.length = length >> 2; accr.sequenceNumber = client->sequence; accr.nPixels = npixels; accr.nMasks = nmasks; WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); DEALLOCATE_LOCAL(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcAllocColorPlanes(client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { xAllocColorPlanesReply acpr; int npixels, retval; long length; Pixel *ppixels; #ifdef LBX /* * If the colormap is grabbed by a proxy, the server will have * to regain control over the colormap. This AllocColorPlanes request * will be handled after the server gets back the colormap control. */ if (LbxCheckColorRequest (client, pcmp, (xReq *) stuff)) return Success; #endif npixels = stuff->colors; if (!npixels) { client->errorValue = npixels; return (BadValue); } if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) { client->errorValue = stuff->contiguous; return (BadValue); } acpr.type = X_Reply; acpr.sequenceNumber = client->sequence; acpr.nPixels = npixels; length = (long)npixels * sizeof(Pixel); ppixels = (Pixel *)ALLOCATE_LOCAL(length); if(!ppixels) return(BadAlloc); if( (retval = AllocColorPlanes(client->index, pcmp, npixels, (int)stuff->red, (int)stuff->green, (int)stuff->blue, (Bool)stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) { DEALLOCATE_LOCAL(ppixels); if (client->noClientException != Success) return(client->noClientException); else return(retval); } acpr.length = length >> 2; WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); DEALLOCATE_LOCAL(ppixels); return (client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcFreeColors (client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { int count; int retval; if(pcmp->flags & AllAllocated) return(BadAccess); count = ((client->req_len << 2)- sizeof(xFreeColorsReq)) >> 2; retval = FreeColors(pcmp, client->index, count, (Pixel *)&stuff[1], (Pixel)stuff->planeMask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(retval); } } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcStoreColors (client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { int count; int retval; count = (client->req_len << 2) - sizeof(xStoreColorsReq); if (count % sizeof(xColorItem)) return(BadLength); count /= sizeof(xColorItem); retval = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return(retval); } } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcStoreNamedColor (client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityWriteAccess); if (pcmp) { xColorItem def; int retval; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &def.red, &def.green, &def.blue)) { def.flags = stuff->flags; def.pixel = stuff->pixel; retval = StoreColors(pcmp, 1, &def); if (client->noClientException != Success) return(client->noClientException); else return(retval); } return (BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcQueryColors(client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityReadAccess); if (pcmp) { int count, retval; xrgb *prgbs; xQueryColorsReply qcr; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; prgbs = (xrgb *)ALLOCATE_LOCAL(count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) { if (prgbs) DEALLOCATE_LOCAL(prgbs); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; return (retval); } } qcr.type = X_Reply; qcr.length = (count * sizeof(xrgb)) >> 2; qcr.sequenceNumber = client->sequence; qcr.nColors = count; WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); } if (prgbs) DEALLOCATE_LOCAL(prgbs); return(client->noClientException); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcLookupColor(client) register ClientPtr client; { ColormapPtr pcmp; REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, RT_COLORMAP, SecurityReadAccess); if (pcmp) { xLookupColorReply lcr; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) { lcr.type = X_Reply; lcr.length = 0; lcr.sequenceNumber = client->sequence; lcr.screenRed = lcr.exactRed; lcr.screenGreen = lcr.exactGreen; lcr.screenBlue = lcr.exactBlue; (*pcmp->pScreen->ResolveColor)(&lcr.screenRed, &lcr.screenGreen, &lcr.screenBlue, pcmp->pVisual); WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr); return(client->noClientException); } return (BadName); } else { client->errorValue = stuff->cmap; return (BadColor); } } int ProcCreateCursor( client) register ClientPtr client; { CursorPtr pCursor; register PixmapPtr src; register PixmapPtr msk; unsigned char * srcbits; unsigned char * mskbits; unsigned short width, height; long n; CursorMetricRec cm; REQUEST(xCreateCursorReq); REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, RT_PIXMAP, SecurityReadAccess); msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, RT_PIXMAP, SecurityReadAccess); if ( src == (PixmapPtr)NULL) { client->errorValue = stuff->source; return (BadPixmap); } if ( msk == (PixmapPtr)NULL) { if (stuff->mask != None) { client->errorValue = stuff->mask; return (BadPixmap); } } else if ( src->drawable.width != msk->drawable.width || src->drawable.height != msk->drawable.height || src->drawable.depth != 1 || msk->drawable.depth != 1) return (BadMatch); width = src->drawable.width; height = src->drawable.height; if ( stuff->x > width || stuff->y > height ) return (BadMatch); n = BitmapBytePad(width)*height; srcbits = (unsigned char *)xalloc(n); if (!srcbits) return (BadAlloc); mskbits = (unsigned char *)xalloc(n); if (!mskbits) { xfree(srcbits); return (BadAlloc); } /* zeroing the (pad) bits helps some ddx cursor handling */ bzero((char *)srcbits, n); (* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height, XYPixmap, 1, (pointer)srcbits); if ( msk == (PixmapPtr)NULL) { register unsigned char *bits = mskbits; while (--n >= 0) *bits++ = ~0; } else { /* zeroing the (pad) bits helps some ddx cursor handling */ bzero((char *)mskbits, n); (* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width, height, XYPixmap, 1, (pointer)mskbits); } cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; pCursor = AllocCursor( srcbits, mskbits, &cm, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue); if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) return (client->noClientException); return BadAlloc; } int ProcCreateGlyphCursor( client) register ClientPtr client; { CursorPtr pCursor; int res; REQUEST(xCreateGlyphCursorReq); REQUEST_SIZE_MATCH(xCreateGlyphCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); res = AllocGlyphCursor(stuff->source, stuff->sourceChar, stuff->mask, stuff->maskChar, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue, &pCursor, client); if (res != Success) return res; if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) return client->noClientException; return BadAlloc; } int ProcFreeCursor(client) register ClientPtr client; { CursorPtr pCursor; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, RT_CURSOR, SecurityDestroyAccess); if (pCursor) { FreeResource(stuff->id, RT_NONE); return (client->noClientException); } else { client->errorValue = stuff->id; return (BadCursor); } } int ProcQueryBestSize (client) register ClientPtr client; { xQueryBestSizeReply reply; register DrawablePtr pDraw; ScreenPtr pScreen; REQUEST(xQueryBestSizeReq); REQUEST_SIZE_MATCH(xQueryBestSizeReq); if ((stuff->class != CursorShape) && (stuff->class != TileShape) && (stuff->class != StippleShape)) { client->errorValue = stuff->class; return(BadValue); } SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client, SecurityReadAccess); if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; (* pScreen->QueryBestSize)(stuff->class, &stuff->width, &stuff->height, pScreen); reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.width = stuff->width; reply.height = stuff->height; WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply); return (client->noClientException); } int ProcSetScreenSaver (client) register ClientPtr client; { int blankingOption, exposureOption; REQUEST(xSetScreenSaverReq); REQUEST_SIZE_MATCH(xSetScreenSaverReq); blankingOption = stuff->preferBlank; if ((blankingOption != DontPreferBlanking) && (blankingOption != PreferBlanking) && (blankingOption != DefaultBlanking)) { client->errorValue = blankingOption; return BadValue; } exposureOption = stuff->allowExpose; if ((exposureOption != DontAllowExposures) && (exposureOption != AllowExposures) && (exposureOption != DefaultExposures)) { client->errorValue = exposureOption; return BadValue; } if (stuff->timeout < -1) { client->errorValue = stuff->timeout; return BadValue; } if (stuff->interval < -1) { client->errorValue = stuff->interval; return BadValue; } if (blankingOption == DefaultBlanking) ScreenSaverBlanking = defaultScreenSaverBlanking; else ScreenSaverBlanking = blankingOption; if (exposureOption == DefaultExposures) ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; else ScreenSaverAllowExposures = exposureOption; if (stuff->timeout >= 0) ScreenSaverTime = stuff->timeout * MILLI_PER_SECOND; else ScreenSaverTime = defaultScreenSaverTime; if (stuff->interval >= 0) ScreenSaverInterval = stuff->interval * MILLI_PER_SECOND; else ScreenSaverInterval = defaultScreenSaverInterval; return (client->noClientException); } int ProcGetScreenSaver(client) register ClientPtr client; { xGetScreenSaverReply rep; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.timeout = ScreenSaverTime / MILLI_PER_SECOND; rep.interval = ScreenSaverInterval / MILLI_PER_SECOND; rep.preferBlanking = ScreenSaverBlanking; rep.allowExposures = ScreenSaverAllowExposures; WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep); return (client->noClientException); } int ProcChangeHosts(client) register ClientPtr client; { REQUEST(xChangeHostsReq); int result; REQUEST_FIXED_SIZE(xChangeHostsReq, stuff->hostLength); if(stuff->mode == HostInsert) result = AddHost(client, (int)stuff->hostFamily, stuff->hostLength, (pointer)&stuff[1]); else if (stuff->mode == HostDelete) result = RemoveHost(client, (int)stuff->hostFamily, stuff->hostLength, (pointer)&stuff[1]); else { client->errorValue = stuff->mode; return BadValue; } if (!result) result = client->noClientException; return (result); } int ProcListHosts(client) register ClientPtr client; { xListHostsReply reply; int len, nHosts, result; pointer pdata; REQUEST_SIZE_MATCH(xListHostsReq); #ifdef XCSECURITY /* untrusted clients can't list hosts */ if (client->trustLevel != XSecurityClientTrusted) { SecurityAudit("client %d attempted to list hosts\n", client->index); return BadAccess; } #endif result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); if (result != Success) return(result); reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.nHosts = nHosts; reply.length = len >> 2; WriteReplyToClient(client, sizeof(xListHostsReply), &reply); if (nHosts) { client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend; WriteSwappedDataToClient(client, len, pdata); } xfree(pdata); return (client->noClientException); } int ProcChangeAccessControl(client) register ClientPtr client; { int result; REQUEST(xSetAccessControlReq); REQUEST_SIZE_MATCH(xSetAccessControlReq); if ((stuff->mode != EnableAccess) && (stuff->mode != DisableAccess)) { client->errorValue = stuff->mode; return BadValue; } result = ChangeAccessControl(client, stuff->mode == EnableAccess); if (!result) result = client->noClientException; return (result); } int ProcKillClient(client) register ClientPtr client; { REQUEST(xResourceReq); ClientPtr killclient; REQUEST_SIZE_MATCH(xResourceReq); if (stuff->id == AllTemporary) { CloseDownRetainedResources(); return (client->noClientException); } if ((killclient = LookupClient(stuff->id, client))) { CloseDownClient(killclient); /* if an LBX proxy gets killed, isItTimeToYield will be set */ if (isItTimeToYield || (client == killclient)) { /* force yield and return Success, so that Dispatch() * doesn't try to touch client */ isItTimeToYield = TRUE; return (Success); } return (client->noClientException); } else { client->errorValue = stuff->id; return (BadValue); } } int ProcSetFontPath(client) register ClientPtr client; { unsigned char *ptr; unsigned long nbytes, total; long nfonts; int n, result; int error; REQUEST(xSetFontPathReq); REQUEST_AT_LEAST_SIZE(xSetFontPathReq); nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq); total = nbytes; ptr = (unsigned char *)&stuff[1]; nfonts = stuff->nFonts; while (--nfonts >= 0) { if ((total == 0) || (total < (n = (*ptr + 1)))) return(BadLength); total -= n; ptr += n; } if (total >= 4) return(BadLength); result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1], &error); if (!result) { result = client->noClientException; client->errorValue = error; } return (result); } int ProcGetFontPath(client) register ClientPtr client; { xGetFontPathReply reply; int stringLens, numpaths; unsigned char *bufferStart; REQUEST_SIZE_MATCH(xReq); bufferStart = GetFontPath(&numpaths, &stringLens); reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = (stringLens + numpaths + 3) >> 2; reply.nPaths = numpaths; WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply); if (stringLens || numpaths) (void)WriteToClient(client, stringLens + numpaths, (char *)bufferStart); return(client->noClientException); } int ProcChangeCloseDownMode(client) register ClientPtr client; { REQUEST(xSetCloseDownModeReq); REQUEST_SIZE_MATCH(xSetCloseDownModeReq); if ((stuff->mode == AllTemporary) || (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) { client->closeDownMode = stuff->mode; return (client->noClientException); } else { client->errorValue = stuff->mode; return (BadValue); } } int ProcForceScreenSaver(client) register ClientPtr client; { REQUEST(xForceScreenSaverReq); REQUEST_SIZE_MATCH(xForceScreenSaverReq); if ((stuff->mode != ScreenSaverReset) && (stuff->mode != ScreenSaverActive)) { client->errorValue = stuff->mode; return BadValue; } SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode); return client->noClientException; } int ProcNoOperation(client) register ClientPtr client; { REQUEST_AT_LEAST_SIZE(xReq); /* noop -- don't do anything */ return(client->noClientException); } void InitProcVectors() { int i; for (i = 0; i<256; i++) { if(!ProcVector[i]) { ProcVector[i] = SwappedProcVector[i] = ProcBadRequest; ReplySwapVector[i] = ReplyNotSwappd; } #ifdef K5AUTH if (!k5_Vector[i]) { k5_Vector[i] = k5_bad; } #endif } for(i = LASTEvent; i < 128; i++) { EventSwapVector[i] = NotImplemented; } } /********************** * CloseDownClient * * Client can either mark his resources destroy or retain. If retained and * then killed again, the client is really destroyed. *********************/ Bool terminateAtReset = FALSE; void CloseDownClient(client) register ClientPtr client; { Bool really_close_down = client->clientGone || client->closeDownMode == DestroyAll; if (!client->clientGone) { /* ungrab server if grabbing client dies */ if (grabState != GrabNone && grabClient == client) { UngrabServer(client); } BITCLEAR(grabWaiters, client->index); DeleteClientFromAnySelections(client); ReleaseActiveGrabs(client); DeleteClientFontStuff(client); if (!really_close_down) { /* This frees resources that should never be retained * no matter what the close down mode is. Actually we * could do this unconditionally, but it's probably * better not to traverse all the client's resources * twice (once here, once a few lines down in * FreeClientResources) in the common case of * really_close_down == TRUE. */ FreeClientNeverRetainResources(client); client->clientState = ClientStateRetained; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); } } client->clientGone = TRUE; /* so events aren't sent to client */ if (ClientIsAsleep(client)) ClientSignal (client); ProcessWorkQueueZombies(); #ifdef LBX ProcessQTagZombies(); #endif CloseDownConnection(client); /* If the client made it to the Running stage, nClients has * been incremented on its behalf, so we need to decrement it * now. If it hasn't gotten to Running, nClients has *not* * been incremented, so *don't* decrement it. */ if (client->clientState != ClientStateInitial && client->clientState != ClientStateAuthenticating ) { --nClients; } } if (really_close_down) { if (client->clientState == ClientStateRunning && nClients == 0) { if (terminateAtReset) dispatchException |= DE_TERMINATE; else dispatchException |= DE_RESET; } client->clientState = ClientStateGone; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); } FreeClientResources(client); if (client->index < nextFreeClientID) nextFreeClientID = client->index; clients[client->index] = NullClient; xfree(client); while (!clients[currentMaxClients-1]) currentMaxClients--; } } static void KillAllClients() { int i; for (i=1; icloseDownMode == RetainTemporary) && (client->clientGone)) CloseDownClient(client); } } void InitClient(client, i, ospriv) ClientPtr client; int i; pointer ospriv; { client->index = i; client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; client->clientGone = FALSE; if (i) { client->closeDownMode = DestroyAll; client->lastDrawable = (DrawablePtr)WindowTable[0]; client->lastDrawableID = WindowTable[0]->drawable.id; } else { client->closeDownMode = RetainPermanent; client->lastDrawable = (DrawablePtr)NULL; client->lastDrawableID = INVALID; } client->lastGC = (GCPtr) NULL; client->lastGCID = INVALID; client->numSaved = 0; client->saveSet = (pointer *)NULL; client->noClientException = Success; #ifdef DEBUG client->requestLogIndex = 0; #endif client->requestVector = InitialVector; client->osPrivate = ospriv; client->swapped = FALSE; client->big_requests = FALSE; client->priority = 0; client->clientState = ClientStateInitial; #ifdef XKB if (!noXkbExtension) { client->xkbClientFlags = 0; client->mapNotifyMask = 0; QueryMinMaxKeyCodes(&client->minKC,&client->maxKC); } #endif client->replyBytesRemaining = 0; #ifdef LBX client->readRequest = StandardReadRequestFromClient; #endif #ifdef XCSECURITY client->trustLevel = XSecurityClientTrusted; client->CheckAccess = NULL; client->authId = 0; #endif #ifdef XAPPGROUP client->appgroup = NULL; #endif client->fontResFunc = NULL; } extern int clientPrivateLen; extern unsigned *clientPrivateSizes; extern unsigned totalClientSize; int InitClientPrivates(client) ClientPtr client; { register char *ptr; DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; if (totalClientSize == sizeof(ClientRec)) ppriv = (DevUnion *)NULL; else if (client->index) ppriv = (DevUnion *)(client + 1); else { ppriv = (DevUnion *)xalloc(totalClientSize - sizeof(ClientRec)); if (!ppriv) return 0; } client->devPrivates = ppriv; sizes = clientPrivateSizes; ptr = (char *)(ppriv + clientPrivateLen); for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (pointer)ptr; ptr += size; } else ppriv->ptr = (pointer)NULL; } return 1; } /************************ * int NextAvailableClient(ospriv) * * OS dependent portion can't assign client id's because of CloseDownModes. * Returns NULL if there are no free clients. *************************/ ClientPtr NextAvailableClient(ospriv) pointer ospriv; { register int i; register ClientPtr client; xReq data; i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; clients[i] = client = (ClientPtr)xalloc(totalClientSize); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); InitClientPrivates(client); if (!InitClientResources(client)) { xfree(client); return (ClientPtr)NULL; } data.reqType = 1; data.length = (sz_xReq + sz_xConnClientPrefix) >> 2; if (!InsertFakeRequest(client, (char *)&data, sz_xReq)) { FreeClientResources(client); xfree(client); return (ClientPtr)NULL; } if (i == currentMaxClients) currentMaxClients++; while ((nextFreeClientID < MAXCLIENTS) && clients[nextFreeClientID]) nextFreeClientID++; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); } return(client); } int ProcInitialConnection(client) register ClientPtr client; { REQUEST(xReq); register xConnClientPrefix *prefix; int whichbyte = 1; prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B')) return (client->noClientException = -1); if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) || (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) { client->swapped = TRUE; SwapConnClientPrefix(prefix); } stuff->reqType = 2; stuff->length += ((prefix->nbytesAuthProto + (unsigned)3) >> 2) + ((prefix->nbytesAuthString + (unsigned)3) >> 2); if (client->swapped) { swaps(&stuff->length, whichbyte); } ResetCurrentRequest(client); return (client->noClientException); } #ifdef LBX void IncrementClientCount() { nClients++; } #endif int SendConnSetup(client, reason) register ClientPtr client; char *reason; { register xWindowRoot *root; register int i; int numScreens; char* lConnectionInfo; xConnSetupPrefix* lconnSetupPrefix; if (reason) { xConnSetupPrefix csp; char pad[3]; csp.success = xFalse; csp.lengthReason = strlen(reason); csp.length = (csp.lengthReason + (unsigned)3) >> 2; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; if (client->swapped) WriteSConnSetupPrefix(client, &csp); else (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp); (void)WriteToClient(client, (int)csp.lengthReason, reason); return (client->noClientException = -1); } numScreens = screenInfo.numScreens; lConnectionInfo = ConnectionInfo; lconnSetupPrefix = &connSetupPrefix; /* We're about to start speaking X protocol back to the client by * sending the connection setup info. This means the authorization * step is complete, and we can count the client as an * authorized one. */ nClients++; client->requestVector = client->swapped ? SwappedProcVector : ProcVector; client->sequence = 0; #ifdef XAPPGROUP XagConnectionInfo (client, &lconnSetupPrefix, &lConnectionInfo, &numScreens); #endif ((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask; ((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK; /* fill in the "currentInputMask" */ root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart); for (i=0; icurrentInputMask = WindowTable[i]->eventMask | wOtherEventMasks (WindowTable[i]); pDepth = (xDepth *)(root + 1); for (j = 0; j < root->nDepths; j++) { pDepth = (xDepth *)(((char *)(pDepth + 1)) + pDepth->nVisuals * sizeof(xVisualType)); } root = (xWindowRoot *)pDepth; } if (client->swapped) { WriteSConnSetupPrefix(client, lconnSetupPrefix); WriteSConnectionInfo(client, (unsigned long)(lconnSetupPrefix->length << 2), lConnectionInfo); } else { (void)WriteToClient(client, sizeof(xConnSetupPrefix), (char *) lconnSetupPrefix); (void)WriteToClient(client, (int)(lconnSetupPrefix->length << 2), lConnectionInfo); } client->clientState = ClientStateRunning; if (ClientStateCallback) { NewClientInfoRec clientinfo; clientinfo.client = client; clientinfo.prefix = lconnSetupPrefix; clientinfo.setup = (xConnSetup *)lConnectionInfo; CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); } return (client->noClientException); } int ProcEstablishConnection(client) register ClientPtr client; { char *reason, *auth_proto, *auth_string; register xConnClientPrefix *prefix; REQUEST(xReq); prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); auth_proto = (char *)prefix + sz_xConnClientPrefix; auth_string = auth_proto + ((prefix->nbytesAuthProto + 3) & ~3); if ((prefix->majorVersion != X_PROTOCOL) || (prefix->minorVersion != X_PROTOCOL_REVISION)) reason = "Protocol version mismatch"; else reason = ClientAuthorized(client, (unsigned short)prefix->nbytesAuthProto, auth_proto, (unsigned short)prefix->nbytesAuthString, auth_string); /* * If Kerberos is being used for this client, the clientState * will be set to ClientStateAuthenticating at this point. * More messages need to be exchanged among the X server, Kerberos * server, and client to figure out if everyone is authorized. * So we don't want to send the connection setup info yet, since * the auth step isn't really done. */ if (client->clientState == ClientStateCheckingSecurity) client->clientState = ClientStateCheckedSecurity; else if (client->clientState != ClientStateAuthenticating) return(SendConnSetup(client, reason)); return(client->noClientException); } void SendErrorToClient(client, majorCode, minorCode, resId, errorCode) ClientPtr client; unsigned int majorCode; unsigned int minorCode; XID resId; int errorCode; { xError rep; rep.type = X_Error; rep.sequenceNumber = client->sequence; rep.errorCode = errorCode; rep.majorCode = majorCode; rep.minorCode = minorCode; rep.resourceID = resId; WriteEventsToClient (client, 1, (xEvent *)&rep); } void DeleteWindowFromAnySelections(pWin) WindowPtr pWin; { register int i; for (i = 0; i< NumCurrentSelections; i++) if (CurrentSelections[i].pWin == pWin) { CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; } } static void DeleteClientFromAnySelections(client) ClientPtr client; { register int i; for (i = 0; i< NumCurrentSelections; i++) if (CurrentSelections[i].client == client) { CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; } } void MarkClientException(client) ClientPtr client; { client->noClientException = -1; } vnc_unixsrc/Xvnc/programs/Xserver/dix/pixmap.c0100664000076400007640000000752307120677563021150 0ustar constconst/* $XConsortium: pixmap.c /main/4 1996/08/12 22:04:49 dpw $ */ /* $XFree86: xc/programs/Xserver/dix/pixmap.c,v 3.1 1996/12/23 06:29:47 dawes Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "site.h" /* * Scratch pixmap management and device independent pixmap allocation * function. */ /* callable by ddx */ PixmapPtr GetScratchPixmapHeader(pScreen, width, height, depth, bitsPerPixel, devKind, pPixData) ScreenPtr pScreen; int width; int height; int depth; int bitsPerPixel; int devKind; pointer pPixData; { PixmapPtr pPixmap = pScreen->pScratchPixmap; if (pPixmap) pScreen->pScratchPixmap = NULL; else /* width and height of 0 means don't allocate any pixmap data */ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth); if (pPixmap) if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pPixmap; return NullPixmap; } /* callable by ddx */ void FreeScratchPixmapHeader(pPixmap) PixmapPtr pPixmap; { if (pPixmap) { ScreenPtr pScreen = pPixmap->drawable.pScreen; pPixmap->devPrivate.ptr = NULL; /* lest ddx chases bad ptr */ if (pScreen->pScratchPixmap) (*pScreen->DestroyPixmap)(pPixmap); else pScreen->pScratchPixmap = pPixmap; } } Bool CreateScratchPixmapsForScreen(scrnum) int scrnum; { /* let it be created on first use */ screenInfo.screens[scrnum]->pScratchPixmap = NULL; return TRUE; } void FreeScratchPixmapsForScreen(scrnum) int scrnum; { FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap); } /* callable by ddx */ PixmapPtr AllocatePixmap(pScreen, pixDataSize) ScreenPtr pScreen; int pixDataSize; { PixmapPtr pPixmap; #ifdef PIXPRIV char *ptr; DevUnion *ppriv; unsigned *sizes; unsigned size; int i; pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; ppriv = (DevUnion *)(pPixmap + 1); pPixmap->devPrivates = ppriv; sizes = pScreen->PixmapPrivateSizes; ptr = (char *)(ppriv + pScreen->PixmapPrivateLen); for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++) { if ((size = *sizes) != 0) { ppriv->ptr = (pointer)ptr; ptr += size; } else ppriv->ptr = (pointer)NULL; } #else pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + pixDataSize); #endif return pPixmap; } vnc_unixsrc/Xvnc/programs/Xserver/dix/dispatch.h0100664000076400007640000001430607120677563021453 0ustar constconst/* $XFree86: xc/programs/Xserver/dix/dispatch.h,v 3.1 1996/05/06 05:56:15 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* * This prototypes the dispatch.c module (except for functions declared in * global headers), plus related dispatch procedures from devices.c, events.c, * extension.c, property.c. */ #ifndef DISPATCH_H #define DISPATCH_H 1 #ifdef LBX void IncrementClientCount( #if NeedFunctionPrototypes void #endif ); #endif void CloseDownClient( #if NeedFunctionPrototypes ClientPtr client #endif ); void Dispatch( #if NeedFunctionPrototypes void #endif ); void InitProcVectors( #if NeedFunctionPrototypes void #endif ); ClientPtr NextAvailableClient( #if NeedFunctionPrototypes pointer ospriv #endif ); int SendConnSetup( #if NeedFunctionPrototypes ClientPtr /* client */, char * /* reason */ #endif ); void SetInputCheck( #if NeedFunctionPrototypes HWEventQueuePtr /* c0 */, HWEventQueuePtr /* c1 */ #endif ); DISPATCH_PROC(InitClientPrivates); DISPATCH_PROC(ProcAllocColor); DISPATCH_PROC(ProcAllocColorCells); DISPATCH_PROC(ProcAllocColorPlanes); DISPATCH_PROC(ProcAllocNamedColor); DISPATCH_PROC(ProcAllowEvents); DISPATCH_PROC(ProcBadRequest); DISPATCH_PROC(ProcBell); DISPATCH_PROC(ProcChangeAccessControl); DISPATCH_PROC(ProcChangeActivePointerGrab); DISPATCH_PROC(ProcChangeCloseDownMode); DISPATCH_PROC(ProcChangeGC); DISPATCH_PROC(ProcChangeHosts); DISPATCH_PROC(ProcChangeKeyboardControl); DISPATCH_PROC(ProcChangeKeyboardMapping); DISPATCH_PROC(ProcChangePointerControl); DISPATCH_PROC(ProcChangeProperty); DISPATCH_PROC(ProcChangeSaveSet); DISPATCH_PROC(ProcChangeWindowAttributes); DISPATCH_PROC(ProcCirculateWindow); DISPATCH_PROC(ProcClearToBackground); DISPATCH_PROC(ProcCloseFont); DISPATCH_PROC(ProcConfigureWindow); DISPATCH_PROC(ProcConvertSelection); DISPATCH_PROC(ProcCopyArea); DISPATCH_PROC(ProcCopyColormapAndFree); DISPATCH_PROC(ProcCopyGC); DISPATCH_PROC(ProcCopyPlane); DISPATCH_PROC(ProcCreateColormap); DISPATCH_PROC(ProcCreateCursor); DISPATCH_PROC(ProcCreateGC); DISPATCH_PROC(ProcCreateGlyphCursor); DISPATCH_PROC(ProcCreatePixmap); DISPATCH_PROC(ProcCreateWindow); DISPATCH_PROC(ProcDeleteProperty); DISPATCH_PROC(ProcDestroySubwindows); DISPATCH_PROC(ProcDestroyWindow); DISPATCH_PROC(ProcEstablishConnection); DISPATCH_PROC(ProcFillPoly); DISPATCH_PROC(ProcForceScreenSaver); DISPATCH_PROC(ProcFreeColormap); DISPATCH_PROC(ProcFreeColors); DISPATCH_PROC(ProcFreeCursor); DISPATCH_PROC(ProcFreeGC); DISPATCH_PROC(ProcFreePixmap); DISPATCH_PROC(ProcGetAtomName); DISPATCH_PROC(ProcGetFontPath); DISPATCH_PROC(ProcGetGeometry); DISPATCH_PROC(ProcGetImage); DISPATCH_PROC(ProcGetInputFocus); DISPATCH_PROC(ProcGetKeyboardControl); DISPATCH_PROC(ProcGetKeyboardMapping); DISPATCH_PROC(ProcGetModifierMapping); DISPATCH_PROC(ProcGetMotionEvents); DISPATCH_PROC(ProcGetPointerControl); DISPATCH_PROC(ProcGetPointerMapping); DISPATCH_PROC(ProcGetProperty); DISPATCH_PROC(ProcGetScreenSaver); DISPATCH_PROC(ProcGetSelectionOwner); DISPATCH_PROC(ProcGetWindowAttributes); DISPATCH_PROC(ProcGrabButton); DISPATCH_PROC(ProcGrabKey); DISPATCH_PROC(ProcGrabKeyboard); DISPATCH_PROC(ProcGrabPointer); DISPATCH_PROC(ProcGrabServer); DISPATCH_PROC(ProcImageText16); DISPATCH_PROC(ProcImageText8); DISPATCH_PROC(ProcInitialConnection); DISPATCH_PROC(ProcInstallColormap); DISPATCH_PROC(ProcInternAtom); DISPATCH_PROC(ProcKillClient); DISPATCH_PROC(ProcListExtensions); DISPATCH_PROC(ProcListFonts); DISPATCH_PROC(ProcListFontsWithInfo); DISPATCH_PROC(ProcListHosts); DISPATCH_PROC(ProcListInstalledColormaps); DISPATCH_PROC(ProcListProperties); DISPATCH_PROC(ProcLookupColor); DISPATCH_PROC(ProcMapSubwindows); DISPATCH_PROC(ProcMapWindow); DISPATCH_PROC(ProcNoOperation); DISPATCH_PROC(ProcOpenFont); DISPATCH_PROC(ProcPolyArc); DISPATCH_PROC(ProcPolyFillArc); DISPATCH_PROC(ProcPolyFillRectangle); DISPATCH_PROC(ProcPolyLine); DISPATCH_PROC(ProcPolyPoint); DISPATCH_PROC(ProcPolyRectangle); DISPATCH_PROC(ProcPolySegment); DISPATCH_PROC(ProcPolyText); DISPATCH_PROC(ProcPutImage); DISPATCH_PROC(ProcQueryBestSize); DISPATCH_PROC(ProcQueryColors); DISPATCH_PROC(ProcQueryExtension); DISPATCH_PROC(ProcQueryFont); DISPATCH_PROC(ProcQueryKeymap); DISPATCH_PROC(ProcQueryPointer); DISPATCH_PROC(ProcQueryTextExtents); DISPATCH_PROC(ProcQueryTree); DISPATCH_PROC(ProcRecolorCursor); DISPATCH_PROC(ProcReparentWindow); DISPATCH_PROC(ProcRotateProperties); DISPATCH_PROC(ProcSendEvent); DISPATCH_PROC(ProcSetClipRectangles); DISPATCH_PROC(ProcSetDashes); DISPATCH_PROC(ProcSetFontPath); DISPATCH_PROC(ProcSetInputFocus); DISPATCH_PROC(ProcSetModifierMapping); DISPATCH_PROC(ProcSetPointerMapping); DISPATCH_PROC(ProcSetScreenSaver); DISPATCH_PROC(ProcSetSelectionOwner); DISPATCH_PROC(ProcStoreColors); DISPATCH_PROC(ProcStoreNamedColor); DISPATCH_PROC(ProcTranslateCoords); DISPATCH_PROC(ProcUngrabButton); DISPATCH_PROC(ProcUngrabKey); DISPATCH_PROC(ProcUngrabKeyboard); DISPATCH_PROC(ProcUngrabPointer); DISPATCH_PROC(ProcUngrabServer); DISPATCH_PROC(ProcUninstallColormap); DISPATCH_PROC(ProcUnmapSubwindows); DISPATCH_PROC(ProcUnmapWindow); DISPATCH_PROC(ProcWarpPointer); #endif /* DISPATCH_H */ vnc_unixsrc/Xvnc/programs/Xserver/dix/atom.c0100664000076400007640000001303507120677563020605 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: atom.c,v 1.30 94/04/17 20:26:16 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/dix/atom.c,v 3.0 1996/04/15 11:19:31 dawes Exp $ */ #include "X.h" #include "Xatom.h" #include "misc.h" #include "resource.h" #include "dix.h" #define InitialTableSize 100 typedef struct _Node { struct _Node *left, *right; Atom a; unsigned int fingerPrint; char *string; } NodeRec, *NodePtr; static Atom lastAtom = None; static NodePtr atomRoot = (NodePtr)NULL; static unsigned long tableLength; static NodePtr *nodeTable; Atom MakeAtom(string, len, makeit) char *string; unsigned len; Bool makeit; { register NodePtr * np; unsigned i; int comp; register unsigned int fp = 0; np = &atomRoot; for (i = 0; i < (len+1)/2; i++) { fp = fp * 27 + string[i]; fp = fp * 27 + string[len - 1 - i]; } while (*np != (NodePtr) NULL) { if (fp < (*np)->fingerPrint) np = &((*np)->left); else if (fp > (*np)->fingerPrint) np = &((*np)->right); else { /* now start testing the strings */ comp = strncmp(string, (*np)->string, (int)len); if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string)))) np = &((*np)->left); else if (comp > 0) np = &((*np)->right); else return(*np)->a; } } if (makeit) { register NodePtr nd; nd = (NodePtr) xalloc(sizeof(NodeRec)); if (!nd) return BAD_RESOURCE; if (lastAtom < XA_LAST_PREDEFINED) { nd->string = string; } else { nd->string = (char *) xalloc(len + 1); if (!nd->string) { xfree(nd); return BAD_RESOURCE; } strncpy(nd->string, string, (int)len); nd->string[len] = 0; } if ((lastAtom + 1) >= tableLength) { NodePtr *table; table = (NodePtr *) xrealloc(nodeTable, tableLength * (2 * sizeof(NodePtr))); if (!table) { if (nd->string != string) xfree(nd->string); xfree(nd); return BAD_RESOURCE; } tableLength <<= 1; nodeTable = table; } *np = nd; nd->left = nd->right = (NodePtr) NULL; nd->fingerPrint = fp; nd->a = (++lastAtom); *(nodeTable+lastAtom) = nd; return nd->a; } else return None; } Bool ValidAtom(atom) Atom atom; { return (atom != None) && (atom <= lastAtom); } char * NameForAtom(atom) Atom atom; { NodePtr node; if (atom > lastAtom) return 0; if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0; return node->string; } void AtomError() { FatalError("initializing atoms"); } void FreeAtom(patom) NodePtr patom; { if(patom->left) FreeAtom(patom->left); if(patom->right) FreeAtom(patom->right); if (patom->a > XA_LAST_PREDEFINED) xfree(patom->string); xfree(patom); } void FreeAllAtoms() { if(atomRoot == (NodePtr)NULL) return; FreeAtom(atomRoot); atomRoot = (NodePtr)NULL; xfree(nodeTable); nodeTable = (NodePtr *)NULL; lastAtom = None; } void InitAtoms() { FreeAllAtoms(); tableLength = InitialTableSize; nodeTable = (NodePtr *)xalloc(InitialTableSize*sizeof(NodePtr)); if (!nodeTable) AtomError(); nodeTable[None] = (NodePtr)NULL; MakePredeclaredAtoms(); if (lastAtom != XA_LAST_PREDEFINED) AtomError (); } vnc_unixsrc/Xvnc/programs/Xserver/dix/dixutils.c0100664000076400007640000005737010543216033021504 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* (c)Copyright 1988,1991 Adobe Systems Incorporated. All rights reserved. Permission to use, copy, modify, distribute, and sublicense this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notices appear in all copies and that both those copyright notices and this permission notice appear in supporting documentation and that the name of Adobe Systems Incorporated not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. No trademark license to use the Adobe trademarks is hereby granted. If the Adobe trademark "Display PostScript"(tm) is used to describe this software, its functionality or for any other purpose, such use shall be limited to a statement that this software works in conjunction with the Display PostScript system. Proper trademark attribution to reflect Adobe's ownership of the trademark shall be given whenever any such reference to the Display PostScript system is made. ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems Incorporated which may be registered in certain jurisdictions. Author: Adobe Systems Incorporated */ /* $TOG: dixutils.c /main/33 1997/05/22 10:02:20 kaleb $ */ /* $XFree86: xc/programs/Xserver/dix/dixutils.c,v 3.1.2.1 1997/05/23 12:19:35 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "misc.h" #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #define XK_LATIN1 #include "keysymdef.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif /* * CompareTimeStamps returns -1, 0, or +1 depending on if the first * argument is less than, equal to or greater than the second argument. */ int CompareTimeStamps(a, b) TimeStamp a, b; { if (a.months < b.months) return EARLIER; if (a.months > b.months) return LATER; if (a.milliseconds < b.milliseconds) return EARLIER; if (a.milliseconds > b.milliseconds) return LATER; return SAMETIME; } /* * convert client times to server TimeStamps */ #define HALFMONTH ((unsigned long) 1<<31) TimeStamp ClientTimeToServerTime(c) CARD32 c; { TimeStamp ts; if (c == CurrentTime) return currentTime; ts.months = currentTime.months; ts.milliseconds = c; if (c > currentTime.milliseconds) { if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH) ts.months -= 1; } else if (c < currentTime.milliseconds) { if (((unsigned long)currentTime.milliseconds - c) > HALFMONTH) ts.months += 1; } return ts; } /* * ISO Latin-1 case conversion routine * * this routine always null-terminates the result, so * beware of too-small buffers */ void CopyISOLatin1Lowered(dest, source, length) register unsigned char *dest, *source; int length; { register int i; for (i = 0; i < length; i++, source++, dest++) { if ((*source >= XK_A) && (*source <= XK_Z)) *dest = *source + (XK_a - XK_A); else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis)) *dest = *source + (XK_agrave - XK_Agrave); else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn)) *dest = *source + (XK_oslash - XK_Ooblique); else *dest = *source; } *dest = '\0'; } #ifdef XCSECURITY /* SecurityLookupWindow and SecurityLookupDrawable: * Look up the window/drawable taking into account the client doing * the lookup and the type of access desired. Return the window/drawable * if it exists and the client is allowed access, else return NULL. * Most Proc* functions should be calling these instead of * LookupWindow and LookupDrawable, which do no access checks. */ WindowPtr SecurityLookupWindow(rid, client, access_mode) XID rid; ClientPtr client; Mask access_mode; { WindowPtr pWin; client->errorValue = rid; if(rid == INVALID) return NULL; if (client->trustLevel != XSecurityClientTrusted) return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); if (client->lastDrawableID == rid) { if (client->lastDrawable->type == DRAWABLE_WINDOW) return ((WindowPtr) client->lastDrawable); return (WindowPtr) NULL; } pWin = (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) { client->lastDrawable = (DrawablePtr) pWin; client->lastDrawableID = rid; client->lastGCID = INVALID; client->lastGC = (GCPtr)NULL; } return pWin; } pointer SecurityLookupDrawable(rid, client, access_mode) XID rid; ClientPtr client; Mask access_mode; { register DrawablePtr pDraw; if(rid == INVALID) return (pointer) NULL; if (client->trustLevel != XSecurityClientTrusted) return (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, access_mode); if (client->lastDrawableID == rid) return ((pointer) client->lastDrawable); pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, access_mode); if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) return (pointer)pDraw; return (pointer)NULL; } /* We can't replace the LookupWindow and LookupDrawable functions with * macros because of compatibility with loadable servers. */ WindowPtr LookupWindow(rid, client) XID rid; ClientPtr client; { return SecurityLookupWindow(rid, client, SecurityUnknownAccess); } pointer LookupDrawable(rid, client) XID rid; ClientPtr client; { return SecurityLookupDrawable(rid, client, SecurityUnknownAccess); } #else /* not XCSECURITY */ WindowPtr LookupWindow(rid, client) XID rid; ClientPtr client; { WindowPtr pWin; client->errorValue = rid; if(rid == INVALID) return NULL; if (client->lastDrawableID == rid) { if (client->lastDrawable->type == DRAWABLE_WINDOW) return ((WindowPtr) client->lastDrawable); return (WindowPtr) NULL; } pWin = (WindowPtr)LookupIDByType(rid, RT_WINDOW); if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) { client->lastDrawable = (DrawablePtr) pWin; client->lastDrawableID = rid; client->lastGCID = INVALID; client->lastGC = (GCPtr)NULL; } return pWin; } pointer LookupDrawable(rid, client) XID rid; ClientPtr client; { register DrawablePtr pDraw; if(rid == INVALID) return (pointer) NULL; if (client->lastDrawableID == rid) return ((pointer) client->lastDrawable); pDraw = (DrawablePtr)LookupIDByClass(rid, RC_DRAWABLE); if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) return (pointer)pDraw; return (pointer)NULL; } #endif /* XCSECURITY */ ClientPtr LookupClient(rid, client) XID rid; ClientPtr client; { pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, SecurityReadAccess); int clientIndex = CLIENT_ID(rid); if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { return clients[clientIndex]; } return (ClientPtr)NULL; } int AlterSaveSetForClient(client, pWin, mode) ClientPtr client; WindowPtr pWin; unsigned mode; { int numnow; pointer *pTmp; int j; numnow = client->numSaved; j = 0; if (numnow) { pTmp = client->saveSet; while ((j < numnow) && (pTmp[j] != (pointer)pWin)) j++; } if (mode == SetModeInsert) { if (j < numnow) /* duplicate */ return(Success); numnow++; pTmp = (pointer *)xrealloc(client->saveSet, sizeof(pointer) * numnow); if (!pTmp) return(BadAlloc); client->saveSet = pTmp; client->numSaved = numnow; client->saveSet[numnow - 1] = (pointer)pWin; return(Success); } else if ((mode == SetModeDelete) && (j < numnow)) { while (j < numnow-1) { pTmp[j] = pTmp[j+1]; j++; } numnow--; if (numnow) { pTmp = (pointer *)xrealloc(client->saveSet, sizeof(pointer) * numnow); if (pTmp) client->saveSet = pTmp; } else { xfree(client->saveSet); client->saveSet = (pointer *)NULL; } client->numSaved = numnow; return(Success); } return(Success); } void DeleteWindowFromAnySaveSet(pWin) WindowPtr pWin; { register int i; register ClientPtr client; for (i = 0; i< currentMaxClients; i++) { client = clients[i]; if (client && client->numSaved) (void)AlterSaveSetForClient(client, pWin, SetModeDelete); } } /* No-op Don't Do Anything : sometimes we need to be able to call a procedure * that doesn't do anything. For example, on screen with only static * colormaps, if someone calls install colormap, it's easier to have a dummy * procedure to call than to check if there's a procedure */ void NoopDDA( #undef NeedVarargsPrototypes #if NeedVarargsPrototypes void* f, ... #endif ) { } typedef struct _BlockHandler { BlockHandlerProcPtr BlockHandler; WakeupHandlerProcPtr WakeupHandler; pointer blockData; Bool deleted; } BlockHandlerRec, *BlockHandlerPtr; static BlockHandlerPtr handlers; static int numHandlers; static int sizeHandlers; static Bool inHandler; static Bool handlerDeleted; /* called from the OS layer */ void BlockHandler(pTimeout, pReadmask) pointer pTimeout; /* DIX doesn't want to know how OS represents time */ pointer pReadmask; /* nor how it represents the set of descriptors */ { register int i, j; ++inHandler; for (i = 0; i < screenInfo.numScreens; i++) (* screenInfo.screens[i]->BlockHandler)(i, screenInfo.screens[i]->blockData, pTimeout, pReadmask); for (i = 0; i < numHandlers; i++) (*handlers[i].BlockHandler) (handlers[i].blockData, pTimeout, pReadmask); if (handlerDeleted) { for (i = 0; i < numHandlers;) if (handlers[i].deleted) { for (j = i; j < numHandlers - 1; j++) handlers[j] = handlers[j+1]; numHandlers--; } else i++; handlerDeleted = FALSE; } --inHandler; } void WakeupHandler(result, pReadmask) int result; /* 32 bits of undefined result from the wait */ pointer pReadmask; /* the resulting descriptor mask */ { register int i, j; ++inHandler; for (i = numHandlers - 1; i >= 0; i--) (*handlers[i].WakeupHandler) (handlers[i].blockData, result, pReadmask); for (i = 0; i < screenInfo.numScreens; i++) (* screenInfo.screens[i]->WakeupHandler)(i, screenInfo.screens[i]->wakeupData, result, pReadmask); if (handlerDeleted) { for (i = 0; i < numHandlers;) if (handlers[i].deleted) { for (j = i; j < numHandlers - 1; j++) handlers[j] = handlers[j+1]; numHandlers--; } else i++; handlerDeleted = FALSE; } --inHandler; } /* Reentrant with BlockHandler and WakeupHandler, except wakeup won't * get called until next time */ Bool RegisterBlockAndWakeupHandlers (blockHandler, wakeupHandler, blockData) BlockHandlerProcPtr blockHandler; WakeupHandlerProcPtr wakeupHandler; pointer blockData; { BlockHandlerPtr new; if (numHandlers >= sizeHandlers) { new = (BlockHandlerPtr) xrealloc (handlers, (numHandlers + 1) * sizeof (BlockHandlerRec)); if (!new) return FALSE; handlers = new; sizeHandlers = numHandlers + 1; } handlers[numHandlers].BlockHandler = blockHandler; handlers[numHandlers].WakeupHandler = wakeupHandler; handlers[numHandlers].blockData = blockData; handlers[numHandlers].deleted = FALSE; numHandlers = numHandlers + 1; return TRUE; } void RemoveBlockAndWakeupHandlers (blockHandler, wakeupHandler, blockData) BlockHandlerProcPtr blockHandler; WakeupHandlerProcPtr wakeupHandler; pointer blockData; { int i; for (i = 0; i < numHandlers; i++) if (handlers[i].BlockHandler == blockHandler && handlers[i].WakeupHandler == wakeupHandler && handlers[i].blockData == blockData) { if (inHandler) { handlerDeleted = TRUE; handlers[i].deleted = TRUE; } else { for (; i < numHandlers - 1; i++) handlers[i] = handlers[i+1]; numHandlers--; } break; } } void InitBlockAndWakeupHandlers () { xfree (handlers); handlers = (BlockHandlerPtr) 0; numHandlers = 0; sizeHandlers = 0; } /* * A general work queue. Perform some task before the server * sleeps for input. */ WorkQueuePtr workQueue; static WorkQueuePtr *workQueueLast = &workQueue; void ProcessWorkQueue() { WorkQueuePtr q, *p; p = &workQueue; /* * Scan the work queue once, calling each function. Those * which return TRUE are removed from the queue, otherwise * they will be called again. This must be reentrant with * QueueWorkProc. */ while (q = *p) { if ((*q->function) (q->client, q->closure)) { /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ xfree (q); } else { p = &q->next; /* don't fetch until after func called */ } } workQueueLast = p; } void ProcessWorkQueueZombies() { WorkQueuePtr q, *p; p = &workQueue; while (q = *p) { if (q->client && q->client->clientGone) { (void) (*q->function) (q->client, q->closure); /* remove q from the list */ *p = q->next; /* don't fetch until after func called */ xfree (q); } else { p = &q->next; /* don't fetch until after func called */ } } workQueueLast = p; } Bool #if NeedFunctionPrototypes QueueWorkProc ( Bool (*function)( #if NeedNestedPrototypes ClientPtr /* pClient */, pointer /* closure */ #endif ), ClientPtr client, pointer closure) #else QueueWorkProc (function, client, closure) Bool (*function)(); ClientPtr client; pointer closure; #endif { WorkQueuePtr q; q = (WorkQueuePtr) xalloc (sizeof *q); if (!q) return FALSE; q->function = function; q->client = client; q->closure = closure; q->next = NULL; *workQueueLast = q; workQueueLast = &q->next; return TRUE; } /* * Manage a queue of sleeping clients, awakening them * when requested, by using the OS functions IgnoreClient * and AttendClient. Note that this *ignores* the troubles * with request data interleaving itself with events, but * we'll leave that until a later time. */ typedef struct _SleepQueue { struct _SleepQueue *next; ClientPtr client; ClientSleepProcPtr function; pointer closure; } SleepQueueRec, *SleepQueuePtr; static SleepQueuePtr sleepQueue = NULL; Bool ClientSleep (client, function, closure) ClientPtr client; ClientSleepProcPtr function; pointer closure; { SleepQueuePtr q; q = (SleepQueuePtr) xalloc (sizeof *q); if (!q) return FALSE; IgnoreClient (client); q->next = sleepQueue; q->client = client; q->function = function; q->closure = closure; sleepQueue = q; return TRUE; } Bool ClientSignal (client) ClientPtr client; { SleepQueuePtr q; for (q = sleepQueue; q; q = q->next) if (q->client == client) { return QueueWorkProc (q->function, q->client, q->closure); } return FALSE; } void ClientWakeup (client) ClientPtr client; { SleepQueuePtr q, *prev; prev = &sleepQueue; while ( (q = *prev) ) { if (q->client == client) { *prev = q->next; xfree (q); if (client->clientGone) CloseDownClient(client); else AttendClient (client); break; } prev = &q->next; } } Bool ClientIsAsleep (client) ClientPtr client; { SleepQueuePtr q; for (q = sleepQueue; q; q = q->next) if (q->client == client) return TRUE; return FALSE; } /* * Generic Callback Manager */ /* ===== Private Procedures ===== */ static int numCallbackListsToCleanup = 0; static CallbackListPtr **listsToCleanup = NULL; static Bool #if NeedFunctionPrototypes _AddCallback( CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) #else _AddCallback(pcbl, callback, data) CallbackListPtr *pcbl; CallbackProcPtr callback; pointer data; #endif { CallbackPtr cbr; cbr = (CallbackPtr) xalloc(sizeof(CallbackRec)); if (!cbr) return FALSE; cbr->proc = callback; cbr->data = data; cbr->next = (*pcbl)->list; cbr->deleted = FALSE; (*pcbl)->list = cbr; return TRUE; } static Bool #if NeedFunctionPrototypes _DeleteCallback( CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) #else _DeleteCallback(pcbl, callback, data) CallbackListPtr *pcbl; CallbackProcPtr callback; pointer data; #endif { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; for (pcbr = NULL, cbr = cbl->list; cbr != NULL; pcbr = cbr, cbr = cbr->next) { if ((cbr->proc == callback) && (cbr->data == data)) break; } if (cbr != NULL) { if (cbl->inCallback) { ++(cbl->numDeleted); cbr->deleted = TRUE; } else { if (pcbr == NULL) cbl->list = cbr->next; else pcbr->next = cbr->next; xfree(cbr); } return TRUE; } return FALSE; } static void #if NeedFunctionPrototypes _CallCallbacks( CallbackListPtr *pcbl, pointer call_data) #else _CallCallbacks(pcbl, call_data) CallbackListPtr *pcbl; pointer call_data; #endif { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, pcbr; ++(cbl->inCallback); for (cbr = cbl->list; cbr != NULL; cbr = cbr->next) { (*(cbr->proc)) (pcbl, cbr->data, call_data); } --(cbl->inCallback); if (cbl->inCallback) return; /* Was the entire list marked for deletion? */ if (cbl->deleted) { DeleteCallbackList(pcbl); return; } /* Were some individual callbacks on the list marked for deletion? * If so, do the deletions. */ if (cbl->numDeleted) { for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; ) { if (cbr->deleted) { if (pcbr) { cbr = cbr->next; xfree(pcbr->next); pcbr->next = cbr; } else { cbr = cbr->next; xfree(cbl->list); cbl->list = cbr; } cbl->numDeleted--; } else /* this one wasn't deleted */ { pcbr = cbr; cbr = cbr->next; } } } } static void #if NeedFunctionPrototypes _DeleteCallbackList( CallbackListPtr *pcbl) #else _DeleteCallbackList(pcbl) CallbackListPtr *pcbl; #endif { CallbackListPtr cbl = *pcbl; CallbackPtr cbr, nextcbr; int i; if (cbl->inCallback) { cbl->deleted = TRUE; return; } for (i = 0; i < numCallbackListsToCleanup; i++) { if ((listsToCleanup[i] = pcbl) != 0) { listsToCleanup[i] = NULL; break; } } for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) { nextcbr = cbr->next; xfree(cbr); } xfree(cbl); *pcbl = NULL; } static CallbackFuncsRec default_cbfuncs = { _AddCallback, _DeleteCallback, _CallCallbacks, _DeleteCallbackList }; /* ===== Public Procedures ===== */ Bool CreateCallbackList(pcbl, cbfuncs) CallbackListPtr *pcbl; CallbackFuncsPtr cbfuncs; { CallbackListPtr cbl; int i; if (!pcbl) return FALSE; cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs; cbl->inCallback = 0; cbl->deleted = FALSE; cbl->numDeleted = 0; cbl->list = NULL; *pcbl = cbl; for (i = 0; i < numCallbackListsToCleanup; i++) { if (!listsToCleanup[i]) { listsToCleanup[i] = pcbl; return TRUE; } } listsToCleanup = (CallbackListPtr **)xnfrealloc(listsToCleanup, sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1)); listsToCleanup[numCallbackListsToCleanup] = pcbl; numCallbackListsToCleanup++; return TRUE; } Bool AddCallback(pcbl, callback, data) CallbackListPtr *pcbl; CallbackProcPtr callback; pointer data; { if (!pcbl) return FALSE; if (!*pcbl) { /* list hasn't been created yet; go create it */ if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL)) return FALSE; } return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data)); } Bool DeleteCallback(pcbl, callback, data) CallbackListPtr *pcbl; CallbackProcPtr callback; pointer data; { if (!pcbl || !*pcbl) return FALSE; return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data)); } void CallCallbacks(pcbl, call_data) CallbackListPtr *pcbl; pointer call_data; { if (!pcbl || !*pcbl) return; (*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data); } void DeleteCallbackList(pcbl) CallbackListPtr *pcbl; { if (!pcbl || !*pcbl) return; (*(*pcbl)->funcs.DeleteCallbackList) (pcbl); } void InitCallbackManager() { int i; for (i = 0; i < numCallbackListsToCleanup; i++) { DeleteCallbackList(listsToCleanup[i]); } if (listsToCleanup) xfree(listsToCleanup); numCallbackListsToCleanup = 0; listsToCleanup = NULL; } vnc_unixsrc/Xvnc/programs/Xserver/dix/Imakefile0100664000076400007640000000534707463513423021313 0ustar constconstXCOMM $XConsortium: Imakefile /main/52 1996/12/02 10:20:03 lehors $ XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.8 1997/01/08 20:32:47 dawes Exp $ #include #if PrintOnlyServer XPSRC = xpstubs.c XPOBJ = xpstubs.o #endif #if !HasFfs FFS_SRC = ffs.c FFS_OBJ = ffs.o #endif SRCS = atom.c colormap.c cursor.c devices.c dispatch.c dixutils.c events.c \ extension.c gc.c globals.c glyphcurs.c grabs.c \ main.c property.c resource.c swaprep.c swapreq.c \ tables.c window.c initatoms.c dixfonts.c privates.c pixmap.c $(FFS_SRC) OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \ extension.o gc.o globals.o glyphcurs.o grabs.o \ main.o property.o resource.o swaprep.o swapreq.o \ tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) LINTLIBS = ../os/llib-los.ln /* * The following configuration parameters may be set in the appropriate * .macros files or site.def in the directory util/imake.includes/: * * DefaultFontPath COMPILEDDEFAULTFONTPATH * DefaultRGBDatabase RGB_DB * * The sample util/imake.includes/Imake.tmpl will provide generic defaults. * The values in site.h are simply a last line of defense and should not be * changed. */ #ifdef DefaultFontPath DEFAULTFONTPATH = DefaultFontPath SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\" #endif #ifdef DefaultRGBDatabase DEFAULTRGBDATABASE = DefaultRGBDatabase SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\" #endif #ifdef DefaultDisplayClass DEFAULTDISPLAYCLASS = DefaultDisplayClass SITE_DISPLAY_CLASS = -DCOMPILEDDISPLAYCLASS=\"$(DEFAULTDISPLAYCLASS)\" #endif #ifdef XVendorString VENDORSTRING = XVendorString VENDOR_STRING = -DVENDOR_STRING="$(VENDORSTRING)" #endif #ifdef XVendorRelease VENDORRELEASE = XVendorRelease VENDOR_RELEASE = -DVENDOR_RELEASE=$(VENDORRELEASE) #endif #if HasKrb5 K5DEFS = Krb5Defines #endif SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_RGB_DB) $(SITE_DISPLAY_CLASS) VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) NormalLibraryObjectRule() NormalLibraryTarget(dix,$(OBJS)) LintLibraryTarget(dix,$(SRCS) $(XPSRC)) NormalLintTarget($(SRCS) $(XPSRC)) SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES)) SpecialCObjectRule(tables,$(ICONFIGFILES),$(K5DEFS)) SpecialCObjectRule(dispatch,$(ICONFIGFILES),$(K5DEFS)) SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES)) SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_)) #if PrintOnlyServer NormalLibraryTarget(xpstubs,$(XPOBJ)) #endif InstallLinkKitLibrary(dix,$(LINKKITDIR)/lib) InstallLinkKitLibrary(xpstubs,$(LINKKITDIR)/lib) DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/dix/initatoms.c0100664000076400007640000001144507120677563021657 0ustar constconst/* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #include "X.h" #include "Xatom.h" #include "misc.h" #include "dix.h" void MakePredeclaredAtoms() { if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError(); if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError(); if (MakeAtom("ARC", 3, 1) != XA_ARC) AtomError(); if (MakeAtom("ATOM", 4, 1) != XA_ATOM) AtomError(); if (MakeAtom("BITMAP", 6, 1) != XA_BITMAP) AtomError(); if (MakeAtom("CARDINAL", 8, 1) != XA_CARDINAL) AtomError(); if (MakeAtom("COLORMAP", 8, 1) != XA_COLORMAP) AtomError(); if (MakeAtom("CURSOR", 6, 1) != XA_CURSOR) AtomError(); if (MakeAtom("CUT_BUFFER0", 11, 1) != XA_CUT_BUFFER0) AtomError(); if (MakeAtom("CUT_BUFFER1", 11, 1) != XA_CUT_BUFFER1) AtomError(); if (MakeAtom("CUT_BUFFER2", 11, 1) != XA_CUT_BUFFER2) AtomError(); if (MakeAtom("CUT_BUFFER3", 11, 1) != XA_CUT_BUFFER3) AtomError(); if (MakeAtom("CUT_BUFFER4", 11, 1) != XA_CUT_BUFFER4) AtomError(); if (MakeAtom("CUT_BUFFER5", 11, 1) != XA_CUT_BUFFER5) AtomError(); if (MakeAtom("CUT_BUFFER6", 11, 1) != XA_CUT_BUFFER6) AtomError(); if (MakeAtom("CUT_BUFFER7", 11, 1) != XA_CUT_BUFFER7) AtomError(); if (MakeAtom("DRAWABLE", 8, 1) != XA_DRAWABLE) AtomError(); if (MakeAtom("FONT", 4, 1) != XA_FONT) AtomError(); if (MakeAtom("INTEGER", 7, 1) != XA_INTEGER) AtomError(); if (MakeAtom("PIXMAP", 6, 1) != XA_PIXMAP) AtomError(); if (MakeAtom("POINT", 5, 1) != XA_POINT) AtomError(); if (MakeAtom("RECTANGLE", 9, 1) != XA_RECTANGLE) AtomError(); if (MakeAtom("RESOURCE_MANAGER", 16, 1) != XA_RESOURCE_MANAGER) AtomError(); if (MakeAtom("RGB_COLOR_MAP", 13, 1) != XA_RGB_COLOR_MAP) AtomError(); if (MakeAtom("RGB_BEST_MAP", 12, 1) != XA_RGB_BEST_MAP) AtomError(); if (MakeAtom("RGB_BLUE_MAP", 12, 1) != XA_RGB_BLUE_MAP) AtomError(); if (MakeAtom("RGB_DEFAULT_MAP", 15, 1) != XA_RGB_DEFAULT_MAP) AtomError(); if (MakeAtom("RGB_GRAY_MAP", 12, 1) != XA_RGB_GRAY_MAP) AtomError(); if (MakeAtom("RGB_GREEN_MAP", 13, 1) != XA_RGB_GREEN_MAP) AtomError(); if (MakeAtom("RGB_RED_MAP", 11, 1) != XA_RGB_RED_MAP) AtomError(); if (MakeAtom("STRING", 6, 1) != XA_STRING) AtomError(); if (MakeAtom("VISUALID", 8, 1) != XA_VISUALID) AtomError(); if (MakeAtom("WINDOW", 6, 1) != XA_WINDOW) AtomError(); if (MakeAtom("WM_COMMAND", 10, 1) != XA_WM_COMMAND) AtomError(); if (MakeAtom("WM_HINTS", 8, 1) != XA_WM_HINTS) AtomError(); if (MakeAtom("WM_CLIENT_MACHINE", 17, 1) != XA_WM_CLIENT_MACHINE) AtomError(); if (MakeAtom("WM_ICON_NAME", 12, 1) != XA_WM_ICON_NAME) AtomError(); if (MakeAtom("WM_ICON_SIZE", 12, 1) != XA_WM_ICON_SIZE) AtomError(); if (MakeAtom("WM_NAME", 7, 1) != XA_WM_NAME) AtomError(); if (MakeAtom("WM_NORMAL_HINTS", 15, 1) != XA_WM_NORMAL_HINTS) AtomError(); if (MakeAtom("WM_SIZE_HINTS", 13, 1) != XA_WM_SIZE_HINTS) AtomError(); if (MakeAtom("WM_ZOOM_HINTS", 13, 1) != XA_WM_ZOOM_HINTS) AtomError(); if (MakeAtom("MIN_SPACE", 9, 1) != XA_MIN_SPACE) AtomError(); if (MakeAtom("NORM_SPACE", 10, 1) != XA_NORM_SPACE) AtomError(); if (MakeAtom("MAX_SPACE", 9, 1) != XA_MAX_SPACE) AtomError(); if (MakeAtom("END_SPACE", 9, 1) != XA_END_SPACE) AtomError(); if (MakeAtom("SUPERSCRIPT_X", 13, 1) != XA_SUPERSCRIPT_X) AtomError(); if (MakeAtom("SUPERSCRIPT_Y", 13, 1) != XA_SUPERSCRIPT_Y) AtomError(); if (MakeAtom("SUBSCRIPT_X", 11, 1) != XA_SUBSCRIPT_X) AtomError(); if (MakeAtom("SUBSCRIPT_Y", 11, 1) != XA_SUBSCRIPT_Y) AtomError(); if (MakeAtom("UNDERLINE_POSITION", 18, 1) != XA_UNDERLINE_POSITION) AtomError(); if (MakeAtom("UNDERLINE_THICKNESS", 19, 1) != XA_UNDERLINE_THICKNESS) AtomError(); if (MakeAtom("STRIKEOUT_ASCENT", 16, 1) != XA_STRIKEOUT_ASCENT) AtomError(); if (MakeAtom("STRIKEOUT_DESCENT", 17, 1) != XA_STRIKEOUT_DESCENT) AtomError(); if (MakeAtom("ITALIC_ANGLE", 12, 1) != XA_ITALIC_ANGLE) AtomError(); if (MakeAtom("X_HEIGHT", 8, 1) != XA_X_HEIGHT) AtomError(); if (MakeAtom("QUAD_WIDTH", 10, 1) != XA_QUAD_WIDTH) AtomError(); if (MakeAtom("WEIGHT", 6, 1) != XA_WEIGHT) AtomError(); if (MakeAtom("POINT_SIZE", 10, 1) != XA_POINT_SIZE) AtomError(); if (MakeAtom("RESOLUTION", 10, 1) != XA_RESOLUTION) AtomError(); if (MakeAtom("COPYRIGHT", 9, 1) != XA_COPYRIGHT) AtomError(); if (MakeAtom("NOTICE", 6, 1) != XA_NOTICE) AtomError(); if (MakeAtom("FONT_NAME", 9, 1) != XA_FONT_NAME) AtomError(); if (MakeAtom("FAMILY_NAME", 11, 1) != XA_FAMILY_NAME) AtomError(); if (MakeAtom("FULL_NAME", 9, 1) != XA_FULL_NAME) AtomError(); if (MakeAtom("CAP_HEIGHT", 10, 1) != XA_CAP_HEIGHT) AtomError(); if (MakeAtom("WM_CLASS", 8, 1) != XA_WM_CLASS) AtomError(); if (MakeAtom("WM_TRANSIENT_FOR", 16, 1) != XA_WM_TRANSIENT_FOR) AtomError(); } vnc_unixsrc/Xvnc/programs/Xserver/dix/extension.c0100664000076400007640000003043107120677563021660 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: extension.c /main/36 1996/09/28 11:23:27 rws $ */ /* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.5 1996/12/23 06:29:44 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #define NEED_REPLIES #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "gcstruct.h" #include "scrnintstr.h" #include "dispatch.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #define EXTENSION_BASE 128 #define EXTENSION_EVENT_BASE 64 #define LAST_EVENT 128 #define LAST_ERROR 255 ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; static ExtensionEntry **extensions = (ExtensionEntry **)NULL; int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = 0; ExtensionEntry *AddExtension(name, NumEvents, NumErrors, MainProc, SwappedMainProc, CloseDownProc, MinorOpcodeProc) char *name; int NumEvents; int NumErrors; int (* MainProc)(); int (* SwappedMainProc)(); void (* CloseDownProc)(); unsigned short (* MinorOpcodeProc)(); { int i; register ExtensionEntry *ext, **newexts; if (!MainProc || !SwappedMainProc || !CloseDownProc || !MinorOpcodeProc) return((ExtensionEntry *) NULL); if ((lastEvent + NumEvents > LAST_EVENT) || (unsigned)(lastError + NumErrors > LAST_ERROR)) return((ExtensionEntry *) NULL); ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); if (!ext) return((ExtensionEntry *) NULL); ext->name = (char *)xalloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; if (!ext->name) { xfree(ext); return((ExtensionEntry *) NULL); } strcpy(ext->name, name); i = NumExtensions; newexts = (ExtensionEntry **) xrealloc(extensions, (i + 1) * sizeof(ExtensionEntry *)); if (!newexts) { xfree(ext->name); xfree(ext); return((ExtensionEntry *) NULL); } NumExtensions++; extensions = newexts; extensions[i] = ext; ext->index = i; ext->base = i + EXTENSION_BASE; ext->CloseDown = CloseDownProc; ext->MinorOpcode = MinorOpcodeProc; ProcVector[i + EXTENSION_BASE] = MainProc; SwappedProcVector[i + EXTENSION_BASE] = SwappedMainProc; if (NumEvents) { ext->eventBase = lastEvent; ext->eventLast = lastEvent + NumEvents; lastEvent += NumEvents; } else { ext->eventBase = 0; ext->eventLast = 0; } if (NumErrors) { ext->errorBase = lastError; ext->errorLast = lastError + NumErrors; lastError += NumErrors; } else { ext->errorBase = 0; ext->errorLast = 0; } #ifdef XCSECURITY ext->secure = FALSE; #endif #ifdef LBX (void) LbxAddExtension(name, ext->base, ext->eventBase, ext->errorBase); #endif return(ext); } Bool AddExtensionAlias(alias, ext) char *alias; ExtensionEntry *ext; { char *name; char **aliases; aliases = (char **)xrealloc(ext->aliases, (ext->num_aliases + 1) * sizeof(char *)); if (!aliases) return FALSE; ext->aliases = aliases; name = (char *)xalloc(strlen(alias) + 1); if (!name) return FALSE; strcpy(name, alias); ext->aliases[ext->num_aliases] = name; ext->num_aliases++; #ifdef LBX return LbxAddExtensionAlias(ext->index, alias); #else return TRUE; #endif } static int FindExtension(extname, len) char *extname; int len; { int i, j; for (i=0; iname) == len) && !strncmp(extname, extensions[i]->name, len)) break; for (j = extensions[i]->num_aliases; --j >= 0;) { if ((strlen(extensions[i]->aliases[j]) == len) && !strncmp(extname, extensions[i]->aliases[j], len)) break; } if (j >= 0) break; } return ((i == NumExtensions) ? -1 : i); } void DeclareExtensionSecurity(extname, secure) char *extname; Bool secure; { #ifdef XCSECURITY int i = FindExtension(extname, strlen(extname)); if (i >= 0) { int majorop = extensions[i]->base; extensions[i]->secure = secure; if (secure) { UntrustedProcVector[majorop] = ProcVector[majorop]; SwappedUntrustedProcVector[majorop] = SwappedProcVector[majorop]; } else { UntrustedProcVector[majorop] = ProcBadRequest; SwappedUntrustedProcVector[majorop] = ProcBadRequest; } } #endif #ifdef LBX LbxDeclareExtensionSecurity(extname, secure); #endif } unsigned short StandardMinorOpcode(client) ClientPtr client; { return ((xReq *)client->requestBuffer)->data; } unsigned short MinorOpcodeOfRequest(client) ClientPtr client; { unsigned char major; major = ((xReq *)client->requestBuffer)->reqType; if (major < EXTENSION_BASE) return 0; major -= EXTENSION_BASE; if (major >= NumExtensions) return 0; return (*extensions[major]->MinorOpcode)(client); } void CloseDownExtensions() { register int i,j; #ifdef LBX LbxCloseDownExtensions(); #endif for (i = NumExtensions - 1; i >= 0; i--) { (* extensions[i]->CloseDown)(extensions[i]); NumExtensions = i; xfree(extensions[i]->name); for (j = extensions[i]->num_aliases; --j >= 0;) xfree(extensions[i]->aliases[j]); xfree(extensions[i]->aliases); xfree(extensions[i]); } xfree(extensions); extensions = (ExtensionEntry **)NULL; lastEvent = EXTENSION_EVENT_BASE; lastError = FirstExtensionError; for (i=0; inum) { spentry->num--; xfree(spentry->procList[spentry->num].name); } xfree(spentry->procList); spentry->procList = (ProcEntryPtr)NULL; } } int ProcQueryExtension(client) ClientPtr client; { xQueryExtensionReply reply; int i; REQUEST(xQueryExtensionReq); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); reply.type = X_Reply; reply.length = 0; reply.major_opcode = 0; reply.sequenceNumber = client->sequence; if ( ! NumExtensions ) reply.present = xFalse; else { i = FindExtension((char *)&stuff[1], stuff->nbytes); if (i < 0 #ifdef XCSECURITY /* don't show insecure extensions to untrusted clients */ || (client->trustLevel == XSecurityClientUntrusted && !extensions[i]->secure) #endif ) reply.present = xFalse; else { reply.present = xTrue; reply.major_opcode = extensions[i]->base; reply.first_event = extensions[i]->eventBase; reply.first_error = extensions[i]->errorBase; } } WriteReplyToClient(client, sizeof(xQueryExtensionReply), &reply); return(client->noClientException); } int ProcListExtensions(client) ClientPtr client; { xListExtensionsReply reply; char *bufptr, *buffer; int total_length = 0; REQUEST_SIZE_MATCH(xReq); reply.type = X_Reply; reply.nExtensions = 0; reply.length = 0; reply.sequenceNumber = client->sequence; buffer = NULL; if ( NumExtensions ) { register int i, j; for (i=0; itrustLevel == XSecurityClientUntrusted && !extensions[i]->secure) continue; #endif total_length += strlen(extensions[i]->name) + 1; reply.nExtensions += 1 + extensions[i]->num_aliases; for (j = extensions[i]->num_aliases; --j >= 0;) total_length += strlen(extensions[i]->aliases[j]) + 1; } reply.length = (total_length + 3) >> 2; buffer = bufptr = (char *)ALLOCATE_LOCAL(total_length); if (!buffer) return(BadAlloc); for (i=0; itrustLevel == XSecurityClientUntrusted && !extensions[i]->secure) continue; #endif *bufptr++ = len = strlen(extensions[i]->name); memmove(bufptr, extensions[i]->name, len); bufptr += len; for (j = extensions[i]->num_aliases; --j >= 0;) { *bufptr++ = len = strlen(extensions[i]->aliases[j]); memmove(bufptr, extensions[i]->aliases[j], len); bufptr += len; } } } WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply); if (reply.length) { WriteToClient(client, total_length, buffer); DEALLOCATE_LOCAL(buffer); } return(client->noClientException); } ExtensionLookupProc LookupProc(name, pGC) char *name; GCPtr pGC; { register int i; register ScreenProcEntry *spentry; spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum]; if (spentry->num) { for (i = 0; i < spentry->num; i++) if (strcmp(name, spentry->procList[i].name) == 0) return(spentry->procList[i].proc); } return (ExtensionLookupProc)NULL; } Bool RegisterProc(name, pGC, proc) char *name; GC *pGC; ExtensionLookupProc proc; { return RegisterScreenProc(name, pGC->pScreen, proc); } Bool RegisterScreenProc(name, pScreen, proc) char *name; ScreenPtr pScreen; ExtensionLookupProc proc; { register ScreenProcEntry *spentry; register ProcEntryPtr procEntry = (ProcEntryPtr)NULL; char *newname; int i; spentry = &AuxillaryScreenProcs[pScreen->myNum]; /* first replace duplicates */ if (spentry->num) { for (i = 0; i < spentry->num; i++) if (strcmp(name, spentry->procList[i].name) == 0) { procEntry = &spentry->procList[i]; break; } } if (procEntry) procEntry->proc = proc; else { newname = (char *)xalloc(strlen(name)+1); if (!newname) return FALSE; procEntry = (ProcEntryPtr) xrealloc(spentry->procList, sizeof(ProcEntryRec) * (spentry->num+1)); if (!procEntry) { xfree(newname); return FALSE; } spentry->procList = procEntry; procEntry += spentry->num; procEntry->name = newname; strcpy(newname, name); procEntry->proc = proc; spentry->num++; } return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/dix/ffs.c0100664000076400007640000000264107120677563020424 0ustar constconst/* $XConsortium: ffs.c /main/1 1996/12/02 10:20:11 lehors $ */ /* Copyright (C) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft- ware"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following condi- tions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ int ffs(int i) { int j; for (j = 1; (i & 1) == 0; j++) i >>= 1; return j; } vnc_unixsrc/Xvnc/programs/Xserver/dix/glyphcurs.c0100664000076400007640000001437007120677563021670 0ustar constconst/************************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* $XConsortium: glyphcurs.c /main/28 1996/08/01 19:21:16 dpw $ */ #include "misc.h" #include "fontstruct.h" #include "dixfontstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "resource.h" #include "dix.h" #include "cursorstr.h" #include "opaque.h" #include "servermd.h" /* get the bits out of the font in a portable way. to avoid dealing with padding and such-like, we draw the glyph into a bitmap, then read the bits out with GetImage, which uses server-natural format. since all screens return the same bitmap format, we'll just use the first one we find. the character origin lines up with the hotspot in the cursor metrics. */ int ServerBitsFromGlyph(pfont, ch, cm, ppbits) FontPtr pfont; unsigned int ch; register CursorMetricPtr cm; unsigned char **ppbits; { register ScreenPtr pScreen; register GCPtr pGC; xRectangle rect; PixmapPtr ppix; long nby; char *pbits; ChangeGCVal gcval[3]; unsigned char char2b[2]; /* turn glyph index into a protocol-format char2b */ char2b[0] = (unsigned char)(ch >> 8); char2b[1] = (unsigned char)(ch & 0xff); pScreen = screenInfo.screens[0]; nby = BitmapBytePad(cm->width) * (long)cm->height; pbits = (char *)xalloc(nby); if (!pbits) return BadAlloc; /* zeroing the (pad) bits seems to help some ddx cursor handling */ bzero(pbits, nby); ppix = (PixmapPtr)(*pScreen->CreatePixmap)(pScreen, cm->width, cm->height, 1); pGC = GetScratchGC(1, pScreen); if (!ppix || !pGC) { if (ppix) (*pScreen->DestroyPixmap)(ppix); if (pGC) FreeScratchGC(pGC); xfree(pbits); return BadAlloc; } rect.x = 0; rect.y = 0; rect.width = cm->width; rect.height = cm->height; /* fill the pixmap with 0 */ gcval[0].val = GXcopy; gcval[1].val = 0; gcval[2].ptr = (pointer)pfont; dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); (*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect); /* draw the glyph */ gcval[0].val = 1; dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval); ValidateGC((DrawablePtr)ppix, pGC); (*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot, 1, (unsigned short *)char2b); (*pScreen->GetImage)((DrawablePtr)ppix, 0, 0, cm->width, cm->height, XYPixmap, 1, pbits); *ppbits = (unsigned char *)pbits; FreeScratchGC(pGC); (*pScreen->DestroyPixmap)(ppix); return Success; } Bool CursorMetricsFromGlyph( pfont, ch, cm) register FontPtr pfont; unsigned ch; register CursorMetricPtr cm; { CharInfoPtr pci; unsigned long nglyphs; CARD8 chs[2]; FontEncoding encoding; chs[0] = ch >> 8; chs[1] = ch; encoding = (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit; if (encoding == Linear16Bit) { if (ch < pfont->info.firstCol || pfont->info.lastCol < ch) return FALSE; } else { if (chs[0] < pfont->info.firstRow || pfont->info.lastRow < chs[0]) return FALSE; if (chs[1] < pfont->info.firstCol || pfont->info.lastCol < chs[1]) return FALSE; } (*pfont->get_glyphs) (pfont, 1, chs, encoding, &nglyphs, &pci); if (nglyphs == 0) return FALSE; cm->width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; cm->height = pci->metrics.descent + pci->metrics.ascent; if (pci->metrics.leftSideBearing > 0) { cm->width += pci->metrics.leftSideBearing; cm->xhot = 0; } else { cm->xhot = -pci->metrics.leftSideBearing; if (pci->metrics.rightSideBearing < 0) cm->width -= pci->metrics.rightSideBearing; } if (pci->metrics.ascent < 0) { cm->height -= pci->metrics.ascent; cm->yhot = 0; } else { cm->yhot = pci->metrics.ascent; if (pci->metrics.descent < 0) cm->height -= pci->metrics.descent; } return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/dix/swaprep.c0100664000076400007640000011520407120677563021327 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: swaprep.c /main/25 1995/12/08 13:39:45 dpw $ */ /* $XFree86: xc/programs/Xserver/dix/swaprep.c,v 3.2 1996/04/15 11:19:58 dawes Exp $ */ #include "X.h" #define NEED_REPLIES #define NEED_EVENTS #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "fontstruct.h" #include "scrnintstr.h" #include "swaprep.h" static void SwapFontInfo( #if NeedFunctionPrototypes xQueryFontReply * /* pr */ #endif ); #ifndef LBX static void SwapCharInfo( #if NeedFunctionPrototypes xCharInfo * /* pInfo */ #endif ); static void SwapFont( #if NeedFunctionPrototypes xQueryFontReply * /* pr */, Bool /* hasGlyphs */ #endif ); #endif /* Thanks to Jack Palevich for testing and subsequently rewriting all this */ void Swap32Write(pClient, size, pbuf) ClientPtr pClient; int size; /* in bytes */ register CARD32 *pbuf; { register int i; register char n; size >>= 2; for(i = 0; i < size; i++) /* brackets are mandatory here, because "swapl" macro expands to several statements */ { swapl(&pbuf[i], n); } (void)WriteToClient(pClient, size << 2, (char *) pbuf); } void CopySwap32Write(pClient, size, pbuf) ClientPtr pClient; int size; /* in bytes */ CARD32 *pbuf; { int bufsize = size; CARD32 *pbufT; register CARD32 *from, *to, *fromLast, *toLast; CARD32 tmpbuf[1]; /* Allocate as big a buffer as we can... */ while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize))) { bufsize >>= 1; if (bufsize == 4) { pbufT = tmpbuf; break; } } /* convert lengths from # of bytes to # of longs */ size >>= 2; bufsize >>= 2; from = pbuf; fromLast = from + size; while (from < fromLast) { int nbytes; to = pbufT; toLast = to + min (bufsize, fromLast - from); nbytes = (toLast - to) << 2; while (to < toLast) { /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro that evaulates its args more than once */ cpswapl(*from, *to); from++; to++; } (void)WriteToClient (pClient, nbytes, (char *) pbufT); } if (pbufT != tmpbuf) DEALLOCATE_LOCAL ((char *) pbufT); } void CopySwap16Write(pClient, size, pbuf) ClientPtr pClient; int size; /* in bytes */ short *pbuf; { int bufsize = size; short *pbufT; register short *from, *to, *fromLast, *toLast; short tmpbuf[2]; /* Allocate as big a buffer as we can... */ while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize))) { bufsize >>= 1; if (bufsize == 4) { pbufT = tmpbuf; break; } } /* convert lengths from # of bytes to # of shorts */ size >>= 1; bufsize >>= 1; from = pbuf; fromLast = from + size; while (from < fromLast) { int nbytes; to = pbufT; toLast = to + min (bufsize, fromLast - from); nbytes = (toLast - to) << 1; while (to < toLast) { /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro that evaulates its args more than once */ cpswaps(*from, *to); from++; to++; } (void)WriteToClient (pClient, nbytes, (char *) pbufT); } if (pbufT != tmpbuf) DEALLOCATE_LOCAL ((char *) pbufT); } /* Extra-small reply */ void SGenericReply(pClient, size, pRep) ClientPtr pClient; int size; xGenericReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); (void)WriteToClient(pClient, size, (char *) pRep); } /* Extra-large reply */ void SGetWindowAttributesReply(pClient, size, pRep) ClientPtr pClient; int size; xGetWindowAttributesReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->visualID, n); swaps(&pRep->class, n); swapl(&pRep->backingBitPlanes, n); swapl(&pRep->backingPixel, n); swapl(&pRep->colormap, n); swapl(&pRep->allEventMasks, n); swapl(&pRep->yourEventMask, n); swaps(&pRep->doNotPropagateMask, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetGeometryReply(pClient, size, pRep) ClientPtr pClient; int size; xGetGeometryReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->root, n); swaps(&pRep->x, n); swaps(&pRep->y, n); swaps(&pRep->width, n); swaps(&pRep->height, n); swaps(&pRep->borderWidth, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SQueryTreeReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryTreeReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->root, n); swapl(&pRep->parent, n); swaps(&pRep->nChildren, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SInternAtomReply(pClient, size, pRep) ClientPtr pClient; int size; xInternAtomReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->atom, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetAtomNameReply(pClient, size, pRep) ClientPtr pClient; int size; xGetAtomNameReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nameLength, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetPropertyReply(pClient, size, pRep) ClientPtr pClient; int size; xGetPropertyReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->propertyType, n); swapl(&pRep->bytesAfter, n); swapl(&pRep->nItems, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SListPropertiesReply(pClient, size, pRep) ClientPtr pClient; int size; xListPropertiesReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nProperties, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetSelectionOwnerReply(pClient, size, pRep) ClientPtr pClient; int size; xGetSelectionOwnerReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->owner, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SQueryPointerReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryPointerReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->root, n); swapl(&pRep->child, n); swaps(&pRep->rootX, n); swaps(&pRep->rootY, n); swaps(&pRep->winX, n); swaps(&pRep->winY, n); swaps(&pRep->mask, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SwapTimecoord(pCoord) xTimecoord *pCoord; { register char n; swapl(&pCoord->time, n); swaps(&pCoord->x, n); swaps(&pCoord->y, n); } void SwapTimeCoordWrite(pClient, size, pRep) ClientPtr pClient; int size; xTimecoord *pRep; { int i, n; xTimecoord *pRepT; n = size / sizeof(xTimecoord); pRepT = pRep; for(i = 0; i < n; i++) { SwapTimecoord(pRepT); pRepT++; } (void)WriteToClient(pClient, size, (char *) pRep); } void SGetMotionEventsReply(pClient, size, pRep) ClientPtr pClient; int size; xGetMotionEventsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->nEvents, n); (void)WriteToClient(pClient, size, (char *) pRep); } void STranslateCoordsReply(pClient, size, pRep) ClientPtr pClient; int size; xTranslateCoordsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->child, n); swaps(&pRep->dstX, n); swaps(&pRep->dstY, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetInputFocusReply(pClient, size, pRep) ClientPtr pClient; int size; xGetInputFocusReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->focus, n); (void)WriteToClient(pClient, size, (char *) pRep); } /* extra long reply */ void SQueryKeymapReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryKeymapReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); (void)WriteToClient(pClient, size, (char *) pRep); } #ifndef LBX static #endif void SwapCharInfo(pInfo) xCharInfo *pInfo; { register char n; swaps(&pInfo->leftSideBearing, n); swaps(&pInfo->rightSideBearing, n); swaps(&pInfo->characterWidth, n); swaps(&pInfo->ascent, n); swaps(&pInfo->descent, n); swaps(&pInfo->attributes, n); } static void SwapFontInfo(pr) xQueryFontReply *pr; { register char n; swaps(&pr->minCharOrByte2, n); swaps(&pr->maxCharOrByte2, n); swaps(&pr->defaultChar, n); swaps(&pr->nFontProps, n); swaps(&pr->fontAscent, n); swaps(&pr->fontDescent, n); SwapCharInfo( &pr->minBounds); SwapCharInfo( &pr->maxBounds); swapl(&pr->nCharInfos, n); } #ifndef LBX static #endif void SwapFont( pr, hasGlyphs) xQueryFontReply * pr; Bool hasGlyphs; { unsigned i; xCharInfo * pxci; unsigned nchars, nprops; char *pby; register char n; swaps(&pr->sequenceNumber, n); swapl(&pr->length, n); nchars = pr->nCharInfos; nprops = pr->nFontProps; SwapFontInfo(pr); pby = (char *) &pr[1]; /* Font properties are an atom and either an int32 or a CARD32, so * they are always 2 4 byte values */ for(i = 0; i < nprops; i++) { swapl(pby, n); pby += 4; swapl(pby, n); pby += 4; } if (hasGlyphs) { pxci = (xCharInfo *)pby; for(i = 0; i< nchars; i++, pxci++) SwapCharInfo(pxci); } } void SQueryFontReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryFontReply *pRep; { SwapFont(pRep, TRUE); (void)WriteToClient(pClient, size, (char *) pRep); } void SQueryTextExtentsReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryTextExtentsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->fontAscent, n); swaps(&pRep->fontDescent, n); swaps(&pRep->overallAscent, n); swaps(&pRep->overallDescent, n); swapl(&pRep->overallWidth, n); swapl(&pRep->overallLeft, n); swapl(&pRep->overallRight, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SListFontsReply(pClient, size, pRep) ClientPtr pClient; int size; xListFontsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nFonts, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SListFontsWithInfoReply(pClient, size, pRep) ClientPtr pClient; int size; xListFontsWithInfoReply *pRep; { SwapFont((xQueryFontReply *)pRep, FALSE); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetFontPathReply(pClient, size, pRep) ClientPtr pClient; int size; xGetFontPathReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nPaths, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetImageReply(pClient, size, pRep) ClientPtr pClient; int size; xGetImageReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->visual, n); (void)WriteToClient(pClient, size, (char *) pRep); /* Fortunately, image doesn't need swapping */ } void SListInstalledColormapsReply(pClient, size, pRep) ClientPtr pClient; int size; xListInstalledColormapsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nColormaps, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SAllocColorReply(pClient, size, pRep) ClientPtr pClient; int size; xAllocColorReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->red, n); swaps(&pRep->green, n); swaps(&pRep->blue, n); swapl(&pRep->pixel, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SAllocNamedColorReply(pClient, size, pRep) ClientPtr pClient; int size; xAllocNamedColorReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->pixel, n); swaps(&pRep->exactRed, n); swaps(&pRep->exactGreen, n); swaps(&pRep->exactBlue, n); swaps(&pRep->screenRed, n); swaps(&pRep->screenGreen, n); swaps(&pRep->screenBlue, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SAllocColorCellsReply(pClient, size, pRep) ClientPtr pClient; int size; xAllocColorCellsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nPixels, n); swaps(&pRep->nMasks, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SAllocColorPlanesReply(pClient, size, pRep) ClientPtr pClient; int size; xAllocColorPlanesReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nPixels, n); swapl(&pRep->redMask, n); swapl(&pRep->greenMask, n); swapl(&pRep->blueMask, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SwapRGB(prgb) xrgb *prgb; { register char n; swaps(&prgb->red, n); swaps(&prgb->green, n); swaps(&prgb->blue, n); } void SQColorsExtend(pClient, size, prgb) ClientPtr pClient; int size; xrgb *prgb; { int i, n; xrgb *prgbT; n = size / sizeof(xrgb); prgbT = prgb; for(i = 0; i < n; i++) { SwapRGB(prgbT); prgbT++; } (void)WriteToClient(pClient, size, (char *) prgb); } void SQueryColorsReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryColorsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nColors, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SLookupColorReply(pClient, size, pRep) ClientPtr pClient; int size; xLookupColorReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->exactRed, n); swaps(&pRep->exactGreen, n); swaps(&pRep->exactBlue, n); swaps(&pRep->screenRed, n); swaps(&pRep->screenGreen, n); swaps(&pRep->screenBlue, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SQueryBestSizeReply(pClient, size, pRep) ClientPtr pClient; int size; xQueryBestSizeReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->width, n); swaps(&pRep->height, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SListExtensionsReply(pClient, size, pRep) ClientPtr pClient; int size; xListExtensionsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetKeyboardMappingReply(pClient, size, pRep) ClientPtr pClient; int size; xGetKeyboardMappingReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetPointerMappingReply(pClient, size, pRep) ClientPtr pClient; int size; xGetPointerMappingReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetModifierMappingReply(pClient, size, pRep) ClientPtr pClient; int size; xGetModifierMappingReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetKeyboardControlReply(pClient, size, pRep) ClientPtr pClient; int size; xGetKeyboardControlReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swapl(&pRep->ledMask, n); swaps(&pRep->bellPitch, n); swaps(&pRep->bellDuration, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetPointerControlReply(pClient, size, pRep) ClientPtr pClient; int size; xGetPointerControlReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->accelNumerator, n); swaps(&pRep->accelDenominator, n); swaps(&pRep->threshold, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SGetScreenSaverReply(pClient, size, pRep) ClientPtr pClient; int size; xGetScreenSaverReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swaps(&pRep->timeout, n); swaps(&pRep->interval, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SLHostsExtend(pClient, size, buf) ClientPtr pClient; int size; char *buf; { char *bufT = buf; char *endbuf = buf + size; while (bufT < endbuf) { xHostEntry *host = (xHostEntry *) bufT; int len = host->length; register char n; swaps (&host->length, n); bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2); } (void)WriteToClient (pClient, size, buf); } void SListHostsReply(pClient, size, pRep) ClientPtr pClient; int size; xListHostsReply *pRep; { register char n; swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, n); swaps(&pRep->nHosts, n); (void)WriteToClient(pClient, size, (char *) pRep); } void SErrorEvent(from, to) xError *from, *to; { to->type = X_Error; to->errorCode = from->errorCode; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->resourceID, to->resourceID); cpswaps(from->minorCode, to->minorCode); to->majorCode = from->majorCode; } void SKeyButtonPtrEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.keyButtonPointer.time, to->u.keyButtonPointer.time); cpswapl(from->u.keyButtonPointer.root, to->u.keyButtonPointer.root); cpswapl(from->u.keyButtonPointer.event, to->u.keyButtonPointer.event); cpswapl(from->u.keyButtonPointer.child, to->u.keyButtonPointer.child); cpswaps(from->u.keyButtonPointer.rootX, to->u.keyButtonPointer.rootX); cpswaps(from->u.keyButtonPointer.rootY, to->u.keyButtonPointer.rootY); cpswaps(from->u.keyButtonPointer.eventX, to->u.keyButtonPointer.eventX); cpswaps(from->u.keyButtonPointer.eventY, to->u.keyButtonPointer.eventY); cpswaps(from->u.keyButtonPointer.state, to->u.keyButtonPointer.state); to->u.keyButtonPointer.sameScreen = from->u.keyButtonPointer.sameScreen; } void SEnterLeaveEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.enterLeave.time, to->u.enterLeave.time); cpswapl(from->u.enterLeave.root, to->u.enterLeave.root); cpswapl(from->u.enterLeave.event, to->u.enterLeave.event); cpswapl(from->u.enterLeave.child, to->u.enterLeave.child); cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX); cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY); cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX); cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY); cpswaps(from->u.enterLeave.state, to->u.enterLeave.state); to->u.enterLeave.mode = from->u.enterLeave.mode; to->u.enterLeave.flags = from->u.enterLeave.flags; } void SFocusEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.focus.window, to->u.focus.window); to->u.focus.mode = from->u.focus.mode; } void SExposeEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.expose.window, to->u.expose.window); cpswaps(from->u.expose.x, to->u.expose.x); cpswaps(from->u.expose.y, to->u.expose.y); cpswaps(from->u.expose.width, to->u.expose.width); cpswaps(from->u.expose.height, to->u.expose.height); cpswaps(from->u.expose.count, to->u.expose.count); } void SGraphicsExposureEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.graphicsExposure.drawable, to->u.graphicsExposure.drawable); cpswaps(from->u.graphicsExposure.x, to->u.graphicsExposure.x); cpswaps(from->u.graphicsExposure.y, to->u.graphicsExposure.y); cpswaps(from->u.graphicsExposure.width, to->u.graphicsExposure.width); cpswaps(from->u.graphicsExposure.height, to->u.graphicsExposure.height); cpswaps(from->u.graphicsExposure.minorEvent, to->u.graphicsExposure.minorEvent); cpswaps(from->u.graphicsExposure.count, to->u.graphicsExposure.count); to->u.graphicsExposure.majorEvent = from->u.graphicsExposure.majorEvent; } void SNoExposureEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable); cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent); to->u.noExposure.majorEvent = from->u.noExposure.majorEvent; } void SVisibilityEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.visibility.window, to->u.visibility.window); to->u.visibility.state = from->u.visibility.state; } void SCreateNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.createNotify.window, to->u.createNotify.window); cpswapl(from->u.createNotify.parent, to->u.createNotify.parent); cpswaps(from->u.createNotify.x, to->u.createNotify.x); cpswaps(from->u.createNotify.y, to->u.createNotify.y); cpswaps(from->u.createNotify.width, to->u.createNotify.width); cpswaps(from->u.createNotify.height, to->u.createNotify.height); cpswaps(from->u.createNotify.borderWidth, to->u.createNotify.borderWidth); to->u.createNotify.override = from->u.createNotify.override; } void SDestroyNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event); cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window); } void SUnmapNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event); cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window); to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure; } void SMapNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.mapNotify.event, to->u.mapNotify.event); cpswapl(from->u.mapNotify.window, to->u.mapNotify.window); to->u.mapNotify.override = from->u.mapNotify.override; } void SMapRequestEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent); cpswapl(from->u.mapRequest.window, to->u.mapRequest.window); } void SReparentEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.reparent.event, to->u.reparent.event); cpswapl(from->u.reparent.window, to->u.reparent.window); cpswapl(from->u.reparent.parent, to->u.reparent.parent); cpswaps(from->u.reparent.x, to->u.reparent.x); cpswaps(from->u.reparent.y, to->u.reparent.y); to->u.reparent.override = from->u.reparent.override; } void SConfigureNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.configureNotify.event, to->u.configureNotify.event); cpswapl(from->u.configureNotify.window, to->u.configureNotify.window); cpswapl(from->u.configureNotify.aboveSibling, to->u.configureNotify.aboveSibling); cpswaps(from->u.configureNotify.x, to->u.configureNotify.x); cpswaps(from->u.configureNotify.y, to->u.configureNotify.y); cpswaps(from->u.configureNotify.width, to->u.configureNotify.width); cpswaps(from->u.configureNotify.height, to->u.configureNotify.height); cpswaps(from->u.configureNotify.borderWidth, to->u.configureNotify.borderWidth); to->u.configureNotify.override = from->u.configureNotify.override; } void SConfigureRequestEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; /* actually stack-mode */ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.configureRequest.parent, to->u.configureRequest.parent); cpswapl(from->u.configureRequest.window, to->u.configureRequest.window); cpswapl(from->u.configureRequest.sibling, to->u.configureRequest.sibling); cpswaps(from->u.configureRequest.x, to->u.configureRequest.x); cpswaps(from->u.configureRequest.y, to->u.configureRequest.y); cpswaps(from->u.configureRequest.width, to->u.configureRequest.width); cpswaps(from->u.configureRequest.height, to->u.configureRequest.height); cpswaps(from->u.configureRequest.borderWidth, to->u.configureRequest.borderWidth); cpswaps(from->u.configureRequest.valueMask, to->u.configureRequest.valueMask); } void SGravityEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.gravity.event, to->u.gravity.event); cpswapl(from->u.gravity.window, to->u.gravity.window); cpswaps(from->u.gravity.x, to->u.gravity.x); cpswaps(from->u.gravity.y, to->u.gravity.y); } void SResizeRequestEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window); cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width); cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height); } void SCirculateEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.circulate.event, to->u.circulate.event); cpswapl(from->u.circulate.window, to->u.circulate.window); cpswapl(from->u.circulate.parent, to->u.circulate.parent); to->u.circulate.place = from->u.circulate.place; } void SPropertyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.property.window, to->u.property.window); cpswapl(from->u.property.atom, to->u.property.atom); cpswapl(from->u.property.time, to->u.property.time); to->u.property.state = from->u.property.state; } void SSelectionClearEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionClear.time, to->u.selectionClear.time); cpswapl(from->u.selectionClear.window, to->u.selectionClear.window); cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom); } void SSelectionRequestEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time); cpswapl(from->u.selectionRequest.owner, to->u.selectionRequest.owner); cpswapl(from->u.selectionRequest.requestor, to->u.selectionRequest.requestor); cpswapl(from->u.selectionRequest.selection, to->u.selectionRequest.selection); cpswapl(from->u.selectionRequest.target, to->u.selectionRequest.target); cpswapl(from->u.selectionRequest.property, to->u.selectionRequest.property); } void SSelectionNotifyEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time); cpswapl(from->u.selectionNotify.requestor, to->u.selectionNotify.requestor); cpswapl(from->u.selectionNotify.selection, to->u.selectionNotify.selection); cpswapl(from->u.selectionNotify.target, to->u.selectionNotify.target); cpswapl(from->u.selectionNotify.property, to->u.selectionNotify.property); } void SColormapEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.colormap.window, to->u.colormap.window); cpswapl(from->u.colormap.colormap, to->u.colormap.colormap); to->u.colormap.new = from->u.colormap.new; to->u.colormap.state = from->u.colormap.state; } void SMappingEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); to->u.mappingNotify.request = from->u.mappingNotify.request; to->u.mappingNotify.firstKeyCode = from->u.mappingNotify.firstKeyCode; to->u.mappingNotify.count = from->u.mappingNotify.count; } void SClientMessageEvent(from, to) xEvent *from, *to; { to->u.u.type = from->u.u.type; to->u.u.detail = from->u.u.detail; /* actually format */ cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); cpswapl(from->u.clientMessage.window, to->u.clientMessage.window); cpswapl(from->u.clientMessage.u.l.type, to->u.clientMessage.u.l.type); switch (from->u.u.detail) { case 8: memmove(to->u.clientMessage.u.b.bytes, from->u.clientMessage.u.b.bytes,20); break; case 16: cpswaps(from->u.clientMessage.u.s.shorts0, to->u.clientMessage.u.s.shorts0); cpswaps(from->u.clientMessage.u.s.shorts1, to->u.clientMessage.u.s.shorts1); cpswaps(from->u.clientMessage.u.s.shorts2, to->u.clientMessage.u.s.shorts2); cpswaps(from->u.clientMessage.u.s.shorts3, to->u.clientMessage.u.s.shorts3); cpswaps(from->u.clientMessage.u.s.shorts4, to->u.clientMessage.u.s.shorts4); cpswaps(from->u.clientMessage.u.s.shorts5, to->u.clientMessage.u.s.shorts5); cpswaps(from->u.clientMessage.u.s.shorts6, to->u.clientMessage.u.s.shorts6); cpswaps(from->u.clientMessage.u.s.shorts7, to->u.clientMessage.u.s.shorts7); cpswaps(from->u.clientMessage.u.s.shorts8, to->u.clientMessage.u.s.shorts8); cpswaps(from->u.clientMessage.u.s.shorts9, to->u.clientMessage.u.s.shorts9); break; case 32: cpswapl(from->u.clientMessage.u.l.longs0, to->u.clientMessage.u.l.longs0); cpswapl(from->u.clientMessage.u.l.longs1, to->u.clientMessage.u.l.longs1); cpswapl(from->u.clientMessage.u.l.longs2, to->u.clientMessage.u.l.longs2); cpswapl(from->u.clientMessage.u.l.longs3, to->u.clientMessage.u.l.longs3); cpswapl(from->u.clientMessage.u.l.longs4, to->u.clientMessage.u.l.longs4); break; } } void SKeymapNotifyEvent(from, to) xEvent *from, *to; { /* Keymap notify events are special; they have no sequence number field, and contain entirely 8-bit data */ *to = *from; } void SwapConnSetupInfo(pInfo, pInfoTBase) char *pInfo; char *pInfoTBase; { int i, j, k; ScreenPtr pScreen; DepthPtr pDepth; char *pInfoT; xConnSetup *pConnSetup = (xConnSetup *)pInfo; pInfoT = pInfoTBase; SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT); pInfo += sizeof(xConnSetup); pInfoT += sizeof(xConnSetup); /* Copy the vendor string */ i = (pConnSetup->nbytesVendor + 3) & ~3; memmove(pInfoT, pInfo, i); pInfo += i; pInfoT += i; /* The Pixmap formats don't need to be swapped, just copied. */ i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats; memmove(pInfoT, pInfo, i); pInfo += i; pInfoT += i; for(i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT); pInfo += sizeof(xWindowRoot); pInfoT += sizeof(xWindowRoot); pDepth = pScreen->allowedDepths; for(j = 0; j < pScreen->numDepths; j++, pDepth++) { ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth; cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals); pInfo += sizeof(xDepth); pInfoT += sizeof(xDepth); for(k = 0; k < pDepth->numVids; k++) { SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT); pInfo += sizeof(xVisualType); pInfoT += sizeof(xVisualType); } } } } void WriteSConnectionInfo(pClient, size, pInfo) ClientPtr pClient; unsigned long size; char *pInfo; { char *pInfoTBase; pInfoTBase = (char *) ALLOCATE_LOCAL(size); if (!pInfoTBase) { pClient->noClientException = -1; return; } SwapConnSetupInfo(pInfo, pInfoTBase); (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); DEALLOCATE_LOCAL(pInfoTBase); } void SwapConnSetup(pConnSetup, pConnSetupT) xConnSetup *pConnSetup, *pConnSetupT; { cpswapl(pConnSetup->release, pConnSetupT->release); cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); pConnSetupT->minKeyCode = pConnSetup->minKeyCode; pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; pConnSetupT->numRoots = pConnSetup->numRoots; pConnSetupT->numFormats = pConnSetup->numFormats; pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; } void SwapWinRoot(pRoot, pRootT) xWindowRoot *pRoot, *pRootT; { cpswapl(pRoot->windowId, pRootT->windowId); cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); cpswapl(pRoot->whitePixel, pRootT->whitePixel); cpswapl(pRoot->blackPixel, pRootT->blackPixel); cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); cpswaps(pRoot->pixWidth, pRootT->pixWidth); cpswaps(pRoot->pixHeight, pRootT->pixHeight); cpswaps(pRoot->mmWidth, pRootT->mmWidth); cpswaps(pRoot->mmHeight, pRootT->mmHeight); cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); pRootT->backingStore = pRoot->backingStore; pRootT->saveUnders = pRoot->saveUnders; pRootT->rootDepth = pRoot->rootDepth; pRootT->nDepths = pRoot->nDepths; } void SwapVisual(pVis, pVisT) xVisualType *pVis, *pVisT; { cpswapl(pVis->visualID, pVisT->visualID); pVisT->class = pVis->class; pVisT->bitsPerRGB = pVis->bitsPerRGB; cpswaps(pVis->colormapEntries, pVisT->colormapEntries); cpswapl(pVis->redMask, pVisT->redMask); cpswapl(pVis->greenMask, pVisT->greenMask); cpswapl(pVis->blueMask, pVisT->blueMask); } void SwapConnSetupPrefix(pcspFrom, pcspTo) xConnSetupPrefix *pcspFrom; xConnSetupPrefix *pcspTo; { pcspTo->success = pcspFrom->success; pcspTo->lengthReason = pcspFrom->lengthReason; cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion); cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion); cpswaps(pcspFrom->length, pcspTo->length); } void WriteSConnSetupPrefix(pClient, pcsp) ClientPtr pClient; xConnSetupPrefix *pcsp; { xConnSetupPrefix cspT; SwapConnSetupPrefix(pcsp, &cspT); (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT); } vnc_unixsrc/Xvnc/programs/Xserver/dix/swapreq.c0100664000076400007640000007040707120677563021335 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: swapreq.c,v 1.39 94/04/17 20:26:45 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/dix/swapreq.c,v 3.1 1996/05/06 05:56:24 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "Xprotostr.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" /* for SendEvent */ #include "swapreq.h" extern int (* ProcVector[256]) (); /* Thanks to Jack Palevich for testing and subsequently rewriting all this */ /* Byte swap a list of longs */ void SwapLongs (list, count) register CARD32 *list; register unsigned long count; { register char n; while (count >= 8) { swapl(list+0, n); swapl(list+1, n); swapl(list+2, n); swapl(list+3, n); swapl(list+4, n); swapl(list+5, n); swapl(list+6, n); swapl(list+7, n); list += 8; count -= 8; } if (count != 0) { do { swapl(list, n); list++; } while (--count != 0); } } /* Byte swap a list of shorts */ void SwapShorts (list, count) register short *list; register unsigned long count; { register char n; while (count >= 16) { swaps(list+0, n); swaps(list+1, n); swaps(list+2, n); swaps(list+3, n); swaps(list+4, n); swaps(list+5, n); swaps(list+6, n); swaps(list+7, n); swaps(list+8, n); swaps(list+9, n); swaps(list+10, n); swaps(list+11, n); swaps(list+12, n); swaps(list+13, n); swaps(list+14, n); swaps(list+15, n); list += 16; count -= 16; } if (count != 0) { do { swaps(list, n); list++; } while (--count != 0); } } /* The following is used for all requests that have no fields to be swapped (except "length") */ int SProcSimpleReq(client) register ClientPtr client; { register char n; REQUEST(xReq); swaps(&stuff->length, n); return(*ProcVector[stuff->reqType])(client); } /* The following is used for all requests that have only a single 32-bit field to be swapped, coming right after the "length" field */ int SProcResourceReq(client) register ClientPtr client; { register char n; REQUEST(xResourceReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */ swapl(&stuff->id, n); return(*ProcVector[stuff->reqType])(client); } int SProcCreateWindow(client) register ClientPtr client; { register char n; REQUEST(xCreateWindowReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xCreateWindowReq); swapl(&stuff->wid, n); swapl(&stuff->parent, n); swaps(&stuff->x, n); swaps(&stuff->y, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swaps(&stuff->borderWidth, n); swaps(&stuff->class, n); swapl(&stuff->visual, n); swapl(&stuff->mask, n); SwapRestL(stuff); return((* ProcVector[X_CreateWindow])(client)); } int SProcChangeWindowAttributes(client) register ClientPtr client; { register char n; REQUEST(xChangeWindowAttributesReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); swapl(&stuff->window, n); swapl(&stuff->valueMask, n); SwapRestL(stuff); return((* ProcVector[X_ChangeWindowAttributes])(client)); } int SProcReparentWindow(client) register ClientPtr client; { register char n; REQUEST(xReparentWindowReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xReparentWindowReq); swapl(&stuff->window, n); swapl(&stuff->parent, n); swaps(&stuff->x, n); swaps(&stuff->y, n); return((* ProcVector[X_ReparentWindow])(client)); } int SProcConfigureWindow(client) register ClientPtr client; { register char n; REQUEST(xConfigureWindowReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); swapl(&stuff->window, n); swaps(&stuff->mask, n); SwapRestL(stuff); return((* ProcVector[X_ConfigureWindow])(client)); } int SProcInternAtom(client) register ClientPtr client; { register char n; REQUEST(xInternAtomReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xInternAtomReq); swaps(&stuff->nbytes, n); return((* ProcVector[X_InternAtom])(client)); } int SProcChangeProperty(client) register ClientPtr client; { register char n; REQUEST(xChangePropertyReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); swapl(&stuff->window, n); swapl(&stuff->property, n); swapl(&stuff->type, n); swapl(&stuff->nUnits, n); switch ( stuff->format ) { case 8 : break; case 16: SwapRestS(stuff); break; case 32: SwapRestL(stuff); break; } return((* ProcVector[X_ChangeProperty])(client)); } int SProcDeleteProperty(client) register ClientPtr client; { register char n; REQUEST(xDeletePropertyReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDeletePropertyReq); swapl(&stuff->window, n); swapl(&stuff->property, n); return((* ProcVector[X_DeleteProperty])(client)); } int SProcGetProperty(client) register ClientPtr client; { register char n; REQUEST(xGetPropertyReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGetPropertyReq); swapl(&stuff->window, n); swapl(&stuff->property, n); swapl(&stuff->type, n); swapl(&stuff->longOffset, n); swapl(&stuff->longLength, n); return((* ProcVector[X_GetProperty])(client)); } int SProcSetSelectionOwner(client) register ClientPtr client; { register char n; REQUEST(xSetSelectionOwnerReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); swapl(&stuff->window, n); swapl(&stuff->selection, n); swapl(&stuff->time, n); return((* ProcVector[X_SetSelectionOwner])(client)); } int SProcConvertSelection(client) register ClientPtr client; { register char n; REQUEST(xConvertSelectionReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xConvertSelectionReq); swapl(&stuff->requestor, n); swapl(&stuff->selection, n); swapl(&stuff->target, n); swapl(&stuff->property, n); swapl(&stuff->time, n); return((* ProcVector[X_ConvertSelection])(client)); } int SProcSendEvent(client) register ClientPtr client; { register char n; xEvent eventT; EventSwapPtr proc; REQUEST(xSendEventReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSendEventReq); swapl(&stuff->destination, n); swapl(&stuff->eventMask, n); /* Swap event */ proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ return (BadValue); (*proc)(&stuff->event, &eventT); stuff->event = eventT; return((* ProcVector[X_SendEvent])(client)); } int SProcGrabPointer(client) register ClientPtr client; { register char n; REQUEST(xGrabPointerReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGrabPointerReq); swapl(&stuff->grabWindow, n); swaps(&stuff->eventMask, n); swapl(&stuff->confineTo, n); swapl(&stuff->cursor, n); swapl(&stuff->time, n); return((* ProcVector[X_GrabPointer])(client)); } int SProcGrabButton(client) register ClientPtr client; { register char n; REQUEST(xGrabButtonReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGrabButtonReq); swapl(&stuff->grabWindow, n); swaps(&stuff->eventMask, n); swapl(&stuff->confineTo, n); swapl(&stuff->cursor, n); swaps(&stuff->modifiers, n); return((* ProcVector[X_GrabButton])(client)); } int SProcUngrabButton(client) register ClientPtr client; { register char n; REQUEST(xUngrabButtonReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xUngrabButtonReq); swapl(&stuff->grabWindow, n); swaps(&stuff->modifiers, n); return((* ProcVector[X_UngrabButton])(client)); } int SProcChangeActivePointerGrab(client) register ClientPtr client; { register char n; REQUEST(xChangeActivePointerGrabReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); swapl(&stuff->cursor, n); swapl(&stuff->time, n); swaps(&stuff->eventMask, n); return((* ProcVector[X_ChangeActivePointerGrab])(client)); } int SProcGrabKeyboard(client) register ClientPtr client; { register char n; REQUEST(xGrabKeyboardReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGrabKeyboardReq); swapl(&stuff->grabWindow, n); swapl(&stuff->time, n); return((* ProcVector[X_GrabKeyboard])(client)); } int SProcGrabKey(client) register ClientPtr client; { register char n; REQUEST(xGrabKeyReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGrabKeyReq); swapl(&stuff->grabWindow, n); swaps(&stuff->modifiers, n); return((* ProcVector[X_GrabKey])(client)); } int SProcUngrabKey(client) register ClientPtr client; { register char n; REQUEST(xUngrabKeyReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xUngrabKeyReq); swapl(&stuff->grabWindow, n); swaps(&stuff->modifiers, n); return((* ProcVector[X_UngrabKey])(client)); } int SProcGetMotionEvents(client) register ClientPtr client; { register char n; REQUEST(xGetMotionEventsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGetMotionEventsReq); swapl(&stuff->window, n); swapl(&stuff->start, n); swapl(&stuff->stop, n); return((* ProcVector[X_GetMotionEvents])(client)); } int SProcTranslateCoords(client) register ClientPtr client; { register char n; REQUEST(xTranslateCoordsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xTranslateCoordsReq); swapl(&stuff->srcWid, n); swapl(&stuff->dstWid, n); swaps(&stuff->srcX, n); swaps(&stuff->srcY, n); return((* ProcVector[X_TranslateCoords])(client)); } int SProcWarpPointer(client) register ClientPtr client; { register char n; REQUEST(xWarpPointerReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xWarpPointerReq); swapl(&stuff->srcWid, n); swapl(&stuff->dstWid, n); swaps(&stuff->srcX, n); swaps(&stuff->srcY, n); swaps(&stuff->srcWidth, n); swaps(&stuff->srcHeight, n); swaps(&stuff->dstX, n); swaps(&stuff->dstY, n); return((* ProcVector[X_WarpPointer])(client)); } int SProcSetInputFocus(client) register ClientPtr client; { register char n; REQUEST(xSetInputFocusReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSetInputFocusReq); swapl(&stuff->focus, n); swapl(&stuff->time, n); return((* ProcVector[X_SetInputFocus])(client)); } int SProcOpenFont(client) register ClientPtr client; { register char n; REQUEST(xOpenFontReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xOpenFontReq); swapl(&stuff->fid, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_OpenFont])(client)); } int SProcListFonts(client) register ClientPtr client; { register char n; REQUEST(xListFontsReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xListFontsReq); swaps(&stuff->maxNames, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_ListFonts])(client)); } int SProcListFontsWithInfo(client) register ClientPtr client; { register char n; REQUEST(xListFontsWithInfoReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq); swaps(&stuff->maxNames, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_ListFontsWithInfo])(client)); } int SProcSetFontPath(client) register ClientPtr client; { register char n; REQUEST(xSetFontPathReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSetFontPathReq); swaps(&stuff->nFonts, n); return((* ProcVector[X_SetFontPath])(client)); } int SProcCreatePixmap(client) register ClientPtr client; { register char n; REQUEST(xCreatePixmapReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCreatePixmapReq); swapl(&stuff->pid, n); swapl(&stuff->drawable, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return((* ProcVector[X_CreatePixmap])(client)); } int SProcCreateGC(client) register ClientPtr client; { register char n; REQUEST(xCreateGCReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xCreateGCReq); swapl(&stuff->gc, n); swapl(&stuff->drawable, n); swapl(&stuff->mask, n); SwapRestL(stuff); return((* ProcVector[X_CreateGC])(client)); } int SProcChangeGC(client) register ClientPtr client; { register char n; REQUEST(xChangeGCReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeGCReq); swapl(&stuff->gc, n); swapl(&stuff->mask, n); SwapRestL(stuff); return((* ProcVector[X_ChangeGC])(client)); } int SProcCopyGC(client) register ClientPtr client; { register char n; REQUEST(xCopyGCReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCopyGCReq); swapl(&stuff->srcGC, n); swapl(&stuff->dstGC, n); swapl(&stuff->mask, n); return((* ProcVector[X_CopyGC])(client)); } int SProcSetDashes(client) register ClientPtr client; { register char n; REQUEST(xSetDashesReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSetDashesReq); swapl(&stuff->gc, n); swaps(&stuff->dashOffset, n); swaps(&stuff->nDashes, n); return((* ProcVector[X_SetDashes])(client)); } int SProcSetClipRectangles(client) register ClientPtr client; { register char n; REQUEST(xSetClipRectanglesReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); swapl(&stuff->gc, n); swaps(&stuff->xOrigin, n); swaps(&stuff->yOrigin, n); SwapRestS(stuff); return((* ProcVector[X_SetClipRectangles])(client)); } int SProcClearToBackground(client) register ClientPtr client; { register char n; REQUEST(xClearAreaReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xClearAreaReq); swapl(&stuff->window, n); swaps(&stuff->x, n); swaps(&stuff->y, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return((* ProcVector[X_ClearArea])(client)); } int SProcCopyArea(client) register ClientPtr client; { register char n; REQUEST(xCopyAreaReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCopyAreaReq); swapl(&stuff->srcDrawable, n); swapl(&stuff->dstDrawable, n); swapl(&stuff->gc, n); swaps(&stuff->srcX, n); swaps(&stuff->srcY, n); swaps(&stuff->dstX, n); swaps(&stuff->dstY, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return((* ProcVector[X_CopyArea])(client)); } int SProcCopyPlane(client) register ClientPtr client; { register char n; REQUEST(xCopyPlaneReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCopyPlaneReq); swapl(&stuff->srcDrawable, n); swapl(&stuff->dstDrawable, n); swapl(&stuff->gc, n); swaps(&stuff->srcX, n); swaps(&stuff->srcY, n); swaps(&stuff->dstX, n); swaps(&stuff->dstY, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swapl(&stuff->bitPlane, n); return((* ProcVector[X_CopyPlane])(client)); } /* The following routine is used for all Poly drawing requests (except FillPoly, which uses a different request format) */ int SProcPoly(client) register ClientPtr client; { register char n; REQUEST(xPolyPointReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xPolyPointReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); SwapRestS(stuff); return((* ProcVector[stuff->reqType])(client)); } /* cannot use SProcPoly for this one, because xFillPolyReq is longer than xPolyPointReq, and we don't want to swap the difference as shorts! */ int SProcFillPoly(client) register ClientPtr client; { register char n; REQUEST(xFillPolyReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xFillPolyReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); SwapRestS(stuff); return((* ProcVector[X_FillPoly])(client)); } int SProcPutImage(client) register ClientPtr client; { register char n; REQUEST(xPutImageReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xPutImageReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swaps(&stuff->dstX, n); swaps(&stuff->dstY, n); /* Image should already be swapped */ return((* ProcVector[X_PutImage])(client)); } int SProcGetImage(client) register ClientPtr client; { register char n; REQUEST(xGetImageReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xGetImageReq); swapl(&stuff->drawable, n); swaps(&stuff->x, n); swaps(&stuff->y, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swapl(&stuff->planeMask, n); return((* ProcVector[X_GetImage])(client)); } /* ProcPolyText used for both PolyText8 and PolyText16 */ int SProcPolyText(client) register ClientPtr client; { register char n; REQUEST(xPolyTextReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xPolyTextReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); swaps(&stuff->x, n); swaps(&stuff->y, n); return((* ProcVector[stuff->reqType])(client)); } /* ProcImageText used for both ImageText8 and ImageText16 */ int SProcImageText(client) register ClientPtr client; { register char n; REQUEST(xImageTextReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xImageTextReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); swaps(&stuff->x, n); swaps(&stuff->y, n); return((* ProcVector[stuff->reqType])(client)); } int SProcCreateColormap(client) register ClientPtr client; { register char n; REQUEST(xCreateColormapReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCreateColormapReq); swapl(&stuff->mid, n); swapl(&stuff->window, n); swapl(&stuff->visual, n); return((* ProcVector[X_CreateColormap])(client)); } int SProcCopyColormapAndFree(client) register ClientPtr client; { register char n; REQUEST(xCopyColormapAndFreeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); swapl(&stuff->mid, n); swapl(&stuff->srcCmap, n); return((* ProcVector[X_CopyColormapAndFree])(client)); } int SProcAllocColor (client) register ClientPtr client; { register char n; REQUEST(xAllocColorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xAllocColorReq); swapl(&stuff->cmap, n); swaps(&stuff->red, n); swaps(&stuff->green, n); swaps(&stuff->blue, n); return((* ProcVector[X_AllocColor])(client)); } int SProcAllocNamedColor (client) register ClientPtr client; { register char n; REQUEST(xAllocNamedColorReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq); swapl(&stuff->cmap, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_AllocNamedColor])(client)); } int SProcAllocColorCells (client) register ClientPtr client; { register char n; REQUEST(xAllocColorCellsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xAllocColorCellsReq); swapl(&stuff->cmap, n); swaps(&stuff->colors, n); swaps(&stuff->planes, n); return((* ProcVector[X_AllocColorCells])(client)); } int SProcAllocColorPlanes(client) register ClientPtr client; { register char n; REQUEST(xAllocColorPlanesReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); swapl(&stuff->cmap, n); swaps(&stuff->colors, n); swaps(&stuff->red, n); swaps(&stuff->green, n); swaps(&stuff->blue, n); return((* ProcVector[X_AllocColorPlanes])(client)); } int SProcFreeColors (client) register ClientPtr client; { register char n; REQUEST(xFreeColorsReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); swapl(&stuff->cmap, n); swapl(&stuff->planeMask, n); SwapRestL(stuff); return((* ProcVector[X_FreeColors])(client)); } void SwapColorItem(pItem) xColorItem *pItem; { register char n; swapl(&pItem->pixel, n); swaps(&pItem->red, n); swaps(&pItem->green, n); swaps(&pItem->blue, n); } int SProcStoreColors (client) register ClientPtr client; { register char n; long count; xColorItem *pItem; REQUEST(xStoreColorsReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); swapl(&stuff->cmap, n); pItem = (xColorItem *) &stuff[1]; for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; ) SwapColorItem(pItem++); return((* ProcVector[X_StoreColors])(client)); } int SProcStoreNamedColor (client) register ClientPtr client; { register char n; REQUEST(xStoreNamedColorReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq); swapl(&stuff->cmap, n); swapl(&stuff->pixel, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_StoreNamedColor])(client)); } int SProcQueryColors(client) register ClientPtr client; { register char n; REQUEST(xQueryColorsReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); swapl(&stuff->cmap, n); SwapRestL(stuff); return((* ProcVector[X_QueryColors])(client)); } int SProcLookupColor(client) register ClientPtr client; { register char n; REQUEST(xLookupColorReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xLookupColorReq); swapl(&stuff->cmap, n); swaps(&stuff->nbytes, n); return((* ProcVector[X_LookupColor])(client)); } int SProcCreateCursor( client) register ClientPtr client; { register char n; REQUEST(xCreateCursorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCreateCursorReq); swapl(&stuff->cid, n); swapl(&stuff->source, n); swapl(&stuff->mask, n); swaps(&stuff->foreRed, n); swaps(&stuff->foreGreen, n); swaps(&stuff->foreBlue, n); swaps(&stuff->backRed, n); swaps(&stuff->backGreen, n); swaps(&stuff->backBlue, n); swaps(&stuff->x, n); swaps(&stuff->y, n); return((* ProcVector[X_CreateCursor])(client)); } int SProcCreateGlyphCursor( client) register ClientPtr client; { register char n; REQUEST(xCreateGlyphCursorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xCreateGlyphCursorReq); swapl(&stuff->cid, n); swapl(&stuff->source, n); swapl(&stuff->mask, n); swaps(&stuff->sourceChar, n); swaps(&stuff->maskChar, n); swaps(&stuff->foreRed, n); swaps(&stuff->foreGreen, n); swaps(&stuff->foreBlue, n); swaps(&stuff->backRed, n); swaps(&stuff->backGreen, n); swaps(&stuff->backBlue, n); return((* ProcVector[X_CreateGlyphCursor])(client)); } int SProcRecolorCursor(client) register ClientPtr client; { register char n; REQUEST(xRecolorCursorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xRecolorCursorReq); swapl(&stuff->cursor, n); swaps(&stuff->foreRed, n); swaps(&stuff->foreGreen, n); swaps(&stuff->foreBlue, n); swaps(&stuff->backRed, n); swaps(&stuff->backGreen, n); swaps(&stuff->backBlue, n); return((* ProcVector[X_RecolorCursor])(client)); } int SProcQueryBestSize (client) register ClientPtr client; { register char n; REQUEST(xQueryBestSizeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xQueryBestSizeReq); swapl(&stuff->drawable, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return((* ProcVector[X_QueryBestSize])(client)); } int SProcQueryExtension (client) register ClientPtr client; { register char n; REQUEST(xQueryExtensionReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xQueryExtensionReq); swaps(&stuff->nbytes, n); return((* ProcVector[X_QueryExtension])(client)); } int SProcChangeKeyboardMapping (client) register ClientPtr client; { register char n; REQUEST(xChangeKeyboardMappingReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); SwapRestL(stuff); return((* ProcVector[X_ChangeKeyboardMapping])(client)); } int SProcChangeKeyboardControl (client) register ClientPtr client; { register char n; REQUEST(xChangeKeyboardControlReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); swapl(&stuff->mask, n); SwapRestL(stuff); return((* ProcVector[X_ChangeKeyboardControl])(client)); } int SProcChangePointerControl (client) register ClientPtr client; { register char n; REQUEST(xChangePointerControlReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xChangePointerControlReq); swaps(&stuff->accelNum, n); swaps(&stuff->accelDenum, n); swaps(&stuff->threshold, n); return((* ProcVector[X_ChangePointerControl])(client)); } int SProcSetScreenSaver (client) register ClientPtr client; { register char n; REQUEST(xSetScreenSaverReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSetScreenSaverReq); swaps(&stuff->timeout, n); swaps(&stuff->interval, n); return((* ProcVector[X_SetScreenSaver])(client)); } int SProcChangeHosts(client) register ClientPtr client; { register char n; REQUEST(xChangeHostsReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeHostsReq); swaps(&stuff->hostLength, n); return((* ProcVector[X_ChangeHosts])(client)); } int SProcRotateProperties(client) register ClientPtr client; { register char n; REQUEST(xRotatePropertiesReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq); swapl(&stuff->window, n); swaps(&stuff->nAtoms, n); swaps(&stuff->nPositions, n); SwapRestL(stuff); return ((* ProcVector[X_RotateProperties])(client)); } /*ARGSUSED*/ int SProcNoOperation(client) ClientPtr client; { register char n; REQUEST(xReq); swaps(&stuff->length, n); return ((* ProcVector[X_NoOperation])(client)); } void SwapConnClientPrefix(pCCP) xConnClientPrefix *pCCP; { register char n; swaps(&pCCP->majorVersion, n); swaps(&pCCP->minorVersion, n); swaps(&pCCP->nbytesAuthProto, n); swaps(&pCCP->nbytesAuthString, n); } vnc_unixsrc/Xvnc/programs/Xserver/dix/devices.c0100664000076400007640000013022507120677563021270 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XFree86: xc/programs/Xserver/dix/devices.c,v 3.11 1996/12/24 02:23:43 dawes Exp $ */ /* $XConsortium: devices.c /main/54 1996/09/25 00:45:00 dpw $ */ #include "X.h" #include "misc.h" #include "resource.h" #define NEED_EVENTS #define NEED_REPLIES #include "Xproto.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixstruct.h" #include "site.h" #define XKB_IN_SERVER #ifdef XKB #include "XKBsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #include "dispatch.h" #include "swaprep.h" #include "dixevents.h" DeviceIntPtr _AddInputDevice(deviceProc, autoStart) DeviceProc deviceProc; Bool autoStart; { register DeviceIntPtr dev; if (inputInfo.numDevices >= MAX_DEVICES) return (DeviceIntPtr)NULL; dev = (DeviceIntPtr) xalloc(sizeof(DeviceIntRec)); if (!dev) return (DeviceIntPtr)NULL; dev->name = (char *)NULL; dev->type = 0; dev->id = inputInfo.numDevices; inputInfo.numDevices++; dev->public.on = FALSE; dev->public.processInputProc = (ProcessInputProc)NoopDDA; dev->public.realInputProc = (ProcessInputProc)NoopDDA; dev->public.enqueueInputProc = EnqueueEvent; dev->deviceProc = deviceProc; dev->startup = autoStart; dev->sync.frozen = FALSE; dev->sync.other = NullGrab; dev->sync.state = NOT_GRABBED; dev->sync.event = (xEvent *) NULL; dev->sync.evcount = 0; dev->grab = NullGrab; dev->grabTime = currentTime; dev->fromPassiveGrab = FALSE; dev->key = (KeyClassPtr)NULL; dev->valuator = (ValuatorClassPtr)NULL; dev->button = (ButtonClassPtr)NULL; dev->focus = (FocusClassPtr)NULL; dev->proximity = (ProximityClassPtr)NULL; dev->kbdfeed = (KbdFeedbackPtr)NULL; dev->ptrfeed = (PtrFeedbackPtr)NULL; dev->intfeed = (IntegerFeedbackPtr)NULL; dev->stringfeed = (StringFeedbackPtr)NULL; dev->bell = (BellFeedbackPtr)NULL; dev->leds = (LedFeedbackPtr)NULL; dev->next = inputInfo.off_devices; #ifdef XKB dev->xkb_interest= NULL; #endif inputInfo.off_devices = dev; return dev; } Bool EnableDevice(dev) register DeviceIntPtr dev; { register DeviceIntPtr *prev; for (prev = &inputInfo.off_devices; *prev && (*prev != dev); prev = &(*prev)->next) ; if ((*prev != dev) || !dev->inited || ((*dev->deviceProc)(dev, DEVICE_ON) != Success)) return FALSE; *prev = dev->next; dev->next = inputInfo.devices; inputInfo.devices = dev; return TRUE; } Bool DisableDevice(dev) register DeviceIntPtr dev; { register DeviceIntPtr *prev; for (prev = &inputInfo.devices; *prev && (*prev != dev); prev = &(*prev)->next) ; if (*prev != dev) return FALSE; (void)(*dev->deviceProc)(dev, DEVICE_OFF); *prev = dev->next; dev->next = inputInfo.off_devices; inputInfo.off_devices = dev; return TRUE; } int InitAndStartDevices() { register DeviceIntPtr dev, next; for (dev = inputInfo.off_devices; dev; dev = dev->next) dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; if (dev->inited && dev->startup) (void)EnableDevice(dev); } for (dev = inputInfo.devices; dev && (dev != inputInfo.keyboard); dev = dev->next) ; if (!dev || (dev != inputInfo.keyboard)) return BadImplementation; for (dev = inputInfo.devices; dev && (dev != inputInfo.pointer); dev = dev->next) ; if (!dev || (dev != inputInfo.pointer)) return BadImplementation; return Success; } static void #if NeedFunctionPrototypes CloseDevice(register DeviceIntPtr dev) #else CloseDevice(dev) register DeviceIntPtr dev; #endif { KbdFeedbackPtr k, knext; PtrFeedbackPtr p, pnext; IntegerFeedbackPtr i, inext; StringFeedbackPtr s, snext; BellFeedbackPtr b, bnext; LedFeedbackPtr l, lnext; if (dev->inited) (void)(*dev->deviceProc)(dev, DEVICE_CLOSE); xfree(dev->name); if (dev->key) { #ifdef XKB if (dev->key->xkbInfo) XkbFreeInfo(dev->key->xkbInfo); #endif xfree(dev->key->curKeySyms.map); xfree(dev->key->modifierKeyMap); xfree(dev->key); } xfree(dev->valuator); #ifdef XKB if ((dev->button)&&(dev->button->xkb_acts)) xfree(dev->button->xkb_acts); #endif xfree(dev->button); if (dev->focus) { xfree(dev->focus->trace); xfree(dev->focus); } xfree(dev->proximity); for (k=dev->kbdfeed; k; k=knext) { knext = k->next; #ifdef XKB if (k->xkb_sli) XkbFreeSrvLedInfo(k->xkb_sli); #endif xfree(k); } for (p=dev->ptrfeed; p; p=pnext) { pnext = p->next; xfree(p); } for (i=dev->intfeed; i; i=inext) { inext = i->next; xfree(i); } for (s=dev->stringfeed; s; s=snext) { snext = s->next; xfree(s->ctrl.symbols_supported); xfree(s->ctrl.symbols_displayed); xfree(s); } for (b=dev->bell; b; b=bnext) { bnext = b->next; xfree(b); } for (l=dev->leds; l; l=lnext) { lnext = l->next; #ifdef XKB if (l->xkb_sli) XkbFreeSrvLedInfo(l->xkb_sli); #endif xfree(l); } #ifdef XKB while (dev->xkb_interest) { XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); } #endif xfree(dev->sync.event); xfree(dev); } void CloseDownDevices() { register DeviceIntPtr dev, next; for (dev = inputInfo.devices; dev; dev = next) { next = dev->next; CloseDevice(dev); } for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; CloseDevice(dev); } inputInfo.keyboard = NULL; inputInfo.pointer = NULL; } void RemoveDevice(dev) register DeviceIntPtr dev; { register DeviceIntPtr prev,tmp,next; prev= NULL; for (tmp= inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { next = tmp->next; if (tmp==dev) { CloseDevice(tmp); if (prev==NULL) inputInfo.devices = next; else prev->next = next; inputInfo.numDevices--; if (inputInfo.keyboard == tmp) inputInfo.keyboard = NULL; else if (inputInfo.pointer == tmp) inputInfo.pointer = NULL; return; } } prev= NULL; for (tmp= inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) { next = tmp->next; if (tmp==dev) { CloseDevice(tmp); if (prev==NULL) inputInfo.off_devices = next; else prev->next = next; inputInfo.numDevices--; if (inputInfo.keyboard == tmp) inputInfo.keyboard = NULL; else if (inputInfo.pointer == tmp) inputInfo.pointer = NULL; return; } } ErrorF("Internal Error! Attempt to remove a non-existent device\n"); return; } int NumMotionEvents() { return inputInfo.pointer->valuator->numMotionEvents; } void _RegisterPointerDevice(device) DeviceIntPtr device; { inputInfo.pointer = device; #ifdef XKB if (noXkbExtension) { device->public.processInputProc = CoreProcessPointerEvent; device->public.realInputProc = CoreProcessPointerEvent; } else { device->public.processInputProc = ProcessPointerEvent; device->public.realInputProc = ProcessPointerEvent; } #else device->public.processInputProc = ProcessPointerEvent; device->public.realInputProc = ProcessPointerEvent; #endif device->ActivateGrab = ActivatePointerGrab; device->DeactivateGrab = DeactivatePointerGrab; if (!device->name) { char *p = "pointer"; device->name = (char *)xalloc(strlen(p) + 1); strcpy(device->name, p); } } void _RegisterKeyboardDevice(device) DeviceIntPtr device; { inputInfo.keyboard = device; #ifdef XKB if (noXkbExtension) { device->public.processInputProc = CoreProcessKeyboardEvent; device->public.realInputProc = CoreProcessKeyboardEvent; } else { device->public.processInputProc = ProcessKeyboardEvent; device->public.realInputProc = ProcessKeyboardEvent; } #else device->public.processInputProc = ProcessKeyboardEvent; device->public.realInputProc = ProcessKeyboardEvent; #endif device->ActivateGrab = ActivateKeyboardGrab; device->DeactivateGrab = DeactivateKeyboardGrab; if (!device->name) { char *k = "keyboard"; device->name = (char *)xalloc(strlen(k) + 1); strcpy(device->name, k); } } DevicePtr LookupKeyboardDevice() { return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; } DevicePtr LookupPointerDevice() { return inputInfo.pointer ? &inputInfo.pointer->public : NULL; } DevicePtr LookupDevice(id) int id; { DeviceIntPtr dev; for (dev=inputInfo.devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) return (DevicePtr)dev; } for (dev=inputInfo.off_devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) return (DevicePtr)dev; } return NULL; } void QueryMinMaxKeyCodes(minCode, maxCode) KeyCode *minCode, *maxCode; { if (inputInfo.keyboard) { *minCode = inputInfo.keyboard->key->curKeySyms.minKeyCode; *maxCode = inputInfo.keyboard->key->curKeySyms.maxKeyCode; } } Bool SetKeySymsMap(dst, src) register KeySymsPtr dst, src; { int i, j; int rowDif = src->minKeyCode - dst->minKeyCode; /* if keysym map size changes, grow map first */ if (src->mapWidth < dst->mapWidth) { for (i = src->minKeyCode; i <= src->maxKeyCode; i++) { #define SI(r, c) (((r-src->minKeyCode)*src->mapWidth) + (c)) #define DI(r, c) (((r - dst->minKeyCode)*dst->mapWidth) + (c)) for (j = 0; j < src->mapWidth; j++) dst->map[DI(i, j)] = src->map[SI(i, j)]; for (j = src->mapWidth; j < dst->mapWidth; j++) dst->map[DI(i, j)] = NoSymbol; #undef SI #undef DI } return TRUE; } else if (src->mapWidth > dst->mapWidth) { KeySym *map; int bytes = sizeof(KeySym) * src->mapWidth * (dst->maxKeyCode - dst->minKeyCode + 1); map = (KeySym *)xalloc(bytes); if (!map) return FALSE; bzero((char *)map, bytes); if (dst->map) { for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++) memmove((char *)&map[i*src->mapWidth], (char *)&dst->map[i*dst->mapWidth], dst->mapWidth * sizeof(KeySym)); xfree(dst->map); } dst->mapWidth = src->mapWidth; dst->map = map; } memmove((char *)&dst->map[rowDif * dst->mapWidth], (char *)src->map, (int)(src->maxKeyCode - src->minKeyCode + 1) * dst->mapWidth * sizeof(KeySym)); return TRUE; } static Bool #if NeedFunctionPrototypes InitModMap(register KeyClassPtr keyc) #else InitModMap(keyc) register KeyClassPtr keyc; #endif { int i, j; CARD8 keysPerModifier[8]; CARD8 mask; keyc->maxKeysPerModifier = 0; for (i = 0; i < 8; i++) keysPerModifier[i] = 0; for (i = 8; i < MAP_LENGTH; i++) { for (j = 0, mask = 1; j < 8; j++, mask <<= 1) { if (mask & keyc->modifierMap[i]) { if (++keysPerModifier[j] > keyc->maxKeysPerModifier) keyc->maxKeysPerModifier = keysPerModifier[j]; } } } keyc->modifierKeyMap = (KeyCode *)xalloc(8*keyc->maxKeysPerModifier); if (!keyc->modifierKeyMap && keyc->maxKeysPerModifier) return (FALSE); bzero((char *)keyc->modifierKeyMap, 8*(int)keyc->maxKeysPerModifier); for (i = 0; i < 8; i++) keysPerModifier[i] = 0; for (i = 8; i < MAP_LENGTH; i++) { for (j = 0, mask = 1; j < 8; j++, mask <<= 1) { if (mask & keyc->modifierMap[i]) { keyc->modifierKeyMap[(j*keyc->maxKeysPerModifier) + keysPerModifier[j]] = i; keysPerModifier[j]++; } } } return TRUE; } Bool InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers) DeviceIntPtr dev; KeySymsPtr pKeySyms; CARD8 pModifiers[]; { int i; register KeyClassPtr keyc; keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec)); if (!keyc) return FALSE; keyc->curKeySyms.map = (KeySym *)NULL; keyc->curKeySyms.mapWidth = 0; keyc->curKeySyms.minKeyCode = pKeySyms->minKeyCode; keyc->curKeySyms.maxKeyCode = pKeySyms->maxKeyCode; keyc->modifierKeyMap = (KeyCode *)NULL; keyc->state = 0; keyc->prev_state = 0; if (pModifiers) memmove((char *)keyc->modifierMap, (char *)pModifiers, MAP_LENGTH); else bzero((char *)keyc->modifierMap, MAP_LENGTH); bzero((char *)keyc->down, DOWN_LENGTH); for (i = 0; i < 8; i++) keyc->modifierKeyCount[i] = 0; if (!SetKeySymsMap(&keyc->curKeySyms, pKeySyms) || !InitModMap(keyc)) { xfree(keyc->curKeySyms.map); xfree(keyc->modifierKeyMap); xfree(keyc); return FALSE; } dev->key = keyc; #ifdef XKB dev->key->xkbInfo= NULL; if (!noXkbExtension) XkbInitDevice(dev); #endif return TRUE; } Bool InitButtonClassDeviceStruct(dev, numButtons, map) register DeviceIntPtr dev; int numButtons; CARD8 *map; { register ButtonClassPtr butc; int i; butc = (ButtonClassPtr)xalloc(sizeof(ButtonClassRec)); if (!butc) return FALSE; butc->numButtons = numButtons; for (i = 1; i <= numButtons; i++) butc->map[i] = map[i]; butc->buttonsDown = 0; butc->state = 0; butc->motionMask = 0; bzero((char *)butc->down, DOWN_LENGTH); #ifdef XKB butc->xkb_acts= NULL; #endif dev->button = butc; return TRUE; } Bool InitValuatorClassDeviceStruct(dev, numAxes, motionProc, numMotionEvents, mode) DeviceIntPtr dev; ValuatorMotionProcPtr motionProc; int numAxes; int numMotionEvents; int mode; { int i; register ValuatorClassPtr valc; valc = (ValuatorClassPtr)xalloc(sizeof(ValuatorClassRec) + numAxes * sizeof(AxisInfo) + numAxes * sizeof(unsigned int)); if (!valc) return FALSE; valc->GetMotionProc = motionProc; valc->numMotionEvents = numMotionEvents; valc->motionHintWindow = NullWindow; valc->numAxes = numAxes; valc->mode = mode; valc->axes = (AxisInfoPtr)(valc + 1); valc->axisVal = (int *)(valc->axes + numAxes); for (i=0; iaxisVal[i]=0; dev->valuator = valc; return TRUE; } Bool InitFocusClassDeviceStruct(dev) DeviceIntPtr dev; { register FocusClassPtr focc; focc = (FocusClassPtr)xalloc(sizeof(FocusClassRec)); if (!focc) return FALSE; focc->win = PointerRootWin; focc->revert = None; focc->time = currentTime; focc->trace = (WindowPtr *)NULL; focc->traceSize = 0; focc->traceGood = 0; dev->focus = focc; return TRUE; } Bool InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc) DeviceIntPtr dev; BellProcPtr bellProc; KbdCtrlProcPtr controlProc; { register KbdFeedbackPtr feedc; feedc = (KbdFeedbackPtr)xalloc(sizeof(KbdFeedbackClassRec)); if (!feedc) return FALSE; feedc->BellProc = bellProc; feedc->CtrlProc = controlProc; #ifdef XKB defaultKeyboardControl.autoRepeat = TRUE; #endif feedc->ctrl = defaultKeyboardControl; feedc->ctrl.id = 0; if ((feedc->next = dev->kbdfeed) != 0) feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1; dev->kbdfeed = feedc; #ifdef XKB feedc->xkb_sli= NULL; if (!noXkbExtension) XkbFinishDeviceInit(dev); #endif (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); return TRUE; } Bool InitPtrFeedbackClassDeviceStruct(dev, controlProc) DeviceIntPtr dev; PtrCtrlProcPtr controlProc; { register PtrFeedbackPtr feedc; feedc = (PtrFeedbackPtr)xalloc(sizeof(PtrFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; #ifdef sgi feedc->ctrl.num = 1; feedc->ctrl.den = 1; feedc->ctrl.threshold = 1; #else feedc->ctrl = defaultPointerControl; #endif feedc->ctrl.id = 0; if ( (feedc->next = dev->ptrfeed) ) feedc->ctrl.id = dev->ptrfeed->ctrl.id + 1; dev->ptrfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } LedCtrl defaultLedControl = { DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0}; BellCtrl defaultBellControl = { DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, 0}; IntegerCtrl defaultIntegerControl = { DEFAULT_INT_RESOLUTION, DEFAULT_INT_MIN_VALUE, DEFAULT_INT_MAX_VALUE, DEFAULT_INT_DISPLAYED, 0}; Bool InitStringFeedbackClassDeviceStruct (dev, controlProc, max_symbols, num_symbols_supported, symbols) DeviceIntPtr dev; StringCtrlProcPtr controlProc; int max_symbols; int num_symbols_supported; KeySym *symbols; { int i; register StringFeedbackPtr feedc; feedc = (StringFeedbackPtr)xalloc(sizeof(StringFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl.num_symbols_supported = num_symbols_supported; feedc->ctrl.num_symbols_displayed = 0; feedc->ctrl.max_symbols = max_symbols; feedc->ctrl.symbols_supported = (KeySym *) xalloc (sizeof (KeySym) * num_symbols_supported); feedc->ctrl.symbols_displayed = (KeySym *) xalloc (sizeof (KeySym) * max_symbols); if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) { if (feedc->ctrl.symbols_supported) xfree(feedc->ctrl.symbols_supported); if (feedc->ctrl.symbols_displayed) xfree(feedc->ctrl.symbols_displayed); xfree(feedc); return FALSE; } for (i=0; ictrl.symbols_supported+i) = *symbols++; for (i=0; ictrl.symbols_displayed+i) = (KeySym) NULL; feedc->ctrl.id = 0; if ( (feedc->next = dev->stringfeed) ) feedc->ctrl.id = dev->stringfeed->ctrl.id + 1; dev->stringfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitBellFeedbackClassDeviceStruct (dev, bellProc, controlProc) DeviceIntPtr dev; BellProcPtr bellProc; BellCtrlProcPtr controlProc; { register BellFeedbackPtr feedc; feedc = (BellFeedbackPtr)xalloc(sizeof(BellFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->BellProc = bellProc; feedc->ctrl = defaultBellControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->bell) ) feedc->ctrl.id = dev->bell->ctrl.id + 1; dev->bell = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitLedFeedbackClassDeviceStruct (dev, controlProc) DeviceIntPtr dev; LedCtrlProcPtr controlProc; { register LedFeedbackPtr feedc; feedc = (LedFeedbackPtr)xalloc(sizeof(LedFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl = defaultLedControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->leds) ) feedc->ctrl.id = dev->leds->ctrl.id + 1; #ifdef XKB feedc->xkb_sli= NULL; #endif dev->leds = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitIntegerFeedbackClassDeviceStruct (dev, controlProc) DeviceIntPtr dev; IntegerCtrlProcPtr controlProc; { register IntegerFeedbackPtr feedc; feedc = (IntegerFeedbackPtr)xalloc(sizeof(IntegerFeedbackClassRec)); if (!feedc) return FALSE; feedc->CtrlProc = controlProc; feedc->ctrl = defaultIntegerControl; feedc->ctrl.id = 0; if ( (feedc->next = dev->intfeed) ) feedc->ctrl.id = dev->intfeed->ctrl.id + 1; dev->intfeed = feedc; (*controlProc)(dev, &feedc->ctrl); return TRUE; } Bool InitPointerDeviceStruct(device, map, numButtons, motionProc, controlProc, numMotionEvents) DevicePtr device; CARD8 *map; int numButtons; PtrCtrlProcPtr controlProc; ValuatorMotionProcPtr motionProc; int numMotionEvents; { DeviceIntPtr dev = (DeviceIntPtr)device; return(InitButtonClassDeviceStruct(dev, numButtons, map) && InitValuatorClassDeviceStruct(dev, 2, motionProc, numMotionEvents, 0) && InitPtrFeedbackClassDeviceStruct(dev, controlProc)); } Bool InitKeyboardDeviceStruct(device, pKeySyms, pModifiers, bellProc, controlProc) DevicePtr device; KeySymsPtr pKeySyms; CARD8 pModifiers[]; BellProcPtr bellProc; KbdCtrlProcPtr controlProc; { DeviceIntPtr dev = (DeviceIntPtr)device; return(InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers) && InitFocusClassDeviceStruct(dev) && InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)); } void SendMappingNotify(request, firstKeyCode, count, client) unsigned int request, count; unsigned int firstKeyCode; ClientPtr client; { int i; xEvent event; event.u.u.type = MappingNotify; event.u.mappingNotify.request = request; if (request == MappingKeyboard) { event.u.mappingNotify.firstKeyCode = firstKeyCode; event.u.mappingNotify.count = count; } #ifdef XKB if (!noXkbExtension && ((request == MappingKeyboard) || (request == MappingModifier))) { XkbApplyMappingChange(inputInfo.keyboard,request,firstKeyCode,count, client); } #endif /* 0 is the server client */ for (i=1; iclientState == ClientStateRunning) { #ifdef XKB if (!noXkbExtension && (request == MappingKeyboard) && (clients[i]->xkbClientFlags != 0) && (clients[i]->mapNotifyMask&XkbKeySymsMask)) continue; #endif event.u.u.sequenceNumber = clients[i]->sequence; WriteEventsToClient(clients[i], 1, &event); } } } /* * n-squared algorithm. n < 255 and don't want to copy the whole thing and * sort it to do the checking. How often is it called? Just being lazy? */ Bool BadDeviceMap(buff, length, low, high, errval) register BYTE *buff; int length; unsigned low, high; XID *errval; { register int i, j; for (i = 0; i < length; i++) if (buff[i]) /* only check non-zero elements */ { if ((low > buff[i]) || (high < buff[i])) { *errval = buff[i]; return TRUE; } for (j = i + 1; j < length; j++) if (buff[i] == buff[j]) { *errval = buff[i]; return TRUE; } } return FALSE; } Bool AllModifierKeysAreUp(dev, map1, per1, map2, per2) register DeviceIntPtr dev; register CARD8 *map1, *map2; int per1, per2; { register int i, j, k; register CARD8 *down = dev->key->down; for (i = 8; --i >= 0; map2 += per2) { for (j = per1; --j >= 0; map1++) { if (*map1 && BitIsOn(down, *map1)) { for (k = per2; (--k >= 0) && (*map1 != map2[k]);) ; if (k < 0) return FALSE; } } } return TRUE; } int ProcSetModifierMapping(client) ClientPtr client; { xSetModifierMappingReply rep; REQUEST(xSetModifierMappingReq); KeyCode *inputMap; int inputMapLen; register int i; DeviceIntPtr keybd = inputInfo.keyboard; register KeyClassPtr keyc = keybd->key; REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq); if (client->req_len != ((stuff->numKeyPerModifier<<1) + (sizeof (xSetModifierMappingReq)>>2))) return BadLength; inputMapLen = 8*stuff->numKeyPerModifier; inputMap = (KeyCode *)&stuff[1]; /* * Now enforce the restriction that "all of the non-zero keycodes must be * in the range specified by min-keycode and max-keycode in the * connection setup (else a Value error)" */ i = inputMapLen; while (i--) { if (inputMap[i] && (inputMap[i] < keyc->curKeySyms.minKeyCode || inputMap[i] > keyc->curKeySyms.maxKeyCode)) { client->errorValue = inputMap[i]; return BadValue; } } #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, keybd, TRUE)) return BadAccess; #endif #ifdef LBX LbxFlushModifierMapTag(); #endif rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.success = MappingSuccess; /* * Now enforce the restriction that none of the old or new * modifier keys may be down while we change the mapping, and * that the DDX layer likes the choice. */ if (!AllModifierKeysAreUp(keybd, keyc->modifierKeyMap, (int)keyc->maxKeysPerModifier, inputMap, (int)stuff->numKeyPerModifier) || !AllModifierKeysAreUp(keybd, inputMap, (int)stuff->numKeyPerModifier, keyc->modifierKeyMap, (int)keyc->maxKeysPerModifier)) { rep.success = MappingBusy; } else { for (i = 0; i < inputMapLen; i++) { if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)keybd)) { rep.success = MappingFailed; break; } } } if (rep.success == MappingSuccess) { KeyCode *map; /* * Now build the keyboard's modifier bitmap from the * list of keycodes. */ map = (KeyCode *)xalloc(inputMapLen); if (!map && inputMapLen) return BadAlloc; if (keyc->modifierKeyMap) xfree(keyc->modifierKeyMap); keyc->modifierKeyMap = map; memmove((char *)map, (char *)inputMap, inputMapLen); keyc->maxKeysPerModifier = stuff->numKeyPerModifier; for (i = 0; i < MAP_LENGTH; i++) keyc->modifierMap[i] = 0; for (i = 0; i < inputMapLen; i++) { if (inputMap[i]) keyc->modifierMap[inputMap[i]] |= (1<<(((unsigned int)i)/keyc->maxKeysPerModifier)); } } if (rep.success == MappingSuccess) SendMappingNotify(MappingModifier, 0, 0, client); WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep); return(client->noClientException); } int ProcGetModifierMapping(client) ClientPtr client; { xGetModifierMappingReply rep; register KeyClassPtr keyc = inputInfo.keyboard->key; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.sequenceNumber = client->sequence; /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */ rep.length = keyc->maxKeysPerModifier << 1; WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); /* Use the (modified by DDX) map that SetModifierMapping passed in */ (void)WriteToClient(client, (int)(keyc->maxKeysPerModifier << 3), (char *)keyc->modifierKeyMap); return client->noClientException; } int ProcChangeKeyboardMapping(client) ClientPtr client; { REQUEST(xChangeKeyboardMappingReq); unsigned len; KeySymsRec keysyms; register KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2); if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode)) return BadLength; if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; return BadValue; } if ( ((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) > curKeySyms->maxKeyCode) || (stuff->keySymsPerKeyCode == 0)) { client->errorValue = stuff->keySymsPerKeyCode; return BadValue; } #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) return BadAccess; #endif keysyms.minKeyCode = stuff->firstKeyCode; keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1; keysyms.mapWidth = stuff->keySymsPerKeyCode; keysyms.map = (KeySym *)&stuff[1]; if (!SetKeySymsMap(curKeySyms, &keysyms)) return BadAlloc; #ifdef LBX LbxFlushKeyboardMapTag(); #endif SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes, client); return client->noClientException; } int ProcSetPointerMapping(client) ClientPtr client; { REQUEST(xSetPointerMappingReq); BYTE *map; xSetPointerMappingReply rep; register unsigned int i; DeviceIntPtr mouse = inputInfo.pointer; REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq); if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2) return BadLength; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.success = MappingSuccess; map = (BYTE *)&stuff[1]; if (stuff->nElts != mouse->button->numButtons) { client->errorValue = stuff->nElts; return BadValue; } if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue)) return BadValue; for (i=0; i < stuff->nElts; i++) if ((mouse->button->map[i + 1] != map[i]) && BitIsOn(mouse->button->down, i + 1)) { rep.success = MappingBusy; WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); return Success; } for (i = 0; i < stuff->nElts; i++) mouse->button->map[i + 1] = map[i]; SendMappingNotify(MappingPointer, 0, 0, client); WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); return Success; } int ProcGetKeyboardMapping(client) ClientPtr client; { xGetKeyboardMappingReply rep; REQUEST(xGetKeyboardMappingReq); KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; REQUEST_SIZE_MATCH(xGetKeyboardMappingReq); if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; return BadValue; } if (stuff->firstKeyCode + stuff->count > (unsigned)(curKeySyms->maxKeyCode + 1)) { client->errorValue = stuff->count; return BadValue; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.keySymsPerKeyCode = curKeySyms->mapWidth; /* length is a count of 4 byte quantities and KeySyms are 4 bytes */ rep.length = (curKeySyms->mapWidth * stuff->count); WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient( client, curKeySyms->mapWidth * stuff->count * sizeof(KeySym), &curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) * curKeySyms->mapWidth]); return client->noClientException; } int ProcGetPointerMapping(client) ClientPtr client; { xGetPointerMappingReply rep; ButtonClassPtr butc = inputInfo.pointer->button; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.nElts = butc->numButtons; rep.length = ((unsigned)rep.nElts + (4-1))/4; WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); (void)WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]); return Success; } void NoteLedState(keybd, led, on) DeviceIntPtr keybd; int led; Bool on; { KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl; if (on) ctrl->leds |= ((Leds)1 << (led - 1)); else ctrl->leds &= ~((Leds)1 << (led - 1)); } int Ones(mask) /* HACKMEM 169 */ unsigned long mask; { register unsigned long y; y = (mask >> 1) &033333333333; y = mask - y - ((y >>1) & 033333333333); return (((y + (y >> 3)) & 030707070707) % 077); } int ProcChangeKeyboardControl (client) ClientPtr client; { #define DO_ALL (-1) KeybdCtrl ctrl; DeviceIntPtr keybd = inputInfo.keyboard; XID *vlist; int t; int led = DO_ALL; int key = DO_ALL; BITS32 vmask, index2; int mask, i; REQUEST(xChangeKeyboardControlReq); REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); vmask = stuff->mask; if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask)) return BadLength; #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, keybd, TRUE)) return BadAccess; #endif vlist = (XID *)&stuff[1]; /* first word of values */ ctrl = keybd->kbdfeed->ctrl; while (vmask) { index2 = (BITS32) lowbit (vmask); vmask &= ~index2; switch (index2) { case KBKeyClickPercent: t = (INT8)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.click; else if (t < 0 || t > 100) { client->errorValue = t; return BadValue; } ctrl.click = t; break; case KBBellPercent: t = (INT8)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell; else if (t < 0 || t > 100) { client->errorValue = t; return BadValue; } ctrl.bell = t; break; case KBBellPitch: t = (INT16)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell_pitch; else if (t < 0) { client->errorValue = t; return BadValue; } ctrl.bell_pitch = t; break; case KBBellDuration: t = (INT16)*vlist; vlist++; if (t == -1) t = defaultKeyboardControl.bell_duration; else if (t < 0) { client->errorValue = t; return BadValue; } ctrl.bell_duration = t; break; case KBLed: led = (CARD8)*vlist; vlist++; if (led < 1 || led > 32) { client->errorValue = led; return BadValue; } if (!(stuff->mask & KBLedMode)) return BadMatch; break; case KBLedMode: t = (CARD8)*vlist; vlist++; if (t == LedModeOff) { if (led == DO_ALL) ctrl.leds = 0x0; else ctrl.leds &= ~(((Leds)(1)) << (led - 1)); } else if (t == LedModeOn) { if (led == DO_ALL) ctrl.leds = ~0L; else ctrl.leds |= (((Leds)(1)) << (led - 1)); } else { client->errorValue = t; return BadValue; } #ifdef XKB if (!noXkbExtension) { XkbEventCauseRec cause; XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client); keybd->kbdfeed->ctrl.leds = ctrl.leds; XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))), ctrl.leds, &cause); } #endif break; case KBKey: key = (KeyCode)*vlist; vlist++; if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode || (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode) { client->errorValue = key; return BadValue; } if (!(stuff->mask & KBAutoRepeatMode)) return BadMatch; break; case KBAutoRepeatMode: i = (key >> 3); mask = (1 << (key & 7)); t = (CARD8)*vlist; vlist++; #ifdef XKB if (!noXkbExtension && key != DO_ALL) XkbDisableComputedAutoRepeats(keybd,key); #endif if (t == AutoRepeatModeOff) { if (key == DO_ALL) ctrl.autoRepeat = FALSE; else ctrl.autoRepeats[i] &= ~mask; } else if (t == AutoRepeatModeOn) { if (key == DO_ALL) ctrl.autoRepeat = TRUE; else ctrl.autoRepeats[i] |= mask; } else if (t == AutoRepeatModeDefault) { if (key == DO_ALL) ctrl.autoRepeat = defaultKeyboardControl.autoRepeat; else ctrl.autoRepeats[i] = (ctrl.autoRepeats[i] & ~mask) | (defaultKeyboardControl.autoRepeats[i] & mask); } else { client->errorValue = t; return BadValue; } break; default: client->errorValue = stuff->mask; return BadValue; } } keybd->kbdfeed->ctrl = ctrl; #ifdef XKB /* The XKB RepeatKeys control and core protocol global autorepeat */ /* value are linked */ if (!noXkbExtension) { XkbSetRepeatKeys(keybd,key,keybd->kbdfeed->ctrl.autoRepeat); } else #endif (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl); return Success; #undef DO_ALL } int ProcGetKeyboardControl (client) ClientPtr client; { int i; register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl; xGetKeyboardControlReply rep; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 5; rep.sequenceNumber = client->sequence; rep.globalAutoRepeat = ctrl->autoRepeat; rep.keyClickPercent = ctrl->click; rep.bellPercent = ctrl->bell; rep.bellPitch = ctrl->bell_pitch; rep.bellDuration = ctrl->bell_duration; rep.ledMask = ctrl->leds; for (i = 0; i < 32; i++) rep.map[i] = ctrl->autoRepeats[i]; WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep); return Success; } int ProcBell(client) ClientPtr client; { register DeviceIntPtr keybd = inputInfo.keyboard; int base = keybd->kbdfeed->ctrl.bell; int newpercent; REQUEST(xBellReq); REQUEST_SIZE_MATCH(xBellReq); if (stuff->percent < -100 || stuff->percent > 100) { client->errorValue = stuff->percent; return BadValue; } newpercent = (base * stuff->percent) / 100; if (stuff->percent < 0) newpercent = base + newpercent; else newpercent = base - newpercent + stuff->percent; #ifdef XKB if (!noXkbExtension) XkbHandleBell(FALSE,FALSE, keybd, newpercent, &keybd->kbdfeed->ctrl, 0, None, NULL, client); else #endif (*keybd->kbdfeed->BellProc)(newpercent, keybd, (pointer) &keybd->kbdfeed->ctrl, 0); return Success; } int ProcChangePointerControl(client) ClientPtr client; { DeviceIntPtr mouse = inputInfo.pointer; PtrCtrl ctrl; /* might get BadValue part way through */ REQUEST(xChangePointerControlReq); REQUEST_SIZE_MATCH(xChangePointerControlReq); ctrl = mouse->ptrfeed->ctrl; if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) { client->errorValue = stuff->doAccel; return(BadValue); } if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse)) { client->errorValue = stuff->doThresh; return(BadValue); } if (stuff->doAccel) { if (stuff->accelNum == -1) ctrl.num = defaultPointerControl.num; else if (stuff->accelNum < 0) { client->errorValue = stuff->accelNum; return BadValue; } else ctrl.num = stuff->accelNum; if (stuff->accelDenum == -1) ctrl.den = defaultPointerControl.den; else if (stuff->accelDenum <= 0) { client->errorValue = stuff->accelDenum; return BadValue; } else ctrl.den = stuff->accelDenum; } if (stuff->doThresh) { if (stuff->threshold == -1) ctrl.threshold = defaultPointerControl.threshold; else if (stuff->threshold < 0) { client->errorValue = stuff->threshold; return BadValue; } else ctrl.threshold = stuff->threshold; } mouse->ptrfeed->ctrl = ctrl; (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl); return Success; } int ProcGetPointerControl(client) ClientPtr client; { register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl; xGetPointerControlReply rep; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.threshold = ctrl->threshold; rep.accelNumerator = ctrl->num; rep.accelDenominator = ctrl->den; WriteReplyToClient(client, sizeof(xGenericReply), &rep); return Success; } void MaybeStopHint(dev, client) register DeviceIntPtr dev; ClientPtr client; { GrabPtr grab = dev->grab; if ((grab && SameClient(grab, client) && ((grab->eventMask & PointerMotionHintMask) || (grab->ownerEvents && (EventMaskForClient(dev->valuator->motionHintWindow, client) & PointerMotionHintMask)))) || (!grab && (EventMaskForClient(dev->valuator->motionHintWindow, client) & PointerMotionHintMask))) dev->valuator->motionHintWindow = NullWindow; } int ProcGetMotionEvents(client) ClientPtr client; { WindowPtr pWin; xTimecoord * coords = (xTimecoord *) NULL; xGetMotionEventsReply rep; int i, count, xmin, xmax, ymin, ymax; unsigned long nEvents; DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq); pWin = SecurityLookupWindow(stuff->window, client, TRUE); if (!pWin) return BadWindow; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; rep.sequenceNumber = client->sequence; nEvents = 0; start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if ((CompareTimeStamps(start, stop) != LATER) && (CompareTimeStamps(start, currentTime) != LATER) && mouse->valuator->numMotionEvents) { if (CompareTimeStamps(stop, currentTime) == LATER) stop = currentTime; coords = (xTimecoord *)ALLOCATE_LOCAL(mouse->valuator->numMotionEvents * sizeof(xTimecoord)); if (!coords) return BadAlloc; count = (*mouse->valuator->GetMotionProc) (mouse, coords, start.milliseconds, stop.milliseconds, pWin->drawable.pScreen); xmin = pWin->drawable.x - wBorderWidth (pWin); xmax = pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin); ymin = pWin->drawable.y - wBorderWidth (pWin); ymax = pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin); for (i = 0; i < count; i++) if ((xmin <= coords[i].x) && (coords[i].x < xmax) && (ymin <= coords[i].y) && (coords[i].y < ymax)) { coords[nEvents].time = coords[i].time; coords[nEvents].x = coords[i].x - pWin->drawable.x; coords[nEvents].y = coords[i].y - pWin->drawable.y; nEvents++; } } rep.length = nEvents * (sizeof(xTimecoord) >> 2); rep.nEvents = nEvents; WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep); if (nEvents) { client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite; WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord), (char *)coords); } if (coords) DEALLOCATE_LOCAL(coords); return Success; } int ProcQueryKeymap(client) ClientPtr client; { xQueryKeymapReply rep; int i; CARD8 *down = inputInfo.keyboard->key->down; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 2; #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) { bzero((char *)&rep.map[0], 32); } else #endif for (i = 0; i<32; i++) rep.map[i] = down[i]; WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep); return Success; } /****************************************************************************** * The following entrypoints are provided for binary compatibility with * previous versions (they make casts, where the current version changes types * for more stringent prototype checking). ******************************************************************************/ #ifdef AddInputDevice #undef AddInputDevice #if NeedFunctionPrototypes DevicePtr AddInputDevice( DeviceProc deviceProc, Bool autoStart) #else DevicePtr AddInputDevice(deviceProc, autoStart) DeviceProc deviceProc; Bool autoStart; #endif { return (DevicePtr)_AddInputDevice(deviceProc, autoStart); } #endif /* AddInputDevice */ #ifdef RegisterPointerDevice #undef RegisterPointerDevice #if NeedFunctionPrototypes void RegisterPointerDevice(DevicePtr device) #else void RegisterPointerDevice(device) DevicePtr device; #endif { _RegisterPointerDevice((DeviceIntPtr)device); } #endif /* RegisterPointerDevice */ #ifdef RegisterKeyboardDevice #undef RegisterKeyboardDevice #if NeedFunctionPrototypes void RegisterKeyboardDevice(DevicePtr device) #else void RegisterKeyboardDevice(device) DevicePtr device; #endif { _RegisterKeyboardDevice((DeviceIntPtr)device); } #endif /* RegisterKeyboardDevice */ vnc_unixsrc/Xvnc/programs/Xserver/dix/property.c0100664000076400007640000005013007120677563021526 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: property.c /main/41 1996/12/22 12:33:58 rws $ */ /* $XFree86: xc/programs/Xserver/dix/property.c,v 3.5 1996/12/24 11:52:04 dawes Exp $ */ #include "X.h" #define NEED_REPLIES #define NEED_EVENTS #include "Xproto.h" #include "windowstr.h" #include "propertyst.h" #include "dixstruct.h" #include "dispatch.h" #include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #if defined(LBX) || defined(LBX_COMPAT) int fWriteToClient(client, len, buf) ClientPtr client; int len; char *buf; { return WriteToClient(client, len, buf); } #endif /***************************************************************** * Property Stuff * * ChangeProperty, DeleteProperty, GetProperties, * ListProperties * * Properties below to windows. A allocate slots each time * a property is added. No fancy searching done. * *****************************************************************/ #ifdef notdef static void PrintPropertys(pWin) WindowPtr pWin; { PropertyPtr pProp; register int j; pProp = pWin->userProps; while (pProp) { ErrorF( "%x %x\n", pProp->propertyName, pProp->type); ErrorF("property format: %d\n", pProp->format); ErrorF("property data: \n"); for (j=0; j<(pProp->format/8)*pProp->size; j++) ErrorF("%c\n", pProp->data[j]); pProp = pProp->next; } } #endif int ProcRotateProperties(client) ClientPtr client; { int i, j, delta; REQUEST(xRotatePropertiesReq); WindowPtr pWin; register Atom * atoms; PropertyPtr * props; /* array of pointer */ PropertyPtr pProp; xEvent event; REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); if (!stuff->nAtoms) return(Success); atoms = (Atom *) & stuff[1]; props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr)); if (!props) return(BadAlloc); for (i = 0; i < stuff->nAtoms; i++) { #ifdef XCSECURITY char action = SecurityCheckPropertyAccess(client, pWin, atoms[i], SecurityReadAccess|SecurityWriteAccess); #endif if (!ValidAtom(atoms[i]) #ifdef XCSECURITY || (SecurityErrorOperation == action) #endif ) { DEALLOCATE_LOCAL(props); client->errorValue = atoms[i]; return BadAtom; } #ifdef XCSECURITY if (SecurityIgnoreOperation == action) { DEALLOCATE_LOCAL(props); return Success; } #endif for (j = i + 1; j < stuff->nAtoms; j++) if (atoms[j] == atoms[i]) { DEALLOCATE_LOCAL(props); return BadMatch; } pProp = wUserProps (pWin); while (pProp) { if (pProp->propertyName == atoms[i]) goto found; pProp = pProp->next; } DEALLOCATE_LOCAL(props); return BadMatch; found: props[i] = pProp; } delta = stuff->nPositions; /* If the rotation is a complete 360 degrees, then moving the properties around and generating PropertyNotify events should be skipped. */ if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 ) { while (delta < 0) /* faster if abs value is small */ delta += stuff->nAtoms; for (i = 0; i < stuff->nAtoms; i++) { /* Generate a PropertyNotify event for each property whose value is changed in the order in which they appear in the request. */ event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyNewValue; event.u.property.atom = props[i]->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; } } DEALLOCATE_LOCAL(props); return Success; } int ProcChangeProperty(client) ClientPtr client; { WindowPtr pWin; char format, mode; unsigned long len; int sizeInBytes; int totalSize; int err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); UpdateCurrentTime(); format = stuff->format; mode = stuff->mode; if ((mode != PropModeReplace) && (mode != PropModeAppend) && (mode != PropModePrepend)) { client->errorValue = mode; return BadValue; } if ((format != 8) && (format != 16) && (format != 32)) { client->errorValue = format; return BadValue; } len = stuff->nUnits; if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2)) return BadLength; sizeInBytes = format>>3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if (!ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } #ifdef XCSECURITY switch (SecurityCheckPropertyAccess(client, pWin, stuff->property, SecurityWriteAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom; case SecurityIgnoreOperation: return Success; } #endif #ifdef LBX err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type, (int)format, (int)mode, len, TRUE, (pointer)&stuff[1], TRUE, NULL); #else err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, (int)mode, len, (pointer)&stuff[1], TRUE); #endif if (err != Success) return err; else return client->noClientException; } int ChangeWindowProperty(pWin, property, type, format, mode, len, value, sendevent) WindowPtr pWin; Atom property, type; int format, mode; unsigned long len; pointer value; Bool sendevent; { #ifdef LBX return LbxChangeWindowProperty(NULL, pWin, property, type, format, mode, len, TRUE, value, sendevent, NULL); #else PropertyPtr pProp; xEvent event; int sizeInBytes; int totalSize; pointer data; sizeInBytes = format>>3; totalSize = len * sizeInBytes; /* first see if property already exists */ pProp = wUserProps (pWin); while (pProp) { if (pProp->propertyName == property) break; pProp = pProp->next; } if (!pProp) /* just add to list */ { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); pProp = (PropertyPtr)xalloc(sizeof(PropertyRec)); if (!pProp) return(BadAlloc); data = (pointer)xalloc(totalSize); if (!data && len) { xfree(pProp); return(BadAlloc); } pProp->propertyName = property; pProp->type = type; pProp->format = format; pProp->data = data; if (len) memmove((char *)data, (char *)value, totalSize); pProp->size = len; pProp->next = pWin->optional->userProps; pWin->optional->userProps = pProp; } else { /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode "PropModeReplace" since they will be written over. */ if ((format != pProp->format) && (mode != PropModeReplace)) return(BadMatch); if ((pProp->type != type) && (mode != PropModeReplace)) return(BadMatch); if (mode == PropModeReplace) { if (totalSize != pProp->size * (pProp->format >> 3)) { data = (pointer)xrealloc(pProp->data, totalSize); if (!data && len) return(BadAlloc); pProp->data = data; } if (len) memmove((char *)pProp->data, (char *)value, totalSize); pProp->size = len; pProp->type = type; pProp->format = format; } else if (len == 0) { /* do nothing */ } else if (mode == PropModeAppend) { data = (pointer)xrealloc(pProp->data, sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); pProp->data = data; memmove(&((char *)data)[pProp->size * sizeInBytes], (char *)value, totalSize); pProp->size += len; } else if (mode == PropModePrepend) { data = (pointer)xalloc(sizeInBytes * (len + pProp->size)); if (!data) return(BadAlloc); memmove(&((char *)data)[totalSize], (char *)pProp->data, (int)(pProp->size * sizeInBytes)); memmove((char *)data, (char *)value, totalSize); xfree(pProp->data); pProp->data = data; pProp->size += len; } } if (sendevent) { event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyNewValue; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } /* Addition for RFB X server */ if (pWin->parent == NullWindow) { extern void rfbRootPropertyChange(); rfbRootPropertyChange(pProp); } return(Success); #endif } int DeleteProperty(pWin, propName) WindowPtr pWin; Atom propName; { PropertyPtr pProp, prevProp; xEvent event; if (!(pProp = wUserProps (pWin))) return(Success); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == propName) break; prevProp = pProp; pProp = pProp->next; } if (pProp) { if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else { prevProp->next = pProp->next; } #ifdef LBX if (pProp->tag_id) TagDeleteTag(pProp->tag_id); #endif event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); xfree(pProp->data); xfree(pProp); } return(Success); } void DeleteAllWindowProperties(pWin) WindowPtr pWin; { PropertyPtr pProp, pNextProp; xEvent event; pProp = wUserProps (pWin); while (pProp) { #ifdef LBX if (pProp->tag_id) TagDeleteTag(pProp->tag_id); #endif event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); pNextProp = pProp->next; xfree(pProp->data); xfree(pProp); pProp = pNextProp; } } static int NullPropertyReply(client, propertyType, format, reply) ClientPtr client; ATOM propertyType; int format; xGetPropertyReply *reply; { reply->nItems = 0; reply->length = 0; reply->bytesAfter = 0; reply->propertyType = propertyType; reply->format = format; WriteReplyToClient(client, sizeof(xGenericReply), reply); return(client->noClientException); } /***************** * GetProperty * If type Any is specified, returns the property from the specified * window regardless of its type. If a type is specified, returns the * property only if its type equals the specified type. * If delete is True and a property is returned, the property is also * deleted from the window and a PropertyNotify event is generated on the * window. *****************/ int ProcGetProperty(client) ClientPtr client; { PropertyPtr pProp, prevProp; unsigned long n, len, ind; WindowPtr pWin; xGetPropertyReply reply; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityReadAccess); if (!pWin) return BadWindow; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return(BadAtom); } if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) { client->errorValue = stuff->delete; return(BadValue); } if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) { client->errorValue = stuff->type; return(BadAtom); } pProp = wUserProps (pWin); prevProp = (PropertyPtr)NULL; while (pProp) { if (pProp->propertyName == stuff->property) break; prevProp = pProp; pProp = pProp->next; } reply.type = X_Reply; reply.sequenceNumber = client->sequence; if (!pProp) return NullPropertyReply(client, None, 0, &reply); #ifdef XCSECURITY { Mask access_mode = SecurityReadAccess; if (stuff->delete) access_mode |= SecurityDestroyAccess; switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, access_mode)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return NullPropertyReply(client, pProp->type, pProp->format, &reply); } } #endif /* If the request type and actual type don't match. Return the property information, but not the data. */ if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType)) ) { reply.bytesAfter = pProp->size; reply.format = pProp->format; reply.length = 0; reply.nItems = 0; reply.propertyType = pProp->type; WriteReplyToClient(client, sizeof(xGenericReply), &reply); return(Success); } #ifdef LBX /* make sure we have the current value */ if (pProp->tag_id && pProp->owner_pid) { LbxStallPropRequest(client, pProp); return client->noClientException; } #endif /* * Return type, format, value to client */ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ ind = stuff->longOffset << 2; /* If longOffset is invalid such that it causes "len" to be negative, it's a value error. */ if (n < ind) { client->errorValue = stuff->longOffset; return BadValue; } len = min(n - ind, 4 * stuff->longLength); reply.bytesAfter = n - (ind + len); reply.format = pProp->format; reply.length = (len + 3) >> 2; reply.nItems = len / (pProp->format / 8 ); reply.propertyType = pProp->type; if (stuff->delete && (reply.bytesAfter == 0)) { /* send the event */ xEvent event; event.u.u.type = PropertyNotify; event.u.property.window = pWin->drawable.id; event.u.property.state = PropertyDelete; event.u.property.atom = pProp->propertyName; event.u.property.time = currentTime.milliseconds; DeliverEvents(pWin, &event, 1, (WindowPtr)NULL); } WriteReplyToClient(client, sizeof(xGenericReply), &reply); if (len) { switch (reply.format) { case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break; case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break; } WriteSwappedDataToClient(client, len, (char *)pProp->data + ind); } if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ #ifdef LBX if (pProp->tag_id) TagDeleteTag(pProp->tag_id); #endif if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); } else prevProp->next = pProp->next; xfree(pProp->data); xfree(pProp); } return(client->noClientException); } int ProcListProperties(client) ClientPtr client; { Atom *pAtoms, *temppAtoms; xListPropertiesReply xlpr; int numProps = 0; WindowPtr pWin; PropertyPtr pProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); pProp = wUserProps (pWin); while (pProp) { pProp = pProp->next; numProps++; } if (numProps) if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom)))) return(BadAlloc); xlpr.type = X_Reply; xlpr.nProperties = numProps; xlpr.length = (numProps * sizeof(Atom)) >> 2; xlpr.sequenceNumber = client->sequence; pProp = wUserProps (pWin); temppAtoms = pAtoms; while (pProp) { *temppAtoms++ = pProp->propertyName; pProp = pProp->next; } WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); DEALLOCATE_LOCAL(pAtoms); } return(client->noClientException); } int ProcDeleteProperty(client) register ClientPtr client; { WindowPtr pWin; REQUEST(xDeletePropertyReq); int result; REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; return (BadAtom); } #ifdef XCSECURITY switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, SecurityDestroyAccess)) { case SecurityErrorOperation: client->errorValue = stuff->property; return BadAtom;; case SecurityIgnoreOperation: return Success; } #endif result = DeleteProperty(pWin, stuff->property); if (client->noClientException != Success) return(client->noClientException); else return(result); } vnc_unixsrc/Xvnc/programs/Xserver/dix/swapreq.h0100664000076400007640000001011307120677563021326 0ustar constconst/* $XFree86: xc/programs/Xserver/dix/swapreq.h,v 3.0 1996/04/15 11:20:01 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef SWAPREQ_H #define SWAPREQ_H 1 void SwapLongs ( #if NeedFunctionPrototypes CARD32 * /* list */, unsigned long /* count */ #endif ); void SwapShorts ( #if NeedFunctionPrototypes short * /* list */, unsigned long /* count */ #endif ); void SwapColorItem( #if NeedFunctionPrototypes xColorItem * /* pItem */ #endif ); void SwapConnClientPrefix( #if NeedFunctionPrototypes xConnClientPrefix * /* pCCP */ #endif ); #undef SWAPREQ_PROC #if NeedFunctionPrototypes #define SWAPREQ_PROC(func) int func(ClientPtr /* client */) #else #define SWAPREQ_PROC(func) int func(/* ClientPtr client */) #endif SWAPREQ_PROC(SProcAllocColor); SWAPREQ_PROC(SProcAllocColorCells); SWAPREQ_PROC(SProcAllocColorPlanes); SWAPREQ_PROC(SProcAllocNamedColor); SWAPREQ_PROC(SProcChangeActivePointerGrab); SWAPREQ_PROC(SProcChangeGC); SWAPREQ_PROC(SProcChangeHosts); SWAPREQ_PROC(SProcChangeKeyboardControl); SWAPREQ_PROC(SProcChangeKeyboardMapping); SWAPREQ_PROC(SProcChangePointerControl); SWAPREQ_PROC(SProcChangeProperty); SWAPREQ_PROC(SProcChangeWindowAttributes); SWAPREQ_PROC(SProcClearToBackground); SWAPREQ_PROC(SProcConfigureWindow); SWAPREQ_PROC(SProcConvertSelection); SWAPREQ_PROC(SProcCopyArea); SWAPREQ_PROC(SProcCopyColormapAndFree); SWAPREQ_PROC(SProcCopyGC); SWAPREQ_PROC(SProcCopyPlane); SWAPREQ_PROC(SProcCreateColormap); SWAPREQ_PROC(SProcCreateCursor); SWAPREQ_PROC(SProcCreateGC); SWAPREQ_PROC(SProcCreateGlyphCursor); SWAPREQ_PROC(SProcCreatePixmap); SWAPREQ_PROC(SProcCreateWindow); SWAPREQ_PROC(SProcDeleteProperty); SWAPREQ_PROC(SProcFillPoly); SWAPREQ_PROC(SProcFreeColors); SWAPREQ_PROC(SProcGetImage); SWAPREQ_PROC(SProcGetMotionEvents); SWAPREQ_PROC(SProcGetProperty); SWAPREQ_PROC(SProcGrabButton); SWAPREQ_PROC(SProcGrabKey); SWAPREQ_PROC(SProcGrabKeyboard); SWAPREQ_PROC(SProcGrabPointer); SWAPREQ_PROC(SProcImageText); SWAPREQ_PROC(SProcInternAtom); SWAPREQ_PROC(SProcListFonts); SWAPREQ_PROC(SProcListFontsWithInfo); SWAPREQ_PROC(SProcLookupColor); SWAPREQ_PROC(SProcNoOperation); SWAPREQ_PROC(SProcOpenFont); SWAPREQ_PROC(SProcPoly); SWAPREQ_PROC(SProcPolyText); SWAPREQ_PROC(SProcPutImage); SWAPREQ_PROC(SProcQueryBestSize); SWAPREQ_PROC(SProcQueryColors); SWAPREQ_PROC(SProcQueryExtension); SWAPREQ_PROC(SProcRecolorCursor); SWAPREQ_PROC(SProcReparentWindow); SWAPREQ_PROC(SProcResourceReq); SWAPREQ_PROC(SProcRotateProperties); SWAPREQ_PROC(SProcSendEvent); SWAPREQ_PROC(SProcSetClipRectangles); SWAPREQ_PROC(SProcSetDashes); SWAPREQ_PROC(SProcSetFontPath); SWAPREQ_PROC(SProcSetInputFocus); SWAPREQ_PROC(SProcSetScreenSaver); SWAPREQ_PROC(SProcSetSelectionOwner); SWAPREQ_PROC(SProcSimpleReq); SWAPREQ_PROC(SProcStoreColors); SWAPREQ_PROC(SProcStoreNamedColor); SWAPREQ_PROC(SProcTranslateCoords); SWAPREQ_PROC(SProcUngrabButton); SWAPREQ_PROC(SProcUngrabKey); SWAPREQ_PROC(SProcWarpPointer); #undef SWAPREQ_PROC #endif /* SWAPREQ_H */ vnc_unixsrc/Xvnc/programs/Xserver/dix/resource.c0100664000076400007640000005460207120677563021501 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: resource.c /main/39 1996/10/30 11:17:56 rws $ */ /* $XFree86: xc/programs/Xserver/dix/resource.c,v 3.1 1996/12/23 06:29:51 dawes Exp $ */ /* Routines to manage various kinds of resources: * * CreateNewResourceType, CreateNewResourceClass, InitClientResources, * FakeClientID, AddResource, FreeResource, FreeClientResources, * FreeAllResources, LookupIDByType, LookupIDByClass, GetXIDRange */ /* * A resource ID is a 32 bit quantity, the upper 3 bits of which are * off-limits for client-visible resources. The next 7 bits are * used as client ID, and the low 22 bits come from the client. * A resource ID is "hashed" by extracting and xoring subfields * (varying with the size of the hash table). * * It is sometimes necessary for the server to create an ID that looks * like it belongs to a client. This ID, however, must not be one * the client actually can create, or we have the potential for conflict. * The 30th bit of the ID is reserved for the server's use for this * purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to * 1, and an otherwise arbitrary ID in the low 22 bits, we can create a * resource "owned" by the client. */ #define NEED_EVENTS #include "X.h" #include "misc.h" #include "os.h" #include "resource.h" #include "dixstruct.h" #include "opaque.h" #include "windowstr.h" #include "inputstr.h" #include "dixfont.h" #include "dixevents.h" #include "dixgrabs.h" #include "colormap.h" #include "cursor.h" #include extern WindowPtr *WindowTable; static void RebuildTable( #if NeedFunctionPrototypes int /*client*/ #endif ); #define SERVER_MINID 32 #define INITBUCKETS 64 #define INITHASHSIZE 6 #define MAXHASHSIZE 11 typedef struct _Resource { struct _Resource *next; XID id; RESTYPE type; pointer value; } ResourceRec, *ResourcePtr; #define NullResource ((ResourcePtr)NULL) typedef struct _ClientResource { ResourcePtr *resources; int elements; int buckets; int hashsize; /* log(2)(buckets) */ XID fakeID; XID endFakeID; XID expectID; } ClientResourceRec; static RESTYPE lastResourceType; static RESTYPE lastResourceClass; static RESTYPE TypeMask; static DeleteType *DeleteFuncs = (DeleteType *)NULL; RESTYPE CreateNewResourceType(deleteFunc) DeleteType deleteFunc; { RESTYPE next = lastResourceType + 1; DeleteType *funcs; if (next & lastResourceClass) return 0; funcs = (DeleteType *)xrealloc(DeleteFuncs, (next + 1) * sizeof(DeleteType)); if (!funcs) return 0; lastResourceType = next; DeleteFuncs = funcs; DeleteFuncs[next] = deleteFunc; return next; } RESTYPE CreateNewResourceClass() { RESTYPE next = lastResourceClass >> 1; if (next & lastResourceType) return 0; lastResourceClass = next; TypeMask = next - 1; return next; } ClientResourceRec clientTable[MAXCLIENTS]; /***************** * InitClientResources * When a new client is created, call this to allocate space * in resource table *****************/ Bool InitClientResources(client) ClientPtr client; { register int i, j; if (client == serverClient) { lastResourceType = RT_LASTPREDEF; lastResourceClass = RC_LASTPREDEF; TypeMask = RC_LASTPREDEF - 1; if (DeleteFuncs) xfree(DeleteFuncs); DeleteFuncs = (DeleteType *)xalloc((lastResourceType + 1) * sizeof(DeleteType)); if (!DeleteFuncs) return FALSE; DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; DeleteFuncs[RT_WINDOW & TypeMask] = DeleteWindow; DeleteFuncs[RT_PIXMAP & TypeMask] = dixDestroyPixmap; DeleteFuncs[RT_GC & TypeMask] = FreeGC; DeleteFuncs[RT_FONT & TypeMask] = CloseFont; DeleteFuncs[RT_CURSOR & TypeMask] = FreeCursor; DeleteFuncs[RT_COLORMAP & TypeMask] = FreeColormap; DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels; DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone; DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; } clientTable[i = client->index].resources = (ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr)); if (!clientTable[i].resources) return FALSE; clientTable[i].buckets = INITBUCKETS; clientTable[i].elements = 0; clientTable[i].hashsize = INITHASHSIZE; /* Many IDs allocated from the server client are visible to clients, * so we don't use the SERVER_BIT for them, but we have to start * past the magic value constants used in the protocol. For normal * clients, we can start from zero, with SERVER_BIT set. */ clientTable[i].fakeID = client->clientAsMask | (client->index ? SERVER_BIT : SERVER_MINID); clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; clientTable[i].expectID = client->clientAsMask; for (j=0; j>6) ^ (id>>12)))); case 7: return ((int)(0x07F & (id ^ (id>>7) ^ (id>>13)))); case 8: return ((int)(0x0FF & (id ^ (id>>8) ^ (id>>16)))); case 9: return ((int)(0x1FF & (id ^ (id>>9)))); case 10: return ((int)(0x3FF & (id ^ (id>>10)))); case 11: return ((int)(0x7FF & (id ^ (id>>11)))); } return -1; } static XID #if NeedFunctionPrototypes AvailableID( register int client, register XID id, register XID maxid, register XID goodid) #else AvailableID(client, id, maxid, goodid) register int client; register XID id, maxid, goodid; #endif { register ResourcePtr res; if ((goodid >= id) && (goodid <= maxid)) return goodid; for (; id <= maxid; id++) { res = clientTable[client].resources[Hash(client, id)]; while (res && (res->id != id)) res = res->next; if (!res) return id; } return 0; } void GetXIDRange(client, server, minp, maxp) int client; Bool server; XID *minp, *maxp; { register XID id, maxid; register ResourcePtr *resp; register ResourcePtr res; register int i; XID goodid; id = (Mask)client << CLIENTOFFSET; if (server) id |= client ? SERVER_BIT : SERVER_MINID; maxid = id | RESOURCE_ID_MASK; goodid = 0; for (resp = clientTable[client].resources, i = clientTable[client].buckets; --i >= 0;) { for (res = *resp++; res; res = res->next) { if ((res->id < id) || (res->id > maxid)) continue; if (((res->id - id) >= (maxid - res->id)) ? (goodid = AvailableID(client, id, res->id - 1, goodid)) : !(goodid = AvailableID(client, res->id + 1, maxid, goodid))) maxid = res->id - 1; else id = res->id + 1; } } if (id > maxid) id = maxid = 0; *minp = id; *maxp = maxid; } /* GetXIDList is called by the XC-MISC extension's MiscGetXIDList function. * This function tries to find count unused XIDs for the given client. It * puts the IDs in the array pids and returns the number found, which should * almost always be the number requested. * * The circumstances that lead to a call to this function are very rare. * Xlib must run out of IDs while trying to generate a request that wants * multiple ID's, like the Multi-buffering CreateImageBuffers request. * * No rocket science in the implementation; just iterate over all * possible IDs for the given client and pick the first count IDs * that aren't in use. A more efficient algorithm could probably be * invented, but this will be used so rarely that this should suffice. */ unsigned int GetXIDList(pClient, count, pids) ClientPtr pClient; unsigned int count; XID *pids; { unsigned int found = 0; XID id = pClient->clientAsMask; XID maxid; maxid = id | RESOURCE_ID_MASK; while ( (found < count) && (id <= maxid) ) { if (!LookupIDByClass(id, RC_ANY)) { pids[found++] = id; } id++; } return found; } /* * Return the next usable fake client ID. * * Normally this is just the next one in line, but if we've used the last * in the range, we need to find a new range of safe IDs to avoid * over-running another client. */ XID FakeClientID(client) register int client; { XID id, maxid; id = clientTable[client].fakeID++; if (id != clientTable[client].endFakeID) return id; GetXIDRange(client, TRUE, &id, &maxid); if (!id) { if (!client) FatalError("FakeClientID: server internal ids exhausted\n"); MarkClientException(clients[client]); id = ((Mask)client << CLIENTOFFSET) | (SERVER_BIT * 3); maxid = id | RESOURCE_ID_MASK; } clientTable[client].fakeID = id + 1; clientTable[client].endFakeID = maxid + 1; return id; } Bool AddResource(id, type, value) XID id; RESTYPE type; pointer value; { int client; register ClientResourceRec *rrec; register ResourcePtr res, *head; client = CLIENT_ID(id); rrec = &clientTable[client]; if (!rrec->buckets) { ErrorF("AddResource(%x, %x, %x), client=%d \n", id, type, (unsigned long)value, client); FatalError("client not in use\n"); } if ((rrec->elements >= 4*rrec->buckets) && (rrec->hashsize < MAXHASHSIZE)) RebuildTable(client); head = &rrec->resources[Hash(client, id)]; res = (ResourcePtr)xalloc(sizeof(ResourceRec)); if (!res) { (*DeleteFuncs[type & TypeMask])(value, id); return FALSE; } res->next = *head; res->id = id; res->type = type; res->value = value; *head = res; rrec->elements++; if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; return TRUE; } static void RebuildTable(client) int client; { register int j; register ResourcePtr res, next; ResourcePtr **tails, *resources; register ResourcePtr **tptr, *rptr; /* * For now, preserve insertion order, since some ddx layers depend * on resources being free in the opposite order they are added. */ j = 2 * clientTable[client].buckets; tails = (ResourcePtr **)ALLOCATE_LOCAL(j * sizeof(ResourcePtr *)); if (!tails) return; resources = (ResourcePtr *)xalloc(j * sizeof(ResourcePtr)); if (!resources) { DEALLOCATE_LOCAL(tails); return; } for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) { *rptr = NullResource; *tptr = rptr; } clientTable[client].hashsize++; for (j = clientTable[client].buckets, rptr = clientTable[client].resources; --j >= 0; rptr++) { for (res = *rptr; res; res = next) { next = res->next; res->next = NullResource; tptr = &tails[Hash(client, res->id)]; **tptr = res; *tptr = &res->next; } } DEALLOCATE_LOCAL(tails); clientTable[client].buckets *= 2; xfree(clientTable[client].resources); clientTable[client].resources = resources; } void FreeResource(id, skipDeleteFuncType) XID id; RESTYPE skipDeleteFuncType; { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; register int *eltptr; int elements; Bool gotOne = FALSE; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; eltptr = &clientTable[cid].elements; prev = head; while ( (res = *prev) ) { if (res->id == id) { RESTYPE rtype = res->type; *prev = res->next; elements = --*eltptr; if (rtype & RC_CACHED) FlushClientCaches(res->id); if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); xfree(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ gotOne = TRUE; } else prev = &res->next; } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; } } if (!gotOne) FatalError("Freeing resource id=%X which isn't there", id); } void FreeResourceByType(id, type, skipFree) XID id; RESTYPE type; Bool skipFree; { int cid; register ResourcePtr res; register ResourcePtr *prev, *head; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { head = &clientTable[cid].resources[Hash(cid, id)]; prev = head; while ( (res = *prev) ) { if (res->id == id && res->type == type) { *prev = res->next; if (type & RC_CACHED) FlushClientCaches(res->id); if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); xfree(res); break; } else prev = &res->next; } if(clients[cid] && (id == clients[cid]->lastDrawableID)) { clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; } } } /* * Change the value associated with a resource id. Caller * is responsible for "doing the right thing" with the old * data */ Bool ChangeResourceValue (id, rtype, value) XID id; RESTYPE rtype; pointer value; { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { if (rtype & RC_CACHED) FlushClientCaches(res->id); res->value = value; return TRUE; } } return FALSE; } /* Note: if func adds or deletes resources, then func can get called * more than once for some resources. If func adds new resources, * func might or might not get called for them. func cannot both * add and delete an equal number of resources! */ void FindClientResourcesByType(client, type, func, cdata) ClientPtr client; RESTYPE type; FindResType func; pointer cdata; { register ResourcePtr *resources; register ResourcePtr this, next; int i, elements; register int *eltptr; if (!client) client = serverClient; resources = clientTable[client->index].resources; eltptr = &clientTable[client->index].elements; for (i = 0; i < clientTable[client->index].buckets; i++) { for (this = resources[i]; this; this = next) { next = this->next; if (!type || this->type == type) { elements = *eltptr; (*func)(this->value, this->id, cdata); if (*eltptr != elements) next = resources[i]; /* start over */ } } } } void FreeClientNeverRetainResources(client) ClientPtr client; { ResourcePtr *resources; ResourcePtr this; ResourcePtr *prev; int j; if (!client) return; resources = clientTable[client->index].resources; for (j=0; j < clientTable[client->index].buckets; j++) { prev = &resources[j]; while ( (this = *prev) ) { RESTYPE rtype = this->type; if (rtype & RC_NEVERRETAIN) { *prev = this->next; if (rtype & RC_CACHED) FlushClientCaches(this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); xfree(this); } else prev = &this->next; } } } void FreeClientResources(client) ClientPtr client; { register ResourcePtr *resources; register ResourcePtr this; int j; /* This routine shouldn't be called with a null client, but just in case ... */ if (!client) return; HandleSaveSet(client); resources = clientTable[client->index].resources; for (j=0; j < clientTable[client->index].buckets; j++) { /* It may seem silly to update the head of this resource list as we delete the members, since the entire list will be deleted any way, but there are some resource deletion functions "FreeClientPixels" for one which do a LookupID on another resource id (a Colormap id in this case), so the resource list must be kept valid up to the point that it is deleted, so every time we delete a resource, we must update the head, just like in FreeResource. I hope that this doesn't slow down mass deletion appreciably. PRH */ ResourcePtr *head; head = &resources[j]; for (this = *head; this; this = *head) { RESTYPE rtype = this->type; *head = this->next; if (rtype & RC_CACHED) FlushClientCaches(this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); xfree(this); } } xfree(clientTable[client->index].resources); clientTable[client->index].buckets = 0; } void FreeAllResources() { int i; for (i = currentMaxClients; --i >= 0; ) { if (clientTable[i].buckets) FreeClientResources(clients[i]); } } Bool LegalNewID(id, client) XID id; register ClientPtr client; { return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) && ((clientTable[client->index].expectID <= id) || !LookupIDByClass(id, RC_ANY))); } #ifdef XCSECURITY /* SecurityLookupIDByType and SecurityLookupIDByClass: * These are the heart of the resource ID security system. They take * two additional arguments compared to the old LookupID functions: * the client doing the lookup, and the access mode (see resource.h). * The resource is returned if it exists and the client is allowed access, * else NULL is returned. */ pointer SecurityLookupIDByType(client, id, rtype, mode) ClientPtr client; XID id; RESTYPE rtype; Mask mode; { int cid; register ResourcePtr res; pointer retval = NULL; assert(client == NullClient || (client->index <= currentMaxClients && clients[client->index] == client)); assert( (rtype & TypeMask) <= lastResourceType); if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { retval = res->value; break; } } if (retval && client && client->CheckAccess) retval = (* client->CheckAccess)(client, id, rtype, mode, retval); return retval; } pointer SecurityLookupIDByClass(client, id, classes, mode) ClientPtr client; XID id; RESTYPE classes; Mask mode; { int cid; register ResourcePtr res; pointer retval = NULL; assert(client == NullClient || (client->index <= currentMaxClients && clients[client->index] == client)); assert (classes >= lastResourceClass); if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type & classes)) { retval = res->value; break; } } if (retval && client && client->CheckAccess) retval = (* client->CheckAccess)(client, id, classes, mode, retval); return retval; } /* We can't replace the LookupIDByType and LookupIDByClass functions with * macros because of compatibility with loadable servers. */ pointer LookupIDByType(id, rtype) XID id; RESTYPE rtype; { return SecurityLookupIDByType(NullClient, id, rtype, SecurityUnknownAccess); } pointer LookupIDByClass(id, classes) XID id; RESTYPE classes; { return SecurityLookupIDByClass(NullClient, id, classes, SecurityUnknownAccess); } #else /* not XCSECURITY */ /* * LookupIDByType returns the object with the given id and type, else NULL. */ pointer LookupIDByType(id, rtype) XID id; RESTYPE rtype; { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) return res->value; } return (pointer)NULL; } /* * LookupIDByClass returns the object with the given id and any one of the * given classes, else NULL. */ pointer LookupIDByClass(id, classes) XID id; RESTYPE classes; { int cid; register ResourcePtr res; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) if ((res->id == id) && (res->type & classes)) return res->value; } return (pointer)NULL; } #endif /* XCSECURITY */ vnc_unixsrc/Xvnc/programs/Xserver/dix/CHANGES0100664000076400007640000000166007120677563020475 0ustar constconstThe following changes have been made to this directory since R3 (for a full description, see doc/Server/r4.tbl.ms): o Windows restructured (memory reduction, devPrivates and speedups) o GCs restructured (memory reduction, devPrivates and wrappers) o Screens restructured (window ops merged in, devPrivates) o Pixmaps restructured (drawable changes mostly) o Cursors restructured (shares glyph bits now) o Visuals restructured (screen index removed, fields rearranged) o Devices restructured (input extension changes) o Out of memory changes. Many interfaces now return OutOfMemory status. o Synchronous grab code rewritten. Should conform to our understanding of the protocol now. Be careful when time stamping events (don't allow time to run backwards). o Resource types redesigned and rewritten. o Internal fake color allocation routine for software cursors. vnc_unixsrc/Xvnc/programs/Xserver/dix/privates.c0100664000076400007640000001677407120677563021517 0ustar constconst/* $XConsortium: privates.c /main/5 1996/06/17 10:56:22 mor $ */ /* $XFree86: xc/programs/Xserver/dix/privates.c,v 3.2 1997/01/23 10:57:19 dawes Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "colormapst.h" #include "servermd.h" #include "site.h" /* * See the Wrappers and devPrivates section in "Definition of the * Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms) * for information on how to use devPrivates. */ /* * client private machinery */ static int clientPrivateCount; int clientPrivateLen; unsigned *clientPrivateSizes; unsigned totalClientSize; void ResetClientPrivates() { clientPrivateCount = 0; clientPrivateLen = 0; xfree(clientPrivateSizes); clientPrivateSizes = (unsigned *)NULL; totalClientSize = sizeof(ClientRec); } int AllocateClientPrivateIndex() { return clientPrivateCount++; } Bool AllocateClientPrivate(index2, amount) int index2; unsigned amount; { unsigned oldamount; if (index2 >= clientPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)xrealloc(clientPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (clientPrivateLen <= index2) { nsizes[clientPrivateLen++] = 0; totalClientSize += sizeof(DevUnion); } clientPrivateSizes = nsizes; } oldamount = clientPrivateSizes[index2]; if (amount > oldamount) { clientPrivateSizes[index2] = amount; totalClientSize += (amount - oldamount); } return TRUE; } /* * screen private machinery */ int screenPrivateCount; void ResetScreenPrivates() { screenPrivateCount = 0; } /* this can be called after some screens have been created, * so we have to worry about resizing existing devPrivates */ int AllocateScreenPrivateIndex() { int index2; int i; ScreenPtr pScreen; DevUnion *nprivs; index2 = screenPrivateCount++; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; nprivs = (DevUnion *)xrealloc(pScreen->devPrivates, screenPrivateCount * sizeof(DevUnion)); if (!nprivs) { screenPrivateCount--; return -1; } pScreen->devPrivates = nprivs; } return index2; } /* * window private machinery */ static int windowPrivateCount; void ResetWindowPrivates() { windowPrivateCount = 0; } int AllocateWindowPrivateIndex() { return windowPrivateCount++; } Bool AllocateWindowPrivate(pScreen, index2, amount) register ScreenPtr pScreen; int index2; unsigned amount; { unsigned oldamount; if (index2 >= pScreen->WindowPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->WindowPrivateLen <= index2) { nsizes[pScreen->WindowPrivateLen++] = 0; pScreen->totalWindowSize += sizeof(DevUnion); } pScreen->WindowPrivateSizes = nsizes; } oldamount = pScreen->WindowPrivateSizes[index2]; if (amount > oldamount) { pScreen->WindowPrivateSizes[index2] = amount; pScreen->totalWindowSize += (amount - oldamount); } return TRUE; } /* * gc private machinery */ static int gcPrivateCount; void ResetGCPrivates() { gcPrivateCount = 0; } int AllocateGCPrivateIndex() { return gcPrivateCount++; } Bool AllocateGCPrivate(pScreen, index2, amount) register ScreenPtr pScreen; int index2; unsigned amount; { unsigned oldamount; if (index2 >= pScreen->GCPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->GCPrivateLen <= index2) { nsizes[pScreen->GCPrivateLen++] = 0; pScreen->totalGCSize += sizeof(DevUnion); } pScreen->GCPrivateSizes = nsizes; } oldamount = pScreen->GCPrivateSizes[index2]; if (amount > oldamount) { pScreen->GCPrivateSizes[index2] = amount; pScreen->totalGCSize += (amount - oldamount); } return TRUE; } /* * pixmap private machinery */ #ifdef PIXPRIV static int pixmapPrivateCount; void ResetPixmapPrivates() { pixmapPrivateCount = 0; } int AllocatePixmapPrivateIndex() { return pixmapPrivateCount++; } Bool AllocatePixmapPrivate(pScreen, index2, amount) register ScreenPtr pScreen; int index2; unsigned amount; { unsigned oldamount; if (index2 >= pScreen->PixmapPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes, (index2 + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (pScreen->PixmapPrivateLen <= index2) { nsizes[pScreen->PixmapPrivateLen++] = 0; pScreen->totalPixmapSize += sizeof(DevUnion); } pScreen->PixmapPrivateSizes = nsizes; } oldamount = pScreen->PixmapPrivateSizes[index2]; if (amount > oldamount) { pScreen->PixmapPrivateSizes[index2] = amount; pScreen->totalPixmapSize += (amount - oldamount); } pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8); return TRUE; } #endif /* * colormap private machinery */ int colormapPrivateCount; void ResetColormapPrivates() { colormapPrivateCount = 0; } int AllocateColormapPrivateIndex (initPrivFunc) InitCmapPrivFunc initPrivFunc; { int index; int i; ColormapPtr pColormap; DevUnion *privs; index = colormapPrivateCount++; for (i = 0; i < screenInfo.numScreens; i++) { /* * AllocateColormapPrivateIndex may be called after the * default colormap has been created on each screen! * * We must resize the devPrivates array for the default * colormap on each screen, making room for this new private. * We also call the initialization function 'initPrivFunc' on * the new private allocated for each default colormap. */ ScreenPtr pScreen = screenInfo.screens[i]; pColormap = (ColormapPtr) LookupIDByType ( pScreen->defColormap, RT_COLORMAP); privs = (DevUnion *) xrealloc (pColormap->devPrivates, colormapPrivateCount * sizeof(DevUnion)); pColormap->devPrivates = privs; if (!privs || !(*initPrivFunc)(pColormap)) { colormapPrivateCount--; return -1; } } return index; } vnc_unixsrc/Xvnc/programs/Xserver/dix/dixfonts.c0100664000076400007640000016104007120677563021503 0ustar constconst/************************************************************************ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* $XConsortium: dixfonts.c /main/58 1996/09/28 17:11:55 rws $ */ /* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.6 1996/12/23 06:29:40 dawes Exp $ */ #define NEED_REPLIES #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "cursorstr.h" #include "misc.h" #include "opaque.h" #include "dixfontstr.h" #include "closestr.h" #ifdef DEBUG #include #endif #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics static Mask FontFormat = #if IMAGE_BYTE_ORDER == LSBFirst BitmapFormatByteOrderLSB | #else BitmapFormatByteOrderMSB | #endif #if BITMAP_BIT_ORDER == LSBFirst BitmapFormatBitOrderLSB | #else BitmapFormatBitOrderMSB | #endif BitmapFormatImageRectMin | #if GLYPHPADBYTES == 1 BitmapFormatScanlinePad8 | #endif #if GLYPHPADBYTES == 2 BitmapFormatScanlinePad16 | #endif #if GLYPHPADBYTES == 4 BitmapFormatScanlinePad32 | #endif #if GLYPHPADBYTES == 8 BitmapFormatScanlinePad64 | #endif BitmapFormatScanlineUnit8; extern pointer fosNaturalParams; extern FontPtr defaultFont; static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; static FPEFunctions *fpe_functions = (FPEFunctions *) 0; static int num_fpe_types = 0; static unsigned char *font_path_string; static int num_slept_fpes = 0; static int size_slept_fpes = 0; static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0; static FontPatternCachePtr patternCache; int FontToXError(err) int err; { switch (err) { case Successful: return Success; case AllocError: return BadAlloc; case BadFontName: case BadFontPath: return BadName; case BadFontFormat: /* is there something better? */ case BadCharRange: return BadValue; default: return err; } } /* * adding RT_FONT prevents conflict with default cursor font */ Bool SetDefaultFont(defaultfontname) char *defaultfontname; { int err; FontPtr pf; XID fid; fid = FakeClientID(0); err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync, (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; pf = (FontPtr) LookupIDByType(fid, RT_FONT); if (pf == (FontPtr) NULL) return FALSE; defaultFont = pf; return TRUE; } /* * note that the font wakeup queue is not refcounted. this is because * an fpe needs to be added when it's inited, and removed when it's finally * freed, in order to handle any data that isn't requested, like FS events. * * since the only thing that should call these routines is the renderer's * init_fpe() and free_fpe(), there shouldn't be any problem in using * freed data. */ void QueueFontWakeup(fpe) FontPathElementPtr fpe; { int i; FontPathElementPtr *new; for (i = 0; i < num_slept_fpes; i++) { if (slept_fpes[i] == fpe) { #ifdef DEBUG fprintf(stderr, "re-queueing fpe wakeup\n"); #endif return; } } if (num_slept_fpes == size_slept_fpes) { new = (FontPathElementPtr *) xrealloc(slept_fpes, sizeof(FontPathElementPtr) * (size_slept_fpes + 4)); if (!new) return; slept_fpes = new; size_slept_fpes += 4; } slept_fpes[num_slept_fpes] = fpe; num_slept_fpes++; } void RemoveFontWakeup(fpe) FontPathElementPtr fpe; { int i, j; for (i = 0; i < num_slept_fpes; i++) { if (slept_fpes[i] == fpe) { for (j = i; j < num_slept_fpes; j++) { slept_fpes[j] = slept_fpes[j + 1]; } num_slept_fpes--; return; } } } /* ARGSUSED */ void FontWakeup(data, count, LastSelectMask) pointer data; int count; pointer LastSelectMask; { int i; FontPathElementPtr fpe; if (count < 0) return; /* wake up any fpe's that may be waiting for information */ for (i = 0; i < num_slept_fpes; i++) { fpe = slept_fpes[i]; (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask); } } /* XXX -- these two funcs may want to be broken into macros */ static void #if NeedFunctionPrototypes UseFPE(FontPathElementPtr fpe) #else UseFPE(fpe) FontPathElementPtr fpe; #endif { fpe->refcount++; } static void #if NeedFunctionPrototypes FreeFPE (FontPathElementPtr fpe) #else FreeFPE (fpe) FontPathElementPtr fpe; #endif { fpe->refcount--; if (fpe->refcount == 0) { (*fpe_functions[fpe->type].free_fpe) (fpe); xfree(fpe->name); xfree(fpe); } } static Bool #if NeedFunctionPrototypes doOpenFont(ClientPtr client, OFclosurePtr c) #else doOpenFont(client, c) ClientPtr client; OFclosurePtr c; #endif { FontPtr pfont = NullFont; FontPathElementPtr fpe; ScreenPtr pScr; int err = Successful; int i; char *alias, *newname; int newlen; int aliascount = 20; if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); } err = Successful; goto bail; } while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; err = (*fpe_functions[fpe->type].open_font) ((pointer) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | BitmapFormatMaskBit | BitmapFormatMaskImageRectangle | BitmapFormatMaskScanLinePad | BitmapFormatMaskScanLineUnit, c->fontid, &pfont, &alias, c->non_cachable_font && c->non_cachable_font->fpe == fpe ? c->non_cachable_font : (FontPtr)0); if (err == FontNameAlias && alias) { newlen = strlen(alias); newname = (char *) xrealloc(c->fontname, newlen); if (!newname) { err = AllocError; break; } memmove(newname, alias, newlen); c->fontname = newname; c->fnamelen = newlen; c->current_fpe = 0; if (--aliascount <= 0) break; continue; } if (err == BadFontName) { c->current_fpe++; continue; } if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c); } return TRUE; } break; } if (err != Successful) goto bail; if (!pfont) { err = BadFontName; goto bail; } if (!pfont->fpe) pfont->fpe = fpe; pfont->refcnt++; if (pfont->refcnt == 1) { UseFPE(pfont->fpe); for (i = 0; i < screenInfo.numScreens; i++) { pScr = screenInfo.screens[i]; if (pScr->RealizeFont) { if (!(*pScr->RealizeFont) (pScr, pfont)) { CloseFont (pfont, (Font) 0); err = AllocError; goto bail; } } } } if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) { err = AllocError; goto bail; } if (patternCache && pfont != c->non_cachable_font) CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen, pfont); bail: if (err != Successful && c->client != serverClient) { SendErrorToClient(c->client, X_OpenFont, 0, c->fontid, FontToXError(err)); } if (c->slept) ClientWakeup(c->client); for (i = 0; i < c->num_fpes; i++) { FreeFPE(c->fpe_list[i]); } xfree(c->fpe_list); xfree(c->fontname); xfree(c); return TRUE; } int OpenFont(client, fid, flags, lenfname, pfontname) ClientPtr client; XID fid; Mask flags; unsigned lenfname; char *pfontname; { OFclosurePtr c; int i; FontPtr cached = (FontPtr)0; #ifdef FONTDEBUG char *f; f = (char *)xalloc(lenfname + 1); memmove(f, pfontname, lenfname); f[lenfname] = '\0'; ErrorF("OpenFont: fontname is \"%s\"\n", f); xfree(f); #endif if (!lenfname) return BadName; if (patternCache) { /* ** Check name cache. If we find a cached version of this font that ** is cachable, immediately satisfy the request with it. If we find ** a cached version of this font that is non-cachable, we do not ** satisfy the request with it. Instead, we pass the FontPtr to the ** FPE's open_font code (the fontfile FPE in turn passes the ** information to the rasterizer; the fserve FPE ignores it). ** ** Presumably, the font is marked non-cachable because the FPE has ** put some licensing restrictions on it. If the FPE, using ** whatever logic it relies on, determines that it is willing to ** share this existing font with the client, then it has the option ** to return the FontPtr we passed it as the newly-opened font. ** This allows the FPE to exercise its licensing logic without ** having to create another instance of a font that already exists. */ cached = FindCachedFontPattern(patternCache, pfontname, lenfname); if (cached && cached->info.cachable) { if (!AddResource(fid, RT_FONT, (pointer) cached)) return BadAlloc; cached->refcnt++; return Success; } } c = (OFclosurePtr) xalloc(sizeof(OFclosureRec)); if (!c) return BadAlloc; c->fontname = (char *) xalloc(lenfname); c->origFontName = pfontname; c->origFontNameLen = lenfname; if (!c->fontname) { xfree(c); return BadAlloc; } /* * copy the current FPE list, so that if it gets changed by another client * while we're blocking, the request still appears atomic */ c->fpe_list = (FontPathElementPtr *) xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c->fontname); xfree(c); return BadAlloc; } memmove(c->fontname, pfontname, lenfname); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->fontid = fid; c->current_fpe = 0; c->num_fpes = num_fpes; c->fnamelen = lenfname; c->slept = FALSE; c->flags = flags; c->non_cachable_font = cached; (void) doOpenFont(client, c); return Success; } /* * Decrement font's ref count, and free storage if ref count equals zero */ /*ARGSUSED*/ int CloseFont(value, fid) pointer value; /* must conform to DeleteType */ XID fid; { int nscr; ScreenPtr pscr; FontPathElementPtr fpe; FontPtr pfont = (FontPtr)value; if (pfont == NullFont) return (Success); if (--pfont->refcnt == 0) { if (patternCache && pfont->info.cachable) RemoveCachedFontPattern (patternCache, pfont); /* * since the last reference is gone, ask each screen to free any * storage it may have allocated locally for it. */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (pscr->UnrealizeFont) (*pscr->UnrealizeFont) (pscr, pfont); } if (pfont == defaultFont) defaultFont = NULL; #ifdef LBX LbxFreeFontTag(pfont); #endif fpe = pfont->fpe; (*fpe_functions[fpe->type].close_font) (fpe, pfont); FreeFPE(fpe); } return (Success); } /***====================================================================***/ /* * \ Sets up pReply as the correct QueryFontReply for pFont with the first * nProtoCCIStructs char infos. \ */ void QueryFont(pFont, pReply, nProtoCCIStructs) FontPtr pFont; xQueryFontReply *pReply; /* caller must allocate this storage */ int nProtoCCIStructs; { FontPropPtr pFP; int r, c, i; xFontProp *prFP; xCharInfo *prCI; xCharInfo *charInfos[256]; unsigned char chars[512]; int ninfos; unsigned long ncols; unsigned long count; /* pr->length set in dispatch */ pReply->minCharOrByte2 = pFont->info.firstCol; pReply->defaultChar = pFont->info.defaultCh; pReply->maxCharOrByte2 = pFont->info.lastCol; pReply->drawDirection = pFont->info.drawDirection; pReply->allCharsExist = pFont->info.allExist; pReply->minByte1 = pFont->info.firstRow; pReply->maxByte1 = pFont->info.lastRow; pReply->fontAscent = pFont->info.fontAscent; pReply->fontDescent = pFont->info.fontDescent; pReply->minBounds = pFont->info.ink_minbounds; pReply->maxBounds = pFont->info.ink_maxbounds; pReply->nFontProps = pFont->info.nprops; pReply->nCharInfos = nProtoCCIStructs; for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]); i < pFont->info.nprops; i++, pFP++, prFP++) { prFP->name = pFP->name; prFP->value = pFP->value; } ninfos = 0; ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1); prCI = (xCharInfo *) (prFP); for (r = pFont->info.firstRow; ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow; r++) { i = 0; for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) { chars[i++] = r; chars[i++] = c; } (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit, &count, charInfos); i = 0; for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) { *prCI = *charInfos[i]; prCI++; ninfos++; } } return; } static Bool #if NeedFunctionPrototypes doListFontsAndAliases(ClientPtr client, LFclosurePtr c) #else doListFontsAndAliases(client, c) ClientPtr client; LFclosurePtr c; #endif { FontPathElementPtr fpe; int err = Successful; FontNamesPtr names = NULL; char *name, *resolved=NULL; int namelen, resolvedlen; int nnames; int stringLens; int i; xListFontsReply reply; char *bufptr; char *bufferStart; int aliascount; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); } err = Successful; goto bail; } if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) { /* This FPE doesn't support/require list_fonts_and_aliases */ err = (*fpe_functions[fpe->type].list_fonts) ((pointer) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); if (err == Suspended) { if (!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (pointer) c); } return TRUE; } err = BadFontName; } else { /* Start of list_fonts_and_aliases functionality. Modeled after list_fonts_with_info in that it resolves aliases, except that the information collected from FPEs is just names, not font info. Each list_next_font_or_alias() returns either a name into name/namelen or an alias into name/namelen and its target name into resolved/resolvedlen. The code at this level then resolves the alias by polling the FPEs. */ if (!c->current.list_started) { err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) ((pointer) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (pointer) c); c->slept = TRUE; } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { char *tmpname; name = 0; err = (*fpe_functions[fpe->type].list_next_font_or_alias) ((pointer) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsAndAliases, (pointer) c); c->slept = TRUE; } return TRUE; } if (err == FontNameAlias) { if (resolved) xfree(resolved); resolved = (char *) xalloc(resolvedlen + 1); if (resolved) memmove(resolved, tmpname, resolvedlen + 1); } } if (err == Successful) { if (c->haveSaved) { if (c->savedName) (void)AddFontNamesName(c->names, c->savedName, c->savedNameLen); } else (void)AddFontNamesName(c->names, name, namelen); } /* * When we get an alias back, save our state and reset back to * the start of the FPE looking for the specified name. As * soon as a real font is found for the alias, pop back to the * old state */ else if (err == FontNameAlias) { char tmp_pattern[256]; /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ memmove(tmp_pattern, resolved, resolvedlen); if (c->haveSaved) { char *tmpname; int tmpnamelen; tmpname = 0; (void) (*fpe_functions[fpe->type].list_next_font_or_alias) ((pointer) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; if (c->savedName) xfree(c->savedName); c->savedName = (char *)xalloc(namelen + 1); if (c->savedName) memmove(c->savedName, name, namelen + 1); c->savedNameLen = namelen; aliascount = 20; } memmove(c->current.pattern, tmp_pattern, resolvedlen); c->current.patlen = resolvedlen; c->current.max_names = c->names->nnames + 1; c->current.current_fpe = -1; c->current.private = 0; err = BadFontName; } } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've collected enough * font names, quit. */ if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->names->nnames == c->current.max_names || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->current = c->saved; /* Give the saved namelist a chance to clean itself up */ continue; } } if (c->names->nnames == c->current.max_names) break; } } /* * send the reply */ if (err != Successful) { SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err)); goto bail; } finish: names = c->names; nnames = names->nnames; client = c->client; stringLens = 0; for (i = 0; i < nnames; i++) stringLens += (names->length[i] <= 255) ? names->length[i] : 0; reply.type = X_Reply; reply.length = (stringLens + nnames + 3) >> 2; reply.nFonts = nnames; reply.sequenceNumber = client->sequence; bufptr = bufferStart = (char *) ALLOCATE_LOCAL(reply.length << 2); if (!bufptr && reply.length) { SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); goto bail; } /* * since WriteToClient long word aligns things, copy to temp buffer and * write all at once */ for (i = 0; i < nnames; i++) { if (names->length[i] > 255) reply.nFonts--; else { *bufptr++ = names->length[i]; memmove( bufptr, names->names[i], names->length[i]); bufptr += names->length[i]; } } nnames = reply.nFonts; reply.length = (stringLens + nnames + 3) >> 2; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); (void) WriteToClient(client, stringLens + nnames, bufferStart); DEALLOCATE_LOCAL(bufferStart); bail: if (c->slept) ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); xfree(c->fpe_list); if (c->savedName) xfree(c->savedName); FreeFontNames(names); xfree(c); if (resolved) xfree(resolved); return TRUE; } int ListFonts(client, pattern, length, max_names) ClientPtr client; unsigned char *pattern; unsigned int length; unsigned int max_names; { int i; LFclosurePtr c; if (!(c = (LFclosurePtr) xalloc(sizeof *c))) return BadAlloc; c->fpe_list = (FontPathElementPtr *) xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c); return BadAlloc; } c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); if (!c->names) { xfree(c->fpe_list); xfree(c); return BadAlloc; } memmove( c->current.pattern, pattern, length); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->current.patlen = length; c->current.current_fpe = 0; c->current.max_names = max_names; c->current.list_started = FALSE; c->current.private = 0; c->haveSaved = FALSE; c->slept = FALSE; c->savedName = 0; doListFontsAndAliases(client, c); return Success; } int doListFontsWithInfo(client, c) ClientPtr client; LFWIclosurePtr c; { FontPathElementPtr fpe; int err = Successful; char *name; int namelen; int numFonts; FontInfoRec fontInfo, *pFontInfo; xListFontsWithInfoReply *reply; int length; xFontProp *pFP; int i; int aliascount; xListFontsWithInfoReply finalReply; if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); } err = Successful; goto bail; } client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo]; if (!c->current.patlen) goto finish; while (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; err = Successful; if (!c->current.list_started) { err = (*fpe_functions[fpe->type].start_list_fonts_with_info) (client, fpe, c->current.pattern, c->current.patlen, c->current.max_names, &c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; } return TRUE; } if (err == Successful) c->current.list_started = TRUE; } if (err == Successful) { name = 0; pFontInfo = &fontInfo; err = (*fpe_functions[fpe->type].list_next_font_with_info) (client, fpe, &name, &namelen, &pFontInfo, &numFonts, c->current.private); if (err == Suspended) { if (!c->slept) { ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c); c->slept = TRUE; } return TRUE; } } /* * When we get an alias back, save our state and reset back to the * start of the FPE looking for the specified name. As soon as a real * font is found for the alias, pop back to the old state */ if (err == FontNameAlias) { /* * when an alias recurses, we need to give * the last FPE a chance to clean up; so we call * it again, and assume that the error returned * is BadFontName, indicating the alias resolution * is complete. */ if (c->haveSaved) { char *tmpname; int tmpnamelen; FontInfoPtr tmpFontInfo; tmpname = 0; tmpFontInfo = &fontInfo; (void) (*fpe_functions[fpe->type].list_next_font_with_info) (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, &numFonts, c->current.private); if (--aliascount <= 0) { err = BadFontName; goto ContBadFontName; } } else { c->saved = c->current; c->haveSaved = TRUE; c->savedNumFonts = numFonts; c->savedName = (char *) pFontInfo; aliascount = 20; } memmove(c->current.pattern, name, namelen); c->current.patlen = namelen; c->current.max_names = 1; c->current.current_fpe = 0; c->current.private = 0; c->current.list_started = FALSE; } /* * At the end of this FPE, step to the next. If we've finished * processing an alias, pop state back. If we've sent enough font * names, quit. Always wait for BadFontName to let the FPE * have a chance to clean up. */ else if (err == BadFontName) { ContBadFontName: ; c->current.list_started = FALSE; c->current.current_fpe++; err = Successful; if (c->haveSaved) { if (c->current.max_names == 0 || c->current.current_fpe == c->num_fpes) { c->haveSaved = FALSE; c->saved.max_names -= (1 - c->current.max_names); c->current = c->saved; } } else if (c->current.max_names == 0) break; } else if (err == Successful) { length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); reply = c->reply; if (c->length < length) { reply = (xListFontsWithInfoReply *) xrealloc(c->reply, length); if (!reply) { err = AllocError; break; } c->reply = reply; c->length = length; } if (c->haveSaved) { numFonts = c->savedNumFonts; name = c->savedName; namelen = strlen(name); } reply->type = X_Reply; reply->length = (sizeof *reply - sizeof(xGenericReply) + pFontInfo->nprops * sizeof(xFontProp) + namelen + 3) >> 2; reply->sequenceNumber = client->sequence; reply->nameLength = namelen; reply->minBounds = pFontInfo->ink_minbounds; reply->maxBounds = pFontInfo->ink_maxbounds; reply->minCharOrByte2 = pFontInfo->firstCol; reply->maxCharOrByte2 = pFontInfo->lastCol; reply->defaultChar = pFontInfo->defaultCh; reply->nFontProps = pFontInfo->nprops; reply->drawDirection = pFontInfo->drawDirection; reply->minByte1 = pFontInfo->firstRow; reply->maxByte1 = pFontInfo->lastRow; reply->allCharsExist = pFontInfo->allExist; reply->fontAscent = pFontInfo->fontAscent; reply->fontDescent = pFontInfo->fontDescent; reply->nReplies = numFonts; pFP = (xFontProp *) (reply + 1); for (i = 0; i < pFontInfo->nprops; i++) { pFP->name = pFontInfo->props[i].name; pFP->value = pFontInfo->props[i].value; pFP++; } WriteSwappedDataToClient(client, length, reply); (void) WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { xfree(fontInfo.props); xfree(fontInfo.isStringProp); } --c->current.max_names; } } finish: length = sizeof(xListFontsWithInfoReply); bzero((char *) &finalReply, sizeof(xListFontsWithInfoReply)); finalReply.type = X_Reply; finalReply.sequenceNumber = client->sequence; finalReply.length = (sizeof(xListFontsWithInfoReply) - sizeof(xGenericReply)) >> 2; WriteSwappedDataToClient(client, length, &finalReply); bail: if (c->slept) ClientWakeup(client); for (i = 0; i < c->num_fpes; i++) FreeFPE(c->fpe_list[i]); xfree(c->reply); xfree(c->fpe_list); xfree(c); return TRUE; } int StartListFontsWithInfo(client, length, pattern, max_names) ClientPtr client; int length; unsigned char *pattern; int max_names; { int i; LFWIclosurePtr c; if (!(c = (LFWIclosurePtr) xalloc(sizeof *c))) goto badAlloc; c->fpe_list = (FontPathElementPtr *) xalloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { xfree(c); goto badAlloc; } memmove(c->current.pattern, pattern, length); for (i = 0; i < num_fpes; i++) { c->fpe_list[i] = font_path_elements[i]; UseFPE(c->fpe_list[i]); } c->client = client; c->num_fpes = num_fpes; c->reply = 0; c->length = 0; c->current.patlen = length; c->current.current_fpe = 0; c->current.max_names = max_names; c->current.list_started = FALSE; c->current.private = 0; c->savedNumFonts = 0; c->haveSaved = FALSE; c->slept = FALSE; doListFontsWithInfo(client, c); return Success; badAlloc: return BadAlloc; } #define TextEltHeader 2 #define FontShiftSize 5 static XID clearGC[] = { CT_NONE }; #define clearGCmask (GCClipMask) int doPolyText(client, c) ClientPtr client; register PTclosurePtr c; { register FontPtr pFont = c->pGC->font, oldpFont; Font fid, oldfid; int err = Success, lgerr; /* err is in X error, not font error, space */ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state; FontPathElementPtr fpe; GC *origGC; if (client->clientGone) { fpe = c->pGC->font->fpe; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); if (c->slept) { /* Client has died, but we cannot bail out right now. We need to clean up after the work we did when going to sleep. Setting the drawable pointer to 0 makes this happen without any attempts to render or perform other unnecessary activities. */ c->pDraw = (DrawablePtr)0; } else { err = Success; goto bail; } } /* Make sure our drawable hasn't disappeared while we slept. */ if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, RC_DRAWABLE, SecurityWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ fpe = c->pGC->font->fpe; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); c->pDraw = (DrawablePtr)0; } client_state = c->slept ? SLEEPING : NEVER_SLEPT; while (c->endReq - c->pElt > TextEltHeader) { if (*c->pElt == FontChange) { if (c->endReq - c->pElt < FontShiftSize) { err = BadLength; goto bail; } oldpFont = pFont; oldfid = fid; fid = ((Font)*(c->pElt+4)) /* big-endian */ | ((Font)*(c->pElt+3)) << 8 | ((Font)*(c->pElt+2)) << 16 | ((Font)*(c->pElt+1)) << 24; pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT, SecurityReadAccess); if (!pFont) { client->errorValue = fid; err = BadFont; /* restore pFont and fid for step 4 (described below) */ pFont = oldpFont; fid = oldfid; /* If we're in START_SLEEP mode, the following step shortens the request... in the unlikely event that the fid somehow becomes valid before we come through again to actually execute the polytext, which would then mess up our refcounting scheme badly. */ c->err = err; c->endReq = c->pElt; goto bail; } /* Step 3 (described below) on our new font */ if (client_state == START_SLEEP) pFont->refcnt++; else { if (pFont != c->pGC->font && c->pDraw) { ChangeGC( c->pGC, GCFont, &fid); ValidateGC(c->pDraw, c->pGC); if (c->reqType == X_PolyText8) c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8; else c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16; } /* Undo the refcnt++ we performed when going to sleep */ if (client_state == SLEEPING) (void)CloseFont(c->pGC->font, (Font)0); } c->pElt += FontShiftSize; } else /* print a string */ { unsigned char *pNextElt; pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize; if ( pNextElt > c->endReq) { err = BadLength; goto bail; } if (client_state == START_SLEEP) { c->pElt = pNextElt; continue; } if (c->pDraw) { lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize, c->pElt + TextEltHeader); } else lgerr = Successful; if (lgerr == Suspended) { if (!c->slept) { int len; GC *pGC; PTclosurePtr new_closure; /* We're putting the client to sleep. We need to do a few things to ensure successful and atomic-appearing execution of the remainder of the request. First, copy the remainder of the request into a safe malloc'd area. Second, create a scratch GC to use for the remainder of the request. Third, mark all fonts referenced in the remainder of the request to prevent their deallocation. Fourth, make the original GC look like the request has completed... set its font to the final font value from this request. These GC manipulations are for the unlikely (but possible) event that some other client is using the GC. Steps 3 and 4 are performed by running this procedure through the remainder of the request in a special no-render mode indicated by client_state = START_SLEEP. */ /* Step 1 */ /* Allocate a malloc'd closure structure to replace the local one we were passed */ new_closure = (PTclosurePtr) xalloc(sizeof(PTclosureRec)); if (!new_closure) { err = BadAlloc; goto bail; } *new_closure = *c; c = new_closure; len = c->endReq - c->pElt; c->data = (unsigned char *)xalloc(len); if (!c->data) { xfree(c); err = BadAlloc; goto bail; } memmove(c->data, c->pElt, len); c->pElt = c->data; c->endReq = c->pElt + len; /* Step 2 */ pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { xfree(c->data); xfree(c); err = BadAlloc; goto bail; } if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCFillStyle | GCTile | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin | GCFont | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask)) != Success) { FreeScratchGC(pGC); xfree(c->data); xfree(c); err = BadAlloc; goto bail; } origGC = c->pGC; c->pGC = pGC; ValidateGC(c->pDraw, c->pGC); c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doPolyText, (pointer) c); /* Set up to perform steps 3 and 4 */ client_state = START_SLEEP; continue; /* on to steps 3 and 4 */ } return TRUE; } else if (lgerr != Successful) { err = FontToXError(lgerr); goto bail; } if (c->pDraw) { c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */ c->xorg = (* c->polyText)(c->pDraw, c->pGC, c->xorg, c->yorg, *c->pElt, c->pElt + TextEltHeader); } c->pElt = pNextElt; } } bail: if (client_state == START_SLEEP) { /* Step 4 */ if (pFont != origGC->font) { ChangeGC(origGC, GCFont, &fid); ValidateGC(c->pDraw, origGC); } /* restore pElt pointer for execution of remainder of the request */ c->pElt = c->data; return TRUE; } if (c->err != Success) err = c->err; if (err != Success && c->client != serverClient) { SendErrorToClient(c->client, c->reqType, 0, 0, err); } if (c->slept) { ClientWakeup(c->client); ChangeGC(c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font)0); c->pGC->font = NullFont; FreeScratchGC(c->pGC); xfree(c->data); xfree(c); } return TRUE; } int PolyText(client, pDraw, pGC, pElt, endReq, xorg, yorg, reqType, did) ClientPtr client; DrawablePtr pDraw; GC *pGC; unsigned char *pElt; unsigned char *endReq; int xorg; int yorg; int reqType; XID did; { PTclosureRec local_closure; local_closure.pElt = pElt; local_closure.endReq = endReq; local_closure.client = client; local_closure.pDraw = pDraw; local_closure.xorg = xorg; local_closure.yorg = yorg; if ((local_closure.reqType = reqType) == X_PolyText8) { local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8; local_closure.itemSize = 1; } else { local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16; local_closure.itemSize = 2; } local_closure.pGC = pGC; local_closure.did = did; local_closure.err = Success; local_closure.slept = FALSE; (void) doPolyText(client, &local_closure); return Success; } #undef TextEltHeader #undef FontShiftSize int doImageText(client, c) ClientPtr client; register ITclosurePtr c; { int err = Success, lgerr; /* err is in X error, not font error, space */ FontPathElementPtr fpe; if (client->clientGone) { fpe = c->pGC->font->fpe; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); err = Success; goto bail; } /* Make sure our drawable hasn't disappeared while we slept. */ if (c->slept && c->pDraw && c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, RC_DRAWABLE, SecurityWriteAccess)) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); err = Success; goto bail; } lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data); if (lgerr == Suspended) { if (!c->slept) { GC *pGC; unsigned char *data; ITclosurePtr new_closure; /* We're putting the client to sleep. We need to save some state. Similar problem to that handled in doPolyText, but much simpler because the request structure is much simpler. */ new_closure = (ITclosurePtr) xalloc(sizeof(ITclosureRec)); if (!new_closure) { err = BadAlloc; goto bail; } *new_closure = *c; c = new_closure; data = (unsigned char *)xalloc(c->nChars * c->itemSize); if (!data) { xfree(c); err = BadAlloc; goto bail; } memmove(data, c->data, c->nChars * c->itemSize); c->data = data; pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); if (!pGC) { xfree(c->data); xfree(c); err = BadAlloc; goto bail; } if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCFillStyle | GCTile | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin | GCFont | GCSubwindowMode | GCClipXOrigin | GCClipYOrigin | GCClipMask)) != Success) { FreeScratchGC(pGC); xfree(c->data); xfree(c); err = BadAlloc; goto bail; } c->pGC = pGC; ValidateGC(c->pDraw, c->pGC); c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c); } return TRUE; } else if (lgerr != Successful) { err = FontToXError(lgerr); goto bail; } if (c->pDraw) { (* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg, c->nChars, c->data); } bail: if (err != Success && c->client != serverClient) { SendErrorToClient(c->client, c->reqType, 0, 0, err); } if (c->slept) { ClientWakeup(c->client); ChangeGC(c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font)0); c->pGC->font = NullFont; FreeScratchGC(c->pGC); xfree(c->data); xfree(c); } return TRUE; } int ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did) ClientPtr client; DrawablePtr pDraw; GC *pGC; int nChars; unsigned char *data; int xorg; int yorg; int reqType; XID did; { ITclosureRec local_closure; local_closure.client = client; local_closure.pDraw = pDraw; local_closure.pGC = pGC; local_closure.nChars = nChars; local_closure.data = data; local_closure.xorg = xorg; local_closure.yorg = yorg; if ((local_closure.reqType = reqType) == X_ImageText8) { local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8; local_closure.itemSize = 1; } else { local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16; local_closure.itemSize = 2; } local_closure.did = did; local_closure.slept = FALSE; (void) doImageText(client, &local_closure); return Success; } /* does the necessary magic to figure out the fpe type */ static int #if NeedFunctionPrototypes DetermineFPEType(char *pathname) #else DetermineFPEType(pathname) char *pathname; #endif { int i; for (i = 0; i < num_fpe_types; i++) { if ((*fpe_functions[i].name_check) (pathname)) return i; } return -1; } static void #if NeedFunctionPrototypes FreeFontPath(FontPathElementPtr *list, int n, Bool force) #else FreeFontPath(list, n, force) FontPathElementPtr *list; Bool force; int n; #endif { int i; for (i = 0; i < n; i++) { if (force) { /* Sanity check that all refcounts will be 0 by the time we get to the end of the list. */ int found = 1; /* the first reference is us */ int j; for (j = i+1; j < n; j++) { if (list[j] == list[i]) found++; } if (list[i]->refcount != found) { ErrorF("FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n", list[i]->name_length, list[i]->name, list[i]->refcount, found); list[i]->refcount = found; /* ensure it will get freed */ } } FreeFPE(list[i]); } xfree((char *) list); } static FontPathElementPtr #if NeedFunctionPrototypes find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len) #else find_existing_fpe(list, num, name, len) FontPathElementPtr *list; int num; unsigned char *name; int len; #endif { FontPathElementPtr fpe; int i; for (i = 0; i < num; i++) { fpe = list[i]; if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0) return fpe; } return (FontPathElementPtr) 0; } static int #if NeedFunctionPrototypes SetFontPathElements(int npaths, unsigned char *paths, int *bad) #else SetFontPathElements(npaths, paths, bad) int npaths; unsigned char *paths; int *bad; #endif { int i, err; int valid_paths = 0; unsigned int len; unsigned char *cp = paths; FontPathElementPtr fpe, *fplist; fplist = (FontPathElementPtr *) xalloc(sizeof(FontPathElementPtr) * npaths); if (!fplist) { *bad = 0; return BadAlloc; } for (i = 0; i < num_fpe_types; i++) { if (fpe_functions[i].set_path_hook) (*fpe_functions[i].set_path_hook) (); } for (i = 0; i < npaths; i++) { len = (unsigned int) (*cp++); if (len) { /* if it's already in our active list, just reset it */ /* * note that this can miss FPE's in limbo -- may be worth catching * them, though it'd muck up refcounting */ fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len); if (fpe) { err = (*fpe_functions[fpe->type].reset_fpe) (fpe); if (err == Successful) { UseFPE(fpe);/* since it'll be decref'd later when freed * from the old list */ fplist[valid_paths++] = fpe; cp += len; continue; } /* if error or can't do it, act like it's a new one */ } fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } fpe->name = (char *) xalloc(len + 1); if (!fpe->name) { xfree(fpe); err = BadAlloc; goto bail; } fpe->refcount = 1; strncpy(fpe->name, (char *) cp, (int) len); cp += len; fpe->name[len] = '\0'; fpe->name_length = len; fpe->type = DetermineFPEType(fpe->name); if (fpe->type == -1) { xfree(fpe->name); xfree(fpe); err = BadValue; goto bail; } err = (*fpe_functions[fpe->type].init_fpe) (fpe); if (err != Successful) { xfree(fpe->name); xfree(fpe); err = BadValue; goto bail; } fplist[valid_paths++] = fpe; } else { err = BadValue; goto bail; } } FreeFontPath(font_path_elements, num_fpes, FALSE); font_path_elements = fplist; if (patternCache) EmptyFontPatternCache(patternCache); num_fpes = valid_paths; return Success; bail: *bad = i; while (--i >= 0) FreeFPE(fplist[i]); xfree(fplist); return err; } /* XXX -- do we need to pass error down to each renderer? */ int SetFontPath(client, npaths, paths, error) ClientPtr client; int npaths; unsigned char *paths; int *error; { int err = Success; if (npaths == 0) { if (SetDefaultFontPath(defaultFontPath) != Success) return BadName; } else { err = SetFontPathElements(npaths, paths, error); } return err; } /*** TJR - dirty hack - this variable is used in lib/font/fontfile/dirfile.c */ int settingDefaultFontPath = 0; int SetDefaultFontPath(path) char *path; { unsigned char *cp, *pp, *nump, *newpath; int num = 1, len, err, size = 0, bad; /* get enough for string, plus values -- use up commas */ len = strlen(path) + 1; nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); if (!newpath) return BadAlloc; pp = (unsigned char *) path; cp++; while (*pp) { if (*pp == ',') { *nump = (unsigned char) size; nump = cp++; pp++; num++; size = 0; } else { *cp++ = *pp++; size++; } } *nump = (unsigned char) size; settingDefaultFontPath = 1; err = SetFontPathElements(num, newpath, &bad); settingDefaultFontPath = 0; DEALLOCATE_LOCAL(newpath); return err; } unsigned char * GetFontPath(count, length) int *count; int *length; { int i; unsigned char *c; int len; FontPathElementPtr fpe; len = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; len += fpe->name_length + 1; } font_path_string = (unsigned char *) xrealloc(font_path_string, len); if (!font_path_string) return NULL; c = font_path_string; *length = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; *c = fpe->name_length; *length += *c++; memmove(c, fpe->name, fpe->name_length); c += fpe->name_length; } *count = num_fpes; return font_path_string; } int LoadGlyphs(client, pfont, nchars, item_size, data) ClientPtr client; FontPtr pfont; unsigned nchars; int item_size; unsigned char *data; { if (fpe_functions[pfont->fpe->type].load_glyphs) return (*fpe_functions[pfont->fpe->type].load_glyphs) (client, pfont, 0, nchars, item_size, data); else return Successful; } void DeleteClientFontStuff(client) ClientPtr client; { int i; FontPathElementPtr fpe; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; if (fpe_functions[fpe->type].client_died) (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); } } void InitFonts () { patternCache = MakeFontPatternCache(); if (screenInfo.numScreens > screenInfo.numVideoScreens) { PrinterFontRegisterFpeFunctions(); FontFileCheckRegisterFpeFunctions(); check_fs_register_fpe_functions(); } else { FontFileRegisterFpeFunctions(); fs_register_fpe_functions(); } } int GetDefaultPointSize () { return 120; } FontResolutionPtr GetClientResolutions (num) int *num; { if (requestingClient && requestingClient->fontResFunc != NULL && !requestingClient->clientGone) { return (*requestingClient->fontResFunc)(requestingClient, num); } else { static struct _FontResolution res; ScreenPtr pScreen; pScreen = screenInfo.screens[0]; res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; /* * XXX - we'll want this as long as bitmap instances are prevalent so that we can match them from scalable fonts */ if (res.x_resolution < 88) res.x_resolution = 75; else res.x_resolution = 100; res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; if (res.y_resolution < 88) res.y_resolution = 75; else res.y_resolution = 100; res.point_size = 120; *num = 1; return &res; } } /* * returns the type index of the new fpe * * should be called (only once!) by each type of fpe when initialized */ int #if NeedFunctionPrototypes RegisterFPEFunctions( int (*name_func) ( char* /* name */ ), int (*init_func) ( FontPathElementPtr /* fpe */ ), int (*free_func) ( FontPathElementPtr /* fpe */ ), int (*reset_func) ( FontPathElementPtr /* fpe */ ), int (*open_func) ( pointer /* client */, FontPathElementPtr /* fpe */, int /* flags */, char* /* name */, int /* namelen */, fsBitmapFormat /* format */, fsBitmapFormatMask /* fmask */, unsigned long /* id (type XID or FSID) */, FontPtr* /* pFont */, char** /* aliasName */, FontPtr /* non_cachable_font */ ), int (*close_func) ( FontPathElementPtr /* fpe */, FontPtr /* pFont */ ), int (*list_func) ( pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, FontNamesPtr /* names */ ), int (*start_lfwi_func) ( pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* patlen */, int /* maxnames */, pointer* /* privatep */ ), int (*next_lfwi_func) ( pointer /* client */, FontPathElementPtr /* fpe */, char** /* name */, int* /* namelen */, FontInfoPtr* /* info */, int* /* numFonts */, pointer /* private */ ), int (*wakeup_func) ( FontPathElementPtr /* fpe */, unsigned long* /* LastSelectMask */ ), int (*client_died) ( pointer /* client */, FontPathElementPtr /* fpe */ ), int (*load_glyphs) ( pointer /* client */, FontPtr /* pfont */, Bool /* range_flag */, unsigned int /* nchars */, int /* item_size */, unsigned char* /* data */ ), int (*start_list_alias_func) ( pointer /* client */, FontPathElementPtr /* fpe */, char* /* pat */, int /* len */, int /* max */, pointer* /* privatep */ ), int (*next_list_alias_func) ( pointer /* client */, FontPathElementPtr /* fpe */, char** /* namep */, int* /* namelenp */, char** /* resolvedp */, int* /* resolvedlenp */, pointer /* private */ ), void (*set_path_func) ( void ) ) #else RegisterFPEFunctions(name_func, init_func, free_func, reset_func, open_func, close_func, list_func, start_lfwi_func, next_lfwi_func, wakeup_func, client_died, load_glyphs, start_list_alias_func, next_list_alias_func, set_path_func) Bool (*name_func) (); int (*init_func) (); int (*free_func) (); int (*reset_func) (); int (*open_func) (); int (*close_func) (); int (*list_func) (); int (*start_lfwi_func) (); int (*next_lfwi_func) (); int (*wakeup_func) (); int (*client_died) (); int (*load_glyphs) (); int (*start_list_alias_func) (); int (*next_list_alias_func) (); void (*set_path_func) (); #endif { FPEFunctions *new; /* grow the list */ new = (FPEFunctions *) xrealloc(fpe_functions, (num_fpe_types + 1) * sizeof(FPEFunctions)); if (!new) return -1; fpe_functions = new; fpe_functions[num_fpe_types].name_check = name_func; fpe_functions[num_fpe_types].open_font = open_func; fpe_functions[num_fpe_types].close_font = close_func; fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func; fpe_functions[num_fpe_types].list_fonts = list_func; fpe_functions[num_fpe_types].start_list_fonts_with_info = start_lfwi_func; fpe_functions[num_fpe_types].list_next_font_with_info = next_lfwi_func; fpe_functions[num_fpe_types].init_fpe = init_func; fpe_functions[num_fpe_types].free_fpe = free_func; fpe_functions[num_fpe_types].reset_fpe = reset_func; fpe_functions[num_fpe_types].client_died = client_died; fpe_functions[num_fpe_types].load_glyphs = load_glyphs; fpe_functions[num_fpe_types].start_list_fonts_and_aliases = start_list_alias_func; fpe_functions[num_fpe_types].list_next_font_or_alias = next_list_alias_func; fpe_functions[num_fpe_types].set_path_hook = set_path_func; return num_fpe_types++; } void FreeFonts() { if (patternCache) { FreeFontPatternCache(patternCache); patternCache = 0; } FreeFontPath(font_path_elements, num_fpes, TRUE); font_path_elements = 0; num_fpes = 0; xfree(fpe_functions); num_fpe_types = 0; fpe_functions = (FPEFunctions *) 0; } /* convenience functions for FS interface */ FontPtr find_old_font(id) XID id; { return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, SecurityUnknownAccess); } Font GetNewFontClientID() { return FakeClientID(0); } int StoreFontClientFont(pfont, id) FontPtr pfont; Font id; { return AddResource(id, RT_NONE, (pointer) pfont); } void DeleteFontClientID(id) Font id; { FreeResource(id, RT_NONE); } int client_auth_generation(client) ClientPtr client; { return 0; } static int fs_handlers_installed = 0; static unsigned int last_server_gen; int init_fs_handlers(fpe, block_handler) FontPathElementPtr fpe; BlockHandlerProcPtr block_handler; { /* if server has reset, make sure the b&w handlers are reinstalled */ if (last_server_gen < serverGeneration) { last_server_gen = serverGeneration; fs_handlers_installed = 0; } if (fs_handlers_installed == 0) { #ifdef DEBUG fprintf(stderr, "adding FS b & w handlers\n"); #endif if (!RegisterBlockAndWakeupHandlers(block_handler, FontWakeup, (pointer) 0)) return AllocError; fs_handlers_installed++; } QueueFontWakeup(fpe); return Successful; } void remove_fs_handlers(fpe, block_handler, all) FontPathElementPtr fpe; BlockHandlerProcPtr block_handler; Bool all; { if (all) { /* remove the handlers if no one else is using them */ if (--fs_handlers_installed == 0) { #ifdef DEBUG fprintf(stderr, "removing FS b & w handlers\n"); #endif RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, (pointer) 0); } } RemoveFontWakeup(fpe); } #ifdef DEBUG #define GLWIDTHBYTESPADDED(bits,nbytes) \ ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ : 0) #define GLYPH_SIZE(ch, nbytes) \ GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \ (ch)->metrics.leftSideBearing, (nbytes)) dump_char_ascii(cip) CharInfoPtr cip; { int r, l; int bpr; int byte; static unsigned maskTab[] = { (1 << 7), (1 << 6), (1 << 5), (1 << 4), (1 << 3), (1 << 2), (1 << 1), (1 << 0), }; bpr = GLYPH_SIZE(cip, 4); for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) { pointer row = (pointer) cip->bits + r * bpr; byte = 0; for (l = 0; l <= (cip->metrics.rightSideBearing - cip->metrics.leftSideBearing); l++) { if (maskTab[l & 7] & row[l >> 3]) putchar('X'); else putchar('.'); } putchar('\n'); } } #endif vnc_unixsrc/Xvnc/programs/Xserver/dix/grabs.c0100664000076400007640000003173107120677563020746 0ustar constconst/* $XConsortium: grabs.c,v 5.10 94/04/17 20:26:39 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/dix/grabs.c,v 3.0 1996/04/15 11:19:48 dawes Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN action OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "X.h" #include "misc.h" #define NEED_EVENTS #include "Xproto.h" #include "windowstr.h" #include "inputstr.h" #include "cursorstr.h" #include "dixgrabs.h" extern InputInfo inputInfo; #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) #define MASKWORD(buf, i) buf[MASKIDX(i)] #define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) #define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) #define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) GrabPtr #if NeedFunctionPrototypes CreateGrab( int client, DeviceIntPtr device, WindowPtr window, Mask eventMask, Bool ownerEvents, Bool keyboardMode, Bool pointerMode, DeviceIntPtr modDevice, unsigned short modifiers, int type, KeyCode keybut, /* key or button */ WindowPtr confineTo, CursorPtr cursor) #else CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode, pointerMode, modDevice, modifiers, type, keybut, confineTo, cursor) int client; DeviceIntPtr device; WindowPtr window; Mask eventMask; Bool ownerEvents, keyboardMode, pointerMode; DeviceIntPtr modDevice; unsigned short modifiers; int type; KeyCode keybut; /* key or button */ WindowPtr confineTo; CursorPtr cursor; #endif { GrabPtr grab; grab = (GrabPtr)xalloc(sizeof(GrabRec)); if (!grab) return (GrabPtr)NULL; grab->resource = FakeClientID(client); grab->device = device; grab->coreGrab = ((device == inputInfo.keyboard) || (device == inputInfo.pointer)); grab->window = window; grab->eventMask = eventMask; grab->ownerEvents = ownerEvents; grab->keyboardMode = keyboardMode; grab->pointerMode = pointerMode; grab->modifiersDetail.exact = modifiers; grab->modifiersDetail.pMask = NULL; grab->modifierDevice = modDevice; grab->coreMods = ((modDevice == inputInfo.keyboard) || (modDevice == inputInfo.pointer)); grab->type = type; grab->detail.exact = keybut; grab->detail.pMask = NULL; grab->confineTo = confineTo; grab->cursor = cursor; if (cursor) cursor->refcnt++; return grab; } static void #if NeedFunctionPrototypes FreeGrab(GrabPtr pGrab) #else FreeGrab(pGrab) GrabPtr pGrab; #endif { if (pGrab->modifiersDetail.pMask != NULL) xfree(pGrab->modifiersDetail.pMask); if (pGrab->detail.pMask != NULL) xfree(pGrab->detail.pMask); if (pGrab->cursor) FreeCursor(pGrab->cursor, (Cursor)0); xfree(pGrab); } /*ARGSUSED*/ int DeletePassiveGrab(value, id) pointer value; XID id; { register GrabPtr g, prev; GrabPtr pGrab = (GrabPtr)value; /* it is OK if the grab isn't found */ prev = 0; for (g = (wPassiveGrabs (pGrab->window)); g; g = g->next) { if (pGrab == g) { if (prev) prev->next = g->next; else if (!(pGrab->window->optional->passiveGrabs = g->next)) CheckWindowOptionalNeed (pGrab->window); break; } prev = g; } FreeGrab(pGrab); return Success; } static Mask * #if NeedFunctionPrototypes DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail) #else DeleteDetailFromMask(pDetailMask, detail) Mask *pDetailMask; unsigned short detail; #endif { register Mask *mask; register int i; mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask); if (mask) { if (pDetailMask) for (i = 0; i < MasksPerDetailMask; i++) mask[i]= pDetailMask[i]; else for (i = 0; i < MasksPerDetailMask; i++) mask[i]= ~0L; BITCLEAR(mask, detail); } return mask; } static Bool #if NeedFunctionPrototypes IsInGrabMask( DetailRec firstDetail, DetailRec secondDetail, unsigned short exception) #else IsInGrabMask(firstDetail, secondDetail, exception) DetailRec firstDetail, secondDetail; unsigned short exception; #endif { if (firstDetail.exact == exception) { if (firstDetail.pMask == NULL) return TRUE; /* (at present) never called with two non-null pMasks */ if (secondDetail.exact == exception) return FALSE; if (GETBIT(firstDetail.pMask, secondDetail.exact)) return TRUE; } return FALSE; } static Bool #if NeedFunctionPrototypes IdenticalExactDetails( unsigned short firstExact, unsigned short secondExact, unsigned short exception) #else IdenticalExactDetails(firstExact, secondExact, exception) unsigned short firstExact, secondExact, exception; #endif { if ((firstExact == exception) || (secondExact == exception)) return FALSE; if (firstExact == secondExact) return TRUE; return FALSE; } static Bool #if NeedFunctionPrototypes DetailSupersedesSecond( DetailRec firstDetail, DetailRec secondDetail, unsigned short exception) #else DetailSupersedesSecond(firstDetail, secondDetail, exception) DetailRec firstDetail, secondDetail; unsigned short exception; #endif { if (IsInGrabMask(firstDetail, secondDetail, exception)) return TRUE; if (IdenticalExactDetails(firstDetail.exact, secondDetail.exact, exception)) return TRUE; return FALSE; } static Bool #if NeedFunctionPrototypes GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab) #else GrabSupersedesSecond(pFirstGrab, pSecondGrab) GrabPtr pFirstGrab, pSecondGrab; #endif { if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail, pSecondGrab->modifiersDetail, (unsigned short)AnyModifier)) return FALSE; if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail, (unsigned short)AnyKey)) return TRUE; return FALSE; } Bool GrabMatchesSecond(pFirstGrab, pSecondGrab) GrabPtr pFirstGrab, pSecondGrab; { if ((pFirstGrab->device != pSecondGrab->device) || (pFirstGrab->modifierDevice != pSecondGrab->modifierDevice) || (pFirstGrab->type != pSecondGrab->type)) return FALSE; if (GrabSupersedesSecond(pFirstGrab, pSecondGrab) || GrabSupersedesSecond(pSecondGrab, pFirstGrab)) return TRUE; if (DetailSupersedesSecond(pSecondGrab->detail, pFirstGrab->detail, (unsigned short)AnyKey) && DetailSupersedesSecond(pFirstGrab->modifiersDetail, pSecondGrab->modifiersDetail, (unsigned short)AnyModifier)) return TRUE; if (DetailSupersedesSecond(pFirstGrab->detail, pSecondGrab->detail, (unsigned short)AnyKey) && DetailSupersedesSecond(pSecondGrab->modifiersDetail, pFirstGrab->modifiersDetail, (unsigned short)AnyModifier)) return TRUE; return FALSE; } int AddPassiveGrabToList(pGrab) GrabPtr pGrab; { GrabPtr grab; for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { if (GrabMatchesSecond(pGrab, grab)) { if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) { FreeGrab(pGrab); return BadAccess; } } } if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window)) { FreeGrab(pGrab); return BadAlloc; } pGrab->next = pGrab->window->optional->passiveGrabs; pGrab->window->optional->passiveGrabs = pGrab; if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer)pGrab)) return Success; return BadAlloc; } /* the following is kinda complicated, because we need to be able to back out * if any allocation fails */ Bool DeletePassiveGrabFromList(pMinuendGrab) GrabPtr pMinuendGrab; { register GrabPtr grab; GrabPtr *deletes, *adds; Mask ***updates, **details; int i, ndels, nadds, nups; Bool ok; #define UPDATE(mask,exact) \ if (!(details[nups] = DeleteDetailFromMask(mask, exact))) \ ok = FALSE; \ else \ updates[nups++] = &(mask) i = 0; for (grab = wPassiveGrabs(pMinuendGrab->window); grab; grab = grab->next) i++; if (!i) return TRUE; deletes = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); adds = (GrabPtr *)ALLOCATE_LOCAL(i * sizeof(GrabPtr)); updates = (Mask ***)ALLOCATE_LOCAL(i * sizeof(Mask **)); details = (Mask **)ALLOCATE_LOCAL(i * sizeof(Mask *)); if (!deletes || !adds || !updates || !details) { if (details) DEALLOCATE_LOCAL(details); if (updates) DEALLOCATE_LOCAL(updates); if (adds) DEALLOCATE_LOCAL(adds); if (deletes) DEALLOCATE_LOCAL(deletes); return FALSE; } ndels = nadds = nups = 0; ok = TRUE; for (grab = wPassiveGrabs(pMinuendGrab->window); grab && ok; grab = grab->next) { if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource)) || !GrabMatchesSecond(grab, pMinuendGrab)) continue; if (GrabSupersedesSecond(pMinuendGrab, grab)) { deletes[ndels++] = grab; } else if ((grab->detail.exact == AnyKey) && (grab->modifiersDetail.exact != AnyModifier)) { UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); } else if ((grab->modifiersDetail.exact == AnyModifier) && (grab->detail.exact != AnyKey)) { UPDATE(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact); } else if ((pMinuendGrab->detail.exact != AnyKey) && (pMinuendGrab->modifiersDetail.exact != AnyModifier)) { GrabPtr pNewGrab; UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device, grab->window, (Mask)grab->eventMask, (Bool)grab->ownerEvents, (Bool)grab->keyboardMode, (Bool)grab->pointerMode, grab->modifierDevice, AnyModifier, (int)grab->type, pMinuendGrab->detail.exact, grab->confineTo, grab->cursor); if (!pNewGrab) ok = FALSE; else if (!(pNewGrab->modifiersDetail.pMask = DeleteDetailFromMask(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact)) || (!pNewGrab->window->optional && !MakeWindowOptional(pNewGrab->window))) { FreeGrab(pNewGrab); ok = FALSE; } else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB, (pointer)pNewGrab)) ok = FALSE; else adds[nadds++] = pNewGrab; } else if (pMinuendGrab->detail.exact == AnyKey) { UPDATE(grab->modifiersDetail.pMask, pMinuendGrab->modifiersDetail.exact); } else { UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact); } } if (!ok) { for (i = 0; i < nadds; i++) FreeResource(adds[i]->resource, RT_NONE); for (i = 0; i < nups; i++) xfree(details[i]); } else { for (i = 0; i < ndels; i++) FreeResource(deletes[i]->resource, RT_NONE); for (i = 0; i < nadds; i++) { grab = adds[i]; grab->next = grab->window->optional->passiveGrabs; grab->window->optional->passiveGrabs = grab; } for (i = 0; i < nups; i++) { xfree(*updates[i]); *updates[i] = details[i]; } } DEALLOCATE_LOCAL(details); DEALLOCATE_LOCAL(updates); DEALLOCATE_LOCAL(adds); DEALLOCATE_LOCAL(deletes); return ok; #undef UPDATE } vnc_unixsrc/Xvnc/programs/Xserver/dix/events.c0100664000076400007640000030751107120677563021156 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: events.c /main/187 1996/09/25 00:47:41 dpw $ */ /* $XFree86: xc/programs/Xserver/dix/events.c,v 3.11 1996/12/24 02:23:45 dawes Exp $ */ #include "X.h" #include "misc.h" #include "resource.h" #define NEED_EVENTS #define NEED_REPLIES #include "Xproto.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixstruct.h" #ifdef XKB #include "XKBsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif #include "XIproto.h" #include "exevents.h" #include "extnsionst.h" #include "dixevents.h" #include "dixgrabs.h" #include "dispatch.h" extern WindowPtr *WindowTable; #define EXTENSION_EVENT_BASE 64 #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ #define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask ) #define AllButtonsMask ( \ Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask ) #define MotionMask ( \ PointerMotionMask | Button1MotionMask | \ Button2MotionMask | Button3MotionMask | Button4MotionMask | \ Button5MotionMask | ButtonMotionMask ) #define PropagateMask ( \ KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \ MotionMask ) #define PointerGrabMask ( \ ButtonPressMask | ButtonReleaseMask | \ EnterWindowMask | LeaveWindowMask | \ PointerMotionHintMask | KeymapStateMask | \ MotionMask ) #define AllModifiersMask ( \ ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \ Mod3Mask | Mod4Mask | Mod5Mask ) #define AllEventMasks (lastEventMask|(lastEventMask-1)) /* * The following relies on the fact that the ButtonMotionMasks are equal * to the corresponding ButtonMasks from the current modifier/button state. */ #define Motion_Filter(class) (PointerMotionMask | \ (class)->state | (class)->motionMask) #define WID(w) ((w) ? ((w)->drawable.id) : 0) #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) CallbackListPtr EventCallback; CallbackListPtr DeviceEventCallback; #define DNPMCOUNT 8 Mask DontPropagateMasks[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT]; #ifdef DEBUG static debug_events = 0; #endif InputInfo inputInfo; static struct { QdEventPtr pending, *pendtail; DeviceIntPtr replayDev; /* kludgy rock to put flag for */ WindowPtr replayWin; /* ComputeFreezes */ Bool playingEvents; TimeStamp time; } syncEvents; /* * The window trace information is used to avoid having to compute all the * windows between the root and the current pointer window each time a button * or key goes down. The grabs on each of those windows must be checked. */ static WindowPtr *spriteTrace = (WindowPtr *)NULL; #define ROOT spriteTrace[0] static int spriteTraceSize = 0; static int spriteTraceGood; typedef struct { int x, y; ScreenPtr pScreen; } HotSpot; static struct { CursorPtr current; BoxRec hotLimits; /* logical constraints of hot spot */ Bool confined; /* confined to screen */ #ifdef SHAPE RegionPtr hotShape; /* additional logical shape constraint */ #endif BoxRec physLimits; /* physical constraints of hot spot */ WindowPtr win; /* window of logical position */ HotSpot hot; /* logical pointer position */ HotSpot hotPhys; /* physical pointer position */ } sprite; /* info about the cursor sprite */ static void DoEnterLeaveEvents( #if NeedFunctionPrototypes WindowPtr /*fromWin*/, WindowPtr /*toWin*/, int /*mode*/ #endif ); static WindowPtr XYToWindow( #if NeedFunctionPrototypes int /*x*/, int /*y*/ #endif ); extern Bool permitOldBugs; extern Bool Must_have_memory; extern int lastEvent; #ifdef XINPUT extern int DeviceMotionNotify, DeviceButtonPress, DeviceKeyPress; #endif static Mask lastEventMask; #define CantBeFiltered NoEventMask static Mask filters[128] = { NoSuchEvent, /* 0 */ NoSuchEvent, /* 1 */ KeyPressMask, /* KeyPress */ KeyReleaseMask, /* KeyRelease */ ButtonPressMask, /* ButtonPress */ ButtonReleaseMask, /* ButtonRelease */ PointerMotionMask, /* MotionNotify (initial state) */ EnterWindowMask, /* EnterNotify */ LeaveWindowMask, /* LeaveNotify */ FocusChangeMask, /* FocusIn */ FocusChangeMask, /* FocusOut */ KeymapStateMask, /* KeymapNotify */ ExposureMask, /* Expose */ CantBeFiltered, /* GraphicsExpose */ CantBeFiltered, /* NoExpose */ VisibilityChangeMask, /* VisibilityNotify */ SubstructureNotifyMask, /* CreateNotify */ StructureAndSubMask, /* DestroyNotify */ StructureAndSubMask, /* UnmapNotify */ StructureAndSubMask, /* MapNotify */ SubstructureRedirectMask, /* MapRequest */ StructureAndSubMask, /* ReparentNotify */ StructureAndSubMask, /* ConfigureNotify */ SubstructureRedirectMask, /* ConfigureRequest */ StructureAndSubMask, /* GravityNotify */ ResizeRedirectMask, /* ResizeRequest */ StructureAndSubMask, /* CirculateNotify */ SubstructureRedirectMask, /* CirculateRequest */ PropertyChangeMask, /* PropertyNotify */ CantBeFiltered, /* SelectionClear */ CantBeFiltered, /* SelectionRequest */ CantBeFiltered, /* SelectionNotify */ ColormapChangeMask, /* ColormapNotify */ CantBeFiltered, /* ClientMessage */ CantBeFiltered /* MappingNotify */ }; static CARD8 criticalEvents[32] = { 0x3c /* key and button events */ }; Mask GetNextEventMask() { lastEventMask <<= 1; return lastEventMask; } void SetMaskForEvent(mask, event) Mask mask; int event; { if ((event < LASTEvent) || (event >= 128)) FatalError("SetMaskForEvent: bogus event number"); filters[event] = mask; } void SetCriticalEvent(event) int event; { if (event >= 128) FatalError("SetCriticalEvent: bogus event number"); criticalEvents[event >> 3] |= 1 << (event & 7); } static void #if NeedFunctionPrototypes SyntheticMotion(int x, int y) #else SyntheticMotion(x, y) int x, y; #endif { xEvent xE; xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootY = y; if (syncEvents.playingEvents) xE.u.keyButtonPointer.time = syncEvents.time.milliseconds; else xE.u.keyButtonPointer.time = currentTime.milliseconds; xE.u.u.type = MotionNotify; (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1); } #ifdef SHAPE static void #if NeedFunctionPrototypes ConfineToShape(RegionPtr shape, int *px, int *py) #else ConfineToShape(shape, px, py) RegionPtr shape; int *px, *py; #endif { BoxRec box; int x = *px, y = *py; int incx = 1, incy = 1; if (POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)) return; box = *REGION_EXTENTS(sprite.hot.pScreen, shape); /* this is rather crude */ do { x += incx; if (x >= box.x2) { incx = -1; x = *px - 1; } else if (x < box.x1) { incx = 1; x = *px; y += incy; if (y >= box.y2) { incy = -1; y = *py - 1; } else if (y < box.y1) return; /* should never get here! */ } } while (!POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)); *px = x; *py = y; } #endif static void #if NeedFunctionPrototypes CheckPhysLimits( CursorPtr cursor, Bool generateEvents, Bool confineToScreen, ScreenPtr pScreen) #else CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen) CursorPtr cursor; Bool generateEvents; Bool confineToScreen; ScreenPtr pScreen; #endif { HotSpot new; if (!cursor) return; new = sprite.hotPhys; if (pScreen) new.pScreen = pScreen; else pScreen = new.pScreen; (*pScreen->CursorLimits) (pScreen, cursor, &sprite.hotLimits, &sprite.physLimits); sprite.confined = confineToScreen; (* pScreen->ConstrainCursor)(pScreen, &sprite.physLimits); if (new.x < sprite.physLimits.x1) new.x = sprite.physLimits.x1; else if (new.x >= sprite.physLimits.x2) new.x = sprite.physLimits.x2 - 1; if (new.y < sprite.physLimits.y1) new.y = sprite.physLimits.y1; else if (new.y >= sprite.physLimits.y2) new.y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &new.x, &new.y); #endif if ((pScreen != sprite.hotPhys.pScreen) || (new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y)) { if (pScreen != sprite.hotPhys.pScreen) sprite.hotPhys = new; (*pScreen->SetCursorPosition) (pScreen, new.x, new.y, generateEvents); if (!generateEvents) SyntheticMotion(new.x, new.y); } } static void #if NeedFunctionPrototypes CheckVirtualMotion( register QdEventPtr qe, register WindowPtr pWin) #else CheckVirtualMotion(qe, pWin) register QdEventPtr qe; register WindowPtr pWin; #endif { if (qe) { sprite.hot.pScreen = qe->pScreen; sprite.hot.x = qe->event->u.keyButtonPointer.rootX; sprite.hot.y = qe->event->u.keyButtonPointer.rootY; pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo : NullWindow; } if (pWin) { BoxRec lims; if (sprite.hot.pScreen != pWin->drawable.pScreen) { sprite.hot.pScreen = pWin->drawable.pScreen; sprite.hot.x = sprite.hot.y = 0; } lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize); if (sprite.hot.x < lims.x1) sprite.hot.x = lims.x1; else if (sprite.hot.x >= lims.x2) sprite.hot.x = lims.x2 - 1; if (sprite.hot.y < lims.y1) sprite.hot.y = lims.y1; else if (sprite.hot.y >= lims.y2) sprite.hot.y = lims.y2 - 1; #ifdef SHAPE if (wBoundingShape(pWin)) ConfineToShape(&pWin->borderSize, &sprite.hot.x, &sprite.hot.y); #endif if (qe) { qe->pScreen = sprite.hot.pScreen; qe->event->u.keyButtonPointer.rootX = sprite.hot.x; qe->event->u.keyButtonPointer.rootY = sprite.hot.y; } } ROOT = WindowTable[sprite.hot.pScreen->myNum]; } void ConfineCursorToWindow(pWin, generateEvents, confineToScreen) WindowPtr pWin; Bool generateEvents; Bool confineToScreen; { ScreenPtr pScreen = pWin->drawable.pScreen; if (syncEvents.playingEvents) { CheckVirtualMotion((QdEventPtr)NULL, pWin); SyntheticMotion(sprite.hot.x, sprite.hot.y); } else { sprite.hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize); #ifdef SHAPE sprite.hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; #endif CheckPhysLimits(sprite.current, generateEvents, confineToScreen, pScreen); } } Bool PointerConfinedToScreen() { return sprite.confined; } static void #if NeedFunctionPrototypes ChangeToCursor(CursorPtr cursor) #else ChangeToCursor(cursor) CursorPtr cursor; #endif { if (cursor != sprite.current) { if ((sprite.current->bits->xhot != cursor->bits->xhot) || (sprite.current->bits->yhot != cursor->bits->yhot)) CheckPhysLimits(cursor, FALSE, PointerConfinedToScreen(), (ScreenPtr)NULL); (*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen, cursor); sprite.current = cursor; } } /* returns true if b is a descendent of a */ Bool IsParent(a, b) register WindowPtr a, b; { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; } static void #if NeedFunctionPrototypes PostNewCursor(void) #else PostNewCursor() #endif { register WindowPtr win; register GrabPtr grab = inputInfo.pointer->grab; if (syncEvents.playingEvents) return; if (grab) { if (grab->cursor) { ChangeToCursor(grab->cursor); return; } if (IsParent(grab->window, sprite.win)) win = sprite.win; else win = grab->window; } else win = sprite.win; for (; win; win = win->parent) if (win->optional && win->optional->cursor != NullCursor) { ChangeToCursor(win->optional->cursor); return; } } WindowPtr GetCurrentRootWindow() { return ROOT; } WindowPtr GetSpriteWindow() { return sprite.win; } CursorPtr GetSpriteCursor() { return sprite.current; } void GetSpritePosition(px, py) int *px, *py; { *px = sprite.hotPhys.x; *py = sprite.hotPhys.y; } #define TIMESLOP (5 * 60 * 1000) /* 5 minutes */ static void #if NeedFunctionPrototypes MonthChangedOrBadTime(register xEvent *xE) #else MonthChangedOrBadTime(xE) register xEvent *xE; #endif { /* If the ddx/OS is careless about not processing timestamped events from * different sources in sorted order, then it's possible for time to go * backwards when it should not. Here we ensure a decent time. */ if ((currentTime.milliseconds - xE->u.keyButtonPointer.time) > TIMESLOP) currentTime.months++; else xE->u.keyButtonPointer.time = currentTime.milliseconds; } #define NoticeTime(xE) { \ if ((xE)->u.keyButtonPointer.time < currentTime.milliseconds) \ MonthChangedOrBadTime(xE); \ currentTime.milliseconds = (xE)->u.keyButtonPointer.time; \ lastDeviceEventTime = currentTime; } void NoticeEventTime(xE) register xEvent *xE; { if (!syncEvents.playingEvents) NoticeTime(xE); } /************************************************************************** * The following procedures deal with synchronous events * **************************************************************************/ void EnqueueEvent(xE, device, count) xEvent *xE; DeviceIntPtr device; int count; { register QdEventPtr tail = *syncEvents.pendtail; register QdEventPtr qe; xEvent *qxE; NoticeTime(xE); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* The RECORD spec says that the root window field of motion events * must be valid. At this point, it hasn't been filled in yet, so * we do it here. The long expression below is necessary to get * the current root window; the apparently reasonable alternative * GetCurrentRootWindow()->drawable.id doesn't give you the right * answer on the first motion event after a screen change because * the data that GetCurrentRootWindow relies on hasn't been * updated yet. */ if (xE->u.u.type == MotionNotify) xE->u.keyButtonPointer.root = WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo); } if (xE->u.u.type == MotionNotify) { sprite.hotPhys.x = xE->u.keyButtonPointer.rootX; sprite.hotPhys.y = xE->u.keyButtonPointer.rootY; /* do motion compression */ if (tail && (tail->event->u.u.type == MotionNotify) && (tail->pScreen == sprite.hotPhys.pScreen)) { tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x; tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y; tail->event->u.keyButtonPointer.time = xE->u.keyButtonPointer.time; tail->months = currentTime.months; return; } } qe = (QdEventPtr)xalloc(sizeof(QdEventRec) + (count * sizeof(xEvent))); if (!qe) return; qe->next = (QdEventPtr)NULL; qe->device = device; qe->pScreen = sprite.hotPhys.pScreen; qe->months = currentTime.months; qe->event = (xEvent *)(qe + 1); qe->evcount = count; for (qxE = qe->event; --count >= 0; qxE++, xE++) *qxE = *xE; if (tail) syncEvents.pendtail = &tail->next; *syncEvents.pendtail = qe; } static void #if NeedFunctionPrototypes PlayReleasedEvents(void) #else PlayReleasedEvents() #endif { register QdEventPtr *prev, qe; register DeviceIntPtr dev; prev = &syncEvents.pending; while ( (qe = *prev) ) { if (!qe->device->sync.frozen) { *prev = qe->next; if (*syncEvents.pendtail == *prev) syncEvents.pendtail = prev; if (qe->event->u.u.type == MotionNotify) CheckVirtualMotion(qe, NullWindow); syncEvents.time.months = qe->months; syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time; (*qe->device->public.processInputProc)(qe->event, qe->device, qe->evcount); xfree(qe); for (dev = inputInfo.devices; dev && dev->sync.frozen; dev = dev->next) ; if (!dev) break; /* Playing the event may have unfrozen another device. */ /* So to play it safe, restart at the head of the queue */ prev = &syncEvents.pending; } else prev = &qe->next; } } static void #if NeedFunctionPrototypes FreezeThaw(register DeviceIntPtr dev, Bool frozen) #else FreezeThaw(dev, frozen) register DeviceIntPtr dev; Bool frozen; #endif { dev->sync.frozen = frozen; if (frozen) dev->public.processInputProc = dev->public.enqueueInputProc; else dev->public.processInputProc = dev->public.realInputProc; } void ComputeFreezes() { register DeviceIntPtr replayDev = syncEvents.replayDev; register int i; WindowPtr w; register xEvent *xE; int count; GrabPtr grab; register DeviceIntPtr dev; for (dev = inputInfo.devices; dev; dev = dev->next) FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN)); if (syncEvents.playingEvents || (!replayDev && !syncEvents.pending)) return; syncEvents.playingEvents = TRUE; if (replayDev) { xE = replayDev->sync.event; count = replayDev->sync.evcount; syncEvents.replayDev = (DeviceIntPtr)NULL; w = XYToWindow( xE->u.keyButtonPointer.rootX, xE->u.keyButtonPointer.rootY); for (i = 0; i < spriteTraceGood; i++) if (syncEvents.replayWin == spriteTrace[i]) { if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) if (replayDev->focus) DeliverFocusedEvent(replayDev, xE, w, count); else DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count); goto playmore; } /* must not still be in the same stack */ if (replayDev->focus) DeliverFocusedEvent(replayDev, xE, w, count); else DeliverDeviceEvents(w, xE, NullGrab, NullWindow, replayDev, count); } playmore: for (dev = inputInfo.devices; dev; dev = dev->next) { if (!dev->sync.frozen) { PlayReleasedEvents(); break; } } syncEvents.playingEvents = FALSE; /* the following may have been skipped during replay, so do it now */ if ((grab = inputInfo.pointer->grab) && grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); } else ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], TRUE, FALSE); PostNewCursor(); } void CheckGrabForSyncs(thisDev, thisMode, otherMode) register DeviceIntPtr thisDev; Bool thisMode, otherMode; { register GrabPtr grab = thisDev->grab; register DeviceIntPtr dev; if (thisMode == GrabModeSync) thisDev->sync.state = FROZEN_NO_EVENT; else { /* free both if same client owns both */ thisDev->sync.state = THAWED; if (thisDev->sync.other && (CLIENT_BITS(thisDev->sync.other->resource) == CLIENT_BITS(grab->resource))) thisDev->sync.other = NullGrab; } for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev != thisDev) { if (otherMode == GrabModeSync) dev->sync.other = grab; else { /* free both if same client owns both */ if (dev->sync.other && (CLIENT_BITS(dev->sync.other->resource) == CLIENT_BITS(grab->resource))) dev->sync.other = NullGrab; } } } ComputeFreezes(); } void ActivatePointerGrab(mouse, grab, time, autoGrab) register GrabPtr grab; register DeviceIntPtr mouse; TimeStamp time; Bool autoGrab; { WindowPtr oldWin = (mouse->grab) ? mouse->grab->window : sprite.win; if (grab->confineTo) { if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) sprite.hotPhys.x = sprite.hotPhys.y = 0; ConfineCursorToWindow(grab->confineTo, FALSE, TRUE); } DoEnterLeaveEvents(oldWin, grab->window, NotifyGrab); mouse->valuator->motionHintWindow = NullWindow; if (syncEvents.playingEvents) mouse->grabTime = syncEvents.time; else mouse->grabTime = time; if (grab->cursor) grab->cursor->refcnt++; mouse->activeGrab = *grab; mouse->grab = &mouse->activeGrab; mouse->fromPassiveGrab = autoGrab; PostNewCursor(); CheckGrabForSyncs(mouse, (Bool)grab->pointerMode, (Bool)grab->keyboardMode); } void DeactivatePointerGrab(mouse) register DeviceIntPtr mouse; { register GrabPtr grab = mouse->grab; register DeviceIntPtr dev; mouse->valuator->motionHintWindow = NullWindow; mouse->grab = NullGrab; mouse->sync.state = NOT_GRABBED; mouse->fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->sync.other == grab) dev->sync.other = NullGrab; } DoEnterLeaveEvents(grab->window, sprite.win, NotifyUngrab); if (grab->confineTo) ConfineCursorToWindow(ROOT, FALSE, FALSE); PostNewCursor(); if (grab->cursor) FreeCursor(grab->cursor, (Cursor)0); ComputeFreezes(); } void ActivateKeyboardGrab(keybd, grab, time, passive) register DeviceIntPtr keybd; GrabPtr grab; TimeStamp time; Bool passive; { WindowPtr oldWin; if (keybd->grab) oldWin = keybd->grab->window; else if (keybd->focus) oldWin = keybd->focus->win; else oldWin = sprite.win; if (oldWin == FollowKeyboardWin) oldWin = inputInfo.keyboard->focus->win; if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab); if (syncEvents.playingEvents) keybd->grabTime = syncEvents.time; else keybd->grabTime = time; keybd->activeGrab = *grab; keybd->grab = &keybd->activeGrab; keybd->fromPassiveGrab = passive; CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); } void DeactivateKeyboardGrab(keybd) register DeviceIntPtr keybd; { register GrabPtr grab = keybd->grab; register DeviceIntPtr dev; register WindowPtr focusWin = keybd->focus ? keybd->focus->win : sprite.win; if (focusWin == FollowKeyboardWin) focusWin = inputInfo.keyboard->focus->win; if (keybd->valuator) keybd->valuator->motionHintWindow = NullWindow; keybd->grab = NullGrab; keybd->sync.state = NOT_GRABBED; keybd->fromPassiveGrab = FALSE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->sync.other == grab) dev->sync.other = NullGrab; } DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab); ComputeFreezes(); } void AllowSome(client, time, thisDev, newState) ClientPtr client; TimeStamp time; register DeviceIntPtr thisDev; int newState; { Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced; TimeStamp grabTime; register DeviceIntPtr dev; thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client); thisSynced = FALSE; otherGrabbed = FALSE; othersFrozen = TRUE; grabTime = thisDev->grabTime; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; if (dev->grab && SameClient(dev->grab, client)) { if (!(thisGrabbed || otherGrabbed) || (CompareTimeStamps(dev->grabTime, grabTime) == LATER)) grabTime = dev->grabTime; otherGrabbed = TRUE; if (thisDev->sync.other == dev->grab) thisSynced = TRUE; if (dev->sync.state < FROZEN) othersFrozen = FALSE; } else if (!dev->sync.other || !SameClient(dev->sync.other, client)) othersFrozen = FALSE; } if (!((thisGrabbed && thisDev->sync.state >= FROZEN) || thisSynced)) return; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, grabTime) == EARLIER)) return; switch (newState) { case THAWED: /* Async */ if (thisGrabbed) thisDev->sync.state = THAWED; if (thisSynced) thisDev->sync.other = NullGrab; ComputeFreezes(); break; case FREEZE_NEXT_EVENT: /* Sync */ if (thisGrabbed) { thisDev->sync.state = FREEZE_NEXT_EVENT; if (thisSynced) thisDev->sync.other = NullGrab; ComputeFreezes(); } break; case THAWED_BOTH: /* AsyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = THAWED; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = FREEZE_BOTH_NEXT_EVENT; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; case NOT_GRABBED: /* Replay */ if (thisGrabbed && thisDev->sync.state == FROZEN_WITH_EVENT) { if (thisSynced) thisDev->sync.other = NullGrab; syncEvents.replayDev = thisDev; syncEvents.replayWin = thisDev->grab->window; (*thisDev->DeactivateGrab)(thisDev); syncEvents.replayDev = (DeviceIntPtr)NULL; } break; case THAW_OTHERS: /* AsyncOthers */ if (othersFrozen) { for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; if (dev->grab && SameClient(dev->grab, client)) dev->sync.state = THAWED; if (dev->sync.other && SameClient(dev->sync.other, client)) dev->sync.other = NullGrab; } ComputeFreezes(); } break; } } int ProcAllowEvents(client) register ClientPtr client; { TimeStamp time; DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST(xAllowEventsReq); REQUEST_SIZE_MATCH(xAllowEventsReq); time = ClientTimeToServerTime(stuff->time); switch (stuff->mode) { case ReplayPointer: AllowSome(client, time, mouse, NOT_GRABBED); break; case SyncPointer: AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); break; case AsyncPointer: AllowSome(client, time, mouse, THAWED); break; case ReplayKeyboard: AllowSome(client, time, keybd, NOT_GRABBED); break; case SyncKeyboard: AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); break; case AsyncKeyboard: AllowSome(client, time, keybd, THAWED); break; case SyncBoth: AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); break; case AsyncBoth: AllowSome(client, time, keybd, THAWED_BOTH); break; default: client->errorValue = stuff->mode; return BadValue; } return Success; } void ReleaseActiveGrabs(client) ClientPtr client; { register DeviceIntPtr dev; Bool done; /* XXX CloseDownClient should remove passive grabs before * releasing active grabs. */ do { done = TRUE; for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev->grab && SameClient(dev->grab, client)) { (*dev->DeactivateGrab)(dev); done = FALSE; } } } while (!done); } /************************************************************************** * The following procedures deal with delivering events * **************************************************************************/ int TryClientEvents (client, pEvents, count, mask, filter, grab) ClientPtr client; GrabPtr grab; xEvent *pEvents; int count; Mask mask, filter; { int i; int type; #ifdef DEBUG if (debug_events) ErrorF( "Event([%d, %d], mask=0x%x), client=%d", pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); #endif if ((client) && (client != serverClient) && (!client->clientGone) && ((filter == CantBeFiltered) || (mask & filter))) { if (grab && !SameClient(grab, client)) return -1; /* don't send, but notify caller */ type = pEvents->u.u.type; if (type == MotionNotify) { if (mask & PointerMotionHintMask) { if (WID(inputInfo.pointer->valuator->motionHintWindow) == pEvents->u.keyButtonPointer.event) { #ifdef DEBUG if (debug_events) ErrorF("\n"); #endif return 1; /* don't send, but pretend we did */ } pEvents->u.u.detail = NotifyHint; } else { pEvents->u.u.detail = NotifyNormal; } } #ifdef XINPUT else { if ((type == DeviceMotionNotify) && MaybeSendDeviceMotionNotifyHint ((deviceKeyButtonPointer*)pEvents, mask) != 0) return 1; } #endif type &= 0177; if (type != KeymapNotify) { /* all extension events must have a sequence number */ for (i = 0; i < count; i++) pEvents[i].u.u.sequenceNumber = client->sequence; } if (BitIsOn(criticalEvents, type)) SetCriticalOutputPending(); WriteEventsToClient(client, count, pEvents); #ifdef DEBUG if (debug_events) ErrorF( " delivered\n"); #endif return 1; } else { #ifdef DEBUG if (debug_events) ErrorF("\n"); #endif return 0; } } int DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx) register WindowPtr pWin; GrabPtr grab; xEvent *pEvents; int count; Mask filter; int mskidx; { int deliveries = 0, nondeliveries = 0; int attempt; register InputClients *other; ClientPtr client = NullClient; Mask deliveryMask; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ int type = pEvents->u.u.type; /* CantBeFiltered means only window owner gets the event */ if ((filter == CantBeFiltered) || !(type & EXTENSION_EVENT_BASE)) { /* if nobody ever wants to see this event, skip some work */ if (filter != CantBeFiltered && !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) return 0; if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, grab)) ) { if (attempt > 0) { deliveries++; client = wClient(pWin); deliveryMask = pWin->eventMask; } else nondeliveries--; } } if (filter != CantBeFiltered) { if (type & EXTENSION_EVENT_BASE) { OtherInputMasks *inputMasks; inputMasks = wOtherInputMasks(pWin); if (!inputMasks || !(inputMasks->inputEvents[mskidx] & filter)) return 0; other = inputMasks->inputClients; } else other = (InputClients *)wOtherClients(pWin); for (; other; other = other->next) { if ( (attempt = TryClientEvents(rClient(other), pEvents, count, other->mask[mskidx], filter, grab)) ) { if (attempt > 0) { deliveries++; client = rClient(other); deliveryMask = other->mask[mskidx]; } else nondeliveries--; } } } if ((type == ButtonPress) && deliveries && (!grab)) { GrabRec tempGrab; tempGrab.device = inputInfo.pointer; tempGrab.resource = client->clientAsMask; tempGrab.window = pWin; tempGrab.ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE; tempGrab.eventMask = deliveryMask; tempGrab.keyboardMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync; tempGrab.confineTo = NullWindow; tempGrab.cursor = NullCursor; (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, currentTime, TRUE); } else if ((type == MotionNotify) && deliveries) inputInfo.pointer->valuator->motionHintWindow = pWin; #ifdef XINPUT else { if (((type == DeviceMotionNotify) || (type == DeviceButtonPress)) && deliveries) CheckDeviceGrabAndHintWindow (pWin, type, (deviceKeyButtonPointer*) pEvents, grab, client, deliveryMask); } #endif if (deliveries) return deliveries; return nondeliveries; } /* If the event goes to dontClient, don't send it and return 0. if send works, return 1 or if send didn't work, return 2. Only works for core events. */ int MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient) register WindowPtr pWin; xEvent *pEvents; int count; Mask filter; ClientPtr dontClient; { register OtherClients *other; if (pWin->eventMask & filter) { if (wClient(pWin) == dontClient) return 0; return TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, NullGrab); } for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & filter) { if (SameClient(other, dontClient)) return 0; return TryClientEvents(rClient(other), pEvents, count, other->mask, filter, NullGrab); } } return 2; } static void #if NeedFunctionPrototypes FixUpEventFromWindow( xEvent *xE, WindowPtr pWin, Window child, Bool calcChild) #else FixUpEventFromWindow(xE, pWin, child, calcChild) xEvent *xE; WindowPtr pWin; Window child; Bool calcChild; #endif { if (calcChild) { WindowPtr w=spriteTrace[spriteTraceGood-1]; /* If the search ends up past the root should the child field be set to none or should the value in the argument be passed through. It probably doesn't matter since everyone calls this function with child == None anyway. */ while (w) { /* If the source window is same as event window, child should be none. Don't bother going all all the way back to the root. */ if (w == pWin) { child = None; break; } if (w->parent == pWin) { child = w->drawable.id; break; } w = w->parent; } } xE->u.keyButtonPointer.root = ROOT->drawable.id; xE->u.keyButtonPointer.event = pWin->drawable.id; if (sprite.hot.pScreen == pWin->drawable.pScreen) { xE->u.keyButtonPointer.sameScreen = xTrue; xE->u.keyButtonPointer.child = child; xE->u.keyButtonPointer.eventX = xE->u.keyButtonPointer.rootX - pWin->drawable.x; xE->u.keyButtonPointer.eventY = xE->u.keyButtonPointer.rootY - pWin->drawable.y; } else { xE->u.keyButtonPointer.sameScreen = xFalse; xE->u.keyButtonPointer.child = None; xE->u.keyButtonPointer.eventX = 0; xE->u.keyButtonPointer.eventY = 0; } } int DeliverDeviceEvents(pWin, xE, grab, stopAt, dev, count) register WindowPtr pWin, stopAt; register xEvent *xE; GrabPtr grab; DeviceIntPtr dev; int count; { Window child = None; int type = xE->u.u.type; Mask filter = filters[type]; int deliveries = 0; if (type & EXTENSION_EVENT_BASE) { register OtherInputMasks *inputMasks; int mskidx = dev->id; inputMasks = wOtherInputMasks(pWin); if (inputMasks && !(filter & inputMasks->deliverableEvents[mskidx])) return 0; while (pWin) { if (inputMasks && (inputMasks->inputEvents[mskidx] & filter)) { FixUpEventFromWindow(xE, pWin, child, FALSE); deliveries = DeliverEventsToWindow(pWin, xE, count, filter, grab, mskidx); if (deliveries > 0) return deliveries; } if ((deliveries < 0) || (pWin == stopAt) || (inputMasks && (filter & inputMasks->dontPropagateMask[mskidx]))) return 0; child = pWin->drawable.id; pWin = pWin->parent; if (pWin) inputMasks = wOtherInputMasks(pWin); } } else { if (!(filter & pWin->deliverableEvents)) return 0; while (pWin) { if ((wOtherEventMasks(pWin)|pWin->eventMask) & filter) { FixUpEventFromWindow(xE, pWin, child, FALSE); deliveries = DeliverEventsToWindow(pWin, xE, count, filter, grab, 0); if (deliveries > 0) return deliveries; } if ((deliveries < 0) || (pWin == stopAt) || (filter & wDontPropagateMask(pWin))) return 0; child = pWin->drawable.id; pWin = pWin->parent; } } return 0; } /* not useful for events that propagate up the tree or extension events */ int DeliverEvents(pWin, xE, count, otherParent) register WindowPtr pWin, otherParent; register xEvent *xE; int count; { Mask filter; int deliveries; if (!count) return 0; filter = filters[xE->u.u.type]; if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify)) xE->u.destroyNotify.event = pWin->drawable.id; if (filter != StructureAndSubMask) return DeliverEventsToWindow(pWin, xE, count, filter, NullGrab, 0); deliveries = DeliverEventsToWindow(pWin, xE, count, StructureNotifyMask, NullGrab, 0); if (pWin->parent) { xE->u.destroyNotify.event = pWin->parent->drawable.id; deliveries += DeliverEventsToWindow(pWin->parent, xE, count, SubstructureNotifyMask, NullGrab, 0); if (xE->u.u.type == ReparentNotify) { xE->u.destroyNotify.event = otherParent->drawable.id; deliveries += DeliverEventsToWindow(otherParent, xE, count, SubstructureNotifyMask, NullGrab, 0); } } return deliveries; } static WindowPtr #if NeedFunctionPrototypes XYToWindow(int x, int y) #else XYToWindow(x, y) int x, y; #endif { register WindowPtr pWin; #ifdef SHAPE BoxRec box; #endif spriteTraceGood = 1; /* root window still there */ pWin = ROOT->firstChild; while (pWin) { if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && (x < pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth(pWin)) && (y >= pWin->drawable.y - wBorderWidth (pWin)) && (y < pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin)) #ifdef SHAPE /* When a window is shaped, a further check * is made to see if the point is inside * borderSize */ && (!wBoundingShape(pWin) || POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box)) #endif ) { if (spriteTraceGood >= spriteTraceSize) { spriteTraceSize += 10; Must_have_memory = TRUE; /* XXX */ spriteTrace = (WindowPtr *)xrealloc( spriteTrace, spriteTraceSize*sizeof(WindowPtr)); Must_have_memory = FALSE; /* XXX */ } spriteTrace[spriteTraceGood++] = pWin; pWin = pWin->firstChild; } else pWin = pWin->nextSib; } return spriteTrace[spriteTraceGood-1]; } static Bool #if NeedFunctionPrototypes CheckMotion(xEvent *xE) #else CheckMotion(xE) xEvent *xE; #endif { WindowPtr prevSpriteWin = sprite.win; if (xE && !syncEvents.playingEvents) { if (sprite.hot.pScreen != sprite.hotPhys.pScreen) { sprite.hot.pScreen = sprite.hotPhys.pScreen; ROOT = WindowTable[sprite.hot.pScreen->myNum]; } sprite.hot.x = xE->u.keyButtonPointer.rootX; sprite.hot.y = xE->u.keyButtonPointer.rootY; if (sprite.hot.x < sprite.physLimits.x1) sprite.hot.x = sprite.physLimits.x1; else if (sprite.hot.x >= sprite.physLimits.x2) sprite.hot.x = sprite.physLimits.x2 - 1; if (sprite.hot.y < sprite.physLimits.y1) sprite.hot.y = sprite.physLimits.y1; else if (sprite.hot.y >= sprite.physLimits.y2) sprite.hot.y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); #endif sprite.hotPhys = sprite.hot; if ((sprite.hotPhys.x != xE->u.keyButtonPointer.rootX) || (sprite.hotPhys.y != xE->u.keyButtonPointer.rootY)) (*sprite.hotPhys.pScreen->SetCursorPosition)( sprite.hotPhys.pScreen, sprite.hotPhys.x, sprite.hotPhys.y, FALSE); xE->u.keyButtonPointer.rootX = sprite.hot.x; xE->u.keyButtonPointer.rootY = sprite.hot.y; } sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); #ifdef notyet if (!(sprite.win->deliverableEvents & Motion_Filter(inputInfo.pointer->button)) !syncEvents.playingEvents) { /* XXX Do PointerNonInterestBox here */ } #endif if (sprite.win != prevSpriteWin) { if (prevSpriteWin != NullWindow) { if (!xE) UpdateCurrentTimeIf(); DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); } PostNewCursor(); return FALSE; } return TRUE; } void WindowsRestructured() { (void) CheckMotion((xEvent *)NULL); } void DefineInitialRootWindow(win) register WindowPtr win; { register ScreenPtr pScreen = win->drawable.pScreen; sprite.hotPhys.pScreen = pScreen; sprite.hotPhys.x = pScreen->width / 2; sprite.hotPhys.y = pScreen->height / 2; sprite.hot = sprite.hotPhys; sprite.hotLimits.x2 = pScreen->width; sprite.hotLimits.y2 = pScreen->height; sprite.win = win; sprite.current = wCursor (win); spriteTraceGood = 1; ROOT = win; (*pScreen->CursorLimits) ( pScreen, sprite.current, &sprite.hotLimits, &sprite.physLimits); sprite.confined = FALSE; (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits); (*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE); (*pScreen->DisplayCursor) (pScreen, sprite.current); } /* * This does not take any shortcuts, and even ignores its argument, since * it does not happen very often, and one has to walk up the tree since * this might be a newly instantiated cursor for an intermediate window * between the one the pointer is in and the one that the last cursor was * instantiated from. */ /*ARGSUSED*/ void WindowHasNewCursor(pWin) WindowPtr pWin; { PostNewCursor(); } void NewCurrentScreen(newScreen, x, y) ScreenPtr newScreen; int x,y; { sprite.hotPhys.x = x; sprite.hotPhys.y = y; if (newScreen != sprite.hotPhys.pScreen) ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); } int ProcWarpPointer(client) ClientPtr client; { WindowPtr dest = NULL; int x, y; ScreenPtr newScreen; REQUEST(xWarpPointerReq); REQUEST_SIZE_MATCH(xWarpPointerReq); if (stuff->dstWid != None) { dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess); if (!dest) return BadWindow; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; if (stuff->srcWid != None) { int winX, winY; WindowPtr source = SecurityLookupWindow(stuff->srcWid, client, SecurityReadAccess); if (!source) return BadWindow; winX = source->drawable.x; winY = source->drawable.y; if (source->drawable.pScreen != sprite.hotPhys.pScreen || x < winX + stuff->srcX || y < winY + stuff->srcY || (stuff->srcWidth != 0 && winX + stuff->srcX + (int)stuff->srcWidth < x) || (stuff->srcHeight != 0 && winY + stuff->srcY + (int)stuff->srcHeight < y) || !PointInWindowIsVisible(source, x, y)) return Success; } if (dest) { x = dest->drawable.x; y = dest->drawable.y; newScreen = dest->drawable.pScreen; } else newScreen = sprite.hotPhys.pScreen; x += stuff->dstX; y += stuff->dstY; if (x < 0) x = 0; else if (x >= newScreen->width) x = newScreen->width - 1; if (y < 0) y = 0; else if (y >= newScreen->height) y = newScreen->height - 1; if (newScreen == sprite.hotPhys.pScreen) { if (x < sprite.physLimits.x1) x = sprite.physLimits.x1; else if (x >= sprite.physLimits.x2) x = sprite.physLimits.x2 - 1; if (y < sprite.physLimits.y1) y = sprite.physLimits.y1; else if (y >= sprite.physLimits.y2) y = sprite.physLimits.y2 - 1; #ifdef SHAPE if (sprite.hotShape) ConfineToShape(sprite.hotShape, &x, &y); #endif (*newScreen->SetCursorPosition)(newScreen, x, y, TRUE); } else if (!PointerConfinedToScreen()) { NewCurrentScreen(newScreen, x, y); } return Success; } /* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a passive grab set on the window to be activated. */ static Bool #if NeedFunctionPrototypes CheckPassiveGrabsOnWindow( WindowPtr pWin, register DeviceIntPtr device, register xEvent *xE, int count) #else CheckPassiveGrabsOnWindow(pWin, device, xE, count) WindowPtr pWin; register DeviceIntPtr device; register xEvent *xE; int count; #endif { register GrabPtr grab = wPassiveGrabs(pWin); GrabRec tempGrab; register xEvent *dxE; if (!grab) return FALSE; tempGrab.window = pWin; tempGrab.device = device; tempGrab.type = xE->u.u.type; tempGrab.detail.exact = xE->u.u.detail; tempGrab.detail.pMask = NULL; tempGrab.modifiersDetail.pMask = NULL; for (; grab; grab = grab->next) { #ifdef XKB DeviceIntPtr gdev; XkbSrvInfoPtr xkbi; gdev= grab->modifierDevice; xkbi= gdev->key->xkbInfo; #endif tempGrab.modifierDevice = grab->modifierDevice; if (device == grab->modifierDevice && (xE->u.u.type == KeyPress #ifdef XINPUT || xE->u.u.type == DeviceKeyPress #endif )) tempGrab.modifiersDetail.exact = #ifdef XKB (noXkbExtension?gdev->key->prev_state:xkbi->state.grab_mods); #else grab->modifierDevice->key->prev_state; #endif else tempGrab.modifiersDetail.exact = #ifdef XKB (noXkbExtension ? gdev->key->state : xkbi->state.grab_mods); #else grab->modifierDevice->key->state; #endif if (GrabMatchesSecond(&tempGrab, grab) && (!grab->confineTo || (grab->confineTo->realized && REGION_NOTEMPTY( grab->confineTo->drawable.pScreen, &grab->confineTo->borderSize)))) { #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE)) return FALSE; #endif #ifdef XKB if (!noXkbExtension) { xE->u.keyButtonPointer.state &= 0x1f00; xE->u.keyButtonPointer.state |= tempGrab.modifiersDetail.exact&(~0x1f00); } #endif (*device->ActivateGrab)(device, grab, currentTime, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE); (void) TryClientEvents(rClient(grab), xE, count, filters[xE->u.u.type], filters[xE->u.u.type], grab); if (device->sync.state == FROZEN_NO_EVENT) { if (device->sync.evcount < count) { Must_have_memory = TRUE; /* XXX */ device->sync.event = (xEvent *)xrealloc(device->sync.event, count* sizeof(xEvent)); Must_have_memory = FALSE; /* XXX */ } device->sync.evcount = count; for (dxE = device->sync.event; --count >= 0; dxE++, xE++) *dxE = *xE; device->sync.state = FROZEN_WITH_EVENT; } return TRUE; } } return FALSE; } /* "CheckDeviceGrabs" handles both keyboard and pointer events that may cause a passive grab to be activated. If the event is a keyboard event, the ancestors of the focus window are traced down and tried to see if they have any passive grabs to be activated. If the focus window itself is reached and it's descendants contain they pointer, the ancestors of the window that the pointer is in are then traced down starting at the focus window, otherwise no grabs are activated. If the event is a pointer event, the ancestors of the window that the pointer is in are traced down starting at the root until CheckPassiveGrabs causes a passive grab to activate or all the windows are tried. PRH */ Bool CheckDeviceGrabs(device, xE, checkFirst, count) register DeviceIntPtr device; register xEvent *xE; int checkFirst; int count; { register int i; register WindowPtr pWin; register FocusClassPtr focus = device->focus; if ((xE->u.u.type == ButtonPress #ifdef XINPUT || xE->u.u.type == DeviceButtonPress #endif ) && device->button->buttonsDown != 1) return FALSE; i = checkFirst; if (focus) { for (; i < focus->traceGood; i++) { pWin = focus->trace[i]; if (pWin->optional && CheckPassiveGrabsOnWindow(pWin, device, xE, count)) return TRUE; } if ((focus->win == NoneWin) || (i >= spriteTraceGood) || ((i > checkFirst) && (pWin != spriteTrace[i-1]))) return FALSE; } for (; i < spriteTraceGood; i++) { pWin = spriteTrace[i]; if (pWin->optional && CheckPassiveGrabsOnWindow(pWin, device, xE, count)) return TRUE; } return FALSE; } void DeliverFocusedEvent(keybd, xE, window, count) xEvent *xE; DeviceIntPtr keybd; WindowPtr window; int count; { WindowPtr focus = keybd->focus->win; int mskidx = 0; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; if (!focus) return; if (focus == PointerRootWin) { DeliverDeviceEvents(window, xE, NullGrab, NullWindow, keybd, count); return; } if ((focus == window) || IsParent(focus, window)) { if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count)) return; } /* just deliver it to the focus window */ FixUpEventFromWindow(xE, focus, None, FALSE); if (xE->u.u.type & EXTENSION_EVENT_BASE) mskidx = keybd->id; (void)DeliverEventsToWindow(focus, xE, count, filters[xE->u.u.type], NullGrab, mskidx); } void DeliverGrabbedEvent(xE, thisDev, deactivateGrab, count) register xEvent *xE; register DeviceIntPtr thisDev; Bool deactivateGrab; int count; { register GrabPtr grab = thisDev->grab; int deliveries = 0; register DeviceIntPtr dev; register xEvent *dxE; if (grab->ownerEvents) { WindowPtr focus; if (thisDev->focus) { focus = thisDev->focus->win; if (focus == FollowKeyboardWin) focus = inputInfo.keyboard->focus->win; } else focus = PointerRootWin; if (focus == PointerRootWin) deliveries = DeliverDeviceEvents(sprite.win, xE, grab, NullWindow, thisDev, count); else if (focus && (focus == sprite.win || IsParent(focus, sprite.win))) deliveries = DeliverDeviceEvents(sprite.win, xE, grab, focus, thisDev, count); else if (focus) deliveries = DeliverDeviceEvents(focus, xE, grab, focus, thisDev, count); } if (!deliveries) { FixUpEventFromWindow(xE, grab->window, None, TRUE); deliveries = TryClientEvents(rClient(grab), xE, count, (Mask)grab->eventMask, filters[xE->u.u.type], grab); if (deliveries && (xE->u.u.type == MotionNotify #ifdef XINPUT || xE->u.u.type == DeviceMotionNotify #endif )) thisDev->valuator->motionHintWindow = grab->window; } if (deliveries && !deactivateGrab && (xE->u.u.type != MotionNotify #ifdef XINPUT && xE->u.u.type != DeviceMotionNotify #endif )) switch (thisDev->sync.state) { case FREEZE_BOTH_NEXT_EVENT: for (dev = inputInfo.devices; dev; dev = dev->next) { if (dev == thisDev) continue; FreezeThaw(dev, TRUE); if ((dev->sync.state == FREEZE_BOTH_NEXT_EVENT) && (CLIENT_BITS(dev->grab->resource) == CLIENT_BITS(thisDev->grab->resource))) dev->sync.state = FROZEN_NO_EVENT; else dev->sync.other = thisDev->grab; } /* fall through */ case FREEZE_NEXT_EVENT: thisDev->sync.state = FROZEN_WITH_EVENT; FreezeThaw(thisDev, TRUE); if (thisDev->sync.evcount < count) { Must_have_memory = TRUE; /* XXX */ thisDev->sync.event = (xEvent *)xrealloc(thisDev->sync.event, count*sizeof(xEvent)); Must_have_memory = FALSE; /* XXX */ } thisDev->sync.evcount = count; for (dxE = thisDev->sync.event; --count >= 0; dxE++, xE++) *dxE = *xE; break; } } void #ifdef XKB CoreProcessKeyboardEvent (xE, keybd, count) #else ProcessKeyboardEvent (xE, keybd, count) #endif register xEvent *xE; register DeviceIntPtr keybd; int count; { int key, bit; register BYTE *kptr; register int i; register CARD8 modifiers; register CARD16 mask; GrabPtr grab = keybd->grab; Bool deactivateGrab = FALSE; register KeyClassPtr keyc = keybd->key; if (!syncEvents.playingEvents) { NoticeTime(xE); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo); } } xE->u.keyButtonPointer.state = (keyc->state | inputInfo.pointer->button->state); xE->u.keyButtonPointer.rootX = sprite.hot.x; xE->u.keyButtonPointer.rootY = sprite.hot.y; key = xE->u.u.detail; kptr = &keyc->down[key >> 3]; bit = 1 << (key & 7); modifiers = keyc->modifierMap[key]; #ifdef DEBUG if ((xkbDebugFlags&0x4)&& ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { ErrorF("CoreProcessKbdEvent: Key %d %s\n",key, (xE->u.u.type==KeyPress?"down":"up")); } #endif switch (xE->u.u.type) { case KeyPress: if (*kptr & bit) /* allow ddx to generate multiple downs */ { if (!modifiers) { xE->u.u.type = KeyRelease; (*keybd->public.processInputProc)(xE, keybd, count); xE->u.u.type = KeyPress; /* release can have side effects, don't fall through */ (*keybd->public.processInputProc)(xE, keybd, count); } return; } inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr |= bit; keyc->prev_state = keyc->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ keyc->modifierKeyCount[i]++; keyc->state |= mask; modifiers &= ~mask; } } if (!grab && CheckDeviceGrabs(keybd, xE, 0, count)) { keybd->activatingKey = key; return; } break; case KeyRelease: if (!(*kptr & bit)) /* guard against duplicates */ return; inputInfo.pointer->valuator->motionHintWindow = NullWindow; *kptr &= ~bit; keyc->prev_state = keyc->state; for (i = 0, mask = 1; modifiers; i++, mask <<= 1) { if (mask & modifiers) { /* This key affects modifier "i" */ if (--keyc->modifierKeyCount[i] <= 0) { keyc->state &= ~mask; keyc->modifierKeyCount[i] = 0; } modifiers &= ~mask; } } if (keybd->fromPassiveGrab && (key == keybd->activatingKey)) deactivateGrab = TRUE; break; default: FatalError("Impossible keyboard event"); } if (grab) DeliverGrabbedEvent(xE, keybd, deactivateGrab, count); else DeliverFocusedEvent(keybd, xE, sprite.win, count); if (deactivateGrab) (*keybd->DeactivateGrab)(keybd); } void #ifdef XKB CoreProcessPointerEvent (xE, mouse, count) #else ProcessPointerEvent (xE, mouse, count) #endif register xEvent *xE; register DeviceIntPtr mouse; int count; { register GrabPtr grab = mouse->grab; Bool deactivateGrab = FALSE; register ButtonClassPtr butc = mouse->button; #ifdef XKB XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo; #endif if (!syncEvents.playingEvents) NoticeTime(xE) xE->u.keyButtonPointer.state = (butc->state | ( #ifdef XKB (noXkbExtension ? inputInfo.keyboard->key->state : xkbi->state.grab_mods) #else inputInfo.keyboard->key->state #endif )); { NoticeTime(xE); if (DeviceEventCallback) { DeviceEventInfoRec eventinfo; /* see comment in EnqueueEvents regarding the next three lines */ if (xE->u.u.type == MotionNotify) xE->u.keyButtonPointer.root = WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; eventinfo.events = xE; eventinfo.count = count; CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo); } } if (xE->u.u.type != MotionNotify) { register int key; register BYTE *kptr; int bit; xE->u.keyButtonPointer.rootX = sprite.hot.x; xE->u.keyButtonPointer.rootY = sprite.hot.y; key = xE->u.u.detail; kptr = &butc->down[key >> 3]; bit = 1 << (key & 7); switch (xE->u.u.type) { case ButtonPress: mouse->valuator->motionHintWindow = NullWindow; butc->buttonsDown++; butc->motionMask = ButtonMotionMask; *kptr |= bit; xE->u.u.detail = butc->map[key]; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) butc->state |= (Button1Mask >> 1) << xE->u.u.detail; filters[MotionNotify] = Motion_Filter(butc); if (!grab) if (CheckDeviceGrabs(mouse, xE, 0, count)) return; break; case ButtonRelease: mouse->valuator->motionHintWindow = NullWindow; if (!--butc->buttonsDown) butc->motionMask = 0; *kptr &= ~bit; xE->u.u.detail = butc->map[key]; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) butc->state &= ~((Button1Mask >> 1) << xE->u.u.detail); filters[MotionNotify] = Motion_Filter(butc); if (!butc->state && mouse->fromPassiveGrab) deactivateGrab = TRUE; break; default: FatalError("bogus pointer event from ddx"); } } else if (!CheckMotion(xE)) return; if (grab) DeliverGrabbedEvent(xE, mouse, deactivateGrab, count); else DeliverDeviceEvents(sprite.win, xE, NullGrab, NullWindow, mouse, count); if (deactivateGrab) (*mouse->DeactivateGrab)(mouse); } #define AtMostOneClient \ (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) void RecalculateDeliverableEvents(pWin) register WindowPtr pWin; { register OtherClients *others; register WindowPtr pChild; pChild = pWin; while (1) { if (pChild->optional) { pChild->optional->otherEventMasks = 0; for (others = wOtherClients(pChild); others; others = others->next) { pChild->optional->otherEventMasks |= others->mask; } } pChild->deliverableEvents = pChild->eventMask| wOtherEventMasks(pChild); if (pChild->parent) pChild->deliverableEvents |= (pChild->parent->deliverableEvents & ~wDontPropagateMask(pChild) & PropagateMask); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } int OtherClientGone(value, id) pointer value; /* must conform to DeleteType */ XID id; { register OtherClientsPtr other, prev; register WindowPtr pWin = (WindowPtr)value; prev = 0; for (other = wOtherClients(pWin); other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else { if (!(pWin->optional->otherClients = other->next)) CheckWindowOptionalNeed (pWin); } xfree(other); RecalculateDeliverableEvents(pWin); return(Success); } prev = other; } FatalError("client not on event list"); /*NOTREACHED*/ return -1; /* make compiler happy */ } int EventSelectForWindow(pWin, client, mask) register WindowPtr pWin; register ClientPtr client; Mask mask; { Mask check; OtherClients * others; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } check = (mask & AtMostOneClient); if (check & (pWin->eventMask|wOtherEventMasks(pWin))) { /* It is illegal for two different clients to select on any of the events for AtMostOneClient. However, it is OK, for some client to continue selecting on one of those events. */ if ((wClient(pWin) != client) && (check & pWin->eventMask)) return BadAccess; for (others = wOtherClients (pWin); others; others = others->next) { if (!SameClient(others, client) && (check & others->mask)) return BadAccess; } } if (wClient (pWin) == client) { check = pWin->eventMask; #if SGIMISC pWin->eventMask = (mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask); #else pWin->eventMask = mask; #endif } else { for (others = wOtherClients (pWin); others; others = others->next) { if (SameClient(others, client)) { check = others->mask; #if SGIMISC mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask); #endif if (mask == 0) { FreeResource(others->resource, RT_NONE); return Success; } else others->mask = mask; goto maskSet; } } check = 0; if (!pWin->optional && !MakeWindowOptional (pWin)) return BadAlloc; others = (OtherClients *) xalloc(sizeof(OtherClients)); if (!others) return BadAlloc; others->mask = mask; others->resource = FakeClientID(client->index); others->next = pWin->optional->otherClients; pWin->optional->otherClients = others; if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin)) return BadAlloc; } maskSet: if ((inputInfo.pointer->valuator->motionHintWindow == pWin) && (mask & PointerMotionHintMask) && !(check & PointerMotionHintMask) && !inputInfo.pointer->grab) inputInfo.pointer->valuator->motionHintWindow = NullWindow; RecalculateDeliverableEvents(pWin); return Success; } /*ARGSUSED*/ int EventSuppressForWindow(pWin, client, mask, checkOptional) register WindowPtr pWin; register ClientPtr client; Mask mask; Bool *checkOptional; { register int i, free; if ((mask & ~PropagateMask) && !permitOldBugs) { client->errorValue = mask; return BadValue; } if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; if (!mask) i = 0; else { for (i = DNPMCOUNT, free = 0; --i > 0; ) { if (!DontPropagateRefCnts[i]) free = i; else if (mask == DontPropagateMasks[i]) break; } if (!i && free) { i = free; DontPropagateMasks[i] = mask; } } if (i || !mask) { pWin->dontPropagate = i; if (i) DontPropagateRefCnts[i]++; if (pWin->optional) { pWin->optional->dontPropagateMask = mask; *checkOptional = TRUE; } } else { if (!pWin->optional && !MakeWindowOptional (pWin)) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]++; return BadAlloc; } pWin->dontPropagate = 0; pWin->optional->dontPropagateMask = mask; } RecalculateDeliverableEvents(pWin); return Success; } static WindowPtr #if NeedFunctionPrototypes CommonAncestor( register WindowPtr a, register WindowPtr b) #else CommonAncestor(a, b) register WindowPtr a, b; #endif { for (b = b->parent; b; b = b->parent) if (IsParent(b, a)) return b; return NullWindow; } static void #if NeedFunctionPrototypes EnterLeaveEvent( int type, int mode, int detail, register WindowPtr pWin, Window child) #else EnterLeaveEvent(type, mode, detail, pWin, child) int type, mode, detail; register WindowPtr pWin; Window child; #endif { xEvent event; register DeviceIntPtr keybd = inputInfo.keyboard; WindowPtr focus; register DeviceIntPtr mouse = inputInfo.pointer; register GrabPtr grab = mouse->grab; Mask mask; if ((pWin == mouse->valuator->motionHintWindow) && (detail != NotifyInferior)) mouse->valuator->motionHintWindow = NullWindow; if (grab) { mask = (pWin == grab->window) ? grab->eventMask : 0; if (grab->ownerEvents) mask |= EventMaskForClient(pWin, rClient(grab)); } else { mask = pWin->eventMask | wOtherEventMasks(pWin); } if (mask & filters[type]) { event.u.u.type = type; event.u.u.detail = detail; event.u.enterLeave.time = currentTime.milliseconds; event.u.enterLeave.rootX = sprite.hot.x; event.u.enterLeave.rootY = sprite.hot.y; /* Counts on the same initial structure of crossing & button events! */ FixUpEventFromWindow(&event, pWin, None, FALSE); /* Enter/Leave events always set child */ event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? ELFlagSameScreen : 0; #ifdef XKB if (!noXkbExtension) { event.u.enterLeave.state = mouse->button->state & 0x1f00; event.u.enterLeave.state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state); } else #endif event.u.enterLeave.state = keybd->key->state | mouse->button->state; event.u.enterLeave.mode = mode; focus = keybd->focus->win; if ((focus != NoneWin) && ((pWin == focus) || (focus == PointerRootWin) || IsParent(focus, pWin))) event.u.enterLeave.flags |= ELFlagFocus; if (grab) (void)TryClientEvents(rClient(grab), &event, 1, mask, filters[type], grab); else (void)DeliverEventsToWindow(pWin, &event, 1, filters[type], NullGrab, 0); } if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke; #ifdef XCSECURITY ClientPtr client = grab ? rClient(grab) : clients[CLIENT_ID(pWin->drawable.id)]; if (!SecurityCheckDeviceAccess(client, keybd, FALSE)) { bzero((char *)&ke.map[0], 31); } else #endif memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); ke.type = KeymapNotify; if (grab) (void)TryClientEvents(rClient(grab), (xEvent *)&ke, 1, mask, KeymapStateMask, grab); else (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, KeymapStateMask, NullGrab, 0); } } static void #if NeedFunctionPrototypes EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail) #else EnterNotifies(ancestor, child, mode, detail) WindowPtr ancestor, child; int mode, detail; #endif { WindowPtr parent = child->parent; if (ancestor == parent) return; EnterNotifies(ancestor, parent, mode, detail); EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id); } static void #if NeedFunctionPrototypes LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail) #else LeaveNotifies(child, ancestor, mode, detail) WindowPtr child, ancestor; int detail, mode; #endif { register WindowPtr pWin; if (ancestor == child) return; for (pWin = child->parent; pWin != ancestor; pWin = pWin->parent) { EnterLeaveEvent(LeaveNotify, mode, detail, pWin, child->drawable.id); child = pWin; } } static void #if NeedFunctionPrototypes DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode) #else DoEnterLeaveEvents(fromWin, toWin, mode) WindowPtr fromWin, toWin; int mode; #endif { if (fromWin == toWin) return; if (IsParent(fromWin, toWin)) { EnterLeaveEvent(LeaveNotify, mode, NotifyInferior, fromWin, None); EnterNotifies(fromWin, toWin, mode, NotifyVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyAncestor, toWin, None); } else if (IsParent(toWin, fromWin)) { EnterLeaveEvent(LeaveNotify, mode, NotifyAncestor, fromWin, None); LeaveNotifies(fromWin, toWin, mode, NotifyVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyInferior, toWin, None); } else { /* neither fromWin nor toWin is descendent of the other */ WindowPtr common = CommonAncestor(toWin, fromWin); /* common == NullWindow ==> different screens */ EnterLeaveEvent(LeaveNotify, mode, NotifyNonlinear, fromWin, None); LeaveNotifies(fromWin, common, mode, NotifyNonlinearVirtual); EnterNotifies(common, toWin, mode, NotifyNonlinearVirtual); EnterLeaveEvent(EnterNotify, mode, NotifyNonlinear, toWin, None); } } static void #if NeedFunctionPrototypes FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin) #else FocusEvent(dev, type, mode, detail, pWin) DeviceIntPtr dev; int type, mode, detail; register WindowPtr pWin; #endif { xEvent event; #ifdef XINPUT if (dev != inputInfo.keyboard) { DeviceFocusEvent(dev, type, mode, detail, pWin); return; } #endif event.u.focus.mode = mode; event.u.u.type = type; event.u.u.detail = detail; event.u.focus.window = pWin->drawable.id; (void)DeliverEventsToWindow(pWin, &event, 1, filters[type], NullGrab, 0); if ((type == FocusIn) && ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke; #ifdef XCSECURITY ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; if (!SecurityCheckDeviceAccess(client, dev, FALSE)) { bzero((char *)&ke.map[0], 31); } else #endif memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); ke.type = KeymapNotify; (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, KeymapStateMask, NullGrab, 0); } } /* * recursive because it is easier * no-op if child not descended from ancestor */ static Bool #if NeedFunctionPrototypes FocusInEvents( DeviceIntPtr dev, WindowPtr ancestor, WindowPtr child, WindowPtr skipChild, int mode, int detail, Bool doAncestor) #else FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor) DeviceIntPtr dev; WindowPtr ancestor, child, skipChild; int mode, detail; Bool doAncestor; #endif { if (child == NullWindow) return ancestor == NullWindow; if (ancestor == child) { if (doAncestor) FocusEvent(dev, FocusIn, mode, detail, child); return TRUE; } if (FocusInEvents(dev, ancestor, child->parent, skipChild, mode, detail, doAncestor)) { if (child != skipChild) FocusEvent(dev, FocusIn, mode, detail, child); return TRUE; } return FALSE; } /* dies horribly if ancestor is not an ancestor of child */ static void #if NeedFunctionPrototypes FocusOutEvents( DeviceIntPtr dev, WindowPtr child, WindowPtr ancestor, int mode, int detail, Bool doAncestor) #else FocusOutEvents(dev, child, ancestor, mode, detail, doAncestor) DeviceIntPtr dev; WindowPtr child, ancestor; int mode; int detail; Bool doAncestor; #endif { register WindowPtr pWin; for (pWin = child; pWin != ancestor; pWin = pWin->parent) FocusEvent(dev, FocusOut, mode, detail, pWin); if (doAncestor) FocusEvent(dev, FocusOut, mode, detail, ancestor); } void DoFocusEvents(dev, fromWin, toWin, mode) DeviceIntPtr dev; WindowPtr fromWin, toWin; int mode; { int out, in; /* for holding details for to/from PointerRoot/None */ int i; if (fromWin == toWin) return; out = (fromWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot; in = (toWin == NoneWin) ? NotifyDetailNone : NotifyPointerRoot; /* wrong values if neither, but then not referenced */ if ((toWin == NullWindow) || (toWin == PointerRootWin)) { if ((fromWin == NullWindow) || (fromWin == PointerRootWin)) { if (fromWin == PointerRootWin) FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer, TRUE); /* Notify all the roots */ for (i=0; iparent, NullWindow, mode, NotifyNonlinearVirtual, FALSE); } /* Notify all the roots */ for (i=0; iparent != NullWindow) (void)FocusInEvents(dev, ROOT, toWin, toWin, mode, NotifyNonlinearVirtual, TRUE); FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin); if (IsParent(toWin, sprite.win)) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } else { if (IsParent(toWin, fromWin)) { FocusEvent(dev, FocusOut, mode, NotifyAncestor, fromWin); FocusOutEvents(dev, fromWin->parent, toWin, mode, NotifyVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyInferior, toWin); if ((IsParent(toWin, sprite.win)) && (sprite.win != fromWin) && (!IsParent(fromWin, sprite.win)) && (!IsParent(sprite.win, fromWin))) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } else if (IsParent(fromWin, toWin)) { if ((IsParent(fromWin, sprite.win)) && (sprite.win != fromWin) && (!IsParent(toWin, sprite.win)) && (!IsParent(sprite.win, toWin))) FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer, FALSE); FocusEvent(dev, FocusOut, mode, NotifyInferior, fromWin); (void)FocusInEvents(dev, fromWin, toWin, toWin, mode, NotifyVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyAncestor, toWin); } else { /* neither fromWin or toWin is child of other */ WindowPtr common = CommonAncestor(toWin, fromWin); /* common == NullWindow ==> different screens */ if (IsParent(fromWin, sprite.win)) FocusOutEvents(dev, sprite.win, fromWin, mode, NotifyPointer, FALSE); FocusEvent(dev, FocusOut, mode, NotifyNonlinear, fromWin); if (fromWin->parent != NullWindow) FocusOutEvents(dev, fromWin->parent, common, mode, NotifyNonlinearVirtual, FALSE); if (toWin->parent != NullWindow) (void)FocusInEvents(dev, common, toWin, toWin, mode, NotifyNonlinearVirtual, FALSE); FocusEvent(dev, FocusIn, mode, NotifyNonlinear, toWin); if (IsParent(toWin, sprite.win)) (void)FocusInEvents(dev, toWin, sprite.win, NullWindow, mode, NotifyPointer, FALSE); } } } } int #if NeedFunctionPrototypes SetInputFocus( ClientPtr client, DeviceIntPtr dev, Window focusID, CARD8 revertTo, Time ctime, Bool followOK) #else SetInputFocus(client, dev, focusID, revertTo, ctime, followOK) ClientPtr client; DeviceIntPtr dev; Window focusID; CARD8 revertTo; Time ctime; Bool followOK; #endif { register FocusClassPtr focus; register WindowPtr focusWin; int mode; TimeStamp time; UpdateCurrentTime(); if ((revertTo != RevertToParent) && (revertTo != RevertToPointerRoot) && (revertTo != RevertToNone) && ((revertTo != RevertToFollowKeyboard) || !followOK)) { client->errorValue = revertTo; return BadValue; } time = ClientTimeToServerTime(ctime); if ((focusID == None) || (focusID == PointerRoot)) focusWin = (WindowPtr)focusID; else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; else if (!(focusWin = SecurityLookupWindow(focusID, client, SecurityReadAccess))) return BadWindow; else { /* It is a match error to try to set the input focus to an unviewable window. */ if(!focusWin->realized) return(BadMatch); } focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) return Success; mode = (dev->grab) ? NotifyWhileGrabbed : NotifyNormal; if (focus->win == FollowKeyboardWin) DoFocusEvents(dev, inputInfo.keyboard->focus->win, focusWin, mode); else DoFocusEvents(dev, focus->win, focusWin, mode); focus->time = time; focus->revert = revertTo; if (focusID == FollowKeyboard) focus->win = FollowKeyboardWin; else focus->win = focusWin; if ((focusWin == NoneWin) || (focusWin == PointerRootWin)) focus->traceGood = 0; else { int depth = 0; register WindowPtr pWin; for (pWin = focusWin; pWin; pWin = pWin->parent) depth++; if (depth > focus->traceSize) { focus->traceSize = depth+1; Must_have_memory = TRUE; /* XXX */ focus->trace = (WindowPtr *)xrealloc(focus->trace, focus->traceSize * sizeof(WindowPtr)); Must_have_memory = FALSE; /* XXX */ } focus->traceGood = depth; for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) focus->trace[depth] = pWin; } return Success; } int ProcSetInputFocus(client) ClientPtr client; { REQUEST(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) return Success; #endif return SetInputFocus(client, inputInfo.keyboard, stuff->focus, stuff->revertTo, stuff->time, FALSE); } int ProcGetInputFocus(client) ClientPtr client; { xGetInputFocusReply rep; FocusClassPtr focus = inputInfo.keyboard->focus; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; rep.revertTo = focus->revert; WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; } int ProcGrabPointer(client) ClientPtr client; { xGrabPointerReply rep; DeviceIntPtr device = inputInfo.pointer; GrabPtr grab; WindowPtr pWin, confineTo; CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs) { client->errorValue = stuff->eventMask; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) confineTo = NullWindow; else { confineTo = SecurityLookupWindow(stuff->confineTo, client, SecurityReadAccess); if (!confineTo) return BadWindow; } if (stuff->cursor == None) cursor = NullCursor; else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, SecurityReadAccess); if (!cursor) { client->errorValue = stuff->cursor; return BadCursor; } } /* at this point, some sort of reply is guaranteed. */ time = ClientTimeToServerTime(stuff->time); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; grab = device->grab; if ((grab) && !SameClient(grab, client)) rep.status = AlreadyGrabbed; else if ((!pWin->realized) || (confineTo && !(confineTo->realized && REGION_NOTEMPTY( confineTo->drawable.pScreen, &confineTo->borderSize)))) rep.status = GrabNotViewable; else if (device->sync.frozen && device->sync.other && !SameClient(device->sync.other, client)) rep.status = GrabFrozen; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->grabTime) == EARLIER)) rep.status = GrabInvalidTime; else { GrabRec tempGrab; oldCursor = NullCursor; if (grab) { if (grab->confineTo && !confineTo) ConfineCursorToWindow(ROOT, FALSE, FALSE); oldCursor = grab->cursor; } tempGrab.cursor = cursor; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = stuff->ownerEvents; tempGrab.eventMask = stuff->eventMask; tempGrab.confineTo = confineTo; tempGrab.window = pWin; tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.pointerMode = stuff->pointerMode; tempGrab.device = device; (*device->ActivateGrab)(device, &tempGrab, time, FALSE); if (oldCursor) FreeCursor (oldCursor, (Cursor)0); rep.status = GrabSuccess; } WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); return Success; } int ProcChangeActivePointerGrab(client) ClientPtr client; { DeviceIntPtr device = inputInfo.pointer; register GrabPtr grab = device->grab; CursorPtr newCursor, oldCursor; REQUEST(xChangeActivePointerGrabReq); TimeStamp time; REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->cursor == None) newCursor = NullCursor; else { newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, SecurityReadAccess); if (!newCursor) { client->errorValue = stuff->cursor; return BadCursor; } } if (!grab) return Success; if (!SameClient(grab, client)) return Success; time = ClientTimeToServerTime(stuff->time); if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, device->grabTime) == EARLIER)) return Success; oldCursor = grab->cursor; grab->cursor = newCursor; if (newCursor) newCursor->refcnt++; PostNewCursor(); if (oldCursor) FreeCursor(oldCursor, (Cursor)0); grab->eventMask = stuff->eventMask; return Success; } int ProcUngrabPointer(client) ClientPtr client; { DeviceIntPtr device = inputInfo.pointer; GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->DeactivateGrab)(device); return Success; } int GrabDevice(client, dev, this_mode, other_mode, grabWindow, ownerEvents, ctime, mask, status) register ClientPtr client; register DeviceIntPtr dev; unsigned this_mode; unsigned other_mode; Window grabWindow; unsigned ownerEvents; Time ctime; Mask mask; CARD8 *status; { register WindowPtr pWin; register GrabPtr grab; TimeStamp time; UpdateCurrentTime(); if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) { client->errorValue = this_mode; return BadValue; } if ((other_mode != GrabModeSync) && (other_mode != GrabModeAsync)) { client->errorValue = other_mode; return BadValue; } if ((ownerEvents != xFalse) && (ownerEvents != xTrue)) { client->errorValue = ownerEvents; return BadValue; } pWin = SecurityLookupWindow(grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) *status = AlreadyGrabbed; else if (!pWin->realized) *status = GrabNotViewable; else if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, dev->grabTime) == EARLIER)) *status = GrabInvalidTime; else if (dev->sync.frozen && dev->sync.other && !SameClient(dev->sync.other, client)) *status = GrabFrozen; else { GrabRec tempGrab; tempGrab.window = pWin; tempGrab.resource = client->clientAsMask; tempGrab.ownerEvents = ownerEvents; tempGrab.keyboardMode = this_mode; tempGrab.pointerMode = other_mode; tempGrab.eventMask = mask; tempGrab.device = dev; (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); *status = GrabSuccess; } return Success; } int ProcGrabKeyboard(client) ClientPtr client; { xGrabKeyboardReply rep; REQUEST(xGrabKeyboardReq); int result; REQUEST_SIZE_MATCH(xGrabKeyboardReq); #ifdef XCSECURITY if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) { result = Success; rep.status = AlreadyGrabbed; } else #endif result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode, stuff->pointerMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, KeyPressMask | KeyReleaseMask, &rep.status); if (result != Success) return result; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); return Success; } int ProcUngrabKeyboard(client) ClientPtr client; { DeviceIntPtr device = inputInfo.keyboard; GrabPtr grab; TimeStamp time; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); UpdateCurrentTime(); grab = device->grab; time = ClientTimeToServerTime(stuff->id); if ((CompareTimeStamps(time, currentTime) != LATER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) && (grab) && SameClient(grab, client)) (*device->DeactivateGrab)(device); return Success; } int ProcQueryPointer(client) ClientPtr client; { xQueryPointerReply rep; WindowPtr pWin, t; REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; REQUEST_SIZE_MATCH(xResourceReq); pWin = SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return BadWindow; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.mask = mouse->button->state | inputInfo.keyboard->key->state; rep.length = 0; rep.root = (ROOT)->drawable.id; rep.rootX = sprite.hot.x; rep.rootY = sprite.hot.y; rep.child = None; if (sprite.hot.pScreen == pWin->drawable.pScreen) { rep.sameScreen = xTrue; rep.winX = sprite.hot.x - pWin->drawable.x; rep.winY = sprite.hot.y - pWin->drawable.y; for (t = sprite.win; t; t = t->parent) if (t->parent == pWin) { rep.child = t->drawable.id; break; } } else { rep.sameScreen = xFalse; rep.winX = 0; rep.winY = 0; } WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); return(Success); } void InitEvents() { int i; sprite.hot.pScreen = sprite.hotPhys.pScreen = (ScreenPtr)NULL; inputInfo.numDevices = 0; inputInfo.devices = (DeviceIntPtr)NULL; inputInfo.off_devices = (DeviceIntPtr)NULL; inputInfo.keyboard = (DeviceIntPtr)NULL; inputInfo.pointer = (DeviceIntPtr)NULL; if (spriteTraceSize == 0) { spriteTraceSize = 32; spriteTrace = (WindowPtr *)xalloc(32*sizeof(WindowPtr)); if (!spriteTrace) FatalError("failed to allocate spriteTrace"); } spriteTraceGood = 0; lastEventMask = OwnerGrabButtonMask; filters[MotionNotify] = PointerMotionMask; sprite.win = NullWindow; sprite.current = NullCursor; sprite.hotLimits.x1 = 0; sprite.hotLimits.y1 = 0; sprite.hotLimits.x2 = 0; sprite.hotLimits.y2 = 0; sprite.confined = FALSE; syncEvents.replayDev = (DeviceIntPtr)NULL; syncEvents.replayWin = NullWindow; while (syncEvents.pending) { QdEventPtr next = syncEvents.pending->next; xfree(syncEvents.pending); syncEvents.pending = next; } syncEvents.pendtail = &syncEvents.pending; syncEvents.playingEvents = FALSE; syncEvents.time.months = 0; syncEvents.time.milliseconds = 0; /* hardly matters */ currentTime.months = 0; currentTime.milliseconds = GetTimeInMillis(); lastDeviceEventTime = currentTime; for (i = 0; i < DNPMCOUNT; i++) { DontPropagateMasks[i] = 0; DontPropagateRefCnts[i] = 0; } } int ProcSendEvent(client) ClientPtr client; { WindowPtr pWin; WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ REQUEST(xSendEventReq); REQUEST_SIZE_MATCH(xSendEventReq); /* The client's event type must be a core event type or one defined by an extension. */ if ( ! ((stuff->event.u.u.type > X_Reply && stuff->event.u.u.type < LASTEvent) || (stuff->event.u.u.type >= EXTENSION_EVENT_BASE && stuff->event.u.u.type < (unsigned)lastEvent))) { client->errorValue = stuff->event.u.u.type; return BadValue; } if (stuff->event.u.u.type == ClientMessage && stuff->event.u.u.detail != 8 && stuff->event.u.u.detail != 16 && stuff->event.u.u.detail != 32 && !permitOldBugs) { client->errorValue = stuff->event.u.u.detail; return BadValue; } if ((stuff->eventMask & ~AllEventMasks) && !permitOldBugs) { client->errorValue = stuff->eventMask; return BadValue; } if (stuff->destination == PointerWindow) pWin = sprite.win; else if (stuff->destination == InputFocus) { WindowPtr inputFocus = inputInfo.keyboard->focus->win; if (inputFocus == NoneWin) return Success; /* If the input focus is PointerRootWin, send the event to where the pointer is if possible, then perhaps propogate up to root. */ if (inputFocus == PointerRootWin) inputFocus = ROOT; if (IsParent(inputFocus, sprite.win)) { effectiveFocus = inputFocus; pWin = sprite.win; } else effectiveFocus = pWin = inputFocus; } else pWin = SecurityLookupWindow(stuff->destination, client, SecurityReadAccess); if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) { client->errorValue = stuff->propagate; return BadValue; } stuff->event.u.u.type |= 0x80; if (stuff->propagate) { for (;pWin; pWin = pWin->parent) { if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0)) return Success; if (pWin == effectiveFocus) return Success; stuff->eventMask &= ~wDontPropagateMask(pWin); if (!stuff->eventMask) break; } } else (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0); return Success; } int ProcUngrabKey(client) ClientPtr client; { REQUEST(xUngrabKeyReq); WindowPtr pWin; GrabRec tempGrab; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST_SIZE_MATCH(xUngrabKeyReq); pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } tempGrab.resource = client->clientAsMask; tempGrab.device = keybd; tempGrab.window = pWin; tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.type = KeyPress; tempGrab.detail.exact = stuff->key; tempGrab.detail.pMask = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); return(Success); } int ProcGrabKey(client) ClientPtr client; { WindowPtr pWin; REQUEST(xGrabKeyReq); GrabPtr grab; DeviceIntPtr keybd = inputInfo.keyboard; REQUEST_SIZE_MATCH(xGrabKeyReq); if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) { client->errorValue = stuff->ownerEvents; return(BadValue); } if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) { client->errorValue = stuff->key; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; grab = CreateGrab(client->index, keybd, pWin, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, (Bool)stuff->keyboardMode, (Bool)stuff->pointerMode, keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int ProcGrabButton(client) ClientPtr client; { WindowPtr pWin, confineTo; REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; REQUEST_SIZE_MATCH(xGrabButtonReq); if ((stuff->pointerMode != GrabModeSync) && (stuff->pointerMode != GrabModeAsync)) { client->errorValue = stuff->pointerMode; return BadValue; } if ((stuff->keyboardMode != GrabModeSync) && (stuff->keyboardMode != GrabModeAsync)) { client->errorValue = stuff->keyboardMode; return BadValue; } if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue)) { client->errorValue = stuff->ownerEvents; return BadValue; } if (stuff->eventMask & ~PointerGrabMask) { client->errorValue = stuff->eventMask; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; if (stuff->confineTo == None) confineTo = NullWindow; else { confineTo = SecurityLookupWindow(stuff->confineTo, client, SecurityReadAccess); if (!confineTo) return BadWindow; } if (stuff->cursor == None) cursor = NullCursor; else { cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, SecurityReadAccess); if (!cursor) { client->errorValue = stuff->cursor; return BadCursor; } } grab = CreateGrab(client->index, inputInfo.pointer, pWin, permitOldBugs ? (Mask)(stuff->eventMask | ButtonPressMask | ButtonReleaseMask) : (Mask)stuff->eventMask, (Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode, (Bool)stuff->pointerMode, inputInfo.keyboard, stuff->modifiers, ButtonPress, stuff->button, confineTo, cursor); if (!grab) return BadAlloc; return AddPassiveGrabToList(grab); } int ProcUngrabButton(client) ClientPtr client; { REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabRec tempGrab; REQUEST_SIZE_MATCH(xUngrabButtonReq); if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) { client->errorValue = stuff->modifiers; return BadValue; } pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); if (!pWin) return BadWindow; tempGrab.resource = client->clientAsMask; tempGrab.device = inputInfo.pointer; tempGrab.window = pWin; tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.type = ButtonPress; tempGrab.detail.exact = stuff->button; tempGrab.detail.pMask = NULL; if (!DeletePassiveGrabFromList(&tempGrab)) return(BadAlloc); return(Success); } void DeleteWindowFromAnyEvents(pWin, freeResources) WindowPtr pWin; Bool freeResources; { WindowPtr parent; DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr keybd = inputInfo.keyboard; FocusClassPtr focus = keybd->focus; OtherClientsPtr oc; GrabPtr passive; /* Deactivate any grabs performed on this window, before making any input focus changes. */ if (mouse->grab && ((mouse->grab->window == pWin) || (mouse->grab->confineTo == pWin))) (*mouse->DeactivateGrab)(mouse); /* Deactivating a keyboard grab should cause focus events. */ if (keybd->grab && (keybd->grab->window == pWin)) (*keybd->DeactivateGrab)(keybd); /* If the focus window is a root window (ie. has no parent) then don't delete the focus from it. */ if ((pWin == focus->win) && (pWin->parent != NullWindow)) { int focusEventMode = NotifyNormal; /* If a grab is in progress, then alter the mode of focus events. */ if (keybd->grab) focusEventMode = NotifyWhileGrabbed; switch (focus->revert) { case RevertToNone: DoFocusEvents(keybd, pWin, NoneWin, focusEventMode); focus->win = NoneWin; focus->traceGood = 0; break; case RevertToParent: parent = pWin; do { parent = parent->parent; focus->traceGood--; } while (!parent->realized /* This would be a good protocol change -- windows being reparented during SaveSet processing would cause the focus to revert to the nearest enclosing window which will survive the death of the exiting client, instead of ending up reverting to a dying window and thence to None */ #ifdef NOTDEF || clients[CLIENT_ID(parent->drawable.id)]->clientGone #endif ); DoFocusEvents(keybd, pWin, parent, focusEventMode); focus->win = parent; focus->revert = RevertToNone; break; case RevertToPointerRoot: DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode); focus->win = PointerRootWin; focus->traceGood = 0; break; } } if (mouse->valuator->motionHintWindow == pWin) mouse->valuator->motionHintWindow = NullWindow; if (freeResources) { if (pWin->dontPropagate) DontPropagateRefCnts[pWin->dontPropagate]--; while ( (oc = wOtherClients(pWin)) ) FreeResource(oc->resource, RT_NONE); while ( (passive = wPassiveGrabs(pWin)) ) FreeResource(passive->resource, RT_NONE); } #ifdef XINPUT DeleteWindowFromAnyExtEvents(pWin, freeResources); #endif } /* Call this whenever some window at or below pWin has changed geometry */ /*ARGSUSED*/ void CheckCursorConfinement(pWin) WindowPtr pWin; { GrabPtr grab = inputInfo.pointer->grab; WindowPtr confineTo; if (grab && (confineTo = grab->confineTo)) { if (!REGION_NOTEMPTY( confineTo->drawable.pScreen, &confineTo->borderSize)) (*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer); else if ((pWin == confineTo) || IsParent(pWin, confineTo)) ConfineCursorToWindow(confineTo, TRUE, TRUE); } } Mask EventMaskForClient(pWin, client) WindowPtr pWin; ClientPtr client; { register OtherClientsPtr other; if (wClient (pWin) == client) return pWin->eventMask; for (other = wOtherClients(pWin); other; other = other->next) { if (SameClient(other, client)) return other->mask; } return 0; } int ProcRecolorCursor(client) ClientPtr client; { CursorPtr pCursor; int nscr; ScreenPtr pscr; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, RT_CURSOR, SecurityWriteAccess); if ( !pCursor) { client->errorValue = stuff->cursor; return (BadCursor); } pCursor->foreRed = stuff->foreRed; pCursor->foreGreen = stuff->foreGreen; pCursor->foreBlue = stuff->foreBlue; pCursor->backRed = stuff->backRed; pCursor->backGreen = stuff->backGreen; pCursor->backBlue = stuff->backBlue; for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; ( *pscr->RecolorCursor)(pscr, pCursor, (pCursor == sprite.current) && (pscr == sprite.hotPhys.pScreen)); } return (Success); } void WriteEventsToClient(pClient, count, events) ClientPtr pClient; int count; xEvent *events; { xEvent eventTo, *eventFrom; int i; #ifdef XKB if ((!noXkbExtension)&&(!XkbFilterEvents(pClient, count, events))) return; #endif if (EventCallback) { EventInfoRec eventinfo; eventinfo.client = pClient; eventinfo.events = events; eventinfo.count = count; CallCallbacks(&EventCallback, (pointer)&eventinfo); } if(pClient->swapped) { for(i = 0; i < count; i++) { eventFrom = &events[i]; /* Remember to strip off the leading bit of type in case this event was sent with "SendEvent." */ (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, &eventTo); (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo); } } else { (void)WriteToClient(pClient, count * sizeof(xEvent), (char *) events); } } vnc_unixsrc/Xvnc/programs/Xserver/dix/window.c0100664000076400007640000027205107120677563021161 0ustar constconst/* $XConsortium: window.c /main/210 1996/10/28 07:24:59 kaleb $ */ /* $XFree86: xc/programs/Xserver/dix/window.c,v 3.6 1997/01/18 06:53:16 dawes Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "misc.h" #include "scrnintstr.h" #include "os.h" #include "regionstr.h" #include "validate.h" #include "windowstr.h" #include "input.h" #include "resource.h" #include "colormapst.h" #include "cursorstr.h" #include "dixstruct.h" #include "gcstruct.h" #include "servermd.h" #include "dixevents.h" #ifdef XAPPGROUP #include "extensions/Xagsrv.h" #endif #ifdef XCSECURITY #define _SECURITY_SERVER #include "extensions/security.h" #endif extern Bool permitOldBugs; #if defined(NEED_SCREEN_REGIONS) #define REGION_PTR(pScreen,pWin) \ register ScreenPtr pScreen = pWin->drawable.pScreen; #else #define REGION_PTR(pScreen,pWin) /* nothing */ #endif /****** * Window stuff for server * * CreateRootWindow, CreateWindow, ChangeWindowAttributes, * GetWindowAttributes, DeleteWindow, DestroySubWindows, * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows, * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow, * ******/ static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11}; static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88}; int screenIsSaved = SCREEN_SAVER_OFF; ScreenSaverStuffRec savedScreenInfo[MAXSCREENS]; extern WindowPtr *WindowTable; extern int rand(); static Bool TileScreenSaver( #if NeedFunctionPrototypes int /*i*/, int /*kind*/ #endif ); #define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ CWDontPropagate | CWOverrideRedirect | CWCursor ) #define BOXES_OVERLAP(b1, b2) \ (!( ((b1)->x2 <= (b2)->x1) || \ ( ((b1)->x1 >= (b2)->x2)) || \ ( ((b1)->y2 <= (b2)->y1)) || \ ( ((b1)->y1 >= (b2)->y2)) ) ) #define RedirectSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureRedirectMask) #define SubSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask) #define StrSend(pWin) \ ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask) #define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) int numSaveUndersViewable = 0; int deltaSaveUndersViewable = 0; #ifdef DEBUG /****** * PrintWindowTree * For debugging only ******/ int PrintChildren(p1, indent) WindowPtr p1; int indent; { WindowPtr p2; int i; while (p1) { p2 = p1->firstChild; for (i=0; idrawable.id); miPrintRegion(&p1->clipList); PrintChildren(p2, indent+4); p1 = p1->nextSib; } } PrintWindowTree() { int i; WindowPtr pWin, p1; for (i=0; iclipList); p1 = pWin->firstChild; PrintChildren(p1, 4); } } #endif int TraverseTree(pWin, func, data) register WindowPtr pWin; VisitWindowProcPtr func; pointer data; { register int result; register WindowPtr pChild; if (!(pChild = pWin)) return(WT_NOMATCH); while (1) { result = (* func)(pChild, data); if (result == WT_STOPWALKING) return(WT_STOPWALKING); if ((result == WT_WALKCHILDREN) && pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } return(WT_NOMATCH); } /***** * WalkTree * Walk the window tree, for SCREEN, preforming FUNC(pWin, data) on * each window. If FUNC returns WT_WALKCHILDREN, traverse the children, * if it returns WT_DONTWALKCHILDREN, dont. If it returns WT_STOPWALKING * exit WalkTree. Does depth-first traverse. *****/ int WalkTree(pScreen, func, data) ScreenPtr pScreen; VisitWindowProcPtr func; pointer data; { return(TraverseTree(WindowTable[pScreen->myNum], func, data)); } /* hack for forcing backing store on all windows */ int defaultBackingStore = NotUseful; /* hack to force no backing store */ Bool disableBackingStore = FALSE; /* hack to force no save unders */ Bool disableSaveUnders = FALSE; static void #if NeedFunctionPrototypes SetWindowToDefaults(register WindowPtr pWin) #else SetWindowToDefaults(pWin) register WindowPtr pWin; #endif { pWin->prevSib = NullWindow; pWin->firstChild = NullWindow; pWin->lastChild = NullWindow; pWin->valdata = (ValidatePtr)NULL; pWin->optional = (WindowOptPtr)NULL; pWin->cursorIsNone = TRUE; pWin->backingStore = NotUseful; pWin->DIXsaveUnder = FALSE; pWin->backStorage = (pointer) NULL; pWin->mapped = FALSE; /* off */ pWin->realized = FALSE; /* off */ pWin->viewable = FALSE; pWin->visibility = VisibilityNotViewable; pWin->overrideRedirect = FALSE; pWin->saveUnder = FALSE; pWin->bitGravity = ForgetGravity; pWin->winGravity = NorthWestGravity; pWin->eventMask = 0; pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; #ifdef NEED_DBE_BUF_BITS pWin->srcBuffer = DBE_FRONT_BUFFER; pWin->dstBuffer = DBE_FRONT_BUFFER; #endif } static void #if NeedFunctionPrototypes MakeRootTile(WindowPtr pWin) #else MakeRootTile(pWin) WindowPtr pWin; #endif { ScreenPtr pScreen = pWin->drawable.pScreen; GCPtr pGC; unsigned char back[128]; int len = BitmapBytePad(4); register unsigned char *from, *to; register int i, j; pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, pScreen->rootDepth); pWin->backgroundState = BackgroundPixmap; pGC = GetScratchGC(pScreen->rootDepth, pScreen); if (!pWin->background.pixmap || !pGC) FatalError("cound not create root tile"); { CARD32 attributes[2]; attributes[0] = pScreen->whitePixel; attributes[1] = pScreen->blackPixel; (void)ChangeGC(pGC, GCForeground | GCBackground, attributes); } ValidateGC((DrawablePtr)pWin->background.pixmap, pGC); from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb; to = back; for (i = 4; i > 0; i--, from++) for (j = len; j > 0; j--) *to++ = *from; (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1, 0, 0, 4, 4, 0, XYBitmap, (char *)back); FreeScratchGC(pGC); } WindowPtr AllocateWindow(pScreen) ScreenPtr pScreen; { WindowPtr pWin; register char *ptr; register DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; pWin = (WindowPtr)xalloc(pScreen->totalWindowSize); if (pWin) { ppriv = (DevUnion *)(pWin + 1); pWin->devPrivates = ppriv; sizes = pScreen->WindowPrivateSizes; ptr = (char *)(ppriv + pScreen->WindowPrivateLen); for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (pointer)ptr; ptr += size; } else ppriv->ptr = (pointer)NULL; } } return pWin; } /***** * CreateRootWindow * Makes a window at initialization time for specified screen *****/ Bool CreateRootWindow(pScreen) ScreenPtr pScreen; { WindowPtr pWin; BoxRec box; PixmapFormatRec *format; pWin = AllocateWindow(pScreen); if (!pWin) return FALSE; savedScreenInfo[pScreen->myNum].pWindow = NULL; savedScreenInfo[pScreen->myNum].wid = FakeClientID(0); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; screenIsSaved = SCREEN_SAVER_OFF; WindowTable[pScreen->myNum] = pWin; pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; pWin->drawable.depth = pScreen->rootDepth; for (format = screenInfo.formats; format->depth != pScreen->rootDepth; format++) ; pWin->drawable.bitsPerPixel = format->bitsPerPixel; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; pWin->parent = NullWindow; SetWindowToDefaults(pWin); pWin->optional = (WindowOptRec *) xalloc (sizeof (WindowOptRec)); pWin->optional->dontPropagateMask = 0; pWin->optional->otherEventMasks = 0; pWin->optional->otherClients = NULL; pWin->optional->passiveGrabs = NULL; pWin->optional->userProps = NULL; pWin->optional->backingBitPlanes = ~0L; pWin->optional->backingPixel = 0; #ifdef SHAPE pWin->optional->boundingShape = NULL; pWin->optional->clipShape = NULL; #endif #ifdef XINPUT pWin->optional->inputMasks = NULL; #endif pWin->optional->colormap = pScreen->defColormap; pWin->optional->visual = pScreen->rootVisual; pWin->nextSib = NullWindow; pWin->drawable.id = FakeClientID(0); pWin->origin.x = pWin->origin.y = 0; pWin->drawable.height = pScreen->height; pWin->drawable.width = pScreen->width; pWin->drawable.x = pWin->drawable.y = 0; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; REGION_INIT(pScreen, &pWin->clipList, &box, 1); REGION_INIT(pScreen, &pWin->winSize, &box, 1); REGION_INIT(pScreen, &pWin->borderSize, &box, 1); REGION_INIT(pScreen, &pWin->borderClip, &box, 1); pWin->drawable.class = InputOutput; pWin->optional->visual = pScreen->rootVisual; pWin->backgroundState = BackgroundPixel; pWin->background.pixel = pScreen->whitePixel; pWin->borderIsPixel = TRUE; pWin->border.pixel = pScreen->blackPixel; pWin->borderWidth = 0; if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin)) return FALSE; if (disableBackingStore) pScreen->backingStoreSupport = NotUseful; #ifdef DO_SAVE_UNDERS if ((pScreen->backingStoreSupport != NotUseful) && (pScreen->saveUnderSupport == NotUseful)) { /* * If the screen has backing-store but no save-unders, let the * clients know we can support save-unders using backing-store. */ pScreen->saveUnderSupport = USE_DIX_SAVE_UNDERS; } #endif /* DO_SAVE_UNDERS */ if (disableSaveUnders) pScreen->saveUnderSupport = NotUseful; return TRUE; } void InitRootWindow(pWin) WindowPtr pWin; { ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; if (!(*pScreen->CreateWindow)(pWin)) return; /* XXX */ (*pScreen->PositionWindow)(pWin, 0, 0); pWin->cursorIsNone = FALSE; pWin->optional->cursor = rootCursor; rootCursor->refcnt++; MakeRootTile(pWin); pWin->backingStore = defaultBackingStore; pWin->forcedBS = (defaultBackingStore != NotUseful); /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap|CWBorderPixel|CWCursor|CWBackingStore); MapWindow(pWin, serverClient); } /* Set the region to the intersection of the rectangle and the * window's winSize. The window is typically the parent of the * window from which the region came. */ void ClippedRegionFromBox(pWin, Rgn, x, y, w, h) register WindowPtr pWin; RegionPtr Rgn; register int x, y; int w, h; { REGION_PTR(pScreen, pWin) BoxRec box; box = *(REGION_EXTENTS(pScreen, &pWin->winSize)); /* we do these calculations to avoid overflows */ if (x > box.x1) box.x1 = x; if (y > box.y1) box.y1 = y; x += w; if (x < box.x2) box.x2 = x; y += h; if (y < box.y2) box.y2 = y; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; REGION_RESET(pScreen, Rgn, &box); REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize); } WindowPtr RealChildHead(pWin) register WindowPtr pWin; { if (!pWin->parent && (screenIsSaved == SCREEN_SAVER_ON) && (HasSaverWindow (pWin->drawable.pScreen->myNum))) return (pWin->firstChild); else return (NullWindow); } /***** * CreateWindow * Makes a window in response to client request *****/ WindowPtr CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist, depth, client, visual, error) Window wid; register WindowPtr pParent; int x,y; unsigned int w, h, bw; unsigned int class; register Mask vmask; XID *vlist; int depth; ClientPtr client; VisualID visual; int *error; { register WindowPtr pWin; WindowPtr pHead; register ScreenPtr pScreen; xEvent event; int idepth, ivisual; Bool fOK; DepthPtr pDepth; PixmapFormatRec *format; register WindowOptPtr ancwopt; if (class == CopyFromParent) class = pParent->drawable.class; if ((class != InputOutput) && (class != InputOnly)) { *error = BadValue; client->errorValue = class; return NullWindow; } if ((class != InputOnly) && (pParent->drawable.class == InputOnly)) { *error = BadMatch; return NullWindow; } if ((class == InputOnly) && ((bw != 0) || (depth != 0))) { *error = BadMatch; return NullWindow; } pScreen = pParent->drawable.pScreen; if ((class == InputOutput) && (depth == 0)) depth = pParent->drawable.depth; ancwopt = pParent->optional; if (!ancwopt) ancwopt = FindWindowWithOptional(pParent)->optional; if (visual == CopyFromParent) { #ifdef XAPPGROUP VisualID ag_visual; if (client->appgroup && !pParent->parent && (ag_visual = XagRootVisual (client))) visual = ag_visual; else #endif visual = ancwopt->visual; } /* Find out if the depth and visual are acceptable for this Screen */ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) { fOK = FALSE; for(idepth = 0; idepth < pScreen->numDepths; idepth++) { pDepth = (DepthPtr) &pScreen->allowedDepths[idepth]; if ((depth == pDepth->depth) || (depth == 0)) { for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) { if (visual == pDepth->vids[ivisual]) { fOK = TRUE; break; } } } } if (fOK == FALSE) { *error = BadMatch; return NullWindow; } } if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) && (class != InputOnly) && (depth != pParent->drawable.depth)) { *error = BadMatch; return NullWindow; } if (((vmask & CWColormap) == 0) && (class != InputOnly) && ((visual != ancwopt->visual) || (ancwopt->colormap == None))) { *error = BadMatch; return NullWindow; } pWin = AllocateWindow(pScreen); if (!pWin) { *error = BadAlloc; return NullWindow; } pWin->drawable = pParent->drawable; pWin->drawable.depth = depth; if (depth == pParent->drawable.depth) pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel; else { for (format = screenInfo.formats; format->depth != depth; format++) ; pWin->drawable.bitsPerPixel = format->bitsPerPixel; } if (class == InputOnly) pWin->drawable.type = (short) UNDRAWABLE_WINDOW; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; pWin->drawable.id = wid; pWin->drawable.class = class; pWin->parent = pParent; SetWindowToDefaults(pWin); if (visual != ancwopt->visual) { if (!MakeWindowOptional (pWin)) { xfree (pWin); *error = BadAlloc; return NullWindow; } pWin->optional->visual = visual; pWin->optional->colormap = None; } pWin->borderWidth = bw; #ifdef XCSECURITY /* can't let untrusted clients have background None windows; * they make it too easy to steal window contents */ if (client->trustLevel != XSecurityClientTrusted) { pWin->backgroundState = BackgroundPixel; pWin->background.pixel = 0; } else #endif pWin->backgroundState = None; pWin->borderIsPixel = pParent->borderIsPixel; pWin->border = pParent->border; if (pWin->borderIsPixel == FALSE) pWin->border.pixmap->refcnt++; pWin->origin.x = x + (int)bw; pWin->origin.y = y + (int)bw; pWin->drawable.width = w; pWin->drawable.height = h; pWin->drawable.x = pParent->drawable.x + x + (int)bw; pWin->drawable.y = pParent->drawable.y + y + (int)bw; /* set up clip list correctly for unobscured WindowPtr */ REGION_INIT(pScreen, &pWin->clipList, NullBox, 1); REGION_INIT(pScreen, &pWin->borderClip, NullBox, 1); REGION_INIT(pScreen, &pWin->winSize, NullBox, 1); REGION_INIT(pScreen, &pWin->borderSize, NullBox, 1); pHead = RealChildHead(pParent); if (pHead) { pWin->nextSib = pHead->nextSib; if (pHead->nextSib) pHead->nextSib->prevSib = pWin; else pParent->lastChild = pWin; pHead->nextSib = pWin; pWin->prevSib = pHead; } else { pWin->nextSib = pParent->firstChild; if (pParent->firstChild) pParent->firstChild->prevSib = pWin; else pParent->lastChild = pWin; pParent->firstChild = pWin; } SetWinSize (pWin); SetBorderSize (pWin); /* We SHOULD check for an error value here XXX */ if (!(*pScreen->CreateWindow)(pWin)) { *error = BadAlloc; DeleteWindow(pWin, None); return NullWindow; } /* We SHOULD check for an error value here XXX */ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y); if (!(vmask & CWEventMask)) RecalculateDeliverableEvents(pWin); if (vmask) *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin)); else *error = Success; if (*error != Success) { DeleteWindow(pWin, None); return NullWindow; } if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful)) { XID value = defaultBackingStore; (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin)); pWin->forcedBS = TRUE; } if (SubSend(pParent)) { event.u.u.type = CreateNotify; event.u.createNotify.window = wid; event.u.createNotify.parent = pParent->drawable.id; event.u.createNotify.x = x; event.u.createNotify.y = y; event.u.createNotify.width = w; event.u.createNotify.height = h; event.u.createNotify.borderWidth = bw; event.u.createNotify.override = pWin->overrideRedirect; DeliverEvents(pParent, &event, 1, NullWindow); } return pWin; } static void #if NeedFunctionPrototypes FreeWindowResources(register WindowPtr pWin) #else FreeWindowResources(pWin) register WindowPtr pWin; #endif { register ScreenPtr pScreen = pWin->drawable.pScreen; DeleteWindowFromAnySaveSet(pWin); DeleteWindowFromAnySelections(pWin); DeleteWindowFromAnyEvents(pWin, TRUE); REGION_UNINIT(pScreen, &pWin->clipList); REGION_UNINIT(pScreen, &pWin->winSize); REGION_UNINIT(pScreen, &pWin->borderClip); REGION_UNINIT(pScreen, &pWin->borderSize); #ifdef SHAPE if (wBoundingShape (pWin)) REGION_DESTROY(pScreen, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_DESTROY(pScreen, wClipShape (pWin)); #endif if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); DeleteAllWindowProperties(pWin); /* We SHOULD check for an error value here XXX */ (*pScreen->DestroyWindow)(pWin); DisposeWindowOptional (pWin); } static void #if NeedFunctionPrototypes CrushTree(WindowPtr pWin) #else CrushTree(pWin) WindowPtr pWin; #endif { register WindowPtr pChild, pSib, pParent; UnrealizeWindowProcPtr UnrealizeWindow; xEvent event; if (!(pChild = pWin->firstChild)) return; UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow; while (1) { if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (1) { pParent = pChild->parent; if (SubStrSend(pChild, pParent)) { event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pChild->drawable.id; DeliverEvents(pChild, &event, 1, NullWindow); } FreeResource(pChild->drawable.id, RT_WINDOW); pSib = pChild->nextSib; #ifdef DO_SAVE_UNDERS if (pChild->saveUnder && pChild->viewable) deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; if (pChild->realized) { pChild->realized = FALSE; (*UnrealizeWindow)(pChild); } FreeWindowResources(pChild); xfree(pChild); if ( (pChild = pSib) ) break; pChild = pParent; pChild->firstChild = NullWindow; pChild->lastChild = NullWindow; if (pChild == pWin) return; } } } /***** * DeleteWindow * Deletes child of window then window itself * If wid is None, don't send any events *****/ /*ARGSUSED*/ int DeleteWindow(value, wid) pointer value; XID wid; { register WindowPtr pParent; register WindowPtr pWin = (WindowPtr)value; xEvent event; UnmapWindow(pWin, FALSE); CrushTree(pWin); pParent = pWin->parent; if (wid && pParent && SubStrSend(pWin, pParent)) { event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pWin->drawable.id; DeliverEvents(pWin, &event, 1, NullWindow); } FreeWindowResources(pWin); if (pParent) { if (pParent->firstChild == pWin) pParent->firstChild = pWin->nextSib; if (pParent->lastChild == pWin) pParent->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } xfree(pWin); return Success; } /*ARGSUSED*/ void DestroySubwindows(pWin, client) register WindowPtr pWin; ClientPtr client; { /* XXX * The protocol is quite clear that each window should be * destroyed in turn, however, unmapping all of the first * eliminates most of the calls to ValidateTree. So, * this implementation is incorrect in that all of the * UnmapNotifies occur before all of the DestroyNotifies. * If you care, simply delete the call to UnmapSubwindows. */ UnmapSubwindows(pWin); while (pWin->lastChild) FreeResource(pWin->lastChild->drawable.id, RT_NONE); } #define DeviceEventMasks (KeyPressMask | KeyReleaseMask | ButtonPressMask | \ ButtonReleaseMask | PointerMotionMask) /***** * ChangeWindowAttributes * * The value-mask specifies which attributes are to be changed; the * value-list contains one value for each one bit in the mask, from least * to most significant bit in the mask. *****/ int ChangeWindowAttributes(pWin, vmask, vlist, client) register WindowPtr pWin; Mask vmask; XID *vlist; ClientPtr client; { register Mask index2; register XID *pVlist; PixmapPtr pPixmap; Pixmap pixID; CursorPtr pCursor, pOldCursor; Cursor cursorID; WindowPtr pChild; Colormap cmap; ColormapPtr pCmap; xEvent xE; int result; register ScreenPtr pScreen; Mask vmaskCopy = 0; register Mask tmask; unsigned int val; int error; Bool checkOptional = FALSE; Bool borderRelative = FALSE; WindowPtr pLayerWin; if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; error = Success; pScreen = pWin->drawable.pScreen; pVlist = vlist; tmask = vmask; while (tmask) { index2 = (Mask) lowbit (tmask); tmask &= ~index2; switch (index2) { case CWBackPixmap: pixID = (Pixmap )*pVlist; pVlist++; if (pWin->backgroundState == ParentRelative) borderRelative = TRUE; if (pixID == None) { #ifdef XCSECURITY /* can't let untrusted clients have background None windows */ if (client->trustLevel == XSecurityClientTrusted) { #endif if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); if (!pWin->parent) MakeRootTile(pWin); else pWin->backgroundState = None; #ifdef XCSECURITY } else { /* didn't change the background to None, so don't tell ddx */ index2 = 0; } #endif } else if (pixID == ParentRelative) { if (pWin->parent && pWin->drawable.depth != pWin->parent->drawable.depth) { error = BadMatch; goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); if (!pWin->parent) MakeRootTile(pWin); else pWin->backgroundState = ParentRelative; borderRelative = TRUE; /* Note that the parent's backgroundTile's refcnt is NOT * incremented. */ } else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, RT_PIXMAP, SecurityReadAccess); if (pPixmap != (PixmapPtr) NULL) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; goto PatchUp; } if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pPixmap; pPixmap->refcnt++; } else { error = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBackPixel: if (pWin->backgroundState == ParentRelative) borderRelative = TRUE; if (pWin->backgroundState == BackgroundPixmap) (*pScreen->DestroyPixmap)(pWin->background.pixmap); pWin->backgroundState = BackgroundPixel; pWin->background.pixel = (CARD32 ) *pVlist; /* background pixel overrides background pixmap, so don't let the ddx layer see both bits */ vmaskCopy &= ~CWBackPixmap; pVlist++; break; case CWBorderPixmap: pixID = (Pixmap ) *pVlist; pVlist++; if (pixID == CopyFromParent) { if (!pWin->parent || (pWin->drawable.depth != pWin->parent->drawable.depth)) { error = BadMatch; goto PatchUp; } if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->border = pWin->parent->border; if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE) { index2 = CWBorderPixel; } else { pWin->parent->border.pixmap->refcnt++; } } else { pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, RT_PIXMAP, SecurityReadAccess); if (pPixmap) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) { error = BadMatch; goto PatchUp; } if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->borderIsPixel = FALSE; pWin->border.pixmap = pPixmap; pPixmap->refcnt++; } else { error = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBorderPixel: if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); pWin->borderIsPixel = TRUE; pWin->border.pixel = (CARD32) *pVlist; /* border pixel overrides border pixmap, so don't let the ddx layer see both bits */ vmaskCopy &= ~CWBorderPixmap; pVlist++; break; case CWBitGravity: val = (CARD8 )*pVlist; pVlist++; if (val > StaticGravity) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->bitGravity = val; break; case CWWinGravity: val = (CARD8 )*pVlist; pVlist++; if (val > StaticGravity) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->winGravity = val; break; case CWBackingStore: val = (CARD8 )*pVlist; pVlist++; if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->backingStore = val; pWin->forcedBS = FALSE; break; case CWBackingPlanes: if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) { if (!pWin->optional && !MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } pWin->optional->backingBitPlanes = (CARD32) *pVlist; if ((CARD32)*pVlist == (CARD32)~0L) checkOptional = TRUE; } pVlist++; break; case CWBackingPixel: if (pWin->optional || (CARD32) *pVlist) { if (!pWin->optional && !MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } pWin->optional->backingPixel = (CARD32) *pVlist; if (!*pVlist) checkOptional = TRUE; } pVlist++; break; case CWSaveUnder: val = (BOOL) *pVlist; pVlist++; if ((val != xTrue) && (val != xFalse)) { error = BadValue; client->errorValue = val; goto PatchUp; } #ifdef DO_SAVE_UNDERS if (pWin->parent && (pWin->saveUnder != val) && (pWin->viewable) && DO_SAVE_UNDERS(pWin)) { /* * Re-check all siblings and inferiors for obscurity or * exposition (hee hee). */ if (pWin->saveUnder) deltaSaveUndersViewable--; else deltaSaveUndersViewable++; pWin->saveUnder = val; if (pWin->firstChild) { pLayerWin = (*pScreen->GetLayerWindow)(pWin); if ((*pScreen->ChangeSaveUnder)(pLayerWin->parent, pWin->nextSib)) (*pScreen->PostChangeSaveUnder)(pLayerWin->parent, pWin->nextSib); } else { if ((*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib)) (*pScreen->PostChangeSaveUnder)(pWin, pWin->nextSib); } } else { /* If we're changing the saveUnder attribute of the root * window, all we do is set pWin->saveUnder so that * GetWindowAttributes returns the right value. We don't * do the "normal" save-under processing (as above). * Hope that doesn't cause any problems. */ pWin->saveUnder = val; } #else pWin->saveUnder = val; #endif /* DO_SAVE_UNDERS */ break; case CWEventMask: result = EventSelectForWindow(pWin, client, (Mask )*pVlist); if (result) { error = result; goto PatchUp; } pVlist++; break; case CWDontPropagate: result = EventSuppressForWindow(pWin, client, (Mask )*pVlist, &checkOptional); if (result) { error = result; goto PatchUp; } pVlist++; break; case CWOverrideRedirect: val = (BOOL ) *pVlist; pVlist++; if ((val != xTrue) && (val != xFalse)) { error = BadValue; client->errorValue = val; goto PatchUp; } pWin->overrideRedirect = val; break; case CWColormap: cmap = (Colormap) *pVlist; pVlist++; if (cmap == CopyFromParent) { #ifdef XAPPGROUP Colormap ag_colormap; ClientPtr win_owner; /* * win_owner == client for CreateWindow, other clients * can ChangeWindowAttributes */ win_owner = LookupClient (pWin->drawable.id, client); if ( win_owner && win_owner->appgroup && !pWin->parent->parent && (ag_colormap = XagDefaultColormap (win_owner))) cmap = ag_colormap; else #endif if (pWin->parent && (!pWin->optional || pWin->optional->visual == wVisual (pWin->parent))) { cmap = wColormap (pWin->parent); } else cmap = None; } if (cmap == None) { error = BadMatch; goto PatchUp; } pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, RT_COLORMAP, SecurityReadAccess); if (!pCmap) { error = BadColor; client->errorValue = cmap; goto PatchUp; } if (pCmap->pVisual->vid != wVisual (pWin) || pCmap->pScreen != pScreen) { error = BadMatch; goto PatchUp; } if (cmap != wColormap (pWin)) { if (!pWin->optional) { if (!MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } } else if (pWin->parent && cmap == wColormap (pWin->parent)) checkOptional = TRUE; /* * propagate the original colormap to any children * inheriting it */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (!pChild->optional && !MakeWindowOptional (pChild)) { error = BadAlloc; goto PatchUp; } } pWin->optional->colormap = cmap; /* * check on any children now matching the new colormap */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (pChild->optional->colormap == cmap) CheckWindowOptionalNeed (pChild); } xE.u.u.type = ColormapNotify; xE.u.colormap.window = pWin->drawable.id; xE.u.colormap.colormap = cmap; xE.u.colormap.new = xTrue; xE.u.colormap.state = IsMapInstalled(cmap, pWin); DeliverEvents(pWin, &xE, 1, NullWindow); } break; case CWCursor: cursorID = (Cursor ) *pVlist; pVlist++; /* * install the new */ if ( cursorID == None) { if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) pCursor = rootCursor; else pCursor = (CursorPtr) None; } else { pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, RT_CURSOR, SecurityReadAccess); if (!pCursor) { error = BadCursor; client->errorValue = cursorID; goto PatchUp; } } if (pCursor != wCursor (pWin)) { /* * patch up child windows so they don't lose cursors. */ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib) { if (!pChild->optional && !pChild->cursorIsNone && !MakeWindowOptional (pChild)) { error = BadAlloc; goto PatchUp; } } pOldCursor = 0; if (pCursor == (CursorPtr) None) { pWin->cursorIsNone = TRUE; if (pWin->optional) { pOldCursor = pWin->optional->cursor; pWin->optional->cursor = (CursorPtr) None; checkOptional = TRUE; } } else { if (!pWin->optional) { if (!MakeWindowOptional (pWin)) { error = BadAlloc; goto PatchUp; } } else if (pWin->parent && pCursor == wCursor (pWin->parent)) checkOptional = TRUE; pOldCursor = pWin->optional->cursor; pWin->optional->cursor = pCursor; pCursor->refcnt++; pWin->cursorIsNone = FALSE; /* * check on any children now matching the new cursor */ for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib) { if (pChild->optional && (pChild->optional->cursor == pCursor)) CheckWindowOptionalNeed (pChild); } } if (pWin->realized) WindowHasNewCursor( pWin); /* Can't free cursor until here - old cursor * is needed in WindowHasNewCursor */ if (pOldCursor) FreeCursor (pOldCursor, (Cursor)0); } break; default: error = BadValue; client->errorValue = vmask; goto PatchUp; } vmaskCopy |= index2; } PatchUp: if (checkOptional) CheckWindowOptionalNeed (pWin); /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy); /* If the border contents have changed, redraw the border. Note that this has to be done AFTER pScreen->ChangeWindowAttributes for the tile to be rotated, and the correct function selected. */ if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative) && pWin->viewable && HasBorder (pWin)) { RegionRec exposed; REGION_INIT(pScreen, &exposed, NullBox, 0); REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize); (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER); REGION_UNINIT(pScreen, &exposed); } return error; } /***** * GetWindowAttributes * Notice that this is different than ChangeWindowAttributes *****/ void GetWindowAttributes(pWin, client, wa) register WindowPtr pWin; ClientPtr client; xGetWindowAttributesReply *wa; { wa->type = X_Reply; wa->bitGravity = pWin->bitGravity; wa->winGravity = pWin->winGravity; if (pWin->forcedBS && pWin->backingStore != Always) wa->backingStore = NotUseful; else wa->backingStore = pWin->backingStore; wa->length = (sizeof(xGetWindowAttributesReply) - sizeof(xGenericReply)) >> 2; wa->sequenceNumber = client->sequence; wa->backingBitPlanes = wBackingBitPlanes (pWin); wa->backingPixel = wBackingPixel (pWin); wa->saveUnder = (BOOL)pWin->saveUnder; wa->override = pWin->overrideRedirect; if (!pWin->mapped) wa->mapState = IsUnmapped; else if (pWin->realized) wa->mapState = IsViewable; else wa->mapState = IsUnviewable; wa->colormap = wColormap (pWin); wa->mapInstalled = (wa->colormap == None) ? xFalse : IsMapInstalled(wa->colormap, pWin); wa->yourEventMask = EventMaskForClient(pWin, client); wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin); wa->doNotPropagateMask = wDontPropagateMask (pWin); wa->class = pWin->drawable.class; wa->visualID = wVisual (pWin); } WindowPtr MoveWindowInStack(pWin, pNextSib) register WindowPtr pWin, pNextSib; { register WindowPtr pParent = pWin->parent; WindowPtr pFirstChange = pWin; /* highest window where list changes */ if (pWin->nextSib != pNextSib) { if (!pNextSib) /* move to bottom */ { if (pParent->firstChild == pWin) pParent->firstChild = pWin->nextSib; /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL * and pWin->nextSib != pNextSib * therefore pWin->nextSib != NULL */ pFirstChange = pWin->nextSib; pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pParent->lastChild->nextSib = pWin; pWin->prevSib = pParent->lastChild; pWin->nextSib = NullWindow; pParent->lastChild = pWin; } else if (pParent->firstChild == pNextSib) /* move to top */ { pFirstChange = pWin; if (pParent->lastChild == pWin) pParent->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pWin->nextSib = pParent->firstChild; pWin->prevSib = (WindowPtr ) NULL; pNextSib->prevSib = pWin; pParent->firstChild = pWin; } else /* move in middle of list */ { WindowPtr pOldNext = pWin->nextSib; pFirstChange = NullWindow; if (pParent->firstChild == pWin) pFirstChange = pParent->firstChild = pWin->nextSib; if (pParent->lastChild == pWin) { pFirstChange = pWin; pParent->lastChild = pWin->prevSib; } if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; pWin->nextSib = pNextSib; pWin->prevSib = pNextSib->prevSib; if (pNextSib->prevSib) pNextSib->prevSib->nextSib = pWin; pNextSib->prevSib = pWin; if (!pFirstChange) { /* do we know it yet? */ pFirstChange = pParent->firstChild; /* no, search from top */ while ((pFirstChange != pWin) && (pFirstChange != pOldNext)) pFirstChange = pFirstChange->nextSib; } } } return( pFirstChange ); } RegionPtr CreateUnclippedWinSize (pWin) register WindowPtr pWin; { RegionPtr pRgn; BoxRec box; box.x1 = pWin->drawable.x; box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + (int) pWin->drawable.width; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { REGION_PTR(pScreen, pWin) REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_INTERSECT(pScreen, pRgn, pRgn, wClipShape (pWin)); REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y); } #endif return pRgn; } void SetWinSize (pWin) register WindowPtr pWin; { ClippedRegionFromBox(pWin->parent, &pWin->winSize, pWin->drawable.x, pWin->drawable.y, (int)pWin->drawable.width, (int)pWin->drawable.height); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { REGION_PTR(pScreen, pWin) REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, wClipShape (pWin)); REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x, pWin->drawable.y); } #endif } void SetBorderSize (pWin) register WindowPtr pWin; { int bw; if (HasBorder (pWin)) { bw = wBorderWidth (pWin); ClippedRegionFromBox(pWin->parent, &pWin->borderSize, pWin->drawable.x - bw, pWin->drawable.y - bw, (int)(pWin->drawable.width + (bw<<1)), (int)(pWin->drawable.height + (bw<<1))); #ifdef SHAPE if (wBoundingShape (pWin)) { REGION_PTR(pScreen, pWin) REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x, - pWin->drawable.y); REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize, wBoundingShape (pWin)); REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x, pWin->drawable.y); REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize, &pWin->winSize); } #endif } else { REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize, &pWin->winSize); } } void GravityTranslate (x, y, oldx, oldy, dw, dh, gravity, destx, desty) register int x, y; /* new window position */ int oldx, oldy; /* old window position */ int dw, dh; unsigned gravity; register int *destx, *desty; /* position relative to gravity */ { switch (gravity) { case NorthGravity: *destx = x + dw / 2; *desty = y; break; case NorthEastGravity: *destx = x + dw; *desty = y; break; case WestGravity: *destx = x; *desty = y + dh / 2; break; case CenterGravity: *destx = x + dw / 2; *desty = y + dh / 2; break; case EastGravity: *destx = x + dw; *desty = y + dh / 2; break; case SouthWestGravity: *destx = x; *desty = y + dh; break; case SouthGravity: *destx = x + dw / 2; *desty = y + dh; break; case SouthEastGravity: *destx = x + dw; *desty = y + dh; break; case StaticGravity: *destx = oldx; *desty = oldy; break; default: *destx = x; *desty = y; break; } } /* XXX need to retile border on each window with ParentRelative origin */ void ResizeChildrenWinSize(pWin, dx, dy, dw, dh) register WindowPtr pWin; int dx, dy, dw, dh; { register ScreenPtr pScreen; register WindowPtr pSib, pChild; Bool resized = (dw || dh); pScreen = pWin->drawable.pScreen; for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) { if (resized && (pSib->winGravity > NorthWestGravity)) { int cwsx, cwsy; cwsx = pSib->origin.x; cwsy = pSib->origin.y; GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh, pSib->winGravity, &cwsx, &cwsy); if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) { xEvent event; event.u.u.type = GravityNotify; event.u.gravity.window = pSib->drawable.id; event.u.gravity.x = cwsx - wBorderWidth (pSib); event.u.gravity.y = cwsy - wBorderWidth (pSib); DeliverEvents (pSib, &event, 1, NullWindow); pSib->origin.x = cwsx; pSib->origin.y = cwsy; } } pSib->drawable.x = pWin->drawable.x + pSib->origin.x; pSib->drawable.y = pWin->drawable.y + pSib->origin.y; SetWinSize (pSib); SetBorderSize (pSib); (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y); if ( (pChild = pSib->firstChild) ) { while (1) { pChild->drawable.x = pChild->parent->drawable.x + pChild->origin.x; pChild->drawable.y = pChild->parent->drawable.y + pChild->origin.y; SetWinSize (pChild); SetBorderSize (pChild); (*pScreen->PositionWindow)(pChild, pChild->drawable.x, pChild->drawable.y); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib && (pChild != pSib)) pChild = pChild->parent; if (pChild == pSib) break; pChild = pChild->nextSib; } } } } #define GET_INT16(m, f) \ if (m & mask) \ { \ f = (INT16) *pVlist;\ pVlist++; \ } #define GET_CARD16(m, f) \ if (m & mask) \ { \ f = (CARD16) *pVlist;\ pVlist++;\ } #define GET_CARD8(m, f) \ if (m & mask) \ { \ f = (CARD8) *pVlist;\ pVlist++;\ } #define ChangeMask ((Mask)(CWX | CWY | CWWidth | CWHeight)) #define IllegalInputOnlyConfigureMask (CWBorderWidth) /* * IsSiblingAboveMe * returns Above if pSib above pMe in stack or Below otherwise */ static int #if NeedFunctionPrototypes IsSiblingAboveMe( register WindowPtr pMe, register WindowPtr pSib) #else IsSiblingAboveMe(pMe, pSib) register WindowPtr pMe, pSib; #endif { register WindowPtr pWin; pWin = pMe->parent->firstChild; while (pWin) { if (pWin == pSib) return(Above); else if (pWin == pMe) return(Below); pWin = pWin->nextSib; } return(Below); } static BoxPtr #if NeedFunctionPrototypes WindowExtents( register WindowPtr pWin, register BoxPtr pBox) #else WindowExtents(pWin, pBox) register WindowPtr pWin; register BoxPtr pBox; #endif { pBox->x1 = pWin->drawable.x - wBorderWidth (pWin); pBox->y1 = pWin->drawable.y - wBorderWidth (pWin); pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width + wBorderWidth (pWin); pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height + wBorderWidth (pWin); return(pBox); } #ifdef SHAPE #define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL) static RegionPtr #if NeedFunctionPrototypes MakeBoundingRegion ( register WindowPtr pWin, BoxPtr pBox) #else MakeBoundingRegion (pWin, pBox) register WindowPtr pWin; BoxPtr pBox; #endif { RegionPtr pRgn; REGION_PTR(pScreen, pWin) pRgn = REGION_CREATE(pScreen, pBox, 1); if (wBoundingShape (pWin)) { REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x, -pWin->origin.y); REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x, pWin->origin.y); } return pRgn; } static Bool #if NeedFunctionPrototypes ShapeOverlap ( WindowPtr pWin, BoxPtr pWinBox, WindowPtr pSib, BoxPtr pSibBox) #else ShapeOverlap (pWin, pWinBox, pSib, pSibBox) WindowPtr pWin, pSib; BoxPtr pWinBox, pSibBox; #endif { RegionPtr pWinRgn, pSibRgn; register ScreenPtr pScreen; Bool ret; if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib)) return TRUE; pScreen = pWin->drawable.pScreen; pWinRgn = MakeBoundingRegion (pWin, pWinBox); pSibRgn = MakeBoundingRegion (pSib, pSibBox); REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn); ret = REGION_NOTEMPTY(pScreen, pWinRgn); REGION_DESTROY(pScreen, pWinRgn); REGION_DESTROY(pScreen, pSibRgn); return ret; } #endif static Bool #if NeedFunctionPrototypes AnyWindowOverlapsMe( WindowPtr pWin, WindowPtr pHead, register BoxPtr box) #else AnyWindowOverlapsMe(pWin, pHead, box) WindowPtr pWin, pHead; register BoxPtr box; #endif { register WindowPtr pSib; BoxRec sboxrec; register BoxPtr sbox; for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib) { if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) #ifdef SHAPE && ShapeOverlap (pWin, box, pSib, sbox) #endif ) return(TRUE); } } return(FALSE); } static Bool #if NeedFunctionPrototypes IOverlapAnyWindow( WindowPtr pWin, register BoxPtr box) #else IOverlapAnyWindow(pWin, box) WindowPtr pWin; register BoxPtr box; #endif { register WindowPtr pSib; BoxRec sboxrec; register BoxPtr sbox; for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib) { if (pSib->mapped) { sbox = WindowExtents(pSib, &sboxrec); if (BOXES_OVERLAP(sbox, box) #ifdef SHAPE && ShapeOverlap (pWin, box, pSib, sbox) #endif ) return(TRUE); } } return(FALSE); } /* * WhereDoIGoInTheStack() * Given pWin and pSib and the relationshipe smode, return * the window that pWin should go ABOVE. * If a pSib is specified: * Above: pWin is placed just above pSib * Below: pWin is placed just below pSib * TopIf: if pSib occludes pWin, then pWin is placed * at the top of the stack * BottomIf: if pWin occludes pSib, then pWin is * placed at the bottom of the stack * Opposite: if pSib occludes pWin, then pWin is placed at the * top of the stack, else if pWin occludes pSib, then * pWin is placed at the bottom of the stack * * If pSib is NULL: * Above: pWin is placed at the top of the stack * Below: pWin is placed at the bottom of the stack * TopIf: if any sibling occludes pWin, then pWin is placed at * the top of the stack * BottomIf: if pWin occludes any sibline, then pWin is placed at * the bottom of the stack * Opposite: if any sibling occludes pWin, then pWin is placed at * the top of the stack, else if pWin occludes any * sibling, then pWin is placed at the bottom of the stack * */ static WindowPtr #if NeedFunctionPrototypes WhereDoIGoInTheStack( register WindowPtr pWin, register WindowPtr pSib, short x, short y, unsigned short w, unsigned short h, int smode) #else WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode) register WindowPtr pWin, pSib; short x, y; unsigned short w, h; int smode; #endif { BoxRec box; register ScreenPtr pScreen; WindowPtr pHead, pFirst; if ((pWin == pWin->parent->firstChild) && (pWin == pWin->parent->lastChild)) return((WindowPtr ) NULL); pHead = RealChildHead(pWin->parent); pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild; pScreen = pWin->drawable.pScreen; box.x1 = x; box.y1 = y; box.x2 = x + (int)w; box.y2 = y + (int)h; switch (smode) { case Above: if (pSib) return(pSib); else if (pWin == pFirst) return(pWin->nextSib); else return(pFirst); case Below: if (pSib) if (pSib->nextSib != pWin) return(pSib->nextSib); else return(pWin->nextSib); else return NullWindow; case TopIf: if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs) return(pWin->nextSib); else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Above) && (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) return(pFirst); else return(pWin->nextSib); } else if (AnyWindowOverlapsMe(pWin, pHead, &box)) return(pFirst); else return(pWin->nextSib); case BottomIf: if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs) return(pWin->nextSib); else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Below) && (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) return NullWindow; else return(pWin->nextSib); } else if (IOverlapAnyWindow(pWin, &box)) return NullWindow; else return(pWin->nextSib); case Opposite: if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs) return(pWin->nextSib); else if (pSib) { if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT) { if (IsSiblingAboveMe(pWin, pSib) == Above) return(pFirst); else return NullWindow; } else return(pWin->nextSib); } else if (AnyWindowOverlapsMe(pWin, pHead, &box)) { /* If I'm occluded, I can't possibly be the first child * if (pWin == pWin->parent->firstChild) * return pWin->nextSib; */ return(pFirst); } else if (IOverlapAnyWindow(pWin, &box)) return NullWindow; else return pWin->nextSib; default: { ErrorF("Internal error in ConfigureWindow, smode == %d\n",smode ); return pWin->nextSib; } } } static void #if NeedFunctionPrototypes ReflectStackChange( register WindowPtr pWin, register WindowPtr pSib, VTKind kind) #else ReflectStackChange(pWin, pSib, kind) register WindowPtr pWin, pSib; VTKind kind; #endif { /* Note that pSib might be NULL */ Bool WasViewable = (Bool)pWin->viewable; WindowPtr pParent; Bool anyMarked; WindowPtr pFirstChange; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; ScreenPtr pScreen = pWin->drawable.pScreen; /* if this is a root window, can't be restacked */ if (!(pParent = pWin->parent)) return ; pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, &pLayerWin); if (pLayerWin != pWin) pFirstChange = pLayerWin; #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pWin->drawable.pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind); } if (pWin->realized) WindowsRestructured (); } /***** * ConfigureWindow *****/ int ConfigureWindow(pWin, mask, vlist, client) register WindowPtr pWin; register Mask mask; XID *vlist; ClientPtr client; { #define RESTACK_WIN 0 #define MOVE_WIN 1 #define RESIZE_WIN 2 #define REBORDER_WIN 3 register WindowPtr pSib = NullWindow; register WindowPtr pParent = pWin->parent; Window sibwid; Mask index2, tmask; register XID *pVlist; short x, y, beforeX, beforeY; unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; int action, smode = Above; #ifdef XAPPGROUP ClientPtr win_owner; ClientPtr ag_leader = NULL; #endif xEvent event; if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask)) return(BadMatch); if ((mask & CWSibling) && !(mask & CWStackMode)) return(BadMatch); pVlist = vlist; if (pParent) { x = pWin->drawable.x - pParent->drawable.x - (int)bw; y = pWin->drawable.y - pParent->drawable.y - (int)bw; } else { x = pWin->drawable.x; y = pWin->drawable.y; } beforeX = x; beforeY = y; action = RESTACK_WIN; if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) { GET_INT16(CWX, x); GET_INT16(CWY, y); action = MOVE_WIN; } /* or should be resized */ else if (mask & (CWX | CWY | CWWidth | CWHeight)) { GET_INT16(CWX, x); GET_INT16(CWY, y); GET_CARD16(CWWidth, w); GET_CARD16 (CWHeight, h); if (!w || !h) { client->errorValue = 0; return BadValue; } action = RESIZE_WIN; } tmask = mask & ~ChangeMask; while (tmask) { index2 = (Mask)lowbit (tmask); tmask &= ~index2; switch (index2) { case CWBorderWidth: GET_CARD16(CWBorderWidth, bw); break; case CWSibling: sibwid = (Window ) *pVlist; pVlist++; pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, RT_WINDOW, SecurityReadAccess); if (!pSib) { client->errorValue = sibwid; return(BadWindow); } if (pSib->parent != pParent) return(BadMatch); if (pSib == pWin) return(BadMatch); break; case CWStackMode: GET_CARD8(CWStackMode, smode); if ((smode != TopIf) && (smode != BottomIf) && (smode != Opposite) && (smode != Above) && (smode != Below)) { client->errorValue = smode; return(BadValue); } break; default: client->errorValue = mask; return(BadValue); } } /* root really can't be reconfigured, so just return */ if (!pParent) return Success; /* Figure out if the window should be moved. Doesnt make the changes to the window if event sent */ if (mask & CWStackMode) pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x, pParent->drawable.y + y, w + (bw << 1), h + (bw << 1), smode); else pSib = pWin->nextSib; #ifdef XAPPGROUP win_owner = clients[CLIENT_ID(pWin->drawable.id)]; ag_leader = XagLeader (win_owner); #endif if ((!pWin->overrideRedirect) && (RedirectSend(pParent) #ifdef XAPPGROUP || (win_owner->appgroup && ag_leader && XagIsControlledRoot (client, pParent)) #endif )) { event.u.u.type = ConfigureRequest; event.u.configureRequest.window = pWin->drawable.id; if (mask & CWSibling) event.u.configureRequest.sibling = sibwid; else event.u.configureRequest.sibling = None; if (mask & CWStackMode) event.u.u.detail = smode; else event.u.u.detail = Above; event.u.configureRequest.x = x; event.u.configureRequest.y = y; event.u.configureRequest.width = w; event.u.configureRequest.height = h; event.u.configureRequest.borderWidth = bw; event.u.configureRequest.valueMask = mask; #ifdef XAPPGROUP /* make sure if the ag_leader maps the window it goes to the wm */ if (ag_leader && ag_leader != client && XagIsControlledRoot (client, pParent)) { event.u.configureRequest.parent = XagId (win_owner); (void) TryClientEvents (ag_leader, &event, 1, NoEventMask, NoEventMask, NullGrab); return Success; } #endif event.u.configureRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } if (action == RESIZE_WIN) { Bool size_change = (w != pWin->drawable.width) || (h != pWin->drawable.height); if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) { xEvent eventT; eventT.u.u.type = ResizeRequest; eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.height = h; if (MaybeDeliverEventsToClient(pWin, &eventT, 1, ResizeRedirectMask, client) == 1) { /* if event is delivered, leave the actual size alone. */ w = pWin->drawable.width; h = pWin->drawable.height; size_change = FALSE; } } if (!size_change) { if (mask & (CWX | CWY)) action = MOVE_WIN; else if (mask & (CWStackMode | CWBorderWidth)) action = RESTACK_WIN; else /* really nothing to do */ return(Success) ; } } if (action == RESIZE_WIN) /* we've already checked whether there's really a size change */ goto ActuallyDoSomething; if ((mask & CWX) && (x != beforeX)) goto ActuallyDoSomething; if ((mask & CWY) && (y != beforeY)) goto ActuallyDoSomething; if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin))) goto ActuallyDoSomething; if (mask & CWStackMode) { if (pWin->nextSib != pSib) goto ActuallyDoSomething; } return(Success); ActuallyDoSomething: if (SubStrSend(pWin, pParent)) { event.u.u.type = ConfigureNotify; event.u.configureNotify.window = pWin->drawable.id; if (pSib) event.u.configureNotify.aboveSibling = pSib->drawable.id; else event.u.configureNotify.aboveSibling = None; event.u.configureNotify.x = x; event.u.configureNotify.y = y; event.u.configureNotify.width = w; event.u.configureNotify.height = h; event.u.configureNotify.borderWidth = bw; event.u.configureNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (mask & CWBorderWidth) { if (action == RESTACK_WIN) { action = MOVE_WIN; pWin->borderWidth = bw; } else if ((action == MOVE_WIN) && (beforeX + wBorderWidth (pWin) == x + (int)bw) && (beforeY + wBorderWidth (pWin) == y + (int)bw)) { action = REBORDER_WIN; (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw); } else pWin->borderWidth = bw; } if (action == MOVE_WIN) (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib, (mask & CWBorderWidth) ? VTOther : VTMove); else if (action == RESIZE_WIN) (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib); else if (mask & CWStackMode) ReflectStackChange(pWin, pSib, VTOther); if (action != RESTACK_WIN) CheckCursorConfinement(pWin); return(Success); #undef RESTACK_WIN #undef MOVE_WIN #undef RESIZE_WIN #undef REBORDER_WIN } /****** * * CirculateWindow * For RaiseLowest, raises the lowest mapped child (if any) that is * obscured by another child to the top of the stack. For LowerHighest, * lowers the highest mapped child (if any) that is obscuring another * child to the bottom of the stack. Exposure processing is performed * ******/ int CirculateWindow(pParent, direction, client) WindowPtr pParent; int direction; ClientPtr client; { register WindowPtr pWin, pHead, pFirst; xEvent event; BoxRec box; pHead = RealChildHead(pParent); pFirst = pHead ? pHead->nextSib : pParent->firstChild; if (direction == RaiseLowest) { for (pWin = pParent->lastChild; (pWin != pHead) && !(pWin->mapped && AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box))); pWin = pWin->prevSib) ; if (pWin == pHead) return Success; } else { for (pWin = pFirst; pWin && !(pWin->mapped && IOverlapAnyWindow(pWin, WindowExtents(pWin, &box))); pWin = pWin->nextSib) ; if (!pWin) return Success; } event.u.circulate.window = pWin->drawable.id; event.u.circulate.parent = pParent->drawable.id; event.u.circulate.event = pParent->drawable.id; if (direction == RaiseLowest) event.u.circulate.place = PlaceOnTop; else event.u.circulate.place = PlaceOnBottom; if (RedirectSend(pParent)) { event.u.u.type = CirculateRequest; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } event.u.u.type = CirculateNotify; DeliverEvents(pWin, &event, 1, NullWindow); ReflectStackChange(pWin, (direction == RaiseLowest) ? pFirst : NullWindow, VTStack); return(Success); } static int #if NeedFunctionPrototypes CompareWIDs( WindowPtr pWin, pointer value) /* must conform to VisitWindowProcPtr */ #else CompareWIDs(pWin, value) WindowPtr pWin; pointer value; /* must conform to VisitWindowProcPtr */ #endif { Window *wid = (Window *)value; if (pWin->drawable.id == *wid) return(WT_STOPWALKING); else return(WT_WALKCHILDREN); } /***** * ReparentWindow *****/ int ReparentWindow(pWin, pParent, x, y, client) register WindowPtr pWin, pParent; int x,y; ClientPtr client; { WindowPtr pPrev, pPriorParent; Bool WasMapped = (Bool)(pWin->mapped); xEvent event; int bw = wBorderWidth (pWin); register ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING) return(BadMatch); if (!MakeWindowOptional(pWin)) return(BadAlloc); if (WasMapped) UnmapWindow(pWin, FALSE); event.u.u.type = ReparentNotify; event.u.reparent.window = pWin->drawable.id; event.u.reparent.parent = pParent->drawable.id; event.u.reparent.x = x; event.u.reparent.y = y; event.u.reparent.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, pParent); /* take out of sibling chain */ pPriorParent = pPrev = pWin->parent; if (pPrev->firstChild == pWin) pPrev->firstChild = pWin->nextSib; if (pPrev->lastChild == pWin) pPrev->lastChild = pWin->prevSib; if (pWin->nextSib) pWin->nextSib->prevSib = pWin->prevSib; if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; /* insert at begining of pParent */ pWin->parent = pParent; pPrev = RealChildHead(pParent); if (pPrev) { pWin->nextSib = pPrev->nextSib; if (pPrev->nextSib) pPrev->nextSib->prevSib = pWin; else pParent->lastChild = pWin; pPrev->nextSib = pWin; pWin->prevSib = pPrev; } else { pWin->nextSib = pParent->firstChild; pWin->prevSib = NullWindow; if (pParent->firstChild) pParent->firstChild->prevSib = pWin; else pParent->lastChild = pWin; pParent->firstChild = pWin; } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.x = x + bw + pParent->drawable.x; pWin->drawable.y = y + bw + pParent->drawable.y; /* clip to parent */ SetWinSize (pWin); SetBorderSize (pWin); if (pScreen->ReparentWindow) (*pScreen->ReparentWindow)(pWin, pPriorParent); (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); CheckWindowOptionalNeed(pWin); if (WasMapped) MapWindow(pWin, client); RecalculateDeliverableEvents(pWin); return(Success); } static void #if NeedFunctionPrototypes RealizeTree(WindowPtr pWin) #else RealizeTree(pWin) WindowPtr pWin; #endif { register WindowPtr pChild; RealizeWindowProcPtr Realize; Realize = pWin->drawable.pScreen->RealizeWindow; pChild = pWin; while (1) { if (pChild->mapped) { pChild->realized = TRUE; #ifdef DO_SAVE_UNDERS if (pChild->saveUnder) deltaSaveUndersViewable++; #endif pChild->viewable = (pChild->drawable.class == InputOutput); (* Realize)(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) return; pChild = pChild->nextSib; } } /***** * MapWindow * If some other client has selected SubStructureReDirect on the parent * and override-redirect is xFalse, then a MapRequest event is generated, * but the window remains unmapped. Otherwise, the window is mapped and a * MapNotify event is generated. *****/ int MapWindow(pWin, client) register WindowPtr pWin; ClientPtr client; { register ScreenPtr pScreen; register WindowPtr pParent; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; if (pWin->mapped) return(Success); #ifdef XCSECURITY /* don't let an untrusted client map a child-of-trusted-window, InputOnly * window; too easy to steal device input */ if ( (client->trustLevel != XSecurityClientTrusted) && (pWin->drawable.class == InputOnly) && (wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) ) return Success; #endif pScreen = pWin->drawable.pScreen; if ( (pParent = pWin->parent) ) { xEvent event; Bool anyMarked; #ifdef XAPPGROUP ClientPtr win_owner = clients[CLIENT_ID(pWin->drawable.id)]; ClientPtr ag_leader = XagLeader (win_owner); #endif if ((!pWin->overrideRedirect) && (RedirectSend(pParent) #ifdef XAPPGROUP || (win_owner->appgroup && ag_leader && XagIsControlledRoot (client, pParent)) #endif )) { event.u.u.type = MapRequest; event.u.mapRequest.window = pWin->drawable.id; #ifdef XAPPGROUP /* make sure if the ag_leader maps the window it goes to the wm */ if (ag_leader && ag_leader != client && XagIsControlledRoot (client, pParent)) { event.u.mapRequest.parent = XagId (win_owner); (void) TryClientEvents (ag_leader, &event, 1, NoEventMask, NoEventMask, NullGrab); return Success; } #endif event.u.mapRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return(Success); } pWin->mapped = TRUE; if (SubStrSend(pWin, pParent)) { event.u.u.type = MapNotify; event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (!pParent->realized) return(Success); RealizeTree(pWin); if (pWin->viewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap); } WindowsRestructured (); } else { RegionRec temp; pWin->mapped = TRUE; pWin->realized = TRUE; /* for roots */ pWin->viewable = pWin->drawable.class == InputOutput; /* We SHOULD check for an error value here XXX */ (*pScreen->RealizeWindow)(pWin); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pWin, 0, 0); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); REGION_INIT(pScreen, &temp, NullBox, 0); REGION_COPY(pScreen, &temp, &pWin->clipList); (*pScreen->WindowExposures) (pWin, &temp, NullRegion); REGION_UNINIT(pScreen, &temp); } return(Success); } /***** * MapSubwindows * Performs a MapWindow all unmapped children of the window, in top * to bottom stacking order. *****/ void MapSubwindows(pParent, client) register WindowPtr pParent; ClientPtr client; { register WindowPtr pWin; WindowPtr pFirstMapped = NullWindow; #ifdef DO_SAVE_UNDERS WindowPtr pFirstSaveUndered = NullWindow; #endif register ScreenPtr pScreen; register Mask parentRedirect; register Mask parentNotify; xEvent event; Bool anyMarked; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; pScreen = pParent->drawable.pScreen; parentRedirect = RedirectSend(pParent); parentNotify = SubSend(pParent); anyMarked = FALSE; for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (!pWin->mapped) { if (parentRedirect && !pWin->overrideRedirect) { event.u.u.type = MapRequest; event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) continue; } pWin->mapped = TRUE; if (parentNotify || StrSend(pWin)) { event.u.u.type = MapNotify; event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (!pFirstMapped) pFirstMapped = pWin; if (pParent->realized) { RealizeTree(pWin); if (pWin->viewable) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = TRUE; } #endif /* DO_SAVE_UNDERS */ } } } } if (pFirstMapped) { pLayerWin = (*pScreen->GetLayerWindow)(pParent); if (pLayerWin->parent != pParent) { anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin, pLayerWin, (WindowPtr *)NULL); pFirstMapped = pLayerWin; } if (anyMarked) { #ifdef DO_SAVE_UNDERS if (pLayerWin->parent != pParent) { if (dosave || (DO_SAVE_UNDERS(pLayerWin))) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); } } else if (dosave) { dosave = FALSE; for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (DO_SAVE_UNDERS(pWin)) { dosave |= (*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib); if (dosave && !pFirstSaveUndered) pFirstSaveUndered = pWin; } } } #endif /* DO_SAVE_UNDERS */ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstSaveUndered->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped, VTMap); WindowsRestructured (); } } static void #if NeedFunctionPrototypes UnrealizeTree( WindowPtr pWin, Bool fromConfigure) #else UnrealizeTree(pWin, fromConfigure) WindowPtr pWin; Bool fromConfigure; #endif { register WindowPtr pChild; UnrealizeWindowProcPtr Unrealize; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; Unrealize = pWin->drawable.pScreen->UnrealizeWindow; MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow; pChild = pWin; while (1) { if (pChild->realized) { pChild->realized = FALSE; pChild->visibility = VisibilityNotViewable; (* Unrealize)(pChild); DeleteWindowFromAnyEvents(pChild, FALSE); if (pChild->viewable) { #ifdef DO_SAVE_UNDERS if (pChild->saveUnder) deltaSaveUndersViewable--; #endif pChild->viewable = FALSE; if (pChild->backStorage) (*pChild->drawable.pScreen->SaveDoomedAreas)( pChild, &pChild->clipList, 0, 0); (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) return; pChild = pChild->nextSib; } } /***** * UnmapWindow * If the window is already unmapped, this request has no effect. * Otherwise, the window is unmapped and an UnMapNotify event is * generated. Cannot unmap a root window. *****/ int UnmapWindow(pWin, fromConfigure) register WindowPtr pWin; Bool fromConfigure; { register WindowPtr pParent; xEvent event; Bool wasRealized = (Bool)pWin->realized; Bool wasViewable = (Bool)pWin->viewable; ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pLayerWin = pWin; if ((!pWin->mapped) || (!(pParent = pWin->parent))) return(Success); if (SubStrSend(pWin, pParent)) { event.u.u.type = UnmapNotify; event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.fromConfigure = fromConfigure; DeliverEvents(pWin, &event, 1, NullWindow); } if (wasViewable && !fromConfigure) { pWin->valdata = UnmapValData; (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin); (*pScreen->MarkWindow)(pLayerWin->parent); } pWin->mapped = FALSE; if (wasRealized) UnrealizeTree(pWin, fromConfigure); if (wasViewable) { if (!fromConfigure) { (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib) ) { (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); } } pWin->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ if (!fromConfigure && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap); } if (wasRealized && !fromConfigure) WindowsRestructured (); return(Success); } /***** * UnmapSubwindows * Performs an UnmapWindow request with the specified mode on all mapped * children of the window, in bottom to top stacking order. *****/ void UnmapSubwindows(pWin) register WindowPtr pWin; { register WindowPtr pChild, pHead; xEvent event; Bool wasRealized = (Bool)pWin->realized; Bool wasViewable = (Bool)pWin->viewable; Bool anyMarked = FALSE; Mask parentNotify; WindowPtr pLayerWin; ScreenPtr pScreen = pWin->drawable.pScreen; if (!pWin->firstChild) return; parentNotify = SubSend(pWin); pHead = RealChildHead(pWin); if (wasViewable) pLayerWin = (*pScreen->GetLayerWindow)(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) { if (pChild->mapped) { if (parentNotify || StrSend(pChild)) { event.u.u.type = UnmapNotify; event.u.unmapNotify.window = pChild->drawable.id; event.u.unmapNotify.fromConfigure = xFalse; DeliverEvents(pChild, &event, 1, NullWindow); } if (pChild->viewable) { pChild->valdata = UnmapValData; anyMarked = TRUE; } pChild->mapped = FALSE; if (pChild->realized) UnrealizeTree(pChild, FALSE); if (wasViewable) { #ifdef DO_SAVE_UNDERS pChild->DIXsaveUnder = FALSE; #endif /* DO_SAVE_UNDERS */ if (pChild->backStorage) (*pScreen->SaveDoomedAreas)( pChild, &pChild->clipList, 0, 0); } } } if (wasViewable) { if (anyMarked) { if (pLayerWin->parent == pWin) (*pScreen->MarkWindow)(pWin); else { WindowPtr ptmp; (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, (WindowPtr *)NULL); (*pScreen->MarkWindow)(pLayerWin->parent); /* Windows between pWin and pLayerWin may not have been marked */ ptmp = pWin; while (ptmp != pLayerWin->parent) { (*pScreen->MarkWindow)(ptmp); ptmp = ptmp->parent; } pHead = pWin->firstChild; } (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { if ( (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin)) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); } #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap); } if (wasRealized) WindowsRestructured (); } void HandleSaveSet(client) register ClientPtr client; { register WindowPtr pParent, pWin; register int j; for (j=0; jnumSaved; j++) { pWin = (WindowPtr)client->saveSet[j]; pParent = pWin->parent; while (pParent && (wClient (pParent) == client)) pParent = pParent->parent; if (pParent) { if (pParent != pWin->parent) { ReparentWindow(pWin, pParent, pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x, pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y, client); if(!pWin->realized && pWin->mapped) pWin->mapped = FALSE; } MapWindow(pWin, client); } } xfree(client->saveSet); client->numSaved = 0; client->saveSet = (pointer *)NULL; } Bool VisibleBoundingBoxFromPoint(pWin, x, y, box) register WindowPtr pWin; int x, y; /* in root */ BoxPtr box; /* "return" value */ { if (!pWin->realized) return (FALSE); if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box)) return(TRUE); return(FALSE); } Bool PointInWindowIsVisible(pWin, x, y) register WindowPtr pWin; int x, y; /* in root */ { BoxRec box; if (!pWin->realized) return (FALSE); if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip, x, y, &box)) return(TRUE); return(FALSE); } RegionPtr NotClippedByChildren(pWin) register WindowPtr pWin; { register ScreenPtr pScreen; RegionPtr pReg; pScreen = pWin->drawable.pScreen; pReg = REGION_CREATE(pScreen, NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || !HasSaverWindow (pWin->drawable.pScreen->myNum)) { REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize); } return(pReg); } void SendVisibilityNotify(pWin) WindowPtr pWin; { xEvent event; event.u.u.type = VisibilityNotify; event.u.visibility.window = pWin->drawable.id; event.u.visibility.state = pWin->visibility; DeliverEvents(pWin, &event, 1, NullWindow); } #define RANDOM_WIDTH 32 #ifndef NOLOGOHACK extern int logoScreenSaver; static void DrawLogo( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); #endif void SaveScreens(on, mode) int on; int mode; { int i; int what; int type; if (on == SCREEN_SAVER_FORCER) { UpdateCurrentTimeIf(); lastDeviceEventTime = currentTime; if (mode == ScreenSaverReset) what = SCREEN_SAVER_OFF; else what = SCREEN_SAVER_ON; type = what; } else { what = on; type = what; if (what == screenIsSaved) type = SCREEN_SAVER_CYCLE; } for (i = 0; i < screenInfo.numScreens; i++) { if (on == SCREEN_SAVER_FORCER) (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on); if (savedScreenInfo[i].ExternalScreenSaver) { if ((*savedScreenInfo[i].ExternalScreenSaver) (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER)) continue; } if (type == screenIsSaved) continue; switch (type) { case SCREEN_SAVER_OFF: if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED) { (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what); } else if (HasSaverWindow (i)) { savedScreenInfo[i].pWindow = NullWindow; FreeResource(savedScreenInfo[i].wid, RT_NONE); } break; case SCREEN_SAVER_CYCLE: if (savedScreenInfo[i].blanked == SCREEN_IS_TILED) { WindowPtr pWin = savedScreenInfo[i].pWindow; /* make it look like screen saver is off, so that * NotClippedByChildren will compute a clip list * for the root window, so miPaintWindow works */ screenIsSaved = SCREEN_SAVER_OFF; #ifndef NOLOGOHACK if (logoScreenSaver) (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE); #endif (*pWin->drawable.pScreen->MoveWindow)(pWin, (short)(-(rand() % RANDOM_WIDTH)), (short)(-(rand() % RANDOM_WIDTH)), pWin->nextSib, VTMove); #ifndef NOLOGOHACK if (logoScreenSaver) DrawLogo(pWin); #endif screenIsSaved = SCREEN_SAVER_ON; } break; case SCREEN_SAVER_ON: if (ScreenSaverBlanking != DontPreferBlanking) { if ((* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], what)) { savedScreenInfo[i].blanked = SCREEN_IS_BLANKED; continue; } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_BLACK)) { savedScreenInfo[i].blanked = SCREEN_IS_BLACK; continue; } } if ((ScreenSaverAllowExposures != DontAllowExposures) && TileScreenSaver(i, SCREEN_IS_TILED)) { savedScreenInfo[i].blanked = SCREEN_IS_TILED; } else savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED; break; } } screenIsSaved = what; } static Bool #if NeedFunctionPrototypes TileScreenSaver(int i, int kind) #else TileScreenSaver(i, kind) int i; int kind; #endif { int j; int result; XID attributes[3]; Mask mask; WindowPtr pWin; CursorMetricRec cm; unsigned char *srcbits, *mskbits; CursorPtr cursor; XID cursorID; int attri; mask = 0; attri = 0; switch (kind) { case SCREEN_IS_TILED: switch (WindowTable[i]->backgroundState) { case BackgroundPixel: attributes[attri++] = WindowTable[i]->background.pixel; mask |= CWBackPixel; break; case BackgroundPixmap: attributes[attri++] = None; mask |= CWBackPixmap; break; default: break; } break; case SCREEN_IS_BLACK: attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; mask |= CWBackPixel; break; } mask |= CWOverrideRedirect; attributes[attri++] = xTrue; /* * create a blank cursor */ cm.width=16; cm.height=16; cm.xhot=8; cm.yhot=8; srcbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); mskbits = (unsigned char *)xalloc( BitmapBytePad(32)*16); if (!srcbits || !mskbits) { xfree(srcbits); xfree(mskbits); cursor = 0; } else { for (j=0; jwidth + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, 0, InputOutput, mask, attributes, 0, serverClient, wVisual (WindowTable[i]), &result); if (cursor) FreeResource (cursorID, RT_NONE); if (!pWin) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)savedScreenInfo[i].pWindow)) return FALSE; if (mask & CWBackPixmap) { MakeRootTile (pWin); (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap); } MapWindow(pWin, serverClient); #ifndef NOLOGOHACK if (kind == SCREEN_IS_TILED && logoScreenSaver) DrawLogo(pWin); #endif return TRUE; } /* * FindWindowWithOptional * * search ancestors of the given window for an entry containing * a WindowOpt structure. Assumptions: some parent will * contain the structure. */ WindowPtr FindWindowWithOptional (w) register WindowPtr w; { do w = w->parent; while (!w->optional); return w; } /* * CheckWindowOptionalNeed * * check each optional entry in the given window to see if * the value is satisfied by the default rules. If so, * release the optional record */ void CheckWindowOptionalNeed (w) register WindowPtr w; { register WindowOptPtr optional; register WindowOptPtr parentOptional; if (!w->parent) return; optional = w->optional; if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate]) return; if (optional->otherEventMasks != 0) return; if (optional->otherClients != NULL) return; if (optional->passiveGrabs != NULL) return; if (optional->userProps != NULL) return; if (optional->backingBitPlanes != ~0L) return; if (optional->backingPixel != 0) return; #ifdef SHAPE if (optional->boundingShape != NULL) return; if (optional->clipShape != NULL) return; #endif #ifdef XINPUT if (optional->inputMasks != NULL) return; #endif parentOptional = FindWindowWithOptional(w)->optional; if (optional->visual != parentOptional->visual) return; if (optional->cursor != None && (optional->cursor != parentOptional->cursor || w->parent->cursorIsNone)) return; if (optional->colormap != parentOptional->colormap) return; DisposeWindowOptional (w); } /* * MakeWindowOptional * * create an optional record and initialize it with the default * values. */ Bool MakeWindowOptional (pWin) register WindowPtr pWin; { register WindowOptPtr optional; register WindowOptPtr parentOptional; if (pWin->optional) return TRUE; optional = (WindowOptPtr) xalloc (sizeof (WindowOptRec)); if (!optional) return FALSE; optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate]; optional->otherEventMasks = 0; optional->otherClients = NULL; optional->passiveGrabs = NULL; optional->userProps = NULL; optional->backingBitPlanes = ~0L; optional->backingPixel = 0; #ifdef SHAPE optional->boundingShape = NULL; optional->clipShape = NULL; #endif #ifdef XINPUT optional->inputMasks = NULL; #endif parentOptional = FindWindowWithOptional(pWin)->optional; optional->visual = parentOptional->visual; if (!pWin->cursorIsNone) { optional->cursor = parentOptional->cursor; optional->cursor->refcnt++; } else { optional->cursor = None; } optional->colormap = parentOptional->colormap; pWin->optional = optional; return TRUE; } void DisposeWindowOptional (pWin) register WindowPtr pWin; { if (!pWin->optional) return; /* * everything is peachy. Delete the optional record * and clean up */ if (pWin->optional->cursor) { FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->cursorIsNone = FALSE; } else pWin->cursorIsNone = TRUE; xfree (pWin->optional); pWin->optional = NULL; } #ifndef NOLOGOHACK static void #if NeedFunctionPrototypes DrawLogo(WindowPtr pWin) #else DrawLogo(pWin) WindowPtr pWin; #endif { DrawablePtr pDraw; ScreenPtr pScreen; int x, y; unsigned int width, height, size; GC *pGC; int thin, gap, d31; DDXPointRec poly[4]; ChangeGCVal fore[2], back[2]; xrgb rgb[2]; BITS32 fmask, bmask; ColormapPtr cmap; pDraw = (DrawablePtr)pWin; pScreen = pDraw->pScreen; x = -pWin->origin.x; y = -pWin->origin.y; width = pScreen->width; height = pScreen->height; pGC = GetScratchGC(pScreen->rootDepth, pScreen); if (!pGC) return; if ((rand() % 100) <= 17) /* make the probability for white fairly low */ fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; if ((pWin->backgroundState == BackgroundPixel) && (cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) { Pixel querypixels[2]; querypixels[0] = fore[0].val; querypixels[1] = pWin->background.pixel; QueryColors(cmap, 2, querypixels, rgb); if ((rgb[0].red == rgb[1].red) && (rgb[0].green == rgb[1].green) && (rgb[0].blue == rgb[1].blue)) { if (fore[0].val == pScreen->blackPixel) fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; } } fore[1].val = FillSolid; fmask = GCForeground|GCFillStyle; if (pWin->backgroundState == BackgroundPixel) { back[0].val = pWin->background.pixel; back[1].val = FillSolid; bmask = GCForeground|GCFillStyle; } else { back[0].val = 0; back[1].val = 0; dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin, NULL, back); back[0].val = FillTiled; back[1].ptr = pWin->background.pixmap; bmask = GCFillStyle|GCTile; } /* should be the same as the reference function XmuDrawLogo() */ size = width; if (height < width) size = height; size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH); size &= ~1; x += rand() % (width - size); y += rand() % (height - size); /* * Draw what will be the thin strokes. * * ----- * / / * / / * / / * / / * /____/ * d * * Point d is 9/44 (~1/5) of the way across. */ thin = (size / 11); if (thin < 1) thin = 1; gap = (thin+3) / 4; d31 = thin + thin + gap; poly[0].x = x + size; poly[0].y = y; poly[1].x = x + size-d31; poly[1].y = y; poly[2].x = x + 0; poly[2].y = y + size; poly[3].x = x + d31; poly[3].y = y + size; dixChangeGC(NullClient, pGC, fmask, NULL, fore); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase area not needed for lower thin stroke. * * ------ * / / * / __ / * / / / * / / / * /__/__/ */ poly[0].x = x + d31/2; poly[0].y = y + size; poly[1].x = x + size / 2; poly[1].y = y + size/2; poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2; poly[3].x = x + d31; poly[3].y = y + size; dixChangeGC(NullClient, pGC, bmask, NULL, back); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase area not needed for upper thin stroke. * * ------ * / / / * /--/ / * / / * / / * /_____/ */ poly[0].x = x + size - d31/2; poly[0].y = y; poly[1].x = x + size / 2; poly[1].y = y + size/2; poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2; poly[3].x = x + size - d31; poly[3].y = y; ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Draw thick stroke. * Point b is 1/4 of the way across. * * b * ----- * \ \ * \ \ * \ \ * \ \ * \____\ */ poly[0].x = x; poly[0].y = y; poly[1].x = x + size/4; poly[1].y = y; poly[2].x = x + size; poly[2].y = y + size; poly[3].x = x + size - size/4; poly[3].y = y + size; dixChangeGC(NullClient, pGC, fmask, NULL, fore); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); /* * Erase to create gap. * * / * / * / * / * / */ poly[0].x = x + size- thin; poly[0].y = y; poly[1].x = x + size-( thin+gap); poly[1].y = y; poly[2].x = x + thin; poly[2].y = y + size; poly[3].x = x + thin + gap; poly[3].y = y + size; dixChangeGC(NullClient, pGC, bmask, NULL, back); ValidateGC(pDraw, pGC); (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly); FreeScratchGC(pGC); } #endif vnc_unixsrc/Xvnc/programs/Xserver/dix/xpstubs.c0100664000076400007640000000304207120677563021352 0ustar constconst/* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: xpstubs.c /main/1 1996/09/28 17:12:15 rws $ */ #include "misc.h" #include "font.h" Bool XpClientIsBitmapClient(client) ClientPtr client; { return TRUE; } Bool XpClientIsPrintClient(client, fpe) ClientPtr client; FontPathElementPtr fpe; { return FALSE; } vnc_unixsrc/Xvnc/programs/Xserver/dix/tables.c0100664000076400007640000003626707120677563021133 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: tables.c,v 1.25 94/04/17 20:26:46 gildea Exp $ */ /* $XFree86: xc/programs/Xserver/dix/tables.c,v 3.1 1996/05/06 05:56:25 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #define NEED_REPLIES #include "Xproto.h" #include "windowstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "dispatch.h" #include "swaprep.h" #include "swapreq.h" #ifdef K5AUTH extern int k5_stage1(), k5_stage2(), k5_stage3(), k5_bad(); #endif int (* InitialVector[3]) ( #if NeedNestedPrototypes ClientPtr /* client */ #endif ) = { 0, ProcInitialConnection, ProcEstablishConnection }; int (* ProcVector[256]) ( #if NeedNestedPrototypes ClientPtr /* client */ #endif ) = { ProcBadRequest, ProcCreateWindow, ProcChangeWindowAttributes, ProcGetWindowAttributes, ProcDestroyWindow, ProcDestroySubwindows, /* 5 */ ProcChangeSaveSet, ProcReparentWindow, ProcMapWindow, ProcMapSubwindows, ProcUnmapWindow, /* 10 */ ProcUnmapSubwindows, ProcConfigureWindow, ProcCirculateWindow, ProcGetGeometry, ProcQueryTree, /* 15 */ ProcInternAtom, ProcGetAtomName, ProcChangeProperty, ProcDeleteProperty, ProcGetProperty, /* 20 */ ProcListProperties, ProcSetSelectionOwner, ProcGetSelectionOwner, ProcConvertSelection, ProcSendEvent, /* 25 */ ProcGrabPointer, ProcUngrabPointer, ProcGrabButton, ProcUngrabButton, ProcChangeActivePointerGrab, /* 30 */ ProcGrabKeyboard, ProcUngrabKeyboard, ProcGrabKey, ProcUngrabKey, ProcAllowEvents, /* 35 */ ProcGrabServer, ProcUngrabServer, ProcQueryPointer, ProcGetMotionEvents, ProcTranslateCoords, /* 40 */ ProcWarpPointer, ProcSetInputFocus, ProcGetInputFocus, ProcQueryKeymap, ProcOpenFont, /* 45 */ ProcCloseFont, ProcQueryFont, ProcQueryTextExtents, ProcListFonts, ProcListFontsWithInfo, /* 50 */ ProcSetFontPath, ProcGetFontPath, ProcCreatePixmap, ProcFreePixmap, ProcCreateGC, /* 55 */ ProcChangeGC, ProcCopyGC, ProcSetDashes, ProcSetClipRectangles, ProcFreeGC, /* 60 */ ProcClearToBackground, ProcCopyArea, ProcCopyPlane, ProcPolyPoint, ProcPolyLine, /* 65 */ ProcPolySegment, ProcPolyRectangle, ProcPolyArc, ProcFillPoly, ProcPolyFillRectangle, /* 70 */ ProcPolyFillArc, ProcPutImage, ProcGetImage, ProcPolyText, ProcPolyText, /* 75 */ ProcImageText8, ProcImageText16, ProcCreateColormap, ProcFreeColormap, ProcCopyColormapAndFree, /* 80 */ ProcInstallColormap, ProcUninstallColormap, ProcListInstalledColormaps, ProcAllocColor, ProcAllocNamedColor, /* 85 */ ProcAllocColorCells, ProcAllocColorPlanes, ProcFreeColors, ProcStoreColors, ProcStoreNamedColor, /* 90 */ ProcQueryColors, ProcLookupColor, ProcCreateCursor, ProcCreateGlyphCursor, ProcFreeCursor, /* 95 */ ProcRecolorCursor, ProcQueryBestSize, ProcQueryExtension, ProcListExtensions, ProcChangeKeyboardMapping, /* 100 */ ProcGetKeyboardMapping, ProcChangeKeyboardControl, ProcGetKeyboardControl, ProcBell, ProcChangePointerControl, /* 105 */ ProcGetPointerControl, ProcSetScreenSaver, ProcGetScreenSaver, ProcChangeHosts, ProcListHosts, /* 110 */ ProcChangeAccessControl, ProcChangeCloseDownMode, ProcKillClient, ProcRotateProperties, ProcForceScreenSaver, /* 115 */ ProcSetPointerMapping, ProcGetPointerMapping, ProcSetModifierMapping, ProcGetModifierMapping, 0, /* 120 */ 0, 0, 0, 0, 0, /* 125 */ 0, ProcNoOperation }; int (* SwappedProcVector[256]) ( #if NeedNestedPrototypes ClientPtr /* client */ #endif ) = { ProcBadRequest, SProcCreateWindow, SProcChangeWindowAttributes, SProcResourceReq, /* GetWindowAttributes */ SProcResourceReq, /* DestroyWindow */ SProcResourceReq, /* 5 DestroySubwindows */ SProcResourceReq, /* SProcChangeSaveSet, */ SProcReparentWindow, SProcResourceReq, /* MapWindow */ SProcResourceReq, /* MapSubwindows */ SProcResourceReq, /* 10 UnmapWindow */ SProcResourceReq, /* UnmapSubwindows */ SProcConfigureWindow, SProcResourceReq, /* SProcCirculateWindow, */ SProcResourceReq, /* GetGeometry */ SProcResourceReq, /* 15 QueryTree */ SProcInternAtom, SProcResourceReq, /* SProcGetAtomName, */ SProcChangeProperty, SProcDeleteProperty, SProcGetProperty, /* 20 */ SProcResourceReq, /* SProcListProperties, */ SProcSetSelectionOwner, SProcResourceReq, /* SProcGetSelectionOwner, */ SProcConvertSelection, SProcSendEvent, /* 25 */ SProcGrabPointer, SProcResourceReq, /* SProcUngrabPointer, */ SProcGrabButton, SProcUngrabButton, SProcChangeActivePointerGrab, /* 30 */ SProcGrabKeyboard, SProcResourceReq, /* SProcUngrabKeyboard, */ SProcGrabKey, SProcUngrabKey, SProcResourceReq, /* 35 SProcAllowEvents, */ SProcSimpleReq, /* SProcGrabServer, */ SProcSimpleReq, /* SProcUngrabServer, */ SProcResourceReq, /* SProcQueryPointer, */ SProcGetMotionEvents, SProcTranslateCoords, /*40 */ SProcWarpPointer, SProcSetInputFocus, SProcSimpleReq, /* SProcGetInputFocus, */ SProcSimpleReq, /* QueryKeymap, */ SProcOpenFont, /* 45 */ SProcResourceReq, /* SProcCloseFont, */ SProcResourceReq, /* SProcQueryFont, */ SProcResourceReq, /* SProcQueryTextExtents, */ SProcListFonts, SProcListFontsWithInfo, /* 50 */ SProcSetFontPath, SProcSimpleReq, /* GetFontPath, */ SProcCreatePixmap, SProcResourceReq, /* SProcFreePixmap, */ SProcCreateGC, /* 55 */ SProcChangeGC, SProcCopyGC, SProcSetDashes, SProcSetClipRectangles, SProcResourceReq, /* 60 SProcFreeGC, */ SProcClearToBackground, SProcCopyArea, SProcCopyPlane, SProcPoly, /* PolyPoint, */ SProcPoly, /* 65 PolyLine */ SProcPoly, /* PolySegment, */ SProcPoly, /* PolyRectangle, */ SProcPoly, /* PolyArc, */ SProcFillPoly, SProcPoly, /* 70 PolyFillRectangle */ SProcPoly, /* PolyFillArc, */ SProcPutImage, SProcGetImage, SProcPolyText, SProcPolyText, /* 75 */ SProcImageText, SProcImageText, SProcCreateColormap, SProcResourceReq, /* SProcFreeColormap, */ SProcCopyColormapAndFree, /* 80 */ SProcResourceReq, /* SProcInstallColormap, */ SProcResourceReq, /* SProcUninstallColormap, */ SProcResourceReq, /* SProcListInstalledColormaps, */ SProcAllocColor, SProcAllocNamedColor, /* 85 */ SProcAllocColorCells, SProcAllocColorPlanes, SProcFreeColors, SProcStoreColors, SProcStoreNamedColor, /* 90 */ SProcQueryColors, SProcLookupColor, SProcCreateCursor, SProcCreateGlyphCursor, SProcResourceReq, /* 95 SProcFreeCursor, */ SProcRecolorCursor, SProcQueryBestSize, SProcQueryExtension, SProcSimpleReq, /* ListExtensions, */ SProcChangeKeyboardMapping, /* 100 */ SProcSimpleReq, /* GetKeyboardMapping, */ SProcChangeKeyboardControl, SProcSimpleReq, /* GetKeyboardControl, */ SProcSimpleReq, /* Bell, */ SProcChangePointerControl, /* 105 */ SProcSimpleReq, /* GetPointerControl, */ SProcSetScreenSaver, SProcSimpleReq, /* GetScreenSaver, */ SProcChangeHosts, SProcSimpleReq, /* 110 ListHosts, */ SProcSimpleReq, /* SProcChangeAccessControl, */ SProcSimpleReq, /* SProcChangeCloseDownMode, */ SProcResourceReq, /* SProcKillClient, */ SProcRotateProperties, SProcSimpleReq, /* 115 ForceScreenSaver */ SProcSimpleReq, /* SetPointerMapping, */ SProcSimpleReq, /* GetPointerMapping, */ SProcSimpleReq, /* SetModifierMapping, */ SProcSimpleReq, /* GetModifierMapping, */ 0, /* 120 */ 0, 0, 0, 0, 0, /* 125 */ 0, SProcNoOperation }; EventSwapPtr EventSwapVector[128] = { (EventSwapPtr)SErrorEvent, NotImplemented, SKeyButtonPtrEvent, SKeyButtonPtrEvent, SKeyButtonPtrEvent, SKeyButtonPtrEvent, /* 5 */ SKeyButtonPtrEvent, SEnterLeaveEvent, SEnterLeaveEvent, SFocusEvent, SFocusEvent, /* 10 */ SKeymapNotifyEvent, SExposeEvent, SGraphicsExposureEvent, SNoExposureEvent, SVisibilityEvent, /* 15 */ SCreateNotifyEvent, SDestroyNotifyEvent, SUnmapNotifyEvent, SMapNotifyEvent, SMapRequestEvent, /* 20 */ SReparentEvent, SConfigureNotifyEvent, SConfigureRequestEvent, SGravityEvent, SResizeRequestEvent, /* 25 */ SCirculateEvent, SCirculateEvent, SPropertyEvent, SSelectionClearEvent, SSelectionRequestEvent, /* 30 */ SSelectionNotifyEvent, SColormapEvent, SClientMessageEvent, SMappingEvent, }; ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetWindowAttributesReply, ReplyNotSwappd, ReplyNotSwappd, /* 5 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 10 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetGeometryReply, (ReplySwapPtr)SQueryTreeReply, /* 15 */ (ReplySwapPtr)SInternAtomReply, (ReplySwapPtr)SGetAtomNameReply, ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetPropertyReply, /* 20 */ (ReplySwapPtr)SListPropertiesReply, ReplyNotSwappd, (ReplySwapPtr)SGetSelectionOwnerReply, ReplyNotSwappd, ReplyNotSwappd, /* 25 */ (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 30 */ (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 35 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SQueryPointerReply, (ReplySwapPtr)SGetMotionEventsReply, (ReplySwapPtr)STranslateCoordsReply, /* 40 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetInputFocusReply, (ReplySwapPtr)SQueryKeymapReply, ReplyNotSwappd, /* 45 */ ReplyNotSwappd, (ReplySwapPtr)SQueryFontReply, (ReplySwapPtr)SQueryTextExtentsReply, (ReplySwapPtr)SListFontsReply, (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */ ReplyNotSwappd, (ReplySwapPtr)SGetFontPathReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 55 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 60 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 65 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 70 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SGetImageReply, ReplyNotSwappd, ReplyNotSwappd, /* 75 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 80 */ ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr)SListInstalledColormapsReply, (ReplySwapPtr)SAllocColorReply, (ReplySwapPtr)SAllocNamedColorReply, /* 85 */ (ReplySwapPtr)SAllocColorCellsReply, (ReplySwapPtr)SAllocColorPlanesReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 90 */ (ReplySwapPtr)SQueryColorsReply, (ReplySwapPtr)SLookupColorReply, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 95 */ ReplyNotSwappd, (ReplySwapPtr)SQueryBestSizeReply, (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */ (ReplySwapPtr)SListExtensionsReply, ReplyNotSwappd, /* 100 */ (ReplySwapPtr)SGetKeyboardMappingReply, ReplyNotSwappd, (ReplySwapPtr)SGetKeyboardControlReply, ReplyNotSwappd, ReplyNotSwappd, /* 105 */ (ReplySwapPtr)SGetPointerControlReply, ReplyNotSwappd, (ReplySwapPtr)SGetScreenSaverReply, ReplyNotSwappd, (ReplySwapPtr)SListHostsReply, /* 110 */ ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 115 */ (ReplySwapPtr)SGenericReply, /* SetPointerMapping */ (ReplySwapPtr)SGetPointerMappingReply, (ReplySwapPtr)SGenericReply, /* SetModifierMapping */ (ReplySwapPtr)SGetModifierMappingReply, /* 119 */ ReplyNotSwappd, /* 120 */ ReplyNotSwappd, /* 121 */ ReplyNotSwappd, /* 122 */ ReplyNotSwappd, /* 123 */ ReplyNotSwappd, /* 124 */ ReplyNotSwappd, /* 125 */ ReplyNotSwappd, /* 126 */ ReplyNotSwappd, /* NoOperation */ ReplyNotSwappd }; #ifdef K5AUTH int (*k5_Vector[256])() = { k5_bad, k5_stage1, k5_bad, k5_stage3 }; #endif vnc_unixsrc/Xvnc/programs/Xserver/dix/colormap.c0100664000076400007640000021643007120677563021465 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: colormap.c /main/71 1996/06/17 11:01:33 mor $ */ /* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.1 1996/12/23 06:29:34 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "misc.h" #include "dix.h" #include "colormapst.h" #include "os.h" #include "scrnintstr.h" #include "resource.h" #include "windowstr.h" extern XID clientErrorValue; static Pixel FindBestPixel( #if NeedFunctionPrototypes EntryPtr /*pentFirst*/, int /*size*/, xrgb * /*prgb*/, int /*channel*/ #endif ); static int AllComp( #if NeedFunctionPrototypes EntryPtr /*pent*/, xrgb * /*prgb*/ #endif ); static int RedComp( #if NeedFunctionPrototypes EntryPtr /*pent*/, xrgb * /*prgb*/ #endif ); static int GreenComp( #if NeedFunctionPrototypes EntryPtr /*pent*/, xrgb * /*prgb*/ #endif ); static int BlueComp( #if NeedFunctionPrototypes EntryPtr /*pent*/, xrgb * /*prgb*/ #endif ); static void FreePixels( #if NeedFunctionPrototypes register ColormapPtr /*pmap*/, register int /*client*/ #endif ); static void CopyFree( #if NeedFunctionPrototypes int /*channel*/, int /*client*/, ColormapPtr /*pmapSrc*/, ColormapPtr /*pmapDst*/ #endif ); static void FreeCell( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, Pixel /*i*/, int /*channel*/ #endif ); static void UpdateColors( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); static int AllocDirect( #if NeedFunctionPrototypes int /*client*/, ColormapPtr /*pmap*/, int /*c*/, int /*r*/, int /*g*/, int /*b*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*prmask*/, Pixel * /*pgmask*/, Pixel * /*pbmask*/ #endif ); static int AllocPseudo( #if NeedFunctionPrototypes int /*client*/, ColormapPtr /*pmap*/, int /*c*/, int /*r*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*pmask*/, Pixel ** /*pppixFirst*/ #endif ); static Bool AllocCP( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, EntryPtr /*pentFirst*/, int /*count*/, int /*planes*/, Bool /*contig*/, Pixel * /*pixels*/, Pixel * /*pMask*/ #endif ); static Bool AllocShared( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, Pixel * /*ppix*/, int /*c*/, int /*r*/, int /*g*/, int /*b*/, Pixel /*rmask*/, Pixel /*gmask*/, Pixel /*bmask*/, Pixel * /*ppixFirst*/ #endif ); static int FreeCo( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*client*/, int /*color*/, int /*npixIn*/, Pixel * /*ppixIn*/, Pixel /*mask*/ #endif ); static int TellNoMap( #if NeedFunctionPrototypes WindowPtr /*pwin*/, Colormap * /*pmid*/ #endif ); #define NUMRED(vis) ((vis->redMask >> vis->offsetRed) + 1) #define NUMGREEN(vis) ((vis->greenMask >> vis->offsetGreen) + 1) #define NUMBLUE(vis) ((vis->blueMask >> vis->offsetBlue) + 1) #define RGBMASK(vis) (vis->redMask | vis->greenMask | vis->blueMask) /* GetNextBitsOrBreak(bits, mask, base) -- * (Suggestion: First read the macro, then read this explanation. * * Either generate the next value to OR in to a pixel or break out of this * while loop * * This macro is used when we're trying to generate all 2^n combinations of * bits in mask. What we're doing here is counting in binary, except that * the bits we use to count may not be contiguous. This macro will be * called 2^n times, returning a different value in bits each time. Then * it will cause us to break out of a surrounding loop. (It will always be * called from within a while loop.) * On call: mask is the value we want to find all the combinations for * base has 1 bit set where the least significant bit of mask is set * * For example,if mask is 01010, base should be 0010 and we count like this: * 00010 (see this isn't so hard), * then we add base to bits and get 0100. (bits & ~mask) is (0100 & 0100) so * we add that to bits getting (0100 + 0100) = * 01000 for our next value. * then we add 0010 to get * 01010 and we're done (easy as 1, 2, 3) */ #define GetNextBitsOrBreak(bits, mask, base) \ if((bits) == (mask)) \ break; \ (bits) += (base); \ while((bits) & ~(mask)) \ (bits) += ((bits) & ~(mask)); /* ID of server as client */ #define SERVER_ID 0 typedef struct _colorResource { Colormap mid; int client; } colorResource; /* Invariants: * refcnt == 0 means entry is empty * refcnt > 0 means entry is useable by many clients, so it can't be changed * refcnt == AllocPrivate means entry owned by one client only * fShared should only be set if refcnt == AllocPrivate, and only in red map */ /* Create and initialize the color map */ int CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client) Colormap mid; /* resource to use for this colormap */ ScreenPtr pScreen; VisualPtr pVisual; ColormapPtr *ppcmap; int alloc; /* 1 iff all entries are allocated writeable */ int client; { int class, size; unsigned long sizebytes; ColormapPtr pmap; register EntryPtr pent; int i; register Pixel *ppix, **pptr; extern int colormapPrivateCount; class = pVisual->class; if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID)) return (BadMatch); size = pVisual->ColormapEntries; sizebytes = (size * sizeof(Entry)) + (MAXCLIENTS * sizeof(Pixel *)) + (MAXCLIENTS * sizeof(int)); if ((class | DynamicClass) == DirectColor) sizebytes *= 3; sizebytes += sizeof(ColormapRec); pmap = (ColormapPtr) xalloc(sizebytes); if (!pmap) return (BadAlloc); pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec)); sizebytes = size * sizeof(Entry); pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes); pmap->numPixelsRed = (int *)((char *)pmap->clientPixelsRed + (MAXCLIENTS * sizeof(Pixel *))); pmap->mid = mid; pmap->flags = 0; /* start out with all flags clear */ if(mid == pScreen->defColormap) pmap->flags |= IsDefault; pmap->pScreen = pScreen; pmap->pVisual = pVisual; pmap->class = class; if ((class | DynamicClass) == DirectColor) size = NUMRED(pVisual); pmap->freeRed = size; bzero ((char *) pmap->red, (int)sizebytes); bzero((char *) pmap->numPixelsRed, MAXCLIENTS * sizeof(int)); for (pptr = &pmap->clientPixelsRed[MAXCLIENTS]; --pptr >= pmap->clientPixelsRed; ) *pptr = (Pixel *)NULL; if (alloc == AllocAll) { if (class & DynamicClass) pmap->flags |= AllAllocated; for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--) pent->refcnt = AllocPrivate; pmap->freeRed = 0; ppix = (Pixel *)xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap); return (BadAlloc); } pmap->clientPixelsRed[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsRed[client] = size; } if ((class | DynamicClass) == DirectColor) { pmap->freeGreen = NUMGREEN(pVisual); pmap->green = (EntryPtr)((char *)pmap->numPixelsRed + (MAXCLIENTS * sizeof(int))); pmap->clientPixelsGreen = (Pixel **)((char *)pmap->green + sizebytes); pmap->numPixelsGreen = (int *)((char *)pmap->clientPixelsGreen + (MAXCLIENTS * sizeof(Pixel *))); pmap->freeBlue = NUMBLUE(pVisual); pmap->blue = (EntryPtr)((char *)pmap->numPixelsGreen + (MAXCLIENTS * sizeof(int))); pmap->clientPixelsBlue = (Pixel **)((char *)pmap->blue + sizebytes); pmap->numPixelsBlue = (int *)((char *)pmap->clientPixelsBlue + (MAXCLIENTS * sizeof(Pixel *))); bzero ((char *) pmap->green, (int)sizebytes); bzero ((char *) pmap->blue, (int)sizebytes); memmove((char *) pmap->clientPixelsGreen, (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *)); memmove((char *) pmap->clientPixelsBlue, (char *) pmap->clientPixelsRed, MAXCLIENTS * sizeof(Pixel *)); bzero((char *) pmap->numPixelsGreen, MAXCLIENTS * sizeof(int)); bzero((char *) pmap->numPixelsBlue, MAXCLIENTS * sizeof(int)); /* If every cell is allocated, mark its refcnt */ if (alloc == AllocAll) { size = pmap->freeGreen; for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--) pent->refcnt = AllocPrivate; pmap->freeGreen = 0; ppix = (Pixel *) xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsRed[client]); xfree(pmap); return(BadAlloc); } pmap->clientPixelsGreen[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsGreen[client] = size; size = pmap->freeBlue; for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--) pent->refcnt = AllocPrivate; pmap->freeBlue = 0; ppix = (Pixel *) xalloc(size * sizeof(Pixel)); if (!ppix) { xfree(pmap->clientPixelsGreen[client]); xfree(pmap->clientPixelsRed[client]); xfree(pmap); return(BadAlloc); } pmap->clientPixelsBlue[client] = ppix; for(i = 0; i < size; i++) ppix[i] = i; pmap->numPixelsBlue[client] = size; } } if (!AddResource(mid, RT_COLORMAP, (pointer)pmap)) return (BadAlloc); /* If the device wants a chance to initialize the colormap in any way, * this is it. In specific, if this is a Static colormap, this is the * time to fill in the colormap's values */ pmap->flags |= BeingCreated; /* * Allocate the array of devPrivate's for this colormap. */ if (colormapPrivateCount == 0) pmap->devPrivates = NULL; else { pmap->devPrivates = (DevUnion *) xalloc ( colormapPrivateCount * sizeof(DevUnion)); if (!pmap->devPrivates) { FreeResource (mid, RT_NONE); return BadAlloc; } } if (!(*pScreen->CreateColormap)(pmap)) { FreeResource (mid, RT_NONE); return BadAlloc; } pmap->flags &= ~BeingCreated; *ppcmap = pmap; return (Success); } int FreeColormap (value, mid) pointer value; /* must conform to DeleteType */ XID mid; { int i; register EntryPtr pent; ColormapPtr pmap = (ColormapPtr)value; if(CLIENT_ID(mid) != SERVER_ID) { (*pmap->pScreen->UninstallColormap) (pmap); WalkTree(pmap->pScreen, (VisitWindowProcPtr)TellNoMap, (pointer) &mid); } /* This is the device's chance to undo anything it needs to, especially * to free any storage it allocated */ (*pmap->pScreen->DestroyColormap)(pmap); if(pmap->clientPixelsRed) { for(i = 0; i < MAXCLIENTS; i++) xfree(pmap->clientPixelsRed[i]); } if ((pmap->class == PseudoColor) || (pmap->class == GrayScale)) { for(pent = &pmap->red[pmap->pVisual->ColormapEntries - 1]; pent >= pmap->red; pent--) { if(pent->fShared) { if (--pent->co.shco.red->refcnt == 0) xfree(pent->co.shco.red); if (--pent->co.shco.green->refcnt == 0) xfree(pent->co.shco.green); if (--pent->co.shco.blue->refcnt == 0) xfree(pent->co.shco.blue); } } } if((pmap->class | DynamicClass) == DirectColor) { for(i = 0; i < MAXCLIENTS; i++) { xfree(pmap->clientPixelsGreen[i]); xfree(pmap->clientPixelsBlue[i]); } } if (pmap->devPrivates) xfree(pmap->devPrivates); xfree(pmap); return(Success); } /* Tell window that pmid has disappeared */ static int TellNoMap (pwin, pmid) WindowPtr pwin; Colormap *pmid; { xEvent xE; if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = None; xE.u.colormap.new = TRUE; xE.u.colormap.state = ColormapUninstalled; DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); if (pwin->optional) { pwin->optional->colormap = None; CheckWindowOptionalNeed (pwin); } } return (WT_WALKCHILDREN); } /* Tell window that pmid got uninstalled */ int TellLostMap (pwin, value) WindowPtr pwin; pointer value; { Colormap *pmid = (Colormap *)value; xEvent xE; if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapUninstalled; DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); } return (WT_WALKCHILDREN); } /* Tell window that pmid got installed */ int TellGainedMap (pwin, value) WindowPtr pwin; pointer value; { Colormap *pmid = (Colormap *)value; xEvent xE; if (wColormap (pwin) == *pmid) { /* This should be call to DeliverEvent */ xE.u.u.type = ColormapNotify; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapInstalled; DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL); } return (WT_WALKCHILDREN); } int CopyColormapAndFree (mid, pSrc, client) Colormap mid; ColormapPtr pSrc; int client; { ColormapPtr pmap = (ColormapPtr) NULL; int result, alloc, size; Colormap midSrc; ScreenPtr pScreen; VisualPtr pVisual; pScreen = pSrc->pScreen; pVisual = pSrc->pVisual; midSrc = pSrc->mid; alloc = ((pSrc->flags & AllAllocated) && CLIENT_ID(midSrc) == client) ? AllocAll : AllocNone; size = pVisual->ColormapEntries; /* If the create returns non-0, it failed */ result = CreateColormap (mid, pScreen, pVisual, &pmap, alloc, client); if(result != Success) return(result); if(alloc == AllocAll) { memmove((char *)pmap->red, (char *)pSrc->red, size * sizeof(Entry)); if((pmap->class | DynamicClass) == DirectColor) { memmove((char *)pmap->green, (char *)pSrc->green, size * sizeof(Entry)); memmove((char *)pmap->blue, (char *)pSrc->blue, size * sizeof(Entry)); } pSrc->flags &= ~AllAllocated; FreePixels(pSrc, client); UpdateColors(pmap); return(Success); } CopyFree(REDMAP, client, pSrc, pmap); if ((pmap->class | DynamicClass) == DirectColor) { CopyFree(GREENMAP, client, pSrc, pmap); CopyFree(BLUEMAP, client, pSrc, pmap); } if (pmap->class & DynamicClass) UpdateColors(pmap); /* XXX should worry about removing any RT_CMAPENTRY resource */ return(Success); } /* Helper routine for freeing large numbers of cells from a map */ static void CopyFree (channel, client, pmapSrc, pmapDst) int channel, client; ColormapPtr pmapSrc, pmapDst; { int z, npix, oldFree; EntryPtr pentSrcFirst, pentDstFirst; EntryPtr pentSrc, pentDst; Pixel *ppix; int nalloc; switch(channel) { default: /* so compiler can see that everything gets initialized */ case REDMAP: ppix = (pmapSrc->clientPixelsRed)[client]; npix = (pmapSrc->numPixelsRed)[client]; pentSrcFirst = pmapSrc->red; pentDstFirst = pmapDst->red; oldFree = pmapSrc->freeRed; break; case GREENMAP: ppix = (pmapSrc->clientPixelsGreen)[client]; npix = (pmapSrc->numPixelsGreen)[client]; pentSrcFirst = pmapSrc->green; pentDstFirst = pmapDst->green; oldFree = pmapSrc->freeGreen; break; case BLUEMAP: ppix = (pmapSrc->clientPixelsBlue)[client]; npix = (pmapSrc->numPixelsBlue)[client]; pentSrcFirst = pmapSrc->blue; pentDstFirst = pmapDst->blue; oldFree = pmapSrc->freeBlue; break; } nalloc = 0; if (pmapSrc->class & DynamicClass) { for(z = npix; --z >= 0; ppix++) { /* Copy entries */ pentSrc = pentSrcFirst + *ppix; pentDst = pentDstFirst + *ppix; if (pentDst->refcnt > 0) { pentDst->refcnt++; } else { *pentDst = *pentSrc; nalloc++; if (pentSrc->refcnt > 0) pentDst->refcnt = 1; else pentSrc->fShared = FALSE; } FreeCell(pmapSrc, *ppix, channel); } } /* Note that FreeCell has already fixed pmapSrc->free{Color} */ switch(channel) { case REDMAP: pmapDst->freeRed -= nalloc; (pmapDst->clientPixelsRed)[client] = (pmapSrc->clientPixelsRed)[client]; (pmapSrc->clientPixelsRed)[client] = (Pixel *) NULL; (pmapDst->numPixelsRed)[client] = (pmapSrc->numPixelsRed)[client]; (pmapSrc->numPixelsRed)[client] = 0; break; case GREENMAP: pmapDst->freeGreen -= nalloc; (pmapDst->clientPixelsGreen)[client] = (pmapSrc->clientPixelsGreen)[client]; (pmapSrc->clientPixelsGreen)[client] = (Pixel *) NULL; (pmapDst->numPixelsGreen)[client] = (pmapSrc->numPixelsGreen)[client]; (pmapSrc->numPixelsGreen)[client] = 0; break; case BLUEMAP: pmapDst->freeBlue -= nalloc; pmapDst->clientPixelsBlue[client] = pmapSrc->clientPixelsBlue[client]; pmapSrc->clientPixelsBlue[client] = (Pixel *) NULL; pmapDst->numPixelsBlue[client] = pmapSrc->numPixelsBlue[client]; pmapSrc->numPixelsBlue[client] = 0; break; } } /* Free the ith entry in a color map. Must handle freeing of * colors allocated through AllocColorPlanes */ static void FreeCell (pmap, i, channel) ColormapPtr pmap; Pixel i; int channel; { EntryPtr pent; int *pCount; switch (channel) { default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: case REDMAP: pent = (EntryPtr) &pmap->red[i]; pCount = &pmap->freeRed; break; case GREENMAP: pent = (EntryPtr) &pmap->green[i]; pCount = &pmap->freeGreen; break; case BLUEMAP: pent = (EntryPtr) &pmap->blue[i]; pCount = &pmap->freeBlue; break; } /* If it's not privately allocated and it's not time to free it, just * decrement the count */ if (pent->refcnt > 1) pent->refcnt--; else { /* If the color type is shared, find the sharedcolor. If decremented * refcnt is 0, free the shared cell. */ if (pent->fShared) { if(--pent->co.shco.red->refcnt == 0) xfree(pent->co.shco.red); if(--pent->co.shco.green->refcnt == 0) xfree(pent->co.shco.green); if(--pent->co.shco.blue->refcnt == 0) xfree(pent->co.shco.blue); pent->fShared = FALSE; } pent->refcnt = 0; *pCount += 1; } } static void UpdateColors (pmap) ColormapPtr pmap; { xColorItem *defs; register xColorItem *pdef; register EntryPtr pent; register VisualPtr pVisual; int i, n, size; pVisual = pmap->pVisual; size = pVisual->ColormapEntries; defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem)); if (!defs) return; n = 0; pdef = defs; if (pmap->class == DirectColor) { for (i = 0; i < size; i++) { if (!pmap->red[i].refcnt && !pmap->green[i].refcnt && !pmap->blue[i].refcnt) continue; pdef->pixel = ((Pixel)i << pVisual->offsetRed) | ((Pixel)i << pVisual->offsetGreen) | ((Pixel)i << pVisual->offsetBlue); pdef->red = pmap->red[i].co.local.red; pdef->green = pmap->green[i].co.local.green; pdef->blue = pmap->blue[i].co.local.blue; pdef->flags = DoRed|DoGreen|DoBlue; pdef++; n++; } } else { for (i = 0, pent = pmap->red; i < size; i++, pent++) { if (!pent->refcnt) continue; pdef->pixel = i; if(pent->fShared) { pdef->red = pent->co.shco.red->color; pdef->green = pent->co.shco.green->color; pdef->blue = pent->co.shco.blue->color; } else { pdef->red = pent->co.local.red; pdef->green = pent->co.local.green; pdef->blue = pent->co.local.blue; } pdef->flags = DoRed|DoGreen|DoBlue; pdef++; n++; } } if (n) (*pmap->pScreen->StoreColors)(pmap, n, defs); DEALLOCATE_LOCAL(defs); } /* Get a read-only color from a ColorMap (probably slow for large maps) * Returns by changing the value in pred, pgreen, pblue and pPix */ int AllocColor (pmap, pred, pgreen, pblue, pPix, client) ColormapPtr pmap; unsigned short *pred, *pgreen, *pblue; Pixel *pPix; int client; { Pixel pixR, pixG, pixB; int entries; xrgb rgb; int class; VisualPtr pVisual; int npix; Pixel *ppix; pVisual = pmap->pVisual; (*pmap->pScreen->ResolveColor) (pred, pgreen, pblue, pVisual); rgb.red = *pred; rgb.green = *pgreen; rgb.blue = *pblue; class = pmap->class; entries = pVisual->ColormapEntries; /* If the colormap is being created, then we want to be able to change * the colormap, even if it's a static type. Otherwise, we'd never be * able to initialize static colormaps */ if(pmap->flags & BeingCreated) class |= DynamicClass; /* If this is one of the static storage classes, and we're not initializing * it, the best we can do is to find the closest color entry to the * requested one and return that. */ switch (class) { case StaticColor: case StaticGray: /* Look up all three components in the same pmap */ *pPix = pixR = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP); *pred = pmap->red[pixR].co.local.red; *pgreen = pmap->red[pixR].co.local.green; *pblue = pmap->red[pixR].co.local.blue; npix = pmap->numPixelsRed[client]; ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixR; pmap->clientPixelsRed[client] = ppix; pmap->numPixelsRed[client]++; break; case TrueColor: /* Look up each component in its own map, then OR them together */ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP); pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP); pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP); *pPix = (pixR << pVisual->offsetRed) | (pixG << pVisual->offsetGreen) | (pixB << pVisual->offsetBlue); *pred = pmap->red[pixR].co.local.red; *pgreen = pmap->green[pixG].co.local.green; *pblue = pmap->blue[pixB].co.local.blue; npix = pmap->numPixelsRed[client]; ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixR; pmap->clientPixelsRed[client] = ppix; npix = pmap->numPixelsGreen[client]; ppix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixG; pmap->clientPixelsGreen[client] = ppix; npix = pmap->numPixelsBlue[client]; ppix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client], (npix + 1) * sizeof(Pixel)); if (!ppix) return (BadAlloc); ppix[npix] = pixB; pmap->clientPixelsBlue[client] = ppix; pmap->numPixelsRed[client]++; pmap->numPixelsGreen[client]++; pmap->numPixelsBlue[client]++; break; case GrayScale: case PseudoColor: if (FindColor(pmap, pmap->red, entries, &rgb, pPix, PSEUDOMAP, client, AllComp) != Success) return (BadAlloc); break; case DirectColor: pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed; if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP, client, RedComp) != Success) return (BadAlloc); pixG = (*pPix & pVisual->greenMask) >> pVisual->offsetGreen; if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG, GREENMAP, client, GreenComp) != Success) { (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0); return (BadAlloc); } pixB = (*pPix & pVisual->blueMask) >> pVisual->offsetBlue; if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP, client, BlueComp) != Success) { (void)FreeCo(pmap, client, GREENMAP, 1, &pixG, (Pixel)0); (void)FreeCo(pmap, client, REDMAP, 1, &pixR, (Pixel)0); return (BadAlloc); } *pPix = pixR | pixG | pixB; break; } /* if this is the client's first pixel in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((pmap->numPixelsRed[client] == 1) && (CLIENT_ID(pmap->mid) != client) && !(pmap->flags & BeingCreated)) { colorResource *pcr; pcr = (colorResource *) xalloc(sizeof(colorResource)); if (!pcr) { (void)FreeColors(pmap, client, 1, pPix, (Pixel)0); return (BadAlloc); } pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) return (BadAlloc); } return (Success); } /* * FakeAllocColor -- fake an AllocColor request by * returning a free pixel if availible, otherwise returning * the closest matching pixel. This is used by the mi * software sprite code to recolor cursors. A nice side-effect * is that this routine will never return failure. */ void FakeAllocColor (pmap, item) register ColormapPtr pmap; register xColorItem *item; { Pixel pixR, pixG, pixB; Pixel temp; int entries; xrgb rgb; int class; register VisualPtr pVisual; pVisual = pmap->pVisual; rgb.red = item->red; rgb.green = item->green; rgb.blue = item->blue; (*pmap->pScreen->ResolveColor) (&rgb.red, &rgb.green, &rgb.blue, pVisual); class = pmap->class; entries = pVisual->ColormapEntries; switch (class) { case GrayScale: case PseudoColor: item->pixel = 0; if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP, -1, AllComp) == Success) { item->pixel = temp; break; } /* fall through ... */ case StaticColor: case StaticGray: item->pixel = FindBestPixel(pmap->red, entries, &rgb, PSEUDOMAP); break; case DirectColor: /* Look up each component in its own map, then OR them together */ pixR = (item->pixel & pVisual->redMask) >> pVisual->offsetRed; pixG = (item->pixel & pVisual->greenMask) >> pVisual->offsetGreen; pixB = (item->pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (FindColor(pmap, pmap->red, NUMRED(pVisual), &rgb, &pixR, REDMAP, -1, RedComp) != Success) pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP) << pVisual->offsetRed; if (FindColor(pmap, pmap->green, NUMGREEN(pVisual), &rgb, &pixG, GREENMAP, -1, GreenComp) != Success) pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP) << pVisual->offsetGreen; if (FindColor(pmap, pmap->blue, NUMBLUE(pVisual), &rgb, &pixB, BLUEMAP, -1, BlueComp) != Success) pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP) << pVisual->offsetBlue; item->pixel = pixR | pixG | pixB; break; case TrueColor: /* Look up each component in its own map, then OR them together */ pixR = FindBestPixel(pmap->red, NUMRED(pVisual), &rgb, REDMAP); pixG = FindBestPixel(pmap->green, NUMGREEN(pVisual), &rgb, GREENMAP); pixB = FindBestPixel(pmap->blue, NUMBLUE(pVisual), &rgb, BLUEMAP); item->pixel = (pixR << pVisual->offsetRed) | (pixG << pVisual->offsetGreen) | (pixB << pVisual->offsetBlue); break; } } /* free a pixel value obtained from FakeAllocColor */ void FakeFreeColor(pmap, pixel) register ColormapPtr pmap; Pixel pixel; { register VisualPtr pVisual; Pixel pixR, pixG, pixB; switch (pmap->class) { case GrayScale: case PseudoColor: if (pmap->red[pixel].refcnt == AllocTemporary) pmap->red[pixel].refcnt = 0; break; case DirectColor: pVisual = pmap->pVisual; pixR = (pixel & pVisual->redMask) >> pVisual->offsetRed; pixG = (pixel & pVisual->greenMask) >> pVisual->offsetGreen; pixB = (pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (pmap->red[pixR].refcnt == AllocTemporary) pmap->red[pixR].refcnt = 0; if (pmap->green[pixG].refcnt == AllocTemporary) pmap->green[pixG].refcnt = 0; if (pmap->blue[pixB].refcnt == AllocTemporary) pmap->blue[pixB].refcnt = 0; break; } } typedef unsigned short BigNumUpper; typedef unsigned long BigNumLower; #define BIGNUMLOWERBITS 24 #define BIGNUMUPPERBITS 16 #define BIGNUMLOWER (1 << BIGNUMLOWERBITS) #define BIGNUMUPPER (1 << BIGNUMUPPERBITS) #define UPPERPART(i) ((i) >> BIGNUMLOWERBITS) #define LOWERPART(i) ((i) & (BIGNUMLOWER - 1)) typedef struct _bignum { BigNumUpper upper; BigNumLower lower; } BigNumRec, *BigNumPtr; #define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\ ((x)->upper == (y)->upper && (x)->lower > (y)->lower)) #define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \ ((r)->lower = LOWERPART(u))) #define MaxBigNum(r) (((r)->upper = BIGNUMUPPER-1), \ ((r)->lower = BIGNUMLOWER-1)) static void #if NeedFunctionPrototypes BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r) #else BigNumAdd (x, y, r) BigNumPtr x, y, r; #endif { BigNumLower lower, carry = 0; lower = x->lower + y->lower; if (lower >= BIGNUMLOWER) { lower -= BIGNUMLOWER; carry = 1; } r->lower = lower; r->upper = x->upper + y->upper + carry; } static Pixel FindBestPixel(pentFirst, size, prgb, channel) EntryPtr pentFirst; int size; xrgb *prgb; int channel; { EntryPtr pent; Pixel pixel, final; long dr, dg, db; unsigned long sq; BigNumRec minval, sum, temp; final = 0; MaxBigNum(&minval); /* look for the minimal difference */ for (pent = pentFirst, pixel = 0; pixel < size; pent++, pixel++) { dr = dg = db = 0; switch(channel) { case PSEUDOMAP: dg = pent->co.local.green - prgb->green; db = pent->co.local.blue - prgb->blue; case REDMAP: dr = pent->co.local.red - prgb->red; break; case GREENMAP: dg = pent->co.local.green - prgb->green; break; case BLUEMAP: db = pent->co.local.blue - prgb->blue; break; } sq = dr * dr; UnsignedToBigNum (sq, &sum); sq = dg * dg; UnsignedToBigNum (sq, &temp); BigNumAdd (&sum, &temp, &sum); sq = db * db; UnsignedToBigNum (sq, &temp); BigNumAdd (&sum, &temp, &sum); if (BigNumGreater (&minval, &sum)) { final = pixel; minval = sum; } } return(final); } /* Tries to find a color in pmap that exactly matches the one requested in prgb * if it can't it allocates one. * Starts looking at pentFirst + *pPixel, so if you want a specific pixel, * load *pPixel with that value, otherwise set it to 0 */ int FindColor (pmap, pentFirst, size, prgb, pPixel, channel, client, comp) ColormapPtr pmap; EntryPtr pentFirst; int size; xrgb *prgb; Pixel *pPixel; int channel; int client; ColorCompareProcPtr comp; { EntryPtr pent; Bool foundFree; Pixel pixel, Free; int npix, count, *nump; Pixel **pixp, *ppix; xColorItem def; foundFree = FALSE; if((pixel = *pPixel) >= size) pixel = 0; /* see if there is a match, and also look for a free entry */ for (pent = pentFirst + pixel, count = size; --count >= 0; ) { if (pent->refcnt > 0) { if ((*comp) (pent, prgb)) { if (client >= 0) pent->refcnt++; *pPixel = pixel; switch(channel) { case REDMAP: *pPixel <<= pmap->pVisual->offsetRed; case PSEUDOMAP: break; case GREENMAP: *pPixel <<= pmap->pVisual->offsetGreen; break; case BLUEMAP: *pPixel <<= pmap->pVisual->offsetBlue; break; } goto gotit; } } else if (!foundFree && pent->refcnt == 0) { Free = pixel; foundFree = TRUE; /* If we're initializing the colormap, then we are looking for * the first free cell we can find, not to minimize the number * of entries we use. So don't look any further. */ if(pmap->flags & BeingCreated) break; } pixel++; if(pixel >= size) { pent = pentFirst; pixel = 0; } else pent++; } /* If we got here, we didn't find a match. If we also didn't find * a free entry, we're out of luck. Otherwise, we'll usurp a free * entry and fill it in */ if (!foundFree) return (BadAlloc); pent = pentFirst + Free; pent->fShared = FALSE; pent->refcnt = (client >= 0) ? 1 : AllocTemporary; switch (channel) { case PSEUDOMAP: pent->co.local.red = prgb->red; pent->co.local.green = prgb->green; pent->co.local.blue = prgb->blue; def.red = prgb->red; def.green = prgb->green; def.blue = prgb->blue; def.flags = (DoRed|DoGreen|DoBlue); if (client >= 0) pmap->freeRed--; def.pixel = Free; break; case REDMAP: pent->co.local.red = prgb->red; def.red = prgb->red; def.green = pmap->green[0].co.local.green; def.blue = pmap->blue[0].co.local.blue; def.flags = DoRed; if (client >= 0) pmap->freeRed--; def.pixel = Free << pmap->pVisual->offsetRed; break; case GREENMAP: pent->co.local.green = prgb->green; def.red = pmap->red[0].co.local.red; def.green = prgb->green; def.blue = pmap->blue[0].co.local.blue; def.flags = DoGreen; if (client >= 0) pmap->freeGreen--; def.pixel = Free << pmap->pVisual->offsetGreen; break; case BLUEMAP: pent->co.local.blue = prgb->blue; def.red = pmap->red[0].co.local.red; def.green = pmap->green[0].co.local.green; def.blue = prgb->blue; def.flags = DoBlue; if (client >= 0) pmap->freeBlue--; def.pixel = Free << pmap->pVisual->offsetBlue; break; } (*pmap->pScreen->StoreColors) (pmap, 1, &def); pixel = Free; *pPixel = def.pixel; gotit: if (pmap->flags & BeingCreated || client == -1) return(Success); /* Now remember the pixel, for freeing later */ switch (channel) { case PSEUDOMAP: case REDMAP: nump = pmap->numPixelsRed; pixp = pmap->clientPixelsRed; break; case GREENMAP: nump = pmap->numPixelsGreen; pixp = pmap->clientPixelsGreen; break; case BLUEMAP: nump = pmap->numPixelsBlue; pixp = pmap->clientPixelsBlue; break; } npix = nump[client]; ppix = (Pixel *) xrealloc (pixp[client], (npix + 1) * sizeof(Pixel)); if (!ppix) { pent->refcnt--; if (!pent->fShared) switch (channel) { case PSEUDOMAP: case REDMAP: pmap->freeRed++; break; case GREENMAP: pmap->freeGreen++; break; case BLUEMAP: pmap->freeBlue++; break; } return(BadAlloc); } ppix[npix] = pixel; pixp[client] = ppix; nump[client]++; return(Success); } /* Comparison functions -- passed to FindColor to determine if an * entry is already the color we're looking for or not */ static int AllComp (pent, prgb) EntryPtr pent; xrgb *prgb; { if((pent->co.local.red == prgb->red) && (pent->co.local.green == prgb->green) && (pent->co.local.blue == prgb->blue) ) return (1); return (0); } static int RedComp (pent, prgb) EntryPtr pent; xrgb *prgb; { if (pent->co.local.red == prgb->red) return (1); return (0); } static int GreenComp (pent, prgb) EntryPtr pent; xrgb *prgb; { if (pent->co.local.green == prgb->green) return (1); return (0); } static int BlueComp (pent, prgb) EntryPtr pent; xrgb *prgb; { if (pent->co.local.blue == prgb->blue) return (1); return (0); } /* Read the color value of a cell */ int QueryColors (pmap, count, ppixIn, prgbList) ColormapPtr pmap; int count; Pixel *ppixIn; xrgb *prgbList; { Pixel *ppix, pixel; xrgb *prgb; VisualPtr pVisual; EntryPtr pent; Pixel i; int errVal = Success; pVisual = pmap->pVisual; if ((pmap->class | DynamicClass) == DirectColor) { int numred, numgreen, numblue; Pixel rgbbad; numred = NUMRED(pVisual); numgreen = NUMGREEN(pVisual); numblue = NUMBLUE(pVisual); rgbbad = ~RGBMASK(pVisual); for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) { pixel = *ppix; if (pixel & rgbbad) { clientErrorValue = pixel; errVal = BadValue; continue; } i = (pixel & pVisual->redMask) >> pVisual->offsetRed; if (i >= numred) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->red = pmap->red[i].co.local.red; i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen; if (i >= numgreen) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->green = pmap->green[i].co.local.green; i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (i >= numblue) { clientErrorValue = pixel; errVal = BadValue; continue; } prgb->blue = pmap->blue[i].co.local.blue; } } else { for( ppix = ppixIn, prgb = prgbList; --count >= 0; ppix++, prgb++) { pixel = *ppix; if (pixel >= pVisual->ColormapEntries) { clientErrorValue = pixel; errVal = BadValue; } else { pent = (EntryPtr)&pmap->red[pixel]; if (pent->fShared) { prgb->red = pent->co.shco.red->color; prgb->green = pent->co.shco.green->color; prgb->blue = pent->co.shco.blue->color; } else { prgb->red = pent->co.local.red; prgb->green = pent->co.local.green; prgb->blue = pent->co.local.blue; } } } } return (errVal); } static void FreePixels(pmap, client) register ColormapPtr pmap; register int client; { register Pixel *ppix, *ppixStart; register int n; int class; #ifdef LBX Bool grabbed; Bool zeroRefCount; Bool anyRefCountReachedZero = 0; #endif class = pmap->class; ppixStart = pmap->clientPixelsRed[client]; if (class & DynamicClass) { n = pmap->numPixelsRed[client]; #ifdef LBX grabbed = LbxCheckCmapGrabbed (pmap); if (grabbed) { /* * If the colormap is grabbed by a proxy, the server must * notify the proxy of all cells that are freed (the refcount * has reached zero on these cells). */ LbxBeginFreeCellsEvent (pmap); LbxSortPixelList (ppixStart, n); } #endif for (ppix = ppixStart; --n >= 0; ) { FreeCell(pmap, *ppix, REDMAP); #ifdef LBX /* * Only PSEUDO colormaps are grabbed by LBX proxies. * Check if the ref count reached zero on this pixel. */ zeroRefCount = pmap->red[*ppix].refcnt == 0; if (zeroRefCount) anyRefCountReachedZero = 1; if (grabbed && zeroRefCount) LbxAddFreeCellToEvent (pmap, *ppix); #endif ppix++; } #ifdef LBX if (grabbed) LbxEndFreeCellsEvent (pmap); else if (anyRefCountReachedZero) { /* * We only send LbxFreeCell events to a proxy that has the colormap * grabbed. If the colormap is not grabbed, the proxy that last * had the colormap grabbed will not be able to do a smart grab * in the future. A smart grab can only occur if the proxy is kept * up to date on every alloc/free change in the colormap. */ LbxDisableSmartGrab (pmap); } #endif } xfree(ppixStart); pmap->clientPixelsRed[client] = (Pixel *) NULL; pmap->numPixelsRed[client] = 0; if ((class | DynamicClass) == DirectColor) { ppixStart = pmap->clientPixelsGreen[client]; if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;) FreeCell(pmap, *ppix++, GREENMAP); xfree(ppixStart); pmap->clientPixelsGreen[client] = (Pixel *) NULL; pmap->numPixelsGreen[client] = 0; ppixStart = pmap->clientPixelsBlue[client]; if (class & DynamicClass) for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; ) FreeCell(pmap, *ppix++, BLUEMAP); xfree(ppixStart); pmap->clientPixelsBlue[client] = (Pixel *) NULL; pmap->numPixelsBlue[client] = 0; } } /* Free all of a client's colors and cells */ /*ARGSUSED*/ int FreeClientPixels (value, fakeid) pointer value; /* must conform to DeleteType */ XID fakeid; { ColormapPtr pmap; colorResource *pcr = (colorResource *)value; pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP); if (pmap) FreePixels(pmap, pcr->client); xfree(pcr); return Success; } int AllocColorCells (client, pmap, colors, planes, contig, ppix, masks) int client; ColormapPtr pmap; int colors, planes; Bool contig; Pixel *ppix; Pixel *masks; { Pixel rmask, gmask, bmask, *ppixFirst, r, g, b; int n, class; int ok; int oldcount; colorResource *pcr = (colorResource *)NULL; class = pmap->class; if (!(class & DynamicClass)) return (BadAlloc); /* Shouldn't try on this type */ oldcount = pmap->numPixelsRed[client]; if (pmap->class == DirectColor) oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { pcr = (colorResource *) xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } if (pmap->class == DirectColor) { ok = AllocDirect (client, pmap, colors, planes, planes, planes, contig, ppix, &rmask, &gmask, &bmask); if(ok == Success) { for (r = g = b = 1, n = planes; --n >= 0; r += r, g += g, b += b) { while(!(rmask & r)) r += r; while(!(gmask & g)) g += g; while(!(bmask & b)) b += b; *masks++ = r | g | b; } } } else { ok = AllocPseudo (client, pmap, colors, planes, contig, ppix, &rmask, &ppixFirst); if(ok == Success) { for (r = 1, n = planes; --n >= 0; r += r) { while(!(rmask & r)) r += r; *masks++ = r; } } } /* if this is the client's first pixels in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) ok = BadAlloc; } else if (pcr) xfree(pcr); return (ok); } int AllocColorPlanes (client, pmap, colors, r, g, b, contig, pixels, prmask, pgmask, pbmask) int client; ColormapPtr pmap; int colors, r, g, b; Bool contig; Pixel *pixels; Pixel *prmask, *pgmask, *pbmask; { int ok; Pixel mask, *ppixFirst; register Pixel shift; register int i; int class; int oldcount; colorResource *pcr = (colorResource *)NULL; class = pmap->class; if (!(class & DynamicClass)) return (BadAlloc); /* Shouldn't try on this type */ oldcount = pmap->numPixelsRed[client]; if (class == DirectColor) oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client]; if (!oldcount && (CLIENT_ID(pmap->mid) != client)) { pcr = (colorResource *) xalloc(sizeof(colorResource)); if (!pcr) return (BadAlloc); } if (class == DirectColor) { ok = AllocDirect (client, pmap, colors, r, g, b, contig, pixels, prmask, pgmask, pbmask); } else { /* Allocate the proper pixels */ /* XXX This is sort of bad, because of contig is set, we force all * r + g + b bits to be contiguous. Should only force contiguity * per mask */ ok = AllocPseudo (client, pmap, colors, r + g + b, contig, pixels, &mask, &ppixFirst); if(ok == Success) { /* now split that mask into three */ *prmask = *pgmask = *pbmask = 0; shift = 1; for (i = r; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *prmask |= shift; } for (i = g; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *pgmask |= shift; } for (i = b; --i >= 0; shift += shift) { while (!(mask & shift)) shift += shift; *pbmask |= shift; } /* set up the shared color cells */ if (!AllocShared(pmap, pixels, colors, r, g, b, *prmask, *pgmask, *pbmask, ppixFirst)) { (void)FreeColors(pmap, client, colors, pixels, mask); ok = BadAlloc; } } } /* if this is the client's first pixels in this colormap, tell the * resource manager that the client has pixels in this colormap which * should be freed when the client dies */ if ((ok == Success) && pcr) { pcr->mid = pmap->mid; pcr->client = client; if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr)) ok = BadAlloc; } else if (pcr) xfree(pcr); return (ok); } static int AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask) int client; ColormapPtr pmap; int c, r, g, b; Bool contig; Pixel *pixels; Pixel *prmask, *pgmask, *pbmask; { Pixel *ppixRed, *ppixGreen, *ppixBlue; Pixel *ppix, *pDst, *p; int npix, npixR, npixG, npixB; Bool okR, okG, okB; Pixel *rpix = 0, *gpix = 0, *bpix = 0; npixR = c << r; npixG = c << g; npixB = c << b; if ((r >= 32) || (g >= 32) || (b >= 32) || (npixR > pmap->freeRed) || (npixR < c) || (npixG > pmap->freeGreen) || (npixG < c) || (npixB > pmap->freeBlue) || (npixB < c)) return BadAlloc; /* start out with empty pixels */ for(p = pixels; p < pixels + c; p++) *p = 0; ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel)); ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel)); ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel)); if (!ppixRed || !ppixGreen || !ppixBlue) { if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue); if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen); if (ppixRed) DEALLOCATE_LOCAL(ppixRed); return(BadAlloc); } okR = AllocCP(pmap, pmap->red, c, r, contig, ppixRed, prmask); okG = AllocCP(pmap, pmap->green, c, g, contig, ppixGreen, pgmask); okB = AllocCP(pmap, pmap->blue, c, b, contig, ppixBlue, pbmask); if (okR && okG && okB) { rpix = (Pixel *) xrealloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + (c << r)) * sizeof(Pixel)); if (rpix) pmap->clientPixelsRed[client] = rpix; gpix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client], (pmap->numPixelsGreen[client] + (c << g)) * sizeof(Pixel)); if (gpix) pmap->clientPixelsGreen[client] = gpix; bpix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client], (pmap->numPixelsBlue[client] + (c << b)) * sizeof(Pixel)); if (bpix) pmap->clientPixelsBlue[client] = bpix; } if (!okR || !okG || !okB || !rpix || !gpix || !bpix) { if (okR) for(ppix = ppixRed, npix = npixR; --npix >= 0; ppix++) pmap->red[*ppix].refcnt = 0; if (okG) for(ppix = ppixGreen, npix = npixG; --npix >= 0; ppix++) pmap->green[*ppix].refcnt = 0; if (okB) for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++) pmap->blue[*ppix].refcnt = 0; DEALLOCATE_LOCAL(ppixBlue); DEALLOCATE_LOCAL(ppixGreen); DEALLOCATE_LOCAL(ppixRed); return(BadAlloc); } *prmask <<= pmap->pVisual->offsetRed; *pgmask <<= pmap->pVisual->offsetGreen; *pbmask <<= pmap->pVisual->offsetBlue; ppix = rpix + pmap->numPixelsRed[client]; for (pDst = pixels, p = ppixRed; p < ppixRed + npixR; p++) { *ppix++ = *p; if(p < ppixRed + c) *pDst++ |= *p << pmap->pVisual->offsetRed; } pmap->numPixelsRed[client] += npixR; pmap->freeRed -= npixR; ppix = gpix + pmap->numPixelsGreen[client]; for (pDst = pixels, p = ppixGreen; p < ppixGreen + npixG; p++) { *ppix++ = *p; if(p < ppixGreen + c) *pDst++ |= *p << pmap->pVisual->offsetGreen; } pmap->numPixelsGreen[client] += npixG; pmap->freeGreen -= npixG; ppix = bpix + pmap->numPixelsBlue[client]; for (pDst = pixels, p = ppixBlue; p < ppixBlue + npixB; p++) { *ppix++ = *p; if(p < ppixBlue + c) *pDst++ |= *p << pmap->pVisual->offsetBlue; } pmap->numPixelsBlue[client] += npixB; pmap->freeBlue -= npixB; DEALLOCATE_LOCAL(ppixBlue); DEALLOCATE_LOCAL(ppixGreen); DEALLOCATE_LOCAL(ppixRed); return (Success); } static int AllocPseudo (client, pmap, c, r, contig, pixels, pmask, pppixFirst) int client; ColormapPtr pmap; int c, r; Bool contig; Pixel *pixels; Pixel *pmask; Pixel **pppixFirst; { Pixel *ppix, *p, *pDst, *ppixTemp; int npix; Bool ok; npix = c << r; if ((r >= 32) || (npix > pmap->freeRed) || (npix < c)) return(BadAlloc); if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel)))) return(BadAlloc); ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask); if (ok) { /* all the allocated pixels are added to the client pixel list, * but only the unique ones are returned to the client */ ppix = (Pixel *)xrealloc(pmap->clientPixelsRed[client], (pmap->numPixelsRed[client] + npix) * sizeof(Pixel)); if (!ppix) { for (p = ppixTemp; p < ppixTemp + npix; p++) pmap->red[*p].refcnt = 0; return (BadAlloc); } pmap->clientPixelsRed[client] = ppix; ppix += pmap->numPixelsRed[client]; *pppixFirst = ppix; pDst = pixels; for (p = ppixTemp; p < ppixTemp + npix; p++) { *ppix++ = *p; if(p < ppixTemp + c) *pDst++ = *p; } pmap->numPixelsRed[client] += npix; pmap->freeRed -= npix; } DEALLOCATE_LOCAL(ppixTemp); return (ok ? Success : BadAlloc); } /* Allocates count << planes pixels from colormap pmap for client. If * contig, then the plane mask is made of consecutive bits. Returns * all count << pixels in the array pixels. The first count of those * pixels are the unique pixels. *pMask has the mask to Or with the * unique pixels to get the rest of them. * * Returns True iff all pixels could be allocated * All cells allocated will have refcnt set to AllocPrivate and shared to FALSE * (see AllocShared for why we care) */ static Bool AllocCP (pmap, pentFirst, count, planes, contig, pixels, pMask) ColormapPtr pmap; EntryPtr pentFirst; int count, planes; Bool contig; Pixel *pixels, *pMask; { EntryPtr ent; Pixel pixel, base, entries, maxp, save; int dplanes, found; Pixel *ppix; Pixel mask; Pixel finalmask; dplanes = pmap->pVisual->nplanes; /* Easy case. Allocate pixels only */ if (planes == 0) { /* allocate writable entries */ ppix = pixels; ent = pentFirst; pixel = 0; while (--count >= 0) { /* Just find count unallocated cells */ while (ent->refcnt) { ent++; pixel++; } ent->refcnt = AllocPrivate; *ppix++ = pixel; ent->fShared = FALSE; } *pMask = 0; return (TRUE); } else if (planes > dplanes) { return (FALSE); } /* General case count pixels * 2 ^ planes cells to be allocated */ /* make room for new pixels */ ent = pentFirst; /* first try for contiguous planes, since it's fastest */ for (mask = (((Pixel)1) << planes) - 1, base = 1, dplanes -= (planes - 1); --dplanes >= 0; mask += mask, base += base) { ppix = pixels; found = 0; pixel = 0; entries = pmap->pVisual->ColormapEntries - mask; while (pixel < entries) { save = pixel; maxp = pixel + mask + base; /* check if all are free */ while (pixel != maxp && ent[pixel].refcnt == 0) pixel += base; if (pixel == maxp) { /* this one works */ *ppix++ = save; found++; if (found == count) { /* found enough, allocate them all */ while (--count >= 0) { pixel = pixels[count]; maxp = pixel + mask; while (1) { ent[pixel].refcnt = AllocPrivate; ent[pixel].fShared = FALSE; if (pixel == maxp) break; pixel += base; *ppix++ = pixel; } } *pMask = mask; return (TRUE); } } pixel = save + 1; if (pixel & mask) pixel += mask; } } dplanes = pmap->pVisual->nplanes; if (contig || planes == 1 || dplanes < 3) return (FALSE); /* this will be very slow for large maps, need a better algorithm */ /* we can generate the smallest and largest numbers that fits in dplanes bits and contain exactly planes bits set as follows. First, we need to check that it is possible to generate such a mask at all. (Non-contiguous masks need one more bit than contiguous masks). Then the smallest such mask consists of the rightmost planes-1 bits set, then a zero, then a one in position planes + 1. The formula is (3 << (planes-1)) -1 The largest such masks consists of the leftmost planes-1 bits set, then a zero, then a one bit in position dplanes-planes-1. If dplanes is smaller than 32 (the number of bits in a word) then the formula is: (1<>> */ finalmask = (((((Pixel)1)<<(planes-1)) - 1) << (dplanes-planes+1)) + (((Pixel)1)<<(dplanes-planes-1)); for (mask = (((Pixel)3) << (planes -1)) - 1; mask <= finalmask; mask++) { /* next 3 magic statements count number of ones (HAKMEM #169) */ pixel = (mask >> 1) & 033333333333; pixel = mask - pixel - ((pixel >> 1) & 033333333333); if ((((pixel + (pixel >> 3)) & 030707070707) % 077) != planes) continue; ppix = pixels; found = 0; entries = pmap->pVisual->ColormapEntries - mask; base = lowbit (mask); for (pixel = 0; pixel < entries; pixel++) { if (pixel & mask) continue; maxp = 0; /* check if all are free */ while (ent[pixel + maxp].refcnt == 0) { GetNextBitsOrBreak(maxp, mask, base); } if ((maxp < mask) || (ent[pixel + mask].refcnt != 0)) continue; /* this one works */ *ppix++ = pixel; found++; if (found < count) continue; /* found enough, allocate them all */ while (--count >= 0) { pixel = (pixels)[count]; maxp = 0; while (1) { ent[pixel + maxp].refcnt = AllocPrivate; ent[pixel + maxp].fShared = FALSE; GetNextBitsOrBreak(maxp, mask, base); *ppix++ = pixel + maxp; } } *pMask = mask; return (TRUE); } } return (FALSE); } static Bool AllocShared (pmap, ppix, c, r, g, b, rmask, gmask, bmask, ppixFirst) ColormapPtr pmap; Pixel *ppix; int c, r, g, b; Pixel rmask, gmask, bmask; Pixel *ppixFirst; /* First of the client's new pixels */ { Pixel *pptr, *cptr; int npix, z, npixClientNew, npixShared; Pixel basemask, base, bits, common; SHAREDCOLOR *pshared, **ppshared, **psharedList; npixClientNew = c << (r + g + b); npixShared = (c << r) + (c << g) + (c << b); psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared * sizeof(SHAREDCOLOR *)); if (!psharedList) return FALSE; ppshared = psharedList; for (z = npixShared; --z >= 0; ) { if (!(ppshared[z] = (SHAREDCOLOR *)xalloc(sizeof(SHAREDCOLOR)))) { for (z++ ; z < npixShared; z++) xfree(ppshared[z]); return FALSE; } } for(pptr = ppix, npix = c; --npix >= 0; pptr++) { basemask = ~(gmask | bmask); common = *pptr & basemask; if (rmask) { bits = 0; base = lowbit (rmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].fShared = TRUE; pmap->red[*cptr].co.shco.red = pshared; } } GetNextBitsOrBreak(bits, rmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].fShared = TRUE; pmap->red[*cptr].co.shco.red = pshared; } } } basemask = ~(rmask | bmask); common = *pptr & basemask; if (gmask) { bits = 0; base = lowbit (gmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (r + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].co.shco.green = pshared; } } GetNextBitsOrBreak(bits, gmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].co.shco.green = pshared; } } } basemask = ~(rmask | gmask); common = *pptr & basemask; if (bmask) { bits = 0; base = lowbit (bmask); while(1) { pshared = *ppshared++; pshared->refcnt = 1 << (r + g); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == (common | bits)) { pmap->red[*cptr].co.shco.blue = pshared; } } GetNextBitsOrBreak(bits, bmask, base); } } else { pshared = *ppshared++; pshared->refcnt = 1 << (g + b); for (cptr = ppixFirst, z = npixClientNew; --z >= 0; cptr++) { if ((*cptr & basemask) == common) { pmap->red[*cptr].co.shco.blue = pshared; } } } } DEALLOCATE_LOCAL(psharedList); return TRUE; } /* Free colors and/or cells (probably slow for large numbers) */ int FreeColors (pmap, client, count, pixels, mask) ColormapPtr pmap; int client, count; Pixel *pixels; Pixel mask; { int rval, result, class; Pixel rmask; class = pmap->class; if (pmap->flags & AllAllocated) return(BadAccess); if ((class | DynamicClass) == DirectColor) { rmask = mask & RGBMASK(pmap->pVisual); result = FreeCo(pmap, client, REDMAP, count, pixels, mask & pmap->pVisual->redMask); /* If any of the three calls fails, we must report that, if more * than one fails, it's ok that we report the last one */ rval = FreeCo(pmap, client, GREENMAP, count, pixels, mask & pmap->pVisual->greenMask); if(rval != Success) result = rval; rval = FreeCo(pmap, client, BLUEMAP, count, pixels, mask & pmap->pVisual->blueMask); if(rval != Success) result = rval; } else { rmask = mask & ((((Pixel)1) << pmap->pVisual->nplanes) - 1); result = FreeCo(pmap, client, PSEUDOMAP, count, pixels, rmask); } if ((mask != rmask) && count) { clientErrorValue = *pixels | mask; result = BadValue; } /* XXX should worry about removing any RT_CMAPENTRY resource */ return (result); } /* Helper for FreeColors -- frees all combinations of *newpixels and mask bits * which the client has allocated in channel colormap cells of pmap. * doesn't change newpixels if it doesn't need to */ static int FreeCo (pmap, client, color, npixIn, ppixIn, mask) ColormapPtr pmap; /* which colormap head */ int client; int color; /* which sub-map, eg RED, BLUE, PSEUDO */ int npixIn; /* number of pixels passed in */ Pixel *ppixIn; /* list of base pixels */ Pixel mask; /* mask client gave us */ { Pixel *ppixClient, pixTest; int npixClient, npixNew, npix; Pixel bits, base, cmask, rgbbad; Pixel *pptr, *cptr; int n, zapped; int errVal = Success; int offset, numents; #ifdef LBX Bool grabbed; Bool zeroRefCount; Bool anyRefCountReachedZero = 0; #endif if (npixIn == 0) return (errVal); bits = 0; zapped = 0; base = lowbit (mask); switch(color) { case REDMAP: cmask = pmap->pVisual->redMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetRed; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsRed[client]; npixClient = pmap->numPixelsRed[client]; break; case GREENMAP: cmask = pmap->pVisual->greenMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetGreen; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsGreen[client]; npixClient = pmap->numPixelsGreen[client]; break; case BLUEMAP: cmask = pmap->pVisual->blueMask; rgbbad = ~RGBMASK(pmap->pVisual); offset = pmap->pVisual->offsetBlue; numents = (cmask >> offset) + 1; ppixClient = pmap->clientPixelsBlue[client]; npixClient = pmap->numPixelsBlue[client]; break; default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: cmask = ~((Pixel)0); rgbbad = 0; offset = 0; numents = pmap->pVisual->ColormapEntries; ppixClient = pmap->clientPixelsRed[client]; npixClient = pmap->numPixelsRed[client]; break; } #ifdef LBX grabbed = LbxCheckCmapGrabbed (pmap); if (grabbed) { /* * If the colormap is grabbed by a proxy, the server must * notify the proxy of all cells that are freed (the refcount * has reached zero on these cells). */ LbxBeginFreeCellsEvent (pmap); LbxSortPixelList (ppixIn, npixIn); } #endif /* zap all pixels which match */ while (1) { /* go through pixel list */ for (pptr = ppixIn, n = npixIn; --n >= 0; pptr++) { pixTest = ((*pptr | bits) & cmask) >> offset; if ((pixTest >= numents) || (*pptr & rgbbad)) { clientErrorValue = *pptr | bits; errVal = BadValue; continue; } /* find match in client list */ for (cptr = ppixClient, npix = npixClient; --npix >= 0 && *cptr != pixTest; cptr++) ; if (npix >= 0) { if (pmap->class & DynamicClass) { FreeCell(pmap, pixTest, color); #ifdef LBX /* * Only PSEUDO colormaps are grabbed by LBX proxies. * Check if the ref count reached zero on this pixel. */ zeroRefCount = pmap->red[pixTest].refcnt == 0; if (zeroRefCount) anyRefCountReachedZero = 1; if (grabbed && zeroRefCount) LbxAddFreeCellToEvent (pmap, pixTest); #endif } *cptr = ~((Pixel)0); zapped++; } else errVal = BadAccess; } /* generate next bits value */ GetNextBitsOrBreak(bits, mask, base); } #ifdef LBX if (grabbed) LbxEndFreeCellsEvent (pmap); else if (anyRefCountReachedZero) { /* * We only send LbxFreeCell events to a proxy that has the colormap * grabbed. If the colormap is not grabbed, the proxy that last * had the colormap grabbed will not be able to do a smart grab * in the future. A smart grab can only occur if the proxy is kept * up to date on every alloc/free change in the colormap. */ LbxDisableSmartGrab (pmap); } #endif /* delete freed pixels from client pixel list */ if (zapped) { npixNew = npixClient - zapped; if (npixNew) { /* Since the list can only get smaller, we can do a copy in * place and then realloc to a smaller size */ pptr = cptr = ppixClient; /* If we have all the new pixels, we don't have to examine the * rest of the old ones */ for(npix = 0; npix < npixNew; cptr++) { if (*cptr != ~((Pixel)0)) { *pptr++ = *cptr; npix++; } } pptr = (Pixel *)xrealloc(ppixClient, npixNew * sizeof(Pixel)); if (pptr) ppixClient = pptr; npixClient = npixNew; } else { npixClient = 0; xfree(ppixClient); ppixClient = (Pixel *)NULL; } switch(color) { case PSEUDOMAP: case REDMAP: pmap->clientPixelsRed[client] = ppixClient; pmap->numPixelsRed[client] = npixClient; break; case GREENMAP: pmap->clientPixelsGreen[client] = ppixClient; pmap->numPixelsGreen[client] = npixClient; break; case BLUEMAP: pmap->clientPixelsBlue[client] = ppixClient; pmap->numPixelsBlue[client] = npixClient; break; } } return (errVal); } /* Redefine color values */ int StoreColors (pmap, count, defs) ColormapPtr pmap; int count; xColorItem *defs; { register Pixel pix; register xColorItem *pdef; register EntryPtr pent, pentT, pentLast; register VisualPtr pVisual; SHAREDCOLOR *pred, *pgreen, *pblue; int n, ChgRed, ChgGreen, ChgBlue, idef; int class, errVal = Success; int ok; class = pmap->class; if(!(class & DynamicClass) && !(pmap->flags & BeingCreated)) { return(BadAccess); } pVisual = pmap->pVisual; idef = 0; if((class | DynamicClass) == DirectColor) { int numred, numgreen, numblue; Pixel rgbbad; numred = NUMRED(pVisual); numgreen = NUMGREEN(pVisual); numblue = NUMBLUE(pVisual); rgbbad = ~RGBMASK(pVisual); for (pdef = defs, n = 0; n < count; pdef++, n++) { ok = TRUE; (*pmap->pScreen->ResolveColor) (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual); if (pdef->pixel & rgbbad) { errVal = BadValue; clientErrorValue = pdef->pixel; continue; } pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed; if (pix >= numred) { errVal = BadValue; ok = FALSE; } else if (pmap->red[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoRed) { pmap->red[pix].co.local.red = pdef->red; } else { pdef->red = pmap->red[pix].co.local.red; } pix = (pdef->pixel & pVisual->greenMask) >> pVisual->offsetGreen; if (pix >= numgreen) { errVal = BadValue; ok = FALSE; } else if (pmap->green[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoGreen) { pmap->green[pix].co.local.green = pdef->green; } else { pdef->green = pmap->green[pix].co.local.green; } pix = (pdef->pixel & pVisual->blueMask) >> pVisual->offsetBlue; if (pix >= numblue) { errVal = BadValue; ok = FALSE; } else if (pmap->blue[pix].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } else if (pdef->flags & DoBlue) { pmap->blue[pix].co.local.blue = pdef->blue; } else { pdef->blue = pmap->blue[pix].co.local.blue; } /* If this is an o.k. entry, then it gets added to the list * to be sent to the hardware. If not, skip it. Once we've * skipped one, we have to copy all the others. */ if(ok) { if(idef != n) defs[idef] = defs[n]; idef++; } else clientErrorValue = pdef->pixel; } } else { for (pdef = defs, n = 0; n < count; pdef++, n++) { ok = TRUE; if (pdef->pixel >= pVisual->ColormapEntries) { clientErrorValue = pdef->pixel; errVal = BadValue; ok = FALSE; } else if (pmap->red[pdef->pixel].refcnt != AllocPrivate) { errVal = BadAccess; ok = FALSE; } /* If this is an o.k. entry, then it gets added to the list * to be sent to the hardware. If not, skip it. Once we've * skipped one, we have to copy all the others. */ if(ok) { if(idef != n) defs[idef] = defs[n]; idef++; } else continue; (*pmap->pScreen->ResolveColor) (&pdef->red, &pdef->green, &pdef->blue, pmap->pVisual); pent = &pmap->red[pdef->pixel]; if(pdef->flags & DoRed) { if(pent->fShared) { pent->co.shco.red->color = pdef->red; if (pent->co.shco.red->refcnt > 1) ok = FALSE; } else pent->co.local.red = pdef->red; } else { if(pent->fShared) pdef->red = pent->co.shco.red->color; else pdef->red = pent->co.local.red; } if(pdef->flags & DoGreen) { if(pent->fShared) { pent->co.shco.green->color = pdef->green; if (pent->co.shco.green->refcnt > 1) ok = FALSE; } else pent->co.local.green = pdef->green; } else { if(pent->fShared) pdef->green = pent->co.shco.green->color; else pdef->green = pent->co.local.green; } if(pdef->flags & DoBlue) { if(pent->fShared) { pent->co.shco.blue->color = pdef->blue; if (pent->co.shco.blue->refcnt > 1) ok = FALSE; } else pent->co.local.blue = pdef->blue; } else { if(pent->fShared) pdef->blue = pent->co.shco.blue->color; else pdef->blue = pent->co.local.blue; } if(!ok) { /* have to run through the colormap and change anybody who * shares this value */ pred = pent->co.shco.red; pgreen = pent->co.shco.green; pblue = pent->co.shco.blue; ChgRed = pdef->flags & DoRed; ChgGreen = pdef->flags & DoGreen; ChgBlue = pdef->flags & DoBlue; pentLast = pmap->red + pVisual->ColormapEntries; for(pentT = pmap->red; pentT < pentLast; pentT++) { if(pentT->fShared && (pentT != pent)) { xColorItem defChg; /* There are, alas, devices in this world too dumb * to read their own hardware colormaps. Sick, but * true. So we're going to be really nice and load * the xColorItem with the proper value for all the * fields. We will only set the flags for those * fields that actually change. Smart devices can * arrange to change only those fields. Dumb devices * can rest assured that we have provided for them, * and can change all three fields */ defChg.flags = 0; if(ChgRed && pentT->co.shco.red == pred) { defChg.flags |= DoRed; } if(ChgGreen && pentT->co.shco.green == pgreen) { defChg.flags |= DoGreen; } if(ChgBlue && pentT->co.shco.blue == pblue) { defChg.flags |= DoBlue; } if(defChg.flags != 0) { defChg.pixel = pentT - pmap->red; defChg.red = pentT->co.shco.red->color; defChg.green = pentT->co.shco.green->color; defChg.blue = pentT->co.shco.blue->color; (*pmap->pScreen->StoreColors) (pmap, 1, &defChg); } } } } } } /* Note that we use idef, the count of acceptable entries, and not * count, the count of proposed entries */ if (idef != 0) ( *pmap->pScreen->StoreColors) (pmap, idef, defs); return (errVal); } int IsMapInstalled(map, pWin) Colormap map; WindowPtr pWin; { Colormap *pmaps; int imap, nummaps, found; pmaps = (Colormap *) ALLOCATE_LOCAL( pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap)); if(!pmaps) return(FALSE); nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps) (pWin->drawable.pScreen, pmaps); found = FALSE; for(imap = 0; imap < nummaps; imap++) { if(pmaps[imap] == map) { found = TRUE; break; } } DEALLOCATE_LOCAL(pmaps); return (found); } vnc_unixsrc/Xvnc/programs/Xserver/dix/cursor.c0100664000076400007640000002461407120677563021167 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cursor.c /main/19 1996/08/01 19:20:16 dpw $ */ /* $XFree86: xc/programs/Xserver/dix/cursor.c,v 3.1 1996/12/23 06:29:36 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" typedef struct _GlyphShare { FontPtr font; unsigned short sourceChar; unsigned short maskChar; CursorBitsPtr bits; struct _GlyphShare *next; } GlyphShare, *GlyphSharePtr; static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL; static void #if NeedFunctionPrototypes FreeCursorBits(CursorBitsPtr bits) #else FreeCursorBits(bits) CursorBitsPtr bits; #endif { if (--bits->refcnt > 0) return; xfree(bits->source); xfree(bits->mask); if (bits->refcnt == 0) { register GlyphSharePtr *prev, this; for (prev = &sharedGlyphs; (this = *prev) && (this->bits != bits); prev = &this->next) ; if (this) { *prev = this->next; CloseFont(this->font, (Font)0); xfree(this); } xfree(bits); } } /* * To be called indirectly by DeleteResource; must use exactly two args */ /*ARGSUSED*/ int FreeCursor(value, cid) pointer value; /* must conform to DeleteType */ XID cid; { int nscr; CursorPtr pCurs = (CursorPtr)value; ScreenPtr pscr; if ( --pCurs->refcnt > 0) return(Success); for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; (void)( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(pCurs->bits); xfree( pCurs); return(Success); } /* * does nothing about the resource table, just creates the data structure. * does not copy the src and mask bits */ CursorPtr AllocCursor(psrcbits, pmaskbits, cm, foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue) unsigned char * psrcbits; /* server-defined padding */ unsigned char * pmaskbits; /* server-defined padding */ CursorMetricPtr cm; unsigned foreRed, foreGreen, foreBlue; unsigned backRed, backGreen, backBlue; { CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits)); if (!pCurs) { xfree(psrcbits); xfree(pmaskbits); return (CursorPtr)NULL; } bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); bits->source = psrcbits; bits->mask = pmaskbits; bits->width = cm->width; bits->height = cm->height; bits->xhot = cm->xhot; bits->yhot = cm->yhot; bits->refcnt = -1; pCurs->bits = bits; pCurs->refcnt = 1; pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; pCurs->foreBlue = foreBlue; pCurs->backRed = backRed; pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (!( *pscr->RealizeCursor)( pscr, pCurs)) { while (--nscr >= 0) { pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(bits); xfree(pCurs); return (CursorPtr)NULL; } } return pCurs; } int AllocGlyphCursor(source, sourceChar, mask, maskChar, foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue, ppCurs, client) Font source, mask; unsigned int sourceChar, maskChar; unsigned foreRed, foreGreen, foreBlue; unsigned backRed, backGreen, backBlue; CursorPtr *ppCurs; ClientPtr client; { FontPtr sourcefont, maskfont; unsigned char *srcbits; unsigned char *mskbits; CursorMetricRec cm; int res; CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; GlyphSharePtr pShare; sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, SecurityReadAccess); maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT, SecurityReadAccess); if (!sourcefont) { client->errorValue = source; return(BadFont); } if (!maskfont && (mask != None)) { client->errorValue = mask; return(BadFont); } if (sourcefont != maskfont) pShare = (GlyphSharePtr)NULL; else { for (pShare = sharedGlyphs; pShare && ((pShare->font != sourcefont) || (pShare->sourceChar != sourceChar) || (pShare->maskChar != maskChar)); pShare = pShare->next) ; } if (pShare) { pCurs = (CursorPtr)xalloc(sizeof(CursorRec)); if (!pCurs) return BadAlloc; bits = pShare->bits; bits->refcnt++; } else { if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm)) { client->errorValue = sourceChar; return BadValue; } if (!maskfont) { register long n; register unsigned char *mskptr; n = BitmapBytePad(cm.width)*(long)cm.height; mskptr = mskbits = (unsigned char *)xalloc(n); if (!mskptr) return BadAlloc; while (--n >= 0) *mskptr++ = ~0; } else { if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm)) { client->errorValue = maskChar; return BadValue; } if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0) return res; } if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0) { xfree(mskbits); return res; } if (sourcefont != maskfont) { pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits)); if (pCurs) bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); else bits = (CursorBitsPtr)NULL; } else { pCurs = (CursorPtr)xalloc(sizeof(CursorRec)); if (pCurs) bits = (CursorBitsPtr)xalloc(sizeof(CursorBits)); else bits = (CursorBitsPtr)NULL; } if (!bits) { xfree(pCurs); xfree(mskbits); xfree(srcbits); return BadAlloc; } bits->source = srcbits; bits->mask = mskbits; bits->width = cm.width; bits->height = cm.height; bits->xhot = cm.xhot; bits->yhot = cm.yhot; if (sourcefont != maskfont) bits->refcnt = -1; else { bits->refcnt = 1; pShare = (GlyphSharePtr)xalloc(sizeof(GlyphShare)); if (!pShare) { FreeCursorBits(bits); return BadAlloc; } pShare->font = sourcefont; sourcefont->refcnt++; pShare->sourceChar = sourceChar; pShare->maskChar = maskChar; pShare->bits = bits; pShare->next = sharedGlyphs; sharedGlyphs = pShare; } } pCurs->bits = bits; pCurs->refcnt = 1; pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; pCurs->foreBlue = foreBlue; pCurs->backRed = backRed; pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; /* * realize the cursor for every screen */ for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { pscr = screenInfo.screens[nscr]; if (!( *pscr->RealizeCursor)( pscr, pCurs)) { while (--nscr >= 0) { pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } FreeCursorBits(pCurs->bits); xfree(pCurs); return BadAlloc; } } *ppCurs = pCurs; return Success; } /*********************************************************** * CreateRootCursor * * look up the name of a font * open the font * add the font to the resource table * make a cursor from the glyphs * add the cursor to the resource table *************************************************************/ CursorPtr CreateRootCursor(pfilename, glyph) char * pfilename; unsigned int glyph; { CursorPtr curs; FontPtr cursorfont; int err; XID fontID; fontID = FakeClientID(0); err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync, (unsigned)strlen( pfilename), pfilename); if (err != Success) return NullCursor; cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); if (!cursorfont) return NullCursor; if (AllocGlyphCursor(fontID, glyph, fontID, glyph + 1, 0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success) return NullCursor; if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs)) return NullCursor; return curs; } vnc_unixsrc/Xvnc/programs/Xserver/dix/buildatoms0100775000076400007640000000232207120677563021567 0ustar constconst#!/bin/sh hfile=../../../include/Xatom.h cfile=initatoms.c rm -f $hfile $cfile umask 222 awk ' BEGIN { hfile = "'$hfile'"; cfile = "'$cfile'"; hformat = "#define XA_%s ((Atom) %d)\n"; printf("#ifndef XATOM_H\n") > hfile; printf("#define XATOM_H 1\n\n") > hfile; printf("/* THIS IS A GENERATED FILE\n") > hfile; printf(" *\n") > hfile; printf(" * Do not change! Changing this file implies a protocol change!\n") > hfile; printf(" */\n\n") > hfile; printf("/* THIS IS A GENERATED FILE\n") > cfile; printf(" *\n") > cfile; printf(" * Do not change! Changing this file implies a protocol change!\n") > cfile; printf(" */\n\n") > cfile; printf("#include \"X.h\"\n") > cfile; printf("#include \"Xatom.h\"\n") > cfile; printf("#include \"misc.h\"\n") > cfile; printf("#include \"dix.h\"\n") > cfile; printf("void MakePredeclaredAtoms()\n") > cfile; printf("{\n") > cfile; } NF == 2 && $2 == "@" { printf(hformat, $1, ++atomno) > hfile ; printf(" if (MakeAtom(\"%s\", %d, 1) != XA_%s) AtomError();\n", $1, length($1), $1) > cfile ; } END { printf("\n") > hfile; printf(hformat, "LAST_PREDEFINED", atomno) > hfile ; printf("#endif /* XATOM_H */\n") > hfile; printf("}\n") > cfile ; } ' BuiltInAtoms exit 0 vnc_unixsrc/Xvnc/programs/Xserver/dix/globals.c0100664000076400007640000001223707120677563021273 0ustar constconst/************************************************************ Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: globals.c,v 1.53 94/04/17 20:26:37 rws Exp $ */ /* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.2.2.1 1997/06/01 12:33:21 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "misc.h" #include "windowstr.h" #include "scrnintstr.h" #include "input.h" #include "dixfont.h" #include "site.h" #include "dixstruct.h" #include "os.h" ScreenInfo screenInfo; KeybdCtrl defaultKeyboardControl = { DEFAULT_KEYBOARD_CLICK, DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, DEFAULT_AUTOREPEAT, DEFAULT_AUTOREPEATS, DEFAULT_LEDS, 0}; PtrCtrl defaultPointerControl = { DEFAULT_PTR_NUMERATOR, DEFAULT_PTR_DENOMINATOR, DEFAULT_PTR_THRESHOLD, 0}; ClientPtr *clients; ClientPtr serverClient; int currentMaxClients; /* current size of clients array */ WindowPtr *WindowTable; unsigned long globalSerialNumber = 0; unsigned long serverGeneration = 0; /* these next four are initialized in main.c */ CARD32 ScreenSaverTime; CARD32 ScreenSaverInterval; int ScreenSaverBlanking; int ScreenSaverAllowExposures; #ifdef DPMSExtension #define DEFAULT_STANDBY_TIME DEFAULT_SCREEN_SAVER_TIME * 2 #define DEFAULT_SUSPEND_TIME DEFAULT_SCREEN_SAVER_TIME * 3 #define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4 CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME; CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME; CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME; CARD16 DPMSPowerLevel = 0; Bool defaultDPMSEnabled = FALSE; Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */ Bool DPMSDisabledSwitch = FALSE; /* switch states */ Bool DPMSCapableFlag = FALSE; CARD32 DPMSStandbyTime; CARD32 DPMSSuspendTime; CARD32 DPMSOffTime; Bool DPMSEnabled; #endif CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME; CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL; int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING; int defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES; #ifndef NOLOGOHACK int logoScreenSaver = DEFAULT_LOGO_SCREEN_SAVER; #endif char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *defaultTextFont = COMPILEDDEFAULTFONT; char *defaultCursorFont = COMPILEDCURSORFONT; char *rgbPath = RGB_DB; char *defaultDisplayClass = COMPILEDDISPLAYCLASS; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ CursorPtr rootCursor; ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */ TimeStamp currentTime; TimeStamp lastDeviceEventTime; Bool permitOldBugs = FALSE; /* turn off some error checking, to permit certain * old broken clients (like R2/R3 xterms) to work */ int defaultColorVisualClass = -1; int monitorResolution = 0; char *display; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; int argcGlobal; char **argvGlobal; vnc_unixsrc/Xvnc/programs/Xserver/dix/main.c0100664000076400007640000005424307120677563020577 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: main.c /main/82 1996/09/28 17:12:09 rws $ */ /* $XFree86: xc/programs/Xserver/dix/main.c,v 3.10.2.2 1998/01/22 10:47:08 dawes Exp $ */ #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "scrnintstr.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "resource.h" #include "dixstruct.h" #include "gcstruct.h" #include "extension.h" #include "extnsionst.h" #include "colormap.h" #include "colormapst.h" #include "cursorstr.h" #include "font.h" #include "opaque.h" #include "servermd.h" #include "site.h" #include "dixfont.h" #include "dixevents.h" /* InitEvents() */ #include "dispatch.h" /* InitProcVectors() */ extern CARD32 defaultScreenSaverTime; extern CARD32 defaultScreenSaverInterval; extern int defaultScreenSaverBlanking; extern int defaultScreenSaverAllowExposures; #ifdef DPMSExtension #include "dpms.h" #endif void ddxGiveUp(); extern int InitClientPrivates( #if NeedFunctionPrototypes ClientPtr /*client*/ #endif ); extern void Dispatch( #if NeedFunctionPrototypes void #endif ); extern char *display; char *ConnectionInfo; xConnSetupPrefix connSetupPrefix; extern WindowPtr *WindowTable; extern FontPtr defaultFont; extern int screenPrivateCount; static Bool CreateConnectionBlock( #if NeedFunctionPrototypes void #endif ); static void FreeScreen( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); PaddingInfo PixmapWidthPaddingInfo[33]; #ifdef INTERNAL_VS_EXTERNAL_PADDING /* add padding info for 32-bit interface. PutImage and GetImage will * work on 32-bit padding while the rest of the server will work * on 64-bit padding (Alpha). */ PaddingInfo PixmapWidthPaddingInfoProto[33]; #endif int connBlockScreenStart; static int restart = 0; /* * Dummy entry for EventSwapVector[] */ /*ARGSUSED*/ void NotImplemented( #if NeedFunctionPrototypes && defined(EVENT_SWAP_PTR) xEvent * from, xEvent * to #endif ) { FatalError("Not implemented"); } /* * Dummy entry for ReplySwapVector[] */ /*ARGSUSED*/ void ReplyNotSwappd( #if NeedNestedPrototypes ClientPtr pClient , int size , void * pbuf #endif ) { FatalError("Not implemented"); } /* * This array encodes the answer to the question "what is the log base 2 * of the number of pixels that fit in a scanline pad unit?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int answer[6][4] = { /* pad pad pad pad*/ /* 8 16 32 64 */ { 3, 4, 5 , 6 }, /* 1 bit per pixel */ { 1, 2, 3 , 4 }, /* 4 bits per pixel */ { 0, 1, 2 , 3 }, /* 8 bits per pixel */ { ~0, 0, 1 , 2 }, /* 16 bits per pixel */ { ~0, ~0, 0 , 1 }, /* 24 bits per pixel */ { ~0, ~0, 0 , 1 } /* 32 bits per pixel */ }; /* * This array gives the answer to the question "what is the first index for * the answer array above given the number of bits per pixel?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int indexForBitsPerPixel[ 33 ] = { ~0, 0, ~0, ~0, /* 1 bit per pixel */ 1, ~0, ~0, ~0, /* 4 bits per pixel */ 2, ~0, ~0, ~0, /* 8 bits per pixel */ ~0,~0, ~0, ~0, 3, ~0, ~0, ~0, /* 16 bits per pixel */ ~0,~0, ~0, ~0, 4, ~0, ~0, ~0, /* 24 bits per pixel */ ~0,~0, ~0, ~0, 5 /* 32 bits per pixel */ }; /* * This array gives the bytesperPixel value for cases where the number * of bits per pixel is a multiple of 8 but not a power of 2. */ static int answerBytesPerPixel[ 33 ] = { ~0, 0, ~0, ~0, /* 1 bit per pixel */ 0, ~0, ~0, ~0, /* 4 bits per pixel */ 0, ~0, ~0, ~0, /* 8 bits per pixel */ ~0,~0, ~0, ~0, 0, ~0, ~0, ~0, /* 16 bits per pixel */ ~0,~0, ~0, ~0, 3, ~0, ~0, ~0, /* 24 bits per pixel */ ~0,~0, ~0, ~0, 0 /* 32 bits per pixel */ }; /* * This array gives the answer to the question "what is the second index for * the answer array above given the number of bits per scanline pad unit?" * Note that ~0 is an invalid entry (mostly for the benefit of the reader). */ static int indexForScanlinePad[ 65 ] = { ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0, ~0, ~0, ~0, /* 8 bits per scanline pad unit */ ~0, ~0, ~0, ~0, 1, ~0, ~0, ~0, /* 16 bits per scanline pad unit */ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 2, ~0, ~0, ~0, /* 32 bits per scanline pad unit */ ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 3 /* 64 bits per scanline pad unit */ }; int main(argc, argv) int argc; char *argv[]; { int i, j, k; HWEventQueueType alwaysCheckForInput[2]; /* Notice if we're restart. Probably this is because we jumped through * uninitialized pointer */ if (restart) FatalError("server restarted. Jumped through uninitialized pointer?\n"); else restart = 1; #if 0 ExpandCommandLine(&argc, &argv); #endif /* These are needed by some routines which are called from interrupt * handlers, thus have no direct calling path back to main and thus * can't be passed argc, argv as parameters */ argcGlobal = argc; argvGlobal = argv; display = "0"; ProcessCommandLine(argc, argv); alwaysCheckForInput[0] = 0; alwaysCheckForInput[1] = 1; while(1) { serverGeneration++; ScreenSaverTime = defaultScreenSaverTime; ScreenSaverInterval = defaultScreenSaverInterval; ScreenSaverBlanking = defaultScreenSaverBlanking; ScreenSaverAllowExposures = defaultScreenSaverAllowExposures; #ifdef DPMSExtension DPMSStandbyTime = defaultDPMSStandbyTime; DPMSSuspendTime = defaultDPMSSuspendTime; DPMSOffTime = defaultDPMSOffTime; DPMSEnabled = defaultDPMSEnabled; DPMSPowerLevel = 0; #endif InitBlockAndWakeupHandlers(); /* Perform any operating system dependent initializations you'd like */ OsInit(); if(serverGeneration == 1) { CreateWellKnownSockets(); InitProcVectors(); clients = (ClientPtr *)xalloc(MAXCLIENTS * sizeof(ClientPtr)); if (!clients) FatalError("couldn't create client array"); for (i=1; iCreateScreenResources && !(*pScreen->CreateScreenResources)(pScreen)) FatalError("failed to create screen resources"); if (!CreateGCperDepth(i)) FatalError("failed to create scratch GCs"); if (!CreateDefaultStipple(i)) FatalError("failed to create default stipple"); if (!CreateRootWindow(pScreen)) FatalError("failed to create root window"); } InitInput(argc, argv); if (InitAndStartDevices() != Success) FatalError("failed to initialize core devices"); InitFonts(); if (SetDefaultFontPath(defaultFontPath) != Success) ErrorF("failed to set default font path '%s'", defaultFontPath); if (!SetDefaultFont(defaultTextFont)) FatalError("could not open default font '%s'", defaultTextFont); if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) FatalError("could not open default cursor font '%s'", defaultCursorFont); #ifdef DPMSExtension /* check all screens, looking for DPMS Capabilities */ DPMSCapableFlag = DPMSSupported(); if (!DPMSCapableFlag) DPMSEnabled = FALSE; #endif for (i = 0; i < screenInfo.numScreens; i++) InitRootWindow(WindowTable[i]); DefineInitialRootWindow(WindowTable[0]); if (!CreateConnectionBlock()) FatalError("could not create connection block info"); Dispatch(); /* Now free up whatever must be freed */ if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); CloseDownExtensions(); FreeAllResources(); CloseDownDevices(); for (i = screenInfo.numScreens - 1; i >= 0; i--) { FreeScratchPixmapsForScreen(i); FreeGCperDepth(i); FreeDefaultStipple(i); (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]); FreeScreen(screenInfo.screens[i]); screenInfo.numScreens = i; } xfree(WindowTable); FreeFonts (); xfree(serverClient->devPrivates); if (dispatchException & DE_TERMINATE) { OsCleanup(); ddxGiveUp(); break; } xfree(ConnectionInfo); } return(0); } static int padlength[4] = {0, 3, 2, 1}; static Bool CreateConnectionBlock() { xConnSetup setup; xWindowRoot root; xDepth depth; xVisualType visual; xPixmapFormat format; unsigned long vid; int i, j, k, lenofblock, sizesofar = 0; char *pBuf; /* Leave off the ridBase and ridMask, these must be sent with connection */ setup.release = VENDOR_RELEASE; /* * per-server image and bitmap parameters are defined in Xmd.h */ setup.imageByteOrder = screenInfo.imageByteOrder; #ifdef INTERNAL_VS_EXTERNAL_PADDING if ( screenInfo.bitmapScanlineUnit > 32 ) setup.bitmapScanlineUnit = 32; else #endif setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit; #ifdef INTERNAL_VS_EXTERNAL_PADDING if ( screenInfo.bitmapScanlinePad > 32 ) setup.bitmapScanlinePad = 32; else #endif setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad; setup.bitmapBitOrder = screenInfo.bitmapBitOrder; setup.motionBufferSize = NumMotionEvents(); setup.numRoots = screenInfo.numScreens; setup.nbytesVendor = strlen(VENDOR_STRING); setup.numFormats = screenInfo.numPixmapFormats; setup.maxRequestSize = MAX_REQUEST_SIZE; QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode); lenofblock = sizeof(xConnSetup) + ((setup.nbytesVendor + 3) & ~3) + (setup.numFormats * sizeof(xPixmapFormat)) + (setup.numRoots * sizeof(xWindowRoot)); ConnectionInfo = (char *) xalloc(lenofblock); if (!ConnectionInfo) return FALSE; memmove(ConnectionInfo, (char *)&setup, sizeof(xConnSetup)); sizesofar = sizeof(xConnSetup); pBuf = ConnectionInfo + sizeof(xConnSetup); memmove(pBuf, VENDOR_STRING, (int)setup.nbytesVendor); sizesofar += setup.nbytesVendor; pBuf += setup.nbytesVendor; i = padlength[setup.nbytesVendor & 3]; sizesofar += i; while (--i >= 0) *pBuf++ = 0; for (i=0; i 32 ) format.scanLinePad = 32; else #endif format.scanLinePad = screenInfo.formats[i].scanlinePad; memmove(pBuf, (char *)&format, sizeof(xPixmapFormat)); pBuf += sizeof(xPixmapFormat); sizesofar += sizeof(xPixmapFormat); } connBlockScreenStart = sizesofar; for (i=0; idrawable.id; root.defaultColormap = pScreen->defColormap; root.whitePixel = pScreen->whitePixel; root.blackPixel = pScreen->blackPixel; root.currentInputMask = 0; /* filled in when sent */ root.pixWidth = pScreen->width; root.pixHeight = pScreen->height; root.mmWidth = pScreen->mmWidth; root.mmHeight = pScreen->mmHeight; root.minInstalledMaps = pScreen->minInstalledCmaps; root.maxInstalledMaps = pScreen->maxInstalledCmaps; root.rootVisualID = pScreen->rootVisual; root.backingStore = pScreen->backingStoreSupport; root.saveUnders = pScreen->saveUnderSupport != NotUseful; root.rootDepth = pScreen->rootDepth; root.nDepths = pScreen->numDepths; memmove(pBuf, (char *)&root, sizeof(xWindowRoot)); sizesofar += sizeof(xWindowRoot); pBuf += sizeof(xWindowRoot); pDepth = pScreen->allowedDepths; for(j = 0; j < pScreen->numDepths; j++, pDepth++) { lenofblock += sizeof(xDepth) + (pDepth->numVids * sizeof(xVisualType)); pBuf = (char *)xrealloc(ConnectionInfo, lenofblock); if (!pBuf) { xfree(ConnectionInfo); return FALSE; } ConnectionInfo = pBuf; pBuf += sizesofar; depth.depth = pDepth->depth; depth.nVisuals = pDepth->numVids; memmove(pBuf, (char *)&depth, sizeof(xDepth)); pBuf += sizeof(xDepth); sizesofar += sizeof(xDepth); for(k = 0; k < pDepth->numVids; k++) { vid = pDepth->vids[k]; for (pVisual = pScreen->visuals; pVisual->vid != vid; pVisual++) ; visual.visualID = vid; visual.class = pVisual->class; visual.bitsPerRGB = pVisual->bitsPerRGBValue; visual.colormapEntries = pVisual->ColormapEntries; visual.redMask = pVisual->redMask; visual.greenMask = pVisual->greenMask; visual.blueMask = pVisual->blueMask; memmove(pBuf, (char *)&visual, sizeof(xVisualType)); pBuf += sizeof(xVisualType); sizesofar += sizeof(xVisualType); } } } connSetupPrefix.success = xTrue; connSetupPrefix.length = lenofblock/4; connSetupPrefix.majorVersion = X_PROTOCOL; connSetupPrefix.minorVersion = X_PROTOCOL_REVISION; return TRUE; } /* grow the array of screenRecs if necessary. call the device-supplied initialization procedure with its screen number, a pointer to its ScreenRec, argc, and argv. return the number of successfully installed screens. */ int #if NeedFunctionPrototypes AddScreen( Bool (* pfnInit)( #if NeedNestedPrototypes int /*index*/, ScreenPtr /*pScreen*/, int /*argc*/, char ** /*argv*/ #endif ), int argc, char **argv) #else AddScreen(pfnInit, argc, argv) Bool (* pfnInit)(); int argc; char **argv; #endif { int i; int scanlinepad, format, depth, bitsPerPixel, j, k; ScreenPtr pScreen; #ifdef DEBUG void (**jNI) (); #endif /* DEBUG */ i = screenInfo.numScreens; if (i == MAXSCREENS) return -1; pScreen = (ScreenPtr) xalloc(sizeof(ScreenRec)); if (!pScreen) return -1; pScreen->devPrivates = (DevUnion *)xalloc(screenPrivateCount * sizeof(DevUnion)); if (!pScreen->devPrivates && screenPrivateCount) { xfree(pScreen); return -1; } pScreen->myNum = i; pScreen->WindowPrivateLen = 0; pScreen->WindowPrivateSizes = (unsigned *)NULL; pScreen->totalWindowSize = sizeof(WindowRec); pScreen->GCPrivateLen = 0; pScreen->GCPrivateSizes = (unsigned *)NULL; pScreen->totalGCSize = sizeof(GC); #ifdef PIXPRIV pScreen->PixmapPrivateLen = 0; pScreen->PixmapPrivateSizes = (unsigned *)NULL; pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8); #endif pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->CreateScreenResources = 0; #ifdef DEBUG for (jNI = &pScreen->QueryBestSize; jNI < (void (**) ()) &pScreen->SendGraphicsExpose; jNI++) *jNI = NotImplemented; #endif /* DEBUG */ /* * This loop gets run once for every Screen that gets added, * but thats ok. If the ddx layer initializes the formats * one at a time calling AddScreen() after each, then each * iteration will make it a little more accurate. Worst case * we do this loop N * numPixmapFormats where N is # of screens. * Anyway, this must be called after InitOutput and before the * screen init routine is called. */ for (format=0; formatrgf = ~0L; /* there are no scratch GCs yet*/ WindowTable[i] = NullWindow; screenInfo.screens[i] = pScreen; screenInfo.numScreens++; if (!(*pfnInit)(i, pScreen, argc, argv)) { FreeScreen(pScreen); screenInfo.numScreens--; return -1; } return i; } static void FreeScreen(pScreen) ScreenPtr pScreen; { xfree(pScreen->WindowPrivateSizes); xfree(pScreen->GCPrivateSizes); #ifdef PIXPRIV xfree(pScreen->PixmapPrivateSizes); #endif xfree(pScreen->devPrivates); xfree(pScreen); } vnc_unixsrc/Xvnc/programs/Xserver/dix/BuiltInAtoms0100664000076400007640000002452307120677563022002 0ustar constconstFile: .../x11/server/dix/BuiltInAtoms This file is of a fixed format and is used to generate both the file include/XAtom.h and dix/initatoms.c. Neither of those files should be edited directly. Changing the atoms in this file, or even the order in which they occur, is equivalent to forcing a new (minor) version number on the server. Take care. The format of the file is that each built in atom starts in column 1 with no text, other than spaces and tabs, on that line other than a mandatory trailing "@" at the end of the line. For each atom (Foo) below the defines will be of the form #define XA_Foo and the string value of the atom will be "Foo". The comment lines in this file are not guaranteed to be accurate. To see the current truth, look at the Xlib documentation as well as the protocol spec. Atoms occur in five distinct name spaces within the protocol. Any particular atom may or may not have some client interpretation within each of the name spaces. For each of the built in atoms, the intended semantics and the space within which it is defined is indicated. Those name spaces are Property names Property types Selections Font properties Type of a ClientMessage event (none built into server) For the font properties mentioned here, see the spec for more information. -- Selections -- PRIMARY @ Selection. SECONDARY @ Selection. -- Property types and names -- ARC @ Property type: x, y: INT16 width, height: CARD16, angle1, angle2: INT16 ATOM @ Property type: atom: ATOM BITMAP @ Property type: bitmap: PIXMAP This is asserted to be of depth 1. CARDINAL @ Property type: card: CARD32 or CARD16 or CARD8 the datum size is dependent on the property format COLORMAP @ Property type: colormap: COLORMAP CURSOR @ Property type: cursor: CURSOR CUT_BUFFER0 @ CUT_BUFFER1 @ CUT_BUFFER2 @ CUT_BUFFER3 @ CUT_BUFFER4 @ CUT_BUFFER5 @ CUT_BUFFER6 @ CUT_BUFFER7 @ Property name: (type: STRING) Used to implement cut buffer ring, in particular Andrew uses this mechanism. Anyone else using this sort of IPC mechanism should use these properties. Data is normally fetched and stored out of CUT_BUFFER0; the RotateProperties request is used to rotate these buffers. DRAWABLE @ Property type: drawable: DRAWABLE FONT @ Property type: font: FONT INTEGER @ Property type: card: INT32 or INT16 or INT8 the datum size is dependent on the property format PIXMAP @ Property type: pixmap: PIXMAP POINT @ Property type: x, y: INT16 RECTANGLE @ Property type: x, y: INT16 width, height: CARD16 RESOURCE_MANAGER @ Property name: (type: STRING) Contents of the user's resource manager data base. RGB_COLOR_MAP @ Property type: colormap: COLORMAP red-max: CARD32 red-mult: CARD32 green-max: CARD32 green-mult: CARD32 blue-max: CARD32 blue-mult: CARD32 base-pixel: CARD32 The fields `red_max', `green_max', and `blue_max' give the maximum red, green, and blue values, respectively. Each color coefficient ranges from 0 to its max, inclusive. For example, a common colormap allocation is 3/3/2: 3 planes for red, 3 planes for green, and 2 planes for blue. Such a colormap would have red_max == 7, green_max = 7, and blue_max = 3. An alternate allocation that uses only 216 colors is red_max = 5, green_max = 5, and blue_max = 5. The fields `red_mult', `green_mult', and `blue_mult' give the scale factors used to compose a full pixel value. (See next paragraph.) For a 3/3/2 allocation red_mult might be 32, green_mult might be 4, and blue_mult might be 1. For a 6-colors-each allocation, red_mult might be 36, green_mult might be 6, and blue_mult might be 1. The field `base_pixel' gives the base pixel value used to compose a full pixel value. Normally base_pixel is obtained from a call to XAllocColorPlanes(). Given integer red, green, and blue coefficients in their appropriate ranges, one can compute a corresponding pixel value with the expression: r * red_mult + g * green_mult + b * blue_mult + base_pixel For gray-scale colormaps, only the colormap, red_max, red_mult, and base_pixel fields are defined; the other fields are ignored. To compute a gray-scale pixel value, use: gray * red_mult + base_pixel This is provided to allow applications to share color maps. RGB_BEST_MAP @ RGB_BLUE_MAP @ RGB_DEFAULT_MAP @ RGB_GRAY_MAP @ RGB_GREEN_MAP @ RGB_RED_MAP @ Property name: (type: RGB_COLOR_MAP) The needs of most applications can be met with five colormaps. Polite applications may need only a small RGB space, and can use a portion of the default color map. Applications doing high-quality RGB rendering will need an entire colormap, filled with as large an RGB space as possible, e.g. 332. For color separations, an application may need maximum device resolution for each of red, green, and blue, even if this requires three renderings with three colormaps. Each of the above five names would be used for sharing color maps. STRING @ Property type: sequence of Bytes VISUALID @ Property type: visual: VISUALID WINDOW @ Property type: window: WINDOW WM_COMMAND @ Property name: (type: STRING) Command line arguments used to invoke this application. The arguments are delimited by null characters (ASCII 0). WM_HINTS @ Property type: flags: CARD32 input: BOOL32 initial-state: CARD32 icon-pixmap: PIXMAP icon-window: WINDOW icon_mask: BITMAP icon-x, icon-y: INT32 flags contains the following bits 0x00000001 input hint 0x00000002 state hint 0x00000004 icon pixmap hint 0x00000008 icon window hint 0x00000010 icon position hint values for initial-state 0 unspecified -> application does not care and WM should pick one. 1 normal 2 zoomed 3 iconic 4 inactive -> application believes itself to be seldomly used. WM may wish to place it on an inactive menu. This type is potentially extensible. The order is critical; append to the end only. Property name: (type: WM_HINTS) Additional hints set by the client for use by the window manager. WM_CLIENT_MACHINE @ Property name: (type: STRING) used to communicate with the window manager. The host name of the machine the client is running on may be set here. WM_ICON_NAME @ Property name: (type: STRING) what the application would like the label to be for the iconic form of the window. WM_ICON_SIZE @ Property type: minWidth, min-height: CARD32 maxWidth, max-height: CARD32 widthInc, height-inc: CARD32 Property name: (type: ICON_SIZE) The window manager may set this property on the root window to specify the icon sizes it allows. WM_NAME @ Property name: (type: STRING) used to communicate with the window manager. This is what the application would like the label for the window. WM_NORMAL_HINTS @ Property name: (type: SIZE_HINTS) used to communicate with the window manager. This is size hints for a window in its "normal" state. WM_SIZE_HINTS @ Property type: flags: CARD32 x, y: INT32 width, height: CARD32 min-width, min-height: CARD32 max-width, max-height: CARD32 width-inc, height-inc: CARD32 min-aspect-x, min-aspect-y: CARD32 max-aspect-x, max-aspect-y: CARD32 flags contains the following bits 0x00000001 user specified x and y 0x00000002 user specified width and height 0x00000004 program specified position 0x00000008 program specified size 0x00000010 program specified minimum size 0x00000020 program specified maximum size 0x00000040 program specified resize increment 0x00000080 program specified aspect ratio This type is potentially extensible. The order is critical; append to the end only. WM_ZOOM_HINTS @ Property name: (type: SIZE_HINTS) used to communicate with the window manager. This is size hints for a window in its "zoomed" state. -- Font properties -- MIN_SPACE @ Font property: CARD32 NORM_SPACE @ Font property: CARD32 MAX_SPACE @ Font property: CARD32 END_SPACE @ Font property: CARD32 SUPERSCRIPT_X @ Font property: INT32 SUPERSCRIPT_Y @ Font property: INT32 SUBSCRIPT_X @ Font property: INT32 SUBSCRIPT_Y @ Font property: INT32 UNDERLINE_POSITION @ Font property: INT32 UNDERLINE_THICKNESS @ Font property: CARD32 STRIKEOUT_ASCENT @ Font property: INT32 STRIKEOUT_DESCENT @ Font property: INT32 ITALIC_ANGLE @ Font property: INT32 X_HEIGHT @ Font property: INT32 QUAD_WIDTH @ Font property: INT32 WEIGHT @ Font property: CARD32 POINT_SIZE @ Font property: CARD32 RESOLUTION @ Font property: CARD32 The following optional properties on fonts have values that are atoms. The atom print name is the useful information. COPYRIGHT @ of the font distribution NOTICE @ trademark/copyright of the character shapes FONT_NAME @ name of this particular instance of a font FAMILY_NAME @ name of the 'font family' to which it belongs FULL_NAME @ full text name of the font The following aren't in order but putting them at the end avoids encoding changes. CAP_HEIGHT @ Font property: CARD32 WM_CLASS @ Property name: (type: STRING) Used (possibly by some window managers; definitely by session managers) to look up resources in the resource data base on behalf of the client who set this property. There are 2 elements: {char *resource_name; char *resource_class;} delimited by a null character (ascii 0) WM_TRANSIENT_FOR @ Property name: (type: WINDOW) Used by transient top-level windows, such as dialog boxes, to point to their logical "parents". The window manager can then take down the dialog boxes when the "parent" gets iconified, for instance. vnc_unixsrc/Xvnc/programs/Xserver/dix/gc.c0100664000076400007640000007745407463513423020247 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: gc.c /main/70 1996/08/01 19:21:09 dpw $ */ /* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.4 1996/12/23 06:29:45 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "misc.h" #include "resource.h" #include "gcstruct.h" #include "pixmapstr.h" #include "dixfontstr.h" #include "scrnintstr.h" #include "region.h" #include "dix.h" #include extern XID clientErrorValue; extern FontPtr defaultFont; static Bool CreateDefaultTile( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); unsigned char DefaultDash[2] = {4, 4}; void ValidateGC(pDraw, pGC) DrawablePtr pDraw; GC *pGC; { (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw); pGC->stateChanges = 0; pGC->serialNumber = pDraw->serialNumber; } /* dixChangeGC(client, pGC, mask, pC32, pUnion) * * This function was created as part of the Security extension * implementation. The client performing the gc change must be passed so * that access checks can be performed on any tiles, stipples, or fonts * that are specified. ddxen can call this too; they should normally * pass NullClient for the client since any access checking should have * already been done at a higher level. * * Since we had to create a new function anyway, we decided to change the * way the list of gc values is passed to eliminate the compiler warnings * caused by the DoChangeGC interface. You can pass the values via pC32 * or pUnion, but not both; one of them must be NULL. If you don't need * to pass any pointers, you can use either one: * * /* example calling dixChangeGC using pC32 parameter * CARD32 v[2]; * v[0] = foreground; * v[1] = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL); * * /* example calling dixChangeGC using pUnion parameter; * /* same effect as above * ChangeGCVal v[2]; * v[0].val = foreground; * v[1].val = background; * dixChangeGC(client, pGC, GCForeground|GCBackground, NULL, v); * * However, if you need to pass a pointer to a pixmap or font, you MUST * use the pUnion parameter. * * /* example calling dixChangeGC passing pointers in the value list * ChangeGCVal v[2]; * v[0].val = FillTiled; * v[1].ptr = pPixmap; /* pointer to a pixmap * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v); * * Note: we could have gotten by with just the pUnion parameter, but on * 64 bit machines that would have forced us to copy the value list that * comes in the ChangeGC request. * * Ideally, we'd change all the DoChangeGC calls to dixChangeGC, but this * is far too many changes to consider at this time, so we've only * changed the ones that caused compiler warnings. New code should use * dixChangeGC. * * dpw */ #define NEXTVAL(_type, _var) { \ if (pC32) _var = (_type)*pC32++; \ else { \ _var = (_type)(pUnion->val); pUnion++; \ } \ } #define NEXT_PTR(_type, _var) { \ assert(pUnion); _var = (_type)pUnion->ptr; pUnion++; } int dixChangeGC(client, pGC, mask, pC32, pUnion) ClientPtr client; register GC *pGC; register BITS32 mask; CARD32 *pC32; ChangeGCValPtr pUnion; { register BITS32 index2; register int error = 0; PixmapPtr pPixmap; BITS32 maskQ; assert( (pC32 && !pUnion) || (!pC32 && pUnion) ); pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; maskQ = mask; /* save these for when we walk the GCque */ while (mask && !error) { index2 = (BITS32) lowbit (mask); mask &= ~index2; pGC->stateChanges |= index2; switch (index2) { case GCFunction: { CARD8 newalu; NEXTVAL(CARD8, newalu); if (newalu <= GXset) pGC->alu = newalu; else { clientErrorValue = newalu; error = BadValue; } break; } case GCPlaneMask: NEXTVAL(unsigned long, pGC->planemask); break; case GCForeground: NEXTVAL(unsigned long, pGC->fgPixel); /* * this is for CreateGC */ if (!pGC->tileIsPixel && !pGC->tile.pixmap) { pGC->tileIsPixel = TRUE; pGC->tile.pixel = pGC->fgPixel; } break; case GCBackground: NEXTVAL(unsigned long, pGC->bgPixel); break; case GCLineWidth: /* ??? line width is a CARD16 */ NEXTVAL(CARD16, pGC->lineWidth); break; case GCLineStyle: { unsigned int newlinestyle; NEXTVAL(unsigned int, newlinestyle); if (newlinestyle <= LineDoubleDash) pGC->lineStyle = newlinestyle; else { clientErrorValue = newlinestyle; error = BadValue; } break; } case GCCapStyle: { unsigned int newcapstyle; NEXTVAL(unsigned int, newcapstyle); if (newcapstyle <= CapProjecting) pGC->capStyle = newcapstyle; else { clientErrorValue = newcapstyle; error = BadValue; } break; } case GCJoinStyle: { unsigned int newjoinstyle; NEXTVAL(unsigned int, newjoinstyle); if (newjoinstyle <= JoinBevel) pGC->joinStyle = newjoinstyle; else { clientErrorValue = newjoinstyle; error = BadValue; } break; } case GCFillStyle: { unsigned int newfillstyle; NEXTVAL(unsigned int, newfillstyle); if (newfillstyle <= FillOpaqueStippled) pGC->fillStyle = newfillstyle; else { clientErrorValue = newfillstyle; error = BadValue; } break; } case GCFillRule: { unsigned int newfillrule; NEXTVAL(unsigned int, newfillrule); if (newfillrule <= WindingRule) pGC->fillRule = newfillrule; else { clientErrorValue = newfillrule; error = BadValue; } break; } case GCTile: { XID newpix = 0; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(XID, newpix); pPixmap = (PixmapPtr)SecurityLookupIDByType(client, newpix, RT_PIXMAP, SecurityReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != pGC->depth) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { pPixmap->refcnt++; if (!pGC->tileIsPixel) (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pPixmap; } } else { clientErrorValue = newpix; error = BadPixmap; } break; } case GCStipple: { XID newstipple = 0; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(XID, newstipple) pPixmap = (PixmapPtr)SecurityLookupIDByType(client, newstipple, RT_PIXMAP, SecurityReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { pPixmap->refcnt++; if (pGC->stipple) (* pGC->pScreen->DestroyPixmap)(pGC->stipple); pGC->stipple = pPixmap; } } else { clientErrorValue = newstipple; error = BadPixmap; } break; } case GCTileStipXOrigin: NEXTVAL(INT16, pGC->patOrg.x); break; case GCTileStipYOrigin: NEXTVAL(INT16, pGC->patOrg.y); break; case GCFont: { FontPtr pFont; XID newfont = 0; if (pUnion) { NEXT_PTR(FontPtr, pFont); } else { NEXTVAL(XID, newfont) pFont = (FontPtr)SecurityLookupIDByType(client, newfont, RT_FONT, SecurityReadAccess); } if (pFont) { pFont->refcnt++; if (pGC->font) CloseFont(pGC->font, (Font)0); pGC->font = pFont; } else { clientErrorValue = newfont; error = BadFont; } break; } case GCSubwindowMode: { unsigned int newclipmode; NEXTVAL(unsigned int, newclipmode); if (newclipmode <= IncludeInferiors) pGC->subWindowMode = newclipmode; else { clientErrorValue = newclipmode; error = BadValue; } break; } case GCGraphicsExposures: { unsigned int newge; NEXTVAL(unsigned int, newge); if (newge <= xTrue) pGC->graphicsExposures = newge; else { clientErrorValue = newge; error = BadValue; } break; } case GCClipXOrigin: NEXTVAL(INT16, pGC->clipOrg.x); break; case GCClipYOrigin: NEXTVAL(INT16, pGC->clipOrg.y); break; case GCClipMask: { Pixmap pid; int clipType; if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); } else { NEXTVAL(Pixmap, pid) if (pid == None) { clipType = CT_NONE; pPixmap = NullPixmap; } else pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pid, RT_PIXMAP, SecurityReadAccess); } if (pPixmap) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) { error = BadMatch; } else { clipType = CT_PIXMAP; pPixmap->refcnt++; } } else if (!pUnion && (pid != None)) { clientErrorValue = pid; error = BadPixmap; } if(error == Success) { (*pGC->funcs->ChangeClip)(pGC, clipType, (pointer)pPixmap, 0); } break; } case GCDashOffset: NEXTVAL(INT16, pGC->dashOffset); break; case GCDashList: { CARD8 newdash; NEXTVAL(CARD8, newdash); if (newdash == 4) { if (pGC->dash != DefaultDash) { xfree(pGC->dash); pGC->numInDashList = 2; pGC->dash = DefaultDash; } } else if (newdash != 0) { unsigned char *dash; dash = (unsigned char *)xalloc(2 * sizeof(unsigned char)); if (dash) { if (pGC->dash != DefaultDash) xfree(pGC->dash); pGC->numInDashList = 2; pGC->dash = dash; dash[0] = newdash; dash[1] = newdash; } else error = BadAlloc; } else { clientErrorValue = newdash; error = BadValue; } break; } case GCArcMode: { unsigned int newarcmode; NEXTVAL(unsigned int, newarcmode); if (newarcmode <= ArcPieSlice) pGC->arcMode = newarcmode; else { clientErrorValue = newarcmode; error = BadValue; } break; } default: clientErrorValue = maskQ; error = BadValue; break; } } /* end while mask && !error */ if (pGC->fillStyle == FillTiled && pGC->tileIsPixel) { if (!CreateDefaultTile (pGC)) { pGC->fillStyle = FillSolid; error = BadAlloc; } } (*pGC->funcs->ChangeGC)(pGC, maskQ); return error; } #undef NEXTVAL #undef NEXT_PTR /* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells * it that all of the entries are constants or IDs */ int ChangeGC(pGC, mask, pval) register GC *pGC; register BITS32 mask; XID *pval; { return (dixChangeGC(NullClient, pGC, mask, pval, NULL)); } /* DoChangeGC(pGC, mask, pval, fPointer) mask is a set of bits indicating which values to change. pval contains an appropriate value for each mask. fPointer is true if the values for tiles, stipples, fonts or clipmasks are pointers instead of IDs. Note: if you are passing pointers you MUST declare the array of values as type pointer! Other data types may not be large enough to hold pointers on some machines. Yes, this means you have to cast to (XID *) when you pass the array to DoChangeGC. Similarly, if you are not passing pointers (fPointer = 0) you MUST declare the array as type XID (not unsigned long!), or again the wrong size data type may be used. To avoid this cruftiness, use dixChangeGC above. if there is an error, the value is marked as changed anyway, which is probably wrong, but infrequent. NOTE: all values sent over the protocol for ChangeGC requests are 32 bits long */ int DoChangeGC(pGC, mask, pval, fPointer) register GC *pGC; register BITS32 mask; XID *pval; int fPointer; { int r; if (fPointer) /* XXX might be a problem on 64 bit big-endian servers */ r = dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval); else r = dixChangeGC(NullClient, pGC, mask, pval, NULL); return r; } /* CreateGC(pDrawable, mask, pval, pStatus) creates a default GC for the given drawable, using mask to fill in any non-default values. Returns a pointer to the new GC on success, NULL otherwise. returns status of non-default fields in pStatus BUG: should check for failure to create default tile */ static GCPtr #if NeedFunctionPrototypes AllocateGC(ScreenPtr pScreen) #else AllocateGC(pScreen) ScreenPtr pScreen; #endif { GCPtr pGC; register char *ptr; register DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; pGC = (GCPtr)xalloc(pScreen->totalGCSize); if (pGC) { ppriv = (DevUnion *)(pGC + 1); pGC->devPrivates = ppriv; sizes = pScreen->GCPrivateSizes; ptr = (char *)(ppriv + pScreen->GCPrivateLen); for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (pointer)ptr; ptr += size; } else ppriv->ptr = (pointer)NULL; } } return pGC; } GCPtr CreateGC(pDrawable, mask, pval, pStatus) DrawablePtr pDrawable; BITS32 mask; XID *pval; int *pStatus; { register GCPtr pGC; pGC = AllocateGC(pDrawable->pScreen); if (!pGC) { *pStatus = BadAlloc; return (GCPtr)NULL; } pGC->pScreen = pDrawable->pScreen; pGC->depth = pDrawable->depth; pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = GC_CHANGE_SERIAL_BIT; pGC->funcs = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcPieSlice; if (mask & GCForeground) { /* * magic special case -- ChangeGC checks for this condition * and snags the Foreground value to create a pseudo default-tile */ pGC->tileIsPixel = FALSE; pGC->tile.pixmap = NullPixmap; } else { pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; } pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = TRUE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; pGC->clientClipType = CT_NONE; pGC->clientClip = (pointer)NULL; pGC->numInDashList = 2; pGC->dash = DefaultDash; pGC->dashOffset = 0; pGC->lastWinOrg.x = 0; pGC->lastWinOrg.y = 0; /* use the default font and stipple */ pGC->font = defaultFont; defaultFont->refcnt++; pGC->stipple = pGC->pScreen->PixmapPerDepth[0]; pGC->stipple->refcnt++; pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pGC->pScreen->CreateGC)(pGC)) *pStatus = BadAlloc; else if (mask) *pStatus = ChangeGC(pGC, mask, pval); else *pStatus = Success; if (*pStatus != Success) { if (!pGC->tileIsPixel && !pGC->tile.pixmap) pGC->tileIsPixel = TRUE; /* undo special case */ FreeGC(pGC, (XID)0); pGC = (GCPtr)NULL; } return (pGC); } static Bool CreateDefaultTile (pGC) GCPtr pGC; { XID tmpval[3]; PixmapPtr pTile; GCPtr pgcScratch; xRectangle rect; CARD16 w, h; w = 1; h = 1; (*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen); pTile = (PixmapPtr) (*pGC->pScreen->CreatePixmap)(pGC->pScreen, w, h, pGC->depth); pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen); if (!pTile || !pgcScratch) { if (pTile) (*pTile->drawable.pScreen->DestroyPixmap)(pTile); if (pgcScratch) FreeScratchGC(pgcScratch); return FALSE; } tmpval[0] = GXcopy; tmpval[1] = pGC->tile.pixel; tmpval[2] = FillSolid; (void)ChangeGC(pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval); ValidateGC((DrawablePtr)pTile, pgcScratch); rect.x = 0; rect.y = 0; rect.width = w; rect.height = h; (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pTile, pgcScratch, 1, &rect); /* Always remember to free the scratch graphics context after use. */ FreeScratchGC(pgcScratch); pGC->tileIsPixel = FALSE; pGC->tile.pixmap = pTile; return TRUE; } int CopyGC(pgcSrc, pgcDst, mask) register GC *pgcSrc; register GC *pgcDst; register BITS32 mask; { register BITS32 index2; BITS32 maskQ; int error = 0; if (pgcSrc == pgcDst) return Success; pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT; pgcDst->stateChanges |= mask; maskQ = mask; while (mask) { index2 = (BITS32) lowbit (mask); mask &= ~index2; switch (index2) { case GCFunction: pgcDst->alu = pgcSrc->alu; break; case GCPlaneMask: pgcDst->planemask = pgcSrc->planemask; break; case GCForeground: pgcDst->fgPixel = pgcSrc->fgPixel; break; case GCBackground: pgcDst->bgPixel = pgcSrc->bgPixel; break; case GCLineWidth: pgcDst->lineWidth = pgcSrc->lineWidth; break; case GCLineStyle: pgcDst->lineStyle = pgcSrc->lineStyle; break; case GCCapStyle: pgcDst->capStyle = pgcSrc->capStyle; break; case GCJoinStyle: pgcDst->joinStyle = pgcSrc->joinStyle; break; case GCFillStyle: pgcDst->fillStyle = pgcSrc->fillStyle; break; case GCFillRule: pgcDst->fillRule = pgcSrc->fillRule; break; case GCTile: { if (EqualPixUnion(pgcDst->tileIsPixel, pgcDst->tile, pgcSrc->tileIsPixel, pgcSrc->tile)) { break; } if (!pgcDst->tileIsPixel) (* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap); pgcDst->tileIsPixel = pgcSrc->tileIsPixel; pgcDst->tile = pgcSrc->tile; if (!pgcDst->tileIsPixel) pgcDst->tile.pixmap->refcnt++; break; } case GCStipple: { if (pgcDst->stipple == pgcSrc->stipple) break; if (pgcDst->stipple) (* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple); pgcDst->stipple = pgcSrc->stipple; if (pgcDst->stipple) pgcDst->stipple->refcnt ++; break; } case GCTileStipXOrigin: pgcDst->patOrg.x = pgcSrc->patOrg.x; break; case GCTileStipYOrigin: pgcDst->patOrg.y = pgcSrc->patOrg.y; break; case GCFont: if (pgcDst->font == pgcSrc->font) break; if (pgcDst->font) CloseFont(pgcDst->font, (Font)0); if ((pgcDst->font = pgcSrc->font) != NullFont) (pgcDst->font)->refcnt++; break; case GCSubwindowMode: pgcDst->subWindowMode = pgcSrc->subWindowMode; break; case GCGraphicsExposures: pgcDst->graphicsExposures = pgcSrc->graphicsExposures; break; case GCClipXOrigin: pgcDst->clipOrg.x = pgcSrc->clipOrg.x; break; case GCClipYOrigin: pgcDst->clipOrg.y = pgcSrc->clipOrg.y; break; case GCClipMask: (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); break; case GCDashOffset: pgcDst->dashOffset = pgcSrc->dashOffset; break; case GCDashList: if (pgcSrc->dash == DefaultDash) { if (pgcDst->dash != DefaultDash) { xfree(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = pgcSrc->dash; } } else { unsigned char *dash; unsigned int i; dash = (unsigned char *)xalloc(pgcSrc->numInDashList * sizeof(unsigned char)); if (dash) { if (pgcDst->dash != DefaultDash) xfree(pgcDst->dash); pgcDst->numInDashList = pgcSrc->numInDashList; pgcDst->dash = dash; for (i=0; inumInDashList; i++) dash[i] = pgcSrc->dash[i]; } else error = BadAlloc; } break; case GCArcMode: pgcDst->arcMode = pgcSrc->arcMode; break; default: clientErrorValue = maskQ; error = BadValue; break; } } if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel) { if (!CreateDefaultTile (pgcDst)) { pgcDst->fillStyle = FillSolid; error = BadAlloc; } } (*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst); return error; } /***************** * FreeGC * does the diX part of freeing the characteristics in the GC ***************/ /*ARGSUSED*/ int FreeGC(value, gid) pointer value; /* must conform to DeleteType */ XID gid; { GCPtr pGC = (GCPtr)value; CloseFont(pGC->font, (Font)0); (* pGC->funcs->DestroyClip)(pGC); if (!pGC->tileIsPixel) (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap); if (pGC->stipple) (* pGC->pScreen->DestroyPixmap)(pGC->stipple); (*pGC->funcs->DestroyGC) (pGC); if (pGC->dash != DefaultDash) xfree(pGC->dash); xfree(pGC); return(Success); } void SetGCMask(pGC, selectMask, newDataMask) GCPtr pGC; Mask selectMask; Mask newDataMask; { pGC->stateChanges = (~selectMask & pGC->stateChanges) | (selectMask & newDataMask); if (selectMask & newDataMask) pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; } /* CreateScratchGC(pScreen, depth) like CreateGC, but doesn't do the default tile or stipple, since we can't create them without already having a GC. any code using the tile or stipple has to set them explicitly anyway, since the state of the scratch gc is unknown. This is OK because ChangeGC() has to be able to deal with NULL tiles and stipples anyway (in case the CreateGC() call has provided a value for them -- we can't set the default tile until the client-supplied attributes are installed, since the fgPixel is what fills the default tile. (maybe this comment should go with CreateGC() or ChangeGC().) */ GCPtr CreateScratchGC(pScreen, depth) ScreenPtr pScreen; unsigned depth; { register GCPtr pGC; pGC = AllocateGC(pScreen); if (!pGC) return (GCPtr)NULL; pGC->pScreen = pScreen; pGC->depth = depth; pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcPieSlice; pGC->font = defaultFont; if ( pGC->font) /* necessary, because open of default font could fail */ pGC->font->refcnt++; pGC->tileIsPixel = TRUE; pGC->tile.pixel = 0; pGC->stipple = NullPixmap; pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = TRUE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; pGC->clientClipType = CT_NONE; pGC->dashOffset = 0; pGC->numInDashList = 2; pGC->dash = DefaultDash; pGC->lastWinOrg.x = 0; pGC->lastWinOrg.y = 0; pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pScreen->CreateGC)(pGC)) { FreeGC(pGC, (XID)0); pGC = (GCPtr)NULL; } return pGC; } void FreeGCperDepth(screenNum) int screenNum; { register int i; register ScreenPtr pScreen; GCPtr *ppGC; pScreen = screenInfo.screens[screenNum]; ppGC = pScreen->GCperDepth; for (i = 0; i <= pScreen->numDepths; i++) (void)FreeGC(ppGC[i], (XID)0); pScreen->rgf = ~0L; } Bool CreateGCperDepth(screenNum) int screenNum; { register int i; register ScreenPtr pScreen; DepthPtr pDepth; GCPtr *ppGC; pScreen = screenInfo.screens[screenNum]; pScreen->rgf = 0; ppGC = pScreen->GCperDepth; /* do depth 1 separately because it's not included in list */ if (!(ppGC[0] = CreateScratchGC(pScreen, 1))) return FALSE; ppGC[0]->graphicsExposures = FALSE; pDepth = pScreen->allowedDepths; for (i=0; inumDepths; i++, pDepth++) { if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth))) { for (; i >= 0; i--) (void)FreeGC(ppGC[i], (XID)0); return FALSE; } ppGC[i+1]->graphicsExposures = FALSE; } return TRUE; } Bool CreateDefaultStipple(screenNum) int screenNum; { register ScreenPtr pScreen; XID tmpval[3]; xRectangle rect; CARD16 w, h; GCPtr pgcScratch; pScreen = screenInfo.screens[screenNum]; w = 16; h = 16; (* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen); if (!(pScreen->PixmapPerDepth[0] = (*pScreen->CreatePixmap)(pScreen, w, h, 1))) return FALSE; /* fill stipple with 1 */ tmpval[0] = GXcopy; tmpval[1] = 1; tmpval[2] = FillSolid; pgcScratch = GetScratchGC(1, pScreen); if (!pgcScratch) { (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]); return FALSE; } (void)ChangeGC(pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval); ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch); rect.x = 0; rect.y = 0; rect.width = w; rect.height = h; (*pgcScratch->ops->PolyFillRect)((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch, 1, &rect); FreeScratchGC(pgcScratch); return TRUE; } void FreeDefaultStipple(screenNum) int screenNum; { ScreenPtr pScreen = screenInfo.screens[screenNum]; (*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]); } int SetDashes(pGC, offset, ndash, pdash) register GCPtr pGC; unsigned offset; register unsigned ndash; register unsigned char *pdash; { register long i; register unsigned char *p, *indash; BITS32 maskQ = 0; i = ndash; p = pdash; while (i--) { if (!*p++) { /* dash segment must be > 0 */ clientErrorValue = 0; return BadValue; } } if (ndash & 1) p = (unsigned char *)xalloc(2 * ndash * sizeof(unsigned char)); else p = (unsigned char *)xalloc(ndash * sizeof(unsigned char)); if (!p) return BadAlloc; pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; if (offset != pGC->dashOffset) { pGC->dashOffset = offset; pGC->stateChanges |= GCDashOffset; maskQ |= GCDashOffset; } if (pGC->dash != DefaultDash) xfree(pGC->dash); pGC->numInDashList = ndash; pGC->dash = p; if (ndash & 1) { pGC->numInDashList += ndash; indash = pdash; i = ndash; while (i--) *p++ = *indash++; } while(ndash--) *p++ = *pdash++; pGC->stateChanges |= GCDashList; maskQ |= GCDashList; if (pGC->funcs->ChangeGC) (*pGC->funcs->ChangeGC) (pGC, maskQ); return Success; } int VerifyRectOrder(nrects, prects, ordering) int nrects; xRectangle *prects; int ordering; { register xRectangle *prectP, *prectN; register int i; switch(ordering) { case Unsorted: return CT_UNSORTED; case YSorted: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if(prectN->y < prectP->y) return -1; } return CT_YSORTED; case YXSorted: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if((prectN->y < prectP->y) || ( (prectN->y == prectP->y) && (prectN->x < prectP->x) ) ) return -1; } return CT_YXSORTED; case YXBanded: if(nrects > 1) { for(i = 1, prectP = prects, prectN = prects + 1; i < nrects; i++, prectP++, prectN++) if((prectN->y != prectP->y && prectN->y < prectP->y + (int) prectP->height) || ((prectN->y == prectP->y) && (prectN->height != prectP->height || prectN->x < prectP->x + (int) prectP->width))) return -1; } return CT_YXBANDED; } return -1; } int SetClipRects(pGC, xOrigin, yOrigin, nrects, prects, ordering) GCPtr pGC; int xOrigin, yOrigin; int nrects; xRectangle *prects; int ordering; { int newct, size; xRectangle *prectsNew; newct = VerifyRectOrder(nrects, prects, ordering); if (newct < 0) return(BadMatch); size = nrects * sizeof(xRectangle); prectsNew = (xRectangle *) xalloc(size); if (!prectsNew && size) return BadAlloc; pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; pGC->clipOrg.x = xOrigin; pGC->stateChanges |= GCClipXOrigin; pGC->clipOrg.y = yOrigin; pGC->stateChanges |= GCClipYOrigin; if (size) memmove((char *)prectsNew, (char *)prects, size); (*pGC->funcs->ChangeClip)(pGC, newct, (pointer)prectsNew, nrects); if (pGC->funcs->ChangeGC) (*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask); return Success; } /* sets reasonable defaults if we can get a pre-allocated one, use it and mark it as used. if we can't, create one out of whole cloth (The Velveteen GC -- if you use it often enough it will become real.) */ GCPtr GetScratchGC(depth, pScreen) register unsigned depth; register ScreenPtr pScreen; { register int i; register GCPtr pGC; for (i=0; i<=pScreen->numDepths; i++) if ( pScreen->GCperDepth[i]->depth == depth && !(pScreen->rgf & (1L << (i+1))) ) { pScreen->rgf |= (1L << (i+1)); pGC = (pScreen->GCperDepth[i]); pGC->alu = GXcopy; pGC->planemask = ~0; pGC->serialNumber = 0; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; pGC->lineStyle = LineSolid; pGC->capStyle = CapButt; pGC->joinStyle = JoinMiter; pGC->fillStyle = FillSolid; pGC->fillRule = EvenOddRule; pGC->arcMode = ArcChord; pGC->patOrg.x = 0; pGC->patOrg.y = 0; pGC->subWindowMode = ClipByChildren; pGC->graphicsExposures = FALSE; pGC->clipOrg.x = 0; pGC->clipOrg.y = 0; if (pGC->clientClipType != CT_NONE) (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0); pGC->stateChanges = (1 << (GCLastBit+1)) - 1; return pGC; } /* if we make it this far, need to roll our own */ pGC = CreateScratchGC(pScreen, depth); if (pGC) pGC->graphicsExposures = FALSE; return pGC; } /* if the gc to free is in the table of pre-existing ones, mark it as available. if not, free it for real */ void FreeScratchGC(pGC) register GCPtr pGC; { register ScreenPtr pScreen = pGC->pScreen; register int i; for (i=0; i<=pScreen->numDepths; i++) { if ( pScreen->GCperDepth[i] == pGC) { pScreen->rgf &= ~(1L << (i+1)); return; } } (void)FreeGC(pGC, (GContext)0); } vnc_unixsrc/Xvnc/programs/Xserver/Xprint/0040775000076400007640000000000010616336470020173 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/Xprint/DiPrint.h0100664000076400007640000000440707120677563021726 0ustar constconst/* $XConsortium: DiPrint.h /main/1 1996/09/28 16:57:42 rws $ */ /* (c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 International Business Machines Corp. (c) Copyright 1996 Sun Microsystems, Inc. (c) Copyright 1996 Novell, Inc. (c) Copyright 1996 Digital Equipment Corp. (c) Copyright 1996 Fujitsu Limited (c) Copyright 1996 Hitachi, Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the names of the copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ /* * The XpDiListEntry struct is the type of each element of the array * handed back to the extension code to handle a GetPrinterList request. * We don't use the printerDb directly because of the desire to handle * multiple locales. Creating this new array for each GetPrinterList * request will allow us to build it with the description in the locale of * the requesting client. */ typedef struct _diListEntry { char *name; char *description; char *localeName; unsigned long rootWinId; } XpDiListEntry; extern void XpDiFreePrinterList(XpDiListEntry **list); extern XpDiListEntry **XpDiGetPrinterList( int nameLen, char *name, int localeLen, char *locale); vnc_unixsrc/Xvnc/programs/Xserver/Xext/0040775000076400007640000000000010616336470017637 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/Xext/xtest1dd.c0100664000076400007640000011703107120677563021552 0ustar constconst/* $XConsortium: xtest1dd.c,v 1.14 94/04/17 20:33:00 gildea Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.0 1996/05/06 05:55:42 dawes Exp $ */ /* * File: xtest1dd.c * * This file contains the device dependent parts of the input * synthesis extension. */ /* Copyright (c) 1986, 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hewlett-Packard makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. */ /*************************************************************** * include files ***************************************************************/ #define NEED_EVENTS #define NEED_REPLIES #include #include "Xos.h" #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #define XTestSERVER_SIDE #include "xtestext1.h" #include "xtest1dd.h" /*************************************************************** * defines ***************************************************************/ /* * the size of the fake input action array */ #define ACTION_ARRAY_SIZE 100 /*************************************************************** * externals ***************************************************************/ /* * Holds the xTestInputAction event type code. * This is defined in xtestext1di.c. */ extern int XTestInputActionType; /* * Holds the xTestFakeAck event type code. * This is defined in xtestext1di.c. */ extern int XTestFakeAckType; /* * used in the WriteReplyToClient macro */ extern int exclusive_steal; /*************************************************************** * variables ***************************************************************/ /* * array to hold fake input actions */ struct { /* * holds the action type, one of: XTestDELAY_ACTION, * XTestKEY_ACTION, XTestMOTION_ACTION, XTestJUMP_ACTION */ CARD8 type; /* * holds the device type, in the range 0 to 15 */ CARD8 device; /* * for XTestKEY_ACTION type, holds the keycode */ CARD8 keycode; /* * for XTestKEY_ACTION type, holds the key up/down state */ CARD8 keystate; /* * for XTestMOTION_ACTION and XTestJUMP_ACTION types, * holds the x and y coordinates to move the mouse to */ int x; int y; /* * holds the time to delay (in milliseconds) before performing * the action */ CARD32 delay_time; }action_array[ACTION_ARRAY_SIZE]; /* * write index for input action array */ static int write_index = 0; /* * read index for input action array */ static int read_index = 0; /* * this is where the input actions are accumulated until they are sent * to a client (in a wire event) */ static xTestInputActionEvent input_action_packet; /* * holds the index (in bytes) into the input actions buffer in the * current input action event */ static int packet_index; /* * set to 1 when the input action event is full and needs to be sent to the * client */ static int input_action_event_full = 0; /* * logical x position of the mouse during input action gathering */ short xtest_mousex; /* * logical y position of the mouse during input action gathering */ short xtest_mousey; /* * logical x position of the mouse during input action playback */ static short mx; /* * logical y position of the mouse during input action playback */ static short my; /* * logical x position of the mouse while we are reading fake input actions * from the client and putting them into the fake input action array */ static short pmousex; /* * logical y position of the mouse while we are reading fake input actions * from the client and putting them into the fake input action array */ static short pmousey; /* * The playback_on flag is set to 1 while there are input actions in the * input action array. It is set to 0 when the server has received all of * the user actions. */ int playback_on = 0; /* * identity of the client using XTestGetInput to get user input actions */ ClientPtr current_xtest_client; /* * if 1 send multiple input actions per XTestInputAction event; * if 0 send one input action per XTestInputAction event */ static char packed_mode; /* * identity of the client using the XTestFakeInput function to send some * fake input actions to the server */ ClientPtr playback_client = NULL; /* * Set to 1 when the XTestFAKE_ACK_REQUEST flag is set in a XTestFakeInput * request. Set back to 0 when all of the input actions have been sent * to the server. */ static int acknowledge = 0; /* * The server's idea of the current time is saved in these variables when * a XTestFakeInput request is received. It is restored when all fake input * actions are sent to the server or when the playback client disconnects. */ static int saved_sec; static int saved_usec; /* * Set to 1 when there is a valid time in saved_sec and saved_usec. */ static int time_saved = 0; /* * holds the extension's notion of what the current time is while it is * sending input actions to a client */ static struct timeval current_time; /* * holds the time when the extension should place the next fake input action * into the server's normal events queue */ static struct timeval play_time; /* * set to 1 when play_time is first set, cleared to 0 when the * client using the extension disconnects, or when XTestReset is called */ static char play_clock = 0; /* * holds the amount of time left until the next input action from the * input action array can be sent to the server */ static struct timeval rtime; /* * Set to 1 after the extension is done waiting for the correct time delay * for an input action to be sent to the server. Remains a 1 until the time * delay for the next input action is computed. Then set to 0 if the * extension has to wait for the correct time delay. */ static int go_for_next = 1; /* * needed to restore waitime if playback is to be aborted */ static struct timeval *restorewait; /* * tmon special command key * * To use the test monitor program (called tmon) efficiently, it is * desirable to have the extension be able to recognize a special "trigger" * key. If the extension did not do this, tmon would have to have the * extension send all keyboard user input actions exclusively to tmon, * only to have tmon send them right back if they were not the command key. * * If the extension can recognize the command key, then tmon can let the * extension handle keyboard user input actions normally until the command * key is pressed (and released), and only then have the extension start * sending keyboard user input actions exclusively to tmon. * * Any key on the keyboard can be used for this command key. It is most * convenient if it is a low-frequency key. If you want to generate a * normal occurrance of this key to a client, just hit it twice. Tmon * will recognize the first occurrance of the key, take control of the input * actions, and wait for certain keys. If it sees another occurrance of the * command key, it will send one occurrance of the command key to the * extension, and go back to waiting. * * set and also referenced in device layer * XXX there should be a way to set this through the protocol */ KeyCode xtest_command_key = 0; /*************************************************************** * function declarations ***************************************************************/ static void parse_key_fake( #if NeedFunctionPrototypes XTestKeyInfo * /* fkey */ #endif ); static void parse_motion_fake( #if NeedFunctionPrototypes XTestMotionInfo * /* fmotion */ #endif ); static void parse_jump_fake( #if NeedFunctionPrototypes XTestJumpInfo * /* fjump */ #endif ); static void parse_delay_fake( #if NeedFunctionPrototypes XTestDelayInfo * /* tevent */ #endif ); static void send_ack( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); static void start_play_clock( #if NeedFunctionPrototypes void #endif ); static void compute_action_time( #if NeedFunctionPrototypes struct timeval * /* rtime */ #endif ); static int find_residual_time( #if NeedFunctionPrototypes struct timeval * /* rtime */ #endif ); static CARD16 check_time_event( #if NeedFunctionPrototypes void #endif ); static CARD32 current_ms( #if NeedFunctionPrototypes struct timeval * /* otime */ #endif ); static int there_is_room( #if NeedFunctionPrototypes int /* actsize */ #endif ); /****************************************************************************** * * stop_stealing_input * * Stop stealing input actions. */ void stop_stealing_input() { /* * put any code that you might need to stop stealing input actions here */ if (packet_index != 0) { /* * if there is a partially full input action event waiting * when this function is called, send it to the client */ flush_input_actions(); } } /****************************************************************************** * * steal_input * * Start stealing input actions and sending them to the passed-in client. */ void steal_input(client, mode) /* * which client is to receive the input action events */ ClientPtr client; /* * what input action packing mode to use. one of 0, XTestPACKED_MOTION, * or XTestPACKED_ACTIONS; optionally 'or'ed with XTestEXCLUSIVE, */ CARD32 mode; { if (packet_index != 0) { /* * if there is a partially full input action event waiting * when this function is called, send it to the client */ flush_input_actions(); } else { /* * otherwise, set up a new input action event */ input_action_packet.type = XTestInputActionType; packet_index = 0; } /* * set up the new input action packing mode */ packed_mode = mode & ~(XTestEXCLUSIVE); /* * keep track of where the mouse is */ XTestGetPointerPos(&xtest_mousex, &xtest_mousey); /* * keep track of which client is getting input actions */ current_xtest_client = client; /* * find out what time it is */ X_GETTIMEOFDAY(¤t_time); /* * jump to the initial position of the mouse, using a device type of 0. */ XTestStealJumpData(xtest_mousex, xtest_mousey, 0); } /****************************************************************************** * * flush_input_actions * * Write the input actions event to the current requesting client * and re-initialize the input action event. */ void flush_input_actions() { /* * pointer to the input action event */ char *rep; /* * loop index */ int i; if (packet_index == 0) { /* * empty input actions event */ return; } else if (packet_index < XTestACTIONS_SIZE) { /* * fill to the end of the input actions event with 0's */ for (i = packet_index; i sequence; /* * send the input action event to the client */ WriteEventsToClient(current_xtest_client, 1, (xEvent *) rep); /* * re-initialize the input action event */ input_action_event_full = 0; input_action_packet.type = XTestInputActionType; packet_index = 0; } /****************************************************************************** * * XTestStealJumpData * * Create one or more input actions and put them in the input action * event. The input actions will be an (maybe) XTestDELAY_ACTION * and an XTestJUMP_ACTION. */ void XTestStealJumpData(jx, jy, dev_type) /* * the x and y coordinates to jump to */ short jx; short jy; /* * which device caused the jump */ int dev_type; { XTestJumpInfo *jmp_ptr; /* * time delta (in ms) from previous event */ CARD16 tchar; /* * Get the time delta from the previous event. If needed, * the check_time_event routine will put an XTestDELAY_ACTION * type action in the input action event. */ tchar = check_time_event(); if (!there_is_room(sizeof(XTestJumpInfo))) { /* * If there isn't room in the input action event for * an XTestJUMP_ACTION, then send that event to the * client and start filling an empty one. */ flush_input_actions(); } /* * update the logical mouse position */ xtest_mousex = jx; xtest_mousey = jy; /* * point jmp_ptr to the correct place in the input action event */ jmp_ptr = (XTestJumpInfo *) &(input_action_packet.actions[packet_index]); /* * compute the input action header */ jmp_ptr->header = (XTestPackDeviceID(dev_type) | XTestJUMP_ACTION); /* * set the x and y coordinates to jump to in the input action */ jmp_ptr->jumpx = jx; jmp_ptr->jumpy = jy; /* * set the delay time in the input action */ jmp_ptr->delay_time = tchar; /* * increment the packet index by the size of the input action */ packet_index = packet_index + sizeof(XTestJumpInfo); if (packed_mode == 0) { /* * if input actions are not packed, send the input * action event to the client */ flush_input_actions(); } } /****************************************************************************** * * current_ms * * Returns the number of milliseconds from the passed-in time to the * current time, and then updates the passed-in time to the current time. */ static CARD32 current_ms(otime) struct timeval *otime; { struct timeval tval; unsigned long the_ms; unsigned long sec; unsigned long usec; /* * get the current time */ X_GETTIMEOFDAY(&tval); if (tval.tv_usec < otime->tv_usec) { /* * borrow a second's worth of microseconds if needed */ usec = tval.tv_usec - otime->tv_usec + 1000000; sec = tval.tv_sec - 1 - otime->tv_sec; } else { usec = tval.tv_usec - otime->tv_usec; sec = tval.tv_sec - otime->tv_sec; } /* * update the passed-in time to the new time */ *otime = tval; /* * compute the number of milliseconds contained in * 'sec' seconds and 'usec' microseconds */ the_ms = (sec * 1000000L + usec) / 1000L; return (the_ms); } /****************************************************************************** * * check_time_event * * If time delta is > XTestSHORT_DELAY_TIME then insert a time event * and return 0; else return the delay time. */ static CARD16 check_time_event() { CARD32 tstamp; CARD16 tchar; XTestDelayInfo *tptr; /* * get the number of milliseconds between input actions */ tstamp = current_ms(¤t_time); /* * if the number of milliseconds is too large to fit in a CARD16, * then add a XTestDELAY_ACTION to the input action event. */ if (tstamp > XTestSHORT_DELAY_TIME) { /* * If there isn't room in the input action event for * an XTestDELAY_ACTION, then send that event to the * client and start filling an empty one. */ if (!there_is_room(sizeof(XTestDelayInfo))) { flush_input_actions(); } /* * point tptr to the correct place in the input action event */ tptr = (XTestDelayInfo *) (&(input_action_packet.actions[packet_index])); /* * compute the input action header */ tptr->header = XTestPackDeviceID(XTestDELAY_DEVICE_ID) | XTestDELAY_ACTION; /* * set the delay time in the input action */ tptr->delay_time = tstamp; /* * increment the packet index by the size of the input action */ packet_index = packet_index + (sizeof(XTestDelayInfo)); if (packed_mode != XTestPACKED_ACTIONS) { /* * if input actions are not packed, send the input * action event to the client */ flush_input_actions(); } /* * set the returned delay time to 0 */ tchar = 0; } else { /* * set the returned delay time to the computed delay time */ tchar = tstamp; } return(tchar); } /****************************************************************************** * * there_is_room * * Checks if there is room in the input_action_packet for an input action * of the size actsize bytes. Returns 1 if there is space, 0 otherwise. * */ static int there_is_room(actsize) /* * the number of bytes of space needed */ int actsize; { if ((packet_index + actsize) > XTestACTIONS_SIZE) { input_action_event_full = 1; return(0); } else { return(1); } } /****************************************************************************** * * XTestStealMotionData * * Put motion information from the locator into an input action. * * called from x_hil.c */ void XTestStealMotionData(dx, dy, dev_type, mx, my) /* * the x and y delta motion of the locator */ short dx; short dy; /* * which locator did the moving */ int dev_type; /* * the x and y position of the locator before the delta motion */ short mx; short my; { /* * pointer to a XTestMOTION_ACTION input action */ XTestMotionInfo *fm; /* * time delta from previous event */ CARD16 tchar; /* * if the current position of the locator is not the same as * the logical position, then update the logical position */ if ((mx != xtest_mousex) || (my != xtest_mousey)) { XTestStealJumpData(mx, my, dev_type); } /* * if the delta motion is outside the range that can * be held in a motion input action, use a jump input action */ if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) || (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN)) { XTestStealJumpData((xtest_mousex + dx), (xtest_mousey + dy), dev_type); } else { /* * compute the new logical position of the mouse */ xtest_mousex += dx; xtest_mousey += dy; /* * Get the time delta from the previous event. If needed, * the check_time_event routine will put an XTestDELAY_ACTION * type action in the input action event. */ tchar = check_time_event(); /* * If there isn't room in the input action event for * an XTestDELAY_ACTION, then send that event to the * client and start filling an empty one. */ if (!there_is_room(sizeof(XTestMotionInfo))) { flush_input_actions(); /* * point fm to the correct place in the input action event */ } fm = (XTestMotionInfo *) &(input_action_packet.actions[packet_index]); /* * compute the input action header */ fm->header = XTestMOTION_ACTION; if (dx < 0) { fm->header |= XTestX_NEGATIVE; dx = abs(dx); } if (dy < 0) { fm->header |= XTestY_NEGATIVE; dy = abs(dy); } fm->header |= XTestPackDeviceID(dev_type); /* * compute the motion data byte */ fm->motion_data = XTestPackYMotionValue(dy); fm->motion_data |= XTestPackXMotionValue(dx); /* * set the delay time in the input action */ fm->delay_time = tchar; /* * increment the packet index by the size of the input action */ packet_index = packet_index + sizeof(XTestMotionInfo); if (packed_mode == 0) { /* * if input actions are not packed, send the input * action event to the client */ flush_input_actions(); } } } /****************************************************************************** * * XTestStealKeyData * * Place this key data in the input_action_packet. * */ Bool XTestStealKeyData(keycode, keystate, dev_type, locx, locy) /* * which key/button moved */ CARD8 keycode; /* * whether the key/button was pressed or released */ char keystate; /* * which device caused the input action */ int dev_type; /* * the x and y coordinates of the locator when the action happenned */ short locx; short locy; { /* * pointer to key/button motion input action */ XTestKeyInfo *kp; /* * time delta from previous event */ CARD16 tchar; char keytrans; /* * update the logical position of the locator if the physical position * of the locator is not the same as the logical position. */ if ((locx != xtest_mousex) || (locy != xtest_mousey)) { XTestStealJumpData(locx, locy, dev_type); } /* * Get the time delta from the previous event. If needed, * the check_time_event routine will put an XTestDELAY_ACTION * type action in the input action event. */ tchar = check_time_event(); if (!there_is_room(sizeof(XTestKeyInfo))) { /* * If there isn't room in the input action event for * an XTestDELAY_ACTION, then send that event to the * client and start filling an empty one. */ flush_input_actions(); } /* * point kp to the correct place in the input action event */ kp = (XTestKeyInfo *) (&(input_action_packet.actions[packet_index])); /* * compute the input action header */ kp->header = XTestPackDeviceID(dev_type); if ((keystate == KeyRelease) || (keystate == ButtonRelease)) { keytrans = XTestKEY_UP; } else if ((keystate == KeyPress) || (keystate == ButtonPress)) { keytrans = XTestKEY_DOWN; } else { printf("%s: invalid key/button state %d.\n", XTestEXTENSION_NAME, keystate); } kp->header = kp->header | keytrans | XTestKEY_ACTION; /* * set the keycode in the input action */ kp->keycode = keycode; /* * set the delay time in the input action */ kp->delay_time = tchar; /* * increment the packet index by the size of the input action */ packet_index = packet_index + sizeof(XTestKeyInfo); /* * if the command key has been released or input actions are not * packed, send the input action event to the client */ if(((keycode == xtest_command_key) && (keystate == KeyRelease)) || (packed_mode != XTestPACKED_ACTIONS)) { flush_input_actions(); } /* return TRUE if the event should be passed on to DIX */ if (exclusive_steal) return ((keystate == KeyRelease) && (keycode == xtest_command_key)); else return ((keystate != KeyRelease) || (keycode != xtest_command_key)); } /****************************************************************************** * * parse_fake_input * * Parsing routine for a XTestFakeInput request. It will take a request * and parse its contents into the input action array. Eventually the * XTestProcessInputAction routine will be called to take input actions * from the input action array and send them to the server to be handled. */ void parse_fake_input(client, req) /* * which client did the XTestFakeInput request */ ClientPtr client; /* * a pointer to the xTestFakeInputReq structure sent by the client */ char *req; { /* * if set to 1, done processing input actions from the request */ int done = 0; /* * type of input action */ CARD8 action_type; /* * device type */ CARD8 dev_type; /* * pointer to an xTestFakeInputReq structure */ xTestFakeInputReq *request; /* * holds the index into the action list in the request */ int parse_index; /* * get a correct-type pointer to the client-supplied request data */ request = (xTestFakeInputReq *) req; /* * save the acknowledge requested state for use in * XTestProcessInputAction */ acknowledge = request->ack; /* * set up an index into the action list in the request */ parse_index = 0; if (write_index >= ACTION_ARRAY_SIZE) { /* * if the input action array is full, don't add any more */ done = 1; } while (!done) { /* * get the type of input action in the list */ action_type = (request->action_list[parse_index]) & XTestACTION_TYPE_MASK; /* * get the type of device in the list */ dev_type = XTestUnpackDeviceID(request->action_list[parse_index]); /* * process the input action appropriately */ switch (action_type) { case XTestKEY_ACTION: parse_key_fake((XTestKeyInfo *) &(request->action_list[parse_index])); parse_index = parse_index + sizeof(XTestKeyInfo); break; case XTestMOTION_ACTION: parse_motion_fake((XTestMotionInfo *) &(request->action_list[parse_index])); parse_index = parse_index + sizeof(XTestMotionInfo); break; case XTestJUMP_ACTION: parse_jump_fake((XTestJumpInfo *) &(request->action_list[parse_index])); parse_index = parse_index + sizeof(XTestJumpInfo); break; case XTestDELAY_ACTION: if (dev_type == XTestDELAY_DEVICE_ID) { parse_delay_fake((XTestDelayInfo *) &(request->action_list[parse_index])); parse_index = parse_index + sizeof(XTestDelayInfo); } else { /* * An invalid input action header byte has * been detected, so there are no more * input actions in this request. * The intended invalid action header byte * for this case should have a value of 0. */ done = 1; } break; } if (parse_index >= XTestMAX_ACTION_LIST_SIZE) { /* * entire XTestFakeInput request has been processed */ done = 1; } if (write_index >= ACTION_ARRAY_SIZE) { /* * no room in the input actions array */ done = 1; } } if (write_index > read_index) { /* * there are fake input actions in the input action array * to be given to the server */ playback_on = 1; playback_client = client; } } /****************************************************************************** * * parse_key_fake * * Called from parse_fake_input. * * Copy the fake key input action from its packed form into the array of * pending input events. */ static void parse_key_fake(fkey) XTestKeyInfo *fkey; { action_array[write_index].type = XTestKEY_ACTION; action_array[write_index].device = XTestUnpackDeviceID(fkey->header); action_array[write_index].keycode = fkey->keycode; action_array[write_index].keystate = fkey->header & XTestKEY_STATE_MASK; action_array[write_index].delay_time = fkey->delay_time; write_index++; } /****************************************************************************** * * parse_motion_fake * * Called from parse_fake_input. * * Copy the fake motion input action from its packed form into the array of * pending input events. */ static void parse_motion_fake(fmotion) XTestMotionInfo *fmotion; { int dx; int dy; dx = (XTestUnpackXMotionValue(fmotion->motion_data)); dy = (XTestUnpackYMotionValue(fmotion->motion_data)); if (((fmotion->header) & XTestX_SIGN_BIT_MASK) == XTestX_NEGATIVE) { pmousex -= dx; } else { pmousex += dx; } if (((fmotion->header) & XTestY_SIGN_BIT_MASK) == XTestY_NEGATIVE) { pmousey -= dy; } else { pmousey += dy; } action_array[write_index].type = XTestJUMP_ACTION; action_array[write_index].device = XTestUnpackDeviceID(fmotion->header); action_array[write_index].x = pmousex; action_array[write_index].y = pmousey; action_array[write_index].delay_time = fmotion->delay_time; write_index++; } /****************************************************************************** * * parse_jump_fake * * Called from parse_fake_input. * * Copy the fake jump input action from its packed form into the array of * pending input events. */ static void parse_jump_fake(fjump) XTestJumpInfo *fjump; { pmousex = fjump->jumpx; pmousey = fjump->jumpy; action_array[write_index].type = XTestJUMP_ACTION; action_array[write_index].device = XTestUnpackDeviceID(fjump->header); action_array[write_index].x = pmousex; action_array[write_index].y = pmousey; action_array[write_index].delay_time = fjump->delay_time; write_index++; } /****************************************************************************** * * parse_delay_fake * * Called from parse_fake_input. * * Copy the fake delay input action from its packed form into the array of * pending input events. */ static void parse_delay_fake(tevent) XTestDelayInfo *tevent; { action_array[write_index].type = XTestDELAY_ACTION; action_array[write_index].delay_time = tevent->delay_time; write_index++; } /****************************************************************************** * * XTestComputeWaitTime * * Compute the amount of time the server should wait before sending the * next monitor event in playback mode. */ void XTestComputeWaitTime(waittime) struct timeval *waittime; { /* * The playback_on flag is set to 1 in parse_fake_input. It is set to * 0 in XTestProcessInputAction if the server has replayed all input * actions. */ if (playback_on) { if (!play_clock) { /* * if the playback clock has never been set, * then do it now */ start_play_clock(); } /* * We need to save the waittime the first time through. This * is a value the server uses, and we have to restore it when * all of the input actions are processed by the server. */ if (!time_saved) { saved_sec = waittime->tv_sec; saved_usec = waittime->tv_usec; time_saved = 1; } if (go_for_next) { /* * if we just processed an input action, figure out * how long to wait for the next input action */ compute_action_time(&rtime); } else { /* * else just find out how much more time to wait * on the current input action */ (void)find_residual_time(&rtime); } waittime->tv_sec = rtime.tv_sec; waittime->tv_usec = rtime.tv_usec; } } /****************************************************************************** * * XTestProcessInputAction * * If there are any input actions in the input action array, * then take one out and process it. * */ int XTestProcessInputAction(readable, waittime) /* * This is the value that a 'select' function returned just before this * routine was called. If the select timed out, this value will be 0. * * This extension modifies the select call's timeout value to cause the * select to time out when the next input action is ready to given to * the server. This routine is called immediately after the select, to * give it a chance to process an input action. If we have an input action * to process and the only reason that the select returned was because it * timed out, then we change the select value to 1 and return 1 instead of 0. */ int readable; /* * this is the timeout value that the select was called with */ struct timeval *waittime; { int mousex, mousey; /* * if playback_on is 0, then the input action array is empty */ if (playback_on) { restorewait = waittime; /* * figure out if we need to wait for the next input action */ if (find_residual_time(&rtime) > 0) { /* * still have to wait before processing the current * input action */ go_for_next = 0; } else { /* * don't have to wait any longer before processing * the current input action */ go_for_next = 1; } /* * if we have an input action to process and the only reason * that the select returned was because it timed out, then we * change the select value to 1 and return 1 instead of 0 */ if (readable == 0) { readable++; } /* * if we don't need to wait, then get an input action from * the input action array and process it */ if (go_for_next) { /* * There are three possible types of input actions in * the input action array (motion input actions are * converted to jump input actions before being put * into the input action array). Delay input actions * are processed by the compute_action_time function * which is called from XTestComputeWaitTime. The * other two types of input actions are processed here. */ if (action_array[read_index].type == XTestJUMP_ACTION) { XTestJumpPointer( action_array[read_index].x, action_array[read_index].y, action_array[read_index].device); mx = action_array[read_index].x; my = action_array[read_index].y; } if (action_array[read_index].type == XTestKEY_ACTION) { GetSpritePosition(&mousex, &mousey); XTestGenerateEvent( action_array[read_index].device, action_array[read_index].keycode, action_array[read_index].keystate, mousex, mousey); } read_index++; /* * if all input actions are processed, then restore * the server state */ if (read_index >= write_index) { waittime->tv_sec = saved_sec; waittime->tv_usec = saved_usec; time_saved = 0; playback_on = 0; if (acknowledge) { /* * if the playback client is waiting * for an xTestFakeAck event, send * it to him */ send_ack(playback_client); acknowledge = 0; } write_index = 0; read_index = 0; playback_client = (ClientPtr) NULL; play_clock = 0; } } } return(readable); } /****************************************************************************** * * send_ack * * send an xTestFakeAck event to the client */ static void send_ack(client) ClientPtr client; { xTestFakeAckEvent rep; /* * set the serial number of the xTestFakeAck event */ rep.sequenceNumber = client->sequence; rep.type = XTestFakeAckType; WriteEventsToClient(client, 1, (xEvent *) &rep); } /****************************************************************************** * * start_play_clock * * start the clock for play back. */ static void start_play_clock() { X_GETTIMEOFDAY(&play_time); /* * flag that play_time is valid */ play_clock = 1; } /****************************************************************************** * * compute_action_time * * Set the play clock to the time when the next input action should be put * into the server's input queue. Fill the rtime structure with values * for the delta until the time for the next input action. */ static void compute_action_time(rtime) struct timeval *rtime; { /* * holds the delay time in milliseconds */ unsigned long dtime; /* * holds the number of microseconds in the sum of the dtime value * and the play_time value */ unsigned long tot_usec; /* * holds the number of seconds and microseconds in the * dtime value */ unsigned long sec; unsigned long usec; /* * holds the current time */ struct timeval btime; /* * Put the time from the current input action in dtime */ dtime = action_array[read_index].delay_time; /* * If the current input action is a delay input action, * add in the time from the following input action. */ if ((action_array[read_index].type == XTestDELAY_ACTION) && ((read_index + 1) < write_index)) { read_index++; dtime = dtime + action_array[read_index].delay_time; } /* * compute the number of seconds and microseconds in the * dtime value */ sec = dtime / 1000; usec = (dtime % 1000) * 1000; /* * get the current time in btime */ X_GETTIMEOFDAY(&btime); /* * compute the number of microseconds in the sum of the dtime value * and the current usec value */ tot_usec = btime.tv_usec + usec; /* * if it is greater than one second's worth, adjust the seconds */ if (tot_usec >= 1000000) { tot_usec -= 1000000; sec++; } play_time.tv_usec = tot_usec; play_time.tv_sec = btime.tv_sec + sec; /* * put the time until the next input action in rtime */ rtime->tv_sec = sec; rtime->tv_usec = usec; } /****************************************************************************** * * find_residual_time * * Find the time interval from the current time to the value in play_time. * This is the time to wait till putting the next input action into the * server's input queue. If the time is already up, reset play_time to * the current time. */ static int find_residual_time(the_residual) struct timeval *the_residual; { /* * if > 0, there is time to wait. If < 0, then don't wait */ int wait = 1; /* * holds the current time */ struct timeval btime; /* * holds the current time in seconds and microseconds */ unsigned long bsec; unsigned long busec; /* * holds the playback time in seconds and microseconds */ unsigned long psec; unsigned long pusec; /* * get the current time in btime */ X_GETTIMEOFDAY(&btime); /* * get the current time in seconds and microseconds */ bsec = btime.tv_sec; busec = btime.tv_usec; /* * get the playback time in seconds and microseconds */ psec = play_time.tv_sec; pusec = play_time.tv_usec; /* * if the current time is already later than the playback time, * we don't need to wait */ if (bsec > psec) { wait = -1; } else { if (bsec == psec) { /* * if the current and playback times have the same * second value, then compare the microsecond values */ if ( busec >= pusec) { /* * if the current time is already later than * the playback time, we don't need to wait */ wait = -1; } else { the_residual->tv_usec = pusec - busec; the_residual->tv_sec = 0; } } else { if (busec > pusec) { /* * 'borrow' a second's worth of microseconds * from the seconds left to wait */ the_residual->tv_usec = 1000000 - busec + pusec; psec--; the_residual->tv_sec = psec - bsec; } else { the_residual->tv_sec = psec - bsec; the_residual->tv_usec = pusec - busec; } } } if (wait < 0) { /* * if don't need to wait, set the playback time * to the current time */ X_GETTIMEOFDAY(&play_time); /* * set the time to wait to 0 */ the_residual->tv_sec = 0; the_residual->tv_usec = 0; } return(wait); } /****************************************************************************** * * abort_play_back */ void abort_play_back() { /* * If we were playing back input actions at the time of the abort, * restore the original wait time for the select in the main wait * loop of the server */ if (playback_on) { restorewait->tv_sec = saved_sec; restorewait->tv_usec = saved_usec; } /* * make the input action array empty */ read_index = 0; write_index = 0; /* * we are no longer playing back anything */ playback_on = 0; play_clock = 0; go_for_next = 1; /* * there is no valid wait time saved any more */ time_saved = 0; /* * there are no valid clients using this extension */ playback_client = (ClientPtr) NULL; current_xtest_client = (ClientPtr) NULL; } /****************************************************************************** * * return_input_array_size * * Return the number of input actions in the input action array. */ void return_input_array_size(client) /* * which client to send the reply to */ ClientPtr client; { xTestQueryInputSizeReply rep; rep.type = X_Reply; /* * set the serial number of the reply */ rep.sequenceNumber = client->sequence; rep.length = 0; rep.size_return = ACTION_ARRAY_SIZE; WriteReplyToClient(client, sizeof(xTestQueryInputSizeReply), (pointer) &rep); } vnc_unixsrc/Xvnc/programs/Xserver/Xext/shape.c0100664000076400007640000007070507120677563021120 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $TOG: shape.c /main/37 1997/05/22 10:11:40 kaleb $ */ /* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.1.2.1 1997/05/23 12:19:34 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #define _SHAPE_SERVER_ /* don't want Xlib structures */ #include "shapestr.h" #include "regionstr.h" #include "gcstruct.h" typedef RegionPtr (*CreateDftPtr)( #if NeedNestedPrototypes WindowPtr /* pWin */ #endif ); static int ShapeFreeClient( #if NeedFunctionPrototypes pointer /* data */, XID /* id */ #endif ); static int ShapeFreeEvents( #if NeedFunctionPrototypes pointer /* data */, XID /* id */ #endif ); static void SendShapeNotify( #if NeedFunctionPrototypes WindowPtr /* pWin */, int /* which */ #endif ); static void ShapeResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static void SShapeNotifyEvent( #if NeedFunctionPrototypes xShapeNotifyEvent * /* from */, xShapeNotifyEvent * /* to */ #endif ); static int RegionOperate ( #if NeedFunctionPrototypes ClientPtr /* client */, WindowPtr /* pWin */, int /* kind */, RegionPtr * /* destRgnp */, RegionPtr /* srcRgn */, int /* op */, int /* xoff */, int /* yoff */, CreateDftPtr /* create */ #endif ); #if NeedFunctionPrototypes #define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */) #else #define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */) #endif static CREATE_PROC(CreateBoundingShape); static CREATE_PROC(CreateClipShape); #undef CREATE_PROC static DISPATCH_PROC(ProcShapeCombine); static DISPATCH_PROC(ProcShapeDispatch); static DISPATCH_PROC(ProcShapeGetRectangles); static DISPATCH_PROC(ProcShapeInputSelected); static DISPATCH_PROC(ProcShapeMask); static DISPATCH_PROC(ProcShapeOffset); static DISPATCH_PROC(ProcShapeQueryExtents); static DISPATCH_PROC(ProcShapeQueryVersion); static DISPATCH_PROC(ProcShapeRectangles); static DISPATCH_PROC(ProcShapeSelectInput); static DISPATCH_PROC(SProcShapeCombine); static DISPATCH_PROC(SProcShapeDispatch); static DISPATCH_PROC(SProcShapeGetRectangles); static DISPATCH_PROC(SProcShapeInputSelected); static DISPATCH_PROC(SProcShapeMask); static DISPATCH_PROC(SProcShapeOffset); static DISPATCH_PROC(SProcShapeQueryExtents); static DISPATCH_PROC(SProcShapeQueryVersion); static DISPATCH_PROC(SProcShapeRectangles); static DISPATCH_PROC(SProcShapeSelectInput); static unsigned char ShapeReqCode = 0; static int ShapeEventBase = 0; static RESTYPE ClientType, EventType; /* resource types for event masks */ /* * each window has a list of clients requesting * ShapeNotify events. Each client has a resource * for each window it selects ShapeNotify input for, * this resource is used to delete the ShapeNotifyRec * entry from the per-window queue. */ typedef struct _ShapeEvent *ShapeEventPtr; typedef struct _ShapeEvent { ShapeEventPtr next; ClientPtr client; WindowPtr window; XID clientResource; } ShapeEventRec; /**************** * ShapeExtensionInit * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * ****************/ void ShapeExtensionInit() { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(ShapeFreeClient); EventType = CreateNewResourceType(ShapeFreeEvents); if (ClientType && EventType && (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, ProcShapeDispatch, SProcShapeDispatch, ShapeResetProc, StandardMinorOpcode))) { ShapeReqCode = (unsigned char)extEntry->base; ShapeEventBase = extEntry->eventBase; EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; } } /*ARGSUSED*/ static void ShapeResetProc (extEntry) ExtensionEntry *extEntry; { } static int RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) ClientPtr client; WindowPtr pWin; int kind; RegionPtr *destRgnp, srcRgn; int op; int xoff, yoff; CreateDftPtr create; /* creates a reasonable *destRgnp */ { ScreenPtr pScreen = pWin->drawable.pScreen; if (srcRgn && (xoff || yoff)) REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff); if (!pWin->parent) { if (srcRgn) REGION_DESTROY(pScreen, srcRgn); return Success; } switch (op) { case ShapeSet: if (*destRgnp) REGION_DESTROY(pScreen, *destRgnp); *destRgnp = srcRgn; srcRgn = 0; break; case ShapeUnion: if (*destRgnp && srcRgn) REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn); break; case ShapeIntersect: if (*destRgnp && srcRgn) REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn); else { *destRgnp = srcRgn; srcRgn = 0; } break; case ShapeSubtract: if (!*destRgnp) *destRgnp = (*create)(pWin); if (srcRgn) REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn); break; case ShapeInvert: if (!*destRgnp) *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0); else if (srcRgn) REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp); break; default: client->errorValue = op; return BadValue; } if (srcRgn) REGION_DESTROY(pScreen, srcRgn); (*pScreen->SetShape) (pWin); SendShapeNotify (pWin, kind); return Success; } static RegionPtr CreateBoundingShape (pWin) WindowPtr pWin; { BoxRec extents; extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); return REGION_CREATE(pWin->drawable.pScreen, &extents, 1); } static RegionPtr CreateClipShape (pWin) WindowPtr pWin; { BoxRec extents; extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; return REGION_CREATE(pWin->drawable.pScreen, &extents, 1); } static int ProcShapeQueryVersion (client) register ClientPtr client; { xShapeQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH (xShapeQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = SHAPE_MAJOR_VERSION; rep.minorVersion = SHAPE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep); return (client->noClientException); } /***************** * ProcShapeRectangles * *****************/ static int ProcShapeRectangles (client) register ClientPtr client; { WindowPtr pWin; ScreenPtr pScreen; REQUEST(xShapeRectanglesReq); xRectangle *prects; int nrects, ctype; RegionPtr srcRgn; RegionPtr *destRgn; CreateDftPtr createDefault; int destBounding; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); UpdateCurrentTime(); pWin = LookupWindow (stuff->dest, client); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: destBounding = 1; createDefault = CreateBoundingShape; break; case ShapeClip: destBounding = 0; createDefault = CreateClipShape; break; default: client->errorValue = stuff->destKind; return BadValue; } if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) && (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) { client->errorValue = stuff->ordering; return BadValue; } pScreen = pWin->drawable.pScreen; nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq)); if (nrects & 4) return BadLength; nrects >>= 3; prects = (xRectangle *) &stuff[1]; ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering); if (ctype < 0) return BadMatch; srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype); if (!pWin->optional) MakeWindowOptional (pWin); if (destBounding) destRgn = &pWin->optional->boundingShape; else destRgn = &pWin->optional->clipShape; return RegionOperate (client, pWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } /************** * ProcShapeMask **************/ static int ProcShapeMask (client) register ClientPtr client; { WindowPtr pWin; ScreenPtr pScreen; REQUEST(xShapeMaskReq); RegionPtr srcRgn; RegionPtr *destRgn; PixmapPtr pPixmap; CreateDftPtr createDefault; int destBounding; REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); pWin = SecurityLookupWindow (stuff->dest, client, SecurityWriteAccess); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: destBounding = 1; createDefault = CreateBoundingShape; break; case ShapeClip: destBounding = 0; createDefault = CreateClipShape; break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pWin->drawable.pScreen; if (stuff->src == None) srcRgn = 0; else { pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src, RT_PIXMAP, SecurityReadAccess); if (!pPixmap) return BadPixmap; if (pPixmap->drawable.pScreen != pScreen || pPixmap->drawable.depth != 1) return BadMatch; srcRgn = BITMAP_TO_REGION(pScreen, pPixmap); if (!srcRgn) return BadAlloc; } if (!pWin->optional) MakeWindowOptional (pWin); if (destBounding) destRgn = &pWin->optional->boundingShape; else destRgn = &pWin->optional->clipShape; return RegionOperate (client, pWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } /************ * ProcShapeCombine ************/ static int ProcShapeCombine (client) register ClientPtr client; { WindowPtr pSrcWin, pDestWin; ScreenPtr pScreen; REQUEST(xShapeCombineReq); RegionPtr srcRgn; RegionPtr *destRgn; CreateDftPtr createDefault; CreateDftPtr createSrc; RegionPtr tmp; int destBounding; REQUEST_SIZE_MATCH (xShapeCombineReq); UpdateCurrentTime(); pDestWin = LookupWindow (stuff->dest, client); if (!pDestWin) return BadWindow; if (!pDestWin->optional) MakeWindowOptional (pDestWin); switch (stuff->destKind) { case ShapeBounding: destBounding = 1; createDefault = CreateBoundingShape; break; case ShapeClip: destBounding = 0; createDefault = CreateClipShape; break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pDestWin->drawable.pScreen; pSrcWin = LookupWindow (stuff->src, client); if (!pSrcWin) return BadWindow; switch (stuff->srcKind) { case ShapeBounding: srcRgn = wBoundingShape (pSrcWin); createSrc = CreateBoundingShape; break; case ShapeClip: srcRgn = wClipShape (pSrcWin); createSrc = CreateClipShape; break; default: client->errorValue = stuff->srcKind; return BadValue; } if (pSrcWin->drawable.pScreen != pScreen) { return BadMatch; } if (srcRgn) { tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0); REGION_COPY(pScreen, tmp, srcRgn); srcRgn = tmp; } else srcRgn = (*createSrc) (pSrcWin); if (!pDestWin->optional) MakeWindowOptional (pDestWin); if (destBounding) destRgn = &pDestWin->optional->boundingShape; else destRgn = &pDestWin->optional->clipShape; return RegionOperate (client, pDestWin, (int)stuff->destKind, destRgn, srcRgn, (int)stuff->op, stuff->xOff, stuff->yOff, createDefault); } /************* * ProcShapeOffset *************/ static int ProcShapeOffset (client) register ClientPtr client; { WindowPtr pWin; ScreenPtr pScreen; REQUEST(xShapeOffsetReq); RegionPtr srcRgn; REQUEST_SIZE_MATCH (xShapeOffsetReq); UpdateCurrentTime(); pWin = LookupWindow (stuff->dest, client); if (!pWin) return BadWindow; switch (stuff->destKind) { case ShapeBounding: srcRgn = wBoundingShape (pWin); break; case ShapeClip: srcRgn = wClipShape(pWin); break; default: client->errorValue = stuff->destKind; return BadValue; } pScreen = pWin->drawable.pScreen; if (srcRgn) { REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff); (*pScreen->SetShape) (pWin); } SendShapeNotify (pWin, (int)stuff->destKind); return Success; } static int ProcShapeQueryExtents (client) register ClientPtr client; { REQUEST(xShapeQueryExtentsReq); WindowPtr pWin; xShapeQueryExtentsReply rep; BoxRec extents, *pExtents; register int n; REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.boundingShaped = (wBoundingShape(pWin) != 0); rep.clipShaped = (wClipShape(pWin) != 0); if (wBoundingShape(pWin)) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin)); extents = *pExtents; } else { extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); } rep.xBoundingShape = extents.x1; rep.yBoundingShape = extents.y1; rep.widthBoundingShape = extents.x2 - extents.x1; rep.heightBoundingShape = extents.y2 - extents.y1; if (wClipShape(pWin)) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin)); extents = *pExtents; } else { extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; } rep.xClipShape = extents.x1; rep.yClipShape = extents.y1; rep.widthClipShape = extents.x2 - extents.x1; rep.heightClipShape = extents.y2 - extents.y1; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.xBoundingShape, n); swaps(&rep.yBoundingShape, n); swaps(&rep.widthBoundingShape, n); swaps(&rep.heightBoundingShape, n); swaps(&rep.xClipShape, n); swaps(&rep.yClipShape, n); swaps(&rep.widthClipShape, n); swaps(&rep.heightClipShape, n); } WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep); return (client->noClientException); } /*ARGSUSED*/ static int ShapeFreeClient (data, id) pointer data; XID id; { ShapeEventPtr pShapeEvent; WindowPtr pWin; ShapeEventPtr *pHead, pCur, pPrev; pShapeEvent = (ShapeEventPtr) data; pWin = pShapeEvent->window; pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next) pPrev = pCur; if (pCur) { if (pPrev) pPrev->next = pShapeEvent->next; else *pHead = pShapeEvent->next; } } xfree ((pointer) pShapeEvent); return Success; } /*ARGSUSED*/ static int ShapeFreeEvents (data, id) pointer data; XID id; { ShapeEventPtr *pHead, pCur, pNext; pHead = (ShapeEventPtr *) data; for (pCur = *pHead; pCur; pCur = pNext) { pNext = pCur->next; FreeResource (pCur->clientResource, ClientType); xfree ((pointer) pCur); } xfree ((pointer) pHead); return Success; } static int ProcShapeSelectInput (client) register ClientPtr client; { REQUEST(xShapeSelectInputReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead; XID clientResource; REQUEST_SIZE_MATCH (xShapeSelectInputReq); pWin = SecurityLookupWindow (stuff->window, client, SecurityWriteAccess); if (!pWin) return BadWindow; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, EventType, SecurityWriteAccess); switch (stuff->enable) { case xTrue: if (pHead) { /* check for existing entry. */ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) return Success; } } /* build the entry */ pNewShapeEvent = (ShapeEventPtr) xalloc (sizeof (ShapeEventRec)); if (!pNewShapeEvent) return BadAlloc; pNewShapeEvent->next = 0; pNewShapeEvent->client = client; pNewShapeEvent->window = pWin; /* * add a resource that will be deleted when * the client goes away */ clientResource = FakeClientID (client->index); pNewShapeEvent->clientResource = clientResource; if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent)) return BadAlloc; /* * create a resource to contain a pointer to the list * of clients selecting input. This must be indirect as * the list may be arbitrarily rearranged which cannot be * done through the resource database. */ if (!pHead) { pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr)); if (!pHead || !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) { FreeResource (clientResource, RT_NONE); return BadAlloc; } *pHead = 0; } pNewShapeEvent->next = *pHead; *pHead = pNewShapeEvent; break; case xFalse: /* delete the interest */ if (pHead) { pNewShapeEvent = 0; for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) break; pNewShapeEvent = pShapeEvent; } if (pShapeEvent) { FreeResource (pShapeEvent->clientResource, ClientType); if (pNewShapeEvent) pNewShapeEvent->next = pShapeEvent->next; else *pHead = pShapeEvent->next; xfree (pShapeEvent); } } break; default: client->errorValue = stuff->enable; return BadValue; } return Success; } /* * deliver the event */ static void SendShapeNotify (pWin, which) WindowPtr pWin; int which; { ShapeEventPtr *pHead, pShapeEvent; ClientPtr client; xShapeNotifyEvent se; BoxRec extents; RegionPtr region; BYTE shaped; pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); if (!pHead) return; if (which == ShapeBounding) { region = wBoundingShape(pWin); if (region) { extents = *REGION_EXTENTS(pWin->drawable.pScreen, region); shaped = xTrue; } else { extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); shaped = xFalse; } } else { region = wClipShape(pWin); if (region) { extents = *REGION_EXTENTS(pWin->drawable.pScreen, region); shaped = xTrue; } else { extents.x1 = 0; extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; shaped = xFalse; } } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { client = pShapeEvent->client; if (client == serverClient || client->clientGone) continue; se.type = ShapeNotify + ShapeEventBase; se.kind = which; se.window = pWin->drawable.id; se.sequenceNumber = client->sequence; se.x = extents.x1; se.y = extents.y1; se.width = extents.x2 - extents.x1; se.height = extents.y2 - extents.y1; se.time = currentTime.milliseconds; se.shaped = shaped; WriteEventsToClient (client, 1, (xEvent *) &se); } } static int ProcShapeInputSelected (client) register ClientPtr client; { REQUEST(xShapeInputSelectedReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, *pHead; int enabled; xShapeInputSelectedReply rep; register int n; REQUEST_SIZE_MATCH (xShapeInputSelectedReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, pWin->drawable.id, EventType, SecurityReadAccess); enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) { enabled = xTrue; break; } } } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.enabled = enabled; if (client->swapped) { swaps (&rep.sequenceNumber, n); swapl (&rep.length, n); } WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep); return (client->noClientException); } static int ProcShapeGetRectangles (client) register ClientPtr client; { REQUEST(xShapeGetRectanglesReq); WindowPtr pWin; xShapeGetRectanglesReply rep; xRectangle *rects; int nrects, i; RegionPtr region; register int n; REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; switch (stuff->kind) { case ShapeBounding: region = wBoundingShape(pWin); break; case ShapeClip: region = wClipShape(pWin); break; default: client->errorValue = stuff->kind; return BadValue; } if (!region) { nrects = 1; rects = (xRectangle *) ALLOCATE_LOCAL (sizeof (xRectangle)); if (!rects) return BadAlloc; switch (stuff->kind) { case ShapeBounding: rects->x = - (int) wBorderWidth (pWin); rects->y = - (int) wBorderWidth (pWin); rects->width = pWin->drawable.width + wBorderWidth (pWin); rects->height = pWin->drawable.height + wBorderWidth (pWin); break; case ShapeClip: rects->x = 0; rects->y = 0; rects->width = pWin->drawable.width; rects->height = pWin->drawable.height; break; } } else { BoxPtr box; nrects = REGION_NUM_RECTS(region); box = REGION_RECTS(region); rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle)); if (!rects && nrects) return BadAlloc; for (i = 0; i < nrects; i++, box++) { rects[i].x = box->x1; rects[i].y = box->y1; rects[i].width = box->x2 - box->x1; rects[i].height = box->y2 - box->y1; } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = (nrects * sizeof (xRectangle)) >> 2; rep.ordering = YXBanded; rep.nrects = nrects; if (client->swapped) { swaps (&rep.sequenceNumber, n); swapl (&rep.length, n); swapl (&rep.nrects, n); SwapShorts ((short *)rects, (unsigned long)nrects * 4); } WriteToClient (client, sizeof (rep), (char *) &rep); WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects); DEALLOCATE_LOCAL (rects); return client->noClientException; } static int ProcShapeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShapeQueryVersion: return ProcShapeQueryVersion (client); case X_ShapeRectangles: return ProcShapeRectangles (client); case X_ShapeMask: return ProcShapeMask (client); case X_ShapeCombine: return ProcShapeCombine (client); case X_ShapeOffset: return ProcShapeOffset (client); case X_ShapeQueryExtents: return ProcShapeQueryExtents (client); case X_ShapeSelectInput: return ProcShapeSelectInput (client); case X_ShapeInputSelected: return ProcShapeInputSelected (client); case X_ShapeGetRectangles: return ProcShapeGetRectangles (client); default: return BadRequest; } } static void SShapeNotifyEvent(from, to) xShapeNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswapl (from->window, to->window); cpswaps (from->sequenceNumber, to->sequenceNumber); cpswaps (from->x, to->x); cpswaps (from->y, to->y); cpswaps (from->width, to->width); cpswaps (from->height, to->height); cpswapl (from->time, to->time); to->shaped = from->shaped; } static int SProcShapeQueryVersion (client) register ClientPtr client; { register int n; REQUEST (xShapeQueryVersionReq); swaps (&stuff->length, n); return ProcShapeQueryVersion (client); } static int SProcShapeRectangles (client) register ClientPtr client; { register char n; REQUEST (xShapeRectanglesReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); swapl (&stuff->dest, n); swaps (&stuff->xOff, n); swaps (&stuff->yOff, n); SwapRestS(stuff); return ProcShapeRectangles (client); } static int SProcShapeMask (client) register ClientPtr client; { register char n; REQUEST (xShapeMaskReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeMaskReq); swapl (&stuff->dest, n); swaps (&stuff->xOff, n); swaps (&stuff->yOff, n); swapl (&stuff->src, n); return ProcShapeMask (client); } static int SProcShapeCombine (client) register ClientPtr client; { register char n; REQUEST (xShapeCombineReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeCombineReq); swapl (&stuff->dest, n); swaps (&stuff->xOff, n); swaps (&stuff->yOff, n); swapl (&stuff->src, n); return ProcShapeCombine (client); } static int SProcShapeOffset (client) register ClientPtr client; { register char n; REQUEST (xShapeOffsetReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeOffsetReq); swapl (&stuff->dest, n); swaps (&stuff->xOff, n); swaps (&stuff->yOff, n); return ProcShapeOffset (client); } static int SProcShapeQueryExtents (client) register ClientPtr client; { register char n; REQUEST (xShapeQueryExtentsReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); swapl (&stuff->window, n); return ProcShapeQueryExtents (client); } static int SProcShapeSelectInput (client) register ClientPtr client; { register char n; REQUEST (xShapeSelectInputReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeSelectInputReq); swapl (&stuff->window, n); return ProcShapeSelectInput (client); } static int SProcShapeInputSelected (client) register ClientPtr client; { register int n; REQUEST (xShapeInputSelectedReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xShapeInputSelectedReq); swapl (&stuff->window, n); return ProcShapeInputSelected (client); } static int SProcShapeGetRectangles (client) register ClientPtr client; { REQUEST(xShapeGetRectanglesReq); register char n; swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); swapl (&stuff->window, n); return ProcShapeGetRectangles (client); } static int SProcShapeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShapeQueryVersion: return SProcShapeQueryVersion (client); case X_ShapeRectangles: return SProcShapeRectangles (client); case X_ShapeMask: return SProcShapeMask (client); case X_ShapeCombine: return SProcShapeCombine (client); case X_ShapeOffset: return SProcShapeOffset (client); case X_ShapeQueryExtents: return SProcShapeQueryExtents (client); case X_ShapeSelectInput: return SProcShapeSelectInput (client); case X_ShapeInputSelected: return SProcShapeInputSelected (client); case X_ShapeGetRectangles: return SProcShapeGetRectangles (client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xtest1di.c0100664000076400007640000005530007120677563021557 0ustar constconst/* $XConsortium: xtest1di.c,v 1.13 94/04/17 20:33:01 rws Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.0 1996/05/06 05:55:45 dawes Exp $ */ /* * File: xtest1di.c * * This file contains the device independent parts of the input * synthesis extension. */ /* Copyright (c) 1986, 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Hewlett-Packard makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This software is not subject to any license of the American Telephone and Telegraph Company or of the Regents of the University of California. */ /***************************************************************************** * include files ****************************************************************************/ #define NEED_EVENTS #define NEED_REPLIES #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "gcstruct.h" #include "extnsionst.h" #include "dixstruct.h" #include "opaque.h" #define XTestSERVER_SIDE #include "xtestext1.h" #include "xtest1dd.h" /***************************************************************************** * defines ****************************************************************************/ /***************************************************************************** * externals ****************************************************************************/ /* * id of client using XTestGetInput * * defined in xtest1dd.c */ extern ClientPtr current_xtest_client; /* * id of client using XTestFakeInput * * defined in xtest1dd.c */ extern ClientPtr playback_client; /***************************************************************************** * variables ****************************************************************************/ /* * Holds the request type code for this extension. The request type code * for this extension may vary depending on how many extensions are installed * already, so the initial value given below will be added to the base request * code that is aquired when this extension is installed. */ static int XTestReqCode = 0; /* * Holds the two event type codes for this extension. The event type codes * for this extension may vary depending on how many extensions are installed * already, so the initial values given below will be added to the base event * code that is aquired when this extension is installed. */ int XTestInputActionType = 0; int XTestFakeAckType = 1; /* * true => monitor stealing input */ int on_steal_input = FALSE; /* * true => monitor alone getting input */ int exclusive_steal = FALSE; /* * holds the resource type assigned to this extension */ static RESTYPE XTestType; /* * holds the resource ID for the client currently using XTestGetInput */ static XID current_client_id; /***************************************************************************** * function declarations ****************************************************************************/ static DISPATCH_PROC(ProcXTestDispatch); static DISPATCH_PROC(SProcXTestDispatch); static DISPATCH_PROC(ProcTestFakeInput); static DISPATCH_PROC(SProcTestFakeInput); static DISPATCH_PROC(ProcTestGetInput); static DISPATCH_PROC(SProcTestGetInput); static DISPATCH_PROC(ProcTestStopInput); static DISPATCH_PROC(SProcTestStopInput); static DISPATCH_PROC(ProcTestReset); static DISPATCH_PROC(SProcTestReset); static DISPATCH_PROC(ProcTestQueryInputSize); static DISPATCH_PROC(SProcTestQueryInputSize); static void XTestResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* unused */ #endif ); static void SReplyXTestDispatch( #if NeedFunctionPrototypes ClientPtr /* client_ptr */, int /* size */, char * /* reply_ptr */ #endif ); static void SEventXTestDispatch( #if NeedFunctionPrototypes xEvent * /* from */, xEvent * /* to */ #endif ); static int XTestCurrentClientGone( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); /***************************************************************************** * * XTestExtension1Init * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * * XTestExtension1Init has no events or errors * (other than the core errors). */ void XTestExtension1Init() { /* * holds the pointer to the extension entry structure */ ExtensionEntry *extEntry; extEntry = AddExtension(XTestEXTENSION_NAME, XTestEVENT_COUNT, 0, ProcXTestDispatch, SProcXTestDispatch, XTestResetProc, StandardMinorOpcode); if (extEntry) { /* * remember the request code assigned to this extension */ XTestReqCode = extEntry->base; /* * make an atom saying that this extension is present */ (void) MakeAtom(XTestEXTENSION_NAME, strlen(XTestEXTENSION_NAME), TRUE); /* * remember the event codes assigned to this extension */ XTestInputActionType += extEntry->eventBase; XTestFakeAckType += extEntry->eventBase; /* * install the routine to handle byte-swapping the replies * for this extension in the ReplySwapVector table */ ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch; /* * install the routine to handle byte-swapping the events * for this extension in the EventSwapVector table */ EventSwapVector[XTestInputActionType] = SEventXTestDispatch; EventSwapVector[XTestFakeAckType] = SEventXTestDispatch; /* * get the resource type for this extension */ XTestType = CreateNewResourceType(XTestCurrentClientGone); if (XTestType == 0) { FatalError("XTestExtension1Init: CreateNewResourceType failed\n"); } } else { FatalError("XTestExtension1Init: AddExtensions failed\n"); } } /***************************************************************************** * * ProcXTestDispatch * * */ static int ProcXTestDispatch(client) register ClientPtr client; { REQUEST(xReq); if (stuff->data == X_TestFakeInput) { return(ProcTestFakeInput(client)); } else if (stuff->data == X_TestGetInput) { return(ProcTestGetInput(client)); } else if (stuff->data == X_TestStopInput) { return(ProcTestStopInput(client)); } else if (stuff->data == X_TestReset) { return(ProcTestReset(client)); } else if (stuff->data == X_TestQueryInputSize) { return(ProcTestQueryInputSize(client)); } else { SendErrorToClient(client, XTestReqCode, stuff->data, None, BadRequest); return(BadRequest); } } /***************************************************************************** * * SProcXTestDispatch * * */ static int SProcXTestDispatch(client) register ClientPtr client; { REQUEST(xReq); if (stuff->data == X_TestFakeInput) { return(SProcTestFakeInput(client)); } else if (stuff->data == X_TestGetInput) { return(SProcTestGetInput(client)); } else if (stuff->data == X_TestStopInput) { return(SProcTestStopInput(client)); } else if (stuff->data == X_TestReset) { return(SProcTestReset(client)); } else if (stuff->data == X_TestQueryInputSize) { return(SProcTestQueryInputSize(client)); } else { SendErrorToClient(client, XTestReqCode, stuff->data, None, BadRequest); return(BadRequest); } } /***************************************************************************** * * SProcTestFakeInput * * */ static int SProcTestFakeInput(client) register ClientPtr client; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; /* * index counter */ int i; /* * pointer to the next input action in the request */ CARD8 *input_action_ptr; /* * holds the type of the next input action in the request */ int input_action_type; REQUEST(xTestFakeInputReq); /* * byte-swap the fields in the request */ swaps(&stuff->length, n); swapl(&stuff->ack, n); /* * have to parse and then byte-swap the input action list here */ for (i = 0; i < XTestMAX_ACTION_LIST_SIZE;) { /* * point to the next input action in the request */ input_action_ptr = &(((xTestFakeInputReq *) stuff)->action_list[i]); /* * figure out what type of input action it is */ input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK; /* * byte-swap the input action according to it's type */ switch (input_action_type) { case XTestKEY_ACTION: /* * byte-swap the delay_time field */ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestKeyInfo); break; case XTestMOTION_ACTION: /* * byte-swap the delay_time field */ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestMotionInfo); break; case XTestJUMP_ACTION: /* * byte-swap the jumpx field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n); /* * byte-swap the jumpy field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n); /* * byte-swap the delay_time field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestJumpInfo); break; default: /* * if this is a delay input action, then byte-swap it, * otherwise we have reached the end of the input * actions in this request */ if (XTestUnpackDeviceID(*input_action_ptr) == XTestDELAY_DEVICE_ID) { /* * byte-swap the delay_time field */ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestDelayInfo); } else { /* * if the input action header byte is 0 or * ill-formed, then there are no more input * actions in this request */ i = XTestMAX_ACTION_LIST_SIZE; } break; } } return(ProcTestFakeInput(client)); } /***************************************************************************** * * SProcTestGetInput * * */ static int SProcTestGetInput(client) register ClientPtr client; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; REQUEST(xTestGetInputReq); /* * byte-swap the fields in the request */ swaps(&stuff->length, n); swapl(&stuff->mode, n); return(ProcTestGetInput(client)); } /***************************************************************************** * * SProcTestStopInput * * */ static int SProcTestStopInput(client) register ClientPtr client; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; REQUEST(xTestStopInputReq); /* * byte-swap the length field in the request */ swaps(&stuff->length, n); return(ProcTestStopInput(client)); } /***************************************************************************** * * SProcTestReset * * */ static int SProcTestReset(client) register ClientPtr client; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; REQUEST(xTestResetReq); /* * byte-swap the length field in the request */ swaps(&stuff->length, n); return(ProcTestReset(client)); } /***************************************************************************** * * SProcTestQueryInputSize * * */ static int SProcTestQueryInputSize(client) register ClientPtr client; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; REQUEST(xTestQueryInputSizeReq); /* * byte-swap the length field in the request */ swaps(&stuff->length, n); return(ProcTestQueryInputSize(client)); } /***************************************************************************** * * ProcTestFakeInput * * */ static int ProcTestFakeInput(client) register ClientPtr client; { REQUEST(xTestFakeInputReq); REQUEST_SIZE_MATCH(xTestFakeInputReq); if (playback_client == NULL) { playback_client = client; current_client_id = FakeClientID(client->index); AddResource(current_client_id, XTestType, 0); MakeClientGrabImpervious(client); } if (playback_client == client) { /* * This extension does not need to clean up any * server state when a client using this function * "goes away". The server will just process any * input actions that have already been sent to it, * and will then reset its association with a client. */ parse_fake_input(client, (char *)stuff); return(Success); } else { /* * this is a request by another client to send fake * input while the server is still being used */ SendErrorToClient(client, XTestReqCode, X_TestFakeInput, None, BadAccess); return(BadAccess); } } /***************************************************************************** * * ProcTestGetInput * * */ static int ProcTestGetInput(client) register ClientPtr client; { REQUEST(xTestGetInputReq); REQUEST_SIZE_MATCH(xTestGetInputReq); if (on_steal_input) { /* * this is a request by another client to get fake input * while the server is still sending input to the first client */ SendErrorToClient(client, XTestReqCode, X_TestGetInput, None, BadAccess); return(BadAccess); } else { /* * Set up a resource associated with the client using this * function so that this extension gets called when the * client "goes away". This allows this extension to * clean up the server state. */ current_client_id = FakeClientID(client->index); AddResource(current_client_id, XTestType, 0); /* * indicate that a client is stealing input */ on_steal_input = TRUE; if ((stuff->mode & XTestEXCLUSIVE) == 0) { exclusive_steal = FALSE; } else { exclusive_steal = TRUE; } steal_input(client, stuff->mode); return(Success); } } /***************************************************************************** * * ProcTestStopInput * * */ static int ProcTestStopInput(client) register ClientPtr client; { REQUEST_SIZE_MATCH(xTestStopInputReq); if (on_steal_input && (current_xtest_client == client)) { on_steal_input = FALSE; exclusive_steal = FALSE; stop_stealing_input(); /* * remove the resource associated with this client */ FreeResource(current_client_id, RT_NONE); return(Success); } else { /* * this is a request to stop fake input when fake input has * never been started or from a client that hasn't started * fake input */ SendErrorToClient(client, XTestReqCode, X_TestStopInput, None, BadAccess); return(BadAccess); } } /***************************************************************************** * * ProcTestReset * * */ static int ProcTestReset(client) register ClientPtr client; { REQUEST_SIZE_MATCH(xTestResetReq); on_steal_input = FALSE; exclusive_steal = FALSE; /* * defined in xtest1dd.c */ stop_stealing_input(); /* * defined in xtest1dd.c */ abort_play_back(); return(Success); } /***************************************************************************** * * ProcTestQueryInputSize * * */ static int ProcTestQueryInputSize(client) register ClientPtr client; { REQUEST_SIZE_MATCH(xTestQueryInputSizeReq); /* * defined in xtest1dd.c */ return_input_array_size(client); return(Success); } /***************************************************************************** * * XTestResetProc * * This function is called by the server when the server has no clients * connected to it. It must put eveything back the way it was before * this extension was installed. */ /*ARGSUSED*/ static void XTestResetProc(unused) ExtensionEntry * unused; { /* * remove the routine to handle byte-swapping the replies * for this extension in the ReplySwapVector table */ ReplySwapVector[XTestReqCode] = ReplyNotSwappd; /* * remove the routine to handle byte-swapping the events * for this extension in the EventSwapVector table */ EventSwapVector[XTestInputActionType] = NotImplemented; EventSwapVector[XTestFakeAckType] = NotImplemented; /* * reset the variables initialized just once at load time */ XTestReqCode = 0; XTestInputActionType = 0; XTestFakeAckType = 1; on_steal_input = FALSE; exclusive_steal = FALSE; playback_client = 0; /* Don't really need this but it looks nice */ } /***************************************************************************** * * PXTestCurrentClientGone * * This routine is called when a client that has asked for input actions * to be sent to it "goes away". This routine must clean up the * server state. */ /*ARGSUSED*/ static int XTestCurrentClientGone(value, id) pointer value; XID id; { /* * defined in xtest1dd.c */ on_steal_input = FALSE; exclusive_steal = FALSE; /* * defined in xtestdd.c */ playback_client = 0; abort_play_back(); return TRUE; } /***************************************************************************** * * SReplyXTestDispatch * * Swap any replies defined in this extension. */ static void SReplyXTestDispatch(client_ptr, size, reply_ptr) ClientPtr client_ptr; int size; char *reply_ptr; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; /* * pointer to xTestQueryInputSizeReply */ xTestQueryInputSizeReply *rep_ptr; /* * there is only one reply in this extension, so byte-swap it */ rep_ptr = (xTestQueryInputSizeReply *) reply_ptr; swaps(&(rep_ptr->sequenceNumber), n); swapl(&(rep_ptr->length), n); swapl(&(rep_ptr->size_return), n); /* * now write the swapped reply to the client */ WriteToClient(client_ptr, size, reply_ptr); } /***************************************************************************** * * SEventXTestDispatch * * Swap any events defined in this extension. */ static void SEventXTestDispatch(from, to) xEvent *from; xEvent *to; { /* * used in the swaps and swapl macros for temporary storage space */ register char n; /* * index counter */ int i; /* * pointer to the next input action in the event */ CARD8 *input_action_ptr; /* * holds the type of the next input action in the event */ int input_action_type; /* * copy the type information from the "from" event to the "to" event */ ((xTestInputActionEvent *) to)->type = ((xTestInputActionEvent *) from)->type; /* * copy the sequence number information from the "from" event to the * "to" event */ ((xTestInputActionEvent *) to)->sequenceNumber = ((xTestInputActionEvent *) from)->sequenceNumber; /* * byte-swap the sequence number in the "to" event */ swaps(&(((xTestInputActionEvent *) to)->sequenceNumber), n); /* * If the event is an xTestInputActionEvent, then it needs more * processing. Otherwise, it is an xTestFakeAckEvent, which * has no other information in it. */ if ((((xTestInputActionEvent *) to)->type & 0x7f) == XTestInputActionType) { /* * copy the input actions from the "from" event * to the "to" event */ for (i = 0; i < XTestACTIONS_SIZE; i++) { ((xTestInputActionEvent *) to)->actions[i] = ((xTestInputActionEvent *) from)->actions[i]; } /* * byte-swap the input actions in the "to" event */ for (i = 0; i < XTestACTIONS_SIZE; i++) { /* * point to the next input action in the event */ input_action_ptr = &(((xTestInputActionEvent *) to)->actions[i]); /* * figure out what type of input action it is */ input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK; /* * byte-swap the input action according to it's type */ switch (input_action_type) { case XTestKEY_ACTION: /* * byte-swap the delay_time field */ swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestKeyInfo); break; case XTestMOTION_ACTION: /* * byte-swap the delay_time field */ swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestMotionInfo); break; case XTestJUMP_ACTION: /* * byte-swap the jumpx field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx), n); /* * byte-swap the jumpy field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy), n); /* * byte-swap the delay_time field */ swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestJumpInfo); break; default: /* * if this is a delay input action, then * byte-swap it, otherwise we have reached the * end of the input actions in this event */ if (XTestUnpackDeviceID(*input_action_ptr) == XTestDELAY_DEVICE_ID) { /* * byte-swap the delay_time field */ swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time), n); /* * advance to the next input action */ i += sizeof(XTestDelayInfo); } else { /* * if the input action header byte is 0 * or ill-formed, then there are no * more input actions in this event */ i = XTestACTIONS_SIZE; } break; } } } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/mbufbf.c0100664000076400007640000007506407120677563021264 0ustar constconst/* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: mbufbf.c,v 1.5 94/04/17 20:32:53 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.0 1994/05/08 05:17:30 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" #include "validate.h" #ifndef MINIX #include #endif #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #define _MULTIBUF_BUFFER_ #include "multibufst.h" /* Support for doublebuffer hardare This code is designed to support doublebuffer hardware where the displayed buffer is selected on a per-pixel basis by an additional bit plane, called the select plane. It could probably be easily modified to work with systems that use window-id planes. This is done by creating a new drawable type, DRAWABLE_BUFFER. The type has the same exact layout as a window drawable. Your code should treat a DRAWABLE_BUFFER the same as it would tread a DRAWABLE_WINDOW when handling the gc drawing functions. In addition, PaintWindowBackground, CopyWindow, and all of the gc drawing functions to be able to draw into both framebuffers. Which framebuffer to draw into is selected by the contents of pWin->devPrivates[frameWindowPrivateIndex]. The content of the devPrivate is either from frameBuffer[0] or frameBuffer[1], depending on which buffer is being drawn into. When pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[0], the functions should draw into the front framebuffer. When pWin->devPrivates[frameWindowPrivateIndex] == frameBuffer[1], the functions should draw into the back framebuffer. In addition, you need to provide a function that allows you to copy bits between the buffers (optional since CopyArea can be used) and a function that draws into the select plane. Then, you need to register your functions and other information, by calling: void RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane, CopyBufferBitsFunc, DrawSelectPlaneFunc) int nInfo; xMbufBufferInfo *pInfo; DevUnion *frameBuffer; DevUnion selectPlane; "pInfo" is an array indicating which visuals and depths that double buffering is supported on. "nInfo" is the length of the array. "frameBuffer" is array of length 2. The contents of the array element is ddx-specific. The content of frameBuffer[0] should, when placed in the window private, indicate that framebuffer 0 should be drawn into. The contents of frameBuffer[1], when placed into the window private, should indicate that framebuffer 1 should be drawn into. "selectPlane" is ddx-specific. It should contain information neccessary for your displayProc to access the select plane. It is passed to DrawSelectPlaneFunc. "CopyBufferBitsFunc" is a ddx-specific function that copies from one buffer of a multibuffered window to another buffer. If the CopyBufferBitsFunc is NULL, a default function will be used that calls pScreen->CopyArea. void CopyBufferBitsFunc(pMBWindow, srcBufferNum, dstBufferNum) mbufWindowPtr pMBWindow; int srcBufferNum, dstBufferNum; "DrawSelectPlaneFunc" is a ddx-specific function that fills the regions "prgn" of select plane with the value "bufferNum". If selectPlane is a DrawablePtr (such as a PixmapPtr), you can pass NULL for DrawSelectPlaneFunc, a default function will be used that calls FillRectangle on the selectPlane. void DrawSelectPlaneFunc(pScreen, selectPlane, prgn, bufferNum) ScreenPtr pScreen; DevUnion selectPlane; RegionPtr prgn; long bufferNum; ... ... ... */ #define MAX_BUFFERS 2 /* Only supports 2 buffers */ #define FRONT_BUFFER 0 #define BACK_BUFFER 1 /* Buffer drawables have the same structure as window drawables */ typedef WindowRec BufferRec; typedef WindowPtr BufferPtr; /* * Call RegisterHdwrBuffer for every screen that has doublebuffer hardware. */ static int bufNumInfo[MAXSCREENS]; static xMbufBufferInfo *bufInfo[MAXSCREENS]; static DevUnion *bufFrameBuffer[MAXSCREENS]; static DevUnion bufselectPlane[MAXSCREENS]; static void (* bufCopyBufferBitsFunc[MAXSCREENS])(); static void (* bufDrawSelectPlaneFunc[MAXSCREENS])(); static Bool bufMultibufferInit(); void RegisterDoubleBufferHardware(pScreen, nInfo, pInfo, frameBuffer, selectPlane, CopyBufferBitsFunc, DrawSelectPlaneFunc) ScreenPtr pScreen; int nInfo; xMbufBufferInfo *pInfo; DevUnion *frameBuffer; DevUnion selectPlane; void (* CopyBufferBitsFunc)(); void (* DrawSelectPlaneFunc)(); { bufNumInfo[pScreen->myNum] = nInfo; bufInfo[pScreen->myNum] = pInfo; bufFrameBuffer[pScreen->myNum] = frameBuffer; bufselectPlane[pScreen->myNum] = selectPlane; bufCopyBufferBitsFunc[pScreen->myNum] = CopyBufferBitsFunc; bufDrawSelectPlaneFunc[pScreen->myNum] = DrawSelectPlaneFunc; /* Register ourselves with device-independent multibuffers code */ RegisterMultibufferInit(pScreen, bufMultibufferInit); } /* * Called by Multibuffer extension initialization. * Initializes mbufScreenRec and its devPrivate. */ static Bool NoopDDA_True() { return TRUE; } static Bool bufPositionWindow(); static int bufCreateImageBuffers(); static void bufDestroyImageBuffers(); static void bufDisplayImageBuffers(); static void bufClearImageBufferArea(); static void bufDestroyBuffer(); static void bufCopyBufferBits(); static void bufDrawSelectPlane(); static void bufWrapScreenFuncs(); static void bufResetProc(); static void bufPostValidateTree(); static void bufClipNotify(); static void bufWindowExposures(); static Bool bufChangeWindowAttributes(); static void bufClearToBackground(); static void bufCopyWindow(); extern WindowPtr *WindowTable; static Bool bufMultibufferInit(pScreen, pMBScreen) ScreenPtr pScreen; mbufScreenPtr pMBScreen; { mbufBufferPrivPtr pMBPriv; BoxRec box; /* Multibuffer info */ pMBScreen->nInfo = bufNumInfo[pScreen->myNum]; pMBScreen->pInfo = bufInfo[pScreen->myNum]; /* Hooks */ pMBScreen->CreateImageBuffers = bufCreateImageBuffers; pMBScreen->DestroyImageBuffers = bufDestroyImageBuffers; pMBScreen->DisplayImageBuffers = bufDisplayImageBuffers; pMBScreen->ClearImageBufferArea = bufClearImageBufferArea; pMBScreen->ChangeMBufferAttributes = NoopDDA_True; pMBScreen->ChangeBufferAttributes = NoopDDA_True; pMBScreen->DeleteBufferDrawable = bufDestroyBuffer; pMBScreen->WrapScreenFuncs = bufWrapScreenFuncs; pMBScreen->ResetProc = bufResetProc; /* Create devPrivate part */ pMBPriv = (mbufBufferPrivPtr) xalloc(sizeof *pMBPriv); if (!pMBPriv) return (FALSE); pMBScreen->devPrivate.ptr = (pointer) pMBPriv; pMBPriv->frameBuffer = bufFrameBuffer[pScreen->myNum]; pMBPriv->selectPlane = bufselectPlane[pScreen->myNum]; /* * Initializing the subtractRgn to the screen area will ensure that * the selectPlane will get cleared on the first PostValidateTree. */ box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; pMBPriv->rgnChanged = TRUE; REGION_INIT(pScreen, &pMBPriv->backBuffer, &box, 1); REGION_INIT(pScreen, &pMBPriv->subtractRgn, &box, 1); REGION_INIT(pScreen, &pMBPriv->unionRgn, NullBox, 0); /* Misc functions */ pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum]; pMBPriv->DrawSelectPlane = bufDrawSelectPlaneFunc[pScreen->myNum]; if (!pMBPriv->CopyBufferBits) pMBPriv->CopyBufferBits = bufCopyBufferBits; if (!pMBPriv->DrawSelectPlane) pMBPriv->DrawSelectPlane = bufDrawSelectPlane; /* screen functions */ pMBPriv->funcsWrapped = 0; pMBPriv->inClearToBackground = FALSE; pMBPriv->WindowExposures = NULL; pMBPriv->CopyWindow = NULL; pMBPriv->ClearToBackground = NULL; pMBPriv->ClipNotify = NULL; pMBPriv->ChangeWindowAttributes = NULL; /* Start out wrapped to clear select plane */ WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree); return TRUE; } static void UpdateBufferFromWindow(pBuffer, pWin) BufferPtr pBuffer; WindowPtr pWin; { pBuffer->drawable.x = pWin->drawable.x; pBuffer->drawable.y = pWin->drawable.y; pBuffer->drawable.width = pWin->drawable.width; pBuffer->drawable.height = pWin->drawable.height; pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER; /* Update for PaintWindowBackground */ pBuffer->parent = pWin->parent; /* * Make the borderClip the same as the clipList so * NotClippedByChildren comes out with just clipList. */ pBuffer->clipList = pWin->clipList; pBuffer->borderClip = pWin->clipList; pBuffer->winSize = pWin->winSize; pBuffer->borderSize = pWin->borderSize; pBuffer->origin = pWin->origin; } static BufferPtr bufCreateBuffer(pScreen, pWin, bufferNum) ScreenPtr pScreen; WindowPtr pWin; int bufferNum; { mbufBufferPrivPtr pMBPriv; DevUnion *devPrivates; BufferPtr pBuffer; int i; pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); pBuffer = AllocateWindow(pWin->drawable.pScreen); if (!pBuffer) return (NULL); /* XXX- Until we know what is needed, copy everything. */ devPrivates = pBuffer->devPrivates; *pBuffer = *pWin; pBuffer->devPrivates = devPrivates; pBuffer->drawable.type = DRAWABLE_BUFFER; pBuffer->drawable.serialNumber = NEXT_SERIAL_NUMBER; pBuffer->nextSib = NULL; pBuffer->prevSib = NULL; pBuffer->firstChild = NULL; pBuffer->lastChild = NULL; /* XXX - Worry about backingstore later */ pBuffer->backStorage = NULL; pBuffer->backingStore = NotUseful; /* XXX - Need to call pScreen->CreateWindow for tile/stipples * or should I just copy the devPrivates? */ for (i=0; i < pScreen->WindowPrivateLen; i++) pBuffer->devPrivates[i] = pWin->devPrivates[i]; pBuffer->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[bufferNum]; return pBuffer; } static void bufDestroyBuffer(pDrawable) DrawablePtr pDrawable; { xfree(pDrawable); } /*ARGSUSED*/ static int bufCreateImageBuffers (pWin, nbuf, ids, action, hint) WindowPtr pWin; int nbuf; XID *ids; int action; int hint; { ScreenPtr pScreen; mbufScreenPtr pMBScreen; mbufWindowPtr pMBWindow; mbufBufferPtr pMBBuffer; int i; pScreen = pWin->drawable.pScreen; pMBScreen = MB_SCREEN_PRIV(pScreen); pMBWindow = MB_WINDOW_PRIV(pWin); pMBWindow->devPrivate.ptr = (pointer) REGION_CREATE(pScreen, 0,0); if (!pMBWindow->devPrivate.ptr) return(0); REGION_COPY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr, &pWin->clipList); for (i = 0; i < nbuf; i++) { pMBBuffer = pMBWindow->buffers + i; pMBBuffer->pDrawable = (DrawablePtr) bufCreateBuffer(pScreen,pWin,i); if (!pMBBuffer->pDrawable) break; if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMBBuffer->pDrawable)) { bufDestroyBuffer((BufferPtr) pMBBuffer->pDrawable); break; } pMBBuffer->pDrawable->id = ids[i]; /* * If window is already mapped, generate exposures and * clear the area of the newly buffers. */ if ((pWin->realized) && (i != pMBWindow->displayedMultibuffer)) (* pMBScreen->ClearImageBufferArea)(pMBBuffer, 0,0, 0,0, TRUE); } return i; } static void bufDestroyImageBuffers(pWin) WindowPtr pWin; { ScreenPtr pScreen; mbufWindowPtr pMBWindow; pScreen = pWin->drawable.pScreen; if (pMBWindow = MB_WINDOW_PRIV(pWin)) { mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); /* * if the backbuffer is currently being displayed, move the bits * to the frontbuffer and display it instead. */ if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER)) { (* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER); REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer, &pWin->clipList); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &pWin->clipList, FRONT_BUFFER); } /* Switch window rendering to front buffer */ pWin->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[FRONT_BUFFER]; REGION_DESTROY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr); pMBWindow->devPrivate.ptr = NULL; } } /* * Can be replaced by pScreen->ClearToBackground if pBuffer->eventMask * and wOtherEventsMasks(pBuffer) were setup. */ static void bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures) mbufBufferPtr pMBBuffer; short x,y; unsigned short w,h; Bool generateExposures; { BoxRec box; RegionRec reg; RegionPtr pBSReg = NullRegion; ScreenPtr pScreen; BoxPtr extents; int x1, y1, x2, y2; BufferPtr pBuffer; pBuffer = (BufferPtr) pMBBuffer->pDrawable; /* compute everything using ints to avoid overflow */ x1 = pBuffer->drawable.x + x; y1 = pBuffer->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pBuffer->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pBuffer->drawable.height - (int) y; extents = &pBuffer->clipList.extents; /* clip the resulting rectangle to the window clipList extents. This * makes sure that the result will fit in a box, given that the * screen is < 32768 on a side. */ if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) { x2 = x1 = 0; y2 = y1 = 0; } box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; pScreen = pBuffer->drawable.pScreen; REGION_INIT(pScreen, ®, &box, 1); if (pBuffer->backStorage) { /* * If the window has backing-store on, call through the * ClearToBackground vector to handle the special semantics * (i.e. things backing store is to be cleared out and * an Expose event is to be generated for those areas in backing * store if generateExposures is TRUE). */ pBSReg = (* pScreen->ClearBackingStore)(pBuffer, x, y, w, h, generateExposures); } REGION_INTERSECT(pScreen, ®, ®, &pBuffer->clipList); if (pBuffer->backgroundState != None) (*pScreen->PaintWindowBackground)(pBuffer, ®, PW_BACKGROUND); if (generateExposures) MultibufferExpose(pMBBuffer, ®); #ifdef _notdef /* XXBS - This is the original miClearToBackground code. * WindowExposures needs to be called (or the functionality emulated) * in order for backingStore to work, but first, pBuffer->eventMask * and wOtherEventsMasks(pBuffer) need to be setup correctly. */ if (generateExposures) (*pScreen->WindowExposures)(pBuffer, ®, pBSReg); else if (pBuffer->backgroundState != None) (*pScreen->PaintWindowBackground)(pBuffer, ®, PW_BACKGROUND); #endif REGION_UNINIT(pScreen, ®); if (pBSReg) REGION_DESTROY(pScreen, pBSReg); } static void bufWrapScreenFuncs(pScreen) ScreenPtr pScreen; { mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); WRAP_SCREEN_FUNC(pScreen,pMBPriv,PostValidateTree, bufPostValidateTree); WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClipNotify, bufClipNotify); WRAP_SCREEN_FUNC(pScreen,pMBPriv,WindowExposures,bufWindowExposures); WRAP_SCREEN_FUNC(pScreen,pMBPriv,ChangeWindowAttributes, bufChangeWindowAttributes); WRAP_SCREEN_FUNC(pScreen,pMBPriv,ClearToBackground,bufClearToBackground); WRAP_SCREEN_FUNC(pScreen,pMBPriv,CopyWindow,bufCopyWindow); } static void bufResetProc(pScreen) ScreenPtr pScreen; { mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); /* * frameBuffer, selectPlane, and pInfo should be freed by * whoever called RegisterDoubleBufferHardware */ REGION_UNINIT(pScreen, &pMBPriv->backBuffer); REGION_UNINIT(pScreen, &pMBPriv->subtractRgn); REGION_UNINIT(pScreen, &pMBPriv->unionRgn); xfree(pMBPriv); } /*---------------------------------------------------------------------------*/ /* * Used if CopyBufferBitsFunc is not provided when registering. * This should work for everybody since CopyArea needs to support * copying between buffers anyway. */ static void bufCopyBufferBits(pMBWindow, srcBufferNum, dstBufferNum) mbufWindowPtr pMBWindow; int srcBufferNum, dstBufferNum; { DrawablePtr pSrcBuffer, pDstBuffer; GCPtr pGC; pSrcBuffer = pMBWindow->buffers[srcBufferNum].pDrawable; pDstBuffer = pMBWindow->buffers[dstBufferNum].pDrawable; pGC = GetScratchGC (pDstBuffer->depth, pDstBuffer->pScreen); if (!pGC) return; ValidateGC (pDstBuffer, pGC); (* pGC->ops->CopyArea) (pSrcBuffer, pDstBuffer, pGC, 0,0, pDstBuffer->width, pDstBuffer->height, 0,0); FreeScratchGC (pGC); } /* * Used if DrawSelectPlanFunc is not provided for when registering. * However, it only works if selectPlane.ptr is a drawable. Also * assumes that painting with color 0 selects the front buffer, * while color 1 selects the back buffer. */ static void bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) ScreenPtr pScreen; DevUnion selectPlane; RegionPtr prgn; long bufferNum; { DrawablePtr pDrawable; GCPtr pGC; register int i; register BoxPtr pbox; register xRectangle *prect; int numRects; XID value; if (REGION_NUM_RECTS(prgn) == 0) return; pDrawable = (DrawablePtr) selectPlane.ptr; pGC = GetScratchGC (pDrawable->depth, pScreen); if (!pGC) return; prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * sizeof(xRectangle)); if (!prect) { FreeScratchGC(pGC); return; } value = (XID) bufferNum; DoChangeGC(pGC, GCForeground, &value, 0); ValidateGC(pDrawable, pGC); numRects = REGION_NUM_RECTS(prgn); pbox = REGION_RECTS(prgn); for (i= numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1; prect->y = pbox->y1; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; (* pGC->ops->PolyFillRect)(pDrawable, pGC, numRects, prect); DEALLOCATE_LOCAL(prect); FreeScratchGC (pGC); } static void bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf) ScreenPtr pScreen; mbufBufferPtr *ppMBBuffer; mbufWindowPtr *ppMBWindow; int nbuf; { WindowPtr pWin; BufferPtr pPrevBuffer, pNewBuffer; int i, number; mbufBufferPrivPtr pMBPriv; mbufBufferPtr pPrevMBBuffer; pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); for (i = 0; i < nbuf; i++) { number = ppMBBuffer[i]->number; /* 0=frontbuffer, 1=backbuffer */ pWin = ppMBWindow[i]->pWindow; pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]); pPrevBuffer = (BufferPtr) pPrevMBBuffer->pDrawable; pNewBuffer = (BufferPtr) ppMBBuffer[i]->pDrawable; if (pPrevBuffer != pNewBuffer) { RegionPtr backBuffer = &pMBPriv->backBuffer; /* * Update the select plane and the backBuffer region. */ (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &pWin->clipList, number); if (number == BACK_BUFFER) REGION_UNION(pScreen, backBuffer, backBuffer, &pWin->clipList); else REGION_SUBTRACT(pScreen, backBuffer, backBuffer, &pWin->clipList); /* Switch which framebuffer the window draws into */ pWin->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[number]; } switch (ppMBWindow[i]->updateAction) { case MultibufferUpdateActionUndefined: break; case MultibufferUpdateActionBackground: (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea) (pPrevMBBuffer, 0,0, 0,0, FALSE); break; case MultibufferUpdateActionUntouched: break; case MultibufferUpdateActionCopied: if (pPrevBuffer != pNewBuffer) { (* pMBPriv->CopyBufferBits) (ppMBWindow[i], ppMBBuffer[i]->number, pPrevMBBuffer->number); } break; } } } /* Updates the backBuffer region and paints the selectPlane. */ static void bufPostValidateTree(pParent, pChild, kind) WindowPtr pParent, pChild; VTKind kind; { ScreenPtr pScreen; mbufBufferPrivPtr pMBPriv; if (pParent) pScreen = pParent->drawable.pScreen; else if (pChild) pScreen = pChild->drawable.pScreen; else return; /* Hopeless */ pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree); if (pScreen->PostValidateTree) (* pScreen->PostValidateTree)(pParent, pChild, kind); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, PostValidateTree); /* Does backBuffer need to change? */ if (pMBPriv->rgnChanged) { RegionRec exposed; RegionPtr pSubtractRgn, pUnionRgn; Bool overlap; pMBPriv->rgnChanged = FALSE; pSubtractRgn = &pMBPriv->subtractRgn; pUnionRgn = &pMBPriv->unionRgn; REGION_VALIDATE(pScreen, pSubtractRgn, &overlap); #ifdef DEBUG if (overlap) FatalError("bufPostValidateTree: subtractRgn overlaps"); #endif REGION_VALIDATE(pScreen, pUnionRgn, &overlap); #ifdef DEBUG if (overlap) FatalError("bufPostValidateTree: unionRgn overlaps"); #endif /* Update backBuffer: subtract must come before union */ REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer, pSubtractRgn); REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer, pUnionRgn); /* Paint gained and lost backbuffer areas in select plane */ REGION_INIT(pScreen, &exposed, NullBox, 0); REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &exposed, FRONT_BUFFER); REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &exposed, BACK_BUFFER); REGION_UNINIT(pScreen, &exposed); REGION_EMPTY(pScreen, pSubtractRgn); REGION_EMPTY(pScreen, pUnionRgn); } } /* XXX - Knows region internals. */ static Bool RegionsEqual(reg1, reg2) RegionPtr reg1; RegionPtr reg2; { int i; BoxPtr rects1, rects2; if (reg1->extents.x1 != reg2->extents.x1) return FALSE; if (reg1->extents.x2 != reg2->extents.x2) return FALSE; if (reg1->extents.y1 != reg2->extents.y1) return FALSE; if (reg1->extents.y2 != reg2->extents.y2) return FALSE; if (REGION_NUM_RECTS(reg1) != REGION_NUM_RECTS(reg2)) return FALSE; rects1 = REGION_RECTS(reg1); rects2 = REGION_RECTS(reg2); for (i = 0; i != REGION_NUM_RECTS(reg1); i++) { if (rects1[i].x1 != rects2[i].x1) return FALSE; if (rects1[i].x2 != rects2[i].x2) return FALSE; if (rects1[i].y1 != rects2[i].y1) return FALSE; if (rects1[i].y2 != rects2[i].y2) return FALSE; } return TRUE; } /* * If the window is multibuffered and displaying the backbuffer, * add the old clipList to the subtractRgn and add the new clipList * to the unionRgn. PostValidateTree will use subtractRgn and unionRgn * to update the backBuffer region and the selectPlane. * * Copy changes to the window structure into the buffers. * Send ClobberNotify events. */ static void bufClipNotify(pWin, dx,dy) WindowPtr pWin; int dx,dy; { ScreenPtr pScreen = pWin->drawable.pScreen; mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); mbufWindowPtr pMBWindow; int i; UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify); if (pScreen->ClipNotify) (* pScreen->ClipNotify)(pWin, dx,dy); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClipNotify); if (pMBWindow = MB_WINDOW_PRIV(pWin)) { RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr; if (! RegionsEqual(pOldClipList, &pWin->clipList)) { if (pMBWindow->displayedMultibuffer == BACK_BUFFER) { pMBPriv->rgnChanged = TRUE; REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList); REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList); } REGION_COPY(pScreen, pOldClipList,&pWin->clipList); } /* Update buffer x,y,w,h, and clipList */ for (i=0; inumMultibuffer; i++) { mbufBufferPtr pMBBuffer = pMBWindow->buffers + i; if (pMBBuffer->clobber != pWin->visibility) { pMBBuffer->clobber = pWin->visibility; MultibufferClobber(pMBBuffer); } UpdateBufferFromWindow(pMBBuffer->pDrawable, pWin); } } } /* * Updates buffer's background fields when the window's changes. * This is necessary because pScreen->PaintWindowBackground * is used to paint the buffer. * * XXBS - Backingstore state will have be tracked too if it is supported. */ static Bool bufChangeWindowAttributes(pWin, mask) WindowPtr pWin; unsigned long mask; { ScreenPtr pScreen = pWin->drawable.pScreen; mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); mbufWindowPtr pMBWindow; Bool ret; UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes); ret = (* pScreen->ChangeWindowAttributes)(pWin, mask); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, ChangeWindowAttributes); if (pMBWindow = MB_WINDOW_PRIV(pWin)) { if (mask & (CWBackPixmap | CWBackPixel)) { BufferPtr pBuffer; int i; for (i=0; idisplayedMultibuffer; i++) { pBuffer = (BufferPtr) pMBWindow->buffers[i].pDrawable; pBuffer->backgroundState = pWin->backgroundState; pBuffer->background = pWin->background; } } } return ret; } /* * Send exposures and clear the background for a buffer whenever * its corresponding window is exposed, except when called by * ClearToBackground. */ static void bufWindowExposures(pWin, prgn, other_exposed) WindowPtr pWin; register RegionPtr prgn, other_exposed; { ScreenPtr pScreen = pWin->drawable.pScreen; mbufWindowPtr pMBWindow = MB_WINDOW_PRIV(pWin); mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); RegionRec tmp_rgn; int i; Bool handleBuffers; handleBuffers = (!pMBPriv->inClearToBackground) && (pWin->drawable.type == DRAWABLE_WINDOW) && pMBWindow && (prgn && !REGION_NIL(prgn)); /* miWindowExposures munges prgn and other_exposed. */ if (handleBuffers) { REGION_INIT(pScreen, &tmp_rgn, NullBox, 0); REGION_COPY(pScreen, &tmp_rgn,prgn); } UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures); (* pScreen->WindowExposures) (pWin, prgn, other_exposed); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures); if (!handleBuffers) return; /* * Send expose events to all clients. Paint the exposed region for all * buffers except the displayed buffer since it is handled when the * window is painted. * * XXBS - Will have to be re-written to handle BackingStore on buffers. */ for (i=0; inumMultibuffer; i++) { mbufBufferPtr pMBBuffer; BufferPtr pBuffer; pMBBuffer = pMBWindow->buffers + i; pBuffer = (BufferPtr) pMBBuffer->pDrawable; if (i != pMBWindow->displayedMultibuffer) (* pScreen->PaintWindowBackground)(pBuffer,&tmp_rgn,PW_BACKGROUND); if ((pMBBuffer->otherEventMask | pMBBuffer->eventMask) & ExposureMask) MultibufferExpose(pMBBuffer, &tmp_rgn); } REGION_UNINIT(pScreen, &tmp_rgn); } /* * Set ``inClearToBackground'' so that WindowExposures does not attempt * to send expose events or clear the background on the buffers. */ static void bufClearToBackground(pWin, x,y,w,h, sendExpose) WindowPtr pWin; int x,y, w,h; Bool sendExpose; { ScreenPtr pScreen = pWin->drawable.pScreen; mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); pMBPriv->inClearToBackground = TRUE; UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground); (* pScreen->ClearToBackground)(pWin, x,y,w,h, sendExpose); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, ClearToBackground); pMBPriv->inClearToBackground = FALSE; } /* * Move bits in both buffers. It does this by calling pScreen->CopyWindow * twice, once with the root window's devPrivate[frameWindowPrivateIndex] * pointing to the frontbuffer pixmap and once with it pointed to the * backbuffer pixmap. It does this if there are *any* existing multibuffered * window... a possible optimization is to copy the backbuffer only if this * window or its inferiors are multibuffered. May be faster, maybe not. * * XXX - Only works if your CopyWindow checks the root window's devPrivate * to see which buffer to draw into. Works for cfbPaintWindow. */ /*ARGSUSED*/ static void bufCopyWindow(pWin, ptOldOrg, prgnSrc) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr prgnSrc; { ScreenPtr pScreen = pWin->drawable.pScreen; mbufBufferPrivPtr pMBPriv = MB_SCREEN_PRIV_BUFFER(pScreen); WindowPtr pwinroot; DevUnion save; UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow); pwinroot = WindowTable[pScreen->myNum]; save = pwinroot->devPrivates[frameWindowPrivateIndex]; /* * Copy front buffer */ pwinroot->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[FRONT_BUFFER]; (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); /* * Copy back buffer */ /* CopyWindow translates prgnSrc... translate it back for 2nd call. */ REGION_TRANSLATE(pScreen, prgnSrc, ptOldOrg.x - pWin->drawable.x, ptOldOrg.y - pWin->drawable.y); pwinroot->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[BACK_BUFFER]; (* pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); pwinroot->devPrivates[frameWindowPrivateIndex] = save; REWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, CopyWindow); } vnc_unixsrc/Xvnc/programs/Xserver/Xext/mbufpx.c0100664000076400007640000004246707120677563021325 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mbufpx.c,v 1.5 94/04/17 20:32:54 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.0 1994/05/08 05:17:32 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" #ifndef MINIX #include #endif #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #define _MULTIBUF_PIXMAP_ #include "multibufst.h" static Bool NoopDDA_True() { return TRUE; } static Bool pixPositionWindow(); static int pixCreateImageBuffers(); static void pixDisplayImageBuffers(); static void pixClearImageBufferArea(); static void pixDeleteBufferDrawable(); static void pixWrapScreenFuncs(); static void pixResetProc(); Bool pixMultibufferInit(pScreen, pMBScreen) ScreenPtr pScreen; mbufScreenPtr pMBScreen; { int i, j, k; xMbufBufferInfo *pInfo; int nInfo; DepthPtr pDepth; mbufPixmapPrivPtr pMBPriv; pMBScreen->CreateImageBuffers = pixCreateImageBuffers; pMBScreen->DestroyImageBuffers = (void (*)())NoopDDA; pMBScreen->DisplayImageBuffers = pixDisplayImageBuffers; pMBScreen->ClearImageBufferArea = pixClearImageBufferArea; pMBScreen->ChangeMBufferAttributes = NoopDDA_True; pMBScreen->ChangeBufferAttributes = NoopDDA_True; pMBScreen->DeleteBufferDrawable = pixDeleteBufferDrawable; pMBScreen->WrapScreenFuncs = pixWrapScreenFuncs; pMBScreen->ResetProc = pixResetProc; /* Support every depth and visual combination that the screen does */ nInfo = 0; for (i = 0; i < pScreen->numDepths; i++) { pDepth = &pScreen->allowedDepths[i]; nInfo += pDepth->numVids; } pInfo = (xMbufBufferInfo *) xalloc (nInfo * sizeof (xMbufBufferInfo)); if (!pInfo) return FALSE; k = 0; for (i = 0; i < pScreen->numDepths; i++) { pDepth = &pScreen->allowedDepths[i]; for (j = 0; j < pDepth->numVids; j++) { pInfo[k].visualID = pDepth->vids[j]; pInfo[k].maxBuffers = 0; pInfo[k].depth = pDepth->depth; k++; } } pMBScreen->nInfo = nInfo; pMBScreen->pInfo = pInfo; /* * Setup the devPrivate to mbufScreenRec */ pMBPriv = (mbufPixmapPrivPtr) xalloc(sizeof(* pMBPriv)); if (!pMBPriv) { xfree(pInfo); return (FALSE); } pMBScreen->devPrivate.ptr = (pointer) pMBPriv; pMBPriv->PositionWindow = NULL; pMBPriv->funcsWrapped = 0; return TRUE; } /*ARGSUSED*/ static int pixCreateImageBuffers (pWin, nbuf, ids, action, hint) WindowPtr pWin; int nbuf; XID *ids; int action; int hint; { mbufWindowPtr pMBWindow; mbufBufferPtr pMBBuffer; ScreenPtr pScreen; int width, height, depth; int i; pMBWindow = MB_WINDOW_PRIV(pWin); width = pWin->drawable.width; height = pWin->drawable.height; depth = pWin->drawable.depth; pScreen = pWin->drawable.pScreen; for (i = 0; i < nbuf; i++) { pMBBuffer = &pMBWindow->buffers[i]; pMBBuffer->pDrawable = (DrawablePtr) (*pScreen->CreatePixmap) (pScreen, width, height, depth); if (!pMBBuffer->pDrawable) break; if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMBBuffer->pDrawable)) { (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable); break; } pMBBuffer->pDrawable->id = ids[i]; /* * In the description of the CreateImageBuffers request: * "If the window is mapped, or if these image buffers have * backing store, their contents will be tiled with the window * background, and zero or more expose events will be generated * for each of these buffers." */ (* MB_SCREEN_PRIV(pScreen)->ClearImageBufferArea) (pMBBuffer, 0,0, 0,0, TRUE); } return i; } /* * set up the gc to clear the pixmaps; */ static Bool SetupBackgroundPainter (pWin, pGC) WindowPtr pWin; GCPtr pGC; { XID gcvalues[4]; int ts_x_origin, ts_y_origin; PixUnion background; int backgroundState; Mask gcmask; /* * First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ ts_x_origin = ts_y_origin = 0; while (pWin->backgroundState == ParentRelative) { ts_x_origin -= pWin->origin.x; ts_y_origin -= pWin->origin.y; pWin = pWin->parent; } backgroundState = pWin->backgroundState; background = pWin->background; switch (backgroundState) { case BackgroundPixel: gcvalues[0] = (XID) background.pixel; gcvalues[1] = FillSolid; gcmask = GCForeground|GCFillStyle; break; case BackgroundPixmap: gcvalues[0] = FillTiled; gcvalues[1] = (XID) background.pixmap; gcvalues[2] = ts_x_origin; gcvalues[3] = ts_y_origin; gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin; break; default: return FALSE; } DoChangeGC(pGC, gcmask, gcvalues, TRUE); return TRUE; } static void MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects) WindowPtr pWin; DrawablePtr pDrawable; int nrects; xRectangle *pRects; { GCPtr pGC; pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen); if (SetupBackgroundPainter(pWin, pGC)) { ValidateGC(pDrawable, pGC); (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, pRects); } FreeScratchGC(pGC); } static void MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion) WindowPtr pWin; DrawablePtr pDrawable; RegionPtr pRegion; { xRectangle *pRects; int nrects = REGION_NUM_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion); pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); if (pRects) { int i; for (i = 0; i < nrects; i++) { pRects[i].x = pbox->x1; pRects[i].y = pbox->y1; pRects[i].width = pbox->x2 - pbox->x1; pRects[i].height = pbox->y2 - pbox->y1; } MultibufferPaintBackgroundRectangles(pWin, pDrawable, nrects, pRects); DEALLOCATE_LOCAL(pRects); } } static void pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf) mbufBufferPtr *ppMBBuffer; mbufWindowPtr *ppMBWindow; int nbuf; { GCPtr pGC = NULL; PixmapPtr pPrevPixmap, pNewPixmap; WindowPtr pWin; RegionPtr pExposed; int i; mbufBufferPtr pPrevMBBuffer; XID bool; xRectangle r; UpdateCurrentTime (); for (i = 0; i < nbuf; i++) { pWin = ppMBWindow[i]->pWindow; /* Time to get a different scratch GC? */ if (!pGC || pGC->depth != pWin->drawable.depth || pGC->pScreen != pWin->drawable.pScreen) { if (pGC) FreeScratchGC(pGC); pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen); } pPrevMBBuffer = MB_DISPLAYED_BUFFER(ppMBWindow[i]); pPrevPixmap = (PixmapPtr) pPrevMBBuffer->pDrawable; pNewPixmap = (PixmapPtr) ppMBBuffer[i]->pDrawable; if (pPrevPixmap == pNewPixmap) { /* "If a specified buffer is already displayed, any delays and * update action will still be performed for that buffer." * * We special-case this because applications do occasionally * request a redundant DisplayImageBuffers, and we can save * strokes by recognizing that the only update action that will * change the buffer contents in this case is Background. */ if (ppMBWindow[i]->updateAction == MultibufferUpdateActionBackground) { r.x = r.y = 0; r.width = pWin->drawable.width; r.height = pWin->drawable.height; MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pWin, 1, &r); } } else /* different buffer is being displayed */ { /* perform update action */ switch (ppMBWindow[i]->updateAction) { case MultibufferUpdateActionUndefined: break; case MultibufferUpdateActionBackground: r.x = r.y = 0; r.width = pPrevPixmap->drawable.width; r.height = pPrevPixmap->drawable.height; MultibufferPaintBackgroundRectangles(pWin, (DrawablePtr)pPrevPixmap, 1, &r); break; case MultibufferUpdateActionUntouched: /* copy the window to the pixmap that represents the * currently displayed buffer */ if (pPrevMBBuffer->eventMask & ExposureMask) { bool = TRUE; DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE); } ValidateGC ((DrawablePtr)pPrevPixmap, pGC); pExposed = (*pGC->ops->CopyArea)((DrawablePtr) pWin, (DrawablePtr) pPrevPixmap, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); /* if we couldn't copy the whole window to the buffer, * send expose events (if any client wants them) */ if (pPrevMBBuffer->eventMask & ExposureMask) { /* some client wants expose events */ if (pExposed) { RegionPtr pWinSize; extern RegionPtr CreateUnclippedWinSize(); ScreenPtr pScreen = pWin->drawable.pScreen; pWinSize = CreateUnclippedWinSize (pWin); /* * pExposed is window-relative, but at this point * pWinSize is screen-relative. Make pWinSize be * window-relative so that region ops involving * pExposed and pWinSize behave sensibly. */ REGION_TRANSLATE(pScreen, pWinSize, -pWin->drawable.x, -pWin->drawable.y); REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize); REGION_DESTROY(pScreen, pWinSize); MultibufferExpose (pPrevMBBuffer, pExposed); REGION_DESTROY(pScreen, pExposed); } bool = FALSE; DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE); } /* end some client wants expose events */ break; /* end case MultibufferUpdateActionUntouched */ case MultibufferUpdateActionCopied: ValidateGC ((DrawablePtr)pPrevPixmap, pGC); (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pPrevPixmap, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); break; } /* end switch on update action */ /* display the new buffer */ ValidateGC ((DrawablePtr)pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); } ppMBWindow[i]->lastUpdate = currentTime; } if (pGC) FreeScratchGC (pGC); return; } /* * resize the buffers when the window is resized */ static Bool pixPositionWindow (pWin, x, y) WindowPtr pWin; int x, y; { ScreenPtr pScreen; mbufPixmapPrivPtr pMBPriv; mbufWindowPtr pMBWindow; mbufBufferPtr pMBBuffer; int width, height; int i; int dx, dy, dw, dh; int sourcex, sourcey; int destx, desty; PixmapPtr pPixmap; GCPtr pGC; int savewidth, saveheight; Bool clear; RegionRec exposedRegion; Bool ret; pScreen = pWin->drawable.pScreen; pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen); UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow); ret = (* pScreen->PositionWindow) (pWin, x, y); REWRAP_SCREEN_FUNC(pScreen, pMBPriv, Bool, PositionWindow); if (!(pMBWindow = MB_WINDOW_PRIV(pWin))) return ret; /* if new size is same as old, we're done */ if (pMBWindow->width == pWin->drawable.width && pMBWindow->height == pWin->drawable.height) return ret; width = pWin->drawable.width; height = pWin->drawable.height; dx = pWin->drawable.x - pMBWindow->x; dy = pWin->drawable.x - pMBWindow->y; dw = width - pMBWindow->width; dh = height - pMBWindow->height; GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty); /* if the window grew, remember to paint the window background, * and maybe send expose events, for the new areas of the buffers */ clear = pMBWindow->width < width || pMBWindow->height < height || pWin->bitGravity == ForgetGravity; sourcex = 0; sourcey = 0; savewidth = pMBWindow->width; saveheight = pMBWindow->height; /* clip rectangle to source and destination */ if (destx < 0) { savewidth += destx; sourcex -= destx; destx = 0; } if (destx + savewidth > width) savewidth = width - destx; if (desty < 0) { saveheight += desty; sourcey -= desty; desty = 0; } if (desty + saveheight > height) saveheight = height - desty; pMBWindow->width = width; pMBWindow->height = height; pMBWindow->x = pWin->drawable.x; pMBWindow->y = pWin->drawable.y; if (clear) { BoxRec box; box.x1 = box.y1 = 0; box.x2 = width; box.y2 = height; REGION_INIT(pScreen, &exposedRegion, &box, 1); if (pWin->bitGravity != ForgetGravity) { RegionRec preservedRegion; box.x1 = destx; box.y1 = desty; box.x2 = destx + savewidth; box.y2 = desty + saveheight; REGION_INIT(pScreen, &preservedRegion, &box, 1); REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion); REGION_UNINIT(pScreen, &preservedRegion); } } /* end if (clear) */ pGC = GetScratchGC (pWin->drawable.depth, pScreen); /* create buffers with new window size */ for (i = 0; i < pMBWindow->numMultibuffer; i++) { pMBBuffer = &pMBWindow->buffers[i]; pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth); if (!pPixmap) { (* MB_SCREEN_PRIV(pScreen)->DestroyImageBuffers)(pWin); break; } if (clear) { MultibufferPaintBackgroundRegion(pWin, (DrawablePtr)pPixmap, &exposedRegion); MultibufferExpose(pMBBuffer, &exposedRegion); } if (pWin->bitGravity != ForgetGravity) { ValidateGC ((DrawablePtr)pPixmap, pGC); (*pGC->ops->CopyArea) (pMBBuffer->pDrawable, (DrawablePtr)pPixmap, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); } pPixmap->drawable.id = pMBBuffer->pDrawable->id; (*pScreen->DestroyPixmap) ((PixmapPtr) pMBBuffer->pDrawable); pMBBuffer->pDrawable = (DrawablePtr) pPixmap; if (i != pMBWindow->displayedMultibuffer) { ChangeResourceValue (pPixmap->drawable.id, MultibufferDrawableResType, (pointer) pPixmap); } } FreeScratchGC (pGC); if (clear) REGION_UNINIT(pScreen, &exposedRegion); return TRUE; } static void pixWrapScreenFuncs(pScreen) ScreenPtr pScreen; { mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen); WRAP_SCREEN_FUNC(pScreen, pMBPriv, PositionWindow, pixPositionWindow); } static void pixResetProc(pScreen) ScreenPtr pScreen; { mbufScreenPtr pMBScreen = MB_SCREEN_PRIV(pScreen); mbufPixmapPrivPtr pMBPriv = MB_SCREEN_PRIV_PIXMAP(pScreen); xfree(pMBScreen->pInfo); xfree(pMBPriv); } static void pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures) mbufBufferPtr pMBBuffer; short x, y; unsigned short width, height; Bool exposures; { WindowPtr pWin; ScreenPtr pScreen; BoxRec box; RegionRec region; int w_width, w_height; DrawablePtr pDrawable; pWin = pMBBuffer->pMBWindow->pWindow; pScreen = pWin->drawable.pScreen; w_width = pWin->drawable.width; w_height = pWin->drawable.height; box.x1 = x; box.y1 = y; box.x2 = width ? (box.x1 + width) : w_width; box.y2 = height ? (box.y1 + height) : w_height; if (box.x1 < 0) box.x1 = 0; if (box.y1 < 0) box.y1 = 0; if (box.x2 > w_width) box.x2 = w_width; if (box.y2 > w_height) box.y2 = w_height; REGION_INIT(pScreen, ®ion, &box, 1); if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer) pDrawable = (DrawablePtr) pWin; else pDrawable = pMBBuffer->pDrawable; MultibufferPaintBackgroundRegion(pWin, pDrawable, ®ion); if (exposures) MultibufferExpose(pMBBuffer, ®ion); REGION_UNINIT(pScreen, ®ion); } static void pixDeleteBufferDrawable(pDrawable) DrawablePtr pDrawable; { (* pDrawable->pScreen->DestroyPixmap)((PixmapPtr) pDrawable); } vnc_unixsrc/Xvnc/programs/Xserver/Xext/dpms.c0100664000076400007640000002375607120677563020767 0ustar constconst/***************************************************************** Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Digital Equipment Corporation shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ /* * HISTORY * * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00 */ /* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.1 1997/01/12 10:40:06 dawes Exp $ */ #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "opaque.h" #include "dpms.h" #include "dpmsstr.h" #include static unsigned char DPMSCode; static int ProcDPMSDispatch(), SProcDPMSDispatch(); static void DPMSResetProc(); static int ProcDPMSGetVersion(), SProcDPMSGetVersion(); static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts(); static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts(); static int ProcDPMSEnable(), ProcDPMSEnable(); static int ProcDPMSDisable(), ProcDPMSDisable(); static int ProcDPMSForceLevel(), ProcDPMSForceLevel(); void DPMSExtensionInit() { ExtensionEntry *extEntry, *AddExtension(); if (extEntry = AddExtension(DPMSExtensionName, 0, 0, ProcDPMSDispatch, SProcDPMSDispatch, DPMSResetProc, StandardMinorOpcode)) DPMSCode = (unsigned char)extEntry->base; return; } /*ARGSUSED*/ static void DPMSResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcDPMSGetVersion(client) register ClientPtr client; { REQUEST(xDPMSGetVersionReq); xDPMSGetVersionReply rep; register int n; REQUEST_SIZE_MATCH(xDPMSGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = DPMSMajorVersion; rep.minorVersion = DPMSMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep); return(client->noClientException); } static int ProcDPMSCapable(client) register ClientPtr client; { REQUEST(xDPMSCapableReq); xDPMSCapableReply rep; register int n; REQUEST_SIZE_MATCH(xDPMSCapableReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.capable = DPMSCapableFlag; WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep); return(client->noClientException); } static int ProcDPMSGetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSGetTimeoutsReq); xDPMSGetTimeoutsReply rep; register int n; REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.standby = DPMSStandbyTime / MILLI_PER_SECOND; rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND; rep.off = DPMSOffTime / MILLI_PER_SECOND; if (client->swapped) { swaps(&rep.sequenceNumber, n); swaps(&rep.standby, n); swaps(&rep.suspend, n); swaps(&rep.off, n); } WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep); return(client->noClientException); } static int ProcDPMSSetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSSetTimeoutsReq); register int n; REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); if ((stuff->off != 0)&&(stuff->off < stuff->suspend)) { client->errorValue = stuff->off; return BadValue; } if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby)) { client->errorValue = stuff->suspend; return BadValue; } DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND; DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND; DPMSOffTime = stuff->off * MILLI_PER_SECOND; return(client->noClientException); } static int ProcDPMSEnable(client) register ClientPtr client; { REQUEST(xDPMSEnableReq); REQUEST_SIZE_MATCH(xDPMSEnableReq); if (DPMSCapableFlag) DPMSEnabled = TRUE; return(client->noClientException); } static int ProcDPMSDisable(client) register ClientPtr client; { REQUEST(xDPMSDisableReq); REQUEST_SIZE_MATCH(xDPMSDisableReq); DPMSSet(DPMSModeOn); DPMSEnabled = FALSE; return(client->noClientException); } static int ProcDPMSForceLevel(client) register ClientPtr client; { REQUEST(xDPMSForceLevelReq); REQUEST_SIZE_MATCH(xDPMSForceLevelReq); if (!DPMSEnabled) return BadMatch; if (stuff->level == DPMSModeOn) { lastDeviceEventTime.milliseconds = GetTimeInMillis(); } else if (stuff->level == DPMSModeStandby) { lastDeviceEventTime.milliseconds = GetTimeInMillis() - DPMSStandbyTime; } else if (stuff->level == DPMSModeSuspend) { lastDeviceEventTime.milliseconds = GetTimeInMillis() - DPMSSuspendTime; } else if (stuff->level == DPMSModeOff) { lastDeviceEventTime.milliseconds = GetTimeInMillis() - DPMSOffTime; } else { client->errorValue = stuff->level; return BadValue; } DPMSSet(stuff->level); return(client->noClientException); } static int ProcDPMSInfo(client) register ClientPtr client; { REQUEST(xDPMSInfoReq); xDPMSInfoReply rep; register int n; REQUEST_SIZE_MATCH(xDPMSInfoReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.power_level = DPMSPowerLevel; rep.state = DPMSEnabled; if (client->swapped) { swaps(&rep.sequenceNumber, n); swaps(&rep.power_level, n); } WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep); return(client->noClientException); } static int ProcDPMSDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_DPMSGetVersion: return ProcDPMSGetVersion(client); case X_DPMSCapable: return ProcDPMSCapable(client); case X_DPMSGetTimeouts: return ProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: return ProcDPMSSetTimeouts(client); case X_DPMSEnable: return ProcDPMSEnable(client); case X_DPMSDisable: return ProcDPMSDisable(client); case X_DPMSForceLevel: return ProcDPMSForceLevel(client); case X_DPMSInfo: return ProcDPMSInfo(client); default: return BadRequest; } } static int SProcDPMSGetVersion(client) register ClientPtr client; { register int n; REQUEST(xDPMSGetVersionReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSGetVersionReq); swaps(&stuff->majorVersion, n); swaps(&stuff->minorVersion, n); return ProcDPMSGetVersion(client); } static int SProcDPMSCapable(client) register ClientPtr client; { REQUEST(xDPMSCapableReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSCapableReq); return ProcDPMSCapable(client); } static int SProcDPMSGetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSGetTimeoutsReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); return ProcDPMSGetTimeouts(client); } static int SProcDPMSSetTimeouts(client) register ClientPtr client; { REQUEST(xDPMSSetTimeoutsReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); swaps(&stuff->standby, n); swaps(&stuff->suspend, n); swaps(&stuff->off, n); return ProcDPMSSetTimeouts(client); } static int SProcDPMSEnable(client) register ClientPtr client; { REQUEST(xDPMSEnableReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSEnableReq); return ProcDPMSEnable(client); } static int SProcDPMSDisable(client) register ClientPtr client; { REQUEST(xDPMSDisableReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSDisableReq); return ProcDPMSDisable(client); } static int SProcDPMSForceLevel(client) register ClientPtr client; { REQUEST(xDPMSForceLevelReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSForceLevelReq); swaps(&stuff->level, n); return ProcDPMSForceLevel(client); } static int SProcDPMSInfo(client) register ClientPtr client; { REQUEST(xDPMSInfoReq); register int n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xDPMSInfoReq); return ProcDPMSInfo(client); } static int SProcDPMSDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_DPMSGetVersion: return SProcDPMSGetVersion(client); case X_DPMSCapable: return SProcDPMSCapable(client); case X_DPMSGetTimeouts: return SProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: return SProcDPMSSetTimeouts(client); case X_DPMSEnable: return SProcDPMSEnable(client); case X_DPMSDisable: return SProcDPMSDisable(client); case X_DPMSForceLevel: return SProcDPMSForceLevel(client); case X_DPMSInfo: return SProcDPMSInfo(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/SecurityPolicy0100664000076400007640000000556107120677563022564 0ustar constconstversion-1 # $XConsortium: SecurityPolicy /main/3 1996/12/20 20:27:48 swick $ # The site policy fields are interpreted by the XC-QUERY-SECURITY-1 # authorization protocol. The values are arbitrary and site-specific. # Refer to the Security Extension Specification for the usage of the policies. #sitepolicy A #sitepolicy B #sitepolicy C # Property access rules: # property # ::= any | root | # ::= | = # :== [ | | ]* # :== r | w | d # r read # w write # d delete # :== a | i | e # a allow # i ignore # e error # Allow reading of application resources, but not writing. property RESOURCE_MANAGER root ar iw property SCREEN_RESOURCES root ar iw # Ignore attempts to use cut buffers. Giving errors causes apps to crash, # and allowing access may give away too much information. property CUT_BUFFER0 root irw property CUT_BUFFER1 root irw property CUT_BUFFER2 root irw property CUT_BUFFER3 root irw property CUT_BUFFER4 root irw property CUT_BUFFER5 root irw property CUT_BUFFER6 root irw property CUT_BUFFER7 root irw # If you are using Motif, you probably want these. property _MOTIF_DEFAULT_BINDINGS root ar iw property _MOTIF_DRAG_WINDOW root ar iw property _MOTIF_DRAG_TARGETS any ar iw property _MOTIF_DRAG_ATOMS any ar iw property _MOTIF_DRAG_ATOM_PAIRS any ar iw # If you are running CDE you also need these property _MOTIF_WM_INFO root arw property TT_SESSION root irw property WM_ICON_SIZE root irw property "SDT Pixel Set" any irw # The next two rules let xwininfo -tree work when untrusted. property WM_NAME any ar # Allow read of WM_CLASS, but only for windows with WM_NAME. # This might be more restrictive than necessary, but demonstrates # the facility, and is also an attempt to # say "top level windows only." property WM_CLASS WM_NAME ar # These next three let xlsclients work untrusted. Think carefully # before including these; giving away the client machine name and command # may be exposing too much. property WM_STATE WM_NAME ar property WM_CLIENT_MACHINE WM_NAME ar property WM_COMMAND WM_NAME ar # To let untrusted clients use the standard colormaps created by # xstdcmap, include these lines. property RGB_DEFAULT_MAP root ar property RGB_BEST_MAP root ar property RGB_RED_MAP root ar property RGB_GREEN_MAP root ar property RGB_BLUE_MAP root ar property RGB_GRAY_MAP root ar # To let untrusted clients use the color management database created # by xcmsdb, include these lines. property XDCCC_LINEAR_RGB_CORRECTION root ar property XDCCC_LINEAR_RGB_MATRICES root ar property XDCCC_GRAY_SCREENWHITEPOINT root ar property XDCCC_GRAY_CORRECTION root ar # To let untrusted clients use the overlay visuals that many vendors # support, include this line. property SERVER_OVERLAY_VISUALS root ar vnc_unixsrc/Xvnc/programs/Xserver/Xext/xtest1dd.h0100664000076400007640000000604307120677563021557 0ustar constconst/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.h,v 3.0 1996/05/06 05:55:43 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #ifndef XTEST1DD_H #define XTEST1DD_H 1 extern short xtest_mousex; extern short xtest_mousey; extern int playback_on; extern ClientPtr current_xtest_client; extern ClientPtr playback_client; extern KeyCode xtest_command_key; extern void stop_stealing_input( #if NeedFunctionPrototypes void #endif ); extern void steal_input( #if NeedFunctionPrototypes ClientPtr /* client */, CARD32 /* mode */ #endif ); extern void flush_input_actions( #if NeedFunctionPrototypes void #endif ); extern void XTestStealJumpData( #if NeedFunctionPrototypes2 short /* jx */, short /* jy */, int /* dev_type */ #endif ); extern void XTestStealMotionData( #if NeedFunctionPrototypes2 short /* dx */, short /* dy */, int /* dev_type */, short /* mx */, short /* my */ #endif ); extern Bool XTestStealKeyData( #if NeedFunctionPrototypes2 CARD8 /* keycode */, char /* keystate */, int /* dev_type */, short /* locx */, short /* locy */ #endif ); extern void parse_fake_input( #if NeedFunctionPrototypes ClientPtr /* client */, char * /* req */ #endif ); extern void XTestComputeWaitTime( #if NeedFunctionPrototypes struct timeval * /* waittime */ #endif ); extern int XTestProcessInputAction( #if NeedFunctionPrototypes int /* readable */, struct timeval * /* waittime */ #endif ); extern void abort_play_back( #if NeedFunctionPrototypes void #endif ); extern void return_input_array_size( #if NeedFunctionPrototypes ClientPtr /* client */ #endif ); #endif /* XTEST1DD_H */ vnc_unixsrc/Xvnc/programs/Xserver/Xext/Imakefile0100664000076400007640000000404707120677563021461 0ustar constconstXCOMM $XConsortium: Imakefile /main/56 1996/11/26 16:07:54 swick $ XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.11.2.1 1998/01/23 12:35:11 dawes Exp $ #include #if HasShm SHMSRCS = shm.c SHMOBJS = shm.o #endif #if BuildScreenSaverExt SCRNSAVSRC = saver.c SCRNSAVOBJ = saver.o #endif #if BuildXF86VidModeExt VIDMODESRCS = xf86vmode.c VIDMODEOBJS = xf86vmode.o #endif #if BuildXF86MiscExt XF86MISCSRCS = xf86misc.c XF86MISCOBJS = xf86misc.o #endif #if BuildXF86DGA XF86DGASRCS = xf86dga.c XF86DGAOBJS = xf86dga.o #endif #if BuildDPMSExt DPMSSRCS = dpms.c DPMSOBJS = dpms.o #endif #if BuildAppgroup APPGROUPSRCS = appgroup.c APPGROUPOBJS = appgroup.o #endif #if BuildXCSecurity SECURITYSRCS = security.c SECURITYOBJS = security.o SERVERCONFIGDIR = ServerConfigDir POLICYFILEDEF = -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGDIR)/SecurityPolicy\" #endif SRCS = shape.c $(SHMSRCS) mbuf.c \ mitmisc.c xtest.c xtest1di.c xtest1dd.c sleepuntil.c \ bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \ $(XF86MISCSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \ $(DPMSSRCS) \ $(APPGROUPSRCS) xprint.c OBJS = shape.o $(SHMOBJS) mbuf.o \ mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \ $(XF86MISCOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \ $(DPMSOBJS) \ $(APPGROUPOBJS) xprint.o XF86INCLUDES = -I../hw/xfree86/common -I../hw/xfree86/os-support INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) $(XF86INCLUDES) LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryObjectRule() NormalLibraryTarget(ext,$(OBJS)) LintLibraryTarget(ext,$(SRCS)) NormalLintTarget($(SRCS)) #if BuildXCSecurity SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF)) #endif InstallLinkKitLibrary(ext,$(LINKKITDIR)/lib) LinkVarDirectory(xserver,.,xserver,.) #if BuildXCSecurity && InstallSecurityConfig InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR)) #endif DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/Xext/mitmisc.c0100664000076400007640000001035507120677563021460 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */ /* $XConsortium: mitmisc.c,v 1.5 94/04/17 20:32:54 rws Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.1 1996/05/06 05:55:29 dawes Exp $ */ #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #define _MITMISC_SERVER_ #include "mitmiscstr.h" extern Bool permitOldBugs; static unsigned char MITReqCode; static void MITResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static DISPATCH_PROC(ProcMITDispatch); static DISPATCH_PROC(ProcMITGetBugMode); static DISPATCH_PROC(ProcMITSetBugMode); static DISPATCH_PROC(SProcMITDispatch); static DISPATCH_PROC(SProcMITGetBugMode); static DISPATCH_PROC(SProcMITSetBugMode); void MITMiscExtensionInit() { ExtensionEntry *extEntry; if ((extEntry = AddExtension(MITMISCNAME, 0, 0, ProcMITDispatch, SProcMITDispatch, MITResetProc, StandardMinorOpcode)) != 0) MITReqCode = (unsigned char)extEntry->base; } /*ARGSUSED*/ static void MITResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcMITSetBugMode(client) register ClientPtr client; { REQUEST(xMITSetBugModeReq); REQUEST_SIZE_MATCH(xMITSetBugModeReq); if ((stuff->onOff != xTrue) && (stuff->onOff != xFalse)) { client->errorValue = stuff->onOff; return BadValue; } permitOldBugs = stuff->onOff; return(client->noClientException); } static int ProcMITGetBugMode(client) register ClientPtr client; { xMITGetBugModeReply rep; register int n; REQUEST_SIZE_MATCH(xMITGetBugModeReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.onOff = permitOldBugs; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); } WriteToClient(client, sizeof(xMITGetBugModeReply), (char *)&rep); return(client->noClientException); } static int ProcMITDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_MITSetBugMode: return ProcMITSetBugMode(client); case X_MITGetBugMode: return ProcMITGetBugMode(client); default: return BadRequest; } } static int SProcMITSetBugMode(client) register ClientPtr client; { register int n; REQUEST(xMITSetBugModeReq); swaps(&stuff->length, n); return ProcMITSetBugMode(client); } static int SProcMITGetBugMode(client) register ClientPtr client; { register int n; REQUEST(xMITGetBugModeReq); swaps(&stuff->length, n); return ProcMITGetBugMode(client); } static int SProcMITDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_MITSetBugMode: return SProcMITSetBugMode(client); case X_MITGetBugMode: return SProcMITGetBugMode(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xf86misc.c0100664000076400007640000004271107120677563021463 0ustar constconst/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.21.2.4 1998/02/25 14:26:43 dawes Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "scrnintstr.h" #include "inputstr.h" #include "servermd.h" #define _XF86MISC_SERVER_ #define _XF86MISC_SAVER_COMPAT_ #include "xf86mscstr.h" #include "Xfuncproto.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include #include "../os/osdep.h" #include #ifndef ESIX #ifndef Lynx #include #else #include #endif #else #include #endif #include "swaprep.h" extern int xf86ScreenIndex; extern Bool xf86MiscModInDevEnabled; extern Bool xf86MiscModInDevAllowNonLocal; static int miscErrorBase; static void XF86MiscResetProc( #if NeedFunctionPrototypes ExtensionEntry* /* extEntry */ #endif ); static DISPATCH_PROC(ProcXF86MiscDispatch); static DISPATCH_PROC(ProcXF86MiscGetKbdSettings); static DISPATCH_PROC(ProcXF86MiscGetMouseSettings); static DISPATCH_PROC(ProcXF86MiscGetSaver); static DISPATCH_PROC(ProcXF86MiscQueryVersion); static DISPATCH_PROC(ProcXF86MiscSetKbdSettings); static DISPATCH_PROC(ProcXF86MiscSetMouseSettings); static DISPATCH_PROC(ProcXF86MiscSetSaver); static DISPATCH_PROC(SProcXF86MiscDispatch); static DISPATCH_PROC(SProcXF86MiscGetKbdSettings); static DISPATCH_PROC(SProcXF86MiscGetMouseSettings); static DISPATCH_PROC(SProcXF86MiscGetSaver); static DISPATCH_PROC(SProcXF86MiscQueryVersion); static DISPATCH_PROC(SProcXF86MiscSetKbdSettings); static DISPATCH_PROC(SProcXF86MiscSetMouseSettings); static DISPATCH_PROC(SProcXF86MiscSetSaver); static unsigned char XF86MiscReqCode = 0; extern InputInfo inputInfo; void XFree86MiscExtensionInit() { ExtensionEntry* extEntry; if ( (extEntry = AddExtension(XF86MISCNAME, XF86MiscNumberEvents, XF86MiscNumberErrors, ProcXF86MiscDispatch, SProcXF86MiscDispatch, XF86MiscResetProc, StandardMinorOpcode))) { XF86MiscReqCode = (unsigned char)extEntry->base; miscErrorBase = extEntry->errorBase; } } /*ARGSUSED*/ static void XF86MiscResetProc (extEntry) ExtensionEntry* extEntry; { } static int ProcXF86MiscQueryVersion(client) register ClientPtr client; { xXF86MiscQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XF86MISC_MAJOR_VERSION; rep.minorVersion = XF86MISC_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep); return (client->noClientException); } /* * This will go away, but remains for now for compatibility with older * clients. */ static int ProcXF86MiscSetSaver(client) register ClientPtr client; { REQUEST(xXF86MiscSetSaverReq); ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq); if (stuff->suspendTime < 0) return BadValue; if (stuff->offTime < 0) return BadValue; return (client->noClientException); } /* * This will go away, but remains for now for compatibility with older * clients. */ static int ProcXF86MiscGetSaver(client) register ClientPtr client; { REQUEST(xXF86MiscGetSaverReq); xXF86MiscGetSaverReply rep; register int n; ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.suspendTime = 0; rep.offTime = 0; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.suspendTime, n); swapl(&rep.offTime, n); } WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep); return (client->noClientException); } static int ProcXF86MiscGetMouseSettings(client) register ClientPtr client; { xXF86MiscGetMouseSettingsReply rep; register int n; REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.mousetype = xf86Info.mouseDev->mseType; #ifdef XQUEUE if (xf86Info.mouseDev->mseProc == xf86XqueMseProc) rep.mousetype = MTYPE_XQUEUE; #endif #if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY) if (xf86Info.mouseDev->mseProc == xf86OsMouseProc) rep.mousetype = MTYPE_OSMOUSE; #endif rep.baudrate = xf86Info.mouseDev->baudRate; rep.samplerate = xf86Info.mouseDev->sampleRate; rep.resolution = xf86Info.mouseDev->resolution; rep.buttons = xf86Info.mouseDev->buttons; rep.emulate3buttons = xf86Info.mouseDev->emulate3Buttons; rep.emulate3timeout = xf86Info.mouseDev->emulate3Timeout; rep.chordmiddle = xf86Info.mouseDev->chordMiddle; rep.flags = xf86Info.mouseDev->mouseFlags; if (xf86Info.mouseDev->mseDevice) rep.devnamelen = strlen(xf86Info.mouseDev->mseDevice); else rep.devnamelen = 0; rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) - sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.mousetype, n); swapl(&rep.baudrate, n); swapl(&rep.samplerate, n); swapl(&rep.resolution, n); swapl(&rep.buttons, n); swapl(&rep.emulate3buttons, n); swapl(&rep.emulate3timeout, n); swapl(&rep.chordmiddle, n); swapl(&rep.flags, n); } WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep); if (rep.devnamelen) WriteToClient(client, rep.devnamelen, xf86Info.mouseDev->mseDevice); return (client->noClientException); } static int ProcXF86MiscGetKbdSettings(client) register ClientPtr client; { xXF86MiscGetKbdSettingsReply rep; register int n; REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.kbdtype = xf86Info.kbdType; #ifdef XQUEUE if (xf86Info.kbdProc == xf86XqueKbdProc) rep.kbdtype = KTYPE_XQUEUE; #endif rep.rate = xf86Info.kbdRate; rep.delay = xf86Info.kbdDelay; rep.servnumlock = xf86Info.serverNumLock; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.kbdtype, n); swapl(&rep.rate, n); swapl(&rep.delay, n); } WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep); return (client->noClientException); } static int ProcXF86MiscSetMouseSettings(client) register ClientPtr client; { int reopen, msetype, flags, baudrate, samplerate, resolution; REQUEST(xXF86MiscSetMouseSettingsReq); REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq); if (xf86Verbose) { ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n", stuff->mousetype, stuff->baudrate, stuff->samplerate, stuff->chordmiddle); ErrorF(" em3but: %d em3tim: %d res: %d flags: %d\n", stuff->emulate3buttons, stuff->emulate3timeout, stuff->resolution, stuff->flags); } if (stuff->mousetype > MTYPE_OSMOUSE || stuff->mousetype < MTYPE_MICROSOFT) return miscErrorBase + XF86MiscBadMouseProtocol; #ifdef OSMOUSE_ONLY if (stuff->mousetype != MTYPE_OSMOUSE) return miscErrorBase + XF86MiscBadMouseProtocol; #else #ifndef XQUEUE if (stuff->mousetype == MTYPE_XQUEUE) return miscErrorBase + XF86MiscBadMouseProtocol; #endif #ifndef USE_OSMOUSE if (stuff->mousetype == MTYPE_OSMOUSE) return miscErrorBase + XF86MiscBadMouseProtocol; #endif #endif /* OSMOUSE_ONLY */ if (stuff->emulate3timeout < 0) return BadValue; if (stuff->mousetype == MTYPE_LOGIMAN && !(stuff->baudrate == 1200 || stuff->baudrate == 9600) ) return miscErrorBase + XF86MiscBadMouseBaudRate; if (stuff->mousetype == MTYPE_LOGIMAN && stuff->samplerate) return miscErrorBase + XF86MiscBadMouseCombo; samplerate = xf86Info.mouseDev->sampleRate; resolution = xf86Info.mouseDev->resolution; baudrate = xf86Info.mouseDev->baudRate; flags = xf86Info.mouseDev->mouseFlags; msetype = xf86Info.mouseDev->mseType; #ifdef XQUEUE if (xf86Info.mouseDev->mseProc == xf86XqueMseProc) msetype = MTYPE_XQUEUE; #endif #if defined(USE_OSMOUSE) || defined(OSMOUSE_ONLY) if (xf86Info.mouseDev->mseProc == xf86OsMouseProc) msetype = MTYPE_OSMOUSE; #endif reopen = 0; if (stuff->mousetype != msetype) if (stuff->mousetype == MTYPE_XQUEUE || stuff->mousetype == MTYPE_OSMOUSE || msetype == MTYPE_XQUEUE || msetype == MTYPE_OSMOUSE) return miscErrorBase + XF86MiscBadMouseProtocol; else { reopen++; msetype = stuff->mousetype; } if (stuff->flags & MF_REOPEN) { reopen++; stuff->flags &= ~MF_REOPEN; } if (stuff->mousetype != MTYPE_OSMOUSE && stuff->mousetype != MTYPE_XQUEUE && stuff->mousetype != MTYPE_PS_2 && stuff->mousetype != MTYPE_BUSMOUSE && stuff->mousetype != MTYPE_IMPS2 && stuff->mousetype != MTYPE_THINKINGPS2 && stuff->mousetype != MTYPE_MMANPLUSPS2 && stuff->mousetype != MTYPE_GLIDEPOINTPS2 && stuff->mousetype != MTYPE_NETPS2 && stuff->mousetype != MTYPE_NETSCROLLPS2 && stuff->mousetype != MTYPE_SYSMOUSE) { if (stuff->baudrate < 1200) return miscErrorBase + XF86MiscBadMouseBaudRate; if (stuff->baudrate % 1200 != 0 || stuff->baudrate < 1200 || stuff->baudrate > 9600) return miscErrorBase + XF86MiscBadMouseBaudRate; if (xf86Info.mouseDev->baudRate != stuff->baudrate) { reopen++; baudrate = stuff->baudrate; } } if (stuff->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS)) if (stuff->mousetype != MTYPE_MOUSESYS) return miscErrorBase + XF86MiscBadMouseFlags; else if (xf86Info.mouseDev->mouseFlags != stuff->flags) { reopen++; flags = stuff->flags; } if (stuff->mousetype != MTYPE_OSMOUSE && stuff->mousetype != MTYPE_XQUEUE && stuff->mousetype != MTYPE_BUSMOUSE) { if (stuff->samplerate < 0) return BadValue; if (xf86Info.mouseDev->sampleRate != stuff->samplerate) { reopen++; samplerate = stuff->samplerate; } } if (stuff->resolution < 0) return BadValue; if (xf86Info.mouseDev->resolution != stuff->resolution) { reopen++; resolution = stuff->resolution; } #if 0 /* Ignore the buttons field */ if (xf86Info.mouseDev->buttons != stuff->buttons) /* we cannot change this field on the fly... */ return BadValue; #endif if (stuff->chordmiddle) if (stuff->emulate3buttons || !(stuff->mousetype == MTYPE_MICROSOFT || stuff->mousetype == MTYPE_LOGIMAN) ) return miscErrorBase + XF86MiscBadMouseCombo; xf86Info.mouseDev->chordMiddle = stuff->chordmiddle!=0; xf86Info.mouseDev->emulate3Buttons = stuff->emulate3buttons!=0; xf86Info.mouseDev->emulate3Timeout = stuff->emulate3timeout; if (reopen && msetype != MTYPE_OSMOUSE && msetype != MTYPE_XQUEUE) { (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_CLOSE); xf86Info.mouseDev->mseType = msetype; xf86Info.mouseDev->mouseFlags = flags; xf86Info.mouseDev->baudRate = baudrate; xf86Info.mouseDev->sampleRate = samplerate; xf86Info.mouseDev->resolution = resolution; xf86Info.pMouse->public.on = FALSE; xf86AllowMouseOpenFail = TRUE; xf86MouseInit(xf86Info.mouseDev); (xf86Info.mouseDev->mseProc)(xf86Info.pMouse, DEVICE_ON); } if (xf86Verbose) ErrorF("SetMouseSettings - Succeeded\n"); return (client->noClientException); } static int ProcXF86MiscSetKbdSettings(client) register ClientPtr client; { REQUEST(xXF86MiscSetKbdSettingsReq); REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq); if (xf86Verbose) ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n", stuff->kbdtype, stuff->rate, stuff->delay, stuff->servnumlock); if (stuff->rate < 0) return BadValue; if (stuff->delay < 0) return BadValue; if (stuff->kbdtype < KTYPE_UNKNOWN || stuff->kbdtype > KTYPE_XQUEUE) return miscErrorBase + XF86MiscBadKbdType; if (xf86Info.kbdRate!=stuff->rate || xf86Info.kbdDelay!=stuff->delay) { char rad; xf86Info.kbdRate = stuff->rate; xf86Info.kbdDelay = stuff->delay; if (xf86Info.kbdDelay <= 375) rad = 0x00; else if (xf86Info.kbdDelay <= 625) rad = 0x20; else if (xf86Info.kbdDelay <= 875) rad = 0x40; else rad = 0x60; if (xf86Info.kbdRate <= 2) rad |= 0x1F; else if (xf86Info.kbdRate >= 30) rad |= 0x00; else rad |= ((58/xf86Info.kbdRate)-2); xf86SetKbdRepeat(rad); } #if 0 /* Not done yet */ xf86Info.kbdType = stuff->kbdtype; xf86Info.serverNumLock = stuff->servnumlock!=0; #endif if (xf86Verbose) ErrorF("SetKbdSettings - Succeeded\n"); return (client->noClientException); } static int ProcXF86MiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XF86MiscQueryVersion: return ProcXF86MiscQueryVersion(client); case X_XF86MiscGetSaver: return ProcXF86MiscGetSaver(client); case X_XF86MiscSetSaver: return ProcXF86MiscSetSaver(client); case X_XF86MiscGetMouseSettings: return ProcXF86MiscGetMouseSettings(client); case X_XF86MiscGetKbdSettings: return ProcXF86MiscGetKbdSettings(client); default: if (!xf86MiscModInDevEnabled) return miscErrorBase + XF86MiscModInDevDisabled; if (xf86MiscModInDevAllowNonLocal || LocalClient (client)) { switch (stuff->data) { case X_XF86MiscSetMouseSettings: return ProcXF86MiscSetMouseSettings(client); case X_XF86MiscSetKbdSettings: return ProcXF86MiscSetKbdSettings(client); default: return BadRequest; } } else return miscErrorBase + XF86MiscModInDevClientNotLocal; } } static int SProcXF86MiscQueryVersion(client) register ClientPtr client; { register int n; REQUEST(xXF86MiscQueryVersionReq); swaps(&stuff->length, n); return ProcXF86MiscQueryVersion(client); } static int SProcXF86MiscGetSaver(client) ClientPtr client; { register int n; REQUEST(xXF86MiscGetSaverReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq); swaps(&stuff->screen, n); return ProcXF86MiscGetSaver(client); } static int SProcXF86MiscSetSaver(client) ClientPtr client; { register int n; REQUEST(xXF86MiscSetSaverReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq); swaps(&stuff->screen, n); swapl(&stuff->suspendTime, n); swapl(&stuff->offTime, n); return ProcXF86MiscSetSaver(client); } static int SProcXF86MiscGetMouseSettings(client) ClientPtr client; { register int n; REQUEST(xXF86MiscGetMouseSettingsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq); return ProcXF86MiscGetMouseSettings(client); } static int SProcXF86MiscGetKbdSettings(client) ClientPtr client; { register int n; REQUEST(xXF86MiscGetKbdSettingsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq); return ProcXF86MiscGetKbdSettings(client); } static int SProcXF86MiscSetMouseSettings(client) ClientPtr client; { register int n; REQUEST(xXF86MiscSetMouseSettingsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq); swapl(&stuff->mousetype, n); swapl(&stuff->baudrate, n); swapl(&stuff->samplerate, n); swapl(&stuff->resolution, n); swapl(&stuff->buttons, n); swapl(&stuff->emulate3timeout, n); swapl(&stuff->flags, n); return ProcXF86MiscSetMouseSettings(client); } static int SProcXF86MiscSetKbdSettings(client) ClientPtr client; { register int n; REQUEST(xXF86MiscSetKbdSettingsReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq); swapl(&stuff->kbdtype, n); swapl(&stuff->rate, n); swapl(&stuff->delay, n); return ProcXF86MiscSetKbdSettings(client); } static int SProcXF86MiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XF86MiscQueryVersion: return SProcXF86MiscQueryVersion(client); case X_XF86MiscGetSaver: return SProcXF86MiscGetSaver(client); case X_XF86MiscSetSaver: return SProcXF86MiscSetSaver(client); case X_XF86MiscGetMouseSettings: return SProcXF86MiscGetMouseSettings(client); case X_XF86MiscGetKbdSettings: return SProcXF86MiscGetKbdSettings(client); default: if (!xf86MiscModInDevEnabled) return miscErrorBase + XF86MiscModInDevDisabled; if (xf86MiscModInDevAllowNonLocal || LocalClient (client)) { switch (stuff->data) { case X_XF86MiscSetMouseSettings: return SProcXF86MiscSetMouseSettings(client); case X_XF86MiscSetKbdSettings: return SProcXF86MiscSetKbdSettings(client); default: return BadRequest; } } else return miscErrorBase + XF86MiscModInDevClientNotLocal; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xtest.c0100664000076400007640000003266507120677563021172 0ustar constconst/* $XConsortium: xtest.c,v 1.22 94/04/17 20:32:59 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.1 1996/05/06 05:55:41 dawes Exp $ */ /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "dixevents.h" #define _XTEST_SERVER_ #include "XTest.h" #include "xteststr.h" #ifdef XINPUT #include "XI.h" #include "XIproto.h" #define EXTENSION_EVENT_BASE 64 #include "extinit.h" /* LookupDeviceIntRec */ #endif /* XINPUT */ static unsigned char XTestReqCode; #ifdef XINPUT extern int DeviceValuator; #endif /* XINPUT */ static void XTestResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static int XTestSwapFakeInput( #if NeedFunctionPrototypes ClientPtr /* client */, xReq * /* req */ #endif ); static DISPATCH_PROC(ProcXTestCompareCursor); static DISPATCH_PROC(ProcXTestDispatch); static DISPATCH_PROC(ProcXTestFakeInput); static DISPATCH_PROC(ProcXTestGetVersion); static DISPATCH_PROC(ProcXTestGrabControl); static DISPATCH_PROC(SProcXTestCompareCursor); static DISPATCH_PROC(SProcXTestDispatch); static DISPATCH_PROC(SProcXTestFakeInput); static DISPATCH_PROC(SProcXTestGetVersion); static DISPATCH_PROC(SProcXTestGrabControl); void XTestExtensionInit() { ExtensionEntry *extEntry; if ((extEntry = AddExtension(XTestExtensionName, 0, 0, ProcXTestDispatch, SProcXTestDispatch, XTestResetProc, StandardMinorOpcode)) != 0) XTestReqCode = (unsigned char)extEntry->base; } /*ARGSUSED*/ static void XTestResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcXTestGetVersion(client) register ClientPtr client; { xXTestGetVersionReply rep; register int n; REQUEST_SIZE_MATCH(xXTestGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XTestMajorVersion; rep.minorVersion = XTestMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep); return(client->noClientException); } static int ProcXTestCompareCursor(client) register ClientPtr client; { REQUEST(xXTestCompareCursorReq); xXTestCompareCursorReply rep; WindowPtr pWin; CursorPtr pCursor; register int n; REQUEST_SIZE_MATCH(xXTestCompareCursorReq); pWin = (WindowPtr)LookupWindow(stuff->window, client); if (!pWin) return(BadWindow); if (stuff->cursor == None) pCursor = NullCursor; else if (stuff->cursor == XTestCurrentCursor) pCursor = GetSpriteCursor(); else { pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR); if (!pCursor) { client->errorValue = stuff->cursor; return (BadCursor); } } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.same = (wCursor(pWin) == pCursor); if (client->swapped) { swaps(&rep.sequenceNumber, n); } WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep); return(client->noClientException); } static int ProcXTestFakeInput(client) register ClientPtr client; { REQUEST(xXTestFakeInputReq); int nev; int n; xEvent *ev; DeviceIntPtr dev; WindowPtr root; int type; #ifdef XINPUT Bool extension = FALSE; deviceValuator *dv; int base; int *values; #endif /* XINPUT */ nev = (stuff->length << 2) - sizeof(xReq); if ((nev % sizeof(xEvent)) || !nev) return BadLength; nev /= sizeof(xEvent); UpdateCurrentTime(); ev = (xEvent *)&((xReq *)stuff)[1]; type = ev->u.u.type & 0177; #ifdef XINPUT if (type >= EXTENSION_EVENT_BASE) { type -= DeviceValuator; switch (type) { case XI_DeviceKeyPress: case XI_DeviceKeyRelease: case XI_DeviceButtonPress: case XI_DeviceButtonRelease: case XI_DeviceMotionNotify: case XI_ProximityIn: case XI_ProximityOut: break; default: client->errorValue = ev->u.u.type; return BadValue; } if (nev == 1 && type == XI_DeviceMotionNotify) return BadLength; if (type == XI_DeviceMotionNotify) base = ((deviceValuator *)(ev+1))->first_valuator; else base = 0; for (n = 1; n < nev; n++) { dv = (deviceValuator *)(ev + n); if (dv->type != DeviceValuator) { client->errorValue = dv->type; return BadValue; } if (dv->first_valuator != base) { client->errorValue = dv->first_valuator; return BadValue; } if (!dv->num_valuators || dv->num_valuators > 6) { client->errorValue = dv->num_valuators; return BadValue; } base += dv->num_valuators; } type = type - XI_DeviceKeyPress + KeyPress; extension = TRUE; } else #endif /* XINPUT */ { if (nev != 1) return BadLength; switch (type) { case KeyPress: case KeyRelease: case MotionNotify: case ButtonPress: case ButtonRelease: break; default: client->errorValue = ev->u.u.type; return BadValue; } } if (ev->u.keyButtonPointer.time) { TimeStamp activateTime; CARD32 ms; activateTime = currentTime; ms = activateTime.milliseconds + ev->u.keyButtonPointer.time; if (ms < activateTime.milliseconds) activateTime.months++; activateTime.milliseconds = ms; ev->u.keyButtonPointer.time = 0; /* see mbuf.c:QueueDisplayRequest for code similar to this */ if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) { return BadAlloc; } /* swap the request back so we can simply re-execute it */ if (client->swapped) { (void) XTestSwapFakeInput(client, (xReq *)stuff); swaps(&stuff->length, n); } ResetCurrentRequest (client); client->sequence--; return Success; } #ifdef XINPUT if (extension) { dev = LookupDeviceIntRec(stuff->deviceid & 0177); if (!dev) { client->errorValue = stuff->deviceid & 0177; return BadValue; } if (nev > 1) { dv = (deviceValuator *)(ev + 1); if (!dev->valuator || dv->first_valuator >= dev->valuator->numAxes) { client->errorValue = dv->first_valuator; return BadValue; } if (dv->first_valuator + dv->num_valuators > dev->valuator->numAxes) { client->errorValue = dv->num_valuators; return BadValue; } } } #endif /* XINPUT */ switch (type) { case KeyPress: case KeyRelease: #ifdef XINPUT if (!extension) #endif /* XINPUT */ dev = (DeviceIntPtr)LookupKeyboardDevice(); if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode || ev->u.u.detail > dev->key->curKeySyms.maxKeyCode) { client->errorValue = ev->u.u.detail; return BadValue; } break; case MotionNotify: #ifdef XINPUT if (extension) { if (ev->u.u.detail != xFalse && ev->u.u.detail != xTrue) { client->errorValue = ev->u.u.detail; return BadValue; } if (ev->u.u.detail == xTrue && dev->valuator->mode == Absolute) { values = dev->valuator->axisVal + dv->first_valuator; for (n = 1; n < nev; n++) { dv = (deviceValuator *)(ev + n); switch (dv->num_valuators) { case 6: dv->valuator5 += values[5]; case 5: dv->valuator4 += values[4]; case 4: dv->valuator3 += values[3]; case 3: dv->valuator2 += values[2]; case 2: dv->valuator1 += values[1]; case 1: dv->valuator0 += values[0]; } values += 6; } } break; } #endif /* XINPUT */ dev = (DeviceIntPtr)LookupPointerDevice(); if (ev->u.keyButtonPointer.root == None) root = GetCurrentRootWindow(); else { root = LookupWindow(ev->u.keyButtonPointer.root, client); if (!root) return BadWindow; if (root->parent) { client->errorValue = ev->u.keyButtonPointer.root; return BadValue; } } if (ev->u.u.detail == xTrue) { int x, y; GetSpritePosition(&x, &y); ev->u.keyButtonPointer.rootX += x; ev->u.keyButtonPointer.rootY += y; } else if (ev->u.u.detail != xFalse) { client->errorValue = ev->u.u.detail; return BadValue; } if (ev->u.keyButtonPointer.rootX < 0) ev->u.keyButtonPointer.rootX = 0; else if (ev->u.keyButtonPointer.rootX >= root->drawable.width) ev->u.keyButtonPointer.rootX = root->drawable.width - 1; if (ev->u.keyButtonPointer.rootY < 0) ev->u.keyButtonPointer.rootY = 0; else if (ev->u.keyButtonPointer.rootY >= root->drawable.height) ev->u.keyButtonPointer.rootY = root->drawable.height - 1; if (root != GetCurrentRootWindow()) { NewCurrentScreen(root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY); return client->noClientException; } (*root->drawable.pScreen->SetCursorPosition) (root->drawable.pScreen, ev->u.keyButtonPointer.rootX, ev->u.keyButtonPointer.rootY, FALSE); break; case ButtonPress: case ButtonRelease: #ifdef XINPUT if (!extension) #endif /* XINPUT */ dev = (DeviceIntPtr)LookupPointerDevice(); if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) { client->errorValue = ev->u.u.detail; return BadValue; } break; } if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); ev->u.keyButtonPointer.time = currentTime.milliseconds; (*dev->public.processInputProc)(ev, dev, nev); return client->noClientException; } static int ProcXTestGrabControl(client) register ClientPtr client; { REQUEST(xXTestGrabControlReq); REQUEST_SIZE_MATCH(xXTestGrabControlReq); if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) { client->errorValue = stuff->impervious; return(BadValue); } if (stuff->impervious) MakeClientGrabImpervious(client); else MakeClientGrabPervious(client); return(client->noClientException); } static int ProcXTestDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XTestGetVersion: return ProcXTestGetVersion(client); case X_XTestCompareCursor: return ProcXTestCompareCursor(client); case X_XTestFakeInput: return ProcXTestFakeInput(client); case X_XTestGrabControl: return ProcXTestGrabControl(client); default: return BadRequest; } } static int SProcXTestGetVersion(client) register ClientPtr client; { register int n; REQUEST(xXTestGetVersionReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXTestGetVersionReq); swaps(&stuff->minorVersion, n); return ProcXTestGetVersion(client); } static int SProcXTestCompareCursor(client) register ClientPtr client; { register int n; REQUEST(xXTestCompareCursorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXTestCompareCursorReq); swapl(&stuff->window, n); swapl(&stuff->cursor, n); return ProcXTestCompareCursor(client); } static int XTestSwapFakeInput(client, req) register ClientPtr client; xReq *req; { register int nev; register xEvent *ev; xEvent sev; EventSwapPtr proc; nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent); for (ev = (xEvent *)&req[1]; --nev >= 0; ev++) { /* Swap event */ proc = EventSwapVector[ev->u.u.type & 0177]; /* no swapping proc; invalid event type? */ if (!proc || proc == NotImplemented) { client->errorValue = ev->u.u.type; return BadValue; } (*proc)(ev, &sev); *ev = sev; } return Success; } static int SProcXTestFakeInput(client) register ClientPtr client; { register int n; REQUEST(xReq); swaps(&stuff->length, n); n = XTestSwapFakeInput(client, stuff); if (n != Success) return n; return ProcXTestFakeInput(client); } static int SProcXTestGrabControl(client) register ClientPtr client; { register int n; REQUEST(xXTestGrabControlReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXTestGrabControlReq); return ProcXTestGrabControl(client); } static int SProcXTestDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XTestGetVersion: return SProcXTestGetVersion(client); case X_XTestCompareCursor: return SProcXTestCompareCursor(client); case X_XTestFakeInput: return SProcXTestFakeInput(client); case X_XTestGrabControl: return SProcXTestGrabControl(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xf86dga.c0100664000076400007640000003007307120677563021261 0ustar constconst/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.8 1997/01/18 06:53:01 dawes Exp $ */ /* Copyright (c) 1995 Jon Tombs Copyright (c) 1995, 1996 XFree86 Inc */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "colormapst.h" #include "cursorstr.h" #include "scrnintstr.h" #include "servermd.h" #define _XF86DGA_SERVER_ #include "xf86dgastr.h" #include "swaprep.h" #include "../hw/xfree86/common/xf86.h" #include #include "../os/osdep.h" #include #ifndef ESIX #ifndef Lynx #include #else #include #endif #else #include #endif extern int xf86ScreenIndex; static int DGAErrorBase; static DISPATCH_PROC(ProcDGAQueryVersion); static DISPATCH_PROC(ProcXF86DGADirectVideo); static DISPATCH_PROC(ProcXF86DGADispatch); static DISPATCH_PROC(ProcXF86DGAGetVidPage); static DISPATCH_PROC(ProcXF86DGAGetVideoLL); static DISPATCH_PROC(ProcXF86DGAGetViewPortSize); static DISPATCH_PROC(ProcXF86DGASetVidPage); static DISPATCH_PROC(ProcXF86DGASetViewPort); static DISPATCH_PROC(ProcDGAInstallColormap); static DISPATCH_PROC(ProcDGAQueryDirectVideo); static DISPATCH_PROC(ProcDGAViewPortChanged); /* * SProcs should probably be deleted, a local connection can never * be byte flipped!? - Jon. */ static DISPATCH_PROC(SProcXF86DGADirectVideo); static DISPATCH_PROC(SProcXF86DGADispatch); static DISPATCH_PROC(SProcXF86DGAQueryVersion); static void XF86DGAResetProc( #if NeedFunctionPrototypes ExtensionEntry* /* extEntry */ #endif ); static unsigned char DGAReqCode = 0; void XFree86DGAExtensionInit() { ExtensionEntry* extEntry; #ifdef XF86DGA_EVENTS int i; ScreenPtr pScreen; EventType = CreateNewResourceType(XF86DGAFreeEvents); ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } #endif if ( #ifdef XF86DGA_EVENTS EventType && ScreenPrivateIndex != -1 && #endif (extEntry = AddExtension(XF86DGANAME, XF86DGANumberEvents, XF86DGANumberErrors, ProcXF86DGADispatch, SProcXF86DGADispatch, XF86DGAResetProc, StandardMinorOpcode))) { DGAReqCode = (unsigned char)extEntry->base; DGAErrorBase = extEntry->errorBase; } } /*ARGSUSED*/ static void XF86DGAResetProc (extEntry) ExtensionEntry* extEntry; { } static int ProcDGAQueryVersion(client) register ClientPtr client; { xXF86DGAQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH(xXF86DGAQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XF86DGA_MAJOR_VERSION; rep.minorVersion = XF86DGA_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); } WriteToClient(client, sizeof(xXF86DGAQueryVersionReply), (char *)&rep); return (client->noClientException); } static int ProcXF86DGAGetVideoLL(client) register ClientPtr client; { REQUEST(xXF86DGAGetVideoLLReq); xXF86DGAGetVideoLLReply rep; ScrnInfoPtr vptr; register int n; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; #if 0 xf86GetVidMemData(stuff->screen, &rep.offset, &rep.bank_size); #else rep.offset = vptr->physBase; rep.bank_size = vptr->physSize; #endif rep.width = vptr->displayWidth; rep.ram_size = vptr->videoRam; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.offset, n); swapl(&rep.width, n); swapl(&rep.bank_size, n); swapl(&rep.ram_size, n); } WriteToClient(client, SIZEOF(xXF86DGAGetVideoLLReply), (char *)&rep); return (client->noClientException); } static int ProcXF86DGADirectVideo(client) register ClientPtr client; { REQUEST(xXF86DGADirectVideoReq); ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); if (!(vptr->directMode&XF86DGADirectPresent)) { /* chipset doesn't know about directVideoMode */ return DGAErrorBase + XF86DGANoDirectVideoMode; } /* Check that the current screen is active. */ if (!xf86VTSema && !(vptr->directMode & XF86DGADirectGraphics)) { return DGAErrorBase + XF86DGAScreenNotActive; } if (stuff->enable&XF86DGADirectGraphics) { vptr->directMode = stuff->enable|XF86DGADirectPresent; if (xf86VTSema == TRUE) { vptr->EnterLeaveVT(LEAVE, stuff->screen); xf86VTSema = FALSE; } } else { if (xf86VTSema == FALSE) { xf86VTSema = TRUE; vptr->EnterLeaveVT(ENTER, stuff->screen); } vptr->directMode = (0x0f&stuff->enable)|XF86DGADirectPresent; } return (client->noClientException); } static int ProcXF86DGAGetViewPortSize(client) register ClientPtr client; { REQUEST(xXF86DGAGetViewPortSizeReq); xXF86DGAGetViewPortSizeReply rep; register int n; ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.width = vptr->modes->HDisplay; rep.height = vptr->modes->VDisplay; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.width, n); swapl(&rep.height, n); } WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), (char *)&rep); return (client->noClientException); } static int ProcXF86DGASetViewPort(client) register ClientPtr client; { REQUEST(xXF86DGASetViewPortReq); ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); if (vptr->AdjustFrame && (xf86VTSema == TRUE || vptr->directMode&XF86DGADirectGraphics)) vptr->AdjustFrame(stuff->x, stuff->y); else return DGAErrorBase + XF86DGAScreenNotActive; return (client->noClientException); } static int ProcXF86DGAGetVidPage(client) register ClientPtr client; { REQUEST(xXF86DGAGetVidPageReq); ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; ErrorF("XF86DGAGetVidPage not yet implemented\n"); REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); return (client->noClientException); } static int ProcXF86DGASetVidPage(client) register ClientPtr client; { REQUEST(xXF86DGASetVidPageReq); ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq); if (xf86VTSema == TRUE) {/* only valid when switched away! */ return DGAErrorBase + XF86DGADirectNotActivated; } if (!xf86VTSema && !(vptr->directMode & XF86DGADirectGraphics)) { return DGAErrorBase + XF86DGAScreenNotActive; } if (vptr->setBank) { vptr->setBank(stuff->vpage); } return (client->noClientException); } static int ProcDGAInstallColormap(client) register ClientPtr client; { ColormapPtr pcmp; ScrnInfoPtr vptr; REQUEST(xXF86DGAInstallColormapReq); REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; if (xf86VTSema == TRUE) {/* only valid when switched away! */ return DGAErrorBase + XF86DGADirectNotActivated; } if (!xf86VTSema && !(vptr->directMode & XF86DGADirectGraphics)) { return DGAErrorBase + XF86DGAScreenNotActive; } pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP); if (pcmp) { vptr->directMode |= XF86DGADirectColormap; vptr->directMode |= XF86DGAHasColormap; (*(pcmp->pScreen->InstallColormap)) (pcmp); vptr->directMode &= ~XF86DGAHasColormap; return (client->noClientException); } else { client->errorValue = stuff->id; return (BadColor); } } static int ProcXF86DGAQueryDirectVideo(client) register ClientPtr client; { REQUEST(xXF86DGAQueryDirectVideoReq); xXF86DGAQueryDirectVideoReply rep; register int n; ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.flags = vptr->directMode; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.flags, n); } WriteToClient(client, SIZEOF(xXF86DGAQueryDirectVideoReply), (char *)&rep); return (client->noClientException); } static int ProcXF86DGAViewPortChanged(client) register ClientPtr client; { REQUEST(xXF86DGAViewPortChangedReq); xXF86DGAViewPortChangedReply rep; register int n; ScrnInfoPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; /* For the moment, always return TRUE. */ rep.result = TRUE; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.result, n); } WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), (char *)&rep); return (client->noClientException); } static int ProcXF86DGADispatch (client) register ClientPtr client; { REQUEST(xReq); if (!LocalClient(client)) return DGAErrorBase + XF86DGAClientNotLocal; switch (stuff->data) { case X_XF86DGAQueryVersion: return ProcDGAQueryVersion(client); case X_XF86DGAGetVideoLL: return ProcXF86DGAGetVideoLL(client); case X_XF86DGADirectVideo: return ProcXF86DGADirectVideo(client); case X_XF86DGAGetViewPortSize: return ProcXF86DGAGetViewPortSize(client); case X_XF86DGASetViewPort: return ProcXF86DGASetViewPort(client); case X_XF86DGAGetVidPage: return ProcXF86DGAGetVidPage(client); case X_XF86DGASetVidPage: return ProcXF86DGASetVidPage(client); case X_XF86DGAInstallColormap: return ProcDGAInstallColormap(client); case X_XF86DGAQueryDirectVideo: return ProcXF86DGAQueryDirectVideo(client); case X_XF86DGAViewPortChanged: return ProcXF86DGAViewPortChanged(client); default: return BadRequest; } } static int SProcXF86DGAQueryVersion(client) register ClientPtr client; { register int n; REQUEST(xXF86DGAQueryVersionReq); swaps(&stuff->length, n); return ProcDGAQueryVersion(client); } static int SProcXF86DGADirectVideo(client) ClientPtr client; { register int n; REQUEST(xXF86DGADirectVideoReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); swaps(&stuff->screen, n); swaps(&stuff->enable, n); return ProcXF86DGADirectVideo(client); } static int SProcXF86DGADispatch (client) register ClientPtr client; { REQUEST(xReq); /* It is bound to be non-local when there is byte swapping */ if (!LocalClient(client)) return DGAErrorBase + XF86DGAClientNotLocal; switch (stuff->data) { case X_XF86DGAQueryVersion: return SProcXF86DGAQueryVersion(client); case X_XF86DGADirectVideo: return SProcXF86DGADirectVideo(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/security.c0100664000076400007640000014416207120677563021666 0ustar constconst/* $XConsortium: security.c /main/13 1996/12/15 21:24:27 rws $ */ /* Copyright (c) 1996 X Consortium, Inc. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.2 1997/01/27 06:57:17 dawes Exp $ */ #include "dixstruct.h" #include "extnsionst.h" #include "windowstr.h" #include "inputstr.h" #include "gcstruct.h" #include "colormapst.h" #include "propertyst.h" #define _SECURITY_SERVER #include "securstr.h" #include #include #ifdef LBX #define _XLBX_SERVER_ #include "XLbx.h" extern unsigned char LbxReqCode; #endif #ifdef XAPPGROUP #include "Xagsrv.h" #endif #include /* for file reading operations */ #include "Xatom.h" /* for XA_STRING */ #ifndef DEFAULTPOLICYFILE # define DEFAULTPOLICYFILE NULL #endif #ifdef WIN32 #include #undef index #endif static int SecurityErrorBase; /* first Security error number */ static int SecurityEventBase; /* first Security event number */ CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */ RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ static RESTYPE RTEventClient; /* Proc vectors for untrusted clients, swapped and unswapped versions. * These are the same as the normal proc vectors except that extensions * that haven't declared themselves secure will have ProcBadRequest plugged * in for their major opcode dispatcher. This prevents untrusted clients * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ int (*UntrustedProcVector[256])( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); int (*SwappedUntrustedProcVector[256])( #if NeedNestedPrototypes ClientPtr /*client*/ #endif ); extern int ProcBadRequest(); /* SecurityAudit * * Arguments: * format is the formatting string to be used to interpret the * remaining arguments. * * Returns: nothing. * * Side Effects: * Writes the message to the log file if security logging is on. */ void SecurityAudit(char *format, ...) { va_list args; if (auditTrailLevel < SECURITY_AUDIT_LEVEL) return; AuditPrefix(format); va_start(args, format); VErrorF(format, args); va_end(args); } /* SecurityAudit */ #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) /* SecurityDeleteAuthorization * * Arguments: * value is the authorization to delete. * id is its resource ID. * * Returns: Success. * * Side Effects: * Frees everything associated with the authorization. */ static int SecurityDeleteAuthorization(value, id) pointer value; XID id; { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value; unsigned short name_len, data_len; char *name, *data; int status; int i; OtherClientsPtr pEventClient; /* Remove the auth using the os layer auth manager */ status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data); assert(status); status = RemoveAuthorization(name_len, name, data_len, data); assert(status); /* free the auth timer if there is one */ if (pAuth->timer) TimerFree(pAuth->timer); /* send revoke events */ while (pEventClient = pAuth->eventClients) { /* send revocation event event */ ClientPtr client = rClient(pEventClient); if (!client->clientGone) { xSecurityAuthorizationRevokedEvent are; are.type = SecurityEventBase + XSecurityAuthorizationRevoked; are.sequenceNumber = client->sequence; are.authId = pAuth->id; WriteEventsToClient(client, 1, (xEvent *)&are); } FreeResource(pEventClient->resource, RT_NONE); } /* kill all clients using this auth */ for (i = 1; iauthId == pAuth->id)) CloseDownClient(clients[i]); } SecurityAudit("revoked authorization ID %d\n", pAuth->id); xfree(pAuth); return Success; } /* SecurityDeleteAuthorization */ /* resource delete function for RTEventClient */ static int SecurityDeleteAuthorizationEventClient(value, id) pointer value; XID id; { OtherClientsPtr pEventClient, prev = NULL; SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value; for (pEventClient = pAuth->eventClients; pEventClient; pEventClient = pEventClient->next) { if (pEventClient->resource == id) { if (prev) prev->next = pEventClient->next; else pAuth->eventClients = pEventClient->next; xfree(pEventClient); return(Success); } prev = pEventClient; } /*NOTREACHED*/ return -1; /* make compiler happy */ } /* SecurityDeleteAuthorizationEventClient */ /* SecurityComputeAuthorizationTimeout * * Arguments: * pAuth is the authorization for which we are computing the timeout * seconds is the number of seconds we want to wait * * Returns: * the number of milliseconds that the auth timer should be set to * * Side Effects: * Sets pAuth->secondsRemaining to any "overflow" amount of time * that didn't fit in 32 bits worth of milliseconds */ static CARD32 SecurityComputeAuthorizationTimeout(pAuth, seconds) SecurityAuthorizationPtr pAuth; unsigned int seconds; { /* maxSecs is the number of full seconds that can be expressed in * 32 bits worth of milliseconds */ CARD32 maxSecs = (CARD32)(~0) / (CARD32)MILLI_PER_SECOND; if (seconds > maxSecs) { /* only come here if we want to wait more than 49 days */ pAuth->secondsRemaining = seconds - maxSecs; return maxSecs * MILLI_PER_SECOND; } else { /* by far the common case */ pAuth->secondsRemaining = 0; return seconds * MILLI_PER_SECOND; } } /* SecurityStartAuthorizationTimer */ /* SecurityAuthorizationExpired * * This function is passed as an argument to TimerSet and gets called from * the timer manager in the os layer when its time is up. * * Arguments: * timer is the timer for this authorization. * time is the current time. * pval is the authorization whose time is up. * * Returns: * A new time delay in milliseconds if the timer should wait some * more, else zero. * * Side Effects: * Frees the authorization resource if the timeout period is really * over, otherwise recomputes pAuth->secondsRemaining. */ static CARD32 SecurityAuthorizationExpired(timer, time, pval) OsTimerPtr timer; CARD32 time; pointer pval; { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)pval; assert(pAuth->timer == timer); if (pAuth->secondsRemaining) { return SecurityComputeAuthorizationTimeout(pAuth, pAuth->secondsRemaining); } else { FreeResource(pAuth->id, RT_NONE); return 0; } } /* SecurityAuthorizationExpired */ /* SecurityStartAuthorizationTimer * * Arguments: * pAuth is the authorization whose timer should be started. * * Returns: nothing. * * Side Effects: * A timer is started, set to expire after the timeout period for * this authorization. When it expires, the function * SecurityAuthorizationExpired will be called. */ static void SecurityStartAuthorizationTimer(pAuth) SecurityAuthorizationPtr pAuth; { pAuth->timer = TimerSet(pAuth->timer, 0, SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout), SecurityAuthorizationExpired, pAuth); } /* SecurityStartAuthorizationTimer */ /* Proc functions all take a client argument, execute the request in * client->requestBuffer, and return a protocol error status. */ static int ProcSecurityQueryVersion(client) ClientPtr client; { REQUEST(xSecurityQueryVersionReq); xSecurityQueryVersionReply rep; /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.majorVersion = SECURITY_MAJOR_VERSION; rep.minorVersion = SECURITY_MINOR_VERSION; if(client->swapped) { register char n; swaps(&rep.sequenceNumber, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), (char *)&rep); return (client->noClientException); } /* ProcSecurityQueryVersion */ static int SecurityEventSelectForAuthorization(pAuth, client, mask) SecurityAuthorizationPtr pAuth; ClientPtr client; Mask mask; { OtherClients *pEventClient; for (pEventClient = pAuth->eventClients; pEventClient; pEventClient = pEventClient->next) { if (SameClient(pEventClient, client)) { if (mask == 0) FreeResource(pEventClient->resource, RT_NONE); else pEventClient->mask = mask; return Success; } } pEventClient = (OtherClients *) xalloc(sizeof(OtherClients)); if (!pEventClient) return BadAlloc; pEventClient->mask = mask; pEventClient->resource = FakeClientID(client->index); pEventClient->next = pAuth->eventClients; if (!AddResource(pEventClient->resource, RTEventClient, (pointer)pAuth)) { xfree(pEventClient); return BadAlloc; } pAuth->eventClients = pEventClient; return Success; } /* SecurityEventSelectForAuthorization */ static int ProcSecurityGenerateAuthorization(client) ClientPtr client; { REQUEST(xSecurityGenerateAuthorizationReq); int len; /* request length in CARD32s*/ Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */ SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */ int err; /* error to return from this function */ int status; /* return value from os functions */ XID authId; /* authorization ID assigned by os layer */ xSecurityGenerateAuthorizationReply rep; /* reply struct */ unsigned int trustLevel; /* trust level of new auth */ XID group; /* group of new auth */ CARD32 timeout; /* timeout of new auth */ CARD32 *values; /* list of supplied attributes */ char *protoname; /* auth proto name sent in request */ char *protodata; /* auth proto data sent in request */ unsigned int authdata_len; /* # bytes of generated auth data */ char *pAuthdata; /* generated auth data */ Mask eventMask; /* what events on this auth does client want */ /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; /* check request length */ REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq); len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2; len += (stuff->nbytesAuthProto + (unsigned)3) >> 2; len += (stuff->nbytesAuthData + (unsigned)3) >> 2; values = ((CARD32 *)stuff) + len; len += Ones(stuff->valueMask); if (client->req_len != len) return BadLength; /* check valuemask */ if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes) { client->errorValue = stuff->valueMask; return BadValue; } /* check timeout */ timeout = 60; if (stuff->valueMask & XSecurityTimeout) { timeout = *values++; } /* check trustLevel */ trustLevel = XSecurityClientUntrusted; if (stuff->valueMask & XSecurityTrustLevel) { trustLevel = *values++; if (trustLevel != XSecurityClientTrusted && trustLevel != XSecurityClientUntrusted) { client->errorValue = trustLevel; return BadValue; } } /* check group */ group = None; if (stuff->valueMask & XSecurityGroup) { group = *values++; if (SecurityValidateGroupCallback) { SecurityValidateGroupInfoRec vgi; vgi.group = group; vgi.valid = FALSE; CallCallbacks(&SecurityValidateGroupCallback, (pointer)&vgi); /* if nobody said they recognized it, it's an error */ if (!vgi.valid) { client->errorValue = group; return BadValue; } } } /* check event mask */ eventMask = 0; if (stuff->valueMask & XSecurityEventMask) { eventMask = *values++; if (eventMask & ~XSecurityAllEventMasks) { client->errorValue = eventMask; return BadValue; } } protoname = (char *)&stuff[1]; protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2); /* call os layer to generate the authorization */ authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname, stuff->nbytesAuthData, protodata, &authdata_len, &pAuthdata); if ((XID) ~0L == authId) { err = SecurityErrorBase + XSecurityBadAuthorizationProtocol; goto bailout; } /* now that we've added the auth, remember to remove it if we have to * abort the request for some reason (like allocation failure) */ removeAuth = TRUE; /* associate additional information with this auth ID */ pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec)); if (!pAuth) { err = BadAlloc; goto bailout; } /* fill in the auth fields */ pAuth->id = authId; pAuth->timeout = timeout; pAuth->group = group; pAuth->trustLevel = trustLevel; pAuth->refcnt = 0; /* the auth was just created; nobody's using it yet */ pAuth->secondsRemaining = 0; pAuth->timer = NULL; pAuth->eventClients = NULL; /* handle event selection */ if (eventMask) { err = SecurityEventSelectForAuthorization(pAuth, client, eventMask); if (err != Success) goto bailout; } if (!AddResource(authId, SecurityAuthorizationResType, pAuth)) { err = BadAlloc; goto bailout; } /* start the timer ticking */ if (pAuth->timeout != 0) SecurityStartAuthorizationTimer(pAuth); /* tell client the auth id and data */ rep.type = X_Reply; rep.length = (authdata_len + 3) >> 2; rep.sequenceNumber = client->sequence; rep.authId = authId; rep.dataLength = authdata_len; if (client->swapped) { register char n; swapl(&rep.length, n); swaps(&rep.sequenceNumber, n); swapl(&rep.authId, n); swaps(&rep.dataLength, n); } WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), (char *)&rep); WriteToClient(client, authdata_len, pAuthdata); SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n", client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout, pAuth->group, eventMask); /* the request succeeded; don't call RemoveAuthorization or free pAuth */ removeAuth = FALSE; pAuth = NULL; err = client->noClientException; bailout: if (removeAuth) RemoveAuthorization(stuff->nbytesAuthProto, protoname, authdata_len, pAuthdata); if (pAuth) xfree(pAuth); return err; } /* ProcSecurityGenerateAuthorization */ static int ProcSecurityRevokeAuthorization(client) ClientPtr client; { REQUEST(xSecurityRevokeAuthorizationReq); SecurityAuthorizationPtr pAuth; /* paranoia: this "can't happen" because this extension is hidden * from untrusted clients, but just in case... */ if (client->trustLevel != XSecurityClientTrusted) return BadRequest; REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, stuff->authId, SecurityAuthorizationResType, SecurityDestroyAccess); if (!pAuth) return SecurityErrorBase + XSecurityBadAuthorization; FreeResource(stuff->authId, RT_NONE); return Success; } /* ProcSecurityRevokeAuthorization */ static int ProcSecurityDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SecurityQueryVersion: return ProcSecurityQueryVersion(client); case X_SecurityGenerateAuthorization: return ProcSecurityGenerateAuthorization(client); case X_SecurityRevokeAuthorization: return ProcSecurityRevokeAuthorization(client); default: return BadRequest; } } /* ProcSecurityDispatch */ static int SProcSecurityQueryVersion(client) ClientPtr client; { REQUEST(xSecurityQueryVersionReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); swaps(&stuff->majorVersion, n); swaps(&stuff->minorVersion,n); return ProcSecurityQueryVersion(client); } /* SProcSecurityQueryVersion */ static int SProcSecurityGenerateAuthorization(client) ClientPtr client; { REQUEST(xSecurityGenerateAuthorizationReq); register char n; CARD32 *values; unsigned long nvalues; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq); swaps(&stuff->nbytesAuthProto, n); swaps(&stuff->nbytesAuthData, n); swapl(&stuff->valueMask, n); values = (CARD32 *)(&stuff[1]) + ((stuff->nbytesAuthProto + (unsigned)3) >> 2) + ((stuff->nbytesAuthData + (unsigned)3) >> 2); nvalues = (((CARD32 *)stuff) + stuff->length) - values; SwapLongs(values, nvalues); return ProcSecurityGenerateAuthorization(client); } /* SProcSecurityGenerateAuthorization */ static int SProcSecurityRevokeAuthorization(client) ClientPtr client; { REQUEST(xSecurityRevokeAuthorizationReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); swapl(&stuff->authId, n); return ProcSecurityRevokeAuthorization(client); } /* SProcSecurityRevokeAuthorization */ static int SProcSecurityDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SecurityQueryVersion: return SProcSecurityQueryVersion(client); case X_SecurityGenerateAuthorization: return SProcSecurityGenerateAuthorization(client); case X_SecurityRevokeAuthorization: return SProcSecurityRevokeAuthorization(client); default: return BadRequest; } } /* SProcSecurityDispatch */ static void SwapSecurityAuthorizationRevokedEvent(from, to) xSecurityAuthorizationRevokedEvent *from, *to; { to->type = from->type; to->detail = from->detail; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->authId, to->authId); } /* SecurityDetermineEventPropogationLimits * * This is a helper function for SecurityCheckDeviceAccess. * * Arguments: * dev is the device for which the starting and stopping windows for * event propogation should be determined. * The values pointed to by ppWin and ppStopWin are not used. * * Returns: * ppWin is filled in with a pointer to the window at which event * propogation for the given device should start given the current * state of the server (pointer position, window layout, etc.) * ppStopWin is filled in with the window at which event propogation * should stop; events should not go to ppStopWin. * * Side Effects: none. */ static void SecurityDetermineEventPropogationLimits(dev, ppWin, ppStopWin) DeviceIntPtr dev; WindowPtr *ppWin; WindowPtr *ppStopWin; { WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin; if (pFocusWin == NoneWin) { /* no focus -- events don't go anywhere */ *ppWin = *ppStopWin = NULL; return; } if (pFocusWin == PointerRootWin) { /* focus follows the pointer */ *ppWin = GetSpriteWindow(); *ppStopWin = NULL; /* propogate all the way to the root */ } else { /* a real window is set for the focus */ WindowPtr pSpriteWin = GetSpriteWindow(); *ppStopWin = pFocusWin->parent; /* don't go past the focus window */ /* if the pointer is in a subwindow of the focus window, start * at that subwindow, else start at the focus window itself */ if (IsParent(pFocusWin, pSpriteWin)) *ppWin = pSpriteWin; else *ppWin = pFocusWin; } } /* SecurityDetermineEventPropogationLimits */ /* SecurityCheckDeviceAccess * * Arguments: * client is the client attempting to access a device. * dev is the device being accessed. * fromRequest is TRUE if the device access is a direct result of * the client executing some request and FALSE if it is a * result of the server trying to send an event (e.g. KeymapNotify) * to the client. * Returns: * TRUE if the device access should be allowed, else FALSE. * * Side Effects: * An audit message is generated if access is denied. */ Bool SecurityCheckDeviceAccess(client, dev, fromRequest) ClientPtr client; DeviceIntPtr dev; Bool fromRequest; { WindowPtr pWin, pStopWin; Bool untrusted_got_event; Bool found_event_window; Mask eventmask; int reqtype; /* trusted clients always allowed to do anything */ if (client->trustLevel == XSecurityClientTrusted) return TRUE; /* device security other than keyboard is not implemented yet */ if (dev != inputInfo.keyboard) return TRUE; /* some untrusted client wants access */ if (fromRequest) { reqtype = ((xReq *)client->requestBuffer)->reqType; switch (reqtype) { /* never allow these */ case X_ChangeKeyboardMapping: case X_ChangeKeyboardControl: case X_SetModifierMapping: SecurityAudit("client %d attempted request %d\n", client->index, reqtype); return FALSE; default: break; } } untrusted_got_event = FALSE; found_event_window = FALSE; if (dev->grab) { untrusted_got_event = ((rClient(dev->grab))->trustLevel != XSecurityClientTrusted); } else { SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin); eventmask = KeyPressMask | KeyReleaseMask; while ( (pWin != pStopWin) && !found_event_window) { OtherClients *other; if (pWin->eventMask & eventmask) { found_event_window = TRUE; client = wClient(pWin); if (client->trustLevel != XSecurityClientTrusted) { untrusted_got_event = TRUE; } } if (wOtherEventMasks(pWin) & eventmask) { found_event_window = TRUE; for (other = wOtherClients(pWin); other; other = other->next) { if (other->mask & eventmask) { client = rClient(other); if (client->trustLevel != XSecurityClientTrusted) { untrusted_got_event = TRUE; break; } } } } if (wDontPropagateMask(pWin) & eventmask) break; pWin = pWin->parent; } /* while propogating the event */ } /* allow access by untrusted clients only if an event would have gone * to an untrusted client */ if (!untrusted_got_event) { char *devname = dev->name; if (!devname) devname = "unnamed"; if (fromRequest) SecurityAudit("client %d attempted request %d device %d (%s)\n", client->index, reqtype, dev->id, devname); else SecurityAudit("client %d attempted to access device %d (%s)\n", client->index, dev->id, devname); } return untrusted_got_event; } /* SecurityCheckDeviceAccess */ /* SecurityAuditResourceIDAccess * * Arguments: * client is the client doing the resource access. * id is the resource id. * * Returns: NULL * * Side Effects: * An audit message is generated with details of the denied * resource access. */ static pointer SecurityAuditResourceIDAccess(client, id) ClientPtr client; XID id; { int cid = CLIENT_ID(id); int reqtype = ((xReq *)client->requestBuffer)->reqType; switch (reqtype) { case X_ChangeProperty: case X_DeleteProperty: case X_GetProperty: { xChangePropertyReq *req = (xChangePropertyReq *)client->requestBuffer; int propertyatom = req->property; char *propertyname = NameForAtom(propertyatom); SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n", client->index, reqtype, id, propertyname, cid); break; } default: { SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n", client->index, reqtype, id, cid); break; } } return NULL; } /* SecurityAuditResourceIDAccess */ /* SecurityCheckResourceIDAccess * * This function gets plugged into client->CheckAccess and is called from * SecurityLookupIDByType/Class to determine if the client can access the * resource. * * Arguments: * client is the client doing the resource access. * id is the resource id. * rtype is its type or class. * access_mode represents the intended use of the resource; see * resource.h. * rval is a pointer to the resource structure for this resource. * * Returns: * If access is granted, the value of rval that was passed in, else NULL. * * Side Effects: * Disallowed resource accesses are audited. */ static pointer SecurityCheckResourceIDAccess(client, id, rtype, access_mode, rval) ClientPtr client; XID id; RESTYPE rtype; Mask access_mode; pointer rval; { int cid = CLIENT_ID(id); int reqtype = ((xReq *)client->requestBuffer)->reqType; if (SecurityUnknownAccess == access_mode) return rval; /* for compatibility, we have to allow access */ switch (reqtype) { /* these are always allowed */ case X_QueryTree: case X_TranslateCoords: case X_GetGeometry: /* property access is controlled in SecurityCheckPropertyAccess */ case X_GetProperty: case X_ChangeProperty: case X_DeleteProperty: case X_RotateProperties: case X_ListProperties: return rval; default: break; } if (cid != 0) { /* not a server-owned resource */ /* * The following 'if' restricts clients to only access resources at * the same trustLevel. Since there are currently only two trust levels, * and trusted clients never call this function, this degenerates into * saying that untrusted clients can only access resources of other * untrusted clients. One way to add the notion of groups would be to * allow values other than Trusted (0) and Untrusted (1) for this field. * Clients at the same trust level would be able to use each other's * resources, but not those of clients at other trust levels. I haven't * tried it, but this probably mostly works already. The obvious * competing alternative for grouping clients for security purposes is to * use app groups. dpw */ if (client->trustLevel == clients[cid]->trustLevel #ifdef XAPPGROUP || (RT_COLORMAP == rtype && XagDefaultColormap (client) == (Colormap) id) #endif ) return rval; else return SecurityAuditResourceIDAccess(client, id); } else /* server-owned resource - probably a default colormap or root window */ { if (RT_WINDOW == rtype || RC_DRAWABLE == rtype) { switch (reqtype) { /* the following operations are allowed on root windows */ case X_CreatePixmap: case X_CreateGC: case X_CreateWindow: case X_CreateColormap: case X_ListProperties: case X_GrabPointer: case X_UngrabButton: case X_QueryBestSize: case X_GetWindowAttributes: break; case X_SendEvent: { /* see if it is an event specified by the ICCCM */ xSendEventReq *req = (xSendEventReq *) (client->requestBuffer); if (req->propagate == xTrue || (req->eventMask != ColormapChangeMask && req->eventMask != StructureNotifyMask && req->eventMask != (SubstructureRedirectMask|SubstructureNotifyMask) ) || (req->event.u.u.type != UnmapNotify && req->event.u.u.type != ConfigureRequest && req->event.u.u.type != ClientMessage ) ) { /* not an ICCCM event */ return SecurityAuditResourceIDAccess(client, id); } break; } /* case X_SendEvent on root */ case X_ChangeWindowAttributes: { /* Allow selection of PropertyNotify and StructureNotify * events on the root. */ xChangeWindowAttributesReq *req = (xChangeWindowAttributesReq *)(client->requestBuffer); if (req->valueMask == CWEventMask) { CARD32 value = *((CARD32 *)(req + 1)); if ( (value & ~(PropertyChangeMask|StructureNotifyMask)) == 0) break; } return SecurityAuditResourceIDAccess(client, id); } /* case X_ChangeWindowAttributes on root */ default: { #ifdef LBX /* XXX really need per extension dispatching */ if (reqtype == LbxReqCode) { switch (((xReq *)client->requestBuffer)->data) { case X_LbxGetProperty: case X_LbxChangeProperty: return rval; default: break; } } #endif /* others not allowed */ return SecurityAuditResourceIDAccess(client, id); } } } /* end server-owned window or drawable */ else if (SecurityAuthorizationResType == rtype) { SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval; if (pAuth->trustLevel != client->trustLevel) return SecurityAuditResourceIDAccess(client, id); } else if (RT_COLORMAP != rtype) { /* don't allow anything else besides colormaps */ return SecurityAuditResourceIDAccess(client, id); } } return rval; } /* SecurityCheckResourceIDAccess */ /* SecurityClientStateCallback * * Arguments: * pcbl is &ClientStateCallback. * nullata is NULL. * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) * which contains information about client state changes. * * Returns: nothing. * * Side Effects: * * If a new client is connecting, its authorization ID is copied to * client->authID. If this is a generated authorization, its reference * count is bumped, its timer is cancelled if it was running, and its * trustlevel is copied to client->trustLevel. * * If a client is disconnecting and the client was using a generated * authorization, the authorization's reference count is decremented, and * if it is now zero, the timer for this authorization is started. */ static void SecurityClientStateCallback(pcbl, nulldata, calldata) CallbackListPtr *pcbl; pointer nulldata; pointer calldata; { NewClientInfoRec *pci = (NewClientInfoRec *)calldata; ClientPtr client = pci->client; switch (client->clientState) { case ClientStateRunning: { XID authId = AuthorizationIDOfClient(client); SecurityAuthorizationPtr pAuth; client->authId = authId; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, SecurityAuthorizationResType); if (pAuth) { /* it is a generated authorization */ pAuth->refcnt++; if (pAuth->refcnt == 1) { if (pAuth->timer) TimerCancel(pAuth->timer); } client->trustLevel = pAuth->trustLevel; if (client->trustLevel != XSecurityClientTrusted) { client->CheckAccess = SecurityCheckResourceIDAccess; client->requestVector = client->swapped ? SwappedUntrustedProcVector : UntrustedProcVector; } } break; } case ClientStateGone: case ClientStateRetained: /* client disconnected */ { XID authId = client->authId; SecurityAuthorizationPtr pAuth; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, SecurityAuthorizationResType); if (pAuth) { /* it is a generated authorization */ pAuth->refcnt--; if (pAuth->refcnt == 0) { SecurityStartAuthorizationTimer(pAuth); } } break; } default: break; } } /* SecurityClientStateCallback */ #ifdef LBX Bool SecuritySameLevel(client, authId) ClientPtr client; XID authId; { SecurityAuthorizationPtr pAuth; pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, SecurityAuthorizationResType); if (pAuth) return client->trustLevel == pAuth->trustLevel; return client->trustLevel == XSecurityClientTrusted; } #endif /* SecurityCensorImage * * Called after pScreen->GetImage to prevent pieces or trusted windows from * being returned in image data from an untrusted window. * * Arguments: * client is the client doing the GetImage. * pVisibleRegion is the visible region of the window. * widthBytesLine is the width in bytes of one horizontal line in pBuf. * pDraw is the source window. * x, y, w, h is the rectangle of image data from pDraw in pBuf. * format is the format of the image data in pBuf: ZPixmap or XYPixmap. * pBuf is the image data. * * Returns: nothing. * * Side Effects: * Any part of the rectangle (x, y, w, h) that is outside the visible * region of the window will be destroyed (overwritten) in pBuf. */ void SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, format, pBuf) ClientPtr client; RegionPtr pVisibleRegion; long widthBytesLine; DrawablePtr pDraw; int x, y, w, h; unsigned int format; char * pBuf; { RegionRec imageRegion; /* region representing x,y,w,h */ RegionRec censorRegion; /* region to obliterate */ BoxRec imageBox; int nRects; imageBox.x1 = x; imageBox.y1 = y; imageBox.x2 = x + w; imageBox.y2 = y + h; REGION_INIT(pScreen, &imageRegion, &imageBox, 1); REGION_INIT(pScreen, &censorRegion, NullBox, 0); /* censorRegion = imageRegion - visibleRegion */ REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion); nRects = REGION_NUM_RECTS(&censorRegion); if (nRects > 0) { /* we have something to censor */ GCPtr pScratchGC = NULL; PixmapPtr pPix = NULL; xRectangle *pRects = NULL; Bool failed = FALSE; int depth = 1; int bitsPerPixel = 1; int i; BoxPtr pBox; /* convert region to list-of-rectangles for PolyFillRect */ pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *)); if (!pRects) { failed = TRUE; goto failSafe; } for (pBox = REGION_RECTS(&censorRegion), i = 0; i < nRects; i++, pBox++) { pRects[i].x = pBox->x1; pRects[i].y = pBox->y1 - imageBox.y1; pRects[i].width = pBox->x2 - pBox->x1; pRects[i].height = pBox->y2 - pBox->y1; } /* use pBuf as a fake pixmap */ if (format == ZPixmap) { depth = pDraw->depth; bitsPerPixel = pDraw->bitsPerPixel; } pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h, depth, bitsPerPixel, widthBytesLine, (pointer)pBuf); if (!pPix) { failed = TRUE; goto failSafe; } pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen); if (!pScratchGC) { failed = TRUE; goto failSafe; } ValidateGC(&pPix->drawable, pScratchGC); (* pScratchGC->ops->PolyFillRect)(&pPix->drawable, pScratchGC, nRects, pRects); failSafe: if (failed) { /* Censoring was not completed above. To be safe, wipe out * all the image data so that nothing trusted gets out. */ bzero(pBuf, (int)(widthBytesLine * h)); } if (pRects) DEALLOCATE_LOCAL(pRects); if (pScratchGC) FreeScratchGC(pScratchGC); if (pPix) FreeScratchPixmapHeader(pPix); } REGION_UNINIT(pScreen, &imageRegion); REGION_UNINIT(pScreen, &censorRegion); } /* SecurityCensorImage */ /**********************************************************************/ typedef struct _PropertyAccessRec { ATOM name; ATOM mustHaveProperty; char *mustHaveValue; char windowRestriction; #define SecurityAnyWindow 0 #define SecurityRootWindow 1 #define SecurityWindowWithProperty 2 char readAction; char writeAction; char destroyAction; struct _PropertyAccessRec *next; } PropertyAccessRec, *PropertyAccessPtr; static PropertyAccessPtr PropertyAccessList = NULL; static char SecurityDefaultAction = SecurityErrorOperation; static char *SecurityPolicyFile = DEFAULTPOLICYFILE; static ATOM SecurityMaxPropertyName = 0; static char *SecurityKeywords[] = { #define SecurityKeywordComment 0 "#", #define SecurityKeywordProperty 1 "property", #define SecurityKeywordSitePolicy 2 "sitepolicy", #define SecurityKeywordRoot 3 "root", #define SecurityKeywordAny 4 "any" }; #define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *)) #undef PROPDEBUG /*#define PROPDEBUG 1*/ static void SecurityFreePropertyAccessList() { while (PropertyAccessList) { PropertyAccessPtr freeit = PropertyAccessList; PropertyAccessList = PropertyAccessList->next; xfree(freeit); } } /* SecurityFreePropertyAccessList */ #ifndef __EMX__ #define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') ) #else #define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') ) #endif static char * SecuritySkipWhitespace(p) char *p; { while (SecurityIsWhitespace(*p)) p++; return p; } /* SecuritySkipWhitespace */ static char * SecurityParseString(rest) char **rest; { char *startOfString; char *s = *rest; char endChar = 0; s = SecuritySkipWhitespace(s); if (*s == '"' || *s == '\'') { endChar = *s++; startOfString = s; while (*s && (*s != endChar)) s++; } else { startOfString = s; while (*s && !SecurityIsWhitespace(*s)) s++; } if (*s) { *s = '\0'; *rest = s + 1; return startOfString; } else { *rest = s; return (endChar) ? NULL : startOfString; } } /* SecurityParseString */ static int SecurityParseKeyword(p) char **p; { int i; char *s = *p; s = SecuritySkipWhitespace(s); for (i = 0; i < NUMKEYWORDS; i++) { int len = strlen(SecurityKeywords[i]); if (strncmp(s, SecurityKeywords[i], len) == 0) { *p = s + len; return (i); } } *p = s; return -1; } /* SecurityParseKeyword */ static Bool SecurityParsePropertyAccessRule(p) char *p; { char *propname; char c; char action = SecurityDefaultAction; char readAction, writeAction, destroyAction; PropertyAccessPtr pacl, prev, cur; ATOM atom; char *mustHaveProperty = NULL; char *mustHaveValue = NULL; Bool invalid; char windowRestriction; int size; int keyword; /* get property name */ propname = SecurityParseString(&p); if (!propname || (strlen(propname) == 0)) return FALSE; /* get window on which property must reside for rule to apply */ keyword = SecurityParseKeyword(&p); if (keyword == SecurityKeywordRoot) windowRestriction = SecurityRootWindow; else if (keyword == SecurityKeywordAny) windowRestriction = SecurityAnyWindow; else /* not root or any, must be a property name */ { mustHaveProperty = SecurityParseString(&p); if (!mustHaveProperty || (strlen(mustHaveProperty) == 0)) return FALSE; windowRestriction = SecurityWindowWithProperty; p = SecuritySkipWhitespace(p); if (*p == '=') { /* property value is specified too */ p++; /* skip over '=' */ mustHaveValue = SecurityParseString(&p); if (!mustHaveValue) return FALSE; } } /* get operations and actions */ invalid = FALSE; readAction = writeAction = destroyAction = SecurityDefaultAction; while ( (c = *p++) && !invalid) { switch (c) { case 'i': action = SecurityIgnoreOperation; break; case 'a': action = SecurityAllowOperation; break; case 'e': action = SecurityErrorOperation; break; case 'r': readAction = action; break; case 'w': writeAction = action; break; case 'd': destroyAction = action; break; default : if (!SecurityIsWhitespace(c)) invalid = TRUE; break; } } if (invalid) return FALSE; /* We've successfully collected all the information needed for this * property access rule. Now record it in a PropertyAccessRec. */ size = sizeof(PropertyAccessRec); /* If there is a property value string, allocate space for it * right after the PropertyAccessRec. */ if (mustHaveValue) size += strlen(mustHaveValue) + 1; pacl = (PropertyAccessPtr)Xalloc(size); if (!pacl) return FALSE; pacl->name = MakeAtom(propname, strlen(propname), TRUE); if (pacl->name == BAD_RESOURCE) { Xfree(pacl); return FALSE; } if (mustHaveProperty) { pacl->mustHaveProperty = MakeAtom(mustHaveProperty, strlen(mustHaveProperty), TRUE); if (pacl->mustHaveProperty == BAD_RESOURCE) { Xfree(pacl); return FALSE; } } else pacl->mustHaveProperty = 0; if (mustHaveValue) { pacl->mustHaveValue = (char *)(pacl + 1); strcpy(pacl->mustHaveValue, mustHaveValue); } else pacl->mustHaveValue = NULL; SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name); pacl->windowRestriction = windowRestriction; pacl->readAction = readAction; pacl->writeAction = writeAction; pacl->destroyAction = destroyAction; /* link the new rule into the list of rules in order of increasing * property name (atom) value to make searching easier */ for (prev = NULL, cur = PropertyAccessList; cur && cur->name <= pacl->name; prev = cur, cur = cur->next) ; if (!prev) { pacl->next = cur; PropertyAccessList = pacl; } else { prev->next = pacl; pacl->next = cur; } return TRUE; } /* SecurityParsePropertyAccessRule */ static char **SecurityPolicyStrings = NULL; static int nSecurityPolicyStrings = 0; static Bool SecurityParseSitePolicy(p) char *p; { char *policyStr = SecurityParseString(&p); char *copyPolicyStr; char **newStrings; if (!policyStr) return FALSE; copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1); if (!copyPolicyStr) return TRUE; strcpy(copyPolicyStr, policyStr); newStrings = (char **)Xrealloc(SecurityPolicyStrings, sizeof (char *) * (nSecurityPolicyStrings + 1)); if (!newStrings) { Xfree(copyPolicyStr); return TRUE; } SecurityPolicyStrings = newStrings; SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr; } /* SecurityParseSitePolicy */ char ** SecurityGetSitePolicyStrings(n) int *n; { *n = nSecurityPolicyStrings; return SecurityPolicyStrings; } /* SecurityGetSitePolicyStrings */ static void SecurityFreeSitePolicyStrings() { if (SecurityPolicyStrings) { assert(nSecurityPolicyStrings); while (nSecurityPolicyStrings--) { Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]); } Xfree(SecurityPolicyStrings); SecurityPolicyStrings = NULL; nSecurityPolicyStrings = 0; } } /* SecurityFreeSitePolicyStrings */ static void SecurityLoadPropertyAccessList() { FILE *f; int lineNumber = 0; SecurityMaxPropertyName = 0; if (!SecurityPolicyFile) return; #ifndef __EMX__ f = fopen(SecurityPolicyFile, "r"); #else f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r"); #endif if (!f) { ErrorF("error opening security policy file %s\n", SecurityPolicyFile); return; } while (!feof(f)) { char buf[200]; Bool validLine; char *p; if (!(p = fgets(buf, sizeof(buf), f))) break; lineNumber++; /* if first line, check version number */ if (lineNumber == 1) { char *v = SecurityParseString(&p); if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0) { ErrorF("%s: invalid security policy file version, ignoring file\n", SecurityPolicyFile); break; } validLine = TRUE; } else { switch (SecurityParseKeyword(&p)) { case SecurityKeywordComment: validLine = TRUE; break; case SecurityKeywordProperty: validLine = SecurityParsePropertyAccessRule(p); break; case SecurityKeywordSitePolicy: validLine = SecurityParseSitePolicy(p); break; default: validLine = (*p == '\0'); /* blank lines OK, others not */ break; } } if (!validLine) ErrorF("Line %d of %s invalid, ignoring\n", lineNumber, SecurityPolicyFile); } /* end while more input */ #ifdef PROPDEBUG { PropertyAccessPtr pacl; char *op = "aie"; for (pacl = PropertyAccessList; pacl; pacl = pacl->next) { ErrorF("property %s ", NameForAtom(pacl->name)); switch (pacl->windowRestriction) { case SecurityAnyWindow: ErrorF("any "); break; case SecurityRootWindow: ErrorF("root "); break; case SecurityWindowWithProperty: { ErrorF("%s ", NameForAtom(pacl->mustHaveProperty)); if (pacl->mustHaveValue) ErrorF(" = \"%s\" ", pacl->mustHaveValue); } break; } ErrorF("%cr %cw %cd\n", op[pacl->readAction], op[pacl->writeAction], op[pacl->destroyAction]); } } #endif /* PROPDEBUG */ fclose(f); } /* SecurityLoadPropertyAccessList */ static Bool SecurityMatchString(ws, cs) char *ws; char *cs; { while (*ws && *cs) { if (*ws == '*') { Bool match = FALSE; ws++; while (!(match = SecurityMatchString(ws, cs)) && *cs) { cs++; } return match; } else if (*ws == *cs) { ws++; cs++; } else break; } return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') ) && (*cs == '\0') ); } /* SecurityMatchString */ #ifdef PROPDEBUG #include #include #endif char SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode) ClientPtr client; WindowPtr pWin; ATOM propertyName; Mask access_mode; { PropertyAccessPtr pacl; char action = SecurityDefaultAction; /* if client trusted or window untrusted, allow operation */ if ( (client->trustLevel == XSecurityClientTrusted) || (wClient(pWin)->trustLevel != XSecurityClientTrusted) ) return SecurityAllowOperation; #ifdef PROPDEBUG /* For testing, it's more convenient if the property rules file gets * reloaded whenever it changes, so we can rapidly try things without * having to reset the server. */ { struct stat buf; static time_t lastmod = 0; int ret = stat(SecurityPolicyFile , &buf); if ( (ret == 0) && (buf.st_mtime > lastmod) ) { ErrorF("reloading property rules\n"); SecurityFreePropertyAccessList(); SecurityLoadPropertyAccessList(); lastmod = buf.st_mtime; } } #endif /* If the property atom is bigger than any atoms on the list, * we know we won't find it, so don't even bother looking. */ if (propertyName <= SecurityMaxPropertyName) { /* untrusted client operating on trusted window; see if it's allowed */ for (pacl = PropertyAccessList; pacl; pacl = pacl->next) { if (pacl->name < propertyName) continue; if (pacl->name > propertyName) break; /* pacl->name == propertyName, so see if it applies to this window */ switch (pacl->windowRestriction) { case SecurityAnyWindow: /* always applies */ break; case SecurityRootWindow: { /* if not a root window, this rule doesn't apply */ if (pWin->parent) continue; } break; case SecurityWindowWithProperty: { PropertyPtr pProp = wUserProps (pWin); Bool match = FALSE; char *p; char *pEndData; while (pProp) { if (pProp->propertyName == pacl->mustHaveProperty) break; pProp = pProp->next; } if (!pProp) continue; if (!pacl->mustHaveValue) break; if (pProp->type != XA_STRING || pProp->format != 8) continue; p = pProp->data; pEndData = ((char *)pProp->data) + pProp->size; while (!match && p < pEndData) { if (SecurityMatchString(pacl->mustHaveValue, p)) match = TRUE; else { /* skip to the next string */ while (*p++ && p < pEndData) ; } } if (!match) continue; } break; /* end case SecurityWindowWithProperty */ } /* end switch on windowRestriction */ /* If we get here, the property access rule pacl applies. * If pacl doesn't apply, something above should have * executed a continue, which will skip the follwing code. */ action = SecurityAllowOperation; if (access_mode & SecurityReadAccess) action = max(action, pacl->readAction); if (access_mode & SecurityWriteAccess) action = max(action, pacl->writeAction); if (access_mode & SecurityDestroyAccess) action = max(action, pacl->destroyAction); break; } /* end for each pacl */ } /* end if propertyName <= SecurityMaxPropertyName */ if (SecurityAllowOperation != action) { /* audit the access violation */ int cid = CLIENT_ID(pWin->drawable.id); int reqtype = ((xReq *)client->requestBuffer)->reqType; char *actionstr = (SecurityIgnoreOperation == action) ? "ignored" : "error"; SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n", client->index, reqtype, pWin->drawable.id, NameForAtom(propertyName), propertyName, cid, actionstr); } return action; } /* SecurityCheckPropertyAccess */ /* SecurityResetProc * * Arguments: * extEntry is the extension information for the security extension. * * Returns: nothing. * * Side Effects: * Performs any cleanup needed by Security at server shutdown time. */ static void SecurityResetProc(extEntry) ExtensionEntry *extEntry; { SecurityFreePropertyAccessList(); SecurityFreeSitePolicyStrings(); } /* SecurityResetProc */ int XSecurityOptions(argc, argv, i) int argc; char **argv; int i; { if (strcmp(argv[i], "-sp") == 0) { if (i < argc) SecurityPolicyFile = argv[++i]; return (i + 1); } return (i); } /* XSecurityOptions */ /* SecurityExtensionInit * * Arguments: none. * * Returns: nothing. * * Side Effects: * Enables the Security extension if possible. */ void SecurityExtensionInit() { ExtensionEntry *extEntry; int i; SecurityAuthorizationResType = CreateNewResourceType(SecurityDeleteAuthorization); RTEventClient = CreateNewResourceType( SecurityDeleteAuthorizationEventClient); if (!SecurityAuthorizationResType || !RTEventClient) return; RTEventClient |= RC_NEVERRETAIN; if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL)) return; extEntry = AddExtension(SECURITY_EXTENSION_NAME, XSecurityNumberEvents, XSecurityNumberErrors, ProcSecurityDispatch, SProcSecurityDispatch, SecurityResetProc, StandardMinorOpcode); SecurityErrorBase = extEntry->errorBase; SecurityEventBase = extEntry->eventBase; EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = SwapSecurityAuthorizationRevokedEvent; /* initialize untrusted proc vectors */ for (i = 0; i < 128; i++) { UntrustedProcVector[i] = ProcVector[i]; SwappedUntrustedProcVector[i] = SwappedProcVector[i]; } /* make sure insecure extensions are not allowed */ for (i = 128; i < 256; i++) { if (!UntrustedProcVector[i]) { UntrustedProcVector[i] = ProcBadRequest; SwappedUntrustedProcVector[i] = ProcBadRequest; } } SecurityLoadPropertyAccessList(); } /* SecurityExtensionInit */ vnc_unixsrc/Xvnc/programs/Xserver/Xext/xtest1.frags0100664000076400007640000000446607120677563022131 0ustar constconstThere are several code fragments that need to be placed in the device dependent part of the server. These are described below. These code fragments are device and implementation dependent. This code fragment should go in your ddx InitInput() routine: #ifdef XTESTEXT1 extern KeyCode xtest_command_key; #endif #ifdef XTESTEXT1 xtest_command_key = ; #endif This code fragment should go at the front of the file that handles keyboards: #ifdef XTESTEXT1 /* * defined in xtestext1di.c */ extern int on_steal_input; extern Bool XTestStealKeyData(); #endif XTESTEXT1 This code fragment should go in the function that parses input from the keyboard or pointer after you know what input action has occurred, but before you have told the server about it. If conditionalizes the actual function call to pass the information on: #ifdef XTESTEXT1 if (!on_steal_input || XTestStealKeyData(code, direction, dev_type, x, y)) #endif /* XTESTEXT1 */ handle_device_event(...); This code fragment should go in the function that handles mouse motion after you have figured out how much the mouse has moved: #ifdef XTESTEXT1 if (on_steal_input) XTestStealMotionData(dx, dy, dev, x, y); #endif XTESTEXT1 This code fragment should go at the front of the os-specific code where you wait (by doing a select on the socket in our implementation) for something to happen: #ifdef XTESTEXT1 extern int playback_on; void XTestComputeWaitTime(); #endif XTESTEXT1 These code fragments should go in the os-specific code on both sides of where you wait (by doing a select on the socket in our implementation) for something to happen: #ifdef XTESTEXT1 if (playback_on) XTestComputeWaitTime(wt = &waittime); #endif XTESTEXT1 ... code to do select ... WakeupHandler(i, LastSelectMask); #ifdef XTESTEXT1 if (playback_on) i = XTestProcessInputAction(i, &waittime); #endif XTESTEXT1 You also need to implement the following routines (documentation is needed; for now, see server/ddx/hp/hp/x_hil.c): void XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey) int dev_type; int keycode; int keystate; int mousex; int mousey; void XTestGetPointerPos(fmousex, fmousey) short *fmousex, *fmousey; void XTestJumpPointer(jx, jy, dev_type) int jx; int jy; int dev_type; vnc_unixsrc/Xvnc/programs/Xserver/Xext/bigreq.c0100664000076400007640000000550307120677563021263 0ustar constconst/* $XConsortium: bigreq.c /main/5 1996/08/01 19:22:48 dpw $ */ /* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.2 1996/12/23 06:28:58 dawes Exp $ */ /* Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "bigreqstr.h" static unsigned char XBigReqCode; static void BigReqResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static DISPATCH_PROC(ProcBigReqDispatch); void BigReqExtensionInit() { ExtensionEntry *extEntry; if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0, ProcBigReqDispatch, ProcBigReqDispatch, BigReqResetProc, StandardMinorOpcode)) != 0) XBigReqCode = (unsigned char)extEntry->base; DeclareExtensionSecurity(XBigReqExtensionName, TRUE); } /*ARGSUSED*/ static void BigReqResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcBigReqDispatch (client) register ClientPtr client; { REQUEST(xBigReqEnableReq); xBigReqEnableReply rep; register int n; if (client->swapped) { swaps(&stuff->length, n); } if (stuff->brReqType != X_BigReqEnable) return BadRequest; REQUEST_SIZE_MATCH(xBigReqEnableReq); client->big_requests = TRUE; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.max_request_size = MAX_BIG_REQUEST_SIZE; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.max_request_size, n); } WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep); return(client->noClientException); } vnc_unixsrc/Xvnc/programs/Xserver/Xext/sync.c0100664000076400007640000017642307120677563021000 0ustar constconst/* $XConsortium: sync.c /main/13 1996/12/16 16:51:55 rws $ */ /* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.3 1997/01/18 06:53:00 dawes Exp $ */ /* Copyright (c) 1991, 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1991, 1993 by Digital Equipment Corporation, Maynard, Massachusetts, and Olivetti Research Limited, Cambridge, England. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Digital or Olivetti not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Digital and Olivetti make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "Xmd.h" #include "misc.h" #include "os.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #define _SYNC_SERVER #include "sync.h" #include "syncstr.h" /* * Local Global Variables */ static int SyncReqCode; static int SyncEventBase; static int SyncErrorBase; static RESTYPE RTCounter = 0; static RESTYPE RTAwait; static RESTYPE RTAlarm; static RESTYPE RTAlarmClient; static int SyncNumSystemCounters = 0; static SyncCounter **SysCounterList = NULL; #define IsSystemCounter(pCounter) \ (pCounter && (pCounter->client == NULL)) /* these are all the alarm attributes that pertain to the alarm's trigger */ #define XSyncCAAllTrigger \ (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType) static int FreeAlarm( #if NeedFunctionPrototypes pointer /* addr */, XID /* id */ #endif ); static int FreeAlarmClient( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); static int FreeAwait( #if NeedFunctionPrototypes pointer /* addr */, XID /* id */ #endif ); static void ServertimeBracketValues( #if NeedFunctionPrototypes pointer /* pCounter */, CARD64 * /* pbracket_less */, CARD64 * /* pbracket_greater */ #endif ); static void ServertimeQueryValue( #if NeedFunctionPrototypes pointer /* pCounter */, CARD64 * /* pValue_return */ #endif ); static void ServertimeWakeupHandler( #if NeedFunctionPrototypes pointer /* env */, int /* rc */, pointer /* LastSelectMask */ #endif ); static int SyncInitTrigger( #if NeedFunctionPrototypes ClientPtr /* client */, SyncTrigger * /* pTrigger */, XSyncCounter /* counter */, Mask /* changes */ #endif ); static void SAlarmNotifyEvent( #if NeedFunctionPrototypes xSyncAlarmNotifyEvent * /* from */, xSyncAlarmNotifyEvent * /* to */ #endif ); static void SCounterNotifyEvent( #if NeedFunctionPrototypes xSyncCounterNotifyEvent * /* from */, xSyncCounterNotifyEvent * /* to */ #endif ); static void ServertimeBlockHandler( #if NeedFunctionPrototypes pointer /* env */, struct timeval ** /* wt */, pointer /* LastSelectMask */ #endif ); static int SyncAddTriggerToCounter( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */ #endif ); extern void SyncAlarmCounterDestroyed( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */ #endif ); static void SyncAlarmTriggerFired( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */ #endif ); static void SyncAwaitTriggerFired( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */ #endif ); static int SyncChangeAlarmAttributes( #if NeedFunctionPrototypes ClientPtr /* client */, SyncAlarm * /* pAlarm */, Mask /* mask */, CARD32 * /* values */ #endif ); static Bool SyncCheckTriggerNegativeComparison( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */, CARD64 /* oldval */ #endif ); static Bool SyncCheckTriggerNegativeTransition( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */, CARD64 /* oldval */ #endif ); static Bool SyncCheckTriggerPositiveComparison( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */, CARD64 /* oldval */ #endif ); static Bool SyncCheckTriggerPositiveTransition( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */, CARD64 /* oldval */ #endif ); static SyncCounter * SyncCreateCounter( #if NeedFunctionPrototypes ClientPtr /* client */, XSyncCounter /* id */, CARD64 /* initialvalue */ #endif ); static void SyncComputeBracketValues( #if NeedFunctionPrototypes SyncCounter * /* pCounter */, Bool /* startOver */ #endif ); static void SyncDeleteTriggerFromCounter( #if NeedFunctionPrototypes SyncTrigger * /* pTrigger */ #endif ); static Bool SyncEventSelectForAlarm( #if NeedFunctionPrototypes SyncAlarm * /* pAlarm */, ClientPtr /* client */, Bool /* wantevents */ #endif ); static void SyncInitServerTime( #if NeedFunctionPrototypes void #endif ); static void SyncResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static void SyncSendAlarmNotifyEvents( #if NeedFunctionPrototypes SyncAlarm * /* pAlarm */ #endif ); static void SyncSendCounterNotifyEvents( #if NeedFunctionPrototypes ClientPtr /* client */, SyncAwait ** /* ppAwait */, int /* num_events */ #endif ); static DISPATCH_PROC(ProcSyncAwait); static DISPATCH_PROC(ProcSyncChangeAlarm); static DISPATCH_PROC(ProcSyncChangeCounter); static DISPATCH_PROC(ProcSyncCreateAlarm); static DISPATCH_PROC(ProcSyncCreateCounter); static DISPATCH_PROC(ProcSyncDestroyAlarm); static DISPATCH_PROC(ProcSyncDestroyCounter); static DISPATCH_PROC(ProcSyncDispatch); static DISPATCH_PROC(ProcSyncGetPriority); static DISPATCH_PROC(ProcSyncInitialize); static DISPATCH_PROC(ProcSyncListSystemCounters); static DISPATCH_PROC(ProcSyncListSystemCounters); static DISPATCH_PROC(ProcSyncQueryAlarm); static DISPATCH_PROC(ProcSyncQueryCounter); static DISPATCH_PROC(ProcSyncSetCounter); static DISPATCH_PROC(ProcSyncSetPriority); static DISPATCH_PROC(SProcSyncAwait); static DISPATCH_PROC(SProcSyncChangeAlarm); static DISPATCH_PROC(SProcSyncChangeCounter); static DISPATCH_PROC(SProcSyncCreateAlarm); static DISPATCH_PROC(SProcSyncCreateCounter); static DISPATCH_PROC(SProcSyncDestroyAlarm); static DISPATCH_PROC(SProcSyncDestroyCounter); static DISPATCH_PROC(SProcSyncDispatch); static DISPATCH_PROC(SProcSyncDispatch); static DISPATCH_PROC(SProcSyncGetPriority); static DISPATCH_PROC(SProcSyncInitialize); static DISPATCH_PROC(SProcSyncListSystemCounters); static DISPATCH_PROC(SProcSyncQueryAlarm); static DISPATCH_PROC(SProcSyncQueryCounter); static DISPATCH_PROC(SProcSyncSetCounter); static DISPATCH_PROC(SProcSyncSetPriority); /* Each counter maintains a simple linked list of triggers that are * interested in the counter. The two functions below are used to * delete and add triggers on this list. */ static void SyncDeleteTriggerFromCounter(pTrigger) SyncTrigger *pTrigger; { SyncTriggerList *pCur, *pPrev = NULL; /* pCounter needs to be stored in pTrigger before calling here. */ if (!pTrigger->pCounter) return; for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) { if (pCur->pTrigger == pTrigger) { if (pPrev) pPrev->next = pCur->next; else pTrigger->pCounter->pTriglist = pCur->next; xfree(pCur); break; } } if (IsSystemCounter(pTrigger->pCounter)) SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE); } static int SyncAddTriggerToCounter(pTrigger) SyncTrigger *pTrigger; { SyncTriggerList *pCur; if (!pTrigger->pCounter) return Success; /* don't do anything if it's already there */ for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next) { if (pCur->pTrigger == pTrigger) return Success; } if (!(pCur = (SyncTriggerList *)xalloc(sizeof(SyncTriggerList)))) return BadAlloc; pCur->pTrigger = pTrigger; pCur->next = pTrigger->pCounter->pTriglist; pTrigger->pCounter->pTriglist = pCur; if (IsSystemCounter(pTrigger->pCounter)) SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE); return Success; } /* Below are four possible functions that can be plugged into * pTrigger->CheckTrigger, corresponding to the four possible * test-types. These functions are called after the counter's * value changes but are also passed the old counter value * so they can inspect both the old and new values. * (PositiveTransition and NegativeTransition need to see both * pieces of information.) These functions return the truth value * of the trigger. * * All of them include the condition pTrigger->pCounter == NULL. * This is because the spec says that a trigger with a counter value * of None is always TRUE. */ static Bool SyncCheckTriggerPositiveComparison(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || XSyncValueGreaterOrEqual(pTrigger->pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerNegativeComparison(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || XSyncValueLessOrEqual(pTrigger->pCounter->value, pTrigger->test_value)); } static Bool SyncCheckTriggerPositiveTransition(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || (XSyncValueLessThan(oldval, pTrigger->test_value) && XSyncValueGreaterOrEqual(pTrigger->pCounter->value, pTrigger->test_value))); } static Bool SyncCheckTriggerNegativeTransition(pTrigger, oldval) SyncTrigger *pTrigger; CARD64 oldval; { return (pTrigger->pCounter == NULL || (XSyncValueGreaterThan(oldval, pTrigger->test_value) && XSyncValueLessOrEqual(pTrigger->pCounter->value, pTrigger->test_value))); } static int SyncInitTrigger(client, pTrigger, counter, changes) ClientPtr client; /* so we can set errorValue */ SyncTrigger *pTrigger; XSyncCounter counter; Mask changes; { SyncCounter *pCounter = pTrigger->pCounter; int status; Bool newcounter = FALSE; if (changes & XSyncCACounter) { if (counter == None) pCounter = NULL; else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType( client, counter, RTCounter, SecurityReadAccess))) { client->errorValue = counter; return SyncErrorBase + XSyncBadCounter; } if (pCounter != pTrigger->pCounter) { /* new counter for trigger */ SyncDeleteTriggerFromCounter(pTrigger); pTrigger->pCounter = pCounter; newcounter = TRUE; } } /* if system counter, ask it what the current value is */ if (IsSystemCounter(pCounter)) { (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, &pCounter->value); } if (changes & XSyncCAValueType) { if (pTrigger->value_type != XSyncRelative && pTrigger->value_type != XSyncAbsolute) { client->errorValue = pTrigger->value_type; return BadValue; } } if (changes & XSyncCATestType) { if (pTrigger->test_type != XSyncPositiveTransition && pTrigger->test_type != XSyncNegativeTransition && pTrigger->test_type != XSyncPositiveComparison && pTrigger->test_type != XSyncNegativeComparison) { client->errorValue = pTrigger->test_type; return BadValue; } /* select appropriate CheckTrigger function */ switch (pTrigger->test_type) { case XSyncPositiveTransition: pTrigger->CheckTrigger = SyncCheckTriggerPositiveTransition; break; case XSyncNegativeTransition: pTrigger->CheckTrigger = SyncCheckTriggerNegativeTransition; break; case XSyncPositiveComparison: pTrigger->CheckTrigger = SyncCheckTriggerPositiveComparison; break; case XSyncNegativeComparison: pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison; break; } } if (changes & (XSyncCAValueType | XSyncCAValue)) { if (pTrigger->value_type == XSyncAbsolute) pTrigger->test_value = pTrigger->wait_value; else /* relative */ { Bool overflow; if (pCounter == NULL) return BadMatch; XSyncValueAdd(&pTrigger->test_value, pCounter->value, pTrigger->wait_value, &overflow); if (overflow) { client->errorValue = XSyncValueHigh32(pTrigger->wait_value); return BadValue; } } } /* we wait until we're sure there are no errors before registering * a new counter on a trigger */ if (newcounter) { if ((status = SyncAddTriggerToCounter(pTrigger)) != Success) return status; } else if (IsSystemCounter(pCounter)) { SyncComputeBracketValues(pCounter, /*startOver*/ TRUE); } return Success; } /* AlarmNotify events happen in response to actions taken on an Alarm or * the counter used by the alarm. AlarmNotify may be sent to multiple * clients. The alarm maintains a list of clients interested in events. */ static void SyncSendAlarmNotifyEvents(pAlarm) SyncAlarm *pAlarm; { SyncAlarmClientList *pcl; xSyncAlarmNotifyEvent ane; SyncTrigger *pTrigger = &pAlarm->trigger; UpdateCurrentTime(); ane.type = SyncEventBase + XSyncAlarmNotify; ane.kind = XSyncAlarmNotify; ane.sequenceNumber = pAlarm->client->sequence; ane.alarm = pAlarm->alarm_id; if (pTrigger->pCounter) { ane.counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); ane.counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); } else { /* XXX what else can we do if there's no counter? */ ane.counter_value_hi = ane.counter_value_lo = 0; } ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value); ane.alarm_value_lo = XSyncValueLow32(pTrigger->test_value); ane.time = currentTime.milliseconds; ane.state = pAlarm->state; /* send to owner */ if (pAlarm->events && !pAlarm->client->clientGone) WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane); /* send to other interested clients */ for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next) { if (!pAlarm->client->clientGone) { ane.sequenceNumber = pcl->client->sequence; WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); } } } /* CounterNotify events only occur in response to an Await. The events * go only to the Awaiting client. */ static void SyncSendCounterNotifyEvents(client, ppAwait, num_events) ClientPtr client; SyncAwait **ppAwait; int num_events; { xSyncCounterNotifyEvent *pEvents, *pev; int i; if (client->clientGone) return; pev = pEvents = (xSyncCounterNotifyEvent *) ALLOCATE_LOCAL(num_events * sizeof(xSyncCounterNotifyEvent)); if (!pEvents) return; UpdateCurrentTime(); for (i = 0; i < num_events; i++, ppAwait++, pev++) { SyncTrigger *pTrigger = &(*ppAwait)->trigger; pev->type = SyncEventBase + XSyncCounterNotify; pev->kind = XSyncCounterNotify; pev->sequenceNumber = client->sequence; pev->counter = pTrigger->pCounter->id; pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value); pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value); pev->counter_value_lo = XSyncValueLow32(pTrigger->pCounter->value); pev->counter_value_hi = XSyncValueHigh32(pTrigger->pCounter->value); pev->time = currentTime.milliseconds; pev->count = num_events - i - 1; /* events remaining */ pev->destroyed = pTrigger->pCounter->beingDestroyed; } /* swapping will be taken care of by this */ WriteEventsToClient(client, num_events, (xEvent *)pEvents); DEALLOCATE_LOCAL(pEvents); } /* This function is called when an alarm's counter is destroyed. * It is plugged into pTrigger->CounterDestroyed (for alarm triggers). */ void SyncAlarmCounterDestroyed(pTrigger) SyncTrigger *pTrigger; { SyncAlarm *pAlarm = (SyncAlarm *)pTrigger; pAlarm->state = XSyncAlarmInactive; SyncSendAlarmNotifyEvents(pAlarm); pTrigger->pCounter = NULL; } /* This function is called when an alarm "goes off." * It is plugged into pTrigger->TriggerFired (for alarm triggers). */ static void SyncAlarmTriggerFired(pTrigger) SyncTrigger *pTrigger; { SyncAlarm *pAlarm = (SyncAlarm *)pTrigger; CARD64 new_test_value; /* no need to check alarm unless it's active */ if (pAlarm->state != XSyncAlarmActive) return; /* " if the counter value is None, or if the delta is 0 and * the test-type is PositiveComparison or NegativeComparison, * no change is made to value (test-value) and the alarm * state is changed to Inactive before the event is generated." */ if (pAlarm->trigger.pCounter == NULL || (XSyncValueIsZero(pAlarm->delta) && (pAlarm->trigger.test_type == XSyncPositiveComparison || pAlarm->trigger.test_type == XSyncNegativeComparison))) pAlarm->state = XSyncAlarmInactive; new_test_value = pAlarm->trigger.test_value; if (pAlarm->state == XSyncAlarmActive) { Bool overflow; CARD64 oldvalue; SyncTrigger *paTrigger = &pAlarm->trigger; /* "The alarm is updated by repeatedly adding delta to the * value of the trigger and re-initializing it until it * becomes FALSE." */ oldvalue = paTrigger->test_value; /* XXX really should do something smarter here */ do { XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value, pAlarm->delta, &overflow); } while (!overflow && (*paTrigger->CheckTrigger)(paTrigger, paTrigger->pCounter->value)); new_test_value = paTrigger->test_value; paTrigger->test_value = oldvalue; /* "If this update would cause value to fall outside the range * for an INT64...no change is made to value (test-value) and * the alarm state is changed to Inactive before the event is * generated." */ if (overflow) { new_test_value = oldvalue; pAlarm->state = XSyncAlarmInactive; } } /* The AlarmNotify event has to have the "new state of the alarm" * which we can't be sure of until this point. However, it has * to have the "old" trigger test value. That's the reason for * all the newvalue/oldvalue shuffling above. After we send the * events, give the trigger its new test value. */ SyncSendAlarmNotifyEvents(pAlarm); pTrigger->test_value = new_test_value; } /* This function is called when an Await unblocks, either as a result * of the trigger firing OR the counter being destroyed. * It goes into pTrigger->TriggerFired AND pTrigger->CounterDestroyed * (for Await triggers). */ static void SyncAwaitTriggerFired(pTrigger) SyncTrigger *pTrigger; { SyncAwait *pAwait = (SyncAwait *)pTrigger; int numwaits; SyncAwaitUnion *pAwaitUnion; SyncAwait **ppAwait; int num_events = 0; pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader; numwaits = pAwaitUnion->header.num_waitconditions; ppAwait = (SyncAwait **)ALLOCATE_LOCAL(numwaits * sizeof(SyncAwait *)); if (!ppAwait) goto bail; pAwait = &(pAwaitUnion+1)->await; /* "When a client is unblocked, all the CounterNotify events for * the Await request are generated contiguously. If count is 0 * there are no more events to follow for this request. If * count is n, there are at least n more events to follow." * * Thus, it is best to find all the counters for which events * need to be sent first, so that an accurate count field can * be stored in the events. */ for ( ; numwaits; numwaits--, pAwait++) { CARD64 diff; Bool overflow, diffgreater, diffequal; /* "A CounterNotify event with the destroyed flag set to TRUE is * always generated if the counter for one of the triggers is * destroyed." */ if (pAwait->trigger.pCounter->beingDestroyed) { ppAwait[num_events++] = pAwait; continue; } /* "The difference between the counter and the test value is * calculated by subtracting the test value from the value of * the counter." */ XSyncValueSubtract(&diff, pAwait->trigger.pCounter->value, pAwait->trigger.test_value, &overflow); /* "If the difference lies outside the range for an INT64, an * event is not generated." */ if (overflow) continue; diffgreater = XSyncValueGreaterThan(diff, pAwait->event_threshold); diffequal = XSyncValueEqual(diff, pAwait->event_threshold); /* "If the test-type is PositiveTransition or * PositiveComparison, a CounterNotify event is generated if * the difference is at least event-threshold. If the test-type * is NegativeTransition or NegativeComparison, a CounterNotify * event is generated if the difference is at most * event-threshold." */ if ( ((pAwait->trigger.test_type == XSyncPositiveComparison || pAwait->trigger.test_type == XSyncPositiveTransition) && (diffgreater || diffequal)) || ((pAwait->trigger.test_type == XSyncNegativeComparison || pAwait->trigger.test_type == XSyncNegativeTransition) && (!diffgreater) /* less or equal */ ) ) { ppAwait[num_events++] = pAwait; } } if (num_events) SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait, num_events); DEALLOCATE_LOCAL(ppAwait); bail: /* unblock the client */ AttendClient(pAwaitUnion->header.client); /* delete the await */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); } /* This function should always be used to change a counter's value so that * any triggers depending on the counter will be checked. */ void SyncChangeCounter(pCounter, newval) SyncCounter *pCounter; CARD64 newval; { SyncTriggerList *ptl, *pnext; CARD64 oldval; oldval = pCounter->value; pCounter->value = newval; /* run through triggers to see if any become true */ for (ptl = pCounter->pTriglist; ptl; ptl = pnext) { pnext = ptl->next; if ((*ptl->pTrigger->CheckTrigger)(ptl->pTrigger, oldval)) (*ptl->pTrigger->TriggerFired)(ptl->pTrigger); } if (IsSystemCounter(pCounter)) { SyncComputeBracketValues(pCounter, /* startOver */ FALSE); } } /* loosely based on dix/events.c/EventSelectForWindow */ static Bool SyncEventSelectForAlarm(pAlarm, client, wantevents) SyncAlarm *pAlarm; ClientPtr client; Bool wantevents; { SyncAlarmClientList *pClients; if (client == pAlarm->client) /* alarm owner */ { pAlarm->events = wantevents; return Success; } /* see if the client is already on the list (has events selected) */ for (pClients = pAlarm->pEventClients; pClients; pClients = pClients->next) { if (pClients->client == client) { /* client's presence on the list indicates desire for * events. If the client doesn't want events, remove it * from the list. If the client does want events, do * nothing, since it's already got them. */ if (!wantevents) { FreeResource(pClients->delete_id, RT_NONE); } return Success; } } /* if we get here, this client does not currently have * events selected on the alarm */ if (!wantevents) /* client doesn't want events, and we just discovered that it * doesn't have them, so there's nothing to do. */ return Success; /* add new client to pAlarm->pEventClients */ pClients = (SyncAlarmClientList *) xalloc(sizeof(SyncAlarmClientList)); if (!pClients) return BadAlloc; /* register it as a resource so it will be cleaned up * if the client dies */ pClients->delete_id = FakeClientID(client->index); if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) { xfree(pClients); return BadAlloc; } /* link it into list after we know all the allocations succeed */ pClients->next = pAlarm->pEventClients; pAlarm->pEventClients = pClients; pClients->client = client; return Success; } /* * ** SyncChangeAlarmAttributes ** This is used by CreateAlarm and ChangeAlarm */ static int SyncChangeAlarmAttributes(client, pAlarm, mask, values) ClientPtr client; SyncAlarm *pAlarm; Mask mask; CARD32 *values; { int status; XSyncCounter counter; Mask origmask = mask; counter = pAlarm->trigger.pCounter ? pAlarm->trigger.pCounter->id : None; while (mask) { int index2 = lowbit(mask); mask &= ~index2; switch (index2) { case XSyncCACounter: mask &= ~XSyncCACounter; /* sanity check in SyncInitTrigger */ counter = *values++; break; case XSyncCAValueType: mask &= ~XSyncCAValueType; /* sanity check in SyncInitTrigger */ pAlarm->trigger.value_type = *values++; break; case XSyncCAValue: mask &= ~XSyncCAValue; XSyncIntsToValue(&pAlarm->trigger.wait_value, values[1], values[0]); values += 2; break; case XSyncCATestType: mask &= ~XSyncCATestType; /* sanity check in SyncInitTrigger */ pAlarm->trigger.test_type = *values++; break; case XSyncCADelta: mask &= ~XSyncCADelta; XSyncIntsToValue(&pAlarm->delta, values[1], values[0]); values += 2; break; case XSyncCAEvents: mask &= ~XSyncCAEvents; if ((*values != xTrue) && (*values != xFalse)) { client->errorValue = *values; return BadValue; } status = SyncEventSelectForAlarm(pAlarm, client, (Bool)(*values++)); if (status != Success) return status; break; default: client->errorValue = mask; return BadValue; } } /* "If the test-type is PositiveComparison or PositiveTransition * and delta is less than zero, or if the test-type is * NegativeComparison or NegativeTransition and delta is * greater than zero, a Match error is generated." */ if (origmask & (XSyncCADelta|XSyncCATestType)) { CARD64 zero; XSyncIntToValue(&zero, 0); if ((((pAlarm->trigger.test_type == XSyncPositiveComparison) || (pAlarm->trigger.test_type == XSyncPositiveTransition)) && XSyncValueLessThan(pAlarm->delta, zero)) || (((pAlarm->trigger.test_type == XSyncNegativeComparison) || (pAlarm->trigger.test_type == XSyncNegativeTransition)) && XSyncValueGreaterThan(pAlarm->delta, zero)) ) { return BadMatch; } } /* postpone this until now, when we're sure nothing else can go wrong */ if ((status = SyncInitTrigger(client, &pAlarm->trigger, counter, origmask & XSyncCAAllTrigger)) != Success) return status; /* XXX spec does not really say to do this - needs clarification */ pAlarm->state = XSyncAlarmActive; return Success; } static SyncCounter * SyncCreateCounter(client, id, initialvalue) ClientPtr client; XSyncCounter id; CARD64 initialvalue; { SyncCounter *pCounter; if (!(pCounter = (SyncCounter *) xalloc(sizeof(SyncCounter)))) return (SyncCounter *)NULL; if (!AddResource(id, RTCounter, (pointer) pCounter)) { xfree((pointer) pCounter); return (SyncCounter *)NULL; } pCounter->client = client; pCounter->id = id; pCounter->value = initialvalue; pCounter->pTriglist = NULL; pCounter->beingDestroyed = FALSE; pCounter->pSysCounterInfo = NULL; return pCounter; } static int FreeCounter( #if NeedFunctionPrototypes pointer /*env*/, XID /*id*/ #endif ); /* * ***** System Counter utilities */ pointer SyncCreateSystemCounter(name, initial, resolution, counterType, QueryValue, BracketValues) char *name; CARD64 initial; CARD64 resolution; SyncCounterType counterType; void (*QueryValue) (); void (*BracketValues) (); { SyncCounter *pCounter; SysCounterList = (SyncCounter **)xrealloc(SysCounterList, (SyncNumSystemCounters+1)*sizeof(SyncCounter *)); if (!SysCounterList) return (pointer)NULL; /* this function may be called before SYNC has been initialized, so we * have to make sure RTCounter is created. */ if (RTCounter == 0) { RTCounter = CreateNewResourceType(FreeCounter); if (RTCounter == 0) { return (pointer)NULL; } } pCounter = SyncCreateCounter((ClientPtr)NULL, FakeClientID(0), initial); if (pCounter) { SysCounterInfo *psci; psci = (SysCounterInfo *)xalloc(sizeof(SysCounterInfo)); if (!psci) { FreeResource(pCounter->id, RT_NONE); return (pointer) pCounter; } pCounter->pSysCounterInfo = psci; psci->name = name; psci->resolution = resolution; psci->counterType = counterType; psci->QueryValue = QueryValue; psci->BracketValues = BracketValues; XSyncMaxValue(&psci->bracket_greater); XSyncMinValue(&psci->bracket_less); SysCounterList[SyncNumSystemCounters++] = pCounter; } return (pointer) pCounter; } void SyncDestroySystemCounter(pSysCounter) pointer pSysCounter; { SyncCounter *pCounter = (SyncCounter *)pSysCounter; FreeResource(pCounter->id, RT_NONE); } static void SyncComputeBracketValues(pCounter, startOver) SyncCounter *pCounter; Bool startOver; { SyncTriggerList *pCur; SyncTrigger *pTrigger; SysCounterInfo *psci = pCounter->pSysCounterInfo; CARD64 *pnewgtval = NULL; CARD64 *pnewltval = NULL; SyncCounterType ct; if (!pCounter) return; ct = pCounter->pSysCounterInfo->counterType; if (ct == XSyncCounterNeverChanges) return; if (startOver) { XSyncMaxValue(&psci->bracket_greater); XSyncMinValue(&psci->bracket_less); } for (pCur = pCounter->pTriglist; pCur; pCur = pCur->next) { pTrigger = pCur->pTrigger; if (pTrigger->test_type == XSyncPositiveComparison && ct != XSyncCounterNeverIncreases) { if (XSyncValueLessThan(pCounter->value, pTrigger->test_value) && XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) { psci->bracket_greater = pTrigger->test_value; pnewgtval = &psci->bracket_greater; } } else if (pTrigger->test_type == XSyncNegativeComparison && ct != XSyncCounterNeverDecreases) { if (XSyncValueGreaterThan(pCounter->value, pTrigger->test_value) && XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) { psci->bracket_less = pTrigger->test_value; pnewltval = &psci->bracket_less; } } else if ( (pTrigger->test_type == XSyncPositiveTransition && ct != XSyncCounterNeverIncreases) || (pTrigger->test_type == XSyncNegativeTransition && ct != XSyncCounterNeverDecreases) ) { if (XSyncValueLessThan(pCounter->value, pTrigger->test_value)) { if (XSyncValueLessThan(pTrigger->test_value, psci->bracket_greater)) { psci->bracket_greater = pTrigger->test_value; pnewgtval = &psci->bracket_greater; } else if (XSyncValueGreaterThan(pTrigger->test_value, psci->bracket_less)) { psci->bracket_less = pTrigger->test_value; pnewltval = &psci->bracket_less; } } } } /* end for each trigger */ if (pnewgtval || pnewltval) { (*psci->BracketValues)((pointer)pCounter, pnewltval, pnewgtval); } } /* * ***** Resource delete functions */ /* ARGSUSED */ static int FreeAlarm(addr, id) pointer addr; XID id; { SyncAlarm *pAlarm = (SyncAlarm *) addr; pAlarm->state = XSyncAlarmDestroyed; SyncSendAlarmNotifyEvents(pAlarm); /* delete event selections */ while (pAlarm->pEventClients) FreeResource(pAlarm->pEventClients->delete_id, RT_NONE); SyncDeleteTriggerFromCounter(&pAlarm->trigger); xfree(pAlarm); return Success; } /* * ** Cleanup after the destruction of a Counter */ /* ARGSUSED */ static int FreeCounter(env, id) pointer env; XID id; { SyncCounter *pCounter = (SyncCounter *) env; SyncTriggerList *ptl, *pnext; pCounter->beingDestroyed = TRUE; /* tell all the counter's triggers that the counter has been destroyed */ for (ptl = pCounter->pTriglist; ptl; ptl = pnext) { (*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger); pnext = ptl->next; xfree(ptl); /* destroy the trigger list as we go */ } if (IsSystemCounter(pCounter)) { int i, found = 0; xfree(pCounter->pSysCounterInfo); /* find the counter in the list of system counters and remove it */ if (SysCounterList) { for (i = 0; i < SyncNumSystemCounters; i++) { if (SysCounterList[i] == pCounter) { found = i; break; } } if (found < (SyncNumSystemCounters-1)) { for (i = found; i < SyncNumSystemCounters-1; i++) { SysCounterList[i] = SysCounterList[i+1]; } } } SyncNumSystemCounters--; } xfree(pCounter); return Success; } /* * ** Cleanup after Await */ /* ARGSUSED */ static int FreeAwait(addr, id) pointer addr; XID id; { SyncAwaitUnion *pAwaitUnion = (SyncAwaitUnion *) addr; SyncAwait *pAwait; int numwaits; pAwait = &(pAwaitUnion+1)->await; /* first await on list */ /* remove triggers from counters */ for (numwaits = pAwaitUnion->header.num_waitconditions; numwaits; numwaits--, pAwait++) { /* If the counter is being destroyed, FreeCounter will delete * the trigger list itself, so don't do it here. */ SyncCounter *pCounter = pAwait->trigger.pCounter; if (pCounter && !pCounter->beingDestroyed) SyncDeleteTriggerFromCounter(&pAwait->trigger); } xfree(pAwaitUnion); return Success; } /* loosely based on dix/events.c/OtherClientGone */ static int FreeAlarmClient(value, id) pointer value; /* must conform to DeleteType */ XID id; { SyncAlarm *pAlarm = (SyncAlarm *)value; SyncAlarmClientList *pCur, *pPrev; for (pPrev = NULL, pCur = pAlarm->pEventClients; pCur; pPrev = pCur, pCur = pCur->next) { if (pCur->delete_id == id) { if (pPrev) pPrev->next = pCur->next; else pAlarm->pEventClients = pCur->next; xfree(pCur); return(Success); } } FatalError("alarm client not on event list"); /*NOTREACHED*/ } /* * ***** Proc functions */ /* * ** Initialize the extension */ static int ProcSyncInitialize(client) ClientPtr client; { xSyncInitializeReply rep; int n; REQUEST_SIZE_MATCH(xSyncInitializeReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.majorVersion = SYNC_MAJOR_VERSION; rep.minorVersion = SYNC_MINOR_VERSION; rep.length = 0; if (client->swapped) { swaps(&rep.sequenceNumber, n); } WriteToClient(client, sizeof(rep), (char *) &rep); return (client->noClientException); } /* * ** Get list of system counters available through the extension */ static int ProcSyncListSystemCounters(client) ClientPtr client; { xSyncListSystemCountersReply rep; int i, len; xSyncSystemCounter *list, *walklist; REQUEST_SIZE_MATCH(xSyncListSystemCountersReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.nCounters = SyncNumSystemCounters; for (i = len = 0; i < SyncNumSystemCounters; i++) { char *name = SysCounterList[i]->pSysCounterInfo->name; /* pad to 4 byte boundary */ len += (sz_xSyncSystemCounter + strlen(name) + 3) & ~3; } if (len) { walklist = list = (xSyncSystemCounter *) ALLOCATE_LOCAL(len); if (!list) return BadAlloc; } rep.length = len >> 2; if (client->swapped) { register char n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.nCounters, n); } for (i = 0; i < SyncNumSystemCounters; i++) { int namelen; char *pname_in_reply; SysCounterInfo *psci = SysCounterList[i]->pSysCounterInfo; walklist->counter = SysCounterList[i]->id; walklist->resolution_hi = XSyncValueHigh32(psci->resolution); walklist->resolution_lo = XSyncValueLow32(psci->resolution); namelen = strlen(psci->name); walklist->name_length = namelen; if (client->swapped) { register char n; swapl(&walklist->counter, n); swapl(&walklist->resolution_hi, n); swapl(&walklist->resolution_lo, n); swaps(&walklist->name_length, n); } pname_in_reply = ((char *)walklist) + sz_xSyncSystemCounter; strncpy(pname_in_reply, psci->name, namelen); walklist = (xSyncSystemCounter *) (((char *)walklist) + ((sz_xSyncSystemCounter + namelen + 3) & ~3)); } WriteToClient(client, sizeof(rep), (char *) &rep); if (len) { WriteToClient(client, len, (char *) list); DEALLOCATE_LOCAL(list); } return (client->noClientException); } /* * ** Set client Priority */ static int ProcSyncSetPriority(client) ClientPtr client; { REQUEST(xSyncSetPriorityReq); ClientPtr priorityclient; REQUEST_SIZE_MATCH(xSyncSetPriorityReq); if (stuff->id == None) priorityclient = client; else if (!(priorityclient = LookupClient(stuff->id, client))) { client->errorValue = stuff->id; return BadMatch; } if (priorityclient->priority != stuff->priority) { priorityclient->priority = stuff->priority; /* The following will force the server back into WaitForSomething * so that the change in this client's priority is immediately * reflected. */ isItTimeToYield = TRUE; dispatchException |= DE_PRIORITYCHANGE; } return Success; } /* * ** Get client Priority */ static int ProcSyncGetPriority(client) ClientPtr client; { REQUEST(xSyncGetPriorityReq); xSyncGetPriorityReply rep; ClientPtr priorityclient; REQUEST_SIZE_MATCH(xSyncGetPriorityReq); if (stuff->id == None) priorityclient = client; else if (!(priorityclient = LookupClient(stuff->id, client))) { client->errorValue = stuff->id; return BadMatch; } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.priority = priorityclient->priority; if (client->swapped) { register char n; swaps(&rep.sequenceNumber, n); swapl(&rep.priority, n); } WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep); return (client->noClientException); } /* * ** Create a new counter */ static int ProcSyncCreateCounter(client) ClientPtr client; { REQUEST(xSyncCreateCounterReq); CARD64 initial; REQUEST_SIZE_MATCH(xSyncCreateCounterReq); LEGAL_NEW_RESOURCE(stuff->cid, client); XSyncIntsToValue(&initial, stuff->initial_value_lo, stuff->initial_value_hi); if (!SyncCreateCounter(client, stuff->cid, initial)) return BadAlloc; return (client->noClientException); } /* * ** Set Counter value */ static int ProcSyncSetCounter(client) ClientPtr client; { REQUEST(xSyncSetCounterReq); SyncCounter *pCounter; CARD64 newvalue; pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->cid, RTCounter, SecurityWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi); SyncChangeCounter(pCounter, newvalue); return Success; } /* * ** Change Counter value */ static int ProcSyncChangeCounter(client) ClientPtr client; { REQUEST(xSyncChangeCounterReq); SyncCounter *pCounter; CARD64 newvalue; Bool overflow; REQUEST_SIZE_MATCH(xSyncChangeCounterReq); pCounter = (SyncCounter *) SecurityLookupIDByType(client, stuff->cid, RTCounter, SecurityWriteAccess); if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi); XSyncValueAdd(&newvalue, pCounter->value, newvalue, &overflow); if (overflow) { /* XXX 64 bit value can't fit in 32 bits; do the best we can */ client->errorValue = stuff->value_hi; return BadValue; } SyncChangeCounter(pCounter, newvalue); return Success; } /* * ** Destroy a counter */ static int ProcSyncDestroyCounter(client) ClientPtr client; { REQUEST(xSyncDestroyCounterReq); SyncCounter *pCounter; REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, RTCounter, SecurityDestroyAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } if (IsSystemCounter(pCounter)) { client->errorValue = stuff->counter; return BadAccess; } FreeResource(pCounter->id, RT_NONE); return Success; } /* * ** Await */ static int ProcSyncAwait(client) ClientPtr client; { REQUEST(xSyncAwaitReq); int len, items; int i; xSyncWaitCondition *pProtocolWaitConds; SyncAwaitUnion *pAwaitUnion; SyncAwait *pAwait; int status; REQUEST_AT_LEAST_SIZE(xSyncAwaitReq); len = client->req_len << 2; len -= sz_xSyncAwaitReq; items = len / sz_xSyncWaitCondition; if (items * sz_xSyncWaitCondition != len) { return BadLength; } if (items == 0) { client->errorValue = items; /* XXX protocol change */ return BadValue; } pProtocolWaitConds = (xSyncWaitCondition *) & stuff[1]; /* all the memory for the entire await list is allocated * here in one chunk */ pAwaitUnion = (SyncAwaitUnion *)xalloc((items+1) * sizeof(SyncAwaitUnion)); if (!pAwaitUnion) return BadAlloc; /* first item is the header, remainder are real wait conditions */ pAwaitUnion->header.delete_id = FakeClientID(client->index); if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) { xfree(pAwaitUnion); return BadAlloc; } /* don't need to do any more memory allocation for this request! */ pAwaitUnion->header.client = client; pAwaitUnion->header.num_waitconditions = 0; pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pProtocolWaitConds++, pAwait++) { if (pProtocolWaitConds->counter == None) /* XXX protocol change */ { /* this should take care of removing any triggers created by * this request that have already been registered on counters */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); client->errorValue = pProtocolWaitConds->counter; return SyncErrorBase + XSyncBadCounter; } /* sanity checks are in SyncInitTrigger */ pAwait->trigger.pCounter = NULL; pAwait->trigger.value_type = pProtocolWaitConds->value_type; XSyncIntsToValue(&pAwait->trigger.wait_value, pProtocolWaitConds->wait_value_lo, pProtocolWaitConds->wait_value_hi); pAwait->trigger.test_type = pProtocolWaitConds->test_type; status = SyncInitTrigger(client, &pAwait->trigger, pProtocolWaitConds->counter, XSyncCAAllTrigger); if (status != Success) { /* this should take care of removing any triggers created by * this request that have already been registered on counters */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); return status; } /* this is not a mistake -- same function works for both cases */ pAwait->trigger.TriggerFired = SyncAwaitTriggerFired; pAwait->trigger.CounterDestroyed = SyncAwaitTriggerFired; XSyncIntsToValue(&pAwait->event_threshold, pProtocolWaitConds->event_threshold_lo, pProtocolWaitConds->event_threshold_hi); pAwait->pHeader = &pAwaitUnion->header; pAwaitUnion->header.num_waitconditions++; } IgnoreClient(client); /* see if any of the triggers are already true */ pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pAwait++) { /* don't have to worry about NULL counters because the request * errors before we get here out if they occur */ if ((*pAwait->trigger.CheckTrigger)(&pAwait->trigger, pAwait->trigger.pCounter->value)) { (*pAwait->trigger.TriggerFired)(&pAwait->trigger); break; /* once is enough */ } } return Success; } /* * ** Query a counter */ static int ProcSyncQueryCounter(client) ClientPtr client; { REQUEST(xSyncQueryCounterReq); xSyncQueryCounterReply rep; SyncCounter *pCounter; REQUEST_SIZE_MATCH(xSyncQueryCounterReq); pCounter = (SyncCounter *)SecurityLookupIDByType(client, stuff->counter, RTCounter, SecurityReadAccess); if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; /* if system counter, ask it what the current value is */ if (IsSystemCounter(pCounter)) { (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, &pCounter->value); } rep.value_hi = XSyncValueHigh32(pCounter->value); rep.value_lo = XSyncValueLow32(pCounter->value); if (client->swapped) { register char n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.value_hi, n); swapl(&rep.value_lo, n); } WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep); return (client->noClientException); } /* * ** Create Alarm */ static int ProcSyncCreateAlarm(client) ClientPtr client; { REQUEST(xSyncCreateAlarmReq); SyncAlarm *pAlarm; int status; unsigned long len, vmask; SyncTrigger *pTrigger; REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq); LEGAL_NEW_RESOURCE(stuff->id, client); vmask = stuff->valueMask; len = client->req_len - (sizeof(xSyncCreateAlarmReq) >> 2); /* the "extra" call to Ones accounts for the presence of 64 bit values */ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) return BadLength; if (!(pAlarm = (SyncAlarm *) xalloc(sizeof(SyncAlarm)))) { return BadAlloc; } /* set up defaults */ pTrigger = &pAlarm->trigger; pTrigger->pCounter = NULL; pTrigger->value_type = XSyncAbsolute; XSyncIntToValue(&pTrigger->wait_value, 0L); pTrigger->test_type = XSyncPositiveComparison; pTrigger->TriggerFired = SyncAlarmTriggerFired; pTrigger->CounterDestroyed = SyncAlarmCounterDestroyed; status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger); if (status != Success) { xfree(pAlarm); return status; } pAlarm->client = client; pAlarm->alarm_id = stuff->id; XSyncIntToValue(&pAlarm->delta, 1L); pAlarm->events = TRUE; pAlarm->state = XSyncAlarmInactive; pAlarm->pEventClients = NULL; status = SyncChangeAlarmAttributes(client, pAlarm, vmask, (CARD32 *)&stuff[1]); if (status != Success) { xfree(pAlarm); return status; } if (!AddResource(stuff->id, RTAlarm, pAlarm)) { xfree(pAlarm); return BadAlloc; } /* see if alarm already triggered. NULL counter will not trigger * in CreateAlarm and sets alarm state to Inactive. */ if (!pTrigger->pCounter) { pAlarm->state = XSyncAlarmInactive; /* XXX protocol change */ } else if ((*pTrigger->CheckTrigger)(pTrigger, pTrigger->pCounter->value)) { (*pTrigger->TriggerFired)(pTrigger); } return Success; } /* * ** Change Alarm */ static int ProcSyncChangeAlarm(client) ClientPtr client; { REQUEST(xSyncChangeAlarmReq); SyncAlarm *pAlarm; long vmask; int len, status; REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, SecurityWriteAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } vmask = stuff->valueMask; len = client->req_len - (sizeof(xSyncChangeAlarmReq) >> 2); /* the "extra" call to Ones accounts for the presence of 64 bit values */ if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta)))) return BadLength; if ((status = SyncChangeAlarmAttributes(client, pAlarm, vmask, (CARD32 *)&stuff[1])) != Success) return status; /* see if alarm already triggered. NULL counter WILL trigger * in ChangeAlarm. */ if (!pAlarm->trigger.pCounter || (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, pAlarm->trigger.pCounter->value)) { (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger); } return Success; } static int ProcSyncQueryAlarm(client) ClientPtr client; { REQUEST(xSyncQueryAlarmReq); SyncAlarm *pAlarm; xSyncQueryAlarmReply rep; SyncTrigger *pTrigger; REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, SecurityReadAccess); if (!pAlarm) { client->errorValue = stuff->alarm; return (SyncErrorBase + XSyncBadAlarm); } rep.type = X_Reply; rep.length = (sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)) >> 2; rep.sequenceNumber = client->sequence; pTrigger = &pAlarm->trigger; rep.counter = (pTrigger->pCounter) ? pTrigger->pCounter->id : None; #if 0 /* XXX unclear what to do, depends on whether relative value-types * are "consumed" immediately and are considered absolute from then * on. */ rep.value_type = pTrigger->value_type; rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value); rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value); #else rep.value_type = XSyncAbsolute; rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value); rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value); #endif rep.test_type = pTrigger->test_type; rep.delta_hi = XSyncValueHigh32(pAlarm->delta); rep.delta_lo = XSyncValueLow32(pAlarm->delta); rep.events = pAlarm->events; rep.state = pAlarm->state; if (client->swapped) { register char n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.counter, n); swapl(&rep.wait_value_hi, n); swapl(&rep.wait_value_lo, n); swapl(&rep.test_type, n); swapl(&rep.delta_hi, n); swapl(&rep.delta_lo, n); } WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep); return (client->noClientException); } static int ProcSyncDestroyAlarm(client) ClientPtr client; { SyncAlarm *pAlarm; REQUEST(xSyncDestroyAlarmReq); REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); if (!(pAlarm = (SyncAlarm *)SecurityLookupIDByType(client, stuff->alarm, RTAlarm, SecurityDestroyAccess))) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } FreeResource(stuff->alarm, RT_NONE); return (client->noClientException); } /* * ** Given an extension request, call the appropriate request procedure */ static int ProcSyncDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SyncInitialize: return ProcSyncInitialize(client); case X_SyncListSystemCounters: return ProcSyncListSystemCounters(client); case X_SyncCreateCounter: return ProcSyncCreateCounter(client); case X_SyncSetCounter: return ProcSyncSetCounter(client); case X_SyncChangeCounter: return ProcSyncChangeCounter(client); case X_SyncQueryCounter: return ProcSyncQueryCounter(client); case X_SyncDestroyCounter: return ProcSyncDestroyCounter(client); case X_SyncAwait: return ProcSyncAwait(client); case X_SyncCreateAlarm: return ProcSyncCreateAlarm(client); case X_SyncChangeAlarm: return ProcSyncChangeAlarm(client); case X_SyncQueryAlarm: return ProcSyncQueryAlarm(client); case X_SyncDestroyAlarm: return ProcSyncDestroyAlarm(client); case X_SyncSetPriority: return ProcSyncSetPriority(client); case X_SyncGetPriority: return ProcSyncGetPriority(client); default: return BadRequest; } } /* * Boring Swapping stuff ... */ static int SProcSyncInitialize(client) ClientPtr client; { REQUEST(xSyncInitializeReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncInitializeReq); return ProcSyncInitialize(client); } static int SProcSyncListSystemCounters(client) ClientPtr client; { REQUEST(xSyncListSystemCountersReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncListSystemCountersReq); return ProcSyncListSystemCounters(client); } static int SProcSyncCreateCounter(client) ClientPtr client; { REQUEST(xSyncCreateCounterReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncCreateCounterReq); swapl(&stuff->cid, n); swapl(&stuff->initial_value_lo, n); swapl(&stuff->initial_value_hi, n); return ProcSyncCreateCounter(client); } static int SProcSyncSetCounter(client) ClientPtr client; { REQUEST(xSyncSetCounterReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncSetCounterReq); swapl(&stuff->cid, n); swapl(&stuff->value_lo, n); swapl(&stuff->value_hi, n); return ProcSyncSetCounter(client); } static int SProcSyncChangeCounter(client) ClientPtr client; { REQUEST(xSyncChangeCounterReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncChangeCounterReq); swapl(&stuff->cid, n); swapl(&stuff->value_lo, n); swapl(&stuff->value_hi, n); return ProcSyncChangeCounter(client); } static int SProcSyncQueryCounter(client) ClientPtr client; { REQUEST(xSyncQueryCounterReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncQueryCounterReq); swapl(&stuff->counter, n); return ProcSyncQueryCounter(client); } static int SProcSyncDestroyCounter(client) ClientPtr client; { REQUEST(xSyncDestroyCounterReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncDestroyCounterReq); swapl(&stuff->counter, n); return ProcSyncDestroyCounter(client); } static int SProcSyncAwait(client) ClientPtr client; { REQUEST(xSyncAwaitReq); register char n; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSyncAwaitReq); SwapRestL(stuff); return ProcSyncAwait(client); } static int SProcSyncCreateAlarm(client) ClientPtr client; { REQUEST(xSyncCreateAlarmReq); register char n; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq); swapl(&stuff->id, n); swapl(&stuff->valueMask, n); SwapRestL(stuff); return ProcSyncCreateAlarm(client); } static int SProcSyncChangeAlarm(client) ClientPtr client; { REQUEST(xSyncChangeAlarmReq); register char n; swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); swapl(&stuff->alarm, n); swapl(&stuff->valueMask, n); SwapRestL(stuff); return ProcSyncChangeAlarm(client); } static int SProcSyncQueryAlarm(client) ClientPtr client; { REQUEST(xSyncQueryAlarmReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncQueryAlarmReq); swapl(&stuff->alarm, n); return ProcSyncQueryAlarm(client); } static int SProcSyncDestroyAlarm(client) ClientPtr client; { REQUEST(xSyncDestroyAlarmReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncDestroyAlarmReq); swapl(&stuff->alarm, n); return ProcSyncDestroyAlarm(client); } static int SProcSyncSetPriority(client) ClientPtr client; { REQUEST(xSyncSetPriorityReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncSetPriorityReq); swapl(&stuff->id, n); swapl(&stuff->priority, n); return ProcSyncSetPriority(client); } static int SProcSyncGetPriority(client) ClientPtr client; { REQUEST(xSyncGetPriorityReq); register char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xSyncGetPriorityReq); swapl(&stuff->id, n); return ProcSyncGetPriority(client); } static int SProcSyncDispatch(client) ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_SyncInitialize: return SProcSyncInitialize(client); case X_SyncListSystemCounters: return SProcSyncListSystemCounters(client); case X_SyncCreateCounter: return SProcSyncCreateCounter(client); case X_SyncSetCounter: return SProcSyncSetCounter(client); case X_SyncChangeCounter: return SProcSyncChangeCounter(client); case X_SyncQueryCounter: return SProcSyncQueryCounter(client); case X_SyncDestroyCounter: return SProcSyncDestroyCounter(client); case X_SyncAwait: return SProcSyncAwait(client); case X_SyncCreateAlarm: return SProcSyncCreateAlarm(client); case X_SyncChangeAlarm: return SProcSyncChangeAlarm(client); case X_SyncQueryAlarm: return SProcSyncQueryAlarm(client); case X_SyncDestroyAlarm: return SProcSyncDestroyAlarm(client); case X_SyncSetPriority: return SProcSyncSetPriority(client); case X_SyncGetPriority: return SProcSyncGetPriority(client); default: return BadRequest; } } /* * Event Swapping */ static void SCounterNotifyEvent(from, to) xSyncCounterNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->counter, to->counter); cpswapl(from->wait_value_lo, to->wait_value_lo); cpswapl(from->wait_value_hi, to->wait_value_hi); cpswapl(from->counter_value_lo, to->counter_value_lo); cpswapl(from->counter_value_hi, to->counter_value_hi); cpswapl(from->time, to->time); cpswaps(from->count, to->count); to->destroyed = from->destroyed; } static void SAlarmNotifyEvent(from, to) xSyncAlarmNotifyEvent *from, *to; { to->type = from->type; to->kind = from->kind; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->alarm, to->alarm); cpswapl(from->counter_value_lo, to->counter_value_lo); cpswapl(from->counter_value_hi, to->counter_value_hi); cpswapl(from->alarm_value_lo, to->alarm_value_lo); cpswapl(from->alarm_value_hi, to->alarm_value_hi); cpswapl(from->time, to->time); to->state = from->state; } /* * ** Close everything down. ** This is fairly simple for now. */ /* ARGSUSED */ static void SyncResetProc(extEntry) ExtensionEntry *extEntry; { xfree(SysCounterList); SysCounterList = NULL; RTCounter = 0; } /* * ** Initialise the extension. */ void SyncExtensionInit() { ExtensionEntry *extEntry; if (RTCounter == 0) { RTCounter = CreateNewResourceType(FreeCounter); } RTAlarm = CreateNewResourceType(FreeAlarm); RTAwait = CreateNewResourceType(FreeAwait)|RC_NEVERRETAIN; RTAlarmClient = CreateNewResourceType(FreeAlarmClient)|RC_NEVERRETAIN; if (RTCounter == 0 || RTAwait == 0 || RTAlarm == 0 || RTAlarmClient == 0 || (extEntry = AddExtension(SYNC_NAME, XSyncNumberEvents, XSyncNumberErrors, ProcSyncDispatch, SProcSyncDispatch, SyncResetProc, StandardMinorOpcode)) == NULL) { ErrorF("Sync Extension %d.%d failed to Initialise\n", SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION); return; } SyncReqCode = extEntry->base; SyncEventBase = extEntry->eventBase; SyncErrorBase = extEntry->errorBase; EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent; /* * Although SERVERTIME is implemented by the OS layer, we initialise it * here because doing it in OsInit() is too early. The resource database * is not initialised when OsInit() is called. This is just about OK * because there is always a servertime counter. */ SyncInitServerTime(); #ifdef DEBUG fprintf(stderr, "Sync Extension %d.%d\n", SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION); #endif } /* * ***** SERVERTIME implementation - should go in its own file in OS directory? */ #if !defined(WIN32) && !defined(MINIX) && !defined(Lynx) #include #endif static pointer ServertimeCounter; static XSyncValue Now; static XSyncValue *pnext_time; #define GetTime()\ {\ unsigned long millis = GetTimeInMillis();\ unsigned long maxis = XSyncValueHigh32(Now);\ if (millis < XSyncValueLow32(Now)) maxis++;\ XSyncIntsToValue(&Now, millis, maxis);\ } /* *** Server Block Handler *** code inspired by multibuffer extension */ /*ARGSUSED*/ static void ServertimeBlockHandler(env, wt, LastSelectMask) pointer env; struct timeval **wt; pointer LastSelectMask; { XSyncValue delay; unsigned long timeout; if (pnext_time) { GetTime(); if (XSyncValueGreaterOrEqual(Now, *pnext_time)) { timeout = 0; } else { Bool overflow; XSyncValueSubtract(&delay, *pnext_time, Now, &overflow); timeout = XSyncValueLow32(delay); } AdjustWaitForDelay(wt, timeout); /* os/utils.c */ } } /* *** Wakeup Handler */ /*ARGSUSED*/ static void ServertimeWakeupHandler(env, rc, LastSelectMask) pointer env; int rc; pointer LastSelectMask; { if (pnext_time) { GetTime(); if (XSyncValueGreaterOrEqual(Now, *pnext_time)) { SyncChangeCounter(ServertimeCounter, Now); } } } static void ServertimeQueryValue(pCounter, pValue_return) pointer pCounter; CARD64 *pValue_return; { GetTime(); *pValue_return = Now; } static void ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater) pointer pCounter; CARD64 *pbracket_less; CARD64 *pbracket_greater; { if (!pnext_time && pbracket_greater) { RegisterBlockAndWakeupHandlers(ServertimeBlockHandler, ServertimeWakeupHandler, NULL); } else if (pnext_time && !pbracket_greater) { RemoveBlockAndWakeupHandlers(ServertimeBlockHandler, ServertimeWakeupHandler, NULL); } pnext_time = pbracket_greater; } static void SyncInitServerTime() { CARD64 resolution; XSyncIntsToValue(&Now, GetTimeInMillis(), 0); XSyncIntToValue(&resolution, 4); ServertimeCounter = SyncCreateSystemCounter("SERVERTIME", Now, resolution, XSyncCounterNeverDecreases, ServertimeQueryValue, ServertimeBracketValues); pnext_time = NULL; } vnc_unixsrc/Xvnc/programs/Xserver/Xext/saver.c0100664000076400007640000007645107120677563021144 0ustar constconst/* * $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $ * $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.2 1996/06/10 09:11:17 dawes Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #include "saverproto.h" #include "gcstruct.h" #include "cursorstr.h" #include "colormapst.h" static unsigned char ScreenSaverReqCode = 0; static int ScreenSaverEventBase = 0; extern DISPATCH_PROC(ProcScreenSaverQueryInfo); static DISPATCH_PROC(ProcScreenSaverDispatch); static DISPATCH_PROC(ProcScreenSaverQueryVersion); static DISPATCH_PROC(ProcScreenSaverSelectInput); static DISPATCH_PROC(ProcScreenSaverSetAttributes); static DISPATCH_PROC(ProcScreenSaverUnsetAttributes); static DISPATCH_PROC(SProcScreenSaverDispatch); static DISPATCH_PROC(SProcScreenSaverQueryInfo); static DISPATCH_PROC(SProcScreenSaverQueryVersion); static DISPATCH_PROC(SProcScreenSaverSelectInput); static DISPATCH_PROC(SProcScreenSaverSetAttributes); static DISPATCH_PROC(SProcScreenSaverUnsetAttributes); static Bool ScreenSaverHandle ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* xstate */, Bool /* force */ #endif ); static Bool CreateSaverWindow ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */ #endif ); static Bool DestroySaverWindow ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */ #endif ); static void UninstallSaverColormap ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */ #endif ); static void CheckScreenPrivate ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */ #endif ); static void SScreenSaverNotifyEvent ( #if NeedFunctionPrototypes xScreenSaverNotifyEvent * /* from */, xScreenSaverNotifyEvent * /* to */ #endif ); static void ScreenSaverResetProc ( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); extern WindowPtr *WindowTable; /* * each screen has a list of clients requesting * ScreenSaverNotify events. Each client has a resource * for each screen it selects ScreenSaverNotify input for, * this resource is used to delete the ScreenSaverNotifyRec * entry from the per-screen queue. */ static RESTYPE EventType; /* resource type for event masks */ typedef struct _ScreenSaverEvent *ScreenSaverEventPtr; typedef struct _ScreenSaverEvent { ScreenSaverEventPtr next; ClientPtr client; ScreenPtr screen; XID resource; CARD32 mask; } ScreenSaverEventRec; static int ScreenSaverFreeEvents( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); static Bool setEventMask ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, ClientPtr /* client */, unsigned long /* mask */ #endif ); static unsigned long getEventMask ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, ClientPtr /* client */ #endif ); /* * when a client sets the screen saver attributes, a resource is * kept to be freed when the client exits */ static RESTYPE AttrType; /* resource type for attributes */ typedef struct _ScreenSaverAttr { ScreenPtr screen; ClientPtr client; XID resource; short x, y; unsigned short width, height, borderWidth; unsigned char class; unsigned char depth; VisualID visual; CursorPtr pCursor; PixmapPtr pBackgroundPixmap; PixmapPtr pBorderPixmap; Colormap colormap; unsigned long mask; /* no pixmaps or cursors */ unsigned long *values; } ScreenSaverAttrRec, *ScreenSaverAttrPtr; static int ScreenSaverFreeAttr ( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); static void FreeAttrs ( #if NeedFunctionPrototypes ScreenSaverAttrPtr /* pAttr */ #endif ); static void FreeScreenAttr ( #if NeedFunctionPrototypes ScreenSaverAttrPtr /* pAttr */ #endif ); static void SendScreenSaverNotify ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, int /* state */, Bool /* forced */ #endif ); typedef struct _ScreenSaverScreenPrivate { ScreenSaverEventPtr events; ScreenSaverAttrPtr attr; Bool hasWindow; Colormap installedMap; } ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr; static ScreenSaverScreenPrivatePtr MakeScreenPrivate ( #if NeedFunctionPrototypes ScreenPtr /* pScreen */ #endif ); static int ScreenPrivateIndex; #define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) #define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s) #define New(t) ((t *) xalloc (sizeof (t))) /**************** * ScreenSaverExtensionInit * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * ****************/ void ScreenSaverExtensionInit() { ExtensionEntry *extEntry; int i; ScreenPtr pScreen; AttrType = CreateNewResourceType(ScreenSaverFreeAttr); EventType = CreateNewResourceType(ScreenSaverFreeEvents); ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } if (AttrType && EventType && ScreenPrivateIndex != -1 && (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, ProcScreenSaverDispatch, SProcScreenSaverDispatch, ScreenSaverResetProc, StandardMinorOpcode))) { ScreenSaverReqCode = (unsigned char)extEntry->base; ScreenSaverEventBase = extEntry->eventBase; EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; } } /*ARGSUSED*/ static void ScreenSaverResetProc (extEntry) ExtensionEntry *extEntry; { } static void CheckScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (!pPriv) return; if (!pPriv->attr && !pPriv->events && !pPriv->hasWindow && pPriv->installedMap == None) { xfree (pPriv); SetScreenPrivate (pScreen, NULL); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; } } static ScreenSaverScreenPrivatePtr MakeScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (pPriv) return pPriv; pPriv = New (ScreenSaverScreenPrivateRec); if (!pPriv) return 0; pPriv->events = 0; pPriv->attr = 0; pPriv->hasWindow = FALSE; pPriv->installedMap = None; SetScreenPrivate (pScreen, pPriv); savedScreenInfo[pScreen->myNum].ExternalScreenSaver = ScreenSaverHandle; return pPriv; } static unsigned long getEventMask (pScreen, client) ScreenPtr pScreen; ClientPtr client; { SetupScreen(pScreen); ScreenSaverEventPtr pEv; if (!pPriv) return 0; for (pEv = pPriv->events; pEv; pEv = pEv->next) if (pEv->client == client) return pEv->mask; return 0; } static Bool setEventMask (pScreen, client, mask) ScreenPtr pScreen; ClientPtr client; unsigned long mask; { SetupScreen(pScreen); ScreenSaverEventPtr pEv, *pPrev; if (getEventMask (pScreen, client) == mask) return TRUE; if (!pPriv) { pPriv = MakeScreenPrivate (pScreen); if (!pPriv) return FALSE; } for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next) if (pEv->client == client) break; if (mask == 0) { FreeResource (pEv->resource, EventType); *pPrev = pEv->next; xfree (pEv); CheckScreenPrivate (pScreen); } else { if (!pEv) { pEv = New (ScreenSaverEventRec); if (!pEv) { CheckScreenPrivate (pScreen); return FALSE; } *pPrev = pEv; pEv->next = NULL; pEv->client = client; pEv->screen = pScreen; pEv->resource = FakeClientID (client->index); if (!AddResource (pEv->resource, EventType, (pointer) pEv)) return FALSE; } pEv->mask = mask; } return TRUE; } static void FreeAttrs (pAttr) ScreenSaverAttrPtr pAttr; { PixmapPtr pPixmap; CursorPtr pCursor; if ((pPixmap = pAttr->pBackgroundPixmap) != 0) (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); if ((pPixmap = pAttr->pBorderPixmap) != 0) (*pPixmap->drawable.pScreen->DestroyPixmap)(pPixmap); if ((pCursor = pAttr->pCursor) != 0) FreeCursor (pCursor, (Cursor) 0); } static void FreeScreenAttr (pAttr) ScreenSaverAttrPtr pAttr; { FreeAttrs (pAttr); xfree (pAttr->values); xfree (pAttr); } static int ScreenSaverFreeEvents (value, id) pointer value; XID id; { ScreenSaverEventPtr pOld = (ScreenSaverEventPtr)value; ScreenPtr pScreen = pOld->screen; SetupScreen (pScreen); ScreenSaverEventPtr pEv, *pPrev; if (!pPriv) return TRUE; for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next) if (pEv == pOld) break; if (!pEv) return TRUE; *pPrev = pEv->next; xfree (pEv); CheckScreenPrivate (pScreen); return TRUE; } static int ScreenSaverFreeAttr (value, id) pointer value; XID id; { ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr)value; ScreenPtr pScreen = pOldAttr->screen; SetupScreen (pScreen); if (!pPriv) return TRUE; if (pPriv->attr != pOldAttr) return TRUE; FreeScreenAttr (pOldAttr); pPriv->attr = NULL; if (pPriv->hasWindow) { SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset); SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive); } CheckScreenPrivate (pScreen); return TRUE; } static void SendScreenSaverNotify (pScreen, state, forced) ScreenPtr pScreen; int state; Bool forced; { ScreenSaverScreenPrivatePtr pPriv; ScreenSaverEventPtr pEv; unsigned long mask; xScreenSaverNotifyEvent ev; ClientPtr client; int kind; ScreenSaverStuffPtr pSaver; UpdateCurrentTimeIf (); mask = ScreenSaverNotifyMask; if (state == ScreenSaverCycle) mask = ScreenSaverCycleMask; pScreen = screenInfo.screens[pScreen->myNum]; pPriv = GetScreenPrivate(pScreen); if (!pPriv) return; pSaver = &savedScreenInfo[pScreen->myNum]; if (pPriv->attr) kind = ScreenSaverExternal; else if (ScreenSaverBlanking != DontPreferBlanking) kind = ScreenSaverBlanked; else kind = ScreenSaverInternal; for (pEv = pPriv->events; pEv; pEv = pEv->next) { client = pEv->client; if (client->clientGone) continue; if (!(pEv->mask & mask)) continue; ev.type = ScreenSaverNotify + ScreenSaverEventBase; ev.state = state; ev.sequenceNumber = client->sequence; ev.timestamp = currentTime.milliseconds; ev.root = WindowTable[pScreen->myNum]->drawable.id; ev.window = savedScreenInfo[pScreen->myNum].wid; ev.kind = kind; ev.forced = forced; WriteEventsToClient (client, 1, (xEvent *) &ev); } } static void SScreenSaverNotifyEvent (from, to) xScreenSaverNotifyEvent *from, *to; { to->type = from->type; to->state = from->state; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->timestamp, to->timestamp); cpswapl (from->root, to->root); cpswapl (from->window, to->window); to->kind = from->kind; to->forced = from->forced; } static void UninstallSaverColormap (pScreen) ScreenPtr pScreen; { SetupScreen(pScreen); ColormapPtr pCmap; if (pPriv && pPriv->installedMap != None) { pCmap = (ColormapPtr) LookupIDByType (pPriv->installedMap, RT_COLORMAP); if (pCmap) (*pCmap->pScreen->UninstallColormap) (pCmap); pPriv->installedMap = None; CheckScreenPrivate (pScreen); } } static Bool CreateSaverWindow (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); ScreenSaverStuffPtr pSaver; ScreenSaverAttrPtr pAttr; WindowPtr pWin; int result; unsigned long mask; extern int GrabInProgress; Colormap *installedMaps; int numInstalled; int i; Colormap wantMap; ColormapPtr pCmap; pSaver = &savedScreenInfo[pScreen->myNum]; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; FreeResource (pSaver->wid, RT_NONE); if (pPriv) { UninstallSaverColormap (pScreen); pPriv->hasWindow = FALSE; CheckScreenPrivate (pScreen); } } if (!pPriv || !(pAttr = pPriv->attr)) return FALSE; pPriv->installedMap = None; if (GrabInProgress && GrabInProgress != pAttr->client->index) return FALSE; pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum], pAttr->x, pAttr->y, pAttr->width, pAttr->height, pAttr->borderWidth, pAttr->class, pAttr->mask, (XID *)pAttr->values, pAttr->depth, serverClient, pAttr->visual, &result); if (!pWin) return FALSE; if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin)) return FALSE; mask = 0; if (pAttr->pBackgroundPixmap) { pWin->backgroundState = BackgroundPixmap; pWin->background.pixmap = pAttr->pBackgroundPixmap; pAttr->pBackgroundPixmap->refcnt++; mask |= CWBackPixmap; } if (pAttr->pBorderPixmap) { pWin->borderIsPixel = FALSE; pWin->border.pixmap = pAttr->pBorderPixmap; pAttr->pBorderPixmap->refcnt++; mask |= CWBorderPixmap; } if (pAttr->pCursor) { if (!pWin->optional) if (!MakeWindowOptional (pWin)) { FreeResource (pWin->drawable.id, RT_NONE); return FALSE; } if (pWin->optional->cursor) FreeCursor (pWin->optional->cursor, (Cursor)0); pWin->optional->cursor = pAttr->pCursor; pAttr->pCursor->refcnt++; pWin->cursorIsNone = FALSE; CheckWindowOptionalNeed (pWin); mask |= CWCursor; } if (mask) (*pScreen->ChangeWindowAttributes) (pWin, mask); if (pAttr->colormap != None) (void) ChangeWindowAttributes (pWin, CWColormap, &pAttr->colormap, serverClient); MapWindow (pWin, serverClient); pPriv->hasWindow = TRUE; pSaver->pWindow = pWin; /* check and install our own colormap if it isn't installed now */ wantMap = wColormap (pWin); if (wantMap == None) return TRUE; installedMaps = (Colormap *) ALLOCATE_LOCAL (pScreen->maxInstalledCmaps * sizeof (Colormap)); numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps) (pScreen, installedMaps); for (i = 0; i < numInstalled; i++) if (installedMaps[i] == wantMap) break; DEALLOCATE_LOCAL ((char *) installedMaps); if (i < numInstalled) return TRUE; pCmap = (ColormapPtr) LookupIDByType (wantMap, RT_COLORMAP); if (!pCmap) return TRUE; pPriv->installedMap = wantMap; (*pCmap->pScreen->InstallColormap) (pCmap); return TRUE; } static Bool DestroySaverWindow (pScreen) ScreenPtr pScreen; { SetupScreen(pScreen); ScreenSaverStuffPtr pSaver; if (!pPriv || !pPriv->hasWindow) return FALSE; pSaver = &savedScreenInfo[pScreen->myNum]; if (pSaver->pWindow) { pSaver->pWindow = NullWindow; FreeResource (pSaver->wid, RT_NONE); } pPriv->hasWindow = FALSE; CheckScreenPrivate (pScreen); UninstallSaverColormap (pScreen); return TRUE; } static Bool ScreenSaverHandle (pScreen, xstate, force) ScreenPtr pScreen; int xstate; Bool force; { int state; Bool ret = FALSE; ScreenSaverScreenPrivatePtr pPriv; switch (xstate) { case SCREEN_SAVER_ON: state = ScreenSaverOn; ret = CreateSaverWindow (pScreen); break; case SCREEN_SAVER_OFF: state = ScreenSaverOff; ret = DestroySaverWindow (pScreen); break; case SCREEN_SAVER_CYCLE: state = ScreenSaverCycle; pPriv = GetScreenPrivate (pScreen); if (pPriv && pPriv->hasWindow) ret = TRUE; } SendScreenSaverNotify (pScreen, state, force); return ret; } static int ProcScreenSaverQueryVersion (client) register ClientPtr client; { xScreenSaverQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH (xScreenSaverQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = ScreenSaverMajorVersion; rep.minorVersion = ScreenSaverMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); } WriteToClient(client, sizeof (xScreenSaverQueryVersionReply), (char *)&rep); return (client->noClientException); } int ProcScreenSaverQueryInfo (client) register ClientPtr client; { REQUEST(xScreenSaverQueryInfoReq); xScreenSaverQueryInfoReply rep; register int n; ScreenSaverStuffPtr pSaver; DrawablePtr pDraw; CARD32 lastInput; ScreenSaverScreenPrivatePtr pPriv; REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pSaver = &savedScreenInfo[pDraw->pScreen->myNum]; pPriv = GetScreenPrivate (pDraw->pScreen); UpdateCurrentTime (); lastInput = GetTimeInMillis() - lastDeviceEventTime.milliseconds; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.window = pSaver->wid; if (screenIsSaved != SCREEN_SAVER_OFF) { rep.state = ScreenSaverOn; if (ScreenSaverTime) rep.tilOrSince = lastInput - ScreenSaverTime; else rep.tilOrSince = 0; } else { if (ScreenSaverTime) { rep.state = ScreenSaverOff; if (ScreenSaverTime < lastInput) rep.tilOrSince = 0; else rep.tilOrSince = ScreenSaverTime - lastInput; } else { rep.state = ScreenSaverDisabled; rep.tilOrSince = 0; } } rep.idle = lastInput; rep.eventMask = getEventMask (pDraw->pScreen, client); if (pPriv && pPriv->attr) rep.kind = ScreenSaverExternal; else if (ScreenSaverBlanking != DontPreferBlanking) rep.kind = ScreenSaverBlanked; else rep.kind = ScreenSaverInternal; if (client->swapped) { swaps (&rep.sequenceNumber, n); swapl (&rep.length, n); swapl (&rep.window, n); swapl (&rep.tilOrSince, n); swapl (&rep.idle, n); swapl (&rep.eventMask, n); } WriteToClient(client, sizeof (xScreenSaverQueryInfoReply), (char *)&rep); return (client->noClientException); } static int ProcScreenSaverSelectInput (client) register ClientPtr client; { REQUEST(xScreenSaverSelectInputReq); DrawablePtr pDraw; REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) return BadAlloc; return Success; } static int ProcScreenSaverSetAttributes (client) register ClientPtr client; { REQUEST(xScreenSaverSetAttributesReq); DrawablePtr pDraw; WindowPtr pParent; ScreenPtr pScreen; ScreenSaverScreenPrivatePtr pPriv = 0; ScreenSaverAttrPtr pAttr = 0; int ret; int len; int class, bw, depth; unsigned long visual; int idepth, ivisual; Bool fOK; DepthPtr pDepth; WindowOptPtr ancwopt; unsigned long *pVlist; unsigned long *values = 0; int valuei; unsigned long tmask, imask; unsigned long val; Pixmap pixID; PixmapPtr pPixmap; Cursor cursorID; CursorPtr pCursor; Colormap cmap; ColormapPtr pCmap; REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pScreen = pDraw->pScreen; pParent = WindowTable[pScreen->myNum]; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } switch (class = stuff->c_class) { case CopyFromParent: case InputOnly: case InputOutput: break; default: client->errorValue = class; return BadValue; } bw = stuff->borderWidth; depth = stuff->depth; visual = stuff->visualID; /* copied directly from CreateWindow */ if (class == CopyFromParent) class = pParent->drawable.class; if ((class != InputOutput) && (class != InputOnly)) { client->errorValue = class; return BadValue; } if ((class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; if ((class == InputOnly) && ((bw != 0) || (depth != 0))) return BadMatch; if ((class == InputOutput) && (depth == 0)) depth = pParent->drawable.depth; ancwopt = pParent->optional; if (!ancwopt) ancwopt = FindWindowWithOptional(pParent)->optional; if (visual == CopyFromParent) visual = ancwopt->visual; /* Find out if the depth and visual are acceptable for this Screen */ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) { fOK = FALSE; for(idepth = 0; idepth < pScreen->numDepths; idepth++) { pDepth = (DepthPtr) &pScreen->allowedDepths[idepth]; if ((depth == pDepth->depth) || (depth == 0)) { for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) { if (visual == pDepth->vids[ivisual]) { fOK = TRUE; break; } } } } if (fOK == FALSE) return BadMatch; } if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) && (class != InputOnly) && (depth != pParent->drawable.depth)) { return BadMatch; } if (((stuff->mask & CWColormap) == 0) && (class != InputOnly) && ((visual != ancwopt->visual) || (ancwopt->colormap == None))) { return BadMatch; } /* end of errors from CreateWindow */ pPriv = GetScreenPrivate (pScreen); if (pPriv && pPriv->attr) { if (pPriv->attr->client != client) return BadAccess; } if (!pPriv) { pPriv = MakeScreenPrivate (pScreen); if (!pPriv) return FALSE; } pAttr = New (ScreenSaverAttrRec); if (!pAttr) { ret = BadAlloc; goto bail; } /* over allocate for override redirect */ values = (unsigned long *) xalloc ((len + 1) * sizeof (unsigned long)); if (!values) { ret = BadAlloc; goto bail; } valuei = 0; pAttr->screen = pScreen; pAttr->client = client; pAttr->x = stuff->x; pAttr->y = stuff->y; pAttr->width = stuff->width; pAttr->height = stuff->height; pAttr->borderWidth = stuff->borderWidth; pAttr->class = stuff->c_class; pAttr->depth = depth; pAttr->visual = visual; pAttr->colormap = None; pAttr->pCursor = NullCursor; pAttr->pBackgroundPixmap = NullPixmap; pAttr->pBorderPixmap = NullPixmap; pAttr->values = values; /* * go through the mask, checking the values, * looking up pixmaps and cursors and hold a reference * to them. */ pAttr->mask = tmask = stuff->mask | CWOverrideRedirect; pVlist = (unsigned long *) (stuff + 1); while (tmask) { imask = lowbit (tmask); tmask &= ~imask; switch (imask) { case CWBackPixmap: pixID = (Pixmap )*pVlist; if (pixID == None) { *values++ = None; } else if (pixID == ParentRelative) { if (depth != pParent->drawable.depth) { ret = BadMatch; goto PatchUp; } *values++ = ParentRelative; } else { pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); if (pPixmap != (PixmapPtr) NULL) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) { ret = BadMatch; goto PatchUp; } pAttr->pBackgroundPixmap = pPixmap; pPixmap->refcnt++; pAttr->mask &= ~CWBackPixmap; } else { ret = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBackPixel: *values++ = (CARD32) *pVlist; break; case CWBorderPixmap: pixID = (Pixmap ) *pVlist; if (pixID == CopyFromParent) { if (depth != pParent->drawable.depth) { ret = BadMatch; goto PatchUp; } *values++ = CopyFromParent; } else { pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); if (pPixmap) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) { ret = BadMatch; goto PatchUp; } pAttr->pBorderPixmap = pPixmap; pPixmap->refcnt++; pAttr->mask &= ~CWBorderPixmap; } else { ret = BadPixmap; client->errorValue = pixID; goto PatchUp; } } break; case CWBorderPixel: *values++ = (CARD32) *pVlist; break; case CWBitGravity: val = (CARD8 )*pVlist; if (val > StaticGravity) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWWinGravity: val = (CARD8 )*pVlist; if (val > StaticGravity) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWBackingStore: val = (CARD8 )*pVlist; if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWBackingPlanes: *values++ = (CARD32) *pVlist; break; case CWBackingPixel: *values++ = (CARD32) *pVlist; break; case CWSaveUnder: val = (BOOL) *pVlist; if ((val != xTrue) && (val != xFalse)) { ret = BadValue; client->errorValue = val; goto PatchUp; } *values++ = val; break; case CWEventMask: *values++ = (CARD32) *pVlist; break; case CWDontPropagate: *values++ = (CARD32) *pVlist; break; case CWOverrideRedirect: if (!(stuff->mask & CWOverrideRedirect)) pVlist--; else { val = (BOOL ) *pVlist; if ((val != xTrue) && (val != xFalse)) { ret = BadValue; client->errorValue = val; goto PatchUp; } } *values++ = xTrue; break; case CWColormap: cmap = (Colormap) *pVlist; pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP); if (!pCmap) { ret = BadColor; client->errorValue = cmap; goto PatchUp; } if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen) { ret = BadMatch; goto PatchUp; } pAttr->colormap = cmap; pAttr->mask &= ~CWColormap; break; case CWCursor: cursorID = (Cursor ) *pVlist; if ( cursorID == None) { *values++ = None; } else { pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR); if (!pCursor) { ret = BadCursor; client->errorValue = cursorID; goto PatchUp; } pCursor->refcnt++; pAttr->pCursor = pCursor; pAttr->mask &= ~CWCursor; } break; default: ret = BadValue; client->errorValue = stuff->mask; goto PatchUp; } pVlist++; } if (pPriv->attr) FreeScreenAttr (pPriv->attr); pPriv->attr = pAttr; pAttr->resource = FakeClientID (client->index); if (!AddResource (pAttr->resource, AttrType, (pointer) pAttr)) return BadAlloc; return Success; PatchUp: FreeAttrs (pAttr); bail: CheckScreenPrivate (pScreen); xfree (pAttr); xfree (values); return ret; } static int ProcScreenSaverUnsetAttributes (client) register ClientPtr client; { REQUEST(xScreenSaverSetAttributesReq); DrawablePtr pDraw; ScreenSaverScreenPrivatePtr pPriv; REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDraw) return BadDrawable; pPriv = GetScreenPrivate (pDraw->pScreen); if (pPriv && pPriv->attr && pPriv->attr->client == client) { FreeScreenAttr (pPriv->attr); pPriv->attr = NULL; CheckScreenPrivate (pDraw->pScreen); } return Success; } static DISPATCH_PROC((*NormalVector[])) = { ProcScreenSaverQueryVersion, ProcScreenSaverQueryInfo, ProcScreenSaverSelectInput, ProcScreenSaverSetAttributes, ProcScreenSaverUnsetAttributes, }; #define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0])) static int ProcScreenSaverDispatch (client) ClientPtr client; { REQUEST(xReq); if (stuff->data < NUM_REQUESTS) return (*NormalVector[stuff->data])(client); return BadRequest; } static int SProcScreenSaverQueryVersion (client) ClientPtr client; { REQUEST(xScreenSaverQueryVersionReq); int n; swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq); return ProcScreenSaverQueryVersion (client); } static int SProcScreenSaverQueryInfo (client) ClientPtr client; { REQUEST(xScreenSaverQueryInfoReq); int n; swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq); swapl (&stuff->drawable, n); return ProcScreenSaverQueryInfo (client); } static int SProcScreenSaverSelectInput (client) ClientPtr client; { REQUEST(xScreenSaverSelectInputReq); int n; swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq); swapl (&stuff->drawable, n); swapl (&stuff->eventMask, n); return ProcScreenSaverSelectInput (client); } static int SProcScreenSaverSetAttributes (client) ClientPtr client; { REQUEST(xScreenSaverSetAttributesReq); int n; swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq); swapl (&stuff->drawable, n); swaps (&stuff->x, n); swaps (&stuff->y, n); swaps (&stuff->width, n); swaps (&stuff->height, n); swaps (&stuff->borderWidth, n); swapl (&stuff->visualID, n); swapl (&stuff->mask, n); SwapRestL(stuff); return ProcScreenSaverSetAttributes (client); } static int SProcScreenSaverUnsetAttributes (client) ClientPtr client; { REQUEST(xScreenSaverUnsetAttributesReq); int n; swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq); swapl (&stuff->drawable, n); return ProcScreenSaverUnsetAttributes (client); } static DISPATCH_PROC((*SwappedVector[])) = { SProcScreenSaverQueryVersion, SProcScreenSaverQueryInfo, SProcScreenSaverSelectInput, SProcScreenSaverSetAttributes, SProcScreenSaverUnsetAttributes, }; static int SProcScreenSaverDispatch (client) ClientPtr client; { REQUEST(xReq); if (stuff->data < NUM_REQUESTS) return (*SwappedVector[stuff->data])(client); return BadRequest; } vnc_unixsrc/Xvnc/programs/Xserver/Xext/sleepuntil.c0100664000076400007640000001461207120677563022177 0ustar constconst/* * $XConsortium: sleepuntil.c,v 1.5 94/04/17 20:32:57 dpw Exp $ * $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.0 1996/05/06 05:55:34 dawes Exp $ * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* dixsleep.c - implement millisecond timeouts for X clients */ #include "X.h" #include "Xmd.h" #include "misc.h" #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" typedef struct _Sertafied { struct _Sertafied *next; TimeStamp revive; ClientPtr pClient; XID id; void (*notifyFunc)( #if NeedNestedPrototypes ClientPtr /* client */, pointer /* closure */ #endif ); pointer closure; } SertafiedRec, *SertafiedPtr; static SertafiedPtr pPending; static RESTYPE SertafiedResType; static Bool BlockHandlerRegistered; static int SertafiedGeneration; static void ClientAwaken( #if NeedFunctionPrototypes ClientPtr /* client */, pointer /* closure */ #endif ); static int SertafiedDelete( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); static void SertafiedBlockHandler( #if NeedFunctionPrototypes pointer /* data */, OSTimePtr /* wt */, pointer /* LastSelectMask */ #endif ); static void SertafiedWakeupHandler( #if NeedFunctionPrototypes pointer /* data */, int /* i */, pointer /* LastSelectMask */ #endif ); int ClientSleepUntil (client, revive, notifyFunc, closure) ClientPtr client; TimeStamp *revive; void (*notifyFunc)(); pointer closure; { SertafiedPtr pRequest, pReq, pPrev; if (SertafiedGeneration != serverGeneration) { SertafiedResType = CreateNewResourceType (SertafiedDelete); if (!SertafiedResType) return FALSE; SertafiedGeneration = serverGeneration; BlockHandlerRegistered = FALSE; } pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec)); if (!pRequest) return FALSE; pRequest->pClient = client; pRequest->revive = *revive; pRequest->id = FakeClientID (client->index); pRequest->closure = closure; if (!BlockHandlerRegistered) { if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler, SertafiedWakeupHandler, (pointer) 0)) { xfree (pRequest); return FALSE; } BlockHandlerRegistered = TRUE; } pRequest->notifyFunc = 0; if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest)) return FALSE; if (!notifyFunc) notifyFunc = ClientAwaken; pRequest->notifyFunc = notifyFunc; /* Insert into time-ordered queue, with earliest activation time coming first. */ pPrev = 0; for (pReq = pPending; pReq; pReq = pReq->next) { if (CompareTimeStamps (pReq->revive, *revive) == LATER) break; pPrev = pReq; } if (pPrev) pPrev->next = pRequest; else pPending = pRequest; pRequest->next = pReq; IgnoreClient (client); return TRUE; } static void ClientAwaken (client, closure) ClientPtr client; pointer closure; { if (!client->clientGone) AttendClient (client); } static int SertafiedDelete (value, id) pointer value; XID id; { SertafiedPtr pRequest = (SertafiedPtr)value; SertafiedPtr pReq, pPrev; pPrev = 0; for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next) if (pReq == pRequest) { if (pPrev) pPrev->next = pReq->next; else pPending = pReq->next; break; } if (pRequest->notifyFunc) (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure); xfree (pRequest); return TRUE; } static void SertafiedBlockHandler (data, wt, LastSelectMask) pointer data; /* unused */ OSTimePtr wt; /* wait time */ pointer LastSelectMask; { SertafiedPtr pReq, pNext; unsigned long newdelay, olddelay; TimeStamp now; if (!pPending) return; now.milliseconds = GetTimeInMillis (); now.months = currentTime.months; if ((int) (now.milliseconds - currentTime.milliseconds) < 0) now.months++; for (pReq = pPending; pReq; pReq = pNext) { pNext = pReq->next; if (CompareTimeStamps (pReq->revive, now) == LATER) break; FreeResource (pReq->id, RT_NONE); /* AttendClient() may have been called via the resource delete * function so a client may have input to be processed and so * set delay to 0 to prevent blocking in WaitForSomething(). */ AdjustWaitForDelay (wt, 0); } pReq = pPending; if (!pReq) return; newdelay = pReq->revive.milliseconds - now.milliseconds; AdjustWaitForDelay (wt, newdelay); } static void SertafiedWakeupHandler (data, i, LastSelectMask) pointer data; int i; pointer LastSelectMask; { SertafiedPtr pReq, pNext; TimeStamp now; now.milliseconds = GetTimeInMillis (); now.months = currentTime.months; if ((int) (now.milliseconds - currentTime.milliseconds) < 0) now.months++; for (pReq = pPending; pReq; pReq = pNext) { pNext = pReq->next; if (CompareTimeStamps (pReq->revive, now) == LATER) break; FreeResource (pReq->id, RT_NONE); } if (!pPending) { RemoveBlockAndWakeupHandlers (SertafiedBlockHandler, SertafiedWakeupHandler, (pointer) 0); BlockHandlerRegistered = FALSE; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xprint.c0100664000076400007640000023045307463513423021334 0ustar constconst/* $XConsortium: xprint.c /main/3 1996/11/23 17:11:55 rws $ */ /* (c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 International Business Machines Corp. (c) Copyright 1996 Sun Microsystems, Inc. (c) Copyright 1996 Novell, Inc. (c) Copyright 1996 Digital Equipment Corp. (c) Copyright 1996 Fujitsu Limited (c) Copyright 1996 Hitachi, Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the names of the copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from said copyright holders. */ /******************************************************************* ** ** ********************************************************* ** * ** * File: xprint.c ** * ** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company ** * ** * Copyright 1989 by The Massachusetts Institute of Technology ** * ** * Permission to use, copy, modify, and distribute this ** * software and its documentation for any purpose and without ** * fee is hereby granted, provided that the above copyright ** * notice appear in all copies and that both that copyright ** * notice and this permission notice appear in supporting ** * documentation, and that the name of MIT not be used in ** * advertising or publicity pertaining to distribution of the ** * software without specific prior written permission. ** * M.I.T. makes no representation about the suitability of ** * this software for any purpose. It is provided "as is" ** * without any express or implied warranty. ** * ** * MIT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, ** * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- ** * NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MIT BE LI- ** * ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ** * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ** * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ** * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH ** * THE USE OR PERFORMANCE OF THIS SOFTWARE. ** * ** ********************************************************* ** ********************************************************************/ /* $XFree86: xc/programs/Xserver/Xext/xprint.c,v 1.4 1997/01/02 04:05:05 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #undef NEED_EVENTS #include "misc.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "Xatom.h" #define _XP_PRINT_SERVER_ #include "Print.h" #include "Printstr.h" #undef _XP_PRINT_SERVER_ #include "../Xprint/DiPrint.h" extern WindowPtr *WindowTable; /* declared in dix:globals.c */ extern WindowPtr XpDiValidatePrinter(); extern char *XpDiGetDriverName(); extern char *XpGetAttributes(); extern char *XpGetOneAttribute(); extern int XpRehashPrinterList(); extern void XpSetFontResFunc(); static void XpResetProc(); static int ProcXpDispatch(); static int ProcXpSwappedDispatch(); static int ProcXpQueryVersion(); static int ProcXpGetPrinterList(); static int ProcXpCreateContext(); static int ProcXpSetContext(); static int ProcXpGetContext(); static int ProcXpDestroyContext(); static int ProcXpGetContextScreen(); static int ProcXpStartJob(); static int ProcXpEndJob(); static int ProcXpStartDoc(); static int ProcXpEndDoc(); static int ProcXpStartPage(); static int ProcXpEndPage(); static int ProcXpSelectInput(); static int ProcXpInputSelected(); static int ProcXpPutDocumentData(); static int ProcXpGetDocumentData(); static int ProcXpGetAttributes(); static int ProcXpGetOneAttribute(); static int ProcXpSetAttributes(); static int ProcXpRehashPrinterList(); static int ProcXpQueryScreens(); static int ProcXpGetPageDimensions(); static int ProcXpSetImageResolution(); static int ProcXpGetImageResolution(); static void SwapXpNotifyEvent(); static void SwapXpAttributeEvent(); static int SProcXpGetPrinterList(); static int SProcXpCreateContext(); static int SProcXpSetContext(); static int SProcXpGetContext(); static int SProcXpDestroyContext(); static int SProcXpGetContextScreen(); static int SProcXpStartJob(); static int SProcXpEndJob(); static int SProcXpStartDoc(); static int SProcXpEndDoc(); static int SProcXpStartPage(); static int SProcXpEndPage(); static int SProcXpSelectInput(); static int SProcXpInputSelected(); static int SProcXpPutDocumentData(); static int SProcXpGetDocumentData(); static int SProcXpGetAttributes(); static int SProcXpGetOneAttribute(); static int SProcXpSetAttributes(); static int SProcXpRehashPrinterList(); static int SProcXpGetPageDimensions(); static int SProcXpSetImageResolution(); static int SProcXpGetImageResolution(); static void SendXpNotify(); static void SendAttributeNotify(); static int XpFreeClient(); static int XpFreeContext(); static int XpFreePage(); static int XpFreeEvents(); static Bool XpCloseScreen(); static CARD32 GetAllEventMasks(); static struct _XpEvent *AddEventRec(); static void DeleteEventRec(); static struct _XpEvent *FindEventRec(); static struct _XpClient *CreateXpClient(); static void FreeXpClient(); static void InitContextPrivates(); static void ResetContextPrivates(); static struct _XpClient *FindClient(); static struct _XpClient *AcquireClient(); typedef struct _driver { struct _driver *next; char *name; int (* CreateContext)(); } XpDriverRec, *XpDriverPtr; typedef struct _xpScreen { Bool (* CloseScreen)(); struct _driver *drivers; } XpScreenRec, *XpScreenPtr; /* * Each context has a list of XpClients indicating which clients have * associated this context with their connection. * Each such client has a RTclient resource allocated for it, * and this per-client * resource is used to delete the XpClientRec if/when the client closes * its connection. * The list of XpClients is also walked if/when the context is destroyed * so that the ContextPtr can be removed from the client's devPrivates. */ typedef struct _XpClient { struct _XpClient *pNext; ClientPtr client; XpContextPtr context; CARD32 eventMask; XID contextClientID; /* unneeded sanity check? */ } XpClientRec, *XpClientPtr; /* * Each StartPage request specifies a window which forms the top level * window of the page. One of the following structs is created as a * RTpage resource with the same ID as the window itself. This enables * us to clean up when/if the window is destroyed, and to prevent the * same window from being simultaneously referenced in multiple contexts. * The page resource is created at the first StartPage on a given window, * and is only destroyed when/if the window is destroyed. When the * EndPage is recieved (or an EndDoc or EndJob) the context field is * set to NULL, but the resource remains alive. */ typedef struct _XpPage { XpContextPtr context; } XpPageRec, *XpPagePtr; typedef struct _XpStPageRec { XpContextPtr pContext; Bool slept; XpPagePtr pPage; WindowPtr pWin; } XpStPageRec, *XpStPagePtr; typedef struct _XpStDocRec { XpContextPtr pContext; Bool slept; CARD8 type; } XpStDocRec, *XpStDocPtr; #define QUADPAD(x) ((((x)+3)>>2)<<2) /* * Possible bit-mask values in the "state" field of a XpContextRec. */ #define JOB_STARTED (1 << 0) #define DOC_RAW_STARTED (1 << 1) #define DOC_COOKED_STARTED (1 << 2) #define PAGE_STARTED (1 << 3) #define GET_DOC_DATA_STARTED (1 << 4) #define JOB_GET_DATA (1 << 5) static XpScreenPtr XpScreens[MAXSCREENS]; static unsigned char XpReqCode; static int XpEventBase; static int XpErrorBase; static int XpGeneration = 0; static int XpWindowPrivateIndex; static int XpClientPrivateIndex; /* Variables for the context private machinery. * These must be initialized at compile time because * main() calls InitOutput before InitExtensions, and the * output drivers are likely to call AllocateContextPrivate. * These variables are reset at CloseScreen time. CloseScreen * is used because it occurs after FreeAllResources, and before * the next InitOutput cycle. */ static int contextPrivateCount = 0; static int contextPrivateLen = 0; static unsigned *contextPrivateSizes = (unsigned *)NULL; static unsigned totalContextSize = sizeof(XpContextRec); /* * There are three types of resources involved. One is the resource associated * with the context itself, with an ID specified by a printing client. The * next is a resource created by us on the client's behalf (and unknown to * the client) when a client inits or sets a context which allows us to * track each client's interest in events * on a particular context, and also allows us to clean up this interest * record when/if the client's connection is closed. Finally, there is * a resource created for each window that's specified in a StartPage. This * resource carries the same ID as the window itself, and enables us to * easily prevent the same window being referenced in multiple contexts * simultaneously, and enables us to clean up if the window is destroyed * before the EndPage. */ static RESTYPE RTclient, RTcontext, RTpage; /* * allEvents is the OR of all the legal event mask bits. */ static CARD32 allEvents = XPPrintMask | XPAttributeMask; /******************************************************************************* * * ExtensionInit, Driver Init functions, QueryVersion, and Dispatch procs * ******************************************************************************/ /* * XpExtensionInit * * Called from InitExtensions in main() usually through miinitextension * */ void XpExtensionInit() { ExtensionEntry *extEntry, *AddExtension(); int i; RTclient = CreateNewResourceType(XpFreeClient); RTcontext = CreateNewResourceType(XpFreeContext); RTpage = CreateNewResourceType(XpFreePage); if (RTclient && RTcontext && RTpage && (extEntry = AddExtension(XP_PRINTNAME, XP_EVENTS, XP_ERRORS, ProcXpDispatch, ProcXpSwappedDispatch, XpResetProc, StandardMinorOpcode))) { XpReqCode = (unsigned char)extEntry->base; XpEventBase = extEntry->eventBase; XpErrorBase = extEntry->errorBase; EventSwapVector[XpEventBase] = SwapXpNotifyEvent; EventSwapVector[XpEventBase+1] = SwapXpAttributeEvent; } if(XpGeneration != serverGeneration) { XpClientPrivateIndex = AllocateClientPrivateIndex(); /* * We allocate 0 length & simply stuff a pointer to the * ContextRec in the DevUnion. */ if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE) { /* we can't alloc a client private, should we bail??? XXX */ } XpGeneration = serverGeneration; } for(i = 0; i < MAXSCREENS; i++) { /* * If a screen has registered with our extension, then we * wrap the screen's CloseScreen function to allow us to * reset our ContextPrivate stuff. Note that this * requires a printing DDX to call XpRegisterInitFunc * _before_ this extension is initialized - i.e. at screen init * time, _not_ at root window creation time. */ if(XpScreens[i] != (XpScreenPtr)NULL) { XpScreens[i]->CloseScreen = screenInfo.screens[i]->CloseScreen; screenInfo.screens[i]->CloseScreen = XpCloseScreen; } } DeclareExtensionSecurity(XP_PRINTNAME, TRUE); } static void XpResetProc(extEntry) ExtensionEntry extEntry; { int i; /* * We can't free up the XpScreens recs here, because extensions are * closed before screens, and our CloseScreen function uses the XpScreens * recs. for(i = 0; i < MAXSCREENS; i++) { if(XpScreens[i] != (XpScreenPtr)NULL) Xfree(XpScreens[i]); XpScreens[i] = (XpScreenPtr)NULL; } */ } static Bool XpCloseScreen(index, pScreen) int index; ScreenPtr pScreen; { Bool (* CloseScreen)(); CloseScreen = XpScreens[index]->CloseScreen; if(XpScreens[index] != (XpScreenPtr)NULL) { XpDriverPtr pDriv, nextDriv; pDriv = XpScreens[index]->drivers; while(pDriv != (XpDriverPtr)NULL) { nextDriv = pDriv->next; Xfree(pDriv); pDriv = nextDriv; } Xfree(XpScreens[index]); } XpScreens[index] = (XpScreenPtr)NULL; /* * It's wasteful to call ResetContextPrivates() at every CloseScreen, * but it's the best we know how to do for now. We do this because we * have to wait until after all resources have been freed (so we know * how to free the ContextRecs), and before the next InitOutput cycle. * See dix/main.c for the order of initialization and reset. */ ResetContextPrivates(); return (*CloseScreen)(index, pScreen); } static void FreeScreenEntry(pScreenEntry) XpScreenPtr pScreenEntry; { XpDriverPtr pDriver; pDriver = pScreenEntry->drivers; while(pDriver != (XpDriverPtr)NULL) { XpDriverPtr tmp; tmp = pDriver->next; xfree(pDriver); pDriver = tmp; } xfree(pScreenEntry); } /* * XpRegisterInitFunc tells the print extension which screens * are printers as opposed to displays, and what drivers are * supported on each screen. This eliminates the need of * allocating print-related private structures on windows on _all_ screens. * It also hands the extension a pointer to the routine to be called * whenever a context gets created for a particular driver on this screen. */ void XpRegisterInitFunc(pScreen, driverName, initContext) ScreenPtr pScreen; char *driverName; int (*initContext)(); { XpDriverPtr pDriver; if(XpScreens[pScreen->myNum] == (XpScreenPtr)NULL) { if((XpScreens[pScreen->myNum] = (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == (XpScreenPtr)NULL) return; XpScreens[pScreen->myNum]->CloseScreen = (Bool(*)())NULL; XpScreens[pScreen->myNum]->drivers = (XpDriverPtr)NULL; } if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == (XpDriverPtr)NULL) return; pDriver->next = XpScreens[pScreen->myNum]->drivers; pDriver->name = driverName; pDriver->CreateContext = initContext; XpScreens[pScreen->myNum]->drivers = pDriver; } static int ProcXpDispatch(client) ClientPtr client; { REQUEST(xReq); switch(stuff->data) { case X_PrintQueryVersion: return ProcXpQueryVersion(client); case X_PrintGetPrinterList: return ProcXpGetPrinterList(client); case X_PrintCreateContext: return ProcXpCreateContext(client); case X_PrintSetContext: return ProcXpSetContext(client); case X_PrintGetContext: return ProcXpGetContext(client); case X_PrintDestroyContext: return ProcXpDestroyContext(client); case X_PrintGetContextScreen: return ProcXpGetContextScreen(client); case X_PrintStartJob: return ProcXpStartJob(client); case X_PrintEndJob: return ProcXpEndJob(client); case X_PrintStartDoc: return ProcXpStartDoc(client); case X_PrintEndDoc: return ProcXpEndDoc(client); case X_PrintStartPage: return ProcXpStartPage(client); case X_PrintEndPage: return ProcXpEndPage(client); case X_PrintSelectInput: return ProcXpSelectInput(client); case X_PrintInputSelected: return ProcXpInputSelected(client); case X_PrintPutDocumentData: return ProcXpPutDocumentData(client); case X_PrintGetDocumentData: return ProcXpGetDocumentData(client); case X_PrintSetAttributes: return ProcXpSetAttributes(client); case X_PrintGetAttributes: return ProcXpGetAttributes(client); case X_PrintGetOneAttribute: return ProcXpGetOneAttribute(client); case X_PrintRehashPrinterList: return ProcXpRehashPrinterList(client); case X_PrintQueryScreens: return ProcXpQueryScreens(client); case X_PrintGetPageDimensions: return ProcXpGetPageDimensions(client); case X_PrintSetImageResolution: return ProcXpSetImageResolution(client); case X_PrintGetImageResolution: return ProcXpGetImageResolution(client); default: return BadRequest; } } static int ProcXpSwappedDispatch(client) ClientPtr client; { int temp; REQUEST(xReq); switch(stuff->data) { case X_PrintQueryVersion: swaps(&stuff->length, temp); return ProcXpQueryVersion(client); case X_PrintGetPrinterList: return SProcXpGetPrinterList(client); case X_PrintCreateContext: return SProcXpCreateContext(client); case X_PrintSetContext: return SProcXpSetContext(client); case X_PrintGetContext: return SProcXpGetContext(client); case X_PrintDestroyContext: return SProcXpDestroyContext(client); case X_PrintGetContextScreen: return SProcXpGetContextScreen(client); case X_PrintStartJob: return SProcXpStartJob(client); case X_PrintEndJob: return SProcXpEndJob(client); case X_PrintStartDoc: return SProcXpStartDoc(client); case X_PrintEndDoc: return SProcXpEndDoc(client); case X_PrintStartPage: return SProcXpStartPage(client); case X_PrintEndPage: return SProcXpEndPage(client); case X_PrintSelectInput: return SProcXpSelectInput(client); case X_PrintInputSelected: return SProcXpInputSelected(client); case X_PrintPutDocumentData: return SProcXpPutDocumentData(client); case X_PrintGetDocumentData: return SProcXpGetDocumentData(client); case X_PrintSetAttributes: return SProcXpSetAttributes(client); case X_PrintGetAttributes: return SProcXpGetAttributes(client); case X_PrintGetOneAttribute: return SProcXpGetOneAttribute(client); case X_PrintRehashPrinterList: return SProcXpRehashPrinterList(client); case X_PrintQueryScreens: swaps(&stuff->length, temp); return ProcXpQueryScreens(client); case X_PrintGetPageDimensions: return SProcXpGetPageDimensions(client); case X_PrintSetImageResolution: return SProcXpSetImageResolution(client); case X_PrintGetImageResolution: return SProcXpGetImageResolution(client); default: return BadRequest; } } static int ProcXpQueryVersion(client) ClientPtr client; { REQUEST(xPrintQueryVersionReq); xPrintQueryVersionReply rep; register int n; long l; REQUEST_SIZE_MATCH(xPrintQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XP_MAJOR_VERSION; rep.minorVersion = XP_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sz_xPrintQueryVersionReply, (char *)&rep); return client->noClientException; } /******************************************************************************* * * GetPrinterList : Return a list of all printers associated with this * server. Calls XpDiGetPrinterList, which is defined in * the device-independent code in Xserver/Xprint. * ******************************************************************************/ static int ProcXpGetPrinterList(client) ClientPtr client; { REQUEST(xPrintGetPrinterListReq); int totalSize, numEntries; XpDiListEntry **pList, *pEntry; xPrintGetPrinterListReply *rep; int n, i, totalBytes; long l; char *curByte; REQUEST_AT_LEAST_SIZE(xPrintGetPrinterListReq); totalSize = ((sz_xPrintGetPrinterListReq) >> 2) + ((stuff->printerNameLen + 3) >> 2) + ((stuff->localeLen + 3) >> 2); if(totalSize != client->req_len) return BadLength; pList = XpDiGetPrinterList(stuff->printerNameLen, (char *)(stuff + 1), stuff->localeLen, (char *)((stuff + 1) + QUADPAD(stuff->printerNameLen))); for(numEntries = 0, totalBytes = sz_xPrintGetPrinterListReply; pList[numEntries] != (XpDiListEntry *)NULL; numEntries++) { totalBytes += 2 * sizeof(CARD32); totalBytes += QUADPAD(strlen(pList[numEntries]->name)); totalBytes += QUADPAD(strlen(pList[numEntries]->description)); } if((rep = (xPrintGetPrinterListReply *)xalloc(totalBytes)) == (xPrintGetPrinterListReply *)NULL) return BadAlloc; rep->type = X_Reply; rep->length = (totalBytes - sz_xPrintGetPrinterListReply) >> 2; rep->sequenceNumber = client->sequence; rep->listCount = numEntries; if (client->swapped) { swaps(&rep->sequenceNumber, n); swapl(&rep->length, l); swapl(&rep->listCount, l); } for(i = 0, curByte = (char *)(rep + 1); i < numEntries; i++) { CARD32 *pCrd; int len; pCrd = (CARD32 *)curByte; len = strlen(pList[i]->name); *pCrd = len; if (client->swapped) swapl((long *)curByte, l); curByte += sizeof(CARD32); strncpy(curByte, pList[i]->name, len); curByte += QUADPAD(len); pCrd = (CARD32 *)curByte; len = strlen(pList[i]->description); *pCrd = len; if (client->swapped) swapl((long *)curByte, l); curByte += sizeof(CARD32); strncpy(curByte, pList[i]->description, len); curByte += QUADPAD(len); } XpDiFreePrinterList(pList); WriteToClient(client, totalBytes, (char *)rep); xfree(rep); return client->noClientException; } /******************************************************************************* * * QueryScreens: Returns the list of screens which are associated with * print drivers. * ******************************************************************************/ static int ProcXpQueryScreens(client) ClientPtr client; { REQUEST(xPrintQueryScreensReq); int i, numPrintScreens, totalSize; WINDOW *pWinId; xPrintQueryScreensReply *rep; long l; REQUEST_SIZE_MATCH(xPrintQueryScreensReq); rep = (xPrintQueryScreensReply *)xalloc(sz_xPrintQueryScreensReply); pWinId = (WINDOW *)(rep + 1); for(i = 0, numPrintScreens = 0, totalSize = sz_xPrintQueryScreensReply; i < MAXSCREENS; i++) { /* * If a screen has registered with our extension, then it's * a printer screen. */ if(XpScreens[i] != (XpScreenPtr)NULL) { numPrintScreens++; totalSize += sizeof(WINDOW); rep = (xPrintQueryScreensReply *)xrealloc(rep, totalSize); *pWinId = WindowTable[i]->drawable.id; if (client->swapped) swapl((long *)pWinId, l); pWinId++; } } rep->type = X_Reply; rep->sequenceNumber = client->sequence; rep->length = (totalSize - sz_xPrintQueryScreensReply) >> 2; rep->listCount = numPrintScreens; if (client->swapped) { int n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, l); swapl(&rep->listCount, l); } WriteToClient(client, totalSize, (char *)rep); xfree(rep); return client->noClientException; } static int ProcXpGetPageDimensions(client) ClientPtr client; { REQUEST(xPrintGetPageDimensionsReq); CARD16 width, height; xRectangle rect; xPrintGetPageDimensionsReply rep; XpContextPtr pContext; int result; REQUEST_SIZE_MATCH(xPrintGetPageDimensionsReq); if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(pContext->funcs.GetMediumDimensions != (int (*)())NULL) result = pContext->funcs.GetMediumDimensions(pContext, &width, &height); else return BadImplementation; if(pContext->funcs.GetReproducibleArea != (int (*)())NULL) result = pContext->funcs.GetReproducibleArea(pContext, &rect); else return BadImplementation; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.width = width; rep.height = height; rep.rx = rect.x; rep.ry = rect.y; rep.rwidth = rect.width; rep.rheight = rect.height; if(client->swapped) { int n; long l; swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swaps(&rep.width, n); swaps(&rep.height, n); swaps(&rep.rx, n); swaps(&rep.ry, n); swaps(&rep.rwidth, n); swaps(&rep.rheight, n); } WriteToClient(client, sz_xPrintGetPageDimensionsReply, (char *)&rep); return client->noClientException; } static int ProcXpSetImageResolution(client) ClientPtr client; { REQUEST(xPrintSetImageResolutionReq); xPrintSetImageResolutionReply rep; XpContextPtr pContext; Bool status; int result; REQUEST_SIZE_MATCH(xPrintSetImageResolutionReq); if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } rep.prevRes = pContext->imageRes; if(pContext->funcs.SetImageResolution != (int (*)())NULL) result = pContext->funcs.SetImageResolution(pContext, (int)stuff->imageRes, &status); else status = FALSE; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.status = status; if(client->swapped) { int n; long l; swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swaps(&rep.prevRes, n); } WriteToClient(client, sz_xPrintSetImageResolutionReply, (char *)&rep); return client->noClientException; } static int ProcXpGetImageResolution(client) ClientPtr client; { REQUEST(xPrintGetImageResolutionReq); xPrintGetImageResolutionReply rep; XpContextPtr pContext; Bool status; int result; REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq); if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.imageRes = pContext->imageRes; if(client->swapped) { int n; long l; swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swaps(&rep.imageRes, n); } WriteToClient(client, sz_xPrintGetImageResolutionReply, (char *)&rep); return client->noClientException; } /******************************************************************************* * * RehashPrinterList : Cause the server's list of printers to be rebuilt. * This allows new printers to be added, or old ones * deleted without needing to restart the server. * ******************************************************************************/ static int ProcXpRehashPrinterList(client) ClientPtr client; { REQUEST(xPrintRehashPrinterListReq); REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq); return XpRehashPrinterList(); } /****************************************************************************** * * Context functions: Init, Set, Destroy, FreeContext * AllocateContextPrivateIndex, AllocateContextPrivate * and supporting functions. * * Init creates a context, creates a XpClientRec for the calling * client, and stores the contextPtr in the client's devPrivates. * * Set creates a XpClientRec for the calling client, and stores the * contextPtr in the client's devPrivates unless the context is None. * If the context is None, then the client's connection association * with any context is removed. * * Destroy frees any and all XpClientRecs associated with the context, * frees the context itself, and removes the contextPtr from any * relevant client devPrivates. * * FreeContext is called by FreeResource to free up a context. * ******************************************************************************/ /* * CreateContext creates and initializes the memory for the context itself. * The driver's CreateContext function * is then called. */ static int ProcXpCreateContext(client) ClientPtr client; { REQUEST(xPrintCreateContextReq); XpScreenPtr pPrintScreen; WindowPtr pRoot; char *printerName, *driverName; XpContextPtr pContext; XpClientPtr pNewPrintClient; int result = Success; XpDriverPtr pDriver; REQUEST_AT_LEAST_SIZE(xPrintCreateContextReq); LEGAL_NEW_RESOURCE(stuff->contextID, client); /* * Check to see if the printer name is valid. */ if((pRoot = XpDiValidatePrinter(stuff + 1, stuff->printerNameLen)) == (WindowPtr)NULL) return BadMatch; pPrintScreen = XpScreens[pRoot->drawable.pScreen->myNum]; /* * Allocate and add the context resource. */ if((pContext = (XpContextPtr) xalloc(totalContextSize)) == (XpContextPtr) NULL) return BadAlloc; InitContextPrivates(pContext); if(AddResource(stuff->contextID, RTcontext, (pointer) pContext) != TRUE) { xfree(pContext); return BadAlloc; } pContext->contextID = stuff->contextID; pContext->clientHead = (XpClientPtr)NULL; pContext->screenNum = pRoot->drawable.pScreen->myNum; pContext->state = 0; pContext->clientSlept = (ClientPtr)NULL; pContext->imageRes = 0; pContext->funcs.DestroyContext = (int (*)())NULL; pContext->funcs.StartJob = (int (*)())NULL; pContext->funcs.EndJob = (int (*)())NULL; pContext->funcs.StartDoc = (int (*)())NULL; pContext->funcs.EndDoc = (int (*)())NULL; pContext->funcs.StartPage = (int (*)())NULL; pContext->funcs.EndPage = (int (*)())NULL; pContext->funcs.PutDocumentData = (int (*)())NULL; pContext->funcs.GetDocumentData = (int (*)())NULL; pContext->funcs.GetAttributes = (char * (*)())NULL; pContext->funcs.GetOneAttribute = (char * (*)())NULL; pContext->funcs.SetAttributes = (int (*)())NULL; pContext->funcs.AugmentAttributes = (int (*)())NULL; pContext->funcs.GetMediumDimensions = (int (*)())NULL; pContext->funcs.GetReproducibleArea = (int (*)())NULL; pContext->funcs.SetImageResolution = (int (*)())NULL; if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) == (char *)NULL) { /* Freeing the context also causes the XpClients to be freed. */ FreeResource(stuff->contextID, RT_NONE); return BadAlloc; } strncpy(pContext->printerName, (char *)(stuff + 1), stuff->printerNameLen); pContext->printerName[stuff->printerNameLen] = (char)'\0'; driverName = XpDiGetDriverName(pRoot->drawable.pScreen->myNum, pContext->printerName); for(pDriver = pPrintScreen->drivers; pDriver != (XpDriverPtr)NULL; pDriver = pDriver->next) { if(!strcmp(driverName, pDriver->name)) { if(pDriver->CreateContext != (Bool (*)())NULL) pDriver->CreateContext(pContext); else return BadImplementation; break; } } if (client->noClientException != Success) return client->noClientException; else return result; } /* * SetContext creates the calling client's contextClient resource, * and stashes the contextID in the client's devPrivate. */ static int ProcXpSetContext(client) ClientPtr client; { REQUEST(xPrintSetContextReq); XpContextPtr pContext; XpClientPtr pPrintClient; int result = Success; REQUEST_AT_LEAST_SIZE(xPrintSetContextReq); if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) != (pointer)NULL) { /* * Erase this client's knowledge of its old context, if any. */ if((pPrintClient = FindClient(pContext, client)) != (XpClientPtr)NULL) { XpUnsetFontResFunc(client); if(pPrintClient->eventMask == 0) FreeXpClient(pPrintClient, TRUE); } client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL; } if(stuff->printContext == None) return Success; /* * Check to see that the supplied XID is really a valid print context * in this server. */ if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL) return BadAlloc; client->devPrivates[XpClientPrivateIndex].ptr = pContext; XpSetFontResFunc(client); if (client->noClientException != Success) return client->noClientException; else return result; } XpContextPtr XpGetPrintContext(client) ClientPtr client; { return (client->devPrivates[XpClientPrivateIndex].ptr); } static int ProcXpGetContext(client) ClientPtr client; { REQUEST(xPrintGetContextReq); xPrintGetContextReply rep; XpContextPtr pContext; XpClientPtr pNewPrintClient; int result = Success; register int n; register long l; REQUEST_SIZE_MATCH(xPrintGetContextReq); if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) == (pointer)NULL) rep.printContext = None; else rep.printContext = pContext->contextID; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swapl(&rep.printContext, l); } WriteToClient(client, sz_xPrintGetContextReply, (char *)&rep); return client->noClientException; } /* * DestroyContext frees the context associated with the calling client. * It operates by freeing the context resource ID, thus causing XpFreeContext * to be called. */ static int ProcXpDestroyContext(client) ClientPtr client; { REQUEST(xPrintDestroyContextReq); XpContextPtr pContext; XpClientPtr pXpClient; ClientPtr curClient; REQUEST_SIZE_MATCH(xPrintDestroyContextReq); if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityDestroyAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } XpUnsetFontResFunc(client); FreeResource(pContext->contextID, RT_NONE); return Success; } static int ProcXpGetContextScreen(client) ClientPtr client; { REQUEST(xPrintGetContextScreenReq); xPrintGetContextScreenReply rep; XpContextPtr pContext; int n; long l; if((pContext =(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) return XpErrorBase+XPBadContext; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.rootWindow = WindowTable[pContext->screenNum]->drawable.id; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swapl(&rep.rootWindow, l); } WriteToClient(client, sz_xPrintGetContextScreenReply, (char *)&rep); return client->noClientException; } /* * XpFreeContext is the routine called by dix:FreeResource when a context * resource ID is freed. * It checks to see if there's a partial job pending on the context, and * if so it calls the appropriate End procs with the cancel flag set. * It calls the driver's DestroyContext routine to allow the driver to clean * up any context-related memory or state. * It calls FreeXpClient to free all the * associated XpClientRecs and to set all the client->devPrivates to NULL. * It frees the printer name string, and frees the context * itself. */ static int XpFreeContext(data, id) pointer data; XID id; { XpContextPtr pContext = (XpContextPtr)data; /* Clean up any pending job on this context */ if(pContext->state != 0) { if(pContext->state & PAGE_STARTED) { WindowPtr pWin = (WindowPtr )LookupIDByType( pContext->pageWin, RT_WINDOW); XpPagePtr pPage = (XpPagePtr)LookupIDByType( pContext->pageWin, RTpage); pContext->funcs.EndPage(pContext, pWin, TRUE); SendXpNotify(pContext, XPEndPageNotify, TRUE); pContext->state &= ~PAGE_STARTED; if(pPage) pPage->context = (XpContextPtr)NULL; } if((pContext->state & DOC_RAW_STARTED) || (pContext->state & DOC_COOKED_STARTED)) { pContext->funcs.EndDoc(pContext, TRUE); SendXpNotify(pContext, XPEndDocNotify, TRUE); pContext->state &= ~DOC_RAW_STARTED; pContext->state &= ~DOC_COOKED_STARTED; } if(pContext->funcs.EndJob != (int (*)())NULL) { pContext->funcs.EndJob(pContext, TRUE); SendXpNotify(pContext, XPEndJobNotify, TRUE); pContext->state &= ~JOB_STARTED; pContext->state &= ~GET_DOC_DATA_STARTED; } } /* * Tell the driver we're destroying the context * This allows the driver to free and ContextPrivate data */ if(pContext->funcs.DestroyContext != (int (*)())NULL) pContext->funcs.DestroyContext(pContext); /* Free up all the XpClientRecs */ while(pContext->clientHead != (XpClientPtr)NULL) { FreeXpClient(pContext->clientHead, TRUE); } xfree(pContext->printerName); xfree(pContext); return Success; /* ??? */ } /* * XpFreeClient is the routine called by dix:FreeResource when a RTclient * is freed. It simply calls the FreeXpClient routine to do the work. */ static int XpFreeClient(data, id) pointer data; XID id; { FreeXpClient((XpClientPtr)data, FALSE); return Success; } /* * FreeXpClient * frees the ClientRec passed in, and sets the client->devPrivates to NULL * if the client->devPrivates points to the same context as the XpClient. * Called from XpFreeContext(from FreeResource), and * XpFreeClient. The boolean freeResource specifies whether or not to call * FreeResource for the XpClientRec's XID. We should free it except if we're * called from XpFreeClient (which is itself called from FreeResource for the * XpClientRec's XID). */ static void FreeXpClient(pXpClient, freeResource) XpClientPtr pXpClient; Bool freeResource; { XpClientPtr pCurrent, pPrev; XpContextPtr pContext = pXpClient->context; /* * If we're freeing the clientRec associated with the context tied * to the client's devPrivates, then we need to clear the devPrivates. */ if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr == pXpClient->context) { pXpClient->client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL; } for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead; pCurrent != (XpClientPtr)NULL; pCurrent = pCurrent->pNext) { if(pCurrent == pXpClient) { if(freeResource == TRUE) FreeResource (pCurrent->contextClientID, RTclient); if (pPrev != (XpClientPtr)NULL) pPrev->pNext = pCurrent->pNext; else pContext->clientHead = pCurrent->pNext; xfree (pCurrent); break; } pPrev = pCurrent; } } /* * CreateXpClient takes a ClientPtr and returns a pointer to a * XpClientRec which it allocates. It also initializes the Rec, * including adding a resource on behalf of the client to enable the * freeing of the Rec when the client's connection is closed. */ static XpClientPtr CreateXpClient(client) ClientPtr client; { XpClientPtr pNewPrintClient; XID clientResource; if((pNewPrintClient = (XpClientPtr)xalloc(sizeof(XpClientRec))) == (XpClientPtr)NULL) return (XpClientPtr)NULL; clientResource = FakeClientID(client->index); if(!AddResource(clientResource, RTclient, (pointer)pNewPrintClient)) { xfree (pNewPrintClient); return (XpClientPtr)NULL; } pNewPrintClient->pNext = (XpClientPtr)NULL; pNewPrintClient->client = client; pNewPrintClient->context = (XpContextPtr)NULL; pNewPrintClient->eventMask = 0; pNewPrintClient->contextClientID = clientResource; return pNewPrintClient; } /* * XpFreePage is the routine called by dix:FreeResource to free the page * resource built with the same ID as a page window. It checks to see * if we're in the middle of a page, and if so calls the driver's EndPage * function with 'cancel' set TRUE. It frees the memory associated with * the page resource. */ static int XpFreePage(data, id) pointer data; XID id; { XpPagePtr page = (XpPagePtr)data; int result = Success; WindowPtr pWin = (WindowPtr )LookupIDByType(id, RT_WINDOW); /* Check to see if the window's being deleted in the middle of a page */ if(page->context != (XpContextPtr)NULL && page->context->state & PAGE_STARTED) { XpScreenPtr pPrintScreen = XpScreens[page->context->screenNum]; if(page->context->funcs.EndPage != (int (*)())NULL) result = page->context->funcs.EndPage(page->context, pWin, TRUE); SendXpNotify(page->context, XPEndPageNotify, (int)TRUE); page->context->pageWin = 0; /* None, NULL??? XXX */ } xfree(page); return result; } /* * ContextPrivate machinery. * Context privates are intended for use by the drivers, allowing the * drivers to maintain context-specific data. The driver should free * the associated data at DestroyContext time. */ static void InitContextPrivates(context) XpContextPtr context; { register char *ptr; DevUnion *ppriv; register unsigned *sizes; register unsigned size; register int i; if (totalContextSize == sizeof(XpContextRec)) ppriv = (DevUnion *)NULL; else ppriv = (DevUnion *)(context + 1); context->devPrivates = ppriv; sizes = contextPrivateSizes; ptr = (char *)(ppriv + contextPrivateLen); for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++) { if ( (size = *sizes) ) { ppriv->ptr = (pointer)ptr; ptr += size; } else ppriv->ptr = (pointer)NULL; } } static void ResetContextPrivates() { contextPrivateCount = 0; contextPrivateLen = 0; xfree(contextPrivateSizes); contextPrivateSizes = (unsigned *)NULL; totalContextSize = sizeof(XpContextRec); } int XpAllocateContextPrivateIndex() { return contextPrivateCount++; } Bool XpAllocateContextPrivate(index, amount) int index; unsigned amount; { unsigned oldamount; if (index >= contextPrivateLen) { unsigned *nsizes; nsizes = (unsigned *)xrealloc(contextPrivateSizes, (index + 1) * sizeof(unsigned)); if (!nsizes) return FALSE; while (contextPrivateLen <= index) { nsizes[contextPrivateLen++] = 0; totalContextSize += sizeof(DevUnion); } contextPrivateSizes = nsizes; } oldamount = contextPrivateSizes[index]; if (amount > oldamount) { contextPrivateSizes[index] = amount; totalContextSize += (amount - oldamount); } return TRUE; } static XpClientPtr AcquireClient(pContext, client) XpContextPtr pContext; ClientPtr client; { XpClientPtr pXpClient; if((pXpClient = FindClient(pContext, client)) != (XpClientPtr)NULL) return pXpClient; if((pXpClient = CreateXpClient(client)) == (XpClientPtr)NULL) return (XpClientPtr)NULL; pXpClient->context = pContext; pXpClient->pNext = pContext->clientHead; pContext->clientHead = pXpClient; return pXpClient; } static XpClientPtr FindClient(pContext, client) XpContextPtr pContext; ClientPtr client; { XpClientPtr pXpClient; for(pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL; pXpClient = pXpClient->pNext) { if(pXpClient->client == client) return pXpClient; } return (XpClientPtr)NULL; } /****************************************************************************** * * Start/End Functions: StartJob, EndJob, StartDoc, EndDoc, StartPage, EndPage * ******************************************************************************/ static int ProcXpStartJob(client) ClientPtr client; { REQUEST(xPrintStartJobReq); XpContextPtr pContext; int result = Success; XpScreenPtr pPrintScreen; REQUEST_SIZE_MATCH(xPrintStartJobReq); /* Check to see that a context has been established by this client. */ if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadContext; if(pContext->state != 0) return XpErrorBase+XPBadSequence; if(stuff->saveData != XPSpool && stuff->saveData != XPGetData) { client->errorValue = stuff->saveData; return BadValue; } pPrintScreen = XpScreens[pContext->screenNum]; if(pContext->funcs.StartJob != (int (*)())NULL) result = pContext->funcs.StartJob(pContext, (stuff->saveData == XPGetData)? TRUE:FALSE); else return BadImplementation; pContext->state = JOB_STARTED; if(stuff->saveData == XPGetData) pContext->state |= JOB_GET_DATA; SendXpNotify(pContext, XPStartJobNotify, FALSE); if (client->noClientException != Success) return client->noClientException; else return result; } static int ProcXpEndJob(client) ClientPtr client; { REQUEST(xPrintEndJobReq); XpScreenPtr pPrintScreen; WindowPtr pWin; int result = Success; XpContextPtr pContext; REQUEST_SIZE_MATCH(xPrintEndJobReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; pPrintScreen = XpScreens[pContext->screenNum]; if(!(pContext->state & JOB_STARTED)) return XpErrorBase+XPBadSequence; /* Check for missing EndDoc */ if((pContext->state & DOC_RAW_STARTED) || (pContext->state & DOC_COOKED_STARTED)) { if(pContext->state & PAGE_STARTED) { WindowPtr pWin = (WindowPtr )LookupIDByType( pContext->pageWin, RT_WINDOW); XpPagePtr pPage = (XpPagePtr)LookupIDByType( pContext->pageWin, RTpage); if(stuff->cancel != TRUE) return XpErrorBase+XPBadSequence; if(pContext->funcs.EndPage != (int (*)())NULL) result = pContext->funcs.EndPage(pContext, pWin, TRUE); else return BadImplementation; SendXpNotify(pContext, XPEndPageNotify, TRUE); pContext->state &= ~PAGE_STARTED; if(pPage) pPage->context = (XpContextPtr)NULL; if(result != Success) return result; } if(pContext->funcs.EndDoc != (int (*)())NULL) result = pContext->funcs.EndDoc(pContext, stuff->cancel); else return BadImplementation; SendXpNotify(pContext, XPEndDocNotify, stuff->cancel); } if(pContext->funcs.EndJob != (int (*)())NULL) result = pContext->funcs.EndJob(pContext, stuff->cancel); else return BadImplementation; pContext->state = 0; SendXpNotify(pContext, XPEndJobNotify, stuff->cancel); if (client->noClientException != Success) return client->noClientException; else return result; } static Bool DoStartDoc(client, c) ClientPtr client; XpStDocPtr c; { XpScreenPtr pPrintScreen; int result = Success; XpContextPtr pContext = c->pContext; if(c->pContext->state & JOB_GET_DATA && !(c->pContext->state & GET_DOC_DATA_STARTED)) { if(!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c); c->pContext->clientSlept = client; } return TRUE; } pPrintScreen = XpScreens[pContext->screenNum]; if(pContext->funcs.StartDoc != (int (*)())NULL) result = pContext->funcs.StartDoc(pContext, c->type); else { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadImplementation); return TRUE; } if(c->type == XPDocNormal) pContext->state |= DOC_COOKED_STARTED; else pContext->state |= DOC_RAW_STARTED; SendXpNotify(pContext, XPStartDocNotify, (int)FALSE); xfree(c); return TRUE; } static int ProcXpStartDoc(client) ClientPtr client; { REQUEST(xPrintStartDocReq); XpScreenPtr pPrintScreen; int result = Success; XpContextPtr pContext; XpStDocPtr c; REQUEST_SIZE_MATCH(xPrintStartDocReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & JOB_STARTED) || pContext->state & DOC_RAW_STARTED || pContext->state & DOC_COOKED_STARTED) return XpErrorBase+XPBadSequence; if(stuff->type != XPDocNormal && stuff->type != XPDocRaw) { client->errorValue = stuff->type; return BadValue; } c = (XpStDocPtr)xalloc(sizeof(XpStDocRec)); c->pContext = pContext; c->type = stuff->type; c->slept = FALSE; (void)DoStartDoc(client, c); if (client->noClientException != Success) return client->noClientException; else return result; } static int ProcXpEndDoc(client) ClientPtr client; { REQUEST(xPrintEndDocReq); XpScreenPtr pPrintScreen; XpContextPtr pContext; int result = Success; REQUEST_SIZE_MATCH(xPrintEndDocReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; pPrintScreen = XpScreens[pContext->screenNum]; if(!(pContext->state & DOC_RAW_STARTED) && !(pContext->state & DOC_COOKED_STARTED)) return XpErrorBase+XPBadSequence; if(pContext->state & PAGE_STARTED) { if(stuff->cancel == TRUE) { WindowPtr pWin = (WindowPtr )LookupIDByType( pContext->pageWin, RT_WINDOW); XpPagePtr pPage = (XpPagePtr)LookupIDByType( pContext->pageWin, RTpage); if(pContext->funcs.EndPage != (int (*)())NULL) result = pContext->funcs.EndPage(pContext, pWin, TRUE); else return BadImplementation; SendXpNotify(pContext, XPEndPageNotify, TRUE); if(pPage) pPage->context = (XpContextPtr)NULL; } else return XpErrorBase+XPBadSequence; if(result != Success) return result; } if(pContext->funcs.EndDoc != (int (*)())NULL) result = pContext->funcs.EndDoc(pContext, stuff->cancel); else return BadImplementation; pContext->state &= ~DOC_RAW_STARTED; pContext->state &= ~DOC_COOKED_STARTED; SendXpNotify(pContext, XPEndDocNotify, stuff->cancel); if (client->noClientException != Success) return client->noClientException; else return result; } static Bool DoStartPage(client, c) ClientPtr client; XpStPagePtr c; { XpScreenPtr pPrintScreen; WindowPtr pWin = c->pWin; int result = Success; XpContextPtr pContext = c->pContext; XpPagePtr pPage; if(c->pContext->state & JOB_GET_DATA && !(c->pContext->state & GET_DOC_DATA_STARTED)) { if(!c->slept) { c->slept = TRUE; ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c); c->pContext->clientSlept = client; } return TRUE; } if(!(pContext->state & DOC_COOKED_STARTED)) { /* Implied StartDoc if it was omitted */ if(pContext->funcs.StartDoc != (int (*)())NULL) result = pContext->funcs.StartDoc(pContext, XPDocNormal); else { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadImplementation); return TRUE; } if(result != Success) { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, result); return TRUE; } pContext->state |= DOC_COOKED_STARTED; SendXpNotify(pContext, XPStartDocNotify, (int)FALSE); } /* ensure the window's not already being used as a page */ if((pPage = (XpPagePtr)LookupIDByType(c->pWin->drawable.id, RTpage)) != (XpPagePtr)NULL) { if(pPage->context != (XpContextPtr)NULL) { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadWindow); return TRUE; } } else { if((pPage = (XpPagePtr)xalloc(sizeof(XpPageRec))) == (XpPagePtr)NULL) { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadAlloc); return TRUE; } if(AddResource(c->pWin->drawable.id, RTpage, pPage) == FALSE) { xfree(pPage); SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadAlloc); return TRUE; } } pPage->context = pContext; pContext->pageWin = c->pWin->drawable.id; pPrintScreen = XpScreens[pContext->screenNum]; if(pContext->funcs.StartPage != (int (*)())NULL) result = pContext->funcs.StartPage(pContext, pWin); else { SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, BadImplementation); return TRUE; } pContext->state |= PAGE_STARTED; (void)MapWindow(pWin, client); SendXpNotify(pContext, XPStartPageNotify, (int)FALSE); return TRUE; } static int ProcXpStartPage(client) ClientPtr client; { REQUEST(xPrintStartPageReq); XpScreenPtr pPrintScreen; WindowPtr pWin; int result = Success; XpContextPtr pContext; XpPagePtr pPage; XpStPagePtr c; REQUEST_SIZE_MATCH(xPrintStartPageReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & JOB_STARTED)) return XpErrorBase+XPBadSequence; /* can't have pages in a raw documented */ if(pContext->state & DOC_RAW_STARTED) return XpErrorBase+XPBadSequence; if(pContext->state & PAGE_STARTED) return XpErrorBase+XPBadSequence; pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum) return BadWindow; if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL) return BadAlloc; c->pContext = pContext; c->slept = FALSE; c->pWin = pWin; (void)DoStartPage(client, c); if (client->noClientException != Success) return client->noClientException; else return result; } static int ProcXpEndPage(client) ClientPtr client; { REQUEST(xPrintEndPageReq); XpScreenPtr pPrintScreen; int result = Success; XpContextPtr pContext; XpPagePtr page; WindowPtr pWin; REQUEST_SIZE_MATCH(xPrintEndPageReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & PAGE_STARTED)) return XpErrorBase+XPBadSequence; pPrintScreen = XpScreens[pContext->screenNum]; pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW); /* Call the ddx's EndPage proc. */ if(pContext->funcs.EndPage != (int (*)())NULL) result = pContext->funcs.EndPage(pContext, pWin, stuff->cancel); else return BadImplementation; if((page = (XpPagePtr)LookupIDByType(pContext->pageWin, RTpage)) != (XpPagePtr)NULL) page->context = (XpContextPtr)NULL; pContext->state &= ~PAGE_STARTED; pContext->pageWin = 0; /* None, NULL??? XXX */ (void)UnmapWindow(pWin, FALSE); SendXpNotify(pContext, XPEndPageNotify, stuff->cancel); if (client->noClientException != Success) return client->noClientException; else return result; } /******************************************************************************* * * Document Data Functions: PutDocumentData, GetDocumentData * ******************************************************************************/ static int ProcXpPutDocumentData(client) ClientPtr client; { REQUEST(xPrintPutDocumentDataReq); XpContextPtr pContext; DrawablePtr pDraw; int result = Success; int len, totalSize; char *pData, *pDoc_fmt, *pOptions; REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq); if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & DOC_RAW_STARTED) && !(pContext->state & DOC_COOKED_STARTED)) return XpErrorBase+XPBadSequence; if (stuff->drawable) { if (pContext->state & DOC_RAW_STARTED) return BadDrawable; pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client); if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum) return BadDrawable; } else { if (pContext->state & DOC_COOKED_STARTED) return BadDrawable; pDraw = NULL; } pData = (char *)(&stuff[1]); totalSize = (stuff->len_data + 3) >> 2; pDoc_fmt = pData + (totalSize << 2); totalSize += (stuff->len_fmt + 3) >> 2; pOptions = pData + (totalSize << 2); totalSize += (stuff->len_options + 3) >> 2; if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len) return BadLength; if(pContext->funcs.PutDocumentData != (int (*)())NULL) { result = (*pContext->funcs.PutDocumentData)(pContext, pDraw, pData, stuff->len_data, pDoc_fmt, stuff->len_fmt, pOptions, stuff->len_options, client); } else return BadImplementation; if (client->noClientException != Success) return client->noClientException; else return result; } static int ProcXpGetDocumentData(client) ClientPtr client; { REQUEST(xPrintGetDocumentDataReq); xPrintGetDocumentDataReply rep; XpScreenPtr pPrintScreen; XpContextPtr pContext; int result = Success; REQUEST_SIZE_MATCH(xPrintGetDocumentDataReq); if((pContext = (XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(pContext->funcs.GetDocumentData == (int (*)())NULL) return BadImplementation; if(!(pContext->state & JOB_GET_DATA) || pContext->state & GET_DOC_DATA_STARTED) return XpErrorBase+XPBadSequence; if(stuff->maxBufferSize <= 0) { client->errorValue = stuff->maxBufferSize; return BadValue; /* gotta have a positive buffer size */ } result = (*pContext->funcs.GetDocumentData)(pContext, client, stuff->maxBufferSize); if(result != Success) { rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.dataLen = 0; rep.statusCode = 1; rep.finishedFlag = TRUE; if (client->swapped) { int n; long l; swaps(&rep.sequenceNumber, n); swapl(&rep.statusCode, l); /* XXX Why are these longs??? */ swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */ } (void)WriteToClient(client,sz_xPrintGetDocumentDataReply,(char *)&rep); } else pContext->state |= GET_DOC_DATA_STARTED; if(pContext->clientSlept != (ClientPtr)NULL) { ClientSignal(pContext->clientSlept); ClientWakeup(pContext->clientSlept); pContext->clientSlept = (ClientPtr)NULL; } return result; } /******************************************************************************* * * Attribute requests: GetAttributes, SetAttributes, GetOneAttribute * ******************************************************************************/ static int ProcXpGetAttributes(client) ClientPtr client; { REQUEST(xPrintGetAttributesReq); XpContextPtr pContext; char *attrs; xPrintGetAttributesReply *pRep; int totalSize, n; unsigned long l; REQUEST_SIZE_MATCH(xPrintGetAttributesReq); if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) { client->errorValue = stuff->type; return BadValue; } if(stuff->type != XPServerAttr) { if((pContext = (XpContextPtr)SecurityLookupIDByType( client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(pContext->funcs.GetAttributes == (char *(*)())NULL) return BadImplementation; if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) == (char *)NULL) return BadAlloc; } else { if((attrs = XpGetAttributes((XpContextPtr)NULL, XPServerAttr)) == (char *)NULL) return BadAlloc; } totalSize = sz_xPrintGetAttributesReply + QUADPAD(strlen(attrs)); if((pRep = (xPrintGetAttributesReply *)malloc(totalSize)) == (xPrintGetAttributesReply *)NULL) return BadAlloc; pRep->type = X_Reply; pRep->length = (totalSize - sz_xPrintGetAttributesReply) >> 2; pRep->sequenceNumber = client->sequence; pRep->stringLen = strlen(attrs); if (client->swapped) { swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, l); swapl(&pRep->stringLen, l); } strncpy((char*)(pRep + 1), attrs, strlen(attrs)); xfree(attrs); WriteToClient(client, totalSize, (char *)pRep); xfree(pRep); return client->noClientException; } static int ProcXpSetAttributes(client) ClientPtr client; { REQUEST(xPrintSetAttributesReq); int result = Success; XpContextPtr pContext; char *attr; REQUEST_AT_LEAST_SIZE(xPrintSetAttributesReq); if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) { client->errorValue = stuff->type; return BadValue; } /* * Disallow changing of read-only attribute pools */ if(stuff->type == XPPrinterAttr || stuff->type == XPServerAttr) return BadMatch; if((pContext = (XpContextPtr)SecurityLookupIDByType( client, stuff->printContext, RTcontext, SecurityWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(pContext->funcs.SetAttributes == (int (*)())NULL) return BadImplementation; /* * Check for attributes being set after their relevant phase * has already begun (e.g. Job attributes set after StartJob). */ if((pContext->state & JOB_STARTED) && stuff->type == XPJobAttr) return XpErrorBase+XPBadSequence; if(((pContext->state & DOC_RAW_STARTED) || (pContext->state & DOC_COOKED_STARTED)) && stuff->type == XPDocAttr) return XpErrorBase+XPBadSequence; if((pContext->state & PAGE_STARTED) && stuff->type == XPPageAttr) return XpErrorBase+XPBadSequence; if((attr = (char *)malloc(stuff->stringLen + 1)) == (char *)NULL) return BadAlloc; strncpy(attr, (char *)(stuff + 1), stuff->stringLen); attr[stuff->stringLen] = (char)'\0'; if(stuff->rule == XPAttrReplace) (*pContext->funcs.SetAttributes)(pContext, stuff->type, attr); else if(stuff->rule == XPAttrMerge) (*pContext->funcs.AugmentAttributes)(pContext, stuff->type, attr); else { client->errorValue = stuff->rule; result = BadValue; } xfree(attr); SendAttributeNotify(pContext, stuff->type); return result; } static int ProcXpGetOneAttribute(client) ClientPtr client; { REQUEST(xPrintGetOneAttributeReq); XpContextPtr pContext; char *value, *attrName; xPrintGetOneAttributeReply *pRep; int totalSize, n; unsigned long l; REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq); totalSize = ((sz_xPrintGetOneAttributeReq) >> 2) + ((stuff->nameLen + 3) >> 2); if(totalSize != client->req_len) return BadLength; if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) { client->errorValue = stuff->type; return BadValue; } if((attrName = (char *)malloc(stuff->nameLen + 1)) == (char *)NULL) return BadAlloc; strncpy(attrName, (char *)(stuff+1), stuff->nameLen); attrName[stuff->nameLen] = (char)'\0'; if(stuff->type != XPServerAttr) { if((pContext = (XpContextPtr)SecurityLookupIDByType( client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(pContext->funcs.GetOneAttribute == (char *(*)())NULL) return BadImplementation; if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type, attrName)) == (char *)NULL) return BadAlloc; } else { if((value = XpGetOneAttribute((XpContextPtr)NULL, XPServerAttr, attrName)) == (char *)NULL) return BadAlloc; } free(attrName); totalSize = sz_xPrintGetOneAttributeReply + QUADPAD(strlen(value)); if((pRep = (xPrintGetOneAttributeReply *)malloc(totalSize)) == (xPrintGetOneAttributeReply *)NULL) return BadAlloc; pRep->type = X_Reply; pRep->length = (totalSize - sz_xPrintGetOneAttributeReply) >> 2; pRep->sequenceNumber = client->sequence; pRep->valueLen = strlen(value); if (client->swapped) { swaps(&pRep->sequenceNumber, n); swapl(&pRep->length, l); swapl(&pRep->valueLen, l); } strncpy((char*)(pRep + 1), value, strlen(value)); WriteToClient(client, totalSize, (char *)pRep); xfree(pRep); return client->noClientException; } /******************************************************************************* * * Print Event requests: SelectInput InputSelected, SendXpNotify * ******************************************************************************/ static int ProcXpSelectInput(client) ClientPtr client; { REQUEST(xPrintSelectInputReq); int result = Success; XpContextPtr pContext; XpClientPtr pPrintClient; REQUEST_SIZE_MATCH(xPrintSelectInputReq); /* * Check to see that the supplied XID is really a valid print context * in this server. */ if((pContext=(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityWriteAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } if(stuff->eventMask & ~allEvents) { client->errorValue = stuff->eventMask; return BadValue; /* bogus event mask bits */ } if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL) return BadAlloc; pPrintClient->eventMask = stuff->eventMask; return result; } static int ProcXpInputSelected(client) ClientPtr client; { REQUEST(xPrintInputSelectedReq); xPrintInputSelectedReply rep; register int n; long l, allMask; WindowPtr pWin; XpClientPtr pXpClient; XpContextPtr pContext; REQUEST_SIZE_MATCH(xPrintInputSelectedReq); if((pContext=(XpContextPtr)SecurityLookupIDByType(client, stuff->printContext, RTcontext, SecurityReadAccess)) == (XpContextPtr)NULL) { client->errorValue = stuff->printContext; return XpErrorBase+XPBadContext; } pXpClient = FindClient(pContext, client); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.eventMask = (pXpClient != (XpClientPtr)NULL)? pXpClient->eventMask : 0; rep.allEventsMask = GetAllEventMasks(pContext); if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, l); swapl(&rep.eventMask, l); swapl(&rep.allEventsMask, l); } WriteToClient(client, sz_xPrintInputSelectedReply, (char *)&rep); return client->noClientException; } static void SendAttributeNotify(pContext, which) XpContextPtr pContext; int which; { XpClientPtr pXpClient; xPrintAttributeEvent ae; ClientPtr client; pXpClient = pContext->clientHead; if(pXpClient == (XpClientPtr)NULL) return; /* Nobody's interested in the events (or this context). */ for (pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL; pXpClient = pXpClient->pNext) { client = pXpClient->client; if (client == serverClient || client->clientGone || !(pXpClient->eventMask & XPAttributeMask)) continue; ae.type = XPAttributeNotify + XpEventBase; ae.detail = which; ae.printContext = pContext->contextID; ae.sequenceNumber = client->sequence; WriteEventsToClient (client, 1, (xEvent *) &ae); } } static void SendXpNotify(pContext, which, val) XpContextPtr pContext; int which; int val; { XpClientPtr pXpClient; xPrintPrintEvent pe; ClientPtr client; pXpClient = pContext->clientHead; if(pXpClient == (XpClientPtr)NULL) return; /* Nobody's interested in the events (or this context). */ for (pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL; pXpClient = pXpClient->pNext) { client = pXpClient->client; if (client == serverClient || client->clientGone || !(pXpClient->eventMask & XPPrintMask)) continue; pe.type = XPPrintNotify + XpEventBase; pe.detail = which; pe.printContext = pContext->contextID; pe.cancel = (Bool)val; pe.sequenceNumber = client->sequence; WriteEventsToClient (client, 1, (xEvent *) &pe); } } static CARD32 GetAllEventMasks(pContext) XpContextPtr pContext; { XpClientPtr pPrintClient; CARD32 totalMask = (CARD32)0; for (pPrintClient = pContext->clientHead; pPrintClient != (XpClientPtr)NULL; pPrintClient = pPrintClient->pNext) { totalMask |= pPrintClient->eventMask; } return totalMask; } /* * XpContextOfClient - returns the XpContextPtr to the context * associated with the specified client, or NULL if the client * does not currently have a context set. */ XpContextPtr XpContextOfClient(client) ClientPtr client; { XpContextPtr pContext; return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr; } /******************************************************************************* * * Swap-request functions * ******************************************************************************/ static int SProcXpCreateContext(client) ClientPtr client; { int i; long n; REQUEST(xPrintCreateContextReq); swaps(&stuff->length, i); swapl(&stuff->contextID, n); swapl(&stuff->printerNameLen, n); swapl(&stuff->localeLen, n); return ProcXpCreateContext(client); } static int SProcXpGetPrinterList(client) ClientPtr client; { int i; long n; REQUEST(xPrintGetPrinterListReq); swaps(&stuff->length, i); swapl(&stuff->printerNameLen, n); swapl(&stuff->localeLen, n); return ProcXpGetPrinterList(client); } static int SProcXpRehashPrinterList(client) ClientPtr client; { int i; long n; REQUEST(xPrintRehashPrinterListReq); swaps(&stuff->length, i); return ProcXpRehashPrinterList(client); } static int SProcXpSetContext(client) ClientPtr client; { int i; long n; REQUEST(xPrintSetContextReq); swaps(&stuff->length, i); swapl(&stuff->printContext, i); return ProcXpSetContext(client); } static int SProcXpGetContext(client) ClientPtr client; { int i; REQUEST(xPrintGetContextReq); swaps(&stuff->length, i); return ProcXpGetContext(client); } static int SProcXpDestroyContext(client) ClientPtr client; { int i; long n; REQUEST(xPrintDestroyContextReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpDestroyContext(client); } static int SProcXpGetContextScreen(client) ClientPtr client; { int i; long n; REQUEST(xPrintGetContextScreenReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpGetContextScreen(client); } static int SProcXpInputSelected(client) ClientPtr client; { int i; long n; REQUEST(xPrintInputSelectedReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpInputSelected(client); } static int SProcXpStartJob(client) ClientPtr client; { int i; REQUEST(xPrintStartJobReq); swaps(&stuff->length, i); return ProcXpStartJob(client); } static int SProcXpEndJob(client) ClientPtr client; { int i; REQUEST(xPrintEndJobReq); swaps(&stuff->length, i); return ProcXpEndJob(client); } static int SProcXpStartDoc(client) ClientPtr client; { int i; REQUEST(xPrintStartDocReq); swaps(&stuff->length, i); return ProcXpStartDoc(client); } static int SProcXpEndDoc(client) ClientPtr client; { int i; REQUEST(xPrintEndDocReq); swaps(&stuff->length, i); return ProcXpEndDoc(client); } static int SProcXpStartPage(client) ClientPtr client; { int i; long n; REQUEST(xPrintStartPageReq); swaps(&stuff->length, i); swapl(&stuff->window, n); return ProcXpStartPage(client); } static int SProcXpEndPage(client) ClientPtr client; { int i; REQUEST(xPrintEndPageReq); swaps(&stuff->length, i); return ProcXpEndPage(client); } static int SProcXpPutDocumentData(client) ClientPtr client; { long n; int i; REQUEST(xPrintPutDocumentDataReq); swaps(&stuff->length, i); swapl(&stuff->drawable, n); swapl(&stuff->len_data, n); swaps(&stuff->len_fmt, i); swaps(&stuff->len_options, i); return ProcXpPutDocumentData(client); } static int SProcXpGetDocumentData(client) ClientPtr client; { long n; int i; REQUEST(xPrintGetDocumentDataReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); swapl(&stuff->maxBufferSize, n); return ProcXpGetDocumentData(client); } static int SProcXpGetAttributes(client) ClientPtr client; { long n; int i; REQUEST(xPrintGetAttributesReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpGetAttributes(client); } static int SProcXpSetAttributes(client) ClientPtr client; { long n; int i; REQUEST(xPrintSetAttributesReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); swapl(&stuff->stringLen, n); return ProcXpSetAttributes(client); } static int SProcXpGetOneAttribute(client) ClientPtr client; { long n; int i; REQUEST(xPrintGetOneAttributeReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); swapl(&stuff->nameLen, n); return ProcXpGetOneAttribute(client); } static int SProcXpSelectInput(client) ClientPtr client; { long n; int i; REQUEST(xPrintSelectInputReq); swaps(&stuff->length, i); swapl(&stuff->eventMask, n); swapl(&stuff->printContext, n); return ProcXpSelectInput(client); } static int SProcXpGetPageDimensions(client) ClientPtr client; { long n; int i; REQUEST(xPrintGetPageDimensionsReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpGetPageDimensions(client); } static int SProcXpSetImageResolution(client) ClientPtr client; { long n; int i; REQUEST(xPrintSetImageResolutionReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); swaps(&stuff->imageRes, i); return ProcXpSetImageResolution(client); } static int SProcXpGetImageResolution(client) ClientPtr client; { long n; int i; REQUEST(xPrintGetImageResolutionReq); swaps(&stuff->length, i); swapl(&stuff->printContext, n); return ProcXpGetImageResolution(client); } static void SwapXpNotifyEvent(src, dst) xPrintPrintEvent *src, *dst; { /* * Swap the sequence number and context fields. */ cpswaps(src->sequenceNumber, dst->sequenceNumber); cpswapl(src->printContext, dst->printContext); /* * Copy the byte-long fields. */ dst->type = src->type; dst->detail = src->detail; dst->cancel = src->cancel; } static void SwapXpAttributeEvent(src, dst) xPrintAttributeEvent *src, *dst; { /* * Swap the sequence number and context fields. */ cpswaps(src->sequenceNumber, dst->sequenceNumber); cpswapl(src->printContext, dst->printContext); /* * Copy the byte-long fields. */ dst->type = src->type; dst->detail = src->detail; } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xcmisc.c0100664000076400007640000001403207120677563021275 0ustar constconst/* $XConsortium: xcmisc.c /main/5 1996/08/01 19:23:23 dpw $ */ /* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.2 1996/12/23 06:29:03 dawes Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define NEED_EVENTS #define NEED_REPLIES #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" #include "xcmiscstr.h" static unsigned char XCMiscCode; static void XCMiscResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static DISPATCH_PROC(ProcXCMiscDispatch); static DISPATCH_PROC(ProcXCMiscGetVersion); static DISPATCH_PROC(ProcXCMiscGetXIDList); static DISPATCH_PROC(ProcXCMiscGetXIDRange); static DISPATCH_PROC(SProcXCMiscDispatch); static DISPATCH_PROC(SProcXCMiscGetVersion); static DISPATCH_PROC(SProcXCMiscGetXIDList); static DISPATCH_PROC(SProcXCMiscGetXIDRange); void XCMiscExtensionInit() { ExtensionEntry *extEntry; if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0, ProcXCMiscDispatch, SProcXCMiscDispatch, XCMiscResetProc, StandardMinorOpcode)) != 0) XCMiscCode = (unsigned char)extEntry->base; DeclareExtensionSecurity(XCMiscExtensionName, TRUE); } /*ARGSUSED*/ static void XCMiscResetProc (extEntry) ExtensionEntry *extEntry; { } static int ProcXCMiscGetVersion(client) register ClientPtr client; { xXCMiscGetVersionReply rep; register int n; REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XCMiscMajorVersion; rep.minorVersion = XCMiscMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *)&rep); return(client->noClientException); } static int ProcXCMiscGetXIDRange(client) register ClientPtr client; { xXCMiscGetXIDRangeReply rep; register int n; XID min_id, max_id; REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.start_id = min_id; rep.count = max_id - min_id + 1; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.start_id, n); swapl(&rep.count, n); } WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *)&rep); return(client->noClientException); } static int ProcXCMiscGetXIDList(client) register ClientPtr client; { REQUEST(xXCMiscGetXIDListReq); xXCMiscGetXIDListReply rep; register int n; XID *pids; unsigned int count; REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); pids = (XID *)ALLOCATE_LOCAL(stuff->count * sizeof(XID)); if (!pids) { return BadAlloc; } count = GetXIDList(client, stuff->count, pids); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = count; rep.count = count; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.count, n); } WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XID), pids); } DEALLOCATE_LOCAL(pids); return(client->noClientException); } static int ProcXCMiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XCMiscGetVersion: return ProcXCMiscGetVersion(client); case X_XCMiscGetXIDRange: return ProcXCMiscGetXIDRange(client); case X_XCMiscGetXIDList: return ProcXCMiscGetXIDList(client); default: return BadRequest; } } static int SProcXCMiscGetVersion(client) register ClientPtr client; { register int n; REQUEST(xXCMiscGetVersionReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); swaps(&stuff->majorVersion, n); swaps(&stuff->minorVersion, n); return ProcXCMiscGetVersion(client); } static int SProcXCMiscGetXIDRange(client) register ClientPtr client; { register int n; REQUEST(xReq); swaps(&stuff->length, n); return ProcXCMiscGetXIDRange(client); } static int SProcXCMiscGetXIDList(client) register ClientPtr client; { register int n; REQUEST(xXCMiscGetXIDListReq); swaps(&stuff->length, n); swapl(&stuff->count, n); return ProcXCMiscGetXIDList(client); } static int SProcXCMiscDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XCMiscGetVersion: return SProcXCMiscGetVersion(client); case X_XCMiscGetXIDRange: return SProcXCMiscGetXIDRange(client); case X_XCMiscGetXIDList: return SProcXCMiscGetXIDList(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/xf86vmode.c0100664000076400007640000013601207120677563021640 0ustar constconst/* $XFree86: xc/programs/Xserver/Xext/xf86vmode.c,v 3.30.2.3 1997/06/11 12:08:44 dawes Exp $ */ /* Copyright (c) 1995 Kaleb S. KEITHLEY Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Kaleb S. KEITHLEY shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Kaleb S. KEITHLEY */ /* $XConsortium: xf86vmode.c /main/24 1996/10/26 21:56:29 kaleb $ */ /* THIS IS NOT AN X CONSORTIUM STANDARD */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "scrnintstr.h" #include "servermd.h" #define _XF86VIDMODE_SERVER_ #include "xf86vmstr.h" #include "Xfuncproto.h" #include "../hw/xfree86/common/xf86.h" #include "../hw/xfree86/common/xf86Priv.h" #include #include "../os/osdep.h" #include #ifndef ESIX #ifndef Lynx #include #else #include #endif #else #include #endif #include "swaprep.h" extern int xf86ScreenIndex; extern Bool xf86VidModeEnabled; extern Bool xf86VidModeAllowNonLocal; static int vidmodeErrorBase; static void XF86VidModeResetProc( #if NeedFunctionPrototypes ExtensionEntry* /* extEntry */ #endif ); static DISPATCH_PROC(ProcXF86VidModeDispatch); static DISPATCH_PROC(ProcXF86VidModeGetAllModeLines); static DISPATCH_PROC(ProcXF86VidModeGetModeLine); static DISPATCH_PROC(ProcXF86VidModeGetMonitor); static DISPATCH_PROC(ProcXF86VidModeLockModeSwitch); static DISPATCH_PROC(ProcXF86VidModeAddModeLine); static DISPATCH_PROC(ProcXF86VidModeDeleteModeLine); static DISPATCH_PROC(ProcXF86VidModeModModeLine); static DISPATCH_PROC(ProcXF86VidModeValidateModeLine); static DISPATCH_PROC(ProcXF86VidModeQueryVersion); static DISPATCH_PROC(ProcXF86VidModeSwitchMode); static DISPATCH_PROC(ProcXF86VidModeSwitchToMode); static DISPATCH_PROC(ProcXF86VidModeGetViewPort); static DISPATCH_PROC(ProcXF86VidModeSetViewPort); static DISPATCH_PROC(SProcXF86VidModeDispatch); static DISPATCH_PROC(SProcXF86VidModeGetAllModeLines); static DISPATCH_PROC(SProcXF86VidModeGetModeLine); static DISPATCH_PROC(SProcXF86VidModeGetMonitor); static DISPATCH_PROC(SProcXF86VidModeLockModeSwitch); static DISPATCH_PROC(SProcXF86VidModeAddModeLine); static DISPATCH_PROC(SProcXF86VidModeDeleteModeLine); static DISPATCH_PROC(SProcXF86VidModeModModeLine); static DISPATCH_PROC(SProcXF86VidModeValidateModeLine); static DISPATCH_PROC(SProcXF86VidModeQueryVersion); static DISPATCH_PROC(SProcXF86VidModeSwitchMode); static DISPATCH_PROC(SProcXF86VidModeSwitchToMode); static DISPATCH_PROC(SProcXF86VidModeGetViewPort); static DISPATCH_PROC(SProcXF86VidModeSetViewPort); static unsigned char XF86VidModeReqCode = 0; /* The XF86VIDMODE_EVENTS code is far from complete */ #ifdef XF86VIDMODE_EVENTS static int XF86VidModeEventBase = 0; static void SXF86VidModeNotifyEvent(); #if NeedFunctionPrototypes xXF86VidModeNotifyEvent * /* from */, xXF86VidModeNotifyEvent * /* to */ #endif ); extern WindowPtr *WindowTable; static RESTYPE EventType; /* resource type for event masks */ typedef struct _XF86VidModeEvent *XF86VidModeEventPtr; typedef struct _XF86VidModeEvent { XF86VidModeEventPtr next; ClientPtr client; ScreenPtr screen; XID resource; CARD32 mask; } XF86VidModeEventRec; static int XF86VidModeFreeEvents(); typedef struct _XF86VidModeScreenPrivate { XF86VidModeEventPtr events; Bool hasWindow; } XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr; static int ScreenPrivateIndex; #define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) #define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s) #define New(t) ((t *) xalloc (sizeof (t))) #endif void XFree86VidModeExtensionInit() { ExtensionEntry* extEntry; #ifdef XF86VIDMODE_EVENTS int i; ScreenPtr pScreen; EventType = CreateNewResourceType(XF86VidModeFreeEvents); ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } #endif if ( #ifdef XF86VIDMODE_EVENTS EventType && ScreenPrivateIndex != -1 && #endif (extEntry = AddExtension(XF86VIDMODENAME, XF86VidModeNumberEvents, XF86VidModeNumberErrors, ProcXF86VidModeDispatch, SProcXF86VidModeDispatch, XF86VidModeResetProc, StandardMinorOpcode))) { XF86VidModeReqCode = (unsigned char)extEntry->base; vidmodeErrorBase = extEntry->errorBase; #ifdef XF86VIDMODE_EVENTS XF86VidModeEventBase = extEntry->eventBase; EventSwapVector[XF86VidModeEventBase] = SXF86VidModeNotifyEvent; #endif } } /*ARGSUSED*/ static void XF86VidModeResetProc (extEntry) ExtensionEntry* extEntry; { } #ifdef XF86VIDMODE_EVENTS static void CheckScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (!pPriv) return; if (!pPriv->events && !pPriv->hasWindow) { xfree (pPriv); SetScreenPrivate (pScreen, NULL); } } static XF86VidModeScreenPrivatePtr MakeScreenPrivate (pScreen) ScreenPtr pScreen; { SetupScreen (pScreen); if (pPriv) return pPriv; pPriv = New (XF86VidModeScreenPrivateRec); if (!pPriv) return 0; pPriv->events = 0; pPriv->hasWindow = FALSE; SetScreenPrivate (pScreen, pPriv); return pPriv; } static unsigned long getEventMask (pScreen, client) ScreenPtr pScreen; ClientPtr client; { SetupScreen(pScreen); XF86VidModeEventPtr pEv; if (!pPriv) return 0; for (pEv = pPriv->events; pEv; pEv = pEv->next) if (pEv->client == client) return pEv->mask; return 0; } static Bool setEventMask (pScreen, client, mask) ScreenPtr pScreen; ClientPtr client; unsigned long mask; { SetupScreen(pScreen); XF86VidModeEventPtr pEv, *pPrev; if (getEventMask (pScreen, client) == mask) return TRUE; if (!pPriv) { pPriv = MakeScreenPrivate (pScreen); if (!pPriv) return FALSE; } for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next) if (pEv->client == client) break; if (mask == 0) { *pPrev = pEv->next; xfree (pEv); CheckScreenPrivate (pScreen); } else { if (!pEv) { pEv = New (ScreenSaverEventRec); if (!pEv) { CheckScreenPrivate (pScreen); return FALSE; } *pPrev = pEv; pEv->next = NULL; pEv->client = client; pEv->screen = pScreen; pEv->resource = FakeClientID (client->index); } pEv->mask = mask; } return TRUE; } static int XF86VidModeFreeEvents (value, id) pointer value; XID id; { XF86VidModeEventPtr pOld = (XF86VidModeEventPtr)value; ScreenPtr pScreen = pOld->screen; SetupScreen (pScreen); XF86VidModeEventPtr pEv, *pPrev; if (!pPriv) return TRUE; for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next) if (pEv == pOld) break; if (!pEv) return TRUE; *pPrev = pEv->next; xfree (pEv); CheckScreenPrivate (pScreen); return TRUE; } static void SendXF86VidModeNotify (pScreen, state, forced) ScreenPtr pScreen; int state; Bool forced; { XF86VidModeScreenPrivatePtr pPriv; XF86VidModeEventPtr pEv; unsigned long mask; xXF86VidModeNotifyEvent ev; ClientPtr client; int kind; UpdateCurrentTimeIf (); mask = XF86VidModeNotifyMask; pScreen = screenInfo.screens[pScreen->myNum]; pPriv = GetScreenPrivate(pScreen); if (!pPriv) return; kind = XF86VidModeModeChange; for (pEv = pPriv->events; pEv; pEv = pEv->next) { client = pEv->client; if (client->clientGone) continue; if (!(pEv->mask & mask)) continue; ev.type = XF86VidModeNotify + XF86VidModeEventBase; ev.state = state; ev.sequenceNumber = client->sequence; ev.timestamp = currentTime.milliseconds; ev.root = WindowTable[pScreen->myNum]->drawable.id; ev.kind = kind; ev.forced = forced; WriteEventsToClient (client, 1, (xEvent *) &ev); } } static void SXF86VidModeNotifyEvent (from, to) xXF86VidModeNotifyEvent *from, *to; { to->type = from->type; to->state = from->state; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->timestamp, to->timestamp); cpswapl (from->root, to->root); to->kind = from->kind; to->forced = from->forced; } #endif static int ProcXF86VidModeQueryVersion(client) register ClientPtr client; { xXF86VidModeQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = XF86VIDMODE_MAJOR_VERSION; rep.minorVersion = XF86VIDMODE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); } WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *)&rep); return (client->noClientException); } static int ProcXF86VidModeGetModeLine(client) register ClientPtr client; { REQUEST(xXF86VidModeGetModeLineReq); xXF86VidModeGetModeLineReply rep; register int n; ScrnInfoPtr vptr; DisplayModePtr mptr; int privsize; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; mptr = vptr->modes; if (!mptr->Private) privsize = 0; else privsize = mptr->PrivSize; REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); rep.type = X_Reply; rep.length = (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xGenericReply) + privsize * sizeof(INT32)) >> 2; rep.sequenceNumber = client->sequence; rep.dotclock = vptr->clock[mptr->Clock]; rep.hdisplay = mptr->HDisplay; rep.hsyncstart = mptr->HSyncStart; rep.hsyncend = mptr->HSyncEnd; rep.htotal = mptr->HTotal; rep.vdisplay = mptr->VDisplay; rep.vsyncstart = mptr->VSyncStart; rep.vsyncend = mptr->VSyncEnd; rep.vtotal = mptr->VTotal; rep.flags = mptr->Flags; rep.privsize = privsize; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.dotclock, n); swaps(&rep.hdisplay, n); swaps(&rep.hsyncstart, n); swaps(&rep.hsyncend, n); swaps(&rep.htotal, n); swaps(&rep.vdisplay, n); swaps(&rep.vsyncstart, n); swaps(&rep.vsyncend, n); swaps(&rep.vtotal, n); swapl(&rep.flags, n); swapl(&rep.privsize, n); } WriteToClient(client, sizeof(xXF86VidModeGetModeLineReply), (char *)&rep); if (privsize) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, privsize * sizeof(INT32), mptr->Private); } return (client->noClientException); } static int ProcXF86VidModeGetAllModeLines(client) register ClientPtr client; { REQUEST(xXF86VidModeGetAllModeLinesReq); xXF86VidModeGetAllModeLinesReply rep; xXF86VidModeModeInfo mdinf; register int n; ScrnInfoPtr vptr; DisplayModePtr mptr, curmptr; int privsize, modecount=1; int totalPrivSize = 0; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; curmptr = mptr = vptr->modes; totalPrivSize = mptr->Private ? mptr->PrivSize : 0; while (mptr->next != curmptr) { ++modecount; mptr = mptr->next; if (mptr->Private) totalPrivSize += mptr->PrivSize; } REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); rep.type = X_Reply; rep.length = (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xGenericReply) + modecount * sizeof(xXF86VidModeModeInfo) + totalPrivSize * sizeof(INT32)) >> 2; rep.sequenceNumber = client->sequence; rep.modecount = modecount; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.modecount, n); } WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), (char *)&rep); mptr = curmptr; do { if (!mptr->Private) privsize = 0; else privsize = mptr->PrivSize; mdinf.dotclock = vptr->clock[mptr->Clock]; mdinf.hdisplay = mptr->HDisplay; mdinf.hsyncstart = mptr->HSyncStart; mdinf.hsyncend = mptr->HSyncEnd; mdinf.htotal = mptr->HTotal; mdinf.vdisplay = mptr->VDisplay; mdinf.vsyncstart = mptr->VSyncStart; mdinf.vsyncend = mptr->VSyncEnd; mdinf.vtotal = mptr->VTotal; mdinf.flags = mptr->Flags; mdinf.privsize = privsize; if (client->swapped) { swapl(&mdinf.dotclock, n); swaps(&mdinf.hdisplay, n); swaps(&mdinf.hsyncstart, n); swaps(&mdinf.hsyncend, n); swaps(&mdinf.htotal, n); swaps(&mdinf.vdisplay, n); swaps(&mdinf.vsyncstart, n); swaps(&mdinf.vsyncend, n); swaps(&mdinf.vtotal, n); swapl(&mdinf.flags, n); swapl(&mdinf.privsize, n); } WriteToClient(client, sizeof(xXF86VidModeModeInfo), (char *)&mdinf); if (privsize) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, privsize * sizeof(INT32), mptr->Private); } mptr = mptr->next; } while (mptr != curmptr); return (client->noClientException); } #define CLOCKSPD(clk,scrp) ((clk>MAXCLOCKS)? clk: scrp->clock[clk]) #define MODEMATCH(mptr,stuff,scrp) \ (CLOCKSPD(mptr->Clock,scrp) == CLOCKSPD(stuff->dotclock,scrp) \ && mptr->HDisplay == stuff->hdisplay \ && mptr->HSyncStart== stuff->hsyncstart \ && mptr->HSyncEnd == stuff->hsyncend \ && mptr->HTotal == stuff->htotal \ && mptr->VDisplay == stuff->vdisplay \ && mptr->VSyncStart== stuff->vsyncstart \ && mptr->VSyncEnd == stuff->vsyncend \ && mptr->VTotal == stuff->vtotal \ && mptr->Flags == stuff->flags ) #include "xf86_Config.h" static int ProcXF86VidModeAddModeLine(client) register ClientPtr client; { REQUEST(xXF86VidModeAddModeLineReq); ScrnInfoPtr vptr; DisplayModePtr curmptr, mptr, newmptr; Bool clock_added = FALSE; int i, len; if (xf86Verbose > 1) { ErrorF("AddModeLine - scrn: %d clock: %d\n", stuff->screen, stuff->dotclock); ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, stuff->flags); ErrorF(" after - scrn: %d clock: %d\n", stuff->screen, stuff->after_dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->after_hdisplay, stuff->after_hsyncstart, stuff->after_hsyncend, stuff->after_htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->after_vdisplay, stuff->after_vsyncstart, stuff->after_vsyncend, stuff->after_vtotal, stuff->after_flags); } if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; curmptr = mptr = vptr->modes; REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq); len = client->req_len - (sizeof(xXF86VidModeAddModeLineReq) >> 2); if (len != stuff->privsize) return BadLength; if (stuff->hsyncstart < stuff->hdisplay || stuff->hsyncend < stuff->hsyncstart || stuff->htotal < stuff->hsyncend || stuff->vsyncstart < stuff->vdisplay || stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend) return BadValue; if (stuff->after_hsyncstart < stuff->after_hdisplay || stuff->after_hsyncend < stuff->after_hsyncstart || stuff->after_htotal < stuff->after_hsyncend || stuff->after_vsyncstart < stuff->after_vdisplay || stuff->after_vsyncend < stuff->after_vsyncstart || stuff->after_vtotal < stuff->after_vsyncend) return BadValue; if (stuff->after_htotal != 0 || stuff->after_vtotal != 0) { Bool found = FALSE; do { if (MODEMATCH(mptr, stuff, vptr)) { found = TRUE; break; } } while ((mptr = mptr->next) != curmptr); if (!found) return BadValue; } newmptr = (DisplayModePtr) xalloc(sizeof(DisplayModeRec)); /* Clock checking code, mostly copied from the xf86LookupMode function */ if (stuff->dotclock < vptr->clocks) { newmptr->Clock = stuff->dotclock; } else { if ((OFLG_ISSET(CLOCK_OPTION_PROGRAMABLE, &(vptr->clockOptions))) && !OFLG_ISSET(OPTION_NO_PROGRAM_CLOCKS, &(vptr->options))) { for (i = 0; i < vptr->clocks; i++) if (stuff->dotclock == vptr->clock[i]) break; if (i >= MAXCLOCKS || vptr->clock[i]/1000 > vptr->maxClock/1000) { xfree(newmptr); return vidmodeErrorBase + XF86VidModeBadClock; } if (i == vptr->clocks) { vptr->clock[i] = stuff->dotclock; vptr->clocks++; clock_added = TRUE; } } else { int flags=0, j, k, Gap, Minimum_Gap = CLOCK_TOLERANCE + 1; double refresh, bestRefresh = 0.0; if (OFLG_ISSET(OPTION_CLKDIV2, &(vptr->options))) k=2; else k=1; if (xf86BestRefresh) flags |= LOOKUP_BEST_REFRESH; for (j=1 ; j<=k ; j++) { i = xf86GetNearestClock(vptr, stuff->dotclock * j); if (flags & LOOKUP_BEST_REFRESH) { if ( ((vptr->clock[i]/j) / 1000) > (vptr->maxClock / 1000) ) { xfree(newmptr); return vidmodeErrorBase + XF86VidModeBadClock; } else { refresh = stuff->dotclock * 1000.0 / stuff->htotal / stuff->vtotal; if (stuff->flags & V_INTERLACE) { refresh *= 2; refresh /= INTERLACE_REFRESH_WEIGHT; } else if (stuff->flags & V_DBLSCAN) refresh /= 2; if (refresh > bestRefresh) { newmptr->Clock = i; if (j==2) stuff->flags |= V_CLKDIV2; bestRefresh = refresh; } } } else { Gap = abs( stuff->dotclock - (vptr->clock[i]/j) ); if (Gap < Minimum_Gap) { if ( ((vptr->clock[i]/j) / 1000) > (vptr->maxClock / 1000) ) { xfree(newmptr); return vidmodeErrorBase + XF86VidModeBadClock; } else { newmptr->Clock = i; if (j==2) stuff->flags |= V_CLKDIV2; Minimum_Gap = Gap; } } } } } } newmptr->CrtcHDisplay = newmptr->HDisplay = stuff->hdisplay; newmptr->CrtcHSyncStart= newmptr->HSyncStart = stuff->hsyncstart; newmptr->CrtcHSyncEnd = newmptr->HSyncEnd = stuff->hsyncend; newmptr->CrtcHTotal = newmptr->HTotal = stuff->htotal; newmptr->CrtcVDisplay = newmptr->VDisplay = stuff->vdisplay; newmptr->CrtcVSyncStart= newmptr->VSyncStart = stuff->vsyncstart; newmptr->CrtcVSyncEnd = newmptr->VSyncEnd = stuff->vsyncend; newmptr->CrtcVTotal = newmptr->VTotal = stuff->vtotal; newmptr->Flags = stuff->flags; #if 0 newmptr->CrtcHSkew = newmptr->HSkew = stuff->hskew; #endif newmptr->CrtcHAdjusted = FALSE; newmptr->CrtcVAdjusted = FALSE; newmptr->name = ""; newmptr->Private = NULL; if (stuff->privsize) { if (xf86Verbose > 1) ErrorF("AddModeLine - Request includes privates\n"); newmptr->Private = (INT32 *) ALLOCATE_LOCAL(stuff->privsize * sizeof(INT32)); memcpy(newmptr->Private, &stuff[1], stuff->privsize*sizeof(INT32)); } /* Check that the mode is consistent with the monitor specs */ switch (xf86CheckMode(vptr, newmptr, vptr->monitor, FALSE)) { case MODE_OK: break; case MODE_HSYNC: xfree(newmptr->Private); xfree(newmptr); if (clock_added) vptr->clocks--; return vidmodeErrorBase + XF86VidModeBadHTimings; case MODE_VSYNC: xfree(newmptr->Private); xfree(newmptr); if (clock_added) vptr->clocks--; return vidmodeErrorBase + XF86VidModeBadVTimings; default: if (clock_added) vptr->clocks--; return vidmodeErrorBase + XF86VidModeModeUnsuitable; } /* Check that the driver is happy with the mode */ if (vptr->ValidMode(newmptr, xf86Verbose, MODE_VID) != MODE_OK) { xfree(newmptr->Private); xfree(newmptr); if (clock_added) vptr->clocks--; return vidmodeErrorBase + XF86VidModeModeUnsuitable; } if (newmptr->Flags & V_DBLSCAN) { newmptr->CrtcVDisplay *= 2; newmptr->CrtcVSyncStart *= 2; newmptr->CrtcVSyncEnd *= 2; newmptr->CrtcVTotal *= 2; newmptr->CrtcVAdjusted = TRUE; } newmptr->next = mptr->next; newmptr->prev = mptr; mptr->next = newmptr; newmptr->next->prev = newmptr; #if 0 /* Do we want this? */ (vptr->SwitchMode)(newmptr); #endif if (xf86Verbose > 1) ErrorF("AddModeLine - Succeeded\n"); return(client->noClientException); } static int ProcXF86VidModeDeleteModeLine(client) register ClientPtr client; { REQUEST(xXF86VidModeDeleteModeLineReq); ScrnInfoPtr vptr; DisplayModePtr curmptr, mptr; int len; if (xf86Verbose > 1) { ErrorF("DeleteModeLine - scrn: %d clock: %d\n", stuff->screen, stuff->dotclock, stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, stuff->flags); } if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; curmptr = mptr = vptr->modes; REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq); len = client->req_len - (sizeof(xXF86VidModeDeleteModeLineReq) >> 2); if (len != stuff->privsize) { if (xf86Verbose > 1) { ErrorF("req_len = %d, sizeof(Req) = %d, privsize = %d, len = %d, length = %d\n", client->req_len, sizeof(xXF86VidModeDeleteModeLineReq)>>2, stuff->privsize, len, stuff->length); } return BadLength; } if (xf86Verbose > 1) { ErrorF("Checking against clock: %d (%d)\n", mptr->Clock, CLOCKSPD(mptr->Clock, vptr)); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", mptr->HDisplay, mptr->HSyncStart, mptr->HSyncEnd, mptr->HTotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", mptr->VDisplay, mptr->VSyncStart, mptr->VSyncEnd, mptr->VTotal, mptr->Flags); } if (MODEMATCH(mptr, stuff, vptr)) return BadValue; while ((mptr = mptr->next) != curmptr) { if (xf86Verbose > 1) { ErrorF("Checking against clock: %d (%d)\n", mptr->Clock, CLOCKSPD(mptr->Clock, vptr)); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", mptr->HDisplay, mptr->HSyncStart, mptr->HSyncEnd, mptr->HTotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", mptr->VDisplay, mptr->VSyncStart, mptr->VSyncEnd, mptr->VTotal, mptr->Flags); } if (MODEMATCH(mptr, stuff, vptr)) { mptr->prev->next = mptr->next; mptr->next->prev = mptr->prev; xfree(mptr->name); xfree(mptr->Private); xfree(mptr); if (xf86Verbose) ErrorF("DeleteModeLine - Succeeded\n"); return(client->noClientException); } } return BadValue; } static int ProcXF86VidModeModModeLine(client) register ClientPtr client; { REQUEST(xXF86VidModeModModeLineReq); ScrnInfoPtr vptr; DisplayModePtr mptr; DisplayModeRec modetmp; int len; if (xf86Verbose > 1) { ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->screen, stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, stuff->flags); } if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; mptr = vptr->modes; REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq); len = client->req_len - (sizeof(xXF86VidModeModModeLineReq) >> 2); if (len != stuff->privsize) return BadLength; if (stuff->hsyncstart < stuff->hdisplay || stuff->hsyncend < stuff->hsyncstart || stuff->htotal < stuff->hsyncend || stuff->vsyncstart < stuff->vdisplay || stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend) return BadValue; memcpy(&modetmp, mptr, sizeof(DisplayModeRec)); modetmp.HDisplay = stuff->hdisplay; modetmp.HSyncStart = stuff->hsyncstart; modetmp.HSyncEnd = stuff->hsyncend; modetmp.HTotal = stuff->htotal; modetmp.VDisplay = stuff->vdisplay; modetmp.VSyncStart = stuff->vsyncstart; modetmp.VSyncEnd = stuff->vsyncend; modetmp.VTotal = stuff->vtotal; modetmp.Flags = stuff->flags; if (mptr->PrivSize && stuff->privsize) { if (mptr->PrivSize != stuff->privsize) return BadValue; } if (mptr->PrivSize && mptr->Private) { modetmp.Private = (INT32 *)ALLOCATE_LOCAL(mptr->PrivSize * sizeof(INT32)); if (stuff->privsize) { if (xf86Verbose > 1) ErrorF("ModModeLine - Request includes privates\n"); memcpy(modetmp.Private, &stuff[1], mptr->PrivSize * sizeof(INT32)); } else memcpy(modetmp.Private, mptr->Private, mptr->PrivSize * sizeof(INT32)); } /* Check that the mode is consistent with the monitor specs */ switch (xf86CheckMode(vptr, &modetmp, vptr->monitor, FALSE)) { case MODE_HSYNC: DEALLOCATE_LOCAL(modetmp.Private); return vidmodeErrorBase + XF86VidModeBadHTimings; case MODE_VSYNC: DEALLOCATE_LOCAL(modetmp.Private); return vidmodeErrorBase + XF86VidModeBadVTimings; } /* Check that the driver is happy with the mode */ if (vptr->ValidMode(&modetmp, xf86Verbose, MODE_VID) != MODE_OK) { DEALLOCATE_LOCAL(modetmp.Private); return vidmodeErrorBase + XF86VidModeModeUnsuitable; } DEALLOCATE_LOCAL(modetmp.Private); mptr->HDisplay = stuff->hdisplay; mptr->HSyncStart = stuff->hsyncstart; mptr->HSyncEnd = stuff->hsyncend; mptr->HTotal = stuff->htotal; mptr->VDisplay = stuff->vdisplay; mptr->VSyncStart = stuff->vsyncstart; mptr->VSyncEnd = stuff->vsyncend; mptr->VTotal = stuff->vtotal; mptr->Flags = stuff->flags; mptr->CrtcHDisplay = stuff->hdisplay; mptr->CrtcHSyncStart = stuff->hsyncstart; mptr->CrtcHSyncEnd = stuff->hsyncend; mptr->CrtcHTotal = stuff->htotal; mptr->CrtcVDisplay = stuff->vdisplay; mptr->CrtcVSyncStart = stuff->vsyncstart; mptr->CrtcVSyncEnd = stuff->vsyncend; mptr->CrtcVTotal = stuff->vtotal; mptr->CrtcVAdjusted = FALSE; mptr->CrtcHAdjusted = FALSE; if (mptr->Flags & V_DBLSCAN) { mptr->CrtcVDisplay *= 2; mptr->CrtcVSyncStart *= 2; mptr->CrtcVSyncEnd *= 2; mptr->CrtcVTotal *= 2; mptr->CrtcVAdjusted = TRUE; } if (mptr->PrivSize && stuff->privsize) { memcpy(mptr->Private, &stuff[1], mptr->PrivSize * sizeof(INT32)); } (vptr->SwitchMode)(mptr); (vptr->AdjustFrame)(vptr->frameX0, vptr->frameY0); if (xf86Verbose > 1) ErrorF("ModModeLine - Succeeded\n"); return(client->noClientException); } static int ProcXF86VidModeValidateModeLine(client) register ClientPtr client; { REQUEST(xXF86VidModeValidateModeLineReq); xXF86VidModeValidateModeLineReply rep; ScrnInfoPtr vptr; DisplayModePtr mptr; DisplayModeRec modetmp; int len, status; if (xf86Verbose > 1) { ErrorF("ValidateModeLine - scrn: %d clock: %d\n", stuff->screen, stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, stuff->flags); } if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; mptr = vptr->modes; REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq); len = client->req_len - (sizeof(xXF86VidModeValidateModeLineReq) >> 2); if (len != stuff->privsize) return BadLength; status = MODE_OK; modetmp.Private = NULL; if (stuff->hsyncstart < stuff->hdisplay || stuff->hsyncend < stuff->hsyncstart || stuff->htotal < stuff->hsyncend || stuff->vsyncstart < stuff->vdisplay || stuff->vsyncend < stuff->vsyncstart || stuff->vtotal < stuff->vsyncend) { status = MODE_BAD; goto status_reply; } memcpy(&modetmp, mptr, sizeof(DisplayModeRec)); modetmp.HDisplay = stuff->hdisplay; modetmp.HSyncStart = stuff->hsyncstart; modetmp.HSyncEnd = stuff->hsyncend; modetmp.HTotal = stuff->htotal; modetmp.VDisplay = stuff->vdisplay; modetmp.VSyncStart = stuff->vsyncstart; modetmp.VSyncEnd = stuff->vsyncend; modetmp.VTotal = stuff->vtotal; modetmp.Flags = stuff->flags; modetmp.Private = NULL; if (mptr->PrivSize && stuff->privsize) { if (mptr->PrivSize != stuff->privsize) { status = MODE_BAD; goto status_reply; } } if (mptr->PrivSize && mptr->Private) { modetmp.Private = (INT32 *)ALLOCATE_LOCAL(mptr->PrivSize * sizeof(INT32)); if (stuff->privsize) { if (xf86Verbose) ErrorF("ValidateModeLine - Request includes privates\n"); memcpy(modetmp.Private, &stuff[1], mptr->PrivSize * sizeof(INT32)); } else memcpy(modetmp.Private, mptr->Private, mptr->PrivSize * sizeof(INT32)); } /* Check that the mode is consistent with the monitor specs */ if ((status = xf86CheckMode(vptr, &modetmp, vptr->monitor, FALSE)) != MODE_OK) goto status_reply; /* Check that the driver is happy with the mode */ status = vptr->ValidMode(&modetmp, xf86Verbose, MODE_VID); status_reply: if (modetmp.Private) DEALLOCATE_LOCAL(modetmp.Private); rep.type = X_Reply; rep.length = (SIZEOF(xXF86VidModeValidateModeLineReply) - SIZEOF(xGenericReply)) >> 2; rep.sequenceNumber = client->sequence; rep.status = status; if (client->swapped) { register int n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.status, n); } WriteToClient(client, sizeof(xXF86VidModeValidateModeLineReply), (char *)&rep); if (xf86Verbose > 1) ErrorF("ValidateModeLine - Succeeded\n"); return(client->noClientException); } static int ProcXF86VidModeSwitchMode(client) register ClientPtr client; { REQUEST(xXF86VidModeSwitchModeReq); ScreenPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = screenInfo.screens[stuff->screen]; if (xf86Info.dontZoom) return vidmodeErrorBase + XF86VidModeZoomLocked; REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq); xf86ZoomViewport(vptr, (short)stuff->zoom); return (client->noClientException); } static int ProcXF86VidModeSwitchToMode(client) register ClientPtr client; { REQUEST(xXF86VidModeSwitchToModeReq); ScrnInfoPtr vptr; DisplayModePtr curmptr, mptr; int len; if (xf86Verbose > 1) { ErrorF("SwitchToMode - scrn: %d clock: %d\n", stuff->screen, stuff->dotclock); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", stuff->hdisplay, stuff->hsyncstart, stuff->hsyncend, stuff->htotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", stuff->vdisplay, stuff->vsyncstart, stuff->vsyncend, stuff->vtotal, stuff->flags); } if (stuff->screen > screenInfo.numScreens) return BadValue; if (xf86Info.dontZoom) return vidmodeErrorBase + XF86VidModeZoomLocked; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; curmptr = mptr = vptr->modes; REQUEST_AT_LEAST_SIZE(xXF86VidModeSwitchToModeReq); len = client->req_len - (sizeof(xXF86VidModeSwitchToModeReq) >> 2); if (len != stuff->privsize) return BadLength; if (MODEMATCH(mptr, stuff, vptr)) return (client->noClientException); while ((mptr = mptr->next) != curmptr) { if (xf86Verbose > 1) { ErrorF("Checking against clock: %d (%d)\n", mptr->Clock, CLOCKSPD(mptr->Clock, vptr)); ErrorF(" hdsp: %d hbeg: %d hend: %d httl: %d\n", mptr->HDisplay, mptr->HSyncStart, mptr->HSyncEnd, mptr->HTotal); ErrorF(" vdsp: %d vbeg: %d vend: %d vttl: %d flags: %d\n", mptr->VDisplay, mptr->VSyncStart, mptr->VSyncEnd, mptr->VTotal, mptr->Flags); } if (MODEMATCH(mptr, stuff, vptr)) { if ((vptr->SwitchMode)(mptr)) { vptr->modes = mptr; vptr->frameX0 = (vptr->frameX1 +vptr->frameX0 -mptr->HDisplay)/2; vptr->frameX1 = vptr->frameX0 + mptr->HDisplay -1; if (vptr->frameX0 < 0) { vptr->frameX0 = 0; vptr->frameX1 = mptr->HDisplay -1; } else if (vptr->frameX1 >= vptr->virtualX) { vptr->frameX0 = vptr->virtualX - mptr->HDisplay; vptr->frameX1 = vptr->frameX0 + mptr->HDisplay -1; } vptr->frameY0 = (vptr->frameY1 +vptr->frameY0 -mptr->VDisplay)/2; vptr->frameY1 = vptr->frameY0 + mptr->VDisplay -1; if (vptr->frameY0 < 0) { vptr->frameY0 = 0; vptr->frameY1 = mptr->VDisplay -1; } else if (vptr->frameY1 >= vptr->virtualY) { vptr->frameY0 = vptr->virtualY - mptr->VDisplay; vptr->frameY1 = vptr->frameY0 + mptr->VDisplay -1; } } (vptr->AdjustFrame)(vptr->frameX0, vptr->frameY0); if (xf86Verbose > 1) ErrorF("SwitchToMode - Succeeded\n"); return(client->noClientException); } } return BadValue; } static int ProcXF86VidModeLockModeSwitch(client) register ClientPtr client; { REQUEST(xXF86VidModeLockModeSwitchReq); ScreenPtr vptr; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = screenInfo.screens[stuff->screen]; if (xf86Info.dontZoom) return vidmodeErrorBase + XF86VidModeZoomLocked; REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq); xf86LockZoom(vptr, (short)stuff->lock); return (client->noClientException); } static int ProcXF86VidModeGetMonitor(client) register ClientPtr client; { REQUEST(xXF86VidModeGetMonitorReq); xXF86VidModeGetMonitorReply rep; register int n; ScrnInfoPtr vptr; MonPtr mptr; CARD32 *hsyncdata, *vsyncdata; int i; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; mptr = vptr->monitor; REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); rep.type = X_Reply; if (mptr->vendor) rep.vendorLength = strlen(mptr->vendor); else rep.vendorLength = 0; if (mptr->model) rep.modelLength = strlen(mptr->model); else rep.modelLength = 0; rep.length = (SIZEOF(xXF86VidModeGetMonitorReply) - SIZEOF(xGenericReply) + (mptr->n_hsync + mptr->n_vrefresh) * sizeof(CARD32) + ((rep.vendorLength + 3) & ~3) + ((rep.modelLength + 3) & ~3)) >> 2; rep.sequenceNumber = client->sequence; rep.nhsync = mptr->n_hsync; rep.nvsync = mptr->n_vrefresh; #if 0 rep.bandwidth = (unsigned long)(mptr->bandwidth * 1e6); #endif hsyncdata = ALLOCATE_LOCAL(mptr->n_hsync * sizeof(CARD32)); if (!hsyncdata) { return BadAlloc; } vsyncdata = ALLOCATE_LOCAL(mptr->n_vrefresh * sizeof(CARD32)); if (!vsyncdata) { DEALLOCATE_LOCAL(hsyncdata); return BadAlloc; } for (i = 0; i < mptr->n_hsync; i++) { hsyncdata[i] = (unsigned short)(mptr->hsync[i].lo * 100.0) | (unsigned short)(mptr->hsync[i].hi * 100.0) << 16; } for (i = 0; i < mptr->n_vrefresh; i++) { vsyncdata[i] = (unsigned short)(mptr->vrefresh[i].lo * 100.0) | (unsigned short)(mptr->vrefresh[i].hi * 100.0) << 16; } if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); #if 0 swapl(&rep.bandwidth, n); #endif } WriteToClient(client, SIZEOF(xXF86VidModeGetMonitorReply), (char *)&rep); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, mptr->n_hsync * sizeof(CARD32), hsyncdata); WriteSwappedDataToClient(client, mptr->n_vrefresh * sizeof(CARD32), vsyncdata); if (rep.vendorLength) WriteToClient(client, rep.vendorLength, mptr->vendor); if (rep.modelLength) WriteToClient(client, rep.modelLength, mptr->model); DEALLOCATE_LOCAL(hsyncdata); DEALLOCATE_LOCAL(vsyncdata); return (client->noClientException); } static int ProcXF86VidModeGetViewPort(client) register ClientPtr client; { REQUEST(xXF86VidModeGetViewPortReq); xXF86VidModeGetViewPortReply rep; ScrnInfoPtr vptr; int n; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.x = vptr->frameX0; rep.y = vptr->frameY0; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.x, n); swapl(&rep.y, n); } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *)&rep); return (client->noClientException); } static int ProcXF86VidModeSetViewPort(client) register ClientPtr client; { REQUEST(xXF86VidModeSetViewPortReq); ScrnInfoPtr vptr; int x, y; if (stuff->screen > screenInfo.numScreens) return BadValue; vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); if (stuff->x < 0) x = 0; else if (stuff->x + vptr->modes->HDisplay + 1 > vptr->virtualX) x = vptr->virtualX - vptr->modes->HDisplay - 1; else x = stuff->x; if (stuff->y < 0) y = 0; else if (stuff->y + vptr->modes->VDisplay + 1 > vptr->virtualY) y = vptr->virtualY - vptr->modes->VDisplay - 1; else y = stuff->y; if (vptr->AdjustFrame && xf86VTSema) { vptr->AdjustFrame(x, y); vptr->frameX0 = x; vptr->frameX1 = x + vptr->modes->HDisplay - 1; vptr->frameY0 = y; vptr->frameY1 = y + vptr->modes->VDisplay - 1; } return (client->noClientException); } static int ProcXF86VidModeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return ProcXF86VidModeQueryVersion(client); case X_XF86VidModeGetModeLine: return ProcXF86VidModeGetModeLine(client); case X_XF86VidModeGetAllModeLines: return ProcXF86VidModeGetAllModeLines(client); case X_XF86VidModeGetMonitor: return ProcXF86VidModeGetMonitor(client); case X_XF86VidModeValidateModeLine: return ProcXF86VidModeValidateModeLine(client); case X_XF86VidModeGetViewPort: return ProcXF86VidModeGetViewPort(client); default: if (!xf86VidModeEnabled) return vidmodeErrorBase + XF86VidModeExtensionDisabled; if (xf86VidModeAllowNonLocal || LocalClient (client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return ProcXF86VidModeAddModeLine(client); case X_XF86VidModeDeleteModeLine: return ProcXF86VidModeDeleteModeLine(client); case X_XF86VidModeModModeLine: return ProcXF86VidModeModModeLine(client); case X_XF86VidModeSwitchMode: return ProcXF86VidModeSwitchMode(client); case X_XF86VidModeSwitchToMode: return ProcXF86VidModeSwitchToMode(client); case X_XF86VidModeLockModeSwitch: return ProcXF86VidModeLockModeSwitch(client); case X_XF86VidModeSetViewPort: return ProcXF86VidModeSetViewPort(client); default: return BadRequest; } } else return vidmodeErrorBase + XF86VidModeClientNotLocal; } } static int SProcXF86VidModeQueryVersion(client) register ClientPtr client; { register int n; REQUEST(xXF86VidModeQueryVersionReq); swaps(&stuff->length, n); return ProcXF86VidModeQueryVersion(client); } static int SProcXF86VidModeGetModeLine(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeGetModeLineReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetModeLine(client); } static int SProcXF86VidModeGetAllModeLines(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetAllModeLines(client); } static int SProcXF86VidModeAddModeLine(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeAddModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeAddModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeAddModeLine(client); } static int SProcXF86VidModeDeleteModeLine(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeDeleteModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeDeleteModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeDeleteModeLine(client); } static int SProcXF86VidModeModModeLine(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeModModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeModModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeModModeLine(client); } static int SProcXF86VidModeValidateModeLine(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeValidateModeLineReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xXF86VidModeValidateModeLineReq); swapl(&stuff->screen, n); swaps(&stuff->hdisplay, n); swaps(&stuff->hsyncstart, n); swaps(&stuff->hsyncend, n); swaps(&stuff->htotal, n); swaps(&stuff->vdisplay, n); swaps(&stuff->vsyncstart, n); swaps(&stuff->vsyncend, n); swaps(&stuff->vtotal, n); swapl(&stuff->flags, n); swapl(&stuff->privsize, n); SwapRestL(stuff); return ProcXF86VidModeValidateModeLine(client); } static int SProcXF86VidModeSwitchMode(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeSwitchModeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq); swaps(&stuff->screen, n); swaps(&stuff->zoom, n); return ProcXF86VidModeSwitchMode(client); } static int SProcXF86VidModeSwitchToMode(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeSwitchToModeReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq); swaps(&stuff->screen, n); return ProcXF86VidModeSwitchToMode(client); } static int SProcXF86VidModeLockModeSwitch(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeLockModeSwitchReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq); swaps(&stuff->screen, n); swaps(&stuff->lock, n); return ProcXF86VidModeLockModeSwitch(client); } static int SProcXF86VidModeGetMonitor(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeGetMonitorReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetMonitor(client); } static int SProcXF86VidModeGetViewPort(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeGetViewPortReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq); swaps(&stuff->screen, n); return ProcXF86VidModeGetViewPort(client); } static int SProcXF86VidModeSetViewPort(client) ClientPtr client; { register int n; REQUEST(xXF86VidModeSetViewPortReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq); swaps(&stuff->screen, n); swapl(&stuff->x, n); swapl(&stuff->y, n); return ProcXF86VidModeSetViewPort(client); } static int SProcXF86VidModeDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XF86VidModeQueryVersion: return SProcXF86VidModeQueryVersion(client); case X_XF86VidModeGetModeLine: return SProcXF86VidModeGetModeLine(client); case X_XF86VidModeGetAllModeLines: return SProcXF86VidModeGetAllModeLines(client); case X_XF86VidModeGetMonitor: return SProcXF86VidModeGetMonitor(client); case X_XF86VidModeGetViewPort: return SProcXF86VidModeGetViewPort(client); case X_XF86VidModeValidateModeLine: return SProcXF86VidModeValidateModeLine(client); default: if (!xf86VidModeEnabled) return vidmodeErrorBase + XF86VidModeExtensionDisabled; if (xf86VidModeAllowNonLocal || LocalClient(client)) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return SProcXF86VidModeAddModeLine(client); case X_XF86VidModeDeleteModeLine: return SProcXF86VidModeDeleteModeLine(client); case X_XF86VidModeModModeLine: return SProcXF86VidModeModModeLine(client); case X_XF86VidModeSwitchMode: return SProcXF86VidModeSwitchMode(client); case X_XF86VidModeSwitchToMode: return SProcXF86VidModeSwitchToMode(client); case X_XF86VidModeLockModeSwitch: return SProcXF86VidModeLockModeSwitch(client); case X_XF86VidModeSetViewPort: return SProcXF86VidModeSetViewPort(client); default: return BadRequest; } } else return vidmodeErrorBase + XF86VidModeClientNotLocal; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/shm.c0100664000076400007640000007072110511106425020563 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* THIS IS NOT AN X CONSORTIUM STANDARD */ /* $XConsortium: shm.c,v 1.25 95/04/06 16:00:55 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.8 1997/01/18 06:52:59 dawes Exp $ */ #include #ifndef Lynx #include #include #else #include #include #endif #define NEED_REPLIES #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "os.h" #include "dixstruct.h" #include "resource.h" #include "scrnintstr.h" #include "windowstr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "extnsionst.h" #include "servermd.h" #define _XSHM_SERVER_ #include "shmstr.h" #include "Xfuncproto.h" typedef struct _ShmDesc { struct _ShmDesc *next; int shmid; int refcnt; char *addr; Bool writable; unsigned long size; } ShmDescRec, *ShmDescPtr; static void miShmPutImage(XSHM_PUT_IMAGE_ARGS); static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS); static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS); static int ShmDetachSegment( #if NeedFunctionPrototypes pointer /* value */, XID /* shmseg */ #endif ); static void ShmResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static void SShmCompletionEvent( #if NeedFunctionPrototypes xShmCompletionEvent * /* from */, xShmCompletionEvent * /* to */ #endif ); static DISPATCH_PROC(ProcShmAttach); static DISPATCH_PROC(ProcShmCreatePixmap); static DISPATCH_PROC(ProcShmDetach); static DISPATCH_PROC(ProcShmDispatch); static DISPATCH_PROC(ProcShmGetImage); static DISPATCH_PROC(ProcShmGetImage); static DISPATCH_PROC(ProcShmGetImage); static DISPATCH_PROC(ProcShmPutImage); static DISPATCH_PROC(ProcShmQueryVersion); static DISPATCH_PROC(SProcShmAttach); static DISPATCH_PROC(SProcShmCreatePixmap); static DISPATCH_PROC(SProcShmDetach); static DISPATCH_PROC(SProcShmDispatch); static DISPATCH_PROC(SProcShmGetImage); static DISPATCH_PROC(SProcShmPutImage); static DISPATCH_PROC(SProcShmQueryVersion); static unsigned char ShmReqCode; static int ShmCompletionCode; static int BadShmSegCode; static RESTYPE ShmSegType, ShmPixType; static ShmDescPtr Shmsegs; static Bool sharedPixmaps; static int pixmapFormat; static int shmPixFormat[MAXSCREENS]; static ShmFuncsPtr shmFuncs[MAXSCREENS]; static ShmFuncs miFuncs = {NULL, miShmPutImage}; static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; #define VERIFY_SHMSEG(shmseg,shmdesc,client) \ { \ shmdesc = (ShmDescPtr)LookupIDByType(shmseg, ShmSegType); \ if (!shmdesc) \ { \ client->errorValue = shmseg; \ return BadShmSegCode; \ } \ } #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ { \ VERIFY_SHMSEG(shmseg, shmdesc, client); \ if ((offset & 3) || (offset > shmdesc->size)) \ { \ client->errorValue = offset; \ return BadValue; \ } \ if (needwrite && !shmdesc->writable) \ return BadAccess; \ } #define VERIFY_SHMSIZE(shmdesc,offset,len,client) \ { \ if ((offset + len) > shmdesc->size) \ { \ return BadAccess; \ } \ } #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #include static Bool badSysCall = FALSE; static void SigSysHandler(signo) int signo; { badSysCall = TRUE; } static Bool CheckForShmSyscall() { void (*oldHandler)(); int shmid = -1; /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ oldHandler = signal(SIGSYS, SigSysHandler); badSysCall = FALSE; shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); /* Clean up */ if (shmid != -1) { shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL); } signal(SIGSYS, oldHandler); return(!badSysCall); } #endif void ShmExtensionInit() { ExtensionEntry *extEntry; int i; #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) if (!CheckForShmSyscall()) { ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); return; } #endif #ifdef INTERNAL_VS_EXTERNAL_PADDING sharedPixmaps = xFalse; pixmapFormat = 0; #else sharedPixmaps = xTrue; pixmapFormat = shmPixFormat[0]; for (i = 0; i < screenInfo.numScreens; i++) { if (!shmFuncs[i]) shmFuncs[i] = &miFuncs; if (!shmFuncs[i]->CreatePixmap) sharedPixmaps = xFalse; if (shmPixFormat[i] && (shmPixFormat[i] != pixmapFormat)) { sharedPixmaps = xFalse; pixmapFormat = 0; } } if (!pixmapFormat) pixmapFormat = ZPixmap; #endif ShmSegType = CreateNewResourceType(ShmDetachSegment); ShmPixType = CreateNewResourceType(ShmDetachSegment); if (ShmSegType && ShmPixType && (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, ProcShmDispatch, SProcShmDispatch, ShmResetProc, StandardMinorOpcode))) { ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } } /*ARGSUSED*/ static void ShmResetProc (extEntry) ExtensionEntry *extEntry; { int i; for (i = 0; i < MAXSCREENS; i++) { shmFuncs[i] = (ShmFuncsPtr)NULL; shmPixFormat[i] = 0; } } void ShmRegisterFuncs(pScreen, funcs) ScreenPtr pScreen; ShmFuncsPtr funcs; { shmFuncs[pScreen->myNum] = funcs; } void ShmSetPixmapFormat(pScreen, format) ScreenPtr pScreen; int format; { shmPixFormat[pScreen->myNum] = format; } void ShmRegisterFbFuncs(pScreen) ScreenPtr pScreen; { shmFuncs[pScreen->myNum] = &fbFuncs; } static int ProcShmQueryVersion(client) register ClientPtr client; { xShmQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH(xShmQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.sharedPixmaps = sharedPixmaps; rep.pixmapFormat = pixmapFormat; rep.majorVersion = SHM_MAJOR_VERSION; rep.minorVersion = SHM_MINOR_VERSION; rep.uid = geteuid(); rep.gid = getegid(); if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); swaps(&rep.uid, n); swaps(&rep.gid, n); } WriteToClient(client, sizeof(xShmQueryVersionReply), (char *)&rep); return (client->noClientException); } static int ProcShmAttach(client) register ClientPtr client; { struct shmid_ds buf; ShmDescPtr shmdesc; REQUEST(xShmAttachReq); REQUEST_SIZE_MATCH(xShmAttachReq); LEGAL_NEW_RESOURCE(stuff->shmseg, client); if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) { client->errorValue = stuff->readOnly; return(BadValue); } for (shmdesc = Shmsegs; shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next) ; if (shmdesc) { if (!stuff->readOnly && !shmdesc->writable) return BadAccess; shmdesc->refcnt++; } else { shmdesc = (ShmDescPtr) xalloc(sizeof(ShmDescRec)); if (!shmdesc) return BadAlloc; shmdesc->addr = shmat(stuff->shmid, 0, stuff->readOnly ? SHM_RDONLY : 0); if ((shmdesc->addr == ((char *)-1)) || shmctl(stuff->shmid, IPC_STAT, &buf)) { xfree(shmdesc); return BadAccess; } shmdesc->shmid = stuff->shmid; shmdesc->refcnt = 1; shmdesc->writable = !stuff->readOnly; shmdesc->size = buf.shm_segsz; shmdesc->next = Shmsegs; Shmsegs = shmdesc; } if (!AddResource(stuff->shmseg, ShmSegType, (pointer)shmdesc)) return BadAlloc; return(client->noClientException); } /*ARGSUSED*/ static int ShmDetachSegment(value, shmseg) pointer value; /* must conform to DeleteType */ XID shmseg; { ShmDescPtr shmdesc = (ShmDescPtr)value; ShmDescPtr *prev; if (--shmdesc->refcnt) return TRUE; shmdt(shmdesc->addr); for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next) ; *prev = shmdesc->next; xfree(shmdesc); return Success; } static int ProcShmDetach(client) register ClientPtr client; { ShmDescPtr shmdesc; REQUEST(xShmDetachReq); REQUEST_SIZE_MATCH(xShmDetachReq); VERIFY_SHMSEG(stuff->shmseg, shmdesc, client); FreeResource(stuff->shmseg, RT_NONE); return(client->noClientException); } static void miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { PixmapPtr pmap; GCPtr putGC; putGC = GetScratchGC(depth, dst->pScreen); if (!putGC) return; pmap = (*dst->pScreen->CreatePixmap)(dst->pScreen, sw, sh, depth); if (!pmap) { FreeScratchGC(putGC); return; } ValidateGC((DrawablePtr)pmap, putGC); (*putGC->ops->PutImage)((DrawablePtr)pmap, putGC, depth, -sx, -sy, w, h, 0, (format == XYPixmap) ? XYPixmap : ZPixmap, data); FreeScratchGC(putGC); if (format == XYBitmap) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh, dx, dy, 1L); else (void)(*pGC->ops->CopyArea)((DrawablePtr)pmap, dst, pGC, 0, 0, sw, sh, dx, dy); (*pmap->drawable.pScreen->DestroyPixmap)(pmap); } static void fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data) DrawablePtr dst; GCPtr pGC; int depth, w, h, sx, sy, sw, sh, dx, dy; unsigned int format; char *data; { if ((format == ZPixmap) || (depth == 1)) { PixmapPtr pPixmap; pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth, /*XXX*/depth, PixmapBytePad(w, depth), (pointer)data); if (!pPixmap) return; if (format == XYBitmap) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy, 1L); else (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy); FreeScratchPixmapHeader(pPixmap); } else miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data); } static int ProcShmPutImage(client) register ClientPtr client; { register GCPtr pGC; register DrawablePtr pDraw; long length; #ifdef INTERNAL_VS_EXTERNAL_PADDING long lengthProto; char *tmpImage; int tmpAlloced = 0; #endif ShmDescPtr shmdesc; REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) return BadValue; if (stuff->format == XYBitmap) { if (stuff->depth != 1) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = PixmapBytePadProto(stuff->totalWidth, 1); #endif } else if (stuff->format == XYPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); length *= stuff->depth; #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = PixmapBytePadProto(stuff->totalWidth, 1); lengthProto *= stuff->depth; #endif } else if (stuff->format == ZPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, stuff->depth); #ifdef INTERNAL_VS_EXTERNAL_PADDING lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth); #endif } else { client->errorValue = stuff->format; return BadValue; } #ifdef INTERNAL_VS_EXTERNAL_PADDING VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight, client); #else VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, client); #endif if (stuff->srcX > stuff->totalWidth) { client->errorValue = stuff->srcX; return BadValue; } if (stuff->srcY > stuff->totalHeight) { client->errorValue = stuff->srcY; return BadValue; } if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) { client->errorValue = stuff->srcWidth; return BadValue; } if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) { client->errorValue = stuff->srcHeight; return BadValue; } #ifdef INTERNAL_VS_EXTERNAL_PADDING /* handle 64 bit case where protocol may pad to 32 and we want 64 * In this case, length is what the server wants and lengthProto is * what the protocol thinks it is. If the the two are different, * copy the protocol version (i.e. the memory shared between the * server and the client) to a version with a scanline pad of 64. */ if (length != lengthProto) { register int i; char * stuffptr, /* pointer into protocol data */ * tmpptr; /* new location to copy to */ if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight))) return (BadAlloc); tmpAlloced = 1; bzero(tmpImage,length*stuff->totalHeight); if (stuff->format == XYPixmap) { int lineBytes = PixmapBytePad(stuff->totalWidth, 1); int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1); int depth = stuff->depth; stuffptr = shmdesc->addr + stuff->offset ; tmpptr = tmpImage; for (i = 0; i < stuff->totalHeight*stuff->depth; stuffptr += lineBytesProto,tmpptr += lineBytes, i++) bcopy(stuffptr,tmpptr,lineBytesProto); } else { for (i = 0, stuffptr = shmdesc->addr + stuff->offset, tmpptr=tmpImage; i < stuff->totalHeight; stuffptr += lengthProto,tmpptr += length, i++) bcopy(stuffptr,tmpptr,lengthProto); } } /* handle 64-bit case where stuff is not 64-bit aligned */ else if ((unsigned long)(shmdesc->addr+stuff->offset) & (sizeof(long)-1)) { if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight))) return (BadAlloc); tmpAlloced = 1; bcopy((char *)(shmdesc->addr+stuff->offset), tmpImage, length*stuff->totalHeight); } else tmpImage = (char *)(shmdesc->addr+stuff->offset); #endif if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || ((stuff->format != ZPixmap) && (stuff->srcX < screenInfo.bitmapScanlinePad) && ((stuff->format == XYBitmap) || ((stuff->srcY == 0) && (stuff->srcHeight == stuff->totalHeight))))) && ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->totalWidth, stuff->srcHeight, stuff->srcX, stuff->format, #ifdef INTERNAL_VS_EXTERNAL_PADDING tmpImage + #else shmdesc->addr + stuff->offset + #endif (stuff->srcY * length)); else (*shmFuncs[pDraw->pScreen->myNum]->PutImage)( pDraw, pGC, stuff->depth, stuff->format, stuff->totalWidth, stuff->totalHeight, stuff->srcX, stuff->srcY, stuff->srcWidth, stuff->srcHeight, stuff->dstX, stuff->dstY, #ifdef INTERNAL_VS_EXTERNAL_PADDING tmpImage); #else shmdesc->addr + stuff->offset); #endif if (stuff->sendEvent) { xShmCompletionEvent ev; ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; ev.sequenceNumber = client->sequence; ev.minorEvent = X_ShmPutImage; ev.majorEvent = ShmReqCode; ev.shmseg = stuff->shmseg; ev.offset = stuff->offset; WriteEventsToClient(client, 1, (xEvent *) &ev); } #ifdef INTERNAL_VS_EXTERNAL_PADDING if (tmpAlloced) DEALLOCATE_LOCAL(tmpImage); #endif return (client->noClientException); } static int ProcShmGetImage(client) register ClientPtr client; { register DrawablePtr pDraw; long lenPer, length; Mask plane; xShmGetImageReply xgi; ShmDescPtr shmdesc; int n; #ifdef INTERNAL_VS_EXTERNAL_PADDING long widthBytesLine,widthBytesLineProto; long lenPerProto,lengthProto; char *tmpImage; int tmpAlloced = 0; #endif REQUEST(xShmGetImageReq); REQUEST_SIZE_MATCH(xShmGetImageReq); if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) { client->errorValue = stuff->format; return(BadValue); } VERIFY_DRAWABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ !((WindowPtr) pDraw)->realized || /* check for being on screen */ pDraw->x + stuff->x < 0 || pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || pDraw->y + stuff->y < 0 || pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || /* check for being inside of border */ stuff->x < - wBorderWidth((WindowPtr)pDraw) || stuff->x + (int)stuff->width > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || stuff->y < -wBorderWidth((WindowPtr)pDraw) || stuff->y + (int)stuff->height > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height ) return(BadMatch); xgi.visual = wVisual(((WindowPtr)pDraw)); } else { if (stuff->x < 0 || stuff->x+(int)stuff->width > pDraw->width || stuff->y < 0 || stuff->y+(int)stuff->height > pDraw->height ) return(BadMatch); xgi.visual = None; } xgi.type = X_Reply; xgi.length = 0; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; if(stuff->format == ZPixmap) { #ifdef INTERNAL_VS_EXTERNAL_PADDING widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth); length = widthBytesLine * stuff->height; widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth); lengthProto = widthBytesLineProto * stuff->height; #else length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; #endif } else { #ifdef INTERNAL_VS_EXTERNAL_PADDING widthBytesLine = PixmapBytePad(stuff->width, 1); lenPer = widthBytesLine * stuff->height; plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); widthBytesLineProto = PixmapBytePadProto(stuff->width, 1); lenPerProto = widthBytesLineProto * stuff->height; lengthProto = lenPerProto * Ones(stuff->planeMask & (plane | (plane - 1))); #else lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); #endif } #ifdef INTERNAL_VS_EXTERNAL_PADDING VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client); xgi.size = lengthProto; #else VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; #endif if (length == 0) { /* nothing to do */ } else if (stuff->format == ZPixmap) { #ifdef INTERNAL_VS_EXTERNAL_PADDING /* check for protocol/server padding differences. */ if ((widthBytesLine != widthBytesLineProto) || ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1))) { /* temp stuff for 64 bit alignment stuff */ register char * bufPtr, * protoPtr; register int i; if(!(tmpImage = (char *) ALLOCATE_LOCAL(length))) return (BadAlloc); tmpAlloced = 1; (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, stuff->planeMask, tmpImage); /* for 64-bit server, convert image to pad to 32 bits */ bzero(shmdesc->addr + stuff->offset,lengthProto); for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset; i < stuff->height; bufPtr += widthBytesLine,protoPtr += widthBytesLineProto, i++) bcopy(bufPtr,protoPtr,widthBytesLineProto); } else { (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, stuff->planeMask, shmdesc->addr + stuff->offset); } #else (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, stuff->planeMask, shmdesc->addr + stuff->offset); #endif } else { #ifdef INTERNAL_VS_EXTERNAL_PADDING /* check for protocol/server padding differences. */ if ((widthBytesLine != widthBytesLineProto) || ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1))) { if(!(tmpImage = (char *) ALLOCATE_LOCAL(length))) return (BadAlloc); tmpAlloced = 1; } #endif length = stuff->offset; for (; plane; plane >>= 1) { if (stuff->planeMask & plane) { #ifdef INTERNAL_VS_EXTERNAL_PADDING if ((widthBytesLine != widthBytesLineProto) || ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1))) { /* get image for each plane. */ (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, plane, tmpImage); /* for 64-bit server, convert image to pad to 32 bits */ bzero(shmdesc->addr+length, widthBytesLine); bcopy(tmpImage, shmdesc->addr+length, widthBytesLineProto); /* increment length */ length += lenPerProto; } else /* no diff between protocol and server */ { (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, plane, shmdesc->addr + length); length += lenPer; } #else (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, plane, shmdesc->addr + length); length += lenPer; #endif } } } if (client->swapped) { swaps(&xgi.sequenceNumber, n); swapl(&xgi.length, n); swapl(&xgi.visual, n); swapl(&xgi.size, n); } WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); #ifdef INTERNAL_VS_EXTERNAL_PADDING if (tmpAlloced) DEALLOCATE_LOCAL(tmpImage); #endif return(client->noClientException); } static PixmapPtr fbShmCreatePixmap (pScreen, width, height, depth, addr) ScreenPtr pScreen; int width; int height; int depth; char *addr; { register PixmapPtr pPixmap; pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth); if (!pPixmap) return NullPixmap; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth, /*XXX*/depth, PixmapBytePad(width, depth), (pointer)addr)) return NullPixmap; return pPixmap; } static int ProcShmCreatePixmap(client) register ClientPtr client; { PixmapPtr pMap; register DrawablePtr pDraw; DepthPtr pDepth; register int i; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); REQUEST_SIZE_MATCH(xShmCreatePixmapReq); client->errorValue = stuff->pid; if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (!stuff->width || !stuff->height) { client->errorValue = 0; return BadValue; } if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i=0; ipScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: VERIFY_SHMSIZE(shmdesc, stuff->offset, PixmapBytePad(stuff->width, stuff->depth) * stuff->height, client); pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)( pDraw->pScreen, stuff->width, stuff->height, stuff->depth, shmdesc->addr + stuff->offset); if (pMap) { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) { shmdesc->refcnt++; if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc)) return(client->noClientException); FreeResource(stuff->pid, RT_NONE); } } return (BadAlloc); } static int ProcShmDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShmQueryVersion: return ProcShmQueryVersion(client); case X_ShmAttach: return ProcShmAttach(client); case X_ShmDetach: return ProcShmDetach(client); case X_ShmPutImage: return ProcShmPutImage(client); case X_ShmGetImage: return ProcShmGetImage(client); case X_ShmCreatePixmap: return ProcShmCreatePixmap(client); default: return BadRequest; } } static void SShmCompletionEvent(from, to) xShmCompletionEvent *from, *to; { to->type = from->type; cpswaps(from->sequenceNumber, to->sequenceNumber); cpswapl(from->drawable, to->drawable); cpswaps(from->minorEvent, to->minorEvent); to->majorEvent = from->majorEvent; cpswapl(from->shmseg, to->shmseg); cpswapl(from->offset, to->offset); } static int SProcShmQueryVersion(client) register ClientPtr client; { register int n; REQUEST(xShmQueryVersionReq); swaps(&stuff->length, n); return ProcShmQueryVersion(client); } static int SProcShmAttach(client) ClientPtr client; { register int n; REQUEST(xShmAttachReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xShmAttachReq); swapl(&stuff->shmseg, n); swapl(&stuff->shmid, n); return ProcShmAttach(client); } static int SProcShmDetach(client) ClientPtr client; { register int n; REQUEST(xShmDetachReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xShmDetachReq); swapl(&stuff->shmseg, n); return ProcShmDetach(client); } static int SProcShmPutImage(client) ClientPtr client; { register int n; REQUEST(xShmPutImageReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xShmPutImageReq); swapl(&stuff->drawable, n); swapl(&stuff->gc, n); swaps(&stuff->totalWidth, n); swaps(&stuff->totalHeight, n); swaps(&stuff->srcX, n); swaps(&stuff->srcY, n); swaps(&stuff->srcWidth, n); swaps(&stuff->srcHeight, n); swaps(&stuff->dstX, n); swaps(&stuff->dstY, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); return ProcShmPutImage(client); } static int SProcShmGetImage(client) ClientPtr client; { register int n; REQUEST(xShmGetImageReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xShmGetImageReq); swapl(&stuff->drawable, n); swaps(&stuff->x, n); swaps(&stuff->y, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swapl(&stuff->planeMask, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); return ProcShmGetImage(client); } static int SProcShmCreatePixmap(client) ClientPtr client; { register int n; REQUEST(xShmCreatePixmapReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xShmCreatePixmapReq); swapl(&stuff->pid, n); swapl(&stuff->drawable, n); swaps(&stuff->width, n); swaps(&stuff->height, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); return ProcShmCreatePixmap(client); } static int SProcShmDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_ShmQueryVersion: return SProcShmQueryVersion(client); case X_ShmAttach: return SProcShmAttach(client); case X_ShmDetach: return SProcShmDetach(client); case X_ShmPutImage: return SProcShmPutImage(client); case X_ShmGetImage: return SProcShmGetImage(client); case X_ShmCreatePixmap: return SProcShmCreatePixmap(client); default: return BadRequest; } } vnc_unixsrc/Xvnc/programs/Xserver/Xext/mbuf.c0100664000076400007640000014212607120677563020746 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mbuf.c /main/25 1996/12/02 10:19:23 lehors $ */ /* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.3 1997/01/18 06:52:58 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include #include "X.h" #include "Xproto.h" #include "window.h" #include "os.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "dixstruct.h" #include "resource.h" #include "opaque.h" #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" #include "multibufst.h" #if !defined(WIN32) && !defined(MINIX) && !defined(Lynx) #include #endif /* given an OtherClientPtr obj, get the ClientPtr */ #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) /* given a MultibufferPtr b, get the ClientPtr */ #define bClient(b) (clients[CLIENT_ID(b->pPixmap->drawable.id)]) #define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask) static unsigned char MultibufferReqCode; static int MultibufferEventBase; static int MultibufferErrorBase; int MultibufferScreenIndex = -1; int MultibufferWindowIndex = -1; static void PerformDisplayRequest ( #if NeedFunctionPrototypes MultibuffersPtr * /* ppMultibuffers */, MultibufferPtr * /* pMultibuffer */, int /* nbuf */ #endif ); static Bool QueueDisplayRequest ( #if NeedFunctionPrototypes ClientPtr /* client */, TimeStamp /* activateTime */ #endif ); static void BumpTimeStamp ( #if NeedFunctionPrototypes TimeStamp * /* ts */, CARD32 /* inc */ #endif ); static void AliasMultibuffer ( #if NeedFunctionPrototypes MultibuffersPtr /* pMultibuffers */, int /* i */ #endif ); static void RecalculateMultibufferOtherEvents ( #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */ #endif ); static int EventSelectForMultibuffer( #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */, ClientPtr /* client */, Mask /* mask */ #endif ); /* * The Pixmap associated with a buffer can be found as a resource * with this type */ RESTYPE MultibufferDrawableResType; static int MultibufferDrawableDelete ( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); /* * The per-buffer data can be found as a resource with this type. * the resource id of the per-buffer data is the same as the resource * id of the pixmap */ static RESTYPE MultibufferResType; static int MultibufferDelete ( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); /* * The per-window data can be found as a resource with this type, * using the window resource id */ static RESTYPE MultibuffersResType; static int MultibuffersDelete ( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); /* * Clients other than the buffer creator attach event masks in * OtherClient structures; each has a resource of this type. */ static RESTYPE OtherClientResType; static int OtherClientDelete ( #if NeedFunctionPrototypes pointer /* value */, XID /* id */ #endif ); /**************** * MultibufferExtensionInit * * Called from InitExtensions in main() * ****************/ extern DISPATCH_PROC(ProcGetBufferAttributes); static DISPATCH_PROC(ProcClearImageBufferArea); static DISPATCH_PROC(ProcCreateImageBuffers); static DISPATCH_PROC(ProcDestroyImageBuffers); static DISPATCH_PROC(ProcDisplayImageBuffers); static DISPATCH_PROC(ProcGetBufferInfo); static DISPATCH_PROC(ProcGetBufferVersion); static DISPATCH_PROC(ProcGetMBufferAttributes); static DISPATCH_PROC(ProcMultibufferDispatch); static DISPATCH_PROC(ProcSetBufferAttributes); static DISPATCH_PROC(ProcSetMBufferAttributes); static DISPATCH_PROC(SProcClearImageBufferArea); static DISPATCH_PROC(SProcCreateImageBuffers); static DISPATCH_PROC(SProcDestroyImageBuffers); static DISPATCH_PROC(SProcDisplayImageBuffers); static DISPATCH_PROC(SProcGetBufferAttributes); static DISPATCH_PROC(SProcGetBufferInfo); static DISPATCH_PROC(SProcGetBufferVersion); static DISPATCH_PROC(SProcGetMBufferAttributes); static DISPATCH_PROC(SProcMultibufferDispatch); static DISPATCH_PROC(SProcSetBufferAttributes); static DISPATCH_PROC(SProcSetMBufferAttributes); static void MultibufferResetProc( #if NeedFunctionPrototypes ExtensionEntry * /* extEntry */ #endif ); static void SClobberNotifyEvent( #if NeedFunctionPrototypes xMbufClobberNotifyEvent * /* from */, xMbufClobberNotifyEvent * /* to */ # endif ); static void SUpdateNotifyEvent( #if NeedFunctionPrototypes xMbufUpdateNotifyEvent * /* from */, xMbufUpdateNotifyEvent * /* to */ #endif ); static Bool MultibufferPositionWindow( #if NeedFunctionPrototypes WindowPtr /* pWin */, int /* x */, int /* y */ #endif ); static void SetupBackgroundPainter ( #if NeedFunctionPrototypes WindowPtr /* pWin */, GCPtr /* pGC */ #endif ); static int DeliverEventsToMultibuffer ( #if NeedFunctionPrototypes MultibufferPtr /* pMultibuffer */, xEvent * /* pEvents */, int /* count */, Mask /* filter */ #endif ); void MultibufferExtensionInit() { ExtensionEntry *extEntry; int i, j; ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; /* * allocate private pointers in windows and screens. Allocating * window privates may seem like an unnecessary expense, but every * PositionWindow call must check to see if the window is * multi-buffered; a resource lookup is too expensive. */ MultibufferScreenIndex = AllocateScreenPrivateIndex (); if (MultibufferScreenIndex < 0) return; MultibufferWindowIndex = AllocateWindowPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) || !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) { for (j = 0; j < i; j++) xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr); return; } pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen; /* * wrap PositionWindow to resize the pixmap when the window * changes size */ pMultibufferScreen->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = MultibufferPositionWindow; } /* * create the resource types */ MultibufferDrawableResType = CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE; MultibufferResType = CreateNewResourceType(MultibufferDelete); MultibuffersResType = CreateNewResourceType(MultibuffersDelete); OtherClientResType = CreateNewResourceType(OtherClientDelete); if (MultibufferDrawableResType && MultibufferResType && MultibuffersResType && OtherClientResType && (extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME, MultibufferNumberEvents, MultibufferNumberErrors, ProcMultibufferDispatch, SProcMultibufferDispatch, MultibufferResetProc, StandardMinorOpcode))) { MultibufferReqCode = (unsigned char)extEntry->base; MultibufferEventBase = extEntry->eventBase; MultibufferErrorBase = extEntry->errorBase; EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent; EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent; } } /*ARGSUSED*/ static void MultibufferResetProc (extEntry) ExtensionEntry *extEntry; { int i; ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; if (MultibufferScreenIndex < 0) return; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if (pScreen->devPrivates[MultibufferScreenIndex].ptr) { pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; pScreen->PositionWindow = pMultibufferScreen->PositionWindow; xfree (pMultibufferScreen); } } } static int ProcGetBufferVersion (client) register ClientPtr client; { xMbufGetBufferVersionReply rep; register int n; REQUEST_SIZE_MATCH (xMbufGetBufferVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.majorVersion = MULTIBUFFER_MAJOR_VERSION; rep.minorVersion = MULTIBUFFER_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); } WriteToClient(client, sizeof (xMbufGetBufferVersionReply), (char *)&rep); return (client->noClientException); } static void SetupBackgroundPainter (pWin, pGC) WindowPtr pWin; GCPtr pGC; { pointer gcvalues[4]; int ts_x_origin, ts_y_origin; PixUnion background; int backgroundState; Mask gcmask; /* * First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ ts_x_origin = ts_y_origin = 0; while (pWin->backgroundState == ParentRelative) { ts_x_origin -= pWin->origin.x; ts_y_origin -= pWin->origin.y; pWin = pWin->parent; } backgroundState = pWin->backgroundState; background = pWin->background; switch (backgroundState) { case BackgroundPixel: gcvalues[0] = (pointer) background.pixel; gcvalues[1] = (pointer) FillSolid; gcmask = GCForeground|GCFillStyle; break; case BackgroundPixmap: gcvalues[0] = (pointer) FillTiled; gcvalues[1] = (pointer) background.pixmap; gcvalues[2] = (pointer) ts_x_origin; gcvalues[3] = (pointer) ts_y_origin; gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin; break; default: gcvalues[0] = (pointer) GXnoop; gcmask = GCFunction; } DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE); } int CreateImageBuffers (pWin, nbuf, ids, action, hint) WindowPtr pWin; int nbuf; XID *ids; int action; int hint; { MultibuffersPtr pMultibuffers; MultibufferPtr pMultibuffer; ScreenPtr pScreen; int width, height, depth; int i; GCPtr pClearGC = NULL; xRectangle clearRect; DestroyImageBuffers(pWin); pMultibuffers = (MultibuffersPtr) xalloc (sizeof (MultibuffersRec) + nbuf * sizeof (MultibufferRec)); if (!pMultibuffers) return BadAlloc; pMultibuffers->pWindow = pWin; pMultibuffers->buffers = (MultibufferPtr) (pMultibuffers + 1); pMultibuffers->refcnt = pMultibuffers->numMultibuffer = 0; if (!AddResource (pWin->drawable.id, MultibuffersResType, (pointer) pMultibuffers)) return BadAlloc; width = pWin->drawable.width; height = pWin->drawable.height; depth = pWin->drawable.depth; pScreen = pWin->drawable.pScreen; if (pWin->backgroundState != None) { pClearGC = GetScratchGC (pWin->drawable.depth, pScreen); SetupBackgroundPainter (pWin, pClearGC); clearRect.x = clearRect.y = 0; clearRect.width = width; clearRect.height = height; } for (i = 0; i < nbuf; i++) { pMultibuffer = &pMultibuffers->buffers[i]; pMultibuffer->eventMask = 0L; pMultibuffer->otherEventMask = 0L; pMultibuffer->otherClients = (OtherClientsPtr) NULL; pMultibuffer->number = i; pMultibuffer->side = MultibufferSideMono; pMultibuffer->clobber = MultibufferUnclobbered; pMultibuffer->pMultibuffers = pMultibuffers; if (!AddResource (ids[i], MultibufferResType, (pointer) pMultibuffer)) break; pMultibuffer->pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, depth); if (!pMultibuffer->pPixmap) break; if (!AddResource (ids[i], MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap)) { FreeResource (ids[i], MultibufferResType); (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap); break; } pMultibuffer->pPixmap->drawable.id = ids[i]; if (i > 0 && pClearGC) { ValidateGC((DrawablePtr)pMultibuffer->pPixmap, pClearGC); (*pClearGC->ops->PolyFillRect)((DrawablePtr)pMultibuffer->pPixmap, pClearGC, 1, &clearRect); } } pMultibuffers->numMultibuffer = i; pMultibuffers->refcnt = i; pMultibuffers->displayedMultibuffer = -1; if (i > 0) AliasMultibuffer (pMultibuffers, 0); pMultibuffers->updateAction = action; pMultibuffers->updateHint = hint; pMultibuffers->windowMode = MultibufferModeMono; pMultibuffers->lastUpdate.months = 0; pMultibuffers->lastUpdate.milliseconds = 0; pMultibuffers->width = width; pMultibuffers->height = height; pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers; if (pClearGC) FreeScratchGC(pClearGC); return Success; } static int ProcCreateImageBuffers (client) register ClientPtr client; { REQUEST(xMbufCreateImageBuffersReq); xMbufCreateImageBuffersReply rep; register int n; WindowPtr pWin; XID *ids; int len, nbuf; int i; int err; REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq); len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2); if (len == 0) return BadLength; if (!(pWin = LookupWindow (stuff->window, client))) return BadWindow; if (pWin->drawable.class == InputOnly) return BadMatch; switch (stuff->updateAction) { case MultibufferUpdateActionUndefined: case MultibufferUpdateActionBackground: case MultibufferUpdateActionUntouched: case MultibufferUpdateActionCopied: break; default: client->errorValue = stuff->updateAction; return BadValue; } switch (stuff->updateHint) { case MultibufferUpdateHintFrequent: case MultibufferUpdateHintIntermittent: case MultibufferUpdateHintStatic: break; default: client->errorValue = stuff->updateHint; return BadValue; } nbuf = len; ids = (XID *) &stuff[1]; for (i = 0; i < nbuf; i++) { LEGAL_NEW_RESOURCE(ids[i], client); } err = CreateImageBuffers (pWin, nbuf, ids, stuff->updateAction, stuff->updateHint); if (err != Success) return err; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.numberBuffer, n); } WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char *)&rep); return (client->noClientException); } static int ProcDisplayImageBuffers (client) register ClientPtr client; { REQUEST(xMbufDisplayImageBuffersReq); MultibufferPtr *pMultibuffer; MultibuffersPtr *ppMultibuffers; int nbuf; XID *ids; int i, j; CARD32 minDelay; TimeStamp activateTime, bufferTime; REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq); nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2); if (!nbuf) return Success; minDelay = stuff->minDelay; ids = (XID *) &stuff[1]; ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr)); pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr)); if (!ppMultibuffers || !pMultibuffer) { if (ppMultibuffers) DEALLOCATE_LOCAL(ppMultibuffers); if (pMultibuffer) DEALLOCATE_LOCAL(pMultibuffer); client->errorValue = 0; return BadAlloc; } activateTime.months = 0; activateTime.milliseconds = 0; for (i = 0; i < nbuf; i++) { pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType); if (!pMultibuffer[i]) { DEALLOCATE_LOCAL(ppMultibuffers); DEALLOCATE_LOCAL(pMultibuffer); client->errorValue = ids[i]; return MultibufferErrorBase + MultibufferBadBuffer; } ppMultibuffers[i] = pMultibuffer[i]->pMultibuffers; for (j = 0; j < i; j++) { if (ppMultibuffers[i] == ppMultibuffers[j]) { DEALLOCATE_LOCAL(ppMultibuffers); DEALLOCATE_LOCAL(pMultibuffer); client->errorValue = ids[i]; return BadMatch; } } bufferTime = ppMultibuffers[i]->lastUpdate; BumpTimeStamp (&bufferTime, minDelay); if (CompareTimeStamps (bufferTime, activateTime) == LATER) activateTime = bufferTime; } UpdateCurrentTime (); if (CompareTimeStamps (activateTime, currentTime) == LATER && QueueDisplayRequest (client, activateTime)) { ; } else PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf); DEALLOCATE_LOCAL(ppMultibuffers); DEALLOCATE_LOCAL(pMultibuffer); return Success; } static int ProcDestroyImageBuffers (client) register ClientPtr client; { REQUEST (xMbufDestroyImageBuffersReq); WindowPtr pWin; REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq); if (!(pWin = LookupWindow (stuff->window, client))) return BadWindow; DestroyImageBuffers (pWin); return Success; } static int ProcSetMBufferAttributes (client) register ClientPtr client; { REQUEST (xMbufSetMBufferAttributesReq); WindowPtr pWin; MultibuffersPtr pMultibuffers; int len; Mask vmask; Mask index2; CARD32 updateHint; XID *vlist; REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); if (!pMultibuffers) return BadMatch; len = stuff->length - (sizeof (xMbufSetMBufferAttributesReq) >> 2); vmask = stuff->valueMask; if (len != Ones (vmask)) return BadLength; vlist = (XID *) &stuff[1]; while (vmask) { index2 = (Mask) lowbit (vmask); vmask &= ~index2; switch (index2) { case MultibufferWindowUpdateHint: updateHint = (CARD32) *vlist; switch (updateHint) { case MultibufferUpdateHintFrequent: case MultibufferUpdateHintIntermittent: case MultibufferUpdateHintStatic: pMultibuffers->updateHint = updateHint; break; default: client->errorValue = updateHint; return BadValue; } vlist++; break; default: client->errorValue = stuff->valueMask; return BadValue; } } return Success; } static int ProcGetMBufferAttributes (client) ClientPtr client; { REQUEST (xMbufGetMBufferAttributesReq); WindowPtr pWin; MultibuffersPtr pMultibuffers; XID *ids; xMbufGetMBufferAttributesReply rep; int i, n; REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq); pWin = LookupWindow (stuff->window, client); if (!pWin) return BadWindow; pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); if (!pMultibuffers) return BadAccess; ids = (XID *) ALLOCATE_LOCAL (pMultibuffers->numMultibuffer * sizeof (XID)); if (!ids) return BadAlloc; for (i = 0; i < pMultibuffers->numMultibuffer; i++) ids[i] = pMultibuffers->buffers[i].pPixmap->drawable.id; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = pMultibuffers->numMultibuffer; rep.displayedBuffer = pMultibuffers->displayedMultibuffer; rep.updateAction = pMultibuffers->updateAction; rep.updateHint = pMultibuffers->updateHint; rep.windowMode = pMultibuffers->windowMode; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.displayedBuffer, n); SwapLongs (ids, pMultibuffers->numMultibuffer); } WriteToClient (client, sizeof(xMbufGetMBufferAttributesReply), (char *)&rep); WriteToClient (client, (int)(pMultibuffers->numMultibuffer * sizeof (XID)), (char *)ids); DEALLOCATE_LOCAL((pointer) ids); return client->noClientException; } static int ProcSetBufferAttributes (client) register ClientPtr client; { REQUEST(xMbufSetBufferAttributesReq); MultibufferPtr pMultibuffer; int len; Mask vmask, index2; XID *vlist; Mask eventMask; int result; REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq); pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; len = stuff->length - (sizeof (xMbufSetBufferAttributesReq) >> 2); vmask = stuff->valueMask; if (len != Ones (vmask)) return BadLength; vlist = (XID *) &stuff[1]; while (vmask) { index2 = (Mask) lowbit (vmask); vmask &= ~index2; switch (index2) { case MultibufferBufferEventMask: eventMask = (Mask) *vlist; vlist++; result = EventSelectForMultibuffer (pMultibuffer, client, eventMask); if (result != Success) return result; break; default: client->errorValue = stuff->valueMask; return BadValue; } } return Success; } int ProcGetBufferAttributes (client) register ClientPtr client; { REQUEST(xMbufGetBufferAttributesReq); MultibufferPtr pMultibuffer; xMbufGetBufferAttributesReply rep; OtherClientsPtr other; int n; REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq); pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.window = pMultibuffer->pMultibuffers->pWindow->drawable.id; if (bClient (pMultibuffer) == client) rep.eventMask = pMultibuffer->eventMask; else { rep.eventMask = (Mask) 0L; for (other = pMultibuffer->otherClients; other; other = other->next) if (SameClient (other, client)) { rep.eventMask = other->mask; break; } } rep.bufferIndex = pMultibuffer->number; rep.side = pMultibuffer->side; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.window, n); swapl(&rep.eventMask, n); swaps(&rep.bufferIndex, n); } WriteToClient(client, sizeof (xMbufGetBufferAttributesReply), (char *)&rep); return (client->noClientException); } static int ProcGetBufferInfo (client) register ClientPtr client; { REQUEST (xMbufGetBufferInfoReq); DrawablePtr pDrawable; xMbufGetBufferInfoReply rep; ScreenPtr pScreen; int i, j, k; int n; xMbufBufferInfo *pInfo; int nInfo; DepthPtr pDepth; pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client); if (!pDrawable) return BadDrawable; pScreen = pDrawable->pScreen; nInfo = 0; for (i = 0; i < pScreen->numDepths; i++) { pDepth = &pScreen->allowedDepths[i]; nInfo += pDepth->numVids; } pInfo = (xMbufBufferInfo *) ALLOCATE_LOCAL (nInfo * sizeof (xMbufBufferInfo)); if (!pInfo) return BadAlloc; rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = nInfo * (sizeof (xMbufBufferInfo) >> 2); rep.normalInfo = nInfo; rep.stereoInfo = 0; if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swaps(&rep.normalInfo, n); swaps(&rep.stereoInfo, n); } k = 0; for (i = 0; i < pScreen->numDepths; i++) { pDepth = &pScreen->allowedDepths[i]; for (j = 0; j < pDepth->numVids; j++) { pInfo[k].visualID = pDepth->vids[j]; pInfo[k].maxBuffers = 0; pInfo[k].depth = pDepth->depth; if (client->swapped) { swapl (&pInfo[k].visualID, n); swaps (&pInfo[k].maxBuffers, n); } k++; } } WriteToClient (client, sizeof (xMbufGetBufferInfoReply), (pointer) &rep); WriteToClient (client, (int) nInfo * sizeof (xMbufBufferInfo), (pointer) pInfo); DEALLOCATE_LOCAL ((pointer) pInfo); return client->noClientException; } static int ProcClearImageBufferArea (client) register ClientPtr client; { REQUEST (xMbufClearImageBufferAreaReq); MultibufferPtr pMultibuffer; WindowPtr pWin; xRectangle clearRect; int width, height; DrawablePtr pDrawable; ScreenPtr pScreen; REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq); pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) { client->errorValue = stuff->exposures; return(BadValue); } pWin = pMultibuffer->pMultibuffers->pWindow; width = pWin->drawable.width; height = pWin->drawable.height; pScreen = pWin->drawable.pScreen; clearRect.x = stuff->x; clearRect.y = stuff->y; clearRect.width = stuff->width ? stuff->width : width; clearRect.height = stuff->height ? stuff->height : height; if (pWin->backgroundState != None) { GCPtr pClearGC; pClearGC = GetScratchGC (pWin->drawable.depth, pScreen); SetupBackgroundPainter (pWin, pClearGC); if (pMultibuffer->number == pMultibuffer->pMultibuffers->displayedMultibuffer) pDrawable = (DrawablePtr)pWin; else pDrawable = (DrawablePtr)pMultibuffer->pPixmap; ValidateGC(pDrawable, pClearGC); (*pClearGC->ops->PolyFillRect) (pDrawable, pClearGC, 1, &clearRect); FreeScratchGC(pClearGC); } if (stuff->exposures) { RegionRec region; BoxRec box; box.x1 = clearRect.x; box.y1 = clearRect.y; box.x2 = clearRect.x + clearRect.width; box.y2 = clearRect.y + clearRect.height; REGION_INIT(pScreen, ®ion, &box, 1); MultibufferExpose(pMultibuffer, ®ion); REGION_UNINIT(pScreen, ®ion); } return Success; } static int ProcMultibufferDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_MbufGetBufferVersion: return ProcGetBufferVersion (client); case X_MbufCreateImageBuffers: return ProcCreateImageBuffers (client); case X_MbufDisplayImageBuffers: return ProcDisplayImageBuffers (client); case X_MbufDestroyImageBuffers: return ProcDestroyImageBuffers (client); case X_MbufSetMBufferAttributes: return ProcSetMBufferAttributes (client); case X_MbufGetMBufferAttributes: return ProcGetMBufferAttributes (client); case X_MbufSetBufferAttributes: return ProcSetBufferAttributes (client); case X_MbufGetBufferAttributes: return ProcGetBufferAttributes (client); case X_MbufGetBufferInfo: return ProcGetBufferInfo (client); case X_MbufClearImageBufferArea: return ProcClearImageBufferArea (client); default: return BadRequest; } } static int SProcGetBufferVersion (client) register ClientPtr client; { register int n; REQUEST (xMbufGetBufferVersionReq); swaps (&stuff->length, n); return ProcGetBufferVersion (client); } static int SProcCreateImageBuffers (client) register ClientPtr client; { register int n; REQUEST (xMbufCreateImageBuffersReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq); swapl (&stuff->window, n); SwapRestL(stuff); return ProcCreateImageBuffers (client); } static int SProcDisplayImageBuffers (client) register ClientPtr client; { register int n; REQUEST (xMbufDisplayImageBuffersReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq); swaps (&stuff->minDelay, n); swaps (&stuff->maxDelay, n); SwapRestL(stuff); return ProcDisplayImageBuffers (client); } static int SProcDestroyImageBuffers (client) register ClientPtr client; { register int n; REQUEST (xMbufDestroyImageBuffersReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq); swapl (&stuff->window, n); return ProcDestroyImageBuffers (client); } static int SProcSetMBufferAttributes (client) register ClientPtr client; { register int n; REQUEST (xMbufSetMBufferAttributesReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE(xMbufSetMBufferAttributesReq); swapl (&stuff->window, n); swapl (&stuff->valueMask, n); SwapRestL(stuff); return ProcSetMBufferAttributes (client); } static int SProcGetMBufferAttributes (client) register ClientPtr client; { register int n; REQUEST (xMbufGetMBufferAttributesReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE(xMbufGetMBufferAttributesReq); swapl (&stuff->window, n); return ProcGetMBufferAttributes (client); } static int SProcSetBufferAttributes (client) register ClientPtr client; { register int n; REQUEST (xMbufSetBufferAttributesReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE(xMbufSetBufferAttributesReq); swapl (&stuff->buffer, n); swapl (&stuff->valueMask, n); SwapRestL(stuff); return ProcSetBufferAttributes (client); } static int SProcGetBufferAttributes (client) register ClientPtr client; { register int n; REQUEST (xMbufGetBufferAttributesReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE(xMbufGetBufferAttributesReq); swapl (&stuff->buffer, n); return ProcGetBufferAttributes (client); } static int SProcGetBufferInfo (client) register ClientPtr client; { register int n; REQUEST (xMbufGetBufferInfoReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xMbufGetBufferInfoReq); swapl (&stuff->drawable, n); return ProcGetBufferInfo (client); } static int SProcClearImageBufferArea(client) register ClientPtr client; { register char n; REQUEST(xMbufClearImageBufferAreaReq); swaps(&stuff->length, n); REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq); swapl(&stuff->buffer, n); swaps(&stuff->x, n); swaps(&stuff->y, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return ProcClearImageBufferArea(client); } static int SProcMultibufferDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_MbufGetBufferVersion: return SProcGetBufferVersion (client); case X_MbufCreateImageBuffers: return SProcCreateImageBuffers (client); case X_MbufDisplayImageBuffers: return SProcDisplayImageBuffers (client); case X_MbufDestroyImageBuffers: return SProcDestroyImageBuffers (client); case X_MbufSetMBufferAttributes: return SProcSetMBufferAttributes (client); case X_MbufGetMBufferAttributes: return SProcGetMBufferAttributes (client); case X_MbufSetBufferAttributes: return SProcSetBufferAttributes (client); case X_MbufGetBufferAttributes: return SProcGetBufferAttributes (client); case X_MbufGetBufferInfo: return SProcGetBufferInfo (client); case X_MbufClearImageBufferArea: return SProcClearImageBufferArea (client); default: return BadRequest; } } static void SUpdateNotifyEvent (from, to) xMbufUpdateNotifyEvent *from, *to; { to->type = from->type; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->buffer, to->buffer); cpswapl (from->timeStamp, to->timeStamp); } static void SClobberNotifyEvent (from, to) xMbufClobberNotifyEvent *from, *to; { to->type = from->type; cpswaps (from->sequenceNumber, to->sequenceNumber); cpswapl (from->buffer, to->buffer); to->state = from->state; } static void PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf) MultibufferPtr *pMultibuffer; MultibuffersPtr *ppMultibuffers; int nbuf; { GCPtr pGC; PixmapPtr pPrevPixmap, pNewPixmap; xRectangle clearRect; WindowPtr pWin; RegionPtr pExposed; int i; MultibufferPtr pPrevMultibuffer; XID graphicsExpose; UpdateCurrentTime (); for (i = 0; i < nbuf; i++) { pWin = ppMultibuffers[i]->pWindow; pGC = GetScratchGC (pWin->drawable.depth, pWin->drawable.pScreen); pPrevMultibuffer = &ppMultibuffers[i]->buffers[ppMultibuffers[i]->displayedMultibuffer]; pPrevPixmap = pPrevMultibuffer->pPixmap; pNewPixmap = pMultibuffer[i]->pPixmap; switch (ppMultibuffers[i]->updateAction) { case MultibufferUpdateActionUndefined: break; case MultibufferUpdateActionBackground: SetupBackgroundPainter (pWin, pGC); ValidateGC ((DrawablePtr)pPrevPixmap, pGC); clearRect.x = 0; clearRect.y = 0; clearRect.width = pPrevPixmap->drawable.width; clearRect.height = pPrevPixmap->drawable.height; (*pGC->ops->PolyFillRect) ((DrawablePtr)pPrevPixmap, pGC, 1, &clearRect); break; case MultibufferUpdateActionUntouched: /* copy the window to the pixmap that represents the * currently displayed buffer */ if (pPrevMultibuffer->eventMask & ExposureMask) { graphicsExpose = TRUE; DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE); } ValidateGC ((DrawablePtr)pPrevPixmap, pGC); pExposed = (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pPrevPixmap, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); /* if we couldn't copy the whole window to the buffer, * send expose events (if any client wants them) */ if (pPrevMultibuffer->eventMask & ExposureMask) { /* some client wants expose events */ if (pExposed) { RegionPtr pWinSize; ScreenPtr pScreen = pWin->drawable.pScreen; pWinSize = CreateUnclippedWinSize (pWin); /* pExposed is window-relative, but at this point * pWinSize is screen-relative. Make pWinSize be * window-relative so that region ops involving * pExposed and pWinSize behave sensibly. */ REGION_TRANSLATE(pScreen, pWinSize, -pWin->drawable.x, -pWin->drawable.y); REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize); REGION_DESTROY(pScreen, pWinSize); MultibufferExpose (pPrevMultibuffer, pExposed); REGION_DESTROY(pScreen, pExposed); } graphicsExpose = FALSE; DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE); } break; /* end case MultibufferUpdateActionUntouched */ case MultibufferUpdateActionCopied: ValidateGC ((DrawablePtr)pPrevPixmap, pGC); (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pPrevPixmap, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); break; } /* end switch on update action */ /* display the new buffer */ ValidateGC ((DrawablePtr)pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr)pNewPixmap, (DrawablePtr)pWin, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); ppMultibuffers[i]->lastUpdate = currentTime; MultibufferUpdate (pMultibuffer[i], ppMultibuffers[i]->lastUpdate.milliseconds); AliasMultibuffer (ppMultibuffers[i], pMultibuffer[i] - ppMultibuffers[i]->buffers); FreeScratchGC (pGC); } } DrawablePtr GetBufferPointer (pWin, i) WindowPtr pWin; int i; { MultibuffersPtr pMultibuffers; if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) return NULL; return (DrawablePtr) pMultibuffers->buffers[i].pPixmap; } int DisplayImageBuffers (ids, nbuf) XID *ids; int nbuf; { MultibufferPtr *pMultibuffer; MultibuffersPtr *pMultibuffers; int i, j; pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL (nbuf * sizeof *pMultibuffer + nbuf * sizeof *pMultibuffers); if (!pMultibuffer) return BadAlloc; pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf); for (i = 0; i < nbuf; i++) { pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType); if (!pMultibuffer[i]) { DEALLOCATE_LOCAL (pMultibuffer); return MultibufferErrorBase + MultibufferBadBuffer; } pMultibuffers[i] = pMultibuffer[i]->pMultibuffers; for (j = 0; j < i; j++) if (pMultibuffers[i] == pMultibuffers[j]) { DEALLOCATE_LOCAL (pMultibuffer); return BadMatch; } } PerformDisplayRequest (pMultibuffers, pMultibuffer, nbuf); DEALLOCATE_LOCAL (pMultibuffer); return Success; } static Bool QueueDisplayRequest (client, activateTime) ClientPtr client; TimeStamp activateTime; { /* see xtest.c:ProcXTestFakeInput for code similar to this */ if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) { return FALSE; } /* swap the request back so we can simply re-execute it */ if (client->swapped) { register int n; REQUEST (xMbufDisplayImageBuffersReq); SwapRestL(stuff); swaps (&stuff->length, n); swaps (&stuff->minDelay, n); swaps (&stuff->maxDelay, n); } ResetCurrentRequest (client); client->sequence--; return TRUE; } /* * Deliver events to a buffer */ static int DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter) MultibufferPtr pMultibuffer; xEvent *pEvents; int count; Mask filter; { int deliveries = 0, nondeliveries = 0; int attempt; OtherClients *other; /* if nobody wants the event, we're done */ if (!((pMultibuffer->otherEventMask|pMultibuffer->eventMask) & filter)) return 0; /* maybe send event to owner */ if ((attempt = TryClientEvents( bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0) { if (attempt > 0) deliveries++; else nondeliveries--; } /* maybe send event to other clients */ for (other = pMultibuffer->otherClients; other; other=other->next) { if ((attempt = TryClientEvents( rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0) { if (attempt > 0) deliveries++; else nondeliveries--; } } if (deliveries) return deliveries; return nondeliveries; } /* * Send Expose events to interested clients */ void MultibufferExpose (pMultibuffer, pRegion) MultibufferPtr pMultibuffer; RegionPtr pRegion; { if (pRegion && !REGION_NIL(pRegion)) { xEvent *pEvent; PixmapPtr pPixmap; register xEvent *pe; register BoxPtr pBox; register int i; int numRects; pPixmap = pMultibuffer->pPixmap; REGION_TRANSLATE(pPixmap->drawable.pScreen, pRegion, -pPixmap->drawable.x, -pPixmap->drawable.y); /* XXX MultibufferExpose "knows" the region representation */ numRects = REGION_NUM_RECTS(pRegion); pBox = REGION_RECTS(pRegion); pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)); if (pEvent) { pe = pEvent; for (i=1; i<=numRects; i++, pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pPixmap->drawable.id; pe->u.expose.x = pBox->x1; pe->u.expose.y = pBox->y1; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = (numRects - i); } (void) DeliverEventsToMultibuffer (pMultibuffer, pEvent, numRects, ExposureMask); DEALLOCATE_LOCAL(pEvent); } } } /* send UpdateNotify event */ void MultibufferUpdate (pMultibuffer, time2) MultibufferPtr pMultibuffer; CARD32 time2; { xMbufUpdateNotifyEvent event; event.type = MultibufferEventBase + MultibufferUpdateNotify; event.buffer = pMultibuffer->pPixmap->drawable.id; event.timeStamp = time2; (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event, 1, (Mask)MultibufferUpdateNotifyMask); } /* * The sample implementation will never generate MultibufferClobberNotify * events */ void MultibufferClobber (pMultibuffer) MultibufferPtr pMultibuffer; { xMbufClobberNotifyEvent event; event.type = MultibufferEventBase + MultibufferClobberNotify; event.buffer = pMultibuffer->pPixmap->drawable.id; event.state = pMultibuffer->clobber; (void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event, 1, (Mask)MultibufferClobberNotifyMask); } /* * make the resource id for buffer i refer to the window * drawable instead of the pixmap; */ static void AliasMultibuffer (pMultibuffers, i) MultibuffersPtr pMultibuffers; int i; { MultibufferPtr pMultibuffer; if (i == pMultibuffers->displayedMultibuffer) return; /* * remove the old association */ if (pMultibuffers->displayedMultibuffer >= 0) { pMultibuffer = &pMultibuffers->buffers[pMultibuffers->displayedMultibuffer]; ChangeResourceValue (pMultibuffer->pPixmap->drawable.id, MultibufferDrawableResType, (pointer) pMultibuffer->pPixmap); } /* * make the new association */ pMultibuffer = &pMultibuffers->buffers[i]; ChangeResourceValue (pMultibuffer->pPixmap->drawable.id, MultibufferDrawableResType, (pointer) pMultibuffers->pWindow); pMultibuffers->displayedMultibuffer = i; } /* * free everything associated with multibuffering for this * window */ void DestroyImageBuffers (pWin) WindowPtr pWin; { FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE); /* Zero out the window's pointer to the buffers so they won't be reused */ pWin->devPrivates[MultibufferWindowIndex].ptr = NULL; } /* * resize the buffers when the window is resized */ static Bool MultibufferPositionWindow (pWin, x, y) WindowPtr pWin; int x, y; { ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; MultibuffersPtr pMultibuffers; MultibufferPtr pMultibuffer; int width, height; int i; int dx, dy, dw, dh; int sourcex, sourcey; int destx, desty; PixmapPtr pPixmap; GCPtr pGC; int savewidth, saveheight; xRectangle clearRect; Bool clear; pScreen = pWin->drawable.pScreen; pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; (*pMultibufferScreen->PositionWindow) (pWin, x, y); /* if this window is not multibuffered, we're done */ if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) return TRUE; /* if new size is same as old, we're done */ if (pMultibuffers->width == pWin->drawable.width && pMultibuffers->height == pWin->drawable.height) return TRUE; width = pWin->drawable.width; height = pWin->drawable.height; dx = pWin->drawable.x - pMultibuffers->x; dy = pWin->drawable.x - pMultibuffers->y; dw = width - pMultibuffers->width; dh = height - pMultibuffers->height; GravityTranslate (0, 0, -dx, -dy, dw, dh, pWin->bitGravity, &destx, &desty); /* if the window grew, remember to paint the window background, * and maybe send expose events, for the new areas of the buffers */ clear = pMultibuffers->width < width || pMultibuffers->height < height || pWin->bitGravity == ForgetGravity; sourcex = 0; sourcey = 0; savewidth = pMultibuffers->width; saveheight = pMultibuffers->height; /* clip rectangle to source and destination */ if (destx < 0) { savewidth += destx; sourcex -= destx; destx = 0; } if (destx + savewidth > width) savewidth = width - destx; if (desty < 0) { saveheight += desty; sourcey -= desty; desty = 0; } if (desty + saveheight > height) saveheight = height - desty; pMultibuffers->width = width; pMultibuffers->height = height; pMultibuffers->x = pWin->drawable.x; pMultibuffers->y = pWin->drawable.y; pGC = GetScratchGC (pWin->drawable.depth, pScreen); if (clear) { SetupBackgroundPainter (pWin, pGC); clearRect.x = 0; clearRect.y = 0; clearRect.width = width; clearRect.height = height; } for (i = 0; i < pMultibuffers->numMultibuffer; i++) { pMultibuffer = &pMultibuffers->buffers[i]; pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pWin->drawable.depth); if (!pPixmap) { DestroyImageBuffers (pWin); break; } ValidateGC ((DrawablePtr)pPixmap, pGC); /* * I suppose this could avoid quite a bit of work if * it computed the minimal area required. */ if (clear) (*pGC->ops->PolyFillRect) ((DrawablePtr)pPixmap, pGC, 1, &clearRect); if (pWin->bitGravity != ForgetGravity) { (*pGC->ops->CopyArea) ((DrawablePtr)pMultibuffer->pPixmap, (DrawablePtr)pPixmap, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); } pPixmap->drawable.id = pMultibuffer->pPixmap->drawable.id; (*pScreen->DestroyPixmap) (pMultibuffer->pPixmap); pMultibuffer->pPixmap = pPixmap; if (i != pMultibuffers->displayedMultibuffer) { ChangeResourceValue (pPixmap->drawable.id, MultibufferDrawableResType, (pointer) pPixmap); } } FreeScratchGC (pGC); return TRUE; } /* Resource delete func for MultibufferDrawableResType */ /*ARGSUSED*/ static int MultibufferDrawableDelete (value, id) pointer value; XID id; { DrawablePtr pDrawable = (DrawablePtr)value; WindowPtr pWin; MultibuffersPtr pMultibuffers; PixmapPtr pPixmap; if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDrawable; pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr; pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap; } else { pPixmap = (PixmapPtr) pDrawable; } (*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap); return Success; } /* Resource delete func for MultibufferResType */ /*ARGSUSED*/ static int MultibufferDelete (value, id) pointer value; XID id; { MultibufferPtr pMultibuffer = (MultibufferPtr)value; MultibuffersPtr pMultibuffers; pMultibuffers = pMultibuffer->pMultibuffers; if (--pMultibuffers->refcnt == 0) { FreeResourceByType (pMultibuffers->pWindow->drawable.id, MultibuffersResType, TRUE); xfree (pMultibuffers); } return Success; } /* Resource delete func for MultibuffersResType */ /*ARGSUSED*/ static int MultibuffersDelete (value, id) pointer value; XID id; { MultibuffersPtr pMultibuffers = (MultibuffersPtr)value; int i; if (pMultibuffers->refcnt == pMultibuffers->numMultibuffer) { for (i = pMultibuffers->numMultibuffer; --i >= 0; ) FreeResource (pMultibuffers->buffers[i].pPixmap->drawable.id, 0); } return Success; } /* Resource delete func for OtherClientResType */ static int OtherClientDelete (value, id) pointer value; XID id; { MultibufferPtr pMultibuffer = (MultibufferPtr)value; register OtherClientsPtr other, prev; prev = 0; for (other = pMultibuffer->otherClients; other; other = other->next) { if (other->resource == id) { if (prev) prev->next = other->next; else pMultibuffer->otherClients = other->next; xfree (other); RecalculateMultibufferOtherEvents (pMultibuffer); break; } prev = other; } return Success; } static int EventSelectForMultibuffer (pMultibuffer, client, mask) MultibufferPtr pMultibuffer; ClientPtr client; Mask mask; { OtherClientsPtr other; if (mask & ~ValidEventMasks) { client->errorValue = mask; return BadValue; } if (bClient (pMultibuffer) == client) { pMultibuffer->eventMask = mask; } else /* some other client besides the creator wants events */ { for (other = pMultibuffer->otherClients; other; other = other->next) { if (SameClient (other, client)) { if (mask == 0) { FreeResource (other->resource, RT_NONE); break; } other->mask = mask; break; } } if (!other) { /* new client that never selected events on this buffer before */ other = (OtherClients *) xalloc (sizeof (OtherClients)); if (!other) return BadAlloc; other->mask = mask; other->resource = FakeClientID (client->index); if (!AddResource (other->resource, OtherClientResType, (pointer) pMultibuffer)) { xfree (other); return BadAlloc; } other->next = pMultibuffer->otherClients; pMultibuffer->otherClients = other; } RecalculateMultibufferOtherEvents (pMultibuffer); } return (client->noClientException); } /* or together all the otherClients event masks */ static void RecalculateMultibufferOtherEvents (pMultibuffer) MultibufferPtr pMultibuffer; { Mask otherEventMask; OtherClients *other; otherEventMask = 0L; for (other = pMultibuffer->otherClients; other; other = other->next) otherEventMask |= other->mask; pMultibuffer->otherEventMask = otherEventMask; } /* add milliseconds to a timestamp, handling overflow */ static void BumpTimeStamp (ts, inc) TimeStamp *ts; CARD32 inc; { CARD32 newms; newms = ts->milliseconds + inc; if (newms < ts->milliseconds) ts->months++; ts->milliseconds = newms; } vnc_unixsrc/Xvnc/programs/Xserver/Xext/appgroup.c0100664000076400007640000005175607120677563021662 0ustar constconst/* Copyright (c) 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: appgroup.c /main/20 1996/12/08 16:14:27 kaleb $ */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" #include "Xproto.h" #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "scrnintstr.h" #include "windowstr.h" #include "colormapst.h" #include "servermd.h" #define _XAG_SERVER_ #include "Xagstr.h" #define _SECURITY_SERVER #include "security.h" #include "Xfuncproto.h" #define XSERV_t #include #include "../os/osdep.h" #include typedef struct _AppGroupRec { struct _AppGroupRec* next; XID appgroupId; ClientPtr* clients; int nclients; ClientPtr leader; Bool single_screen; Window default_root; VisualID root_visual; Colormap default_colormap; Pixel black_pixel; Pixel white_pixel; xConnSetupPrefix connSetupPrefix; char* ConnectionInfo; } AppGroupRec, *AppGroupPtr; static int ProcXagDispatch (), SProcXagDispatch (); static void XagResetProc (); static unsigned char XagReqCode = 0; static int XagErrorBase; static int XagCallbackRefCount = 0; static RESTYPE RT_APPGROUP; static AppGroupPtr appGrpList = NULL; extern WindowPtr* WindowTable; extern xConnSetupPrefix connSetupPrefix; extern char* ConnectionInfo; static int XagAppGroupFree (what, id) pointer what; XID id; /* unused */ { int i; AppGroupPtr pAppGrp = (AppGroupPtr) what; if (pAppGrp->leader) for (i = 0; i < pAppGrp->nclients; i++) { pAppGrp->clients[i]->appgroup = NULL; CloseDownClient (pAppGrp->clients[i]); } if (pAppGrp == appGrpList) appGrpList = appGrpList->next; else { AppGroupPtr tpAppGrp; for (tpAppGrp = appGrpList; tpAppGrp->next != NULL; tpAppGrp = tpAppGrp->next) { if (tpAppGrp->next == pAppGrp) { tpAppGrp->next = tpAppGrp->next->next; break; } } } (void) xfree (pAppGrp->clients); (void) xfree (pAppGrp->ConnectionInfo); (void) xfree (what); return Success; } /* static */ void XagClientStateChange (pcbl, nulldata, calldata) CallbackListPtr* pcbl; pointer nulldata; pointer calldata; { SecurityAuthorizationPtr pAuth; NewClientInfoRec* pci = (NewClientInfoRec*) calldata; ClientPtr pClient = pci->client; AppGroupPtr pAppGrp; XID authId; if (!pClient->appgroup) { switch (pClient->clientState) { case ClientStateAuthenticating: case ClientStateRunning: case ClientStateCheckingSecurity: return; case ClientStateInitial: case ClientStateCheckedSecurity: /* * If the client is connecting via a firewall proxy (which * uses XC-QUERY-SECURITY-1, then the authId is available * during ClientStateCheckedSecurity, otherwise it's * available during ClientStateInitial. * * Don't get it from pClient because can't guarantee the order * of the callbacks and the security extension might not have * plugged it in yet. */ authId = AuthorizationIDOfClient(pClient); break; case ClientStateGone: case ClientStateRetained: /* * Don't get if from AuthorizationIDOfClient because can't * guarantee the order of the callbacks and the security * extension may have torn down the client's private data */ authId = pClient->authId; break; } if (authId == None) return; pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient, authId, SecurityAuthorizationResType, SecurityReadAccess); if (pAuth == NULL) return; for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next) if (pAppGrp->appgroupId == pAuth->group) break; } else { pAppGrp = pClient->appgroup; } if (!pAppGrp) return; switch (pClient->clientState) { case ClientStateAuthenticating: case ClientStateRunning: case ClientStateCheckingSecurity: break; case ClientStateInitial: case ClientStateCheckedSecurity: /* see the comment above about Initial vs. CheckedSecurity */ { /* if this client already in AppGroup, don't add it again */ int i; for (i = 0; i < pAppGrp->nclients; i++) if (pClient == pAppGrp->clients[i]) return; } pAppGrp->clients = (ClientPtr*) xrealloc (pAppGrp->clients, ++pAppGrp->nclients * sizeof (ClientPtr)); pAppGrp->clients[pAppGrp->nclients - 1] = pClient; pClient->appgroup = pAppGrp; break; case ClientStateGone: case ClientStateRetained: /* client disconnected, dump it */ { int i; for (i = 0; i < pAppGrp->nclients; i++) if (pAppGrp->clients[i] == pClient) { pAppGrp->clients[i] = NULL; break; } for (i = 0; i < pAppGrp->nclients; i++) if (pAppGrp->clients[i] == NULL && i + 1 < pAppGrp->nclients) pAppGrp->clients[i] = pAppGrp->clients[i + 1]; pAppGrp->nclients--; } pClient->appgroup = NULL; /* redundant, pClient will be freed */ break; } } void XagExtensionInit () { ExtensionEntry* extEntry; if (extEntry = AddExtension (XAGNAME, 0, XagNumberErrors, ProcXagDispatch, SProcXagDispatch, XagResetProc, StandardMinorOpcode)) { XagReqCode = (unsigned char)extEntry->base; XagErrorBase = extEntry->errorBase; RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); } } /*ARGSUSED*/ static void XagResetProc (extEntry) ExtensionEntry* extEntry; { DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL); XagCallbackRefCount = 0; while (appGrpList) XagAppGroupFree ((pointer) appGrpList, 0); } static int ProcXagQueryVersion (client) register ClientPtr client; { REQUEST (xXagQueryVersionReq); xXagQueryVersionReply rep; register int n; REQUEST_SIZE_MATCH (xXagQueryVersionReq); rep.type = X_Reply; rep.length = 0; rep.sequence_number = client->sequence; rep.server_major_version = XAG_MAJOR_VERSION; rep.server_minor_version = XAG_MINOR_VERSION; if (client->swapped) { swaps (&rep.sequence_number, n); swapl (&rep.length, n); swaps (&rep.server_major_version, n); swaps (&rep.server_minor_version, n); } WriteToClient (client, sizeof (xXagQueryVersionReply), (char *)&rep); return client->noClientException; } static void ProcessAttr (pAppGrp, client, attrib_mask, attribs) AppGroupPtr pAppGrp; ClientPtr client; unsigned int attrib_mask; CARD32* attribs; { int i; for (i = XagNsingleScreen; i <= XagNappGroupLeader; i++) { switch (attrib_mask & (1 << i)) { case XagSingleScreenMask: pAppGrp->single_screen = *attribs; break; case XagDefaultRootMask: pAppGrp->default_root = *attribs; break; case XagRootVisualMask: pAppGrp->root_visual = *attribs; break; case XagDefaultColormapMask: pAppGrp->default_colormap = *attribs; break; case XagBlackPixelMask: pAppGrp->black_pixel = *attribs; break; case XagWhitePixelMask: pAppGrp->white_pixel = *attribs; break; case XagAppGroupLeaderMask: pAppGrp->leader = client; break; default: continue; } attribs++; } } static void CreateConnectionInfo (pAppGrp) AppGroupPtr pAppGrp; { extern int connBlockScreenStart; xConnSetup *setup = (xConnSetup*) ConnectionInfo; xWindowRoot* rootp; xWindowRoot* roots[MAXSCREENS]; unsigned int rootlens[MAXSCREENS]; xDepth* depth; int olen; int snum, i; rootp = (xWindowRoot*) (ConnectionInfo + connBlockScreenStart); for (snum = 0; snum < screenInfo.numScreens; snum++) { rootlens[snum] = sizeof (xWindowRoot); roots[snum] = rootp; depth = (xDepth*) (rootp + 1); for (i = 0; i < rootp->nDepths; i++) { rootlens[snum] += sizeof (xDepth) + depth->nVisuals * sizeof (xVisualType); depth = (xDepth *)(((char*)(depth + 1)) + depth->nVisuals * sizeof (xVisualType)); } rootp = (xWindowRoot*) depth; } snum = 0; if (pAppGrp->default_root) { for (; snum < screenInfo.numVideoScreens; snum++) { if (roots[snum]->windowId == pAppGrp->default_root) break; } } olen = connBlockScreenStart + rootlens[snum]; for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) olen += rootlens[i]; pAppGrp->ConnectionInfo = (char*) xalloc (olen); if (!pAppGrp->ConnectionInfo) return; memmove (pAppGrp->ConnectionInfo, ConnectionInfo, connBlockScreenStart); ((xConnSetup*) (pAppGrp->ConnectionInfo))->numRoots = 1 + screenInfo.numScreens - screenInfo.numVideoScreens; memmove (pAppGrp->ConnectionInfo + connBlockScreenStart, (void*) roots[snum], rootlens[snum]); rootp = (xWindowRoot*) (pAppGrp->ConnectionInfo + connBlockScreenStart); if (pAppGrp->default_colormap) { rootp->defaultColormap = pAppGrp->default_colormap; rootp->whitePixel = pAppGrp->white_pixel; rootp->blackPixel = pAppGrp->black_pixel; } if (pAppGrp->root_visual) rootp->rootVisualID = pAppGrp->root_visual; rootp = (xWindowRoot*) (((char*)rootp) + rootlens[snum]); for (i = screenInfo.numVideoScreens; i < screenInfo.numScreens; i++) { memmove ((void*) rootp, (void*) roots[i], rootlens[i]); rootp = (xWindowRoot*) (((char*) rootp) + rootlens[i]); } pAppGrp->connSetupPrefix = connSetupPrefix; pAppGrp->connSetupPrefix.length = olen >> 2; } static AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs) ClientPtr client; XID appgroupId; unsigned int attrib_mask; CARD32* attribs; { AppGroupPtr pAppGrp; int i; pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec)); if (pAppGrp) { pAppGrp->next = appGrpList; appGrpList = pAppGrp; pAppGrp->appgroupId = appgroupId; pAppGrp->clients = (ClientPtr*) xalloc (0); pAppGrp->nclients = 0; pAppGrp->leader = NULL; pAppGrp->default_root = 0; pAppGrp->root_visual = 0; pAppGrp->default_colormap = 0; pAppGrp->black_pixel = -1; pAppGrp->white_pixel = -1; pAppGrp->ConnectionInfo = NULL; ProcessAttr (pAppGrp, client, attrib_mask, attribs); } return pAppGrp; } static int AttrValidate (client, attrib_mask, pAppGrp) ClientPtr client; int attrib_mask; AppGroupPtr pAppGrp; { WindowPtr pWin; int idepth, ivids, found; ScreenPtr pScreen; DepthPtr pDepth; ColormapPtr pColormap; pWin = LookupWindow (pAppGrp->default_root, client); /* XXX check that pWin is not NULL */ pScreen = pWin->drawable.pScreen; if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root) return BadWindow; pDepth = pScreen->allowedDepths; if (pAppGrp->root_visual) { found = FALSE; for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) { for (ivids = 0; ivids < pDepth->numVids; ivids++) { if (pAppGrp->root_visual == pDepth->vids[ivids]) { found = TRUE; break; } } } if (!found) return BadMatch; } if (pAppGrp->default_colormap) { pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP); /* XXX check that pColormap is not NULL */ if (pColormap->pScreen != pScreen) return BadColor; if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual)) return BadMatch; } return client->noClientException; } /* static */ int ProcXagCreate (client) register ClientPtr client; { REQUEST (xXagCreateReq); AppGroupPtr pAppGrp; int ret; REQUEST_AT_LEAST_SIZE (xXagCreateReq); LEGAL_NEW_RESOURCE (stuff->app_group, client); pAppGrp = CreateAppGroup (client, stuff->app_group, stuff->attrib_mask, (CARD32*) &stuff[1]); if (!pAppGrp) return BadAlloc; ret = AttrValidate (client, stuff->attrib_mask, pAppGrp); if (ret != Success) { XagAppGroupFree ((pointer)pAppGrp, (XID)0); return ret; } if (pAppGrp->single_screen) { CreateConnectionInfo (pAppGrp); if (!pAppGrp->ConnectionInfo) return BadAlloc; } if (!AddResource (stuff->app_group, RT_APPGROUP, (pointer)pAppGrp)) return BadAlloc; if (XagCallbackRefCount++ == 0) (void) AddCallback (&ClientStateCallback, XagClientStateChange, NULL); return client->noClientException; } /* static */ int ProcXagDestroy (client) register ClientPtr client; { AppGroupPtr pAppGrp; REQUEST (xXagDestroyReq); REQUEST_SIZE_MATCH (xXagDestroyReq); pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess); if (!pAppGrp) return XagBadAppGroup; FreeResource ((XID)stuff->app_group, RT_NONE); if (--XagCallbackRefCount == 0) (void) DeleteCallback (&ClientStateCallback, XagClientStateChange, NULL); return client->noClientException; } static int ProcXagGetAttr (client) register ClientPtr client; { AppGroupPtr pAppGrp; REQUEST (xXagGetAttrReq); xXagGetAttrReply rep; int n; REQUEST_SIZE_MATCH (xXagGetAttrReq); pAppGrp = (AppGroupPtr)SecurityLookupIDByType (client, (XID)stuff->app_group, RT_APPGROUP, SecurityReadAccess); if (!pAppGrp) return XagBadAppGroup; rep.default_root = pAppGrp->default_root; rep.root_visual = pAppGrp->root_visual; rep.default_colormap = pAppGrp->default_colormap; rep.single_screen = pAppGrp->single_screen; rep.app_group_leader = (pAppGrp->leader) ? 1 : 0; if (client->swapped) { swaps (&rep.sequence_number, n); swapl (&rep.length, n); swapl (&rep.default_root, n); swapl (&rep.root_visual, n); swapl (&rep.default_colormap, n); } WriteToClient (client, sizeof (xXagGetAttrReply), (char *)&rep); return client->noClientException; } static int ProcXagQuery (client) register ClientPtr client; { ClientPtr pClient; AppGroupPtr pAppGrp; REQUEST (xXagQueryReq); int n; REQUEST_SIZE_MATCH (xXagQueryReq); pClient = LookupClient (stuff->resource, client); for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next) for (n = 0; n < pAppGrp->nclients; n++) if (pAppGrp->clients[n] == pClient) { xXagQueryReply rep; rep.type = X_Reply; rep.length = 0; rep.sequence_number = client->sequence; rep.app_group = pAppGrp->appgroupId; if (client->swapped) { swaps (&rep.sequence_number, n); swapl (&rep.length, n); swapl (&rep.app_group, n); } WriteToClient (client, sizeof (xXagQueryReply), (char *)&rep); return client->noClientException; } return BadMatch; } static int ProcXagCreateAssoc (client) register ClientPtr client; { REQUEST (xXagCreateAssocReq); REQUEST_SIZE_MATCH (xXagCreateAssocReq); #ifdef WIN32 if (stuff->window_type != XagWindowTypeWin32) #else if (stuff->window_type != XagWindowTypeX11) #endif return BadMatch; #ifdef WIN32 /* and Mac, etc */ if (!LocalClient (client)) return BadAccess; #endif /* Macintosh, OS/2, and MS-Windows servers have some work to do here */ return client->noClientException; } static int ProcXagDestroyAssoc (client) register ClientPtr client; { REQUEST (xXagDestroyAssocReq); REQUEST_SIZE_MATCH (xXagDestroyAssocReq); /* Macintosh, OS/2, and MS-Windows servers have some work to do here */ return client->noClientException; } static int ProcXagDispatch (client) register ClientPtr client; { REQUEST (xReq); switch (stuff->data) { case X_XagQueryVersion: return ProcXagQueryVersion (client); case X_XagCreate: return ProcXagCreate (client); case X_XagDestroy: return ProcXagDestroy (client); case X_XagGetAttr: return ProcXagGetAttr (client); case X_XagQuery: return ProcXagQuery (client); case X_XagCreateAssoc: return ProcXagCreateAssoc (client); case X_XagDestroyAssoc: return ProcXagDestroyAssoc (client); default: return BadRequest; } } static int SProcXagQueryVersion (client) register ClientPtr client; { register int n; REQUEST(xXagQueryVersionReq); swaps(&stuff->length, n); return ProcXagQueryVersion(client); } static int SProcXagCreate (client) ClientPtr client; { register int n; REQUEST (xXagCreateReq); swaps (&stuff->length, n); REQUEST_AT_LEAST_SIZE (xXagCreateReq); swapl (&stuff->app_group, n); swapl (&stuff->attrib_mask, n); SwapRestL (stuff); return ProcXagCreate (client); } static int SProcXagDestroy (client) ClientPtr client; { register int n; REQUEST (xXagDestroyReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXagDestroyReq); swapl (&stuff->app_group, n); return ProcXagDestroy (client); } static int SProcXagGetAttr (client) ClientPtr client; { register int n; REQUEST (xXagGetAttrReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXagGetAttrReq); swapl (&stuff->app_group, n); return ProcXagGetAttr (client); } static int SProcXagQuery (client) ClientPtr client; { register int n; REQUEST (xXagQueryReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXagQueryReq); swapl (&stuff->resource, n); return ProcXagQuery (client); } static int SProcXagCreateAssoc (client) ClientPtr client; { register int n; REQUEST (xXagCreateAssocReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXagCreateAssocReq); swapl (&stuff->window, n); swapl (&stuff->window_type, n); swaps (&stuff->system_window_len, n); return ProcXagCreateAssoc (client); } static int SProcXagDestroyAssoc (client) ClientPtr client; { register int n; REQUEST (xXagDestroyAssocReq); swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXagDestroyAssocReq); swapl (&stuff->window, n); return ProcXagDestroyAssoc (client); } static int SProcXagDispatch (client) register ClientPtr client; { REQUEST(xReq); switch (stuff->data) { case X_XagQueryVersion: return SProcXagQueryVersion (client); case X_XagCreate: return SProcXagCreate (client); case X_XagDestroy: return SProcXagDestroy (client); case X_XagGetAttr: return SProcXagGetAttr (client); case X_XagQuery: return SProcXagQuery (client); case X_XagCreateAssoc: return SProcXagCreateAssoc (client); case X_XagDestroyAssoc: return SProcXagDestroyAssoc (client); default: return BadRequest; } } Colormap XagDefaultColormap (client) ClientPtr client; { return (client->appgroup ? client->appgroup->default_colormap : None); } VisualID XagRootVisual (client) ClientPtr client; { return (client->appgroup ? client->appgroup->root_visual : 0); } ClientPtr XagLeader (client) ClientPtr client; { return (client->appgroup ? client->appgroup->leader : NULL); } /* * Return whether the Map request event should be sent to the appgroup leader. * We don't want to send it to the leader when the window is on a different * screen, e.g. a print screen. */ Bool XagIsControlledRoot (client, pParent) ClientPtr client; WindowPtr pParent; { if (client->appgroup) { if (client->appgroup->single_screen && pParent->drawable.id == client->appgroup->default_root) return TRUE; else if (!pParent->parent) return TRUE; else return FALSE; } return FALSE; } void XagConnectionInfo (client, conn_prefix, conn_info, num_screen) ClientPtr client; xConnSetupPrefix** conn_prefix; char** conn_info; int* num_screen; { if (client->appgroup && client->appgroup->ConnectionInfo) { *conn_prefix = &client->appgroup->connSetupPrefix; *conn_info = client->appgroup->ConnectionInfo; *num_screen = ((xConnSetup*)(client->appgroup->ConnectionInfo))->numRoots; } } XID XagId (client) ClientPtr client; { return (client->appgroup ? client->appgroup->appgroupId : 0); } void XagGetDeltaInfo (client, buf) ClientPtr client; CARD32* buf; { *buf++ = (CARD32) client->appgroup->default_root; *buf++ = (CARD32) client->appgroup->root_visual; *buf++ = (CARD32) client->appgroup->default_colormap; *buf++ = (CARD32) client->appgroup->black_pixel; *buf = (CARD32) client->appgroup->white_pixel; } void XagCallClientStateChange (client) ClientPtr client; { if (appGrpList) { NewClientInfoRec clientinfo; clientinfo.client = client; XagClientStateChange (NULL, NULL, (pointer)&clientinfo); } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/0040775000076400007640000000000010616336472017443 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbtileodd.c0100664000076400007640000006770307120677563021725 0ustar constconst/* * Fill odd tiled rectangles and spans. * no depth dependencies. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfbtileodd.c,v 1.16 94/04/17 20:29:06 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbtileodd.c,v 3.0 1996/06/29 09:05:55 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #include "mergerop.h" #if PSZ == 24 #if PGSZ == 32 #define LEFTSHIFT_AMT (3) #else /* PGSZ == 64 */ #define LEFTSHIFT_AMT (4 - PWSH) #endif /* PGSZ */ #else /* PSZ != 24 */ #if PGSZ == 32 #define LEFTSHIFT_AMT (5 - PWSH) #else /* PGSZ == 64 */ #define LEFTSHIFT_AMT (6 - PWSH) #endif /* PGSZ */ #endif /* PSZ == 24*/ #define LastTileBits {\ tmp = bits; \ if (tileEndPart) \ bits = (*pSrc & tileEndMask) | BitRight (*pSrcLine, tileEndLeftShift); \ else \ bits = *pSrc; \ } #if PSZ == 24 #define ResetTileBits {\ pSrc = pSrcLine; \ nlwSrc = widthSrc;\ if (tileEndPart) { \ if (4 - xoff + tileEndPart <= 4) {\ bits = *pSrc++; \ nlwSrc--; \ } else \ bits = BitLeft(tmp, tileEndLeftShift) | \ BitRight(bits, tileEndRightShift); \ xoff = (xoff + xoffStep) & 3; \ leftShift = xoff << LEFTSHIFT_AMT; \ rightShift = PGSZ - leftShift; \ }\ } #else #define ResetTileBits {\ pSrc = pSrcLine; \ nlwSrc = widthSrc;\ if (tileEndPart) { \ if (PPW - xoff + tileEndPart <= PPW) {\ bits = *pSrc++; \ nlwSrc--; \ } else \ bits = BitLeft(tmp, tileEndLeftShift) | \ BitRight(bits, tileEndRightShift); \ xoff = (xoff + xoffStep) & PIM; \ leftShift = xoff << LEFTSHIFT_AMT; \ rightShift = PGSZ - leftShift; \ }\ } #endif #define NextTileBits {\ if (nlwSrc == 1) {\ LastTileBits\ } else { \ if (nlwSrc == 0) {\ ResetTileBits\ } \ if (nlwSrc == 1) {\ LastTileBits\ } else {\ tmp = bits; \ bits = *pSrc++; \ }\ }\ nlwSrc--; \ } void MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int nBox; /* number of boxes to fill */ register BoxPtr pBox; /* pointer to list of boxes to fill */ PixmapPtr tile; /* tile */ int xrot, yrot; int alu; unsigned long planemask; { int tileWidth; /* width of tile in pixels */ int tileHeight; /* height of the tile */ int widthSrc; int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ int h; /* height of current box */ unsigned long startmask; unsigned long endmask;/* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwSrc; /* number of whole longwords in source */ register int nlw; /* loop version of nlwMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int xoffDst, xoffSrc; int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pDstBase; /* pointer to start of dest */ unsigned long *pDstLine; /* poitner to start of dest box */ unsigned long *pSrcBase; /* pointer to start of source */ unsigned long *pSrcLine; /* pointer to start of source line */ register unsigned long *pDst; register unsigned long *pSrc; register unsigned long bits, tmp; register int nlwPart; int xoffStart, xoff; int leftShiftStart, rightShiftStart, nlwSrcStart; unsigned long tileEndMask; int tileEndLeftShift, tileEndRightShift; int xoffStep; int tileEndPart; int needFirst; unsigned long narrow[2]; unsigned long narrowMask; int narrowShift; Bool narrowTile; MROP_INITIALIZE (alu, planemask) tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; widthSrc = tile->devKind / PGSZB; narrowTile = FALSE; if (widthSrc == 1) { narrowShift = tileWidth; narrowMask = cfbendpartial [tileWidth]; tileWidth *= 2; widthSrc = 2; narrowTile = TRUE; } pSrcBase = (unsigned long *)tile->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) #if PSZ == 24 tileEndPart = (4 - tileWidth) & 3; tileEndMask = cfbendpartial[tileWidth & 3]; #else tileEndPart = tileWidth & PIM; tileEndMask = cfbendpartial[tileEndPart]; #endif /* PSZ == 24 */ tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; tileEndRightShift = PGSZ - tileEndLeftShift; #if PSZ == 24 xoffStep = 4 - tileEndPart; #else xoffStep = PPW - tileEndPart; #endif /* PSZ == 24 */ /* * current assumptions: tile > 32 bits wide. */ while (nBox--) { w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; modulus (pBox->x1 - xrot, tileWidth, srcx); modulus (pBox->y1 - yrot, tileHeight, srcy); #if PSZ == 24 xoffDst = (4 - pBox->x1) & 3; if (w == 1 && (xoffDst == 0 || xoffDst == 1)) #else xoffDst = pBox->x1 & PIM; if (xoffDst + w < PPW) #endif { maskpartialbits(pBox->x1, w, startmask); endmask = 0; nlwMiddle = 0; } else { maskbits (pBox->x1, w, startmask, endmask, nlwMiddle) } #if PSZ == 24 pDstLine = pDstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); #else pDstLine = pDstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); #endif pSrcLine = pSrcBase + (srcy * widthSrc); #if PSZ == 24 xoffSrc = (4 - srcx) & 3; #else xoffSrc = srcx & PIM; #endif if (xoffSrc >= xoffDst) { xoffStart = xoffSrc - xoffDst; needFirst = 1; } else { #if PSZ == 24 xoffStart = 4 - (xoffDst - xoffSrc); #else xoffStart = PPW - (xoffDst - xoffSrc); #endif needFirst = 0; } leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; rightShiftStart = PGSZ - leftShiftStart; #if PSZ == 24 nlwSrcStart = widthSrc - ((srcx*3) >> 2); #else nlwSrcStart = widthSrc - (srcx >> PWSH); #endif while (h--) { /* XXX only works when narrowShift >= PPW/2 */ if (narrowTile) { tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); #if PSZ == 24 narrow[1] = BitLeft (tmp, 8) | BitRight(tmp, 16); #else narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | SCRRIGHT(tmp, 2 * narrowShift - PPW); #endif pSrcLine = narrow; } xoff = xoffStart; leftShift = leftShiftStart; rightShift = rightShiftStart; nlwSrc = nlwSrcStart; #if PSZ == 24 pSrc = pSrcLine + ((srcx * 3) >> 2); #else pSrc = pSrcLine + (srcx >> PWSH); #endif pDst = pDstLine; bits = 0; if (needFirst) { NextTileBits } if (startmask) { NextTileBits tmp = BitLeft(tmp, leftShift); if (rightShift != PGSZ) tmp |= BitRight(bits,rightShift); *pDst = MROP_MASK (tmp, *pDst, startmask); ++pDst; } nlw = nlwMiddle; while (nlw) { #if MROP == Mcopy if (nlwSrc > 1) { nlwPart = nlw; if (nlwPart >= nlwSrc) nlwPart = nlwSrc - 1; nlw -= nlwPart; nlwSrc -= nlwPart; if (rightShift != PGSZ) { while (nlwPart--) { tmp = bits; bits = *pSrc++; *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | BitRight (bits, rightShift), *pDst); ++pDst; } } else { if (nlwPart) { *pDst = MROP_SOLID (bits, *pDst); ++pDst; nlwPart--; while (nlwPart--) { *pDst = MROP_SOLID(*pSrc, *pDst); ++pDst; ++pSrc; } bits = *pSrc++; } } } else #endif { NextTileBits if (rightShift != PGSZ) { *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | BitRight(bits, rightShift), *pDst); } else { *pDst = MROP_SOLID (tmp, *pDst); } ++pDst; nlw--; } } if (endmask) { NextTileBits if (rightShift == PGSZ) bits = 0; *pDst = MROP_MASK (BitLeft(tmp, leftShift) | BitRight(bits,rightShift), *pDst, endmask); } pDstLine += widthDst; pSrcLine += widthSrc; if (++srcy == tileHeight) { srcy = 0; pSrcLine = pSrcBase; } } pBox++; } } void MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int n; DDXPointPtr ppt; int *pwidth; PixmapPtr tile; int xrot, yrot; int alu; unsigned long planemask; { int tileWidth; /* width of tile in pixels */ int tileHeight; /* height of the tile */ int widthSrc; int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current span */ unsigned long startmask; unsigned long endmask; /* masks for reggedy bits at either end of line */ int nlwSrc; /* number of whole longwords in source */ register int nlw; /* loop version of nlwMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int xoffDst, xoffSrc; int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pDstBase; /* pointer to start of dest */ unsigned long *pDstLine; /* poitner to start of dest box */ unsigned long *pSrcBase; /* pointer to start of source */ unsigned long *pSrcLine; /* pointer to start of source line */ register unsigned long *pDst; register unsigned long *pSrc; register unsigned long bits, tmp; register int nlwPart; int xoffStart, xoff; int leftShiftStart, rightShiftStart, nlwSrcStart; unsigned long tileEndMask; int tileEndLeftShift, tileEndRightShift; int xoffStep; int tileEndPart; int needFirst; unsigned long narrow[2]; unsigned long narrowMask; int narrowShift; Bool narrowTile; MROP_INITIALIZE (alu, planemask) tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; widthSrc = tile->devKind / PGSZB; narrowTile = FALSE; if (widthSrc == 1) { narrowShift = tileWidth; narrowMask = cfbendpartial [tileWidth]; tileWidth *= 2; widthSrc = 2; narrowTile = TRUE; } pSrcBase = (unsigned long *)tile->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, widthDst, pDstBase) #if PSZ == 24 tileEndPart = (4 - tileWidth) & 3; tileEndMask = cfbendpartial[tileWidth & 3]; #else tileEndPart = tileWidth & PIM; tileEndMask = cfbendpartial[tileEndPart]; #endif tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; tileEndRightShift = PGSZ - tileEndLeftShift; #if PSZ == 24 xoffStep = 4 - tileEndPart; #else xoffStep = PPW - tileEndPart; #endif while (n--) { w = *pwidth++; modulus (ppt->x - xrot, tileWidth, srcx); modulus (ppt->y - yrot, tileHeight, srcy); #if PSZ == 24 xoffDst = (4 - ppt->x) & 3; if (w == 1 && (xoffDst == 0 || xoffDst == 1)) #else xoffDst = ppt->x & PIM; if (xoffDst + w < PPW) #endif { maskpartialbits(ppt->x, w, startmask); endmask = 0; nlw = 0; } else { maskbits (ppt->x, w, startmask, endmask, nlw) } #if PSZ == 24 pDstLine = pDstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2); #else pDstLine = pDstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); #endif pSrcLine = pSrcBase + (srcy * widthSrc); #if PSZ == 24 xoffSrc = (4 - srcx) & 3; #else xoffSrc = srcx & PIM; #endif if (xoffSrc >= xoffDst) { xoffStart = xoffSrc - xoffDst; needFirst = 1; } else { #if PSZ == 24 xoffStart = 4 - (xoffDst - xoffSrc); #else xoffStart = PPW - (xoffDst - xoffSrc); #endif needFirst = 0; } leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; rightShiftStart = PGSZ - leftShiftStart; #if PSZ == 24 nlwSrcStart = widthSrc - ((srcx*3) >> 2); #else nlwSrcStart = widthSrc - (srcx >> PWSH); #endif /* XXX only works when narrowShift >= PPW/2 */ if (narrowTile) { tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); #if PSZ == 24 narrow[1] = BitLeft (tmp, 8) | BitRight(tmp, 16); #else narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | SCRRIGHT(tmp, 2 * narrowShift - PPW); #endif pSrcLine = narrow; } xoff = xoffStart; leftShift = leftShiftStart; rightShift = rightShiftStart; nlwSrc = nlwSrcStart; #if PSZ == 24 pSrc = pSrcLine + ((srcx * 3) >> 2); #else pSrc = pSrcLine + (srcx >> PWSH); #endif pDst = pDstLine; bits = 0; if (needFirst) { NextTileBits } if (startmask) { NextTileBits tmp = BitLeft(tmp, leftShift); if (rightShift != PGSZ) tmp |= BitRight(bits,rightShift); *pDst = MROP_MASK (tmp, *pDst, startmask); ++pDst; } while (nlw) { #if MROP == Mcopy if (nlwSrc > 1) { nlwPart = nlw; if (nlwPart >= nlwSrc) nlwPart = nlwSrc - 1; nlw -= nlwPart; nlwSrc -= nlwPart; if (rightShift != PGSZ) { while (nlwPart--) { tmp = bits; bits = *pSrc++; *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | BitRight (bits, rightShift), *pDst); ++pDst; } } else { if (nlwPart) { *pDst = MROP_SOLID (bits, *pDst); ++pDst; nlwPart--; while (nlwPart--) { *pDst = MROP_SOLID(*pSrc, *pDst); ++pDst; ++pSrc; } bits = *pSrc++; } } } else #endif { NextTileBits if (rightShift != PGSZ) { *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | BitRight(bits, rightShift), *pDst); ++pDst; } else { *pDst = MROP_SOLID (tmp, *pDst); ++pDst; } nlw--; } } if (endmask) { NextTileBits if (rightShift == PGSZ) bits = 0; *pDst = MROP_MASK (BitLeft(tmp, leftShift) | BitRight(bits,rightShift), *pDst, endmask); } ppt++; } } # include "fastblt.h" #define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } void MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int nBox; /* number of boxes to fill */ register BoxPtr pBox; /* pointer to list of boxes to fill */ PixmapPtr tile; /* tile */ int xrot, yrot; int alu; unsigned long planemask; { int tileWidth; /* width of tile */ int tileHeight; /* height of the tile */ int widthSrc; /* width in longwords of the source tile */ int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ int h; /* height of current box */ unsigned long startmask; unsigned long endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int srcRemaining; /* number of longwords remaining in source */ int xoffDst, xoffSrc; int srcStart; /* number of longwords source offset at left of box */ int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pdstBase; /* pointer to start of dest */ unsigned long *pdstLine; /* poitner to start of dest box */ unsigned long *psrcBase; /* pointer to start of source */ unsigned long *psrcLine; /* pointer to fetch point of source */ unsigned long *psrcStart; /* pointer to start of source line */ register unsigned long *pdst; register unsigned long *psrc; register unsigned long bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) psrcBase = (unsigned long *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; #if PSZ == 24 widthSrc = tile->devKind / PGSZB; #else widthSrc = tileWidth >> PWSH; #endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) while (nBox--) { w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; /* set up source */ modulus (pBox->x1 - xrot, tileWidth, srcx); modulus (pBox->y1 - yrot, tileHeight, srcy); #if PSZ == 24 xoffSrc = (4 - srcx) & 3; srcStart = (srcx * 3) >> 2; #else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH); #endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */ #if PSZ == 24 xoffDst = (4 - pBox->x1) & 3; pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); #else xoffDst = pBox->x1 & PIM; pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); #endif /* set up masks */ #if PSZ == 24 if (w == 1 && (xoffDst == 0 || xoffDst == 1)) #else if (xoffDst + w < PPW) #endif { maskpartialbits(pBox->x1, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits (pBox->x1, w, startmask, endmask, nlMiddle) } if (xoffSrc == xoffDst) { while (h--) { psrc = psrcLine; pdst = pdstLine; srcRemaining = widthSrc - srcStart; if (startmask) { *pdst = MROP_MASK (*psrc, *pdst, startmask); pdst++; IncSrcPtr } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl; #if MROP == Mcopy #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;) #endif #else while (nl--) { *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; } #endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { *pdst = MROP_MASK (*psrc, *pdst, endmask); } pdstLine += widthDst; psrcLine += widthSrc; psrcStart += widthSrc; if (++srcy == tileHeight) { psrcStart = psrcBase; psrcLine = psrcStart + srcStart; srcy = 0; } } } else { if (xoffSrc > xoffDst) { leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; rightShift = PGSZ - leftShift; } else { rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; leftShift = PGSZ - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; bits = 0; srcRemaining = widthSrc - srcStart; if (xoffSrc > xoffDst) { bits = *psrc; IncSrcPtr } if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl; #if MROP == Mcopy #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) \ bits = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); #define BodyEven(n) \ bits1 = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) \ bits = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ pdst++; #define BodyEven(n) \ bits1 = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ pdst++; #define LoopReset ; #endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; ) #endif #else while (nl--) { bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; } #endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } pdstLine += widthDst; psrcLine += widthSrc; psrcStart += widthSrc; if (++srcy == tileHeight) { psrcStart = psrcBase; psrcLine = psrcStart + srcStart; srcy = 0; } } } pBox++; } } void MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) DrawablePtr pDrawable; int n; DDXPointPtr ppt; int *pwidth; PixmapPtr tile; int xrot, yrot; int alu; unsigned long planemask; { int tileWidth; /* width of tile */ int tileHeight; /* height of the tile */ int widthSrc; /* width in longwords of the source tile */ int widthDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ unsigned long startmask; unsigned long endmask;/* masks for reggedy bits at either end of line */ int nlMiddle; /* number of longwords between sides of boxes */ register int nl; /* loop version of nlMiddle */ int srcy; /* current tile y position */ int srcx; /* current tile x position */ int srcRemaining; /* number of longwords remaining in source */ int xoffDst, xoffSrc; int srcStart; /* number of longwords source offset at left of box */ int leftShift, rightShift; MROP_DECLARE_REG() unsigned long *pdstBase; /* pointer to start of dest */ unsigned long *pdstLine; /* poitner to start of dest box */ unsigned long *psrcBase; /* pointer to start of source */ unsigned long *psrcLine; /* pointer to fetch point of source */ unsigned long *psrcStart; /* pointer to start of source line */ register unsigned long *pdst; register unsigned long *psrc; register unsigned long bits, bits1; register int nlTemp; MROP_INITIALIZE (alu, planemask) psrcBase = (unsigned long *)tile->devPrivate.ptr; tileHeight = tile->drawable.height; tileWidth = tile->drawable.width; #if PSZ == 24 widthSrc = tile->devKind / PGSZB; #else widthSrc = tileWidth >> PWSH; #endif cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) while (n--) { w = *pwidth++; /* set up source */ modulus (ppt->x - xrot, tileWidth, srcx); modulus (ppt->y - yrot, tileHeight, srcy); #if PSZ == 24 xoffSrc = (4 - srcx) & 3; srcStart = (srcx * 3) >> 2; #else xoffSrc = srcx & PIM; srcStart = (srcx >> PWSH); #endif psrcStart = psrcBase + (srcy * widthSrc); psrcLine = psrcStart + srcStart; /* set up dest */ #if PSZ == 24 xoffDst = (4 - ppt->x) & 3; pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2); /* set up masks */ if (w == 1 && (xoffDst == 0 || xoffDst == 1)) #else xoffDst = ppt->x & PIM; pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); /* set up masks */ if (xoffDst + w < PPW) #endif { maskpartialbits(ppt->x, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits (ppt->x, w, startmask, endmask, nlMiddle) } if (xoffSrc == xoffDst) { psrc = psrcLine; pdst = pdstLine; srcRemaining = widthSrc - srcStart; if (startmask) { *pdst = MROP_MASK (*psrc, *pdst, startmask); pdst++; IncSrcPtr } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl; #if MROP == Mcopy #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;) #endif #else while (nl--) { *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; } #endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { *pdst = MROP_MASK (*psrc, *pdst, endmask); } } else { if (xoffSrc > xoffDst) { leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; rightShift = PGSZ - leftShift; } else { rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; leftShift = PGSZ - rightShift; } psrc = psrcLine; pdst = pdstLine; bits = 0; srcRemaining = widthSrc - srcStart; if (xoffSrc > xoffDst) { bits = *psrc; IncSrcPtr } if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc; IncSrcPtr bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nlTemp = nlMiddle; while (nlTemp) { nl = nlTemp; if (nl > srcRemaining) nl = srcRemaining; nlTemp -= nl; srcRemaining -= nl; #if MROP == Mcopy #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) \ bits = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); #define BodyEven(n) \ bits1 = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) \ bits = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ pdst++; #define BodyEven(n) \ bits1 = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ pdst++; #define LoopReset ; #endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; ) #endif #else while (nl--) { bits1 = BitLeft(bits,leftShift); bits = *psrc++; *pdst = MROP_SOLID(bits1|BitRight(bits,rightShift), *pdst); pdst++; } #endif if (!srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } } if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } } ppt++; } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfb.h0100664000076400007640000007537307120677563020367 0ustar constconst/* $XConsortium: cfb.h,v 5.37 94/04/17 20:28:38 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfb.h,v 3.3.2.2 1997/05/30 13:50:37 hohndel Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #include "X.h" #include "pixmap.h" #include "region.h" #include "gc.h" #include "colormap.h" #include "miscstruct.h" #include "servermd.h" #include "windowstr.h" #include "mfb.h" #undef PixelType #include "cfbmap.h" /* private filed of pixmap pixmap.devPrivate = (unsigned int *)pointer_to_bits pixmap.devKind = width_of_pixmap_in_bytes */ extern int cfbGCPrivateIndex; extern int cfbWindowPrivateIndex; /* private field of GC */ typedef struct { unsigned char rop; /* special case rop values */ /* next two values unused in cfb, included for compatibility with mfb */ unsigned char ropOpStip; /* rop for opaque stipple */ /* this value is ropFillArea in mfb, usurped for cfb */ unsigned char oneRect; /* drawable has one clip rect */ unsigned fExpose:1; /* callexposure handling ? */ unsigned freeCompClip:1; PixmapPtr pRotatedPixmap; RegionPtr pCompositeClip; /* FREE_CC or REPLACE_CC */ unsigned long xor, and; /* reduced rop values */ } cfbPrivGC; typedef cfbPrivGC *cfbPrivGCPtr; #define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\ (pGC)->devPrivates[cfbGCPrivateIndex].ptr) #define cfbGetCompositeClip(pGC) (((cfbPrivGCPtr)\ (pGC)->devPrivates[cfbGCPrivateIndex].ptr)->pCompositeClip) /* way to carry RROP info around */ typedef struct { unsigned char rop; unsigned long xor, and; } cfbRRopRec, *cfbRRopPtr; /* private field of window */ typedef struct { unsigned char fastBorder; /* non-zero if border is 32 bits wide */ unsigned char fastBackground; unsigned short unused; /* pad for alignment with Sun compiler */ DDXPointRec oldRotate; PixmapPtr pRotatedBackground; PixmapPtr pRotatedBorder; } cfbPrivWin; #define cfbGetWindowPrivate(_pWin) ((cfbPrivWin *)\ (_pWin)->devPrivates[cfbWindowPrivateIndex].ptr) /* cfb8bit.c */ extern int cfbSetStipple( #if NeedFunctionPrototypes int /*alu*/, unsigned long /*fg*/, unsigned long /*planemask*/ #endif ); extern int cfbSetOpaqueStipple( #if NeedFunctionPrototypes int /*alu*/, unsigned long /*fg*/, unsigned long /*bg*/, unsigned long /*planemask*/ #endif ); extern int cfbComputeClipMasks32( #if NeedFunctionPrototypes BoxPtr /*pBox*/, int /*numRects*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, CARD32 * /*clips*/ #endif ); /* cfb8cppl.c */ extern void cfbCopyImagePlane( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); extern void cfbCopyPlane8to1( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/, unsigned long /*bitPlane*/ #endif ); /* cfb8lineCO.c */ extern int cfb8LineSS1RectCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/, DDXPointPtr /*pptInitOrig*/, int * /*x1p*/, int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ #endif ); extern void cfb8LineSS1Rect( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); extern void cfb8ClippedLineCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ #endif ); /* cfb8lineCP.c */ extern int cfb8LineSS1RectPreviousCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/, DDXPointPtr /*pptInitOrig*/, int * /*x1p*/, int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ #endif ); /* cfb8lineG.c */ extern int cfb8LineSS1RectGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/, DDXPointPtr /*pptInitOrig*/, int * /*x1p*/, int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ #endif ); extern void cfb8ClippedLineGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ #endif ); /* cfb8lineX.c */ extern int cfb8LineSS1RectXor( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/, DDXPointPtr /*pptInitOrig*/, int * /*x1p*/, int * /*y1p*/, int * /*x2p*/, int * /*y2p*/ #endif ); extern void cfb8ClippedLineXor( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, BoxPtr /*boxp*/, Bool /*shorten*/ #endif ); /* cfb8segC.c */ extern int cfb8SegmentSS1RectCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ #endif ); /* cfb8segCS.c */ extern int cfb8SegmentSS1RectShiftCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ #endif ); extern void cfb8SegmentSS1Rect( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ #endif ); /* cfb8segG.c */ extern int cfb8SegmentSS1RectGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ #endif ); /* cfbsegX.c */ extern int cfb8SegmentSS1RectXor( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegInit*/ #endif ); /* cfballpriv.c */ extern Bool cfbAllocatePrivates( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int * /*window_index*/, int * /*gc_index*/ #endif ); /* cfbbitblt.c */ extern RegionPtr cfbBitBlt( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, void (* /*doBitBlt*/)( #if NeedNestedPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/, unsigned long /*bitPlane*/ #endif ), unsigned long /*bitPlane*/ #endif ); extern void cfbDoBitblt( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); extern RegionPtr cfbCopyArea( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/ #endif ); extern void cfbCopyPlane1to8( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, int /*rop*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/, unsigned long /*bitPlane*/ #endif ); extern RegionPtr cfbCopyPlane( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ #endif ); /* cfbbltC.c */ extern void cfbDoBitbltCopy( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); /* cfbbltG.c */ extern void cfbDoBitbltGeneral( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); /* cfbbltO.c */ extern void cfbDoBitbltOr( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); /* cfbbltX.c */ extern void cfbDoBitbltXor( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/, unsigned long /*planemask*/ #endif ); /* cfbbres.c */ extern void cfbBresS( #if NeedFunctionPrototypes int /*rop*/, unsigned long /*and*/, unsigned long /*xor*/, unsigned long * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, int /*axis*/, int /*x1*/, int /*y1*/, int /*e*/, int /*e1*/, int /*e2*/, int /*len*/ #endif ); /* cfbbresd.c */ extern void cfbBresD( #if NeedFunctionPrototypes cfbRRopPtr /*rrops*/, int * /*pdashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pdashOffset*/, int /*isDoubleDash*/, unsigned long * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, int /*axis*/, int /*x1*/, int /*y1*/, int /*e*/, int /*e1*/, int /*e2*/, int /*len*/ #endif ); /* cfbbstore.c */ extern void cfbSaveAreas( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ #endif ); extern void cfbRestoreAreas( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnRestore*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ #endif ); /* cfbcmap.c */ extern int cfbListInstalledColormaps( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, Colormap * /*pmaps*/ #endif ); extern void cfbInstallColormap( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); extern void cfbUninstallColormap( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); extern void cfbResolveColor( #if NeedFunctionPrototypes unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/, VisualPtr /*pVisual*/ #endif ); extern Bool cfbInitializeColormap( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); extern int cfbExpandDirectColors( #if NeedFunctionPrototypes ColormapPtr /*pmap*/, int /*ndef*/, xColorItem * /*indefs*/, xColorItem * /*outdefs*/ #endif ); extern Bool cfbCreateDefColormap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern Bool cfbSetVisualTypes( #if NeedFunctionPrototypes int /*depth*/, int /*visuals*/, int /*bitsPerRGB*/ #endif ); extern Bool cfbInitVisuals( #if NeedFunctionPrototypes VisualPtr * /*visualp*/, DepthPtr * /*depthp*/, int * /*nvisualp*/, int * /*ndepthp*/, int * /*rootDepthp*/, VisualID * /*defaultVisp*/, unsigned long /*sizes*/, int /*bitsPerRGB*/ #endif ); /* cfbfillarcC.c */ extern void cfbPolyFillArcSolidCopy( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* cfbfillarcG.c */ extern void cfbPolyFillArcSolidGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* cfbfillrct.c */ extern void cfbFillBoxTileOdd( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, BoxPtr /*rects*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/ #endif ); extern void cfbFillRectTileOdd( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbPolyFillRect( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ #endif ); /* cfbfillsp.c */ extern void cfbUnnaturalTileFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void cfbUnnaturalStippleFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void cfb8Stipple32FS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void cfb8OpaqueStipple32FS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbgc.c */ extern GCOpsPtr cfbMatchCommon( #if NeedFunctionPrototypes GCPtr /*pGC*/, cfbPrivGCPtr /*devPriv*/ #endif ); extern Bool cfbCreateGC( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); extern void cfbValidateGC( #if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned long /*changes*/, DrawablePtr /*pDrawable*/ #endif ); /* cfbgetsp.c */ extern void cfbGetSpans( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, char * /*pdstStart*/ #endif ); /* cfbglblt8.c */ extern void cfbPolyGlyphBlt8( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* cfbglrop8.c */ extern void cfbPolyGlyphRop8( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* cfbhrzvert.c */ extern int cfbHorzS( #if NeedFunctionPrototypes int /*rop*/, unsigned long /*and*/, unsigned long /*xor*/, unsigned long * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ #endif ); extern void cfbVertS( #if NeedFunctionPrototypes int /*rop*/, unsigned long /*and*/, unsigned long /*xor*/, unsigned long * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ #endif ); /* cfbigblt8.c */ extern void cfbImageGlyphBlt8( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* cfbimage.c */ extern void cfbPutImage( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pImage*/ #endif ); extern void cfbGetImage( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ #endif ); /* cfbline.c */ extern void cfbLineSS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); extern void cfbLineSD( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); /* cfbmskbits.c */ /* cfbpixmap.c */ extern PixmapPtr cfbCreatePixmap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/ #endif ); extern Bool cfbDestroyPixmap( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern PixmapPtr cfbCopyPixmap( #if NeedFunctionPrototypes PixmapPtr /*pSrc*/ #endif ); extern void cfbPadPixmap( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern void cfbXRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rw*/ #endif ); extern void cfbYRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rh*/ #endif ); extern void cfbCopyRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*psrcPix*/, PixmapPtr * /*ppdstPix*/, int /*xrot*/, int /*yrot*/ #endif ); /* cfbply1rctC.c */ extern void cfbFillPoly1RectCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* cfbply1rctG.c */ extern void cfbFillPoly1RectGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* cfbpntwin.c */ extern void cfbPaintWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); extern void cfbFillBoxSolid( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, unsigned long /*pixel*/ #endif ); extern void cfbFillBoxTile32( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/ #endif ); /* cfbpolypnt.c */ extern void cfbPolyPoint( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ #endif ); /* cfbpush8.c */ extern void cfbPushPixels8( #if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitmap*/, DrawablePtr /*pDrawable*/, int /*dx*/, int /*dy*/, int /*xOrg*/, int /*yOrg*/ #endif ); /* cfbrctstp8.c */ extern void cfb8FillRectOpaqueStippled32( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfb8FillRectTransparentStippled32( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfb8FillRectStippledUnnatural( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); /* cfbrrop.c */ extern int cfbReduceRasterOp( #if NeedFunctionPrototypes int /*rop*/, unsigned long /*fg*/, unsigned long /*pm*/, unsigned long * /*andp*/, unsigned long * /*xorp*/ #endif ); /* cfbscrinit.c */ extern Bool cfbCloseScreen( #if NeedFunctionPrototypes int /*index*/, ScreenPtr /*pScreen*/ #endif ); extern Bool cfbSetupScreen( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/ #endif ); extern int cfbFinishScreenInit( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/ #endif ); extern Bool cfbScreenInit( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/ #endif ); /* cfbseg.c */ extern void cfbSegmentSS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ #endif ); extern void cfbSegmentSD( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ #endif ); /* cfbsetsp.c */ extern int cfbSetScanline( #if NeedFunctionPrototypes int /*y*/, int /*xOrigin*/, int /*xStart*/, int /*xEnd*/, unsigned int * /*psrc*/, int /*alu*/, int * /*pdstBase*/, int /*widthDst*/, unsigned long /*planemask*/ #endif ); extern void cfbSetSpans( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, char * /*psrc*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, int /*fSorted*/ #endif ); /* cfbsolidC.c */ extern void cfbFillRectSolidCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbSolidSpansCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbsolidG.c */ extern void cfbFillRectSolidGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbSolidSpansGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbsolidX.c */ extern void cfbFillRectSolidXor( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbSolidSpansXor( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbteblt8.c */ extern void cfbTEGlyphBlt8( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*xInit*/, int /*yInit*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* cfbtegblt.c */ extern void cfbTEGlyphBlt( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* cfbtile32C.c */ extern void cfbFillRectTile32Copy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbTile32FSCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbtile32G.c */ extern void cfbFillRectTile32General( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nBox*/, BoxPtr /*pBox*/ #endif ); extern void cfbTile32FSGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* cfbtileoddC.c */ extern void cfbFillBoxTileOddCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillSpanTileOddCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillBoxTile32sCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillSpanTile32sCopy( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); /* cfbtileoddG.c */ extern void cfbFillBoxTileOddGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillSpanTileOddGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillBoxTile32sGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*nBox*/, BoxPtr /*pBox*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); extern void cfbFillSpanTile32sGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*n*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, PixmapPtr /*tile*/, int /*xrot*/, int /*yrot*/, int /*alu*/, unsigned long /*planemask*/ #endif ); /* cfbwindow.c */ extern Bool cfbCreateWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern Bool cfbDestroyWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern Bool cfbMapWindow( #if NeedFunctionPrototypes WindowPtr /*pWindow*/ #endif ); extern Bool cfbPositionWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/ #endif ); extern Bool cfbUnmapWindow( #if NeedFunctionPrototypes WindowPtr /*pWindow*/ #endif ); extern void cfbCopyWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/ #endif ); extern Bool cfbChangeWindowAttributes( #if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned long /*mask*/ #endif ); /* cfbzerarcC.c */ extern void cfbZeroPolyArcSS8Copy( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* cfbzerarcG.c */ extern void cfbZeroPolyArcSS8General( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* cfbzerarcX.c */ extern void cfbZeroPolyArcSS8Xor( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* * This is the only completely portable way to * compute this info */ #define BitsPerPixel(d) (\ PixmapWidthPaddingInfo[d].notPower2 ? \ (PixmapWidthPaddingInfo[d].bytesPerPixel * 8) : \ ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ (PixmapWidthPaddingInfo[d].padRoundUp+1))) /* Common macros for extracting drawing information */ #if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE) #define CFB_NEED_SCREEN_PRIVATE extern int cfbScreenPrivateIndex; #define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivates[cfbScreenPrivateIndex].ptr) #else #define cfbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) #endif #ifdef PIXMAP_PER_WINDOW #define cfbGetWindowPixmap(d) ((PixmapPtr) ((WindowPtr) d)->devPrivates[frameWindowPrivateIndex].ptr) #else #define cfbGetWindowPixmap(d) cfbGetScreenPixmap((d)->pScreen) #endif #define cfbGetTypedWidth(pDrawable,wtype) (\ (((pDrawable)->type != DRAWABLE_PIXMAP) ? \ (int) (cfbGetWindowPixmap(pDrawable)->devKind) : \ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype)) #define cfbGetByteWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned char) #define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType) #define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned long) #define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ PixmapPtr _pPix; \ if ((pDrawable)->type != DRAWABLE_PIXMAP) \ _pPix = cfbGetWindowPixmap(pDrawable); \ else \ _pPix = (PixmapPtr) (pDrawable); \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ (width) = ((int) _pPix->devKind) / sizeof (wtype); \ } #define cfbGetByteWidthAndPointer(pDrawable, width, pointer) \ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char) #define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned long, unsigned long) #define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \ cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) #define cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\ PixmapPtr _pPix = cfbGetWindowPixmap((DrawablePtr) (pWin)); \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ (width) = ((int) _pPix->devKind) / sizeof (wtype); \ } #define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned long, unsigned long) #define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \ cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char) #define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \ cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) /* Macros which handle a coordinate in a single register */ /* Most compilers will convert divide by 65536 into a shift, if signed * shifts exist. If your machine does arithmetic shifts and your compiler * can't get it right, add to this line. */ /* mips compiler - what a joke - it CSEs the 65536 constant into a reg * forcing as to use div instead of shift. Let's be explicit. */ #if defined(mips) || defined(sparc) || defined(__alpha) || defined(__alpha__) || defined(__i386__) || defined(i386) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) #endif #if IMAGE_BYTE_ORDER == MSBFirst #define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) #define coordToInt(x,y) (((x) << 16) | (y)) #define intToX(i) (GetHighWord(i)) #define intToY(i) ((int) ((short) i)) #else #define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) #define coordToInt(x,y) (((y) << 16) | (x)) #define intToX(i) ((int) ((short) (i))) #define intToY(i) (GetHighWord(i)) #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbzerarc.c0100664000076400007640000002221107120677563021550 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: cfbzerarc.c /main/24 1995/12/06 16:58:51 dpw $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbzerarc.c,v 3.0 1996/06/29 09:05:57 dawes Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" * by M. L. V. Pitteway * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "mizerarc.h" #include "cfbrrop.h" #include "mi.h" #ifdef PIXEL_ADDR static void RROP_NAME(cfbZeroArcSS8) (pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { miZeroArcRec info; Bool do360; register int x; PixelType *addrp; register PixelType *yorgp, *yorgop; #if PSZ == 24 int xorg, xorg3, xorgo, xorgo3; register int xtmp; #endif RROP_DECLARE register int yoffset; int npwidth, dyoffset; register int y, a, b, d, mask; register int k1, k3, dx, dy; cfbGetPixelWidthAndPointer(pDraw,npwidth, addrp) RROP_FETCH_GC (pGC); do360 = miZeroArcSetup(arc, &info, TRUE); yorgp = addrp + ((info.yorg + pDraw->y) * npwidth); yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth); info.xorg += pDraw->x; info.xorgo += pDraw->x; #if PSZ == 24 xorg = info.xorg; xorg3 = xorg * 3; info.xorg = (info.xorg * 3) >> 2; xorgo = info.xorgo; xorgo3 = xorgo * 3; info.xorgo = (info.xorgo * 3) >> 2; #endif MIARCSETUP(); yoffset = y ? npwidth : 0; dyoffset = 0; mask = info.initialMask; if (!(arc->width & 1)) { #if PSZ == 24 if (mask & 2) RROP_SOLID24((yorgp + info.xorgo), xorgo); if (mask & 8) RROP_SOLID24((yorgop + info.xorgo), xorgo); #else if (mask & 2) RROP_SOLID((yorgp + info.xorgo)); if (mask & 8) RROP_SOLID((yorgop + info.xorgo)); #endif /* PSZ == 24 */ } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { register int xoffset = npwidth; #if PSZ == 24 PixelType *yorghb = yorgp + (info.h * npwidth); register int tmp1, tmp2, tmp1_3, tmp2_3; tmp1 = xorg + info.h; tmp1_3 = tmp1 * 3; tmp2 = xorg - info.h; tmp2_3 = tmp2 * 3; while (1) { xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); xtmp = (xorg3 - x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x); RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x); if (a < 0) break; xtmp = (tmp1_3 - y * 3) >> 2; RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y); RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y); xtmp = (tmp2_3 + y * 3) >> 2; RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y); RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y); xoffset += npwidth; MIARCCIRCLESTEP(yoffset += npwidth;); } #else PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg; PixelType *yorgohb = yorghb - info.h; yorgp += info.xorg; yorgop += info.xorg; yorghb += info.h; while (1) { RROP_SOLID(yorgp + yoffset + x); RROP_SOLID(yorgp + yoffset - x); RROP_SOLID(yorgop - yoffset - x); RROP_SOLID(yorgop - yoffset + x); if (a < 0) break; RROP_SOLID(yorghb - xoffset - y); RROP_SOLID(yorgohb - xoffset + y); RROP_SOLID(yorgohb + xoffset + y); RROP_SOLID(yorghb + xoffset - y); xoffset += npwidth; MIARCCIRCLESTEP(yoffset += npwidth;); } yorgp -= info.xorg; yorgop -= info.xorg; #endif /* PSZ == 24 */ x = info.w; yoffset = info.h * npwidth; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = npwidth;); #if PSZ == 24 xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); xtmp = (xorgo3 - x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); #else RROP_SOLID(yorgp + yoffset + info.xorg + x); RROP_SOLID(yorgp + yoffset + info.xorgo - x); RROP_SOLID(yorgop - yoffset + info.xorgo - x); RROP_SOLID(yorgop - yoffset + info.xorg + x); #endif MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = npwidth;); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } #if PSZ == 24 if (mask & 1){ xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); } if (mask & 2){ xtmp = (xorgo3 - x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); } if (mask & 4){ xtmp = (xorgo3 - x * 3) >> 2; RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); } if (mask & 8){ xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); } #else if (mask & 1) RROP_SOLID(yorgp + yoffset + info.xorg + x); if (mask & 2) RROP_SOLID(yorgp + yoffset + info.xorgo - x); if (mask & 4) RROP_SOLID(yorgop - yoffset + info.xorgo - x); if (mask & 8) RROP_SOLID(yorgop - yoffset + info.xorg + x); #endif /* PSZ == 24 */ if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; #if PSZ == 24 if (mask & 1){ xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); } if (mask & 4){ xtmp = (xorgo3 - x * 3) >> 2; RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); } #else if (mask & 1) RROP_SOLID(yorgp + yoffset + info.xorg + x); if (mask & 4) RROP_SOLID(yorgop - yoffset + info.xorgo - x); #endif /* PSZ == 24 */ if (arc->height & 1) { #if PSZ == 24 if (mask & 2){ xtmp = (xorgo3 - x * 3) >> 2; RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); } if (mask & 8){ xtmp = (xorg3 + x * 3) >> 2; RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); } #else if (mask & 2) RROP_SOLID(yorgp + yoffset + info.xorgo - x); if (mask & 8) RROP_SOLID(yorgop - yoffset + info.xorg + x); #endif /* PSZ == 24 */ } } void RROP_NAME (cfbZeroPolyArcSS8) (pDraw, pGC, narcs, parcs) register DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register xArc *arc; register int i; BoxRec box; int x2, y2; RegionPtr cclip; cclip = cfbGetCompositeClip(pGC); for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miCanZeroArc(arc)) { box.x1 = arc->x + pDraw->x; box.y1 = arc->y + pDraw->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)arc->width + 1; box.x2 = x2; y2 = box.y1 + (int)arc->height + 1; box.y2 = y2; if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) RROP_NAME (cfbZeroArcSS8) (pDraw, pGC, arc); else miZeroPolyArc(pDraw, pGC, 1, arc); } else miPolyArc(pDraw, pGC, 1, arc); } } #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/Imakefile0100664000076400007640000002011607446015423021246 0ustar constconstXCOMM $XConsortium: Imakefile /main/67 1996/12/02 10:19:53 lehors $ XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile,v 3.9.2.1 1997/05/03 09:45:03 dawes Exp $ #include #ifndef PixelSize #define PixelSize 8 #endif #if PixelSize == 8 /* cfb8cppl.c MUST come last to avoid confusing makedepend */ PSZSRCS = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c cfb8cppl.c PSZOBJS = cfb8bit.o cfbteblt8.o cfbglrop8.o cfbpush8.o cfbrctstp8.o cfb8cppl.o #ifdef MipsArchitecture #ifndef ArcArchitecture #ifndef Mips64Architecture STIPPLESRC = stipmips.s stipmipste.s STIPPLEOBJ = stipmips.o stipmipste.o STIPPLEDEF = -DHAS_STIPPLE_CODE #endif #endif #endif #ifdef SparcArchitecture STIPPLESRC = stipsparc.s stipsparcte.s STIPPLEOBJ = stipsparc.o stipsparcte.o STIPPLEDEF = -DHAS_STIPPLE_CODE #endif #endif #if PixelSize == 32 #ifdef SparcArchitecture STIPPLESRC = stipsprc32.s stipsprcte32.s STIPPLEOBJ = stipsprc32.o stipsprcte32.o STIPPLEDEF = -DHAS_STIPPLE_CODE #endif #endif SRCS = cfbgc.c cfbrrop.c cfbwindow.c \ cfbpntwin.c cfbmskbits.c cfbpixmap.c cfbbitblt.c \ cfbfillsp.c cfbsetsp.c cfbscrinit.c cfballpriv.c \ cfbgetsp.c cfbfillrct.c \ cfbsolidC.c cfbsolidX.c cfbsolidG.c \ cfbtileoddC.c cfbtileoddG.c cfbtile32C.c cfbtile32G.c \ cfbcmap.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \ cfbfillarcC.c cfbfillarcG.c \ cfbigblt8.c cfbglblt8.c cfbtegblt.c cfbbstore.c \ cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c \ cfbpolypnt.c \ cfbbres.c cfbline.c cfbhrzvert.c cfbbresd.c cfbimage.c cfbseg.c \ cfb8lineCO.c cfb8lineX.c cfb8lineG.c cfb8lineCP.c \ cfb8segC.c cfb8segX.c cfb8segG.c cfb8segCS.c \ cfbply1rctC.c cfbply1rctG.c $(PSZSRCS) OBJS = cfbgc.o cfbrrop.o cfbwindow.o \ cfbgetsp.o cfbfillrct.o \ cfbsolidC.o cfbsolidX.o cfbsolidG.o \ cfbtileoddC.o cfbtileoddG.o cfbtile32C.o cfbtile32G.o \ cfbfillsp.o cfbsetsp.o cfbscrinit.o cfballpriv.o \ cfbpntwin.o cfbmskbits.o cfbpixmap.o \ cfbcmap.o cfbzerarcC.o cfbzerarcX.o cfbzerarcG.o \ cfbfillarcC.o cfbfillarcG.o \ cfbigblt8.o cfbglblt8.o cfbtegblt.o cfbbstore.o \ cfbpolypnt.o \ cfbbres.o cfbline.o cfbhrzvert.o cfbbresd.o cfbimage.o cfbseg.o \ cfb8lineCO.o cfb8lineX.o cfb8lineG.o cfb8lineCP.o \ cfb8segCS.o cfb8segX.o cfb8segG.o cfb8segC.o \ cfbbitblt.o cfbbltC.o cfbbltX.o cfbbltO.o cfbbltG.o \ cfbply1rctC.o cfbply1rctG.o $(PSZOBJS) $(STIPPLEOBJ) #ifdef XFree86Version EXTRAINCLUDES = -I../hw/xfree86/common EXTRADEFINES = -DXFREE86 #endif INCLUDES = -I. -I../cfb -I../mfb -I../mi -I../include -I$(XINCLUDESRC) \ -I$(FONTINCSRC) $(EXTRAINCLUDES) LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln \ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln DEFINES = -DPSZ=PixelSize $(EXTRADEFINES) NormalLibraryObjectRule() NormalLibraryTarget(cfb,$(OBJS)) LintLibraryTarget(cfb,$(SRCS)) NormalLintTarget($(SRCS)) #ifdef LinkDirectory LinkSourceFile(cfb.h,LinkDirectory) LinkSourceFile(cfbmap.h,LinkDirectory) LinkSourceFile(cfballpriv.c,LinkDirectory) LinkSourceFile(cfbbitblt.c,LinkDirectory) LinkSourceFile(cfbblt.c,LinkDirectory) LinkSourceFile(cfbbres.c,LinkDirectory) LinkSourceFile(cfbbresd.c,LinkDirectory) LinkSourceFile(cfbbstore.c,LinkDirectory) LinkSourceFile(cfbcmap.c,LinkDirectory) LinkSourceFile(cfbfillarc.c,LinkDirectory) LinkSourceFile(cfbfillrct.c,LinkDirectory) LinkSourceFile(cfbfillsp.c,LinkDirectory) LinkSourceFile(cfbgc.c,LinkDirectory) LinkSourceFile(cfbgetsp.c,LinkDirectory) LinkSourceFile(cfbhrzvert.c,LinkDirectory) LinkSourceFile(cfbimage.c,LinkDirectory) LinkSourceFile(cfbline.c,LinkDirectory) LinkSourceFile(cfb8line.c,LinkDirectory) LinkSourceFile(cfbmskbits.c,LinkDirectory) LinkSourceFile(cfbmskbits.h,LinkDirectory) LinkSourceFile(cfbpixmap.c,LinkDirectory) LinkSourceFile(cfbply1rct.c,LinkDirectory) LinkSourceFile(cfbpntwin.c,LinkDirectory) LinkSourceFile(cfbpolypnt.c,LinkDirectory) LinkSourceFile(cfbrrop.c,LinkDirectory) LinkSourceFile(cfbrrop.h,LinkDirectory) LinkSourceFile(cfbscrinit.c,LinkDirectory) LinkSourceFile(cfbsetsp.c,LinkDirectory) LinkSourceFile(cfbsolid.c,LinkDirectory) LinkSourceFile(cfbigblt8.c,LinkDirectory) LinkSourceFile(cfbglblt8.c,LinkDirectory) LinkSourceFile(cfbtegblt.c,LinkDirectory) LinkSourceFile(cfbtileodd.c,LinkDirectory) LinkSourceFile(cfbtile32.c,LinkDirectory) LinkSourceFile(cfbwindow.c,LinkDirectory) LinkSourceFile(cfbzerarc.c,LinkDirectory) LinkSourceFile(cfb8bit.h,LinkDirectory) #if PixelSize == 8 LinkSourceFile(cfb8bit.c,LinkDirectory) LinkSourceFile(cfb8cppl.c,LinkDirectory) LinkSourceFile(cfbpush8.c,LinkDirectory) LinkSourceFile(cfbrctstp8.c,LinkDirectory) LinkSourceFile(cfbteblt8.c,LinkDirectory) #ifdef MipsArchitecture LinkSourceFile(stipmips.s,LinkDirectory) #endif #ifdef SparcArchitecture LinkSourceFile(stipsparc.s,LinkDirectory) #endif #endif #if PixelSize == 32 #ifdef SparcArchitecture LinkSourceFile(stipsprc32.s,LinkDirectory) #endif #endif #endif ObjectFromSpecialSource(cfbseg,cfbline,-DPOLYSEGMENT) ObjectFromSpecialSource(cfbfillarcC,cfbfillarc,-DRROP=GXcopy) ObjectFromSpecialSource(cfbfillarcG,cfbfillarc,-DRROP=GXset) ObjectFromSpecialSource(cfbzerarcC,cfbzerarc,-DRROP=GXcopy) ObjectFromSpecialSource(cfbzerarcX,cfbzerarc,-DRROP=GXxor) ObjectFromSpecialSource(cfbzerarcG,cfbzerarc,-DRROP=GXset) ObjectFromSpecialSource(cfbbltC,cfbblt,-DMROP=Mcopy) ObjectFromSpecialSource(cfbbltX,cfbblt,-DMROP=Mxor) ObjectFromSpecialSource(cfbbltO,cfbblt,-DMROP=Mor) ObjectFromSpecialSource(cfbbltG,cfbblt,-DMROP=0) ObjectFromSpecialSource(cfbsolidC,cfbsolid,-DRROP=GXcopy) ObjectFromSpecialSource(cfbsolidX,cfbsolid,-DRROP=GXxor) ObjectFromSpecialSource(cfbsolidG,cfbsolid,-DRROP=GXset) ObjectFromSpecialSource(cfbtileoddC,cfbtileodd,-DMROP=Mcopy) ObjectFromSpecialSource(cfbtileoddG,cfbtileodd,-DMROP=0) ObjectFromSpecialSource(cfbtile32C,cfbtile32,-DMROP=Mcopy) ObjectFromSpecialSource(cfbtile32G,cfbtile32,-DMROP=0) ObjectFromSpecialSource(cfb8lineCO,cfb8line,-DRROP=GXcopy) ObjectFromSpecialSource(cfb8lineCP,cfb8line,-DRROP=GXcopy -DPREVIOUS) ObjectFromSpecialSource(cfb8lineX,cfb8line,-DRROP=GXxor) ObjectFromSpecialSource(cfb8lineG,cfb8line,-DRROP=GXset) ObjectFromSpecialSource(cfb8segCS,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT -DWIDTH_SHIFT) ObjectFromSpecialSource(cfb8segC,cfb8line,-DRROP=GXcopy -DPOLYSEGMENT) ObjectFromSpecialSource(cfb8segX,cfb8line,-DRROP=GXxor -DPOLYSEGMENT) ObjectFromSpecialSource(cfb8segG,cfb8line,-DRROP=GXset -DPOLYSEGMENT) ObjectFromSpecialSource(cfbply1rctC,cfbply1rct,-DRROP=GXcopy) ObjectFromSpecialSource(cfbply1rctG,cfbply1rct,-DRROP=GXset) SpecialCObjectRule(cfbglblt8,$(_NOOP_),$(STIPPLEDEF)) SpecialCObjectRule(cfbpixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(cfbcmap,$(ICONFIGFILES),$(EXT_DEFINES) $(GLX_DEFINES)) #if PixelSize == 8 ObjectFromSpecialSource(cfbglrop8,cfbglblt8,-DGLYPHROP) #ifdef MipsArchitecture stipmipste.s: stipmips.s $(RM) $@ $(LN) stipmips.s stipmipste.s clean:: $(RM) stipmipste.s stipmipste.o: stipmipste.s $(AS) -o $@ -DTETEXT stipmipste.s #endif #ifdef SparcArchitecture stipsparcte.s: stipsparc.s $(RM) $@ $(LN) stipsparc.s stipsparcte.s clean:: $(RM) stipsparcte.s stipsparc.o: stipsparc.s $(CPP) AsmDefines stipsparc.s | $(AS) -o $@ - stipsparcte.o: stipsparcte.s $(CPP) AsmDefines -DTETEXT stipsparcte.s | $(AS) -o $@ - #endif #endif #if PixelSize == 32 #ifdef SparcArchitecture stipsprcte32.s: stipsprc32.s $(RM) $@ $(LN) stipsprc32.s stipsprcte32.s clean:: $(RM) stipsprcte32.s stipsprc32.o: stipsprc32.s $(CPP) AsmDefines stipsprc32.s | $(AS) -o $@ - stipsprcte32.o: stipsprcte32.s $(CPP) AsmDefines -DTETEXT stipsprcte32.s | $(AS) -o $@ - #endif #endif #if PixelSize == 32 InstallLinkKitNamedLibrary(cfb,cfb32,$(LINKKITDIR)/lib) #endif #if PixelSize == 24 InstallLinkKitNamedLibrary(cfb,cfb24,$(LINKKITDIR)/lib) #endif #if PixelSize == 16 InstallLinkKitNamedLibrary(cfb,cfb16,$(LINKKITDIR)/lib) #endif #if PixelSize == 8 InstallLinkKitLibrary(cfb,$(LINKKITDIR)/lib) InstallLinkKitNonExecFile(cfb.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cfb8bit.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cfbmap.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cfbmskbits.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(cfbrrop.h,$(LINKKITDIR)/include) #endif #ifndef OS2Architecture DependTarget() #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbbres.c0100664000076400007640000002043707120677563021225 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbbres.c,v 1.15 94/04/17 20:28:45 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbbres.c,v 3.1 1996/08/25 14:05:40 dawes Exp $ */ #include "X.h" #include "misc.h" #include "cfb.h" #include "cfbmskbits.h" #include "servermd.h" #include "miline.h" /* Solid bresenham line */ /* NOTES e2 is used less often than e1, so it's not in a register */ void cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) int rop; unsigned long and, xor; unsigned long *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ register int signdx; int signdy; /* signs of directions */ int axis; /* major axis (Y_AXIS or X_AXIS) */ int x1, y1; /* initial point */ register int e; /* error accumulator */ register int e1; /* bresenham increments */ int e2; int len; /* length of line */ { register int e3 = e2-e1; #if PSZ == 24 unsigned long piQxelXor[3],piQxelAnd[3]; char *addrb; int nlwidth3, signdx3; #endif #ifdef PIXEL_ADDR register PixelType *addrp; /* Pixel pointer */ if (len == 0) return; /* point to first point */ nlwidth <<= PWSH; #if PSZ == 24 addrp = (PixelType *)(addrl) + (y1 * nlwidth); addrb = (char *)addrp + x1 * 3; piQxelXor[0] = (xor << 24) | xor; piQxelXor[1] = (xor << 16)| (xor >> 8); piQxelXor[2] = (xor << 8) | (xor >> 16); piQxelAnd[0] = (and << 24) | and; piQxelAnd[1] = (and << 16)| (and >> 8); piQxelAnd[2] = (and << 8) | (and >> 16); #else addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; #endif if (signdy < 0) nlwidth = -nlwidth; e = e-e1; /* to make looping easier */ #if PSZ == 24 nlwidth3 = nlwidth * sizeof (long); signdx3 = signdx * 3; #endif if (axis == Y_AXIS) { int t; t = nlwidth; nlwidth = signdx; signdx = t; #if PSZ == 24 t = nlwidth3; nlwidth3 = signdx3; signdx3 = t; #endif } if (rop == GXcopy) { --len; #if PSZ == 24 #define body_copy \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ break; \ case 1: \ *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ break; \ case 3: \ *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ break; \ case 2: \ *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ break; \ } #define body {\ body_copy \ addrb += signdx3; \ e += e1; \ if (e >= 0) \ { \ addrb += nlwidth3; \ e += e3; \ } \ } #else /* PSZ == 24 */ #define body {\ *addrp = xor; \ addrp += signdx; \ e += e1; \ if (e >= 0) \ { \ addrp += nlwidth; \ e += e3; \ } \ } #endif /* PSZ == 24 */ while (len >= 4) { body body body body len -= 4; } switch (len) { case 3: body case 2: body case 1: body } #undef body #if PSZ == 24 body_copy # undef body_copy #else *addrp = xor; #endif } else /* not GXcopy */ { while(len--) { #if PSZ == 24 addrp = (PixelType *)((unsigned long)addrb & ~0x03); switch((unsigned long)addrb & 3){ case 0: *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) ^ (piQxelXor[0] & 0xFFFFFF); break; case 1: *addrp = (*addrp & (piQxelAnd[2]|0xFF)) ^ (piQxelXor[2] & 0xFFFFFF00); break; case 3: *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) ^ (piQxelXor[0] & 0xFF000000); *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) ^ (piQxelXor[1] & 0xFFFF); break; case 2: *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) ^ (piQxelXor[1] & 0xFFFF0000); *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) ^ (piQxelXor[2] & 0xFF); break; } e += e1; if (e >= 0) { addrb += nlwidth3; e += e3; } addrb += signdx3; #else /* PSZ == 24 */ *addrp = DoRRop (*addrp, and, xor); e += e1; if (e >= 0) { addrp += nlwidth; e += e3; } addrp += signdx; #endif /* PSZ == 24 */ } } #else /* !PIXEL_ADDR */ register unsigned long tmp, bit; unsigned long leftbit, rightbit; /* point to longword containing first point */ #if PSZ == 24 addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2); #else addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); #endif if (signdy < 0) nlwidth = -nlwidth; e = e-e1; /* to make looping easier */ leftbit = cfbmask[0]; #if PSZ == 24 rightbit = cfbmask[(PPW-1)<<1]; bit = cfbmask[(x1 & 3)<<1]; #else rightbit = cfbmask[PPW-1]; bit = cfbmask[x1 & PIM]; #endif if (axis == X_AXIS) { if (signdx > 0) { while (len--) { *addrl = DoMaskRRop (*addrl, and, xor, bit); bit = SCRRIGHT(bit,1); e += e1; if (e >= 0) { addrl += nlwidth; e += e3; } if (!bit) { bit = leftbit; addrl++; } } } else { while (len--) { *addrl = DoMaskRRop (*addrl, and, xor, bit); e += e1; bit = SCRLEFT(bit,1); if (e >= 0) { addrl += nlwidth; e += e3; } if (!bit) { bit = rightbit; addrl--; } } } } /* if X_AXIS */ else { if (signdx > 0) { while(len--) { *addrl = DoMaskRRop (*addrl, and, xor, bit); e += e1; if (e >= 0) { bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit; addrl++; } e += e3; } addrl += nlwidth; } } else { while(len--) { *addrl = DoMaskRRop (*addrl, and, xor, bit); e += e1; if (e >= 0) { bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit; addrl--; } e += e3; } addrl += nlwidth; } } } /* else Y_AXIS */ #endif } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbbstore.c0100664000076400007640000001075507120677563021572 0ustar constconst/*- * cfbbstore.c -- * Functions required by the backing-store implementation in MI. * * Copyright (c) 1987 by the Regents of the University of California * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. * * */ #ifndef lint static char rcsid[] = "$XConsortium: cfbbstore.c,v 5.8 93/12/13 17:21:51 dpw Exp $ SPRITE (Berkeley)"; #endif #include "cfb.h" #include "X.h" #include "mibstore.h" #include "regionstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" /*- *----------------------------------------------------------------------- * cfbSaveAreas -- * Function called by miSaveAreas to actually fetch the areas to be * saved into the backing pixmap. This is very simple to do, since * cfbDoBitblt is designed for this very thing. The region to save is * already destination-relative and we're given the offset to the * window origin, so we have only to create an array of points of the * u.l. corners of the boxes in the region translated to the screen * coordinate system and fetch the screen pixmap out of its devPrivate * field.... * * Results: * None. * * Side Effects: * Data are copied from the screen into the pixmap. * *----------------------------------------------------------------------- */ void cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin) PixmapPtr pPixmap; /* Backing pixmap */ RegionPtr prgnSave; /* Region to save (pixmap-relative) */ int xorg; /* X origin of region */ int yorg; /* Y origin of region */ WindowPtr pWin; { register DDXPointPtr pPt; DDXPointPtr pPtsInit; register BoxPtr pBox; register int i; ScreenPtr pScreen = pPixmap->drawable.pScreen; PixmapPtr pScrPix; i = REGION_NUM_RECTS(prgnSave); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec)); if (!pPtsInit) return; pBox = REGION_RECTS(prgnSave); pPt = pPtsInit; while (--i >= 0) { pPt->x = pBox->x1 + xorg; pPt->y = pBox->y1 + yorg; pPt++; pBox++; } #ifdef CFB_NEED_SCREEN_PRIVATE pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr; #else pScrPix = (PixmapPtr) pScreen->devPrivate; #endif cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap, GXcopy, prgnSave, pPtsInit, ~0L); DEALLOCATE_LOCAL (pPtsInit); } /*- *----------------------------------------------------------------------- * cfbRestoreAreas -- * Function called by miRestoreAreas to actually fetch the areas to be * restored from the backing pixmap. This is very simple to do, since * cfbDoBitblt is designed for this very thing. The region to restore is * already destination-relative and we're given the offset to the * window origin, so we have only to create an array of points of the * u.l. corners of the boxes in the region translated to the pixmap * coordinate system and fetch the screen pixmap out of its devPrivate * field.... * * Results: * None. * * Side Effects: * Data are copied from the pixmap into the screen. * *----------------------------------------------------------------------- */ void cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin) PixmapPtr pPixmap; /* Backing pixmap */ RegionPtr prgnRestore; /* Region to restore (screen-relative)*/ int xorg; /* X origin of window */ int yorg; /* Y origin of window */ WindowPtr pWin; { register DDXPointPtr pPt; DDXPointPtr pPtsInit; register BoxPtr pBox; register int i; ScreenPtr pScreen = pPixmap->drawable.pScreen; PixmapPtr pScrPix; i = REGION_NUM_RECTS(prgnRestore); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec)); if (!pPtsInit) return; pBox = REGION_RECTS(prgnRestore); pPt = pPtsInit; while (--i >= 0) { pPt->x = pBox->x1 - xorg; pPt->y = pBox->y1 - yorg; pPt++; pBox++; } #ifdef CFB_NEED_SCREEN_PRIVATE pScrPix = (PixmapPtr) pScreen->devPrivates[cfbScreenPrivateIndex].ptr; #else pScrPix = (PixmapPtr) pScreen->devPrivate; #endif cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix, GXcopy, prgnRestore, pPtsInit, ~0L); DEALLOCATE_LOCAL (pPtsInit); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbsetsp.c0100664000076400007640000002160607120677563021427 0ustar constconst/* $XConsortium: cfbsetsp.c,v 5.10 94/04/17 20:29:01 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbsetsp.c,v 3.0 1996/06/29 09:05:49 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "misc.h" #include "regionstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" #include /* cfbSetScanline -- copies the bits from psrc to the drawable starting at * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc * starts on the scanline. (I.e., if this scanline passes through multiple * boxes, we may not want to start grabbing bits at psrc but at some offset * further on.) */ cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask) int y; int xOrigin; /* where this scanline starts */ int xStart; /* first bit to use from scanline */ int xEnd; /* last bit to use from scanline + 1 */ register unsigned int *psrc; register int alu; /* raster op */ int *pdstBase; /* start of the drawable */ int widthDst; /* width of drawable in words */ unsigned long planemask; { int w; /* width of scanline in bits */ register int *pdst; /* where to put the bits */ register int tmpSrc; /* scratch buffer to collect bits in */ int dstBit; /* offset in bits from beginning of * word */ register int nstart; /* number of bits from first partial */ register int nend; /* " " last partial word */ int offSrc; int startmask, endmask, nlMiddle, nl; #if PSZ == 24 register char *psrcb, *pdstb; register int xIndex; #endif DeclareMergeRop() InitializeMergeRop(alu,planemask); #if PSZ == 24 pdst = pdstBase + (y * widthDst); xIndex = xStart; pdstb = (char *)pdst + (xStart * 3); offSrc = xStart - xOrigin; psrcb = (char *)psrc + (offSrc * 3); #else pdst = pdstBase + (y * widthDst) + (xStart >> PWSH); psrc += (xStart - xOrigin) >> PWSH; offSrc = (xStart - xOrigin) & PIM; #endif w = xEnd - xStart; dstBit = xStart & PIM; #if PSZ == 24 nl = w; while (nl--){ psrc = (unsigned int *)((unsigned long)psrcb & ~0x03); getbits24(psrc, tmpSrc, offSrc); pdst = (int *)((unsigned long)pdstb & ~0x03); DoMergeRop24(tmpSrc, pdst, xIndex); offSrc++; psrcb += 3; xIndex++; pdstb += 3; } #else /* PSZ == 24 */ if (dstBit + w <= PPW) { maskpartialbits(dstBit, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits(xStart, w, startmask, endmask, nlMiddle); } if (startmask) nstart = PPW - dstBit; else nstart = 0; if (endmask) nend = xEnd & PIM; else nend = 0; if (startmask) { getbits(psrc, offSrc, nstart, tmpSrc); putbitsmropshort(tmpSrc, dstBit, nstart, pdst); pdst++; offSrc += nstart; if (offSrc > PLST) { psrc++; offSrc -= PPW; } } nl = nlMiddle; while (nl--) { getbits(psrc, offSrc, PPW, tmpSrc); *pdst = DoMergeRop(tmpSrc, *pdst); pdst++; psrc++; } if (endmask) { getbits(psrc, offSrc, nend, tmpSrc); putbitsmropshort(tmpSrc, 0, nend, pdst); } #endif /* PSZ == 24 */ } /* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines * are in increasing Y order. * Source bit lines are server scanline padded so that they always begin * on a word boundary. */ void cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *pcharsrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { unsigned int *psrc = (unsigned int *)pcharsrc; unsigned long *pdstBase; /* start of dst bitmap */ int widthDst; /* width of bitmap in words */ register BoxPtr pbox, pboxLast, pboxTest; register DDXPointPtr pptLast; int alu; RegionPtr prgnDst; int xStart, xEnd; int yMax; alu = pGC->alu; prgnDst = cfbGetCompositeClip(pGC); pptLast = ppt + nspans; cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) yMax = (int) pDrawable->y + (int) pDrawable->height; pbox = REGION_RECTS(prgnDst); pboxLast = pbox + REGION_NUM_RECTS(prgnDst); if(fSorted) { /* scan lines sorted in ascending order. Because they are sorted, we * don't have to check each scanline against each clip box. We can be * sure that this scanline only has to be clipped to boxes at or after the * beginning of this y-band */ pboxTest = pbox; while(ppt < pptLast) { pbox = pboxTest; if(ppt->y >= yMax) break; while(pbox < pboxLast) { if(pbox->y1 > ppt->y) { /* scanline is before clip box */ break; } else if(pbox->y2 <= ppt->y) { /* clip box is before scanline */ pboxTest = ++pbox; continue; } else if(pbox->x1 > ppt->x + *pwidth) { /* clip box is to right of scanline */ break; } else if(pbox->x2 <= ppt->x) { /* scanline is to right of clip box */ pbox++; continue; } /* at least some of the scanline is in the current clip box */ xStart = max(pbox->x1, ppt->x); xEnd = min(ppt->x + *pwidth, pbox->x2); cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, (int *)pdstBase, widthDst, pGC->planemask); if(ppt->x + *pwidth <= pbox->x2) { /* End of the line, as it were */ break; } else pbox++; } /* We've tried this line against every box; it must be outside them * all. move on to the next point */ ppt++; psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); pwidth++; } } else { /* scan lines not sorted. We must clip each line against all the boxes */ while(ppt < pptLast) { if(ppt->y >= 0 && ppt->y < yMax) { for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) { if(pbox->y1 > ppt->y) { /* rest of clip region is above this scanline, * skip it */ break; } if(pbox->y2 <= ppt->y) { /* clip box is below scanline */ pbox++; break; } if(pbox->x1 <= ppt->x + *pwidth && pbox->x2 > ppt->x) { xStart = max(pbox->x1, ppt->x); xEnd = min(pbox->x2, ppt->x + *pwidth); cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, (int *)pdstBase, widthDst, pGC->planemask); } } } psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); ppt++; pwidth++; } } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbbresd.c0100664000076400007640000002606607120677563021375 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbbresd.c,v 1.16 94/04/17 20:28:45 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbbresd.c,v 3.1 1996/08/25 14:05:42 dawes Exp $ */ #include "X.h" #include "misc.h" #include "cfb.h" #include "cfbmskbits.h" #include "miline.h" /* Dashed bresenham line */ void cfbBresD(rrops, pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) cfbRRopPtr rrops; int *pdashIndex; /* current dash */ unsigned char *pDash; /* dash list */ int numInDashList; /* total length of dash list */ int *pdashOffset; /* offset into current dash */ int isDoubleDash; unsigned long *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int signdx, signdy; /* signs of directions */ int axis; /* major axis (Y_AXIS or X_AXIS) */ int x1, y1; /* initial point */ register int e; /* error accumulator */ register int e1; /* bresenham increments */ int e2; int len; /* length of line */ { #ifdef PIXEL_ADDR register PixelType *addrp; #endif register int e3 = e2-e1; int dashIndex; int dashOffset; int dashRemaining; unsigned long xorFg, andFg, xorBg, andBg; Bool isCopy; int thisDash; #if PSZ == 24 unsigned long xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3]; char *addrb; int signdx3, signdy3; #endif dashOffset = *pdashOffset; dashIndex = *pdashIndex; isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy); #if PSZ == 24 xorFg = rrops[0].xor & 0xffffff; andFg = rrops[0].and & 0xffffff; xorBg = rrops[1].xor & 0xffffff; andBg = rrops[1].and & 0xffffff; xorPiQxlFg[0] = xorFg | (xorFg << 24); xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16); xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8); andPiQxlFg[0] = andFg | (andFg << 24); andPiQxlFg[1] = (andFg >> 8) | (andFg << 16); andPiQxlFg[2] = (andFg >> 16) | (andFg << 8); xorPiQxlBg[0] = xorBg | (xorBg << 24); xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16); xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8); andPiQxlBg[0] = andBg | (andBg << 24); andPiQxlBg[1] = (andBg >> 8) | (andBg << 16); andPiQxlBg[2] = (andFg >> 16) | (andBg << 8); #else xorFg = rrops[0].xor; andFg = rrops[0].and; xorBg = rrops[1].xor; andBg = rrops[1].and; #endif dashRemaining = pDash[dashIndex] - dashOffset; if ((thisDash = dashRemaining) >= len) { thisDash = len; dashRemaining -= len; } e = e-e1; /* to make looping easier */ #define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;} #define NextDash {\ dashIndex++; \ if (dashIndex == numInDashList) \ dashIndex = 0; \ dashRemaining = pDash[dashIndex]; \ if ((thisDash = dashRemaining) >= len) \ { \ dashRemaining -= len; \ thisDash = len; \ } \ } #ifdef PIXEL_ADDR #if PSZ == 24 #define Loop(store) while (thisDash--) {\ store; \ BresStep(addrb+=signdy3,addrb+=signdx3) \ } /* point to first point */ nlwidth <<= PWSH; addrp = (PixelType *)(addrl) + (y1 * nlwidth); addrb = (char *)addrp + x1 * 3; #else #define Loop(store) while (thisDash--) {\ store; \ BresStep(addrp+=signdy,addrp+=signdx) \ } /* point to first point */ nlwidth <<= PWSH; addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; #endif signdy *= nlwidth; #if PSZ == 24 signdx3 = signdx * 3; signdy3 = signdy * sizeof (long); #endif if (axis == Y_AXIS) { int t; t = signdx; signdx = signdy; signdy = t; #if PSZ == 24 t = signdx3; signdx3 = signdy3; signdy3 = t; #endif } if (isCopy) { #if PSZ == 24 #define body_copy(pix) { \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \ break; \ case 1: \ *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \ break; \ case 3: \ *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \ *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \ break; \ case 2: \ *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \ *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \ break; \ } \ } #endif /* PSZ == 24 */ for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { #if PSZ == 24 Loop(body_copy(xorPiQxlBg)) #else Loop(*addrp = xorBg) #endif } else { Loop(;) } } else { #if PSZ == 24 Loop(body_copy(xorPiQxlFg)) #else Loop(*addrp = xorFg) #endif } if (!len) break; NextDash } #undef body_copy } else { #define body_set(and, xor) { \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \ break; \ case 1: \ *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \ break; \ case 3: \ *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \ *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \ break; \ case 2: \ *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \ *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \ break; \ } \ } for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { #if PSZ == 24 Loop(body_set(andPiQxlBg, xorPiQxlBg)) #else Loop(*addrp = DoRRop(*addrp,andBg, xorBg)) #endif } else { Loop(;) } } else { #if PSZ == 24 Loop(body_set(andPiQxlFg, xorPiQxlFg)) #else Loop(*addrp = DoRRop(*addrp,andFg, xorFg)) #endif } if (!len) break; NextDash } #undef body_set } #else /* !PIXEL_ADDR */ { register unsigned long tmp; unsigned long startbit, bit; /* point to longword containing first point */ #if PSZ == 24 addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2); #else addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); #endif signdy = signdy * nlwidth; if (signdx > 0) startbit = cfbmask[0]; else #if PSZ == 24 startbit = cfbmask[(PPW-1)<<1]; bit = cfbmask[(x1 & 3)<<1]; #else startbit = cfbmask[PPW-1]; bit = cfbmask[x1 & PIM]; #endif #if PSZ == 24 #define X_Loop(store) while(thisDash--) {\ store; \ BresStep(addrl += signdy, \ if (signdx > 0) \ bit = SCRRIGHT(bit,1); \ else \ bit = SCRLEFT(bit,1); \ if (!bit) \ { \ bit = startbit; \ addrl += signdx; \ }) \ } #define Y_Loop(store) while(thisDash--) {\ store; \ BresStep(if (signdx > 0) \ bit = SCRRIGHT(bit,1); \ else \ bit = SCRLEFT(bit,1); \ if (!bit) \ { \ bit = startbit; \ addrl += signdx; \ }, \ addrl += signdy) \ } #else #define X_Loop(store) while(thisDash--) {\ store; \ BresStep(addrl += signdy, \ if (signdx > 0) \ bit = SCRRIGHT(bit,1); \ else \ bit = SCRLEFT(bit,1); \ if (!bit) \ { \ bit = startbit; \ addrl += signdx; \ }) \ } #define Y_Loop(store) while(thisDash--) {\ store; \ BresStep(if (signdx > 0) \ bit = SCRRIGHT(bit,1); \ else \ bit = SCRLEFT(bit,1); \ if (!bit) \ { \ bit = startbit; \ addrl += signdx; \ }, \ addrl += signdy) \ } #endif if (axis == X_AXIS) { for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { X_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit)); } else { X_Loop(;) } } else { X_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit)); } if (!len) break; NextDash } } /* if X_AXIS */ else { for (;;) { len -= thisDash; if (dashIndex & 1) { if (isDoubleDash) { Y_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit)); } else { Y_Loop(;) } } else { Y_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit)); } if (!len) break; NextDash } } /* else Y_AXIS */ } #endif *pdashIndex = dashIndex; *pdashOffset = pDash[dashIndex] - dashRemaining; } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbfillrct.c0100664000076400007640000001642007120677563021726 0ustar constconst/* * Fill rectangles. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfbfillrct.c,v 5.18 94/04/17 20:28:47 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbfillrct.c,v 3.1.4.1 1997/05/10 07:02:48 hohndel Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "mergerop.h" void cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot) DrawablePtr pDrawable; int n; BoxPtr rects; PixmapPtr tile; int xrot, yrot; { #if PSZ == 24 if (tile->drawable.width & 3) #else if (tile->drawable.width & PIM) #endif cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); else cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); } void cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; BoxPtr pBox; { int xrot, yrot; void (*fill)(); xrot = pDrawable->x + pGC->patOrg.x; yrot = pDrawable->y + pGC->patOrg.y; #if PSZ == 24 if (pGC->tile.pixmap->drawable.width & 3) #else if (pGC->tile.pixmap->drawable.width & PIM) #endif { fill = cfbFillBoxTileOddGeneral; if ((pGC->planemask & PMSK) == PMSK) { if (pGC->alu == GXcopy) fill = cfbFillBoxTileOddCopy; } } else { fill = cfbFillBoxTile32sGeneral; if ((pGC->planemask & PMSK) == PMSK) { if (pGC->alu == GXcopy) fill = cfbFillBoxTile32sCopy; } } (*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); } #define NUM_STACK_RECTS 1024 void cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; register GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { xRectangle *prect; RegionPtr prgnClip; register BoxPtr pbox; register BoxPtr pboxClipped; BoxPtr pboxClippedBase; BoxPtr pextent; BoxRec stackRects[NUM_STACK_RECTS]; cfbPrivGC *priv; int numRects; void (*BoxFill)(); int n; int xorg, yorg; #if PSZ != 8 if ((pGC->fillStyle == FillStippled) || (pGC->fillStyle == FillOpaqueStippled)) { miPolyFillRect(pDrawable, pGC, nrectFill, prectInit); return; } #endif priv = cfbGetGCPrivate(pGC); prgnClip = priv->pCompositeClip; BoxFill = 0; switch (pGC->fillStyle) { case FillSolid: switch (priv->rop) { case GXcopy: BoxFill = cfbFillRectSolidCopy; break; case GXxor: BoxFill = cfbFillRectSolidXor; break; default: BoxFill = cfbFillRectSolidGeneral; break; } break; case FillTiled: if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) BoxFill = cfbFillRectTileOdd; else { if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) BoxFill = cfbFillRectTile32Copy; else BoxFill = cfbFillRectTile32General; } break; #if PSZ == 8 case FillStippled: if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) BoxFill = cfb8FillRectStippledUnnatural; else BoxFill = cfb8FillRectTransparentStippled32; break; case FillOpaqueStippled: if (!cfbGetGCPrivate(pGC)->pRotatedPixmap) BoxFill = cfb8FillRectStippledUnnatural; else BoxFill = cfb8FillRectOpaqueStippled32; break; #endif } prect = prectInit; xorg = pDrawable->x; yorg = pDrawable->y; if (xorg || yorg) { prect = prectInit; n = nrectFill; while(n--) { prect->x += xorg; prect->y += yorg; prect++; } } prect = prectInit; numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; if (numRects > NUM_STACK_RECTS) { pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); if (!pboxClippedBase) return; } else pboxClippedBase = stackRects; pboxClipped = pboxClippedBase; if (REGION_NUM_RECTS(prgnClip) == 1) { int x1, y1, x2, y2, bx2, by2; pextent = REGION_RECTS(prgnClip); x1 = pextent->x1; y1 = pextent->y1; x2 = pextent->x2; y2 = pextent->y2; while (nrectFill--) { if ((pboxClipped->x1 = prect->x) < x1) pboxClipped->x1 = x1; if ((pboxClipped->y1 = prect->y) < y1) pboxClipped->y1 = y1; bx2 = (int) prect->x + (int) prect->width; if (bx2 > x2) bx2 = x2; pboxClipped->x2 = bx2; by2 = (int) prect->y + (int) prect->height; if (by2 > y2) by2 = y2; pboxClipped->y2 = by2; prect++; if ((pboxClipped->x1 < pboxClipped->x2) && (pboxClipped->y1 < pboxClipped->y2)) { pboxClipped++; } } } else { int x1, y1, x2, y2, bx2, by2; pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); x1 = pextent->x1; y1 = pextent->y1; x2 = pextent->x2; y2 = pextent->y2; while (nrectFill--) { BoxRec box; if ((box.x1 = prect->x) < x1) box.x1 = x1; if ((box.y1 = prect->y) < y1) box.y1 = y1; bx2 = (int) prect->x + (int) prect->width; if (bx2 > x2) bx2 = x2; box.x2 = bx2; by2 = (int) prect->y + (int) prect->height; if (by2 > y2) by2 = y2; box.y2 = by2; prect++; if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) continue; n = REGION_NUM_RECTS (prgnClip); pbox = REGION_RECTS(prgnClip); /* clip the rectangle to each box in the clip region this is logically equivalent to calling Intersect() */ while(n--) { pboxClipped->x1 = max(box.x1, pbox->x1); pboxClipped->y1 = max(box.y1, pbox->y1); pboxClipped->x2 = min(box.x2, pbox->x2); pboxClipped->y2 = min(box.y2, pbox->y2); pbox++; /* see if clipping left anything */ if(pboxClipped->x1 < pboxClipped->x2 && pboxClipped->y1 < pboxClipped->y2) { pboxClipped++; } } } } if (pboxClipped != pboxClippedBase) (*BoxFill) (pDrawable, pGC, pboxClipped-pboxClippedBase, pboxClippedBase); if (pboxClippedBase != stackRects) DEALLOCATE_LOCAL(pboxClippedBase); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbteblt8.c0100664000076400007640000003625307120677563021477 0ustar constconst/* * TEGblt - ImageText expanded glyph fonts only. For * 8 bit displays, in Copy mode with no clipping. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfbteblt8.c,v 5.24 94/09/29 15:26:00 dpw Exp $ */ #if PSZ == 8 #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfbmskbits.h" #include "cfb8bit.h" /* * this code supports up to 5 characters at a time. The performance * differences between 4 and 5 is usually small (~7% on PMAX) and * frequently negative (SPARC and Sun3), so this file is compiled * only once for now. If you want to use the other options, you'll * need to hack cfbgc.c as well. */ #ifndef NGLYPHS #define NGLYPHS 4 #define DO_COMMON #endif #ifdef DO_COMMON #define CFBTEGBLT8 cfbTEGlyphBlt8 #endif /* * On little-endian machines (or where fonts are padded to 32-bit * boundaries) we can use some magic to avoid the expense of getleftbits */ #if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4) #if GLYPHPADBYTES == 1 typedef unsigned char *glyphPointer; #define USE_LEFTBITS #endif #if GLYPHPADBYTES == 2 typedef unsigned short *glyphPointer; #define USE_LEFTBITS #endif #if GLYPHPADBYTES == 4 typedef unsigned int *glyphPointer; #endif #define GetBitsL c = BitLeft (*leftChar++, lshift) #define NGetBits1S(r) c = BitRight(*char1++ r, xoff1) #define NGetBits1L(r) GetBitsL | BitRight(*char1++ r, xoff1) #define NGetBits1U(r) c = *char1++ r #define NGetBits2S(r) NGetBits1S(| BitRight(*char2++ r, widthGlyph)) #define NGetBits2L(r) NGetBits1L(| BitRight(*char2++ r, widthGlyph)) #define NGetBits2U(r) NGetBits1U(| BitRight(*char2++ r, widthGlyph)) #define NGetBits3S(r) NGetBits2S(| BitRight(*char3++ r, widthGlyph)) #define NGetBits3L(r) NGetBits2L(| BitRight(*char3++ r, widthGlyph)) #define NGetBits3U(r) NGetBits2U(| BitRight(*char3++ r, widthGlyph)) #define NGetBits4S(r) NGetBits3S(| BitRight(*char4++ r, widthGlyph)) #define NGetBits4L(r) NGetBits3L(| BitRight(*char4++ r, widthGlyph)) #define NGetBits4U(r) NGetBits3U(| BitRight(*char4++ r, widthGlyph)) #define NGetBits5S(r) NGetBits4S(| BitRight(*char5++ r, widthGlyph)) #define NGetBits5L(r) NGetBits4L(| BitRight(*char5++ r, widthGlyph)) #define NGetBits5U(r) NGetBits4U(| BitRight(*char5++ r, widthGlyph)) #define GetBits1S c = BitRight(*char1++, xoff1) #define GetBits1L GetBitsL | BitRight(*char1++, xoff1) #define GetBits1U c = *char1++ #define GetBits2S NGetBits1S(| BitRight(*char2++, widthGlyph)) #define GetBits2L NGetBits1L(| BitRight(*char2++, widthGlyph)) #define GetBits2U NGetBits1U(| BitRight(*char2++, widthGlyph)) #define GetBits3S NGetBits2S(| BitRight(*char3++, widthGlyph)) #define GetBits3L NGetBits2L(| BitRight(*char3++, widthGlyph)) #define GetBits3U NGetBits2U(| BitRight(*char3++, widthGlyph)) #define GetBits4S NGetBits3S(| BitRight(*char4++, widthGlyph)) #define GetBits4L NGetBits3L(| BitRight(*char4++, widthGlyph)) #define GetBits4U NGetBits3U(| BitRight(*char4++, widthGlyph)) #define GetBits5S NGetBits4S(| BitRight(*char5++, widthGlyph)) #define GetBits5L NGetBits4L(| BitRight(*char5++, widthGlyph)) #define GetBits5U NGetBits4U(| BitRight(*char5++, widthGlyph)) #else typedef unsigned int *glyphPointer; #define USE_LEFTBITS #define ALL_LEFTBITS #define GetBitsL WGetBitsL #define GetBits1S WGetBits1S #define GetBits1L WGetBits1L #define GetBits1U WGetBits1U #define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \ c |= BitRight(tmpSrc, xoff2); #define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \ c |= BitRight(tmpSrc, xoff2); #define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \ c |= BitRight(tmpSrc, xoff2); #define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \ c |= BitRight(tmpSrc, xoff3); #define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \ c |= BitRight(tmpSrc, xoff3); #define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \ c |= BitRight(tmpSrc, xoff3); #define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \ c |= BitRight(tmpSrc, xoff4); #define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \ c |= BitRight(tmpSrc, xoff4); #define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \ c |= BitRight(tmpSrc, xoff4); #define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \ c |= BitRight(tmpSrc, xoff5); #define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \ c |= BitRight(tmpSrc, xoff5); #define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \ c |= BitRight(tmpSrc, xoff5); #endif #ifdef USE_LEFTBITS extern unsigned long endtab[]; #define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes)) #define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \ IncChar (ch); #define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \ dst &= mask; #define WGetBitsL Get1Bits(leftChar,c); \ c = BitLeft (c, lshift); #define WGetBits1S Get1Bits (char1, c) \ c = BitRight (c, xoff1); #define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \ c |= BitRight (tmpSrc, xoff1); #define WGetBits1U Get1Bits (char1, c) #else #define WGetBitsL GetBitsL #define WGetBits1S GetBits1S #define WGetBits1L GetBits1L #define WGetBits1U GetBits1U #endif #if NGLYPHS == 2 # define GetBitsNS GetBits2S # define GetBitsNL GetBits2L # define GetBitsNU GetBits2U # define LastChar char2 #ifndef CFBTEGBLT8 # define CFBTEGBLT8 cfbTEGlyphBlt8x2 #endif #endif #if NGLYPHS == 3 # define GetBitsNS GetBits3S # define GetBitsNL GetBits3L # define GetBitsNU GetBits3U # define LastChar char3 #ifndef CFBTEGBLT8 # define CFBTEGBLT8 cfbTEGlyphBlt8x3 #endif #endif #if NGLYPHS == 4 # define GetBitsNS GetBits4S # define GetBitsNL GetBits4L # define GetBitsNU GetBits4U # define LastChar char4 #ifndef CFBTEGBLT8 # define CFBTEGBLT8 cfbTEGlyphBlt8x4 #endif #endif #if NGLYPHS == 5 # define GetBitsNS GetBits5S # define GetBitsNL GetBits5L # define GetBitsNU GetBits5U # define LastChar char5 #ifndef CFBTEGBLT8 # define CFBTEGBLT8 cfbTEGlyphBlt8x5 #endif #endif /* another ugly giant macro */ #define SwitchEm switch (ew) \ { \ case 0: \ break; \ case 1: \ while (hTmp--) { \ GetBits; \ StoreBits0 \ Loop \ } \ break; \ case 2: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) \ Loop \ } \ break; \ case 3: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \ Loop \ } \ break; \ case 4: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step \ StoreBits(2) Step StoreBits(3) \ Loop \ } \ break; \ case 5: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step \ StoreBits(2) Step StoreBits(3) Step \ StoreBits(4) \ Loop \ } \ break; \ case 6: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step \ StoreBits(2) Step StoreBits(3) Step \ StoreBits(4) Step StoreBits(5) \ Loop \ } \ break; \ case 7: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step \ StoreBits(2) Step StoreBits(3) Step \ StoreBits(4) Step StoreBits(5) Step \ StoreBits(6) \ Loop \ } \ break; \ case 8: \ while (hTmp--) { \ GetBits; \ StoreBits0 FirstStep StoreBits(1) Step \ StoreBits(2) Step StoreBits(3) Step \ StoreBits(4) Step StoreBits(5) Step \ StoreBits(6) Step StoreBits(7) \ Loop \ } \ break; \ } #ifdef FAST_CONSTANT_OFFSET_MODE #define StorePixels(o,p) dst[o] = p #define Loop dst += widthDst; #else #define StorePixels(o,p) *dst++ = (p) #define Loop dst += widthLeft; #endif #define Step NextBitGroup(c); #if (BITMAP_BIT_ORDER == MSBFirst) #define StoreBits(o) StorePixels(o,GetPixelGroup(c)); #define FirstStep Step #else #if PGSZ == 64 #define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]); #define FirstStep Step #else /* PGSZ == 32 */ #define StoreBits(o) StorePixels(o,*((unsigned long *) (((char *) cfb8Pixels) + (c & 0x3c)))); #define FirstStep c = BitLeft (c, 2); #endif /* PGSZ */ #endif /* BITMAP_BIT_ORDER */ void CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int xInit, yInit; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { register unsigned long c; register unsigned long *dst; register unsigned long leftMask, rightMask; register int hTmp; register int xoff1; register glyphPointer char1; register glyphPointer char2; #if NGLYPHS >= 3 register glyphPointer char3; #endif #if NGLYPHS >= 4 register glyphPointer char4; #endif #if NGLYPHS >= 5 register glyphPointer char5; #endif #ifdef ALL_LEFTBITS int xoff2, xoff3, xoff4, xoff5; #endif FontPtr pfont = pGC->font; unsigned long *dstLine; glyphPointer oldRightChar; unsigned long *pdstBase; glyphPointer leftChar; int widthDst, widthLeft; int widthGlyph; int h; int ew; int x, y; BoxRec bbox; /* for clipping */ int lshift; int widthGlyphs; #ifdef USE_LEFTBITS register unsigned long glyphMask; register unsigned long tmpSrc; register int glyphBytes; #endif widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); h = FONTASCENT(pfont) + FONTDESCENT(pfont); if (!h) return; x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; y = yInit - FONTASCENT(pfont) + pDrawable->y; bbox.x1 = x; bbox.x2 = x + (widthGlyph * nglyph); bbox.y1 = y; bbox.y2 = y + h; switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox)) { case rgnPART: cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase); case rgnOUT: return; } if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel)) cfb8SetPixels (pGC->fgPixel, pGC->bgPixel); leftChar = 0; cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase) #if NGLYPHS == 2 widthGlyphs = widthGlyph << 1; #else #if NGLYPHS == 4 widthGlyphs = widthGlyph << 2; #else widthGlyphs = widthGlyph * NGLYPHS; #endif #endif #ifdef USE_LEFTBITS glyphMask = endtab[widthGlyph]; glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci); #endif pdstBase += y * widthDst; #ifdef DO_COMMON if (widthGlyphs <= 32) #endif while (nglyph >= NGLYPHS) { nglyph -= NGLYPHS; hTmp = h; dstLine = pdstBase + (x >> PWSH); xoff1 = x & PIM; char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); #ifdef ALL_LEFTBITS xoff2 = xoff1 + widthGlyph; #endif #if NGLYPHS >= 3 char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); #ifdef ALL_LEFTBITS xoff3 = xoff2 + widthGlyph; #endif #endif #if NGLYPHS >= 4 char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); #ifdef ALL_LEFTBITS xoff4 = xoff3 + widthGlyph; #endif #endif #if NGLYPHS >= 5 char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); #ifdef ALL_LEFTBITS xoff5 = xoff4 + widthGlyph; #endif #endif oldRightChar = LastChar; dst = dstLine; if (xoff1) { ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1; #ifndef FAST_CONSTANT_OFFSET_MODE widthLeft = widthDst - ew; #endif if (!leftChar) { leftMask = cfbendtab[xoff1]; rightMask = cfbstarttab[xoff1]; #define StoreBits0 StorePixels (0,dst[0] & leftMask | \ GetPixelGroup(c) & rightMask); #define GetBits GetBitsNS SwitchEm #undef GetBits #undef StoreBits0 } else { lshift = widthGlyph - xoff1; #define StoreBits0 StorePixels (0,GetPixelGroup(c)); #define GetBits GetBitsNL SwitchEm #undef GetBits #undef StoreBits0 } } else { #if NGLYPHS == 4 && PGSZ == 32 ew = widthGlyph; /* widthGlyphs >> 2 */ #else ew = widthGlyphs >> PWSH; #endif #ifndef FAST_CONSTANT_OFFSET_MODE widthLeft = widthDst - ew; #endif #define StoreBits0 StorePixels (0,GetPixelGroup(c)); #define GetBits GetBitsNU SwitchEm #undef GetBits #undef StoreBits0 } x += widthGlyphs; leftChar = oldRightChar; } while (nglyph--) { xoff1 = x & PIM; char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); hTmp = h; dstLine = pdstBase + (x >> PWSH); oldRightChar = char1; dst = dstLine; if (xoff1) { ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1; #ifndef FAST_CONSTANT_OFFSET_MODE widthLeft = widthDst - ew; #endif if (!leftChar) { leftMask = cfbendtab[xoff1]; rightMask = cfbstarttab[xoff1]; #define StoreBits0 StorePixels (0,dst[0] & leftMask | GetPixelGroup(c) & rightMask); #define GetBits WGetBits1S SwitchEm #undef GetBits #undef StoreBits0 } else { lshift = widthGlyph - xoff1; #define StoreBits0 StorePixels (0,GetPixelGroup(c)); #define GetBits WGetBits1L SwitchEm #undef GetBits #undef StoreBits0 } } else { ew = widthGlyph >> PWSH; #ifndef FAST_CONSTANT_OFFSET_MODE widthLeft = widthDst - ew; #endif #define StoreBits0 StorePixels (0,GetPixelGroup(c)); #define GetBits WGetBits1U SwitchEm #undef GetBits #undef StoreBits0 } x += widthGlyph; leftChar = oldRightChar; } /* * draw the tail of the last character */ xoff1 = x & PIM; if (xoff1) { rightMask = cfbstarttab[xoff1]; leftMask = cfbendtab[xoff1]; lshift = widthGlyph - xoff1; dst = pdstBase + (x >> PWSH); hTmp = h; while (hTmp--) { GetBitsL; *dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask); dst += widthDst; } } } #endif /* PSZ == 8 */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfb8bit.c0100664000076400007640000003673507120677563021150 0ustar constconst/* $XConsortium: cfb8bit.c,v 1.13 94/09/29 20:33:11 dpw Exp $ */ /* Copyright (c) 1989, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * cfb8bit.c * * 8 bit color frame buffer utility routines */ #if PSZ == 8 #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" PixelGroup cfb8StippleMasks[NUM_MASKS] = { #if NUM_MASKS == 16 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff #else /* NUM_MASKS == 256 */ 0x0000000000000000, 0x00000000000000ff, 0x000000000000ff00, 0x000000000000ffff, 0x0000000000ff0000, 0x0000000000ff00ff, 0x0000000000ffff00, 0x0000000000ffffff, 0x00000000ff000000, 0x00000000ff0000ff, 0x00000000ff00ff00, 0x00000000ff00ffff, 0x00000000ffff0000, 0x00000000ffff00ff, 0x00000000ffffff00, 0x00000000ffffffff, 0x000000ff00000000, 0x000000ff000000ff, 0x000000ff0000ff00, 0x000000ff0000ffff, 0x000000ff00ff0000, 0x000000ff00ff00ff, 0x000000ff00ffff00, 0x000000ff00ffffff, 0x000000ffff000000, 0x000000ffff0000ff, 0x000000ffff00ff00, 0x000000ffff00ffff, 0x000000ffffff0000, 0x000000ffffff00ff, 0x000000ffffffff00, 0x000000ffffffffff, 0x0000ff0000000000, 0x0000ff00000000ff, 0x0000ff000000ff00, 0x0000ff000000ffff, 0x0000ff0000ff0000, 0x0000ff0000ff00ff, 0x0000ff0000ffff00, 0x0000ff0000ffffff, 0x0000ff00ff000000, 0x0000ff00ff0000ff, 0x0000ff00ff00ff00, 0x0000ff00ff00ffff, 0x0000ff00ffff0000, 0x0000ff00ffff00ff, 0x0000ff00ffffff00, 0x0000ff00ffffffff, 0x0000ffff00000000, 0x0000ffff000000ff, 0x0000ffff0000ff00, 0x0000ffff0000ffff, 0x0000ffff00ff0000, 0x0000ffff00ff00ff, 0x0000ffff00ffff00, 0x0000ffff00ffffff, 0x0000ffffff000000, 0x0000ffffff0000ff, 0x0000ffffff00ff00, 0x0000ffffff00ffff, 0x0000ffffffff0000, 0x0000ffffffff00ff, 0x0000ffffffffff00, 0x0000ffffffffffff, 0x00ff000000000000, 0x00ff0000000000ff, 0x00ff00000000ff00, 0x00ff00000000ffff, 0x00ff000000ff0000, 0x00ff000000ff00ff, 0x00ff000000ffff00, 0x00ff000000ffffff, 0x00ff0000ff000000, 0x00ff0000ff0000ff, 0x00ff0000ff00ff00, 0x00ff0000ff00ffff, 0x00ff0000ffff0000, 0x00ff0000ffff00ff, 0x00ff0000ffffff00, 0x00ff0000ffffffff, 0x00ff00ff00000000, 0x00ff00ff000000ff, 0x00ff00ff0000ff00, 0x00ff00ff0000ffff, 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff, 0x00ff00ff00ffff00, 0x00ff00ff00ffffff, 0x00ff00ffff000000, 0x00ff00ffff0000ff, 0x00ff00ffff00ff00, 0x00ff00ffff00ffff, 0x00ff00ffffff0000, 0x00ff00ffffff00ff, 0x00ff00ffffffff00, 0x00ff00ffffffffff, 0x00ffff0000000000, 0x00ffff00000000ff, 0x00ffff000000ff00, 0x00ffff000000ffff, 0x00ffff0000ff0000, 0x00ffff0000ff00ff, 0x00ffff0000ffff00, 0x00ffff0000ffffff, 0x00ffff00ff000000, 0x00ffff00ff0000ff, 0x00ffff00ff00ff00, 0x00ffff00ff00ffff, 0x00ffff00ffff0000, 0x00ffff00ffff00ff, 0x00ffff00ffffff00, 0x00ffff00ffffffff, 0x00ffffff00000000, 0x00ffffff000000ff, 0x00ffffff0000ff00, 0x00ffffff0000ffff, 0x00ffffff00ff0000, 0x00ffffff00ff00ff, 0x00ffffff00ffff00, 0x00ffffff00ffffff, 0x00ffffffff000000, 0x00ffffffff0000ff, 0x00ffffffff00ff00, 0x00ffffffff00ffff, 0x00ffffffffff0000, 0x00ffffffffff00ff, 0x00ffffffffffff00, 0x00ffffffffffffff, 0xff00000000000000, 0xff000000000000ff, 0xff0000000000ff00, 0xff0000000000ffff, 0xff00000000ff0000, 0xff00000000ff00ff, 0xff00000000ffff00, 0xff00000000ffffff, 0xff000000ff000000, 0xff000000ff0000ff, 0xff000000ff00ff00, 0xff000000ff00ffff, 0xff000000ffff0000, 0xff000000ffff00ff, 0xff000000ffffff00, 0xff000000ffffffff, 0xff0000ff00000000, 0xff0000ff000000ff, 0xff0000ff0000ff00, 0xff0000ff0000ffff, 0xff0000ff00ff0000, 0xff0000ff00ff00ff, 0xff0000ff00ffff00, 0xff0000ff00ffffff, 0xff0000ffff000000, 0xff0000ffff0000ff, 0xff0000ffff00ff00, 0xff0000ffff00ffff, 0xff0000ffffff0000, 0xff0000ffffff00ff, 0xff0000ffffffff00, 0xff0000ffffffffff, 0xff00ff0000000000, 0xff00ff00000000ff, 0xff00ff000000ff00, 0xff00ff000000ffff, 0xff00ff0000ff0000, 0xff00ff0000ff00ff, 0xff00ff0000ffff00, 0xff00ff0000ffffff, 0xff00ff00ff000000, 0xff00ff00ff0000ff, 0xff00ff00ff00ff00, 0xff00ff00ff00ffff, 0xff00ff00ffff0000, 0xff00ff00ffff00ff, 0xff00ff00ffffff00, 0xff00ff00ffffffff, 0xff00ffff00000000, 0xff00ffff000000ff, 0xff00ffff0000ff00, 0xff00ffff0000ffff, 0xff00ffff00ff0000, 0xff00ffff00ff00ff, 0xff00ffff00ffff00, 0xff00ffff00ffffff, 0xff00ffffff000000, 0xff00ffffff0000ff, 0xff00ffffff00ff00, 0xff00ffffff00ffff, 0xff00ffffffff0000, 0xff00ffffffff00ff, 0xff00ffffffffff00, 0xff00ffffffffffff, 0xffff000000000000, 0xffff0000000000ff, 0xffff00000000ff00, 0xffff00000000ffff, 0xffff000000ff0000, 0xffff000000ff00ff, 0xffff000000ffff00, 0xffff000000ffffff, 0xffff0000ff000000, 0xffff0000ff0000ff, 0xffff0000ff00ff00, 0xffff0000ff00ffff, 0xffff0000ffff0000, 0xffff0000ffff00ff, 0xffff0000ffffff00, 0xffff0000ffffffff, 0xffff00ff00000000, 0xffff00ff000000ff, 0xffff00ff0000ff00, 0xffff00ff0000ffff, 0xffff00ff00ff0000, 0xffff00ff00ff00ff, 0xffff00ff00ffff00, 0xffff00ff00ffffff, 0xffff00ffff000000, 0xffff00ffff0000ff, 0xffff00ffff00ff00, 0xffff00ffff00ffff, 0xffff00ffffff0000, 0xffff00ffffff00ff, 0xffff00ffffffff00, 0xffff00ffffffffff, 0xffffff0000000000, 0xffffff00000000ff, 0xffffff000000ff00, 0xffffff000000ffff, 0xffffff0000ff0000, 0xffffff0000ff00ff, 0xffffff0000ffff00, 0xffffff0000ffffff, 0xffffff00ff000000, 0xffffff00ff0000ff, 0xffffff00ff00ff00, 0xffffff00ff00ffff, 0xffffff00ffff0000, 0xffffff00ffff00ff, 0xffffff00ffffff00, 0xffffff00ffffffff, 0xffffffff00000000, 0xffffffff000000ff, 0xffffffff0000ff00, 0xffffffff0000ffff, 0xffffffff00ff0000, 0xffffffff00ff00ff, 0xffffffff00ffff00, 0xffffffff00ffffff, 0xffffffffff000000, 0xffffffffff0000ff, 0xffffffffff00ff00, 0xffffffffff00ffff, 0xffffffffffff0000, 0xffffffffffff00ff, 0xffffffffffffff00, 0xffffffffffffffff #endif }; int cfb8StippleMode, cfb8StippleAlu, cfb8StippleRRop; PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm; PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS]; int cfb8SetStipple (alu, fg, planemask) int alu; unsigned long fg, planemask; { unsigned long and, xor, rrop; int s; unsigned long c; cfb8StippleMode = FillStippled; cfb8StippleAlu = alu; cfb8StippleFg = fg & PMSK; cfb8StipplePm = planemask & PMSK; rrop = cfbReduceRasterOp (alu, fg, planemask, &and, &xor); cfb8StippleRRop = rrop; /* * create the appropriate pixel-fill bits for current * foreground */ for (s = 0; s < NUM_MASKS; s++) { c = cfb8StippleMasks[s]; cfb8StippleAnd[s] = and | ~c; cfb8StippleXor[s] = xor & c; } return TRUE; } int cfb8SetOpaqueStipple (alu, fg, bg, planemask) int alu; unsigned long fg, bg, planemask; { unsigned long andfg, xorfg, andbg, xorbg, rropfg, rropbg; int s; unsigned long c; cfb8StippleMode = FillOpaqueStippled; cfb8StippleAlu = alu; cfb8StippleFg = fg & PMSK; cfb8StippleBg = bg & PMSK; cfb8StipplePm = planemask & PMSK; rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg); rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg); if (rropfg == rropbg) cfb8StippleRRop = rropfg; else cfb8StippleRRop = GXset; /* * create the appropriate pixel-fill bits for current * foreground */ for (s = 0; s < NUM_MASKS; s++) { c = cfb8StippleMasks[s]; cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c); cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c); } return TRUE; } /* * a grungy little routine. This computes clip masks * for partial character blts. Returns rgnOUT if the * entire character is clipped; returns rgnIN if the entire * character is unclipped; returns rgnPART if a portion of * the character is visible. Computes clip masks for each * longword of the character -- and those with the * contents of the glyph to compute the visible bits. */ #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, 0x0000000f, 0x00000007, 0x00000003, 0x00000001, }; #else PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8, 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80, 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800, 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000, 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000, 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000, 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000, }; #endif /* BITMAP_BIT_ORDER */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffffffffffff, 0x7fffffffffffffff, 0x3fffffffffffffff, 0x1fffffffffffffff, 0x0fffffffffffffff, 0x07ffffffffffffff, 0x03ffffffffffffff, 0x01ffffffffffffff, 0x00ffffffffffffff, 0x007fffffffffffff, 0x003fffffffffffff, 0x001fffffffffffff, 0x000fffffffffffff, 0x0007ffffffffffff, 0x0003ffffffffffff, 0x0001ffffffffffff, 0x0000ffffffffffff, 0x00007fffffffffff, 0x00003fffffffffff, 0x00001fffffffffff, 0x00000fffffffffff, 0x000007ffffffffff, 0x000003ffffffffff, 0x000001ffffffffff, 0x000000ffffffffff, 0x0000007fffffffff, 0x0000003fffffffff, 0x0000001fffffffff, 0x0000000fffffffff, 0x00000007ffffffff, 0x00000003ffffffff, 0x00000001ffffffff, 0x00000000ffffffff, 0x000000007fffffff, 0x000000003fffffff, 0x000000001fffffff, 0x000000000fffffff, 0x0000000007ffffff, 0x0000000003ffffff, 0x0000000001ffffff, 0x0000000000ffffff, 0x00000000007fffff, 0x00000000003fffff, 0x00000000001fffff, 0x00000000000fffff, 0x000000000007ffff, 0x000000000003ffff, 0x000000000001ffff, 0x000000000000ffff, 0x0000000000007fff, 0x0000000000003fff, 0x0000000000001fff, 0x0000000000000fff, 0x00000000000007ff, 0x00000000000003ff, 0x00000000000001ff, 0x00000000000000ff, 0x000000000000007f, 0x000000000000003f, 0x000000000000001f, 0x000000000000000f, 0x0000000000000007, 0x0000000000000003, 0x0000000000000001 }; #else PixelGroup cfb8BitLenMasks[PGSZ] = { 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffffffffc, 0xfffffffffffffff8, 0xfffffffffffffff0, 0xffffffffffffffe0, 0xffffffffffffffc0, 0xffffffffffffff80, 0xffffffffffffff00, 0xfffffffffffffe00, 0xfffffffffffffc00, 0xfffffffffffff800, 0xfffffffffffff000, 0xffffffffffffe000, 0xffffffffffffc000, 0xffffffffffff8000, 0xffffffffffff0000, 0xfffffffffffe0000, 0xfffffffffffc0000, 0xfffffffffff80000, 0xfffffffffff00000, 0xffffffffffe00000, 0xffffffffffc00000, 0xffffffffff800000, 0xffffffffff000000, 0xfffffffffe000000, 0xfffffffffc000000, 0xfffffffff8000000, 0xfffffffff0000000, 0xffffffffe0000000, 0xffffffffc0000000, 0xffffffff80000000, 0xffffffff00000000, 0xfffffffe00000000, 0xfffffffc00000000, 0xfffffff800000000, 0xfffffff000000000, 0xffffffe000000000, 0xffffffc000000000, 0xffffff8000000000, 0xffffff0000000000, 0xfffffe0000000000, 0xfffffc0000000000, 0xfffff80000000000, 0xfffff00000000000, 0xffffe00000000000, 0xffffc00000000000, 0xffff800000000000, 0xffff000000000000, 0xfffe000000000000, 0xfffc000000000000, 0xfff8000000000000, 0xfff0000000000000, 0xffe0000000000000, 0xffc0000000000000, 0xff80000000000000, 0xff00000000000000, 0xfe00000000000000, 0xfc00000000000000, 0xf800000000000000, 0xf000000000000000, 0xe000000000000000, 0xc000000000000000, 0x8000000000000000 }; #endif /* BITMAP_BIT_ORDER */ #endif /* PGSZ */ int cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips) BoxPtr pBox; int numRects; int x, y, w, h; CARD32 *clips; { int yBand, yBandBot; int ch; unsigned long clip; int partIN = FALSE, partOUT = FALSE; int result; if (numRects == 0) return rgnOUT; while (numRects && pBox->y2 <= y) { --numRects; ++pBox; } if (!numRects || pBox->y1 >= y + h) return rgnOUT; yBand = pBox->y1; while (numRects && pBox->y1 == yBand && pBox->x2 <= x) { --numRects; ++pBox; } if (!numRects || pBox->y1 >= y + h) return rgnOUT; if (numRects && x >= pBox->x1 && x + w <= pBox->x2 && y >= pBox->y1 && y + h <= pBox->y2) { return rgnIN; } ch = 0; while (numRects && pBox->y1 < y + h) { yBand = pBox->y1; yBandBot = pBox->y2; while (ch < h && y + ch < yBand) { partOUT = TRUE; clips[ch++] = 0; } if (ch >= h) break; while (numRects && pBox->y1 == yBand && pBox->x2 <= x) { --numRects; ++pBox; } if (!numRects) break; clip = 0; while (numRects && pBox->y1 == yBand && pBox->x1 < x + w) { if (x < pBox->x1) if (pBox->x2 < x + w) clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x]; else clip |= cfb8BitLenMasks[pBox->x1 - x]; else if (pBox->x2 < x + w) clip |= ~cfb8BitLenMasks[pBox->x2 - x]; else clip = ~0; --numRects; ++pBox; } if (clip != 0) partIN = TRUE; if (clip != ~0) partOUT = TRUE; while (ch < h && y + ch < yBandBot) clips[ch++] = clip; while (numRects && pBox->y1 == yBand) { --numRects; ++pBox; } } while (ch < h) { partOUT = TRUE; clips[ch++] = 0; } result = rgnOUT; if (partIN) { if (partOUT) result = rgnPART; else result = rgnIN; } return result; } #endif /* PSZ == 8 */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbwindow.c0100664000076400007640000002274007120677563021600 0ustar constconst/* $XConsortium: cfbwindow.c,v 5.22 94/04/17 20:29:07 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "mistruct.h" #include "regionstr.h" #include "cfbmskbits.h" extern WindowPtr *WindowTable; Bool cfbCreateWindow(pWin) WindowPtr pWin; { cfbPrivWin *pPrivWin; pPrivWin = cfbGetWindowPrivate(pWin); pPrivWin->pRotatedBorder = NullPixmap; pPrivWin->pRotatedBackground = NullPixmap; pPrivWin->fastBackground = FALSE; pPrivWin->fastBorder = FALSE; pPrivWin->oldRotate.x = 0; pPrivWin->oldRotate.y = 0; #ifdef PIXMAP_PER_WINDOW /* Setup pointer to Screen pixmap */ pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer) cfbGetScreenPixmap(pWin->drawable.pScreen); #endif return TRUE; } Bool cfbDestroyWindow(pWin) WindowPtr pWin; { cfbPrivWin *pPrivWin; pPrivWin = cfbGetWindowPrivate(pWin); if (pPrivWin->pRotatedBorder) (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder); if (pPrivWin->pRotatedBackground) (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground); return(TRUE); } /*ARGSUSED*/ Bool cfbMapWindow(pWindow) WindowPtr pWindow; { return(TRUE); } /* (x, y) is the upper left corner of the window on the screen do we really need to pass this? (is it a;ready in pWin->absCorner?) we only do the rotation for pixmaps that are 32 bits wide (padded or otherwise.) cfbChangeWindowAttributes() has already put a copy of the pixmap in pPrivWin->pRotated* */ /*ARGSUSED*/ Bool cfbPositionWindow(pWin, x, y) WindowPtr pWin; int x, y; { cfbPrivWin *pPrivWin; int setxy = 0; pPrivWin = cfbGetWindowPrivate(pWin); if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) { cfbXRotatePixmap(pPrivWin->pRotatedBackground, pWin->drawable.x - pPrivWin->oldRotate.x); cfbYRotatePixmap(pPrivWin->pRotatedBackground, pWin->drawable.y - pPrivWin->oldRotate.y); setxy = 1; } if (!pWin->borderIsPixel && pPrivWin->fastBorder) { while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; cfbXRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.x - pPrivWin->oldRotate.x); cfbYRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.y - pPrivWin->oldRotate.y); setxy = 1; } if (setxy) { pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } return (TRUE); } /*ARGSUSED*/ Bool cfbUnmapWindow(pWindow) WindowPtr pWindow; { return (TRUE); } /* UNCLEAN! this code calls the bitblt helper code directly. cfbCopyWindow copies only the parts of the destination that are visible in the source. */ void cfbCopyWindow(pWin, ptOldOrg, prgnSrc) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr prgnSrc; { DDXPointPtr pptSrc; register DDXPointPtr ppt; RegionRec rgnDst; register BoxPtr pbox; register int dx, dy; register int i, nbox; WindowPtr pwinRoot; pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); pbox = REGION_RECTS(&rgnDst); nbox = REGION_NUM_RECTS(&rgnDst); if(!nbox || !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) { REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); return; } ppt = pptSrc; for (i = nbox; --i >= 0; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, &rgnDst, pptSrc, ~0L); DEALLOCATE_LOCAL(pptSrc); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); } /* swap in correct PaintWindow* routine. If we can use a fast output routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy of it in devPrivates[cfbWindowPrivateIndex].ptr. */ Bool cfbChangeWindowAttributes(pWin, mask) WindowPtr pWin; unsigned long mask; { register unsigned long index; register cfbPrivWin *pPrivWin; int width; WindowPtr pBgWin; pPrivWin = cfbGetWindowPrivate(pWin); /* * When background state changes from ParentRelative and * we had previously rotated the fast border pixmap to match * the parent relative origin, rerotate to match window */ if (mask & (CWBackPixmap | CWBackPixel) && pWin->backgroundState != ParentRelative && pPrivWin->fastBorder && (pPrivWin->oldRotate.x != pWin->drawable.x || pPrivWin->oldRotate.y != pWin->drawable.y)) { cfbXRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.x - pPrivWin->oldRotate.x); cfbYRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.y - pPrivWin->oldRotate.y); pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } while(mask) { index = lowbit (mask); mask &= ~index; switch(index) { case CWBackPixmap: if (pWin->backgroundState == None) { pPrivWin->fastBackground = FALSE; } else if (pWin->backgroundState == ParentRelative) { pPrivWin->fastBackground = FALSE; /* Rotate border to match parent origin */ if (pPrivWin->pRotatedBorder) { for (pBgWin = pWin->parent; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); cfbXRotatePixmap(pPrivWin->pRotatedBorder, pBgWin->drawable.x - pPrivWin->oldRotate.x); cfbYRotatePixmap(pPrivWin->pRotatedBorder, pBgWin->drawable.y - pPrivWin->oldRotate.y); pPrivWin->oldRotate.x = pBgWin->drawable.x; pPrivWin->oldRotate.y = pBgWin->drawable.y; } } else if (((width = (pWin->background.pixmap->drawable.width * PSZ)) <= PGSZ) && !(width & (width - 1))) { cfbCopyRotatePixmap(pWin->background.pixmap, &pPrivWin->pRotatedBackground, pWin->drawable.x, pWin->drawable.y); if (pPrivWin->pRotatedBackground) { pPrivWin->fastBackground = TRUE; pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } else { pPrivWin->fastBackground = FALSE; } } else { pPrivWin->fastBackground = FALSE; } break; case CWBackPixel: pPrivWin->fastBackground = FALSE; break; case CWBorderPixmap: if (((width = (pWin->border.pixmap->drawable.width * PSZ)) <= PGSZ) && !(width & (width - 1))) { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); cfbCopyRotatePixmap(pWin->border.pixmap, &pPrivWin->pRotatedBorder, pBgWin->drawable.x, pBgWin->drawable.y); if (pPrivWin->pRotatedBorder) { pPrivWin->fastBorder = TRUE; pPrivWin->oldRotate.x = pBgWin->drawable.x; pPrivWin->oldRotate.y = pBgWin->drawable.y; } else { pPrivWin->fastBorder = FALSE; } } else { pPrivWin->fastBorder = FALSE; } break; case CWBorderPixel: pPrivWin->fastBorder = FALSE; break; } } return (TRUE); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfb8bit.h0100664000076400007640000014416207120677563021147 0ustar constconst/* * cfb8bit.h * * Defines which are only useful to 8 bit color frame buffers * * That doesn't seem to be true any more. Some of the macros in here * are used for depths other than 8. Perhaps the file should be * renamed. dpw */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfb8bit.h,v 1.18 95/04/07 18:59:27 kaleb Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfb8bit.h,v 3.2 1996/06/29 09:05:22 dawes Exp $ */ #include "servermd.h" #if (BITMAP_BIT_ORDER == MSBFirst) #define GetBitGroup(x) (((PixelGroup) (x)) >> (PGSZ - PGSZB)) #define NextBitGroup(x) ((x) <<= PGSZB) #define NextSomeBits(x,n) ((x) <<= (n)) #else #define GetBitGroup(x) ((x) & PGSZBMSK) #define NextBitGroup(x) ((x) >>= PGSZB) #define NextSomeBits(x,n) ((x) >>= (n)) #endif #define RotBitsLeft(x,k) ((x) = BitLeft (x,k) | \ BitRight (x, PGSZ-(k))) #if defined(__GNUC__) && defined(mc68020) #undef RotBitsLeft #define RotBitsLeft(x,k) asm("rol%.l %2,%0" \ : "=d" (x) \ : "0" (x), "dI" (k)) #endif #if PSZ == 8 #define GetPixelGroup(x) (cfb8StippleXor[GetBitGroup(x)]) #define RRopPixels(dst,x) (DoRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x])) #define RRopPixelGroup(dst,x) (RRopPixels(dst,GetBitGroup(x))) #define MaskRRopPixels(dst,x,mask) (DoMaskRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x], mask)) #define NUM_MASKS (1<= MFB_PPW) \ { \ inputBits = *srcTemp++; \ bitsLeft -= MFB_PPW; \ partBitsLeft = MFB_PPW; \ } \ else \ { \ inputBits = 0; \ if (bitsLeft) \ inputBits = *srcTemp & ~cfb8BitLenMasks[bitsLeft]; \ srcTemp = srcStart; \ partBitsLeft = bitsLeft; \ bitsLeft = bitsWhole; \ } #define NextUnnaturalStippleBits \ if (partBitsLeft >= PPW) { \ bits = GetBitGroup (inputBits); \ NextBitGroup (inputBits); \ partBitsLeft -= PPW; \ } else { \ bits = GetBitGroup (inputBits); \ nextPartBits = PPW - partBitsLeft; \ NextUnnaturalStippleWord \ if (partBitsLeft < nextPartBits) { \ if (partBitsLeft) {\ bits |= BitRight (GetBitGroup (inputBits), \ PPW - nextPartBits) & PPWMSK;\ nextPartBits -= partBitsLeft; \ } \ NextUnnaturalStippleWord \ } \ bits |= BitRight (GetBitGroup (inputBits), \ PPW - nextPartBits) & PPWMSK; \ NextSomeBits (inputBits, nextPartBits); \ partBitsLeft -= nextPartBits; \ } #define NextUnnaturalStippleBitsFast \ if (partBitsLeft >= PPW) { \ bits = GetBitGroup(inputBits); \ NextBitGroup(inputBits); \ partBitsLeft -= PPW; \ } else { \ bits = GetBitGroup (inputBits); \ nextPartBits = PPW - partBitsLeft; \ inputBits = *srcTemp++; \ bits |= BitRight (GetBitGroup (inputBits), \ partBitsLeft) & PPWMSK; \ NextSomeBits (inputBits, nextPartBits); \ partBitsLeft = MFB_PPW - nextPartBits; \ } /* * WriteBitGroup takes the destination address, a pixel * value (which must be 8 bits duplicated 4 time with PFILL) * and the PPW bits to write, which must be in the low order * bits of the register (probably from GetBitGroup) and writes * the appropriate locations in memory with the pixel value. This * is a copy-mode only operation. */ #define RRopBitGroup(dst,bits) \ { \ register PixelGroup _bitsTmp = (bits); \ *(dst) = RRopPixels(*(dst),bits); \ } #define MaskRRopBitGroup(dst,bits,mask) \ { \ register PixelGroup _bitsTmp = (bits); \ *(dst) = MaskRRopPixels(*(dst),bits,mask); \ } #endif /* PSZ == 8 */ #if !defined(AVOID_MEMORY_READ) && PSZ == 8 #define WriteBitGroup(dst,pixel,bits) \ { \ register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \ *(dst) = (*(dst) & ~_maskTmp) | ((pixel) & _maskTmp); \ } #define SwitchBitGroup(dst,pixel,bits) \ { \ register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \ register PixelGroup _pixTmp = ((pixel) & _maskTmp); \ _maskTmp = ~_maskTmp; \ SwitchBitsLoop (*(dst) = (*(dst) & _maskTmp) | _pixTmp;) \ } #else /* AVOID_MEMORY_READ */ #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) #define SinglePixel0 3 #define SinglePixel1 2 #define SinglePixel2 1 #define SinglePixel3 0 #define SinglePixel4 7 #define SinglePixel5 6 #define SinglePixel6 5 #define SinglePixel7 4 #define SinglePixel8 0xB #define SinglePixel9 0xA #define DoublePixel0 1 #define DoublePixel1 0 #define DoublePixel2 3 #define DoublePixel3 2 #define DoublePixel4 5 #define DoublePixel5 4 #else #define SinglePixel0 0 #define SinglePixel1 1 #define SinglePixel2 2 #define SinglePixel3 3 #define SinglePixel4 4 #define SinglePixel5 5 #define SinglePixel6 6 #define SinglePixel7 7 #define SinglePixel8 8 #define SinglePixel9 9 #define DoublePixel0 0 #define DoublePixel1 1 #define DoublePixel2 2 #define DoublePixel3 3 #define DoublePixel4 4 #define DoublePixel5 5 #endif #define QuadPixel0 0 #define QuadPixel1 1 #define QuadPixel2 2 #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) #define SinglePixel0 7 #define SinglePixel1 6 #define SinglePixel2 5 #define SinglePixel3 4 #define SinglePixel4 3 #define SinglePixel5 2 #define SinglePixel6 1 #define SinglePixel7 0 #define DoublePixel0 3 #define DoublePixel1 2 #define DoublePixel2 1 #define DoublePixel3 0 #define QuadPixel0 1 #define QuadPixel1 0 #else #define SinglePixel0 0 #define SinglePixel1 1 #define SinglePixel2 2 #define SinglePixel3 3 #define SinglePixel4 4 #define SinglePixel5 5 #define SinglePixel6 6 #define SinglePixel7 7 #define DoublePixel0 0 #define DoublePixel1 1 #define DoublePixel2 2 #define DoublePixel3 3 #define QuadPixel0 0 #define QuadPixel1 1 #endif #define OctaPixel0 0 #endif /* PGSZ == 64 */ #if PSZ == 8 #if PGSZ == 32 #define WriteBitGroup(dst,pixel,bits) \ switch (bits) { \ case 0: \ break; \ case 1: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ break; \ case 4: \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 13: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 14: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[0] = (pixel); \ break; \ } #else /* PGSZ == 64 */ #define WriteBitGroup(dst,pixel,bits) \ if ( bits == 0xff ) \ ((PixelGroup *) (dst))[OctaPixel0] = (pixel); \ else { \ switch (bits & 0x0f) { \ case 0: \ break; \ case 1: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ break; \ case 4: \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 13: \ ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 14: \ ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[QuadPixel0] = (pixel); \ break; \ } \ switch ((bits & 0xf0) >> 4) { \ case 0: \ break; \ case 1: \ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ break; \ case 2: \ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 3: \ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ break; \ case 4: \ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 5: \ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 6: \ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 7: \ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 8: \ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 9: \ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 10: \ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 11: \ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 12: \ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 13: \ ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 14: \ ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ break; \ } \ } #endif /* PGSZ == 64 */ #if PGSZ == 32 #define SwitchBitGroup(dst,pixel,bits) { \ switch (bits) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);) \ break; \ case 4: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 13: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 14: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[0] = (pixel);) \ break; \ } \ } #else /* PGSZ == 64 */ #define SwitchBitGroup(dst,pixel,bits) { \ if ( bits == 0xff ) \ SwitchBitsLoop (((PixelGroup *) (dst))[OctaPixel0] = (pixel);) \ else { \ switch (bits & 0x0f) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);)\ break; \ case 4: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ break; \ case 13: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ break; \ case 14: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel);) \ break; \ } \ switch ((bits & 0xf0) >> 4) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel);)\ break; \ case 4: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ break; \ case 13: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ break; \ case 14: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel1] = (pixel);) \ break; \ } \ } \ } #endif /* PGSZ == 64 */ #endif /* PSZ == 8 */ #if PSZ == 16 #if PGSZ == 32 #define WriteBitGroup(dst,pixel,bits) \ switch (bits) { \ case 0: \ break; \ case 1: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ break; \ case 4: \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 13: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 14: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ } #else /* PGSZ == 64 */ #define WriteBitGroup(dst,pixel,bits) \ if ( bits == 0xff ) { \ ((PixelGroup *) (dst))[QuadPixel0] = (pixel); \ ((PixelGroup *) (dst))[QuadPixel1] = (pixel); \ } \ else { \ switch (bits & 0x0f) { \ case 0: \ break; \ case 1: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ break; \ case 4: \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 13: \ ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 14: \ ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ break; \ } \ switch ((bits & 0xf0) >> 4) { \ case 0: \ break; \ case 1: \ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ break; \ case 2: \ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ break; \ case 4: \ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 5: \ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 6: \ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 8: \ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 9: \ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 10: \ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 13: \ ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 14: \ ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ break; \ } \ } #endif /* PGSZ */ #if PGSZ == 32 #define SwitchBitGroup(dst,pixel,bits) { \ switch (bits) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel);) \ break; \ case 4: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 13: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 14: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ break; \ } \ } #else /* PGSZ == 64 */ #define SwitchBitGroup(dst,pixel,bits) { \ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ #endif /* PGSZ */ #endif /* PSZ == 16 */ #if PSZ == 24 /* 32 000011112222*/ /* 24 000111222333*/ /* 16 001122334455*/ /* 8 0123456789AB*/ #if PGSZ == 32 #define WriteBitGroup(dst,pixel,bits) \ { \ register CARD32 reg_pixel = (pixel); \ switch (bits) { \ case 0: \ break; \ case 1: \ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \ break; \ case 2: \ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ break; \ case 3: \ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \ break; \ case 4: \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \ break; \ case 5: \ ((CARD16 *) (dst))[DoublePixel0] = \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ reg_pixel >>= 16; \ ((CARD8 *) (dst))[SinglePixel2] = \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ break; \ case 6: \ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ break; \ case 7: \ ((CARD16 *) (dst))[DoublePixel0] = \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel2] = \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ break; \ case 8: \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \ break; \ case 9: \ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \ break; \ case 10: \ ((CARD8 *) (dst))[SinglePixel3] = \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ break; \ case 11: \ ((CARD8 *) (dst))[SinglePixel3] = \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ break; \ case 12: \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ break; \ case 13: \ ((CARD16 *) (dst))[DoublePixel0] = \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel2] = \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ break; \ case 14: \ ((CARD8 *) (dst))[SinglePixel3] = \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ break; \ case 15: \ ((CARD16 *) (dst))[DoublePixel0] = \ ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ ((CARD8 *) (dst))[SinglePixel3] = \ ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD16 *) (dst))[DoublePixel2] = \ ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ reg_pixel >>= 8; \ ((CARD8 *) (dst))[SinglePixel8] = \ ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ break; \ } \ } #else /* PGSZ == 64 */ #define WriteBitGroup(dst,pixel,bits) \ if ( bits == 0xff ) { \ ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \ } \ else { \ switch (bits & 0x0f) { \ case 0: \ break; \ case 1: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 4: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 13: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 14: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ } \ switch ((bits & 0xf0) >> 4) { \ case 0: \ break; \ case 1: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ break; \ case 2: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 4: \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 5: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 6: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 8: \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 9: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 10: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 13: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 14: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ } \ } #endif /* PGSZ */ #if PGSZ == 32 #define SwitchBitGroup(dst,pixel,bits) { \ switch (bits) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ break; \ case 4: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ ((CARD32 *) (dst))[QuadPixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \ ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ break; \ case 13: \ SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ break; \ case 14: \ SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ break; \ } \ } #else /* PGSZ == 64 */ #define SwitchBitGroup(dst,pixel,bits) { \ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ #endif /* PGSZ */ #endif /* PSZ == 24 */ #if PSZ == 32 #if PGSZ == 32 #define WriteBitGroup(dst,pixel,bits) \ switch (bits) { \ case 0: \ break; \ case 1: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 4: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 13: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 14: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ } #else /* PGSZ == 64 */ #define WriteBitGroup(dst,pixel,bits) \ if ( bits == 0xff ) { \ ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \ ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \ } \ else { \ switch (bits & 0x0f) { \ case 0: \ break; \ case 1: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ break; \ case 2: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ break; \ case 4: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 5: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 6: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ break; \ case 8: \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 9: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 10: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 13: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 14: \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ break; \ } \ switch ((bits & 0xf0) >> 4) { \ case 0: \ break; \ case 1: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ break; \ case 2: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 3: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ break; \ case 4: \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 5: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 6: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 7: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ break; \ case 8: \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 9: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 10: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 11: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 12: \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 13: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 14: \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ case 15: \ ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ break; \ } \ } #endif /* PGSZ */ #if PGSZ == 32 #define SwitchBitGroup(dst,pixel,bits) { \ switch (bits) { \ case 0: \ break; \ case 1: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel);) \ break; \ case 2: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel);) \ break; \ case 3: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel);) \ break; \ case 4: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 5: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 6: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 7: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ break; \ case 8: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 9: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 10: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 11: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 12: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 13: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 14: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ case 15: \ SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ break; \ } \ } #else /* PGSZ == 64 */ #define SwitchBitGroup(dst,pixel,bits) { \ cfb cannot hack 64-bit SwitchBitGroup psz=PSZ #endif /* PGSZ */ #endif /* PSZ == 32 */ #endif /* AVOID_MEMORY_READ */ extern PixelGroup cfb8BitLenMasks[PGSZ]; extern int cfb8SetStipple ( #if NeedFunctionPrototypes int /*alu*/, unsigned long /*fg*/, unsigned long /*planemask*/ #endif ); extern int cfb8SetOpaqueStipple ( #if NeedFunctionPrototypes int /*alu*/, unsigned long /*fg*/, unsigned long /*bg*/, unsigned long /*planemask*/ #endif ); extern int cfb8ComputeClipMasks32 ( #if NeedFunctionPrototypes BoxPtr /*pBox*/, int /*numRects*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, CARD32 * /*clips*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbfillarc.c0100664000076400007640000002200707120677563021701 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: cfbfillarc.c /main/17 1995/12/06 16:57:18 dpw $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbfillarc.c,v 3.1 1996/08/13 11:27:33 dawes Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "mifillarc.h" #include "cfbrrop.h" #include "mi.h" /* gcc 1.35 is stupid */ #if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020) #define STUPID volatile #else #define STUPID #endif static void RROP_NAME(cfbFillEllipseSolid) (pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { STUPID int x, y, e; STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg; miFillArcRec info; #if PSZ == 24 unsigned char *addrlt, *addrlb; #else unsigned long *addrlt, *addrlb; #endif register unsigned long *addrl; register int n; int nlwidth; RROP_DECLARE register int xpos; register int slw; unsigned long startmask, endmask; int nlmiddle; #if PSZ == 24 register int pidx; int xpos3; #endif #if PSZ == 24 cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) #else cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) #endif RROP_FETCH_GC(pGC); miFillArcSetup(arc, &info); MIFILLARCSETUP(); xorg += pDraw->x; yorg += pDraw->y; addrlb = addrlt; addrlt += nlwidth * (yorg - y); addrlb += nlwidth * (yorg + y + dy); while (y) { addrlt += nlwidth; addrlb -= nlwidth; MIFILLARCSTEP(slw); if (!slw) continue; xpos = xorg - x; #if PSZ == 24 xpos3 = (xpos * 3) & ~0x03; addrl = (unsigned long *)((char *)addrlt + xpos3); if (slw == 1){ RROP_SOLID24(addrl, xpos); if (miFillArcLower(slw)){ addrl = (unsigned long *)((char *)addrlb + xpos3); RROP_SOLID24(addrl, xpos); } continue; } maskbits(xpos, slw, startmask, endmask, nlmiddle); xpos &= 3; pidx = xpos; if (startmask){ RROP_SOLID_MASK(addrl, startmask, pidx-1); addrl++; if (pidx == 3) pidx = 0; } n = nlmiddle; while (--n >= 0){ RROP_SOLID(addrl, pidx); addrl++; if (++pidx == 3) pidx = 0; } if (endmask) RROP_SOLID_MASK(addrl, endmask, pidx); if (!miFillArcLower(slw)) continue; addrl = (unsigned long *)((char *)addrlb + xpos3); pidx = xpos; if (startmask){ RROP_SOLID_MASK(addrl, startmask, pidx-1); addrl++; if (pidx == 3) pidx = 0; } n = nlmiddle; while (--n >= 0){ RROP_SOLID(addrl, pidx); addrl++; if (++pidx == 3) pidx = 0; } if (endmask) RROP_SOLID_MASK(addrl, endmask, pidx); #else /* PSZ == 24 */ addrl = addrlt + (xpos >> PWSH); if (((xpos & PIM) + slw) <= PPW) { maskpartialbits(xpos, slw, startmask); RROP_SOLID_MASK(addrl,startmask); if (miFillArcLower(slw)) { addrl = addrlb + (xpos >> PWSH); RROP_SOLID_MASK(addrl, startmask); } continue; } maskbits(xpos, slw, startmask, endmask, nlmiddle); if (startmask) { RROP_SOLID_MASK(addrl, startmask); addrl++; } n = nlmiddle; RROP_SPAN(addrl,n) if (endmask) RROP_SOLID_MASK(addrl, endmask); if (!miFillArcLower(slw)) continue; addrl = addrlb + (xpos >> PWSH); if (startmask) { RROP_SOLID_MASK(addrl, startmask); addrl++; } n = nlmiddle; RROP_SPAN(addrl, n); if (endmask) RROP_SOLID_MASK(addrl, endmask); #endif /* PSZ == 24 */ } } #if PSZ == 24 #define FILLSPAN(xl,xr,addr) \ if (xr >= xl){ \ n = xr - xl + 1; \ addrl = (unsigned long *)((char *)addr + ((xl * 3) & ~0x03)); \ if (n <= 1){ \ if (n) \ RROP_SOLID24(addrl, xl); \ } else { \ maskbits(xl, n, startmask, endmask, n); \ pidx = xl & 3; \ if (startmask){ \ RROP_SOLID_MASK(addrl, startmask, pidx-1); \ addrl++; \ if (pidx == 3) \ pidx = 0; \ } \ while (--n >= 0){ \ RROP_SOLID(addrl, pidx); \ addrl++; \ if (++pidx == 3) \ pidx = 0; \ } \ if (endmask) \ RROP_SOLID_MASK(addrl, endmask, pidx); \ } \ } #else /* PSZ == 24 */ #define FILLSPAN(xl,xr,addr) \ if (xr >= xl) \ { \ n = xr - xl + 1; \ addrl = addr + (xl >> PWSH); \ if (((xl & PIM) + n) <= PPW) \ { \ maskpartialbits(xl, n, startmask); \ RROP_SOLID_MASK(addrl, startmask); \ } \ else \ { \ maskbits(xl, n, startmask, endmask, n); \ if (startmask) \ { \ RROP_SOLID_MASK(addrl, startmask); \ addrl++; \ } \ while (n--) \ { \ RROP_SOLID(addrl); \ ++addrl; \ } \ if (endmask) \ RROP_SOLID_MASK(addrl, endmask); \ } \ } #endif /* PSZ == 24 */ #define FILLSLICESPANS(flip,addr) \ if (!flip) \ { \ FILLSPAN(xl, xr, addr); \ } \ else \ { \ xc = xorg - x; \ FILLSPAN(xc, xr, addr); \ xc += slw - 1; \ FILLSPAN(xl, xc, addr); \ } static void RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; register int x, y, e; miFillArcRec info; miArcSliceRec slice; int xl, xr, xc; #if PSZ == 24 unsigned char *addrlt, *addrlb; #else unsigned long *addrlt, *addrlb; #endif register unsigned long *addrl; register int n; int nlwidth; RROP_DECLARE unsigned long startmask, endmask; #if PSZ == 24 register int pidx; #endif /* PSZ == 24 */ #if PSZ == 24 cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) #else cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) #endif RROP_FETCH_GC(pGC); miFillArcSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); xorg += pDraw->x; yorg += pDraw->y; addrlb = addrlt; addrlt += nlwidth * (yorg - y); addrlb += nlwidth * (yorg + y + dy); slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; while (y > 0) { addrlt += nlwidth; addrlb -= nlwidth; MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { MIARCSLICEUPPER(xl, xr, slice, slw); FILLSLICESPANS(slice.flip_top, addrlt); } if (miFillSliceLower(slice)) { MIARCSLICELOWER(xl, xr, slice, slw); FILLSLICESPANS(slice.flip_bot, addrlb); } } } void RROP_NAME(cfbPolyFillArcSolid) (pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register xArc *arc; register int i; int x2, y2; BoxRec box; RegionPtr cclip; cclip = cfbGetCompositeClip(pGC); for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miFillArcEmpty(arc)) continue; if (miCanFillArc(arc)) { box.x1 = arc->x + pDraw->x; box.y1 = arc->y + pDraw->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)arc->width + 1; box.x2 = x2; y2 = box.y1 + (int)arc->height + 1; box.y2 = y2; if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) { if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) RROP_NAME(cfbFillEllipseSolid)(pDraw, pGC, arc); else RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc); continue; } } miPolyFillArc(pDraw, pGC, 1, arc); } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/stip68kgnu.h0100664000076400007640000000776307120677563021655 0ustar constconst/* * $XConsortium: stip68kgnu.h,v 1.3 94/04/17 20:29:08 dpw Exp $ * $XFree86: xc/programs/Xserver/cfb/stip68kgnu.h,v 3.0.4.1 1997/05/11 05:04:17 dawes Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * Stipple stack macro for 68k GCC */ #define STIPPLE(addr,stipple,value,width,count,shift) \ __asm volatile ( \ "lea 5f,%/a1\n\ moveq #28,%/d2\n\ addl %2,%/d2\n\ moveq #28,%/d3\n\ subql #4,%2\n\ negl %2\n\ 1:\n\ movel %0,%/a0\n\ addl %6,%0\n\ movel %3@+,%/d1\n\ jeq 3f\n\ movel %/d1,%/d0\n\ lsrl %/d2,%/d0\n\ lsll #5,%/d0\n\ lsll %2,%/d1\n\ jmp %/a1@(%/d0:l)\n\ 2:\n\ addl #4,%/a0\n\ movel %/d1,%/d0\n\ lsrl %/d3,%/d0\n\ lsll #5,%/d0\n\ lsll #4,%/d1\n\ jmp %/a1@(%/d0:l)\n\ 5:\n\ jne 2b ; dbra %1,1b ; jra 4f\n\ . = 5b + 0x20\n\ moveb %5,%/a0@(3)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ . = 5b + 0x40\n\ moveb %5,%/a0@(2)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ . = 5b + 0x60\n\ movew %5,%/a0@(2)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ . = 5b + 0x80\n\ moveb %5,%/a0@(1)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0xa0\n\ moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0xc0\n\ movew %5,%/a0@(1)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0xe0\n\ movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x100\n\ moveb %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x120\n\ moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x140\n\ moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x160\n\ movew %5,%/a0@(2) ; moveb %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x180\n\ movew %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x1a0\n\ moveb %5,%/a0@(3) ; movew %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x1c0\n\ moveb %5,%/a0@(2) ; movew %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ . = 5b + 0x1e0\n\ movel %5,%/a0@\n\ andl %/d1,%/d1 ; jne 2b ; \n\ 3: dbra %1,1b ; \n\ 4:\n"\ : "=a" (addr), /* %0 */ \ "=d" (count), /* %1 */ \ "=d" (shift), /* %2 */ \ "=a" (stipple) /* %3 */ \ : "0" (addr), /* %4 */ \ "d" (value), /* %5 */ \ "a" (width), /* %6 */ \ "1" (count-1), /* %7 */ \ "2" (shift), /* %8 */ \ "3" (stipple) /* %9 */ \ : /* ctemp */ "d0", \ /* c */ "d1", \ /* lshift */ "d2", \ /* rshift */ "d3", \ /* atemp */ "a0", \ /* case */ "a1") vnc_unixsrc/Xvnc/programs/Xserver/cfb/stipple68k.s0100664000076400007640000001077607120677563021655 0ustar constconst/* * $XConsortium: stipple68k.s,v 1.3 94/04/17 20:29:09 keith Exp $ * $XFree86: xc/programs/Xserver/cfb/stipple68k.s,v 3.0 1996/08/13 11:27:37 dawes Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * Stipple code for 68k processors */ #ifdef __ELF__ #ifdef TETEXT #define _cfbStippleStack cfbStippleStackTE #else #define _cfbStippleStack cfbStippleStack #endif #else #ifdef TETEXT #define _cfbStippleStack _cfbStippleStackTE #endif #endif #define atemp a0 #define addr a1 #define stipple a2 #define stride a3 #define case a4 #define ctemp d0 #define value d1 #define count d2 #define shift d3 #define c d4 #define lshift d5 #define rshift d6 #define PushMask #0x3e38 #define PopMask #0x1c7c #define NumReg 8 #define arg0 36 #define arg1 40 #define arg2 44 #define arg3 48 #define arg4 52 #define arg5 56 #define arg6 60 #ifdef __ELF__ #define ForEachLine .L2 #define ForEachBits .L5 #define a0 %A0 #define a1 %A1 #define a2 %A2 #define a3 %A3 #define a4 %A4 #define a5 %A5 #define a6 %A6 #define sp %SP #define d0 %D0 #define d1 %D1 #define d2 %D2 #define d3 %D3 #define d4 %D4 #define d5 %D5 #define d6 %D6 #define d7 %D7 #else #define ForEachLine L2 #define ForEachBits L5 #endif #define CASE_SIZE 5 .text .even .globl _cfbStippleStack _cfbStippleStack: moveml PushMask,sp@- movel sp@(arg0),addr movel sp@(arg1),stipple movel sp@(arg2),value movel sp@(arg3),stride movew sp@(arg4+2),count movel sp@(arg5),shift subqw #1,count /* predecrement count */ lea CaseBegin,case movew #28,lshift addl shift,lshift movew #28,rshift subql #4,shift negl shift ForEachLine: movel addr,atemp addl stride,addr movel stipple@+,c #ifdef TETEXT jeq NextLine #endif /* Get first few bits */ movel c,ctemp lsrl lshift,ctemp lsll #CASE_SIZE,ctemp lsll shift,c /* set up for next bits */ jmp case@(ctemp:l) ForEachBits: addl #4,atemp movel c,ctemp lsrl rshift,ctemp /* better than lsrl, andi */ lsll #CASE_SIZE,ctemp lsll #4,c /* set up for next bits */ jmp case@(ctemp:l) #define Break \ andl c,c ; \ jne ForEachBits ; \ dbra count,ForEachLine ; \ moveml sp@+,PopMask ; \ rts ; CaseBegin: jne ForEachBits /* 0 */ NextLine: dbra count,ForEachLine moveml sp@+,PopMask rts . = CaseBegin + 0x20 moveb value,atemp@(3) /* 1 */ Break . = CaseBegin + 0x40 moveb value,atemp@(2) /* 2 */ Break . = CaseBegin + 0x60 movew value,atemp@(2) /* 3 */ Break . = CaseBegin + 0x80 moveb value,atemp@(1) /* 4 */ Break . = CaseBegin + 0xa0 moveb value,atemp@(3) /* 5 */ moveb value,atemp@(1) Break . = CaseBegin + 0xc0 movew value,atemp@(1) /* 6 */ Break . = CaseBegin + 0xe0 movew value,atemp@(2) /* 7 */ moveb value,atemp@(1) Break . = CaseBegin + 0x100 moveb value,atemp@ /* 8 */ Break . = CaseBegin + 0x120 moveb value,atemp@(3) /* 9 */ moveb value,atemp@ Break . = CaseBegin + 0x140 moveb value,atemp@(2) /* a */ moveb value,atemp@ Break . = CaseBegin + 0x160 movew value,atemp@(2) /* b */ moveb value,atemp@ Break . = CaseBegin + 0x180 movew value,atemp@ /* c */ Break . = CaseBegin + 0x1a0 moveb value,atemp@(3) /* d */ movew value,atemp@ Break . = CaseBegin + 0x1c0 moveb value,atemp@(2) /* e */ movew value,atemp@ Break . = CaseBegin + 0x1e0 movel value,atemp@ /* f */ Break vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbcmap.c0100664000076400007640000003714607202745564021215 0ustar constconst/* $XConsortium: cfbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbcmap.c,v 3.1.8.2 1997/05/11 05:04:17 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ #include "X.h" #include "Xproto.h" #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" #ifdef GLXEXT #ifdef GLX_MODULE Bool (*GlxInitVisualsPtr)( #else extern Bool GlxInitVisuals( #endif #if NeedFunctionPrototypes VisualPtr * /*visualp*/, DepthPtr * /*depthp*/, int * /*nvisualp*/, int * /*ndepthp*/, int * /*rootDepthp*/, VisualID * /*defaultVisp*/, unsigned long /*sizes*/, int /*bitsPerRGB*/ #endif #ifdef GLX_MODULE ) = NULL; #else ); #endif #endif #ifdef STATIC_COLOR static ColormapPtr InstalledMaps[MAXSCREENS]; int cfbListInstalledColormaps(pScreen, pmaps) ScreenPtr pScreen; Colormap *pmaps; { /* By the time we are processing requests, we can guarantee that there * is always a colormap installed */ *pmaps = InstalledMaps[pScreen->myNum]->mid; return (1); } void cfbInstallColormap(pmap) ColormapPtr pmap; { int index = pmap->pScreen->myNum; ColormapPtr oldpmap = InstalledMaps[index]; if(pmap != oldpmap) { /* Uninstall pInstalledMap. No hardware changes required, just * notify all interested parties. */ if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); /* Install pmap */ InstalledMaps[index] = pmap; WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); } } void cfbUninstallColormap(pmap) ColormapPtr pmap; { int index = pmap->pScreen->myNum; ColormapPtr curpmap = InstalledMaps[index]; if(pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, RT_COLORMAP); (*pmap->pScreen->InstallColormap)(curpmap); } } } #endif void cfbResolveColor(pred, pgreen, pblue, pVisual) unsigned short *pred, *pgreen, *pblue; register VisualPtr pVisual; { int shift = 16 - pVisual->bitsPerRGBValue; unsigned lim = (1 << pVisual->bitsPerRGBValue) - 1; if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor)) { /* rescale to rgb bits */ *pred = ((*pred >> shift) * 65535) / lim; *pgreen = ((*pgreen >> shift) * 65535) / lim; *pblue = ((*pblue >> shift) * 65535) / lim; } else if (pVisual->class == GrayScale) { /* rescale to gray then rgb bits */ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; } else if (pVisual->class == StaticGray) { unsigned limg = pVisual->ColormapEntries - 1; /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ *pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100; *pred = ((((*pred * (limg + 1))) >> 16) * 65535) / limg; *pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim; } else { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; /* rescale to [0..limN] then [0..65535] then rgb bits */ *pred = ((((((*pred * (limr + 1)) >> 16) * 65535) / limr) >> shift) * 65535) / lim; *pgreen = ((((((*pgreen * (limg + 1)) >> 16) * 65535) / limg) >> shift) * 65535) / lim; *pblue = ((((((*pblue * (limb + 1)) >> 16) * 65535) / limb) >> shift) * 65535) / lim; } } Bool cfbInitializeColormap(pmap) register ColormapPtr pmap; { register unsigned i; register VisualPtr pVisual; unsigned lim, maxent, shift; pVisual = pmap->pVisual; lim = (1 << pVisual->bitsPerRGBValue) - 1; shift = 16 - pVisual->bitsPerRGBValue; maxent = pVisual->ColormapEntries - 1; if (pVisual->class == TrueColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / limr) >> shift) * 65535) / lim; pmap->green[i].co.local.green = ((((i * 65535) / limg) >> shift) * 65535) / lim; pmap->blue[i].co.local.blue = ((((i * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticColor) { unsigned limr, limg, limb; limr = pVisual->redMask >> pVisual->offsetRed; limg = pVisual->greenMask >> pVisual->offsetGreen; limb = pVisual->blueMask >> pVisual->offsetBlue; for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((((i & pVisual->redMask) >> pVisual->offsetRed) * 65535) / limr) >> shift) * 65535) / lim; pmap->red[i].co.local.green = ((((((i & pVisual->greenMask) >> pVisual->offsetGreen) * 65535) / limg) >> shift) * 65535) / lim; pmap->red[i].co.local.blue = ((((((i & pVisual->blueMask) >> pVisual->offsetBlue) * 65535) / limb) >> shift) * 65535) / lim; } } else if (pVisual->class == StaticGray) { for(i = 0; i <= maxent; i++) { /* rescale to [0..65535] then rgb bits */ pmap->red[i].co.local.red = ((((i * 65535) / maxent) >> shift) * 65535) / lim; pmap->red[i].co.local.green = pmap->red[i].co.local.red; pmap->red[i].co.local.blue = pmap->red[i].co.local.red; } } return TRUE; } /* When simulating DirectColor on PseudoColor hardware, multiple entries of the colormap must be updated */ #define AddElement(mask) { \ pixel = red | green | blue; \ for (i = 0; i < nresult; i++) \ if (outdefs[i].pixel == pixel) \ break; \ if (i == nresult) \ { \ nresult++; \ outdefs[i].pixel = pixel; \ outdefs[i].flags = 0; \ } \ outdefs[i].flags |= (mask); \ outdefs[i].red = pmap->red[red >> pVisual->offsetRed].co.local.red; \ outdefs[i].green = pmap->green[green >> pVisual->offsetGreen].co.local.green; \ outdefs[i].blue = pmap->blue[blue >> pVisual->offsetBlue].co.local.blue; \ } cfbExpandDirectColors (pmap, ndef, indefs, outdefs) ColormapPtr pmap; int ndef; xColorItem *indefs, *outdefs; { int minred, mingreen, minblue; register int red, green, blue; int maxred, maxgreen, maxblue; int stepred, stepgreen, stepblue; VisualPtr pVisual; register int pixel; register int nresult; register int i; pVisual = pmap->pVisual; stepred = 1 << pVisual->offsetRed; stepgreen = 1 << pVisual->offsetGreen; stepblue = 1 << pVisual->offsetBlue; maxred = pVisual->redMask; maxgreen = pVisual->greenMask; maxblue = pVisual->blueMask; nresult = 0; for (;ndef--; indefs++) { if (indefs->flags & DoRed) { red = indefs->pixel & pVisual->redMask; for (green = 0; green <= maxgreen; green += stepgreen) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoRed) } } } if (indefs->flags & DoGreen) { green = indefs->pixel & pVisual->greenMask; for (red = 0; red <= maxred; red += stepred) { for (blue = 0; blue <= maxblue; blue += stepblue) { AddElement (DoGreen) } } } if (indefs->flags & DoBlue) { blue = indefs->pixel & pVisual->blueMask; for (red = 0; red <= maxred; red += stepred) { for (green = 0; green <= maxgreen; green += stepgreen) { AddElement (DoBlue) } } } } return nresult; } Bool cfbCreateDefColormap(pScreen) ScreenPtr pScreen; { unsigned short zero = 0, ones = 0xFFFF; VisualPtr pVisual; ColormapPtr cmap; Pixel wp, bp; for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, (pVisual->class & DynamicClass) ? AllocNone : AllocAll, 0) != Success) return FALSE; wp = pScreen->whitePixel; bp = pScreen->blackPixel; if ((AllocColor(cmap, &ones, &ones, &ones, &wp, 0) != Success) || (AllocColor(cmap, &zero, &zero, &zero, &bp, 0) != Success)) return FALSE; pScreen->whitePixel = wp; pScreen->blackPixel = bp; (*pScreen->InstallColormap)(cmap); return TRUE; } extern int defaultColorVisualClass; #define _BZ(d) (d / 3) #define _BS(d) 0 #define _BM(d) ((1 << _BZ(d)) - 1) #define _GZ(d) ((d - _BZ(d) + 1) / 2) #define _GS(d) _BZ(d) #define _GM(d) (((1 << _GZ(d)) - 1) << _GS(d)) #define _RZ(d) (d - _BZ(d) - _GZ(d)) #define _RS(d) (_BZ(d) + _GZ(d)) #define _RM(d) (((1 << _RZ(d)) - 1) << _RS(d)) #define _CE(d) (1 << _GZ(d)) #define MAX_PSEUDO_DEPTH 10 /* largest DAC size I know */ #define StaticGrayMask (1 << StaticGray) #define GrayScaleMask (1 << GrayScale) #define StaticColorMask (1 << StaticColor) #define PseudoColorMask (1 << PseudoColor) #define TrueColorMask (1 << TrueColor) #define DirectColorMask (1 << DirectColor) #define ALL_VISUALS (StaticGrayMask|\ GrayScaleMask|\ StaticColorMask|\ PseudoColorMask|\ TrueColorMask|\ DirectColorMask) #define LARGE_VISUALS (TrueColorMask|\ DirectColorMask) typedef struct _cfbVisuals { struct _cfbVisuals *next; int depth; int bitsPerRGB; int visuals; int count; } cfbVisualsRec, *cfbVisualsPtr; static int cfbVisualPriority[] = { PseudoColor, DirectColor, GrayScale, StaticColor, TrueColor, StaticGray }; #define NUM_PRIORITY 6 static cfbVisualsPtr cfbVisuals; Bool cfbSetVisualTypes (depth, visuals, bitsPerRGB) int depth; int visuals; { cfbVisualsPtr new, *prev, v; int count; new = (cfbVisualsPtr) xalloc (sizeof *new); if (!new) return FALSE; new->next = 0; new->depth = depth; new->visuals = visuals; new->bitsPerRGB = bitsPerRGB; count = (visuals >> 1) & 033333333333; count = visuals - count - ((count >> 1) & 033333333333); count = (((count + (count >> 3)) & 030707070707) % 077); /* HAKMEM 169 */ new->count = count; for (prev = &cfbVisuals; v = *prev; prev = &v->next); *prev = new; return TRUE; } /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which coorespond to * the set which can be used with this version of cfb. */ Bool cfbInitVisuals (visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB) VisualPtr *visualp; DepthPtr *depthp; int *nvisualp, *ndepthp; int *rootDepthp; VisualID *defaultVisp; unsigned long sizes; int bitsPerRGB; { int i, j, k; VisualPtr visual; DepthPtr depth; VisualID *vid; int d, b; int f; int ndepth, nvisual; int nvtype; int vtype; VisualID defaultVisual; cfbVisualsPtr visuals, nextVisuals; /* none specified, we'll guess from pixmap formats */ if (!cfbVisuals) { for (f = 0; f < screenInfo.numPixmapFormats; f++) { d = screenInfo.formats[f].depth; b = screenInfo.formats[f].bitsPerPixel; if (sizes & (1 << (b - 1))) { if (d > MAX_PSEUDO_DEPTH) vtype = LARGE_VISUALS; else if (d == 1) vtype = StaticGrayMask; else vtype = ALL_VISUALS; } else vtype = 0; if (!cfbSetVisualTypes (d, vtype, bitsPerRGB)) return FALSE; } } nvisual = 0; ndepth = 0; for (visuals = cfbVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; ndepth++; nvisual += visuals->count; } depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec)); visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec)); if (!depth || !visual) { xfree (depth); xfree (visual); return FALSE; } *depthp = depth; *visualp = visual; *ndepthp = ndepth; *nvisualp = nvisual; for (visuals = cfbVisuals; visuals; visuals = nextVisuals) { nextVisuals = visuals->next; d = visuals->depth; vtype = visuals->visuals; nvtype = visuals->count; vid = NULL; if (nvtype) { vid = (VisualID *) xalloc (nvtype * sizeof (VisualID)); if (!vid) return FALSE; } depth->depth = d; depth->numVids = nvtype; depth->vids = vid; depth++; for (i = 0; i < NUM_PRIORITY; i++) { if (! (vtype & (1 << cfbVisualPriority[i]))) continue; visual->class = cfbVisualPriority[i]; visual->bitsPerRGBValue = visuals->bitsPerRGB; visual->ColormapEntries = 1 << d; visual->nplanes = d; visual->vid = *vid = FakeClientID (0); switch (visual->class) { case PseudoColor: case GrayScale: case StaticGray: visual->redMask = 0; visual->greenMask = 0; visual->blueMask = 0; visual->offsetRed = 0; visual->offsetGreen = 0; visual->offsetBlue = 0; break; case DirectColor: case TrueColor: visual->ColormapEntries = _CE(d); /* fall through */ case StaticColor: if (d == 8) { visual->redMask = 0x07; visual->greenMask = 0x38; visual->blueMask = 0xC0; visual->offsetRed = 0; visual->offsetGreen = 3; visual->offsetBlue = 6; } else { visual->redMask = _RM(d); visual->greenMask = _GM(d); visual->blueMask = _BM(d); visual->offsetRed = _RS(d); visual->offsetGreen = _GS(d); visual->offsetBlue = _BS(d); } } vid++; visual++; } xfree (visuals); } cfbVisuals = NULL; visual = *visualp; depth = *depthp; for (i = 0; i < ndepth; i++) { if (*rootDepthp && *rootDepthp != depth[i].depth) continue; for (j = 0; j < depth[i].numVids; j++) { for (k = 0; k < nvisual; k++) if (visual[k].vid == depth[i].vids[j]) break; if (k == nvisual) continue; if (defaultColorVisualClass < 0 || visual[k].class == defaultColorVisualClass) break; } if (j != depth[i].numVids) break; } if (i == ndepth) { i = 0; j = 0; } *rootDepthp = depth[i].depth; *defaultVisp = depth[i].vids[j]; #ifdef GLXEXT #ifdef GLX_MODULE if( GlxInitVisualsPtr != NULL ) return (*GlxInitVisualsPtr) #else return GlxInitVisuals #endif ( visualp, depthp, nvisualp, ndepthp, rootDepthp, defaultVisp, sizes, bitsPerRGB ); #else return TRUE; #endif } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbtegblt.c0100664000076400007640000001625007120677563021551 0ustar constconst/* $XConsortium: cfbtegblt.c,v 5.9 94/04/17 20:29:03 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbtegblt.c,v 3.0 1996/06/29 09:05:52 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfbmskbits.h" #include "mi.h" #define MFB_CONSTS_ONLY #include "maskbits.h" /* this works for fonts with glyphs <= 32 bits wide, on an arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays. This should be called only with a terminal-emulator font; this means that the FIXED_METRICS flag is set, and that glyphbounds == charbounds. in theory, this goes faster; even if it doesn't, it reduces the flicker caused by writing a string over itself with image text (since the background gets repainted per character instead of per string.) this seems to be important for some converted X10 applications. Image text looks at the bits in the glyph and the fg and bg in the GC. it paints a rectangle, as defined in the protocol dcoument, and the paints the characters. */ void cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { FontPtr pfont = pGC->font; int widthDst; unsigned long *pdstBase; /* pointer to longword with top row of current glyph */ int w; /* width of glyph and char */ int h; /* height of glyph and char */ register int xpos=x; /* current x%32 */ int ypos=y; /* current y%32 */ register unsigned char *pglyph; int widthGlyph; register unsigned long *pdst;/* pointer to current longword in dst */ int hTmp; /* counter for height */ BoxRec bbox; /* for clipping */ register int wtmp,xtemp,width; unsigned long bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp; int tmpx; #if PSZ == 24 int xIndex; #endif xpos += pDrawable->x; ypos += pDrawable->y; cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) wtmp = FONTMAXBOUNDS(pfont,characterWidth); h = FONTASCENT(pfont) + FONTDESCENT(pfont); widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci); xpos += FONTMAXBOUNDS(pfont,leftSideBearing); ypos -= FONTASCENT(pfont); bbox.x1 = xpos; bbox.x2 = xpos + (wtmp * nglyph); bbox.y1 = ypos; bbox.y2 = ypos + h; fgfill = PFILL(pGC->fgPixel); bgfill = PFILL(pGC->bgPixel); switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox)) { case rgnOUT: break; case rgnPART: /* this is the WRONG thing to do, but it works. calling the non-terminal text is easy, but slow, given what we know about the font. the right thing to do is something like: for each clip rectangle compute at which row the glyph starts to be in it, and at which row the glyph ceases to be in it compute which is the first glyph inside the left edge, and the last one inside the right edge draw a fractional first glyph, using only the rows we know are in draw all the whole glyphs, using the appropriate rows draw any pieces of the last glyph, using the right rows this way, the code would take advantage of knowing that all glyphs are the same height and don't overlap. one day... */ miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); break; case rgnIN: pdtmp = pdstBase + (widthDst * ypos); while(nglyph--) { pglyph = FONTGLYPHBITS(pglyphBase, *ppci++); pdst = pdtmp; hTmp = h; while (hTmp--) { x = xpos; width = wtmp; xtemp = 0; while (width > 0) { #if PSZ == 24 tmpx = x & 3; w = 1; #else tmpx = x & PIM; w = min(width, PPW - tmpx); w = min(w, (PGSZ - xtemp)); #endif #if PSZ == 24 ptemp = (unsigned long *)(pglyph + ((xtemp *3)>> 2)); #else ptemp = (unsigned long *)(pglyph + (xtemp >> MFB_PWSH)); #endif #if PSZ == 24 getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp); getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp); #else getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1); getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2); #endif { unsigned long tmpDst = tmpDst1 | tmpDst2; #if PSZ == 24 unsigned long *pdsttmp = pdst + ((x*3) >> 2); putbits24(tmpDst,tmpx,w,pdsttmp,pGC->planemask,x); #else unsigned long *pdsttmp = pdst + (x >> PWSH); putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask); #endif } x += w; xtemp += w; width -= w; } pglyph += widthGlyph; pdst += widthDst; } xpos += wtmp; } break; } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbblt.c0100664000076400007640000003765707120677563021067 0ustar constconst/* * cfb copy area */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Keith Packard */ /* $XConsortium: cfbblt.c,v 1.13 94/04/17 20:28:44 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbblt.c,v 3.1 1996/12/09 11:50:52 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #include "fastblt.h" #include "mergerop.h" #ifdef notdef /* XXX fails right now, walks off end of pixmaps */ #if defined (FAST_UNALIGNED_READS) && PSZ == 8 #define DO_UNALIGNED_BITBLT #endif #endif #if defined(FAST_MEMCPY) && (MROP == Mcopy) && PSZ == 8 #define DO_MEMCPY #endif void MROP_NAME(cfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask) DrawablePtr pSrc, pDst; int alu; RegionPtr prgnDst; DDXPointPtr pptSrc; unsigned long planemask; { unsigned long *psrcBase, *pdstBase; /* start of src and dst bitmaps */ int widthSrc, widthDst; /* add to get to same position in next line */ BoxPtr pbox; int nbox; BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; /* temporaries for shuffling rectangles */ DDXPointPtr pptTmp, pptNew1, pptNew2; /* shuffling boxes entails shuffling the source points too */ int w, h; int xdir; /* 1 = left right, -1 = right left/ */ int ydir; /* 1 = top down, -1 = bottom up */ unsigned long *psrcLine, *pdstLine; /* pointers to line with current src and dst */ register unsigned long *psrc;/* pointer to current src longword */ register unsigned long *pdst;/* pointer to current dst longword */ MROP_DECLARE_REG() /* following used for looping through a line */ unsigned long startmask, endmask; /* masks for writing ends of dst */ int nlMiddle; /* whole longwords in dst */ int xoffSrc, xoffDst; register int leftShift, rightShift; register unsigned long bits; register unsigned long bits1; register int nl; /* temp copy of nlMiddle */ /* place to store full source word */ int nstart; /* number of ragged bits at start of dst */ int nend; /* number of ragged bits at end of dst */ int srcStartOver; /* pulling nstart bits from src overflows into the next word? */ int careful; int tmpSrc; #if PSZ == 24 #ifdef DO_MEMCPY int w2; #endif #endif MROP_INITIALIZE(alu,planemask); cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase) cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase) /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. */ careful = ((pSrc == pDst) || ((pSrc->type == DRAWABLE_WINDOW) && (pDst->type == DRAWABLE_WINDOW))); pbox = REGION_RECTS(prgnDst); nbox = REGION_NUM_RECTS(prgnDst); pboxNew1 = NULL; pptNew1 = NULL; pboxNew2 = NULL; pptNew2 = NULL; if (careful && (pptSrc->y < pbox->y1)) { /* walk source botttom to top */ ydir = -1; widthSrc = -widthSrc; widthDst = -widthDst; if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); if(!pboxNew1) return; pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if(!pptNew1) { DEALLOCATE_LOCAL(pboxNew1); return; } pboxBase = pboxNext = pbox+nbox-1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; pboxTmp = pboxNext+1; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; *pptNew1++ = *pptTmp++; } pboxBase = pboxNext; } pboxNew1 -= nbox; pbox = pboxNew1; pptNew1 -= nbox; pptSrc = pptNew1; } } else { /* walk source top to bottom */ ydir = 1; } if (careful && (pptSrc->x < pbox->x1)) { /* walk source right to left */ xdir = -1; if (nbox > 1) { /* reverse order of rects in each band */ pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if(!pboxNew2 || !pptNew2) { if (pptNew2) DEALLOCATE_LOCAL(pptNew2); if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); } return; } pboxBase = pboxNext = pbox; while (pboxBase < pbox+nbox) { while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp != pboxBase) { *pboxNew2++ = *--pboxTmp; *pptNew2++ = *--pptTmp; } pboxBase = pboxNext; } pboxNew2 -= nbox; pbox = pboxNew2; pptNew2 -= nbox; pptSrc = pptNew2; } } else { /* walk source left to right */ xdir = 1; } while(nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; #if PSZ == 24 #ifdef DO_MEMCPY w2 = w * 3; #endif #endif if (ydir == -1) /* start at last scanline of rectangle */ { psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc); pdstLine = pdstBase + ((pbox->y2-1) * -widthDst); } else /* start at first scanline */ { psrcLine = psrcBase + (pptSrc->y * widthSrc); pdstLine = pdstBase + (pbox->y1 * widthDst); } #if PSZ == 24 if (w == 1 && ((pbox->x1 & 3) == 0 || (pbox->x1 & 3) == 3)) #else if ((pbox->x1 & PIM) + w <= PPW) #endif { maskpartialbits (pbox->x1, w, endmask); startmask = 0; nlMiddle = 0; } else { maskbits(pbox->x1, w, startmask, endmask, nlMiddle); } #ifdef DO_MEMCPY /* If the src and dst scanline don't overlap, do forward case. */ if ((xdir == 1) || (pptSrc->y != pbox->y1) || (pptSrc->x + w <= pbox->x1)) { #if PSZ == 24 char *psrc = (char *) psrcLine + (pptSrc->x * 3); char *pdst = (char *) pdstLine + (pbox->x1 * 3); #else char *psrc = (char *) psrcLine + pptSrc->x; char *pdst = (char *) pdstLine + pbox->x1; #endif while (h--) { #if PSZ == 24 memcpy(pdst, psrc, w2); #else memcpy(pdst, psrc, w); #endif pdst += widthDst << PWSH; psrc += widthSrc << PWSH; } } #else /* ! DO_MEMCPY */ if (xdir == 1) { #if PSZ == 24 xoffSrc = (4 - pptSrc->x) & 3; xoffDst = (4 - pbox->x1) & 3; pdstLine += (pbox->x1 * 3) >> 2; psrcLine += (pptSrc->x * 3) >> 2; #else xoffSrc = pptSrc->x & PIM; xoffDst = pbox->x1 & PIM; pdstLine += (pbox->x1 >> PWSH); psrcLine += (pptSrc->x >> PWSH); #endif #ifdef DO_UNALIGNED_BITBLT nl = xoffSrc - xoffDst; psrcLine = (unsigned long *) (((unsigned char *) psrcLine) + nl); #else if (xoffSrc == xoffDst) #endif { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (startmask) { *pdst = MROP_MASK(*psrc, *pdst, startmask); psrc++; pdst++; } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else #ifdef NOTDEF /* you'd think this would be faster -- * a single instruction instead of 6 * but measurements show it to be ~15% slower */ while ((nl -= 6) >= 0) { asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0" : "=m" (*(char *)pdst) : "m" (*(char *)psrc) : "d0", "d1", "d2", "d3", "a2", "a3"); pdst += 6; } nl += 6; while (nl--) *pdst++ = *psrc++; #endif DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;) #endif if (endmask) *pdst = MROP_MASK(*psrc, *pdst, endmask); } } #ifndef DO_UNALIGNED_BITBLT else { if (xoffSrc > xoffDst) { #if PSZ == 24 leftShift = (xoffSrc - xoffDst) << 3; #else #if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH); #else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH); #endif /* PGSZ */ #endif rightShift = PGSZ - leftShift; } else { #if PSZ == 24 rightShift = (xoffDst - xoffSrc) << 3; #else #if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH); #else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH); #endif /* PGSZ */ #endif leftShift = PGSZ - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; if (xoffSrc > xoffDst) bits = *psrc++; if (startmask) { bits1 = BitLeft(bits,leftShift); bits = *psrc++; bits1 |= BitRight(bits,rightShift); *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) \ bits = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); #define BodyEven(n) \ bits1 = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) \ bits = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ pdst++; #define BodyEven(n) \ bits1 = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ pdst++; #define LoopReset ; #endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; ) #endif if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } } } #endif /* DO_UNALIGNED_BITBLT */ } #endif /* ! DO_MEMCPY */ else /* xdir == -1 */ { #if PSZ == 24 xoffSrc = (pptSrc->x + w) & 3; xoffDst = pbox->x2 & 3; pdstLine += ((pbox->x2 * 3 - 1) >> 2) + 1; psrcLine += (((pptSrc->x+w) * 3 - 1) >> 2) + 1; #else xoffSrc = (pptSrc->x + w - 1) & PIM; xoffDst = (pbox->x2 - 1) & PIM; pdstLine += ((pbox->x2-1) >> PWSH) + 1; psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; #endif #ifdef DO_UNALIGNED_BITBLT #if PSZ == 24 nl = xoffDst - xoffSrc; #else nl = xoffSrc - xoffDst; #endif psrcLine = (unsigned long *) (((unsigned char *) psrcLine) + nl); #else if (xoffSrc == xoffDst) #endif { while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; if (endmask) { pdst--; psrc--; *pdst = MROP_MASK (*psrc, *pdst, endmask); } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1); #define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]); #define BodyEven(n) BodyOdd(n) #define LoopReset \ pdst -= UNROLL;\ psrc -= UNROLL; #else #define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst); #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL(nl,label3, --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);) #endif if (startmask) { --pdst; --psrc; *pdst = MROP_MASK(*psrc, *pdst, startmask); } } } #ifndef DO_UNALIGNED_BITBLT else { if (xoffDst > xoffSrc) { #if PSZ == 24 leftShift = (xoffDst - xoffSrc) << 3; rightShift = PGSZ - leftShift; #else #if PGSZ == 32 rightShift = (xoffDst - xoffSrc) << (5 - PWSH); #else /* PGSZ == 64 */ rightShift = (xoffDst - xoffSrc) << (6 - PWSH); #endif /* PGSZ */ leftShift = PGSZ - rightShift; #endif } else { #if PSZ == 24 rightShift = (xoffSrc - xoffDst) << 3; leftShift = PGSZ - rightShift; #else #if PGSZ == 32 leftShift = (xoffSrc - xoffDst) << (5 - PWSH); #else /* PGSZ == 64 */ leftShift = (xoffSrc - xoffDst) << (6 - PWSH); #endif /* PGSZ */ rightShift = PGSZ - leftShift; #endif } while (h--) { psrc = psrcLine; pdst = pdstLine; pdstLine += widthDst; psrcLine += widthSrc; bits = 0; #if PSZ == 24 if (xoffSrc > xoffDst) #else if (xoffDst > xoffSrc) #endif bits = *--psrc; if (endmask) { bits1 = BitRight(bits, rightShift); bits = *--psrc; bits1 |= BitLeft(bits, leftShift); pdst--; *pdst = MROP_MASK(bits1, *pdst, endmask); } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1); #define BodyOdd(n) \ bits = psrc[n-1]; \ pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]); #define BodyEven(n) \ bits1 = psrc[n-1]; \ pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]); #define LoopReset \ pdst -= UNROLL; \ psrc -= UNROLL; #else #define BodyOdd(n) \ bits = *--psrc; --pdst; \ *pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst); #define BodyEven(n) \ bits1 = *--psrc; --pdst; \ *pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst); #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl, label4, bits1 = BitRight(bits, rightShift); bits = *--psrc; --pdst; *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst); ) #endif if (startmask) { bits1 = BitRight(bits, rightShift); if (BitRight (startmask, leftShift)) { bits = *--psrc; bits1 |= BitLeft(bits, leftShift); } --pdst; *pdst = MROP_MASK(bits1, *pdst, startmask); } } } #endif } pbox++; pptSrc++; } if (pboxNew2) { DEALLOCATE_LOCAL(pptNew2); DEALLOCATE_LOCAL(pboxNew2); } if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbrrop.c0100664000076400007640000001366307120677563021257 0ustar constconst/* * $XConsortium: cfbrrop.c,v 1.8 94/04/17 20:28:59 dpw Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* cfb reduced rasterop computations */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "cfbmskbits.h" /* A description: * * There are four possible operations on each bit in the destination word, * * 1 2 3 4 * * 0 0 0 1 1 * 1 0 1 0 1 * * On examination of the reduced rop equation (dst = (dst & and) ^ xor), * these four fall to reduced rops as follows: * * and 0 1 1 0 * xor 0 0 1 1 * * or, (if 'and' is expensive) (dst = (dst | or) ^ xor) * * or 1 0 0 1 * xor 1 0 1 0 * * The trouble with using this later equation is that trivial * rasterop reduction is more difficult; some common rasterops * use complicated expressions of xor/and instead of the simple * ones while other common rasterops are not made any simpler: * * GXcopy: *dst = ~xor instead of *dst = xor * GXand: *dst = *dst & ~or instead of *dst = *dst & and * GXor: *dst = *dst | or instead of *dst = *dst | xor * GXxor: *dst = *dst ^ xor instead of *dst = *dst ^ xor * * If you're really set on using this second mechanism, the changes * are pretty simple. * * All that remains is to provide a mechanism for computing and/xor values * based on the raster op and foreground value. * * The 16 rops fall as follows, with the associated reduced * rop and/xor and or/xor values. The values in parenthesis following the * reduced values gives an equation using the source value for * the reduced value, and is one of {0, src, ~src, 1} as appropriate. * * clear and andReverse copy * src 0 1 0 1 0 1 0 1 * dst 0 0 0 0 0 0 0 0 1 0 0 1 * 1 0 0 1 0 1 1 0 0 1 0 1 * * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0) * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src) * * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1) * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src) * * andInverted noop xor or * src 0 1 0 1 0 1 0 1 * dst 0 0 0 0 0 0 0 0 1 0 0 1 * 1 1 0 1 1 1 1 1 0 1 1 1 * * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src) * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src) * * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src) * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0) * * nor equiv invert orReverse * src 0 1 0 1 0 1 0 1 * dst 0 1 0 0 1 0 0 1 1 0 1 1 * 1 0 0 1 0 1 1 0 0 1 0 1 * * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src) * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1) * * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src) * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src) * * copyInverted orInverted nand set * src 0 1 0 1 0 1 0 1 * dst 0 1 0 0 1 0 0 1 1 0 1 1 * 1 1 0 1 1 1 1 1 0 1 1 1 * * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0) * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1) * * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1) * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0) */ int cfbReduceRasterOp (rop, fg, pm, andp, xorp) int rop; unsigned long fg, pm; unsigned long *andp, *xorp; { unsigned long and, xor; int rrop; fg = PFILL (fg); pm = PFILL (pm); switch (rop) { case GXclear: and = 0; xor = 0; break; case GXand: and = fg; xor = 0; break; case GXandReverse: and = fg; xor = fg; break; case GXcopy: and = 0; xor = fg; break; case GXandInverted: and = ~fg; xor = 0; break; case GXnoop: and = ~0; xor = 0; break; case GXxor: and = ~0; xor = fg; break; case GXor: and = ~fg; xor = fg; break; case GXnor: and = ~fg; xor = ~fg; break; case GXequiv: and = ~0; xor = ~fg; break; case GXinvert: and = ~0; xor = ~0; break; case GXorReverse: and = ~fg; xor = ~0; break; case GXcopyInverted: and = 0; xor = ~fg; break; case GXorInverted: and = fg; xor = ~fg; break; case GXnand: and = fg; xor = ~0; break; case GXset: and = 0; xor = ~0; break; } and |= ~pm; xor &= pm; *andp = and; *xorp = xor; /* check for some special cases to reduce computation */ if (and == 0) rrop = GXcopy; /* nothing checks for GXnoop else if (and == ~0 && xor == 0) rrop = GXnoop; */ else if (and == ~0) rrop = GXxor; else if (xor == 0) rrop = GXand; else if ( (and ^ xor) == ~0) /* fix XBUG 6541 */ rrop = GXor; else rrop = GXset; /* rop not reduced */ return rrop; } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbimage.c0100664000076400007640000001377107120677563021357 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbimage.c,v 1.18 94/04/17 20:28:52 dpw Exp $ */ #include "X.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "cfb.h" #include "cfbmskbits.h" #include "servermd.h" void cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) DrawablePtr pDraw; GCPtr pGC; int depth, x, y, w, h; int leftPad; int format; char *pImage; { int bitsPerPixel; PixmapPtr pPixmap; if ((w == 0) || (h == 0)) return; if (format != XYPixmap) { pPixmap = GetScratchPixmapHeader(pDraw->pScreen, w+leftPad, h, depth, BitsPerPixel(depth), PixmapBytePad(w+leftPad, depth), (pointer)pImage); if (!pPixmap) return; cfbGetGCPrivate(pGC)->fExpose = FALSE; if (format == ZPixmap) (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, w, h, x, y); else (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, w, h, x, y, 1); cfbGetGCPrivate(pGC)->fExpose = TRUE; FreeScratchPixmapHeader(pPixmap); } else { unsigned long oldFg, oldBg; XID gcv[3]; unsigned long oldPlanemask; unsigned long i; long bytesPer; depth = pGC->depth; oldPlanemask = pGC->planemask; oldFg = pGC->fgPixel; oldBg = pGC->bgPixel; gcv[0] = ~0L; gcv[1] = 0; DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0); bytesPer = (long)h * BitmapBytePad(w + leftPad); for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer) { if (i & oldPlanemask) { gcv[0] = i; DoChangeGC(pGC, GCPlaneMask, gcv, 0); ValidateGC(pDraw, pGC); (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad, XYBitmap, pImage); } } gcv[0] = oldPlanemask; gcv[1] = oldFg; gcv[2] = oldBg; DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0); } } void cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planeMask; char *pdstLine; { BoxRec box; DDXPointRec ptSrc; RegionRec rgnDst; ScreenPtr pScreen; PixmapPtr pPixmap; if ((w == 0) || (h == 0)) return; if (pDrawable->bitsPerPixel == 1) { mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); return; } pScreen = pDrawable->pScreen; if (format == ZPixmap) { pPixmap = GetScratchPixmapHeader(pScreen, w, h, pDrawable->depth, pDrawable->bitsPerPixel, PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine); if (!pPixmap) return; if ((planeMask & PMSK) != PMSK) bzero((char *)pdstLine, pPixmap->devKind * h); ptSrc.x = sx + pDrawable->x; ptSrc.y = sy + pDrawable->y; box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; REGION_INIT(pScreen, &rgnDst, &box, 1); cfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc, planeMask); REGION_UNINIT(pScreen, &rgnDst); FreeScratchPixmapHeader(pPixmap); } else { #if PSZ == 8 pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine); if (!pPixmap) return; ptSrc.x = sx + pDrawable->x; ptSrc.y = sy + pDrawable->y; box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; REGION_INIT(pScreen, &rgnDst, &box, 1); cfbCopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc, planeMask); REGION_UNINIT(pScreen, &rgnDst); FreeScratchPixmapHeader(pPixmap); #else miGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); #endif } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfb8cppl.c0100664000076400007640000001311707120677563021315 0ustar constconst/* * $XConsortium: cfb8cppl.c,v 1.15 94/04/17 20:28:41 dpw Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #if PSZ == 8 #include "X.h" #include "Xmd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #undef PSZ /* for maskbits.h */ #include "maskbits.h" #include "mergerop.h" #if BITMAP_BIT_ORDER == MSBFirst #define LeftMost (MFB_PPW-1) #define StepBit(bit, inc) ((bit) -= (inc)) #else #define LeftMost 0 #define StepBit(bit, inc) ((bit) += (inc)) #endif #define GetBits(psrc, nBits, curBit, bitPos, bits) {\ bits = 0; \ while (nBits--) \ { \ bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \ StepBit (curBit, 1); \ } \ } void cfbCopyImagePlane (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask) DrawablePtr pSrcDrawable; DrawablePtr pDstDrawable; int rop; RegionPtr prgnDst; DDXPointPtr pptSrc; unsigned long planemask; { cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, (unsigned long) ~0L, planemask); } void cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane) DrawablePtr pSrcDrawable; DrawablePtr pDstDrawable; int rop; RegionPtr prgnDst; DDXPointPtr pptSrc; unsigned long planemask; unsigned long bitPlane; { int srcx, srcy, dstx, dsty, width, height; unsigned char *psrcBase; PixelType *pdstBase; int widthSrc, widthDst; unsigned char *psrcLine; PixelType *pdstLine; register unsigned char *psrc; register int i; register int curBit; register int bitPos; register unsigned long bits; register PixelType *pdst; PixelType startmask, endmask; int niStart, niEnd; int bitStart, bitEnd; int nl, nlMiddle; int nbox; BoxPtr pbox; MROP_DECLARE() if (!(planemask & 1)) return; if (rop != GXcopy) MROP_INITIALIZE (rop, planemask); cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase) bitPos = ffs (bitPlane) - 1; nbox = REGION_NUM_RECTS(prgnDst); pbox = REGION_RECTS(prgnDst); while (nbox--) { dstx = pbox->x1; dsty = pbox->y1; srcx = pptSrc->x; srcy = pptSrc->y; width = pbox->x2 - pbox->x1; height = pbox->y2 - pbox->y1; pbox++; pptSrc++; psrcLine = psrcBase + srcy * widthSrc + srcx; pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst); dstx &= MFB_PIM; if (dstx + width <= MFB_PPW) { maskpartialbits(dstx, width, startmask); nlMiddle = 0; endmask = 0; } else { maskbits (dstx, width, startmask, endmask, nlMiddle); } if (startmask) { niStart = min(MFB_PPW - dstx, width); bitStart = LeftMost; StepBit (bitStart, dstx); } if (endmask) { niEnd = (dstx + width) & MFB_PIM; bitEnd = LeftMost; } if (rop == GXcopy) { while (height--) { psrc = psrcLine; pdst = pdstLine; psrcLine += widthSrc; mfbScanlineInc(pdstLine, widthDst); if (startmask) { i = niStart; curBit = bitStart; GetBits (psrc, i, curBit, bitPos, bits); *pdst = *pdst & ~startmask | bits; pdst++; } nl = nlMiddle; while (nl--) { i = MFB_PPW; curBit = LeftMost; GetBits (psrc, i, curBit, bitPos, bits); *pdst++ = bits; } if (endmask) { i = niEnd; curBit = bitEnd; GetBits (psrc, i, curBit, bitPos, bits); *pdst = *pdst & ~endmask | bits; } } } else { while (height--) { psrc = psrcLine; pdst = pdstLine; psrcLine += widthSrc; mfbScanlineInc(pdstLine, widthDst); if (startmask) { i = niStart; curBit = bitStart; GetBits (psrc, i, curBit, bitPos, bits); *pdst = MROP_MASK(bits, *pdst, startmask); pdst++; } nl = nlMiddle; while (nl--) { i = MFB_PPW; curBit = LeftMost; GetBits (psrc, i, curBit, bitPos, bits); *pdst = MROP_SOLID(bits, *pdst); pdst++; } if (endmask) { i = niEnd; curBit = bitEnd; GetBits (psrc, i, curBit, bitPos, bits); *pdst = MROP_MASK (bits, *pdst, endmask); } } } } } #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbrrop.h0100664000076400007640000003224407120677563021260 0ustar constconst/* * $XConsortium: cfbrrop.h,v 1.10 95/06/08 23:20:39 gildea Exp $ * $XFree86: xc/programs/Xserver/cfb/cfbrrop.h,v 3.2 1997/01/08 20:32:41 dawes Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef GXcopy #include "X.h" #endif #define RROP_FETCH_GC(gc) \ RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr)) #ifndef RROP #define RROP GXset #endif #if RROP == GXcopy #if PSZ == 24 #define RROP_DECLARE register unsigned long rrop_xor; \ unsigned long piQxelXor[3], spiQxelXor[8]; #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ spiQxelXor[2] = rrop_xor << 24; \ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ spiQxelXor[4] = rrop_xor << 16; \ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ spiQxelXor[6] = rrop_xor << 8; \ spiQxelXor[1] = spiQxelXor[7] = 0; \ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); #define RROP_SOLID24(dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \ if (idx == 2 || idx == 4){ \ idx++; \ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \ } \ } #define RROP_SOLID(dst, idx) \ (*(dst) = piQxelXor[(idx)]) #define RROP_SOLID_MASK(dst,mask,idx) \ (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask))) #else #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; #define RROP_DECLARE register unsigned long rrop_xor; #define RROP_SOLID(dst) (*(dst) = (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask))) #define RROP_SOLID_lu(dst) stl_u(rrop_xor, dst) #define RROP_SOLID_MASK_lu(dst,mask) stl_u((ldl_u(dst) & ~(mask)) | ((rrop_xor) & (mask)), dst) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy) #endif /* GXcopy */ #if RROP == GXxor #if PSZ == 24 #define RROP_DECLARE register unsigned long rrop_xor; \ unsigned long piQxelXor[3], spiQxelXor[8]; #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ spiQxelXor[2] = rrop_xor << 24; \ spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ spiQxelXor[4] = rrop_xor << 16; \ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ spiQxelXor[6] = rrop_xor << 8; \ spiQxelXor[1] = spiQxelXor[7] = 0; \ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); #define RROP_SOLID24(dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) ^= spiQxelXor[idx]; \ if (idx == 2 || idx == 4) \ *((dst)+1) ^= spiQxelXor[idx+1]; \ } #define RROP_SOLID(dst,idx) \ (*(dst) ^= piQxelXor[(idx)]) #define RROP_SOLID_MASK(dst,mask,idx) \ (*(dst) ^= (piQxelXor[(idx)] & (mask))) #else #define RROP_DECLARE register unsigned long rrop_xor; #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) ^= (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask))) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor) #endif /* GXxor */ #if RROP == GXand #if PSZ == 24 #define RROP_DECLARE register unsigned long rrop_and; \ unsigned long piQxelAnd[3], spiQxelAnd[6]; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \ spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); #define RROP_SOLID24(dst,index) {\ switch((index) & 3){ \ case 0: \ *(dst) &= spiQxelAnd[0]; \ break; \ case 3: \ *(dst) &= spiQxelAnd[1]; \ break; \ case 1: \ *(dst) &= spiQxelAnd[2]; \ *((dst)+1) &= spiQxelAnd[3]; \ break; \ case 2: \ *(dst) &= spiQxelAnd[4]; \ *((dst)+1) &= spiQxelAnd[5]; \ break; \ } \ } #define RROP_SOLID(dst,idx) \ (*(dst) &= piQxelAnd[(idx)]) #define RROP_SOLID_MASK(dst,mask,idx) \ (*(dst) &= (piQxelAnd[(idx)] | ~(mask))) #else #define RROP_DECLARE register unsigned long rrop_and; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; #define RROP_SOLID(dst) (*(dst) &= (rrop_and)) #define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask))) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And) #endif /* GXand */ #if RROP == GXor #if PSZ == 24 #define RROP_DECLARE register unsigned long rrop_or; \ unsigned long piQxelOr[3], spiQxelOr[6]; #define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \ spiQxelOr[0] = rrop_or & 0xFFFFFF; \ spiQxelOr[1] = rrop_or << 24; \ spiQxelOr[2] = rrop_or << 16; \ spiQxelOr[3] = rrop_or << 8; \ spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \ spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \ piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \ piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \ piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16); #define RROP_SOLID24(dst,index) {\ switch((index) & 3){ \ case 0: \ *(dst) |= spiQxelOr[0]; \ break; \ case 3: \ *(dst) |= spiQxelOr[3]; \ break; \ case 1: \ *(dst) |= spiQxelOr[1]; \ *((dst)+1) |= spiQxelOr[4]; \ break; \ case 2: \ *(dst) |= spiQxelOr[2]; \ *((dst)+1) |= spiQxelOr[5]; \ break; \ } \ } #define RROP_SOLID(dst,idx) \ (*(dst) |= piQxelOr[(idx)]) #define RROP_SOLID_MASK(dst,mask,idx) \ (*(dst) |= (piQxelOr[(idx)] & (mask))) #else #define RROP_DECLARE register unsigned long rrop_or; #define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) |= (rrop_or)) #define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask))) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or) #endif /* GXor */ #if RROP == GXnoop #define RROP_DECLARE #define RROP_FETCH_GCPRIV(devPriv) #define RROP_SOLID(dst) #define RROP_SOLID_MASK(dst,mask) #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop) #endif /* GXnoop */ #if RROP == GXset #if PSZ == 24 #define RROP_DECLARE register unsigned long rrop_and, rrop_xor; \ unsigned long piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6]; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ rrop_xor = (devPriv)->xor; \ spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ spiQxelXor[1] = rrop_xor << 24; \ spiQxelXor[2] = rrop_xor << 16; \ spiQxelXor[3] = rrop_xor << 8; \ spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \ spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \ spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \ spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \ spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \ piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); #define RROP_SOLID24(dst,index) {\ switch((index) & 3){ \ case 0: \ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \ break; \ case 3: \ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \ break; \ case 1: \ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \ break; \ case 2: \ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \ break; \ } \ } #define RROP_SOLID(dst,idx) \ (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)])) #define RROP_SOLID_MASK(dst,mask,idx) \ (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask))) #else #define RROP_DECLARE register unsigned long rrop_and, rrop_xor; #define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask))) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General) #endif /* GXset */ #define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i)); #define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i) #define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i) #define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i) #define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i) #define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1) #define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p) #define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p) #define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p) #ifdef LONG64 #define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p) #endif /* LONG64 */ #define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i)); #define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1) #define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2) #define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4) #define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8) #define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16) #ifdef LONG64 #define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32) #endif /* LONG64 */ #if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy) #ifdef LONG64 #define RROP_UNROLL_SHIFT 6 #define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p) #define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64) #else /* not LONG64 */ #define RROP_UNROLL_SHIFT 5 #define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p) #define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32) #endif /* LONG64 */ #define RROP_UNROLL (1<>= RROP_UNROLL_SHIFT; \ (pdst) += part * (sizeof (unsigned long) / sizeof (*pdst)); \ switch (part) {\ RROP_UNROLL_CASE((unsigned long *) (pdst)) \ } \ while (--(nmiddle) >= 0) { \ (pdst) += RROP_UNROLL * (sizeof (unsigned long) / sizeof (*pdst)); \ RROP_UNROLL_LOOP((unsigned long *) (pdst)) \ } \ } #else #define RROP_SPAN(pdst,nmiddle) \ while (--(nmiddle) >= 0) { \ RROP_SOLID((unsigned long *) (pdst)); \ (pdst) += sizeof (unsigned long) / sizeof (*pdst); \ } #define RROP_SPAN_lu(pdst,nmiddle) \ while (--(nmiddle) >= 0) { \ RROP_SOLID_lu((unsigned long *) (pdst)); \ (pdst) += sizeof (unsigned long) / sizeof (*pdst); \ } #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define RROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbline.c0100664000076400007640000004362407120677563021224 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbline.c,v 1.24 94/07/28 14:33:33 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbline.c,v 3.0 1996/06/29 09:05:38 dawes Exp $ */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "mistruct.h" #include "cfb.h" #include "cfbmskbits.h" #include "miline.h" /* single-pixel lines on a color frame buffer NON-SLOPED LINES horizontal lines are always drawn left to right; we have to move the endpoints right by one after they're swapped. horizontal lines will be confined to a single band of a region. the code finds that band (giving up if the lower bound of the band is above the line we're drawing); then it finds the first box in that band that contains part of the line. we clip the line to subsequent boxes in that band. vertical lines are always drawn top to bottom (y-increasing.) this requires adding one to the y-coordinate of each endpoint after swapping. SLOPED LINES when clipping a sloped line, we bring the second point inside the clipping box, rather than one beyond it, and then add 1 to the length of the line before drawing it. this lets us use the same box for finding the outcodes for both endpoints. since the equation for clipping the second endpoint to an edge gives us 1 beyond the edge, we then have to move the point towards the first point by one step on the major axis. eventually, there will be a diagram here to explain what's going on. the method uses Cohen-Sutherland outcodes to determine outsideness, and a method similar to Pike's layers for doing the actual clipping. */ void #ifdef POLYSEGMENT cfbSegmentSS (pDrawable, pGC, nseg, pSeg) DrawablePtr pDrawable; GCPtr pGC; int nseg; register xSegment *pSeg; #else cfbLineSS (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; #endif { int nboxInit; register int nbox; BoxPtr pboxInit; register BoxPtr pbox; #ifndef POLYSEGMENT register DDXPointPtr ppt; /* pointer to list of translated points */ #endif unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ unsigned long *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); /* a bunch of temporaries */ int tmp; register int y1, y2; register int x1, x2; RegionPtr cclip; cfbPrivGCPtr devPriv; unsigned long xor, and; int alu; devPriv = cfbGetGCPrivate(pGC); cclip = devPriv->pCompositeClip; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) alu = devPriv->rop; xor = devPriv->xor; and = devPriv->and; xorg = pDrawable->x; yorg = pDrawable->y; #ifdef POLYSEGMENT while (nseg--) #else ppt = pptInit; x2 = ppt->x + xorg; y2 = ppt->y + yorg; while(--npt) #endif { nbox = nboxInit; pbox = pboxInit; #ifdef POLYSEGMENT x1 = pSeg->x1 + xorg; y1 = pSeg->y1 + yorg; x2 = pSeg->x2 + xorg; y2 = pSeg->y2 + yorg; pSeg++; #else x1 = x2; y1 = y2; ++ppt; if (mode == CoordModePrevious) { xorg = x1; yorg = y1; } x2 = ppt->x + xorg; y2 = ppt->y + yorg; #endif if (x1 == x2) /* vertical line */ { /* make the line go top to bottom of screen, keeping endpoint semantics */ if (y1 > y2) { register int tmp; tmp = y2; y2 = y1 + 1; y1 = tmp + 1; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) y1--; #endif } #ifdef POLYSEGMENT else if (pGC->capStyle != CapNotLast) y2++; #endif /* get to first band that might contain part of line */ while ((nbox) && (pbox->y2 <= y1)) { pbox++; nbox--; } if (nbox) { /* stop when lower edge of box is beyond end of line */ while((nbox) && (y2 >= pbox->y1)) { if ((x1 >= pbox->x1) && (x1 < pbox->x2)) { int y1t, y2t; /* this box has part of the line in it */ y1t = max(y1, pbox->y1); y2t = min(y2, pbox->y2); if (y1t != y2t) { cfbVertS (alu, and, xor, addrl, nlwidth, x1, y1t, y2t-y1t); } } nbox--; pbox++; } } #ifndef POLYSEGMENT y2 = ppt->y + yorg; #endif } else if (y1 == y2) /* horizontal line */ { /* force line from left to right, keeping endpoint semantics */ if (x1 > x2) { register int tmp; tmp = x2; x2 = x1 + 1; x1 = tmp + 1; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) x1--; #endif } #ifdef POLYSEGMENT else if (pGC->capStyle != CapNotLast) x2++; #endif /* find the correct band */ while( (nbox) && (pbox->y2 <= y1)) { pbox++; nbox--; } /* try to draw the line, if we haven't gone beyond it */ if ((nbox) && (pbox->y1 <= y1)) { /* when we leave this band, we're done */ tmp = pbox->y1; while((nbox) && (pbox->y1 == tmp)) { int x1t, x2t; if (pbox->x2 <= x1) { /* skip boxes until one might contain start point */ nbox--; pbox++; continue; } /* stop if left of box is beyond right of line */ if (pbox->x1 >= x2) { nbox = 0; break; } x1t = max(x1, pbox->x1); x2t = min(x2, pbox->x2); if (x1t != x2t) { cfbHorzS (alu, and, xor, addrl, nlwidth, x1t, y1, x2t-x1t); } nbox--; pbox++; } } #ifndef POLYSEGMENT x2 = ppt->x + xorg; #endif } else /* sloped line */ { CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; SetYMajorOctant(octant); } FIXUP_ERROR(e, octant, bias); /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ while(nbox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pbox); OUTCODES(oc2, x2, y2, pbox); if ((oc1 | oc2) == 0) { if (axis == X_AXIS) len = adx; else len = ady; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) len++; #endif cfbBresS (alu, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len); break; } else if (oc1 & oc2) { pbox++; } else { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pbox++; continue; } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); #ifdef POLYSEGMENT if (clip2 != 0 || pGC->capStyle != CapNotLast) len++; #else len += (clip2 != 0); #endif if (len) { /* unwind bresenham error term to first point */ if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); else err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); } else err = e; cfbBresS(alu, and, xor, addrl, nlwidth, signdx, signdy, axis, new_x1, new_y1, err, e1, e2, len); } pbox++; } } /* while (nbox--) */ } /* sloped line */ } /* while (nline--) */ #ifndef POLYSEGMENT /* paint the last point if the end style isn't CapNotLast. (Assume that a projecting, butt, or round cap that is one pixel wide is the same as the single pixel of the endpoint.) */ if ((pGC->capStyle != CapNotLast) && ((ppt->x + xorg != pptInit->x + pDrawable->x) || (ppt->y + yorg != pptInit->y + pDrawable->y) || (ppt == pptInit + 1))) { nbox = nboxInit; pbox = pboxInit; while (nbox--) { if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) && (y2 < pbox->y2)) { unsigned long mask; unsigned long scrbits; #if PSZ == 24 mask = cfbmask[(x2 & 3)<<1]; addrl += (y2 * nlwidth) + ((x2*3) >> 2); #else mask = cfbmask[x2 & PIM]; addrl += (y2 * nlwidth) + (x2 >> PWSH); #endif scrbits = *addrl; *addrl = (scrbits & ~mask) | (DoRRop (scrbits, and, xor) & mask); break; } else pbox++; } } #endif } /* * Draw dashed 1-pixel lines. */ void #ifdef POLYSEGMENT cfbSegmentSD (pDrawable, pGC, nseg, pSeg) DrawablePtr pDrawable; register GCPtr pGC; int nseg; register xSegment *pSeg; #else cfbLineSD( pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; register GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; #endif { int nboxInit; register int nbox; BoxPtr pboxInit; register BoxPtr pbox; #ifndef POLYSEGMENT register DDXPointPtr ppt; /* pointer to list of translated points */ #endif register unsigned int oc1; /* outcode of point 1 */ register unsigned int oc2; /* outcode of point 2 */ unsigned long *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); int x1, x2, y1, y2; RegionPtr cclip; cfbRRopRec rrops[2]; unsigned char *pDash; int dashOffset; int numInDashList; int dashIndex; int isDoubleDash; int dashIndexTmp, dashOffsetTmp; int unclippedlen; cfbPrivGCPtr devPriv; devPriv = cfbGetGCPrivate(pGC); cclip = devPriv->pCompositeClip; rrops[0].rop = devPriv->rop; rrops[0].and = devPriv->and; rrops[0].xor = devPriv->xor; if (pGC->alu == GXcopy) { rrops[1].rop = GXcopy; rrops[1].and = 0; rrops[1].xor = PFILL (pGC->bgPixel); } else { rrops[1].rop = cfbReduceRasterOp (pGC->alu, pGC->bgPixel, pGC->planemask, &rrops[1].and, &rrops[1].xor); } pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) /* compute initial dash values */ pDash = (unsigned char *) pGC->dash; numInDashList = pGC->numInDashList; isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashIndex = 0; dashOffset = 0; miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, numInDashList, &dashOffset); xorg = pDrawable->x; yorg = pDrawable->y; #ifdef POLYSEGMENT while (nseg--) #else ppt = pptInit; x2 = ppt->x + xorg; y2 = ppt->y + yorg; while(--npt) #endif { nbox = nboxInit; pbox = pboxInit; #ifdef POLYSEGMENT x1 = pSeg->x1 + xorg; y1 = pSeg->y1 + yorg; x2 = pSeg->x2 + xorg; y2 = pSeg->y2 + yorg; pSeg++; #else x1 = x2; y1 = y2; ++ppt; if (mode == CoordModePrevious) { xorg = x1; yorg = y1; } x2 = ppt->x + xorg; y2 = ppt->y + yorg; #endif CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; unclippedlen = adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; unclippedlen = ady; SetYMajorOctant(octant); } FIXUP_ERROR(e, octant, bias); /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ while(nbox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pbox); OUTCODES(oc2, x2, y2, pbox); if ((oc1 | oc2) == 0) { #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) unclippedlen++; dashIndexTmp = dashIndex; dashOffsetTmp = dashOffset; cfbBresD (rrops, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen); break; #else cfbBresD (rrops, &dashIndex, pDash, numInDashList, &dashOffset, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen); goto dontStep; #endif } else if (oc1 & oc2) { pbox++; } else /* have to clip */ { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; int dashIndexTmp, dashOffsetTmp; if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pbox++; continue; } dashIndexTmp = dashIndex; dashOffsetTmp = dashOffset; if (clip1) { int dlen; if (axis == X_AXIS) dlen = abs(new_x1 - x1); else dlen = abs(new_y1 - y1); miStepDash (dlen, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp); } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); #ifdef POLYSEGMENT if (clip2 != 0 || pGC->capStyle != CapNotLast) len++; #else len += (clip2 != 0); #endif if (len) { /* unwind bresenham error term to first point */ if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); else err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); } else err = e; cfbBresD (rrops, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, new_x1, new_y1, err, e1, e2, len); } pbox++; } } /* while (nbox--) */ #ifndef POLYSEGMENT /* * walk the dash list around to the next line */ miStepDash (unclippedlen, &dashIndex, pDash, numInDashList, &dashOffset); dontStep: ; #endif } /* while (nline--) */ #ifndef POLYSEGMENT /* paint the last point if the end style isn't CapNotLast. (Assume that a projecting, butt, or round cap that is one pixel wide is the same as the single pixel of the endpoint.) */ if ((pGC->capStyle != CapNotLast) && ((dashIndex & 1) == 0 || isDoubleDash) && ((ppt->x + xorg != pptInit->x + pDrawable->x) || (ppt->y + yorg != pptInit->y + pDrawable->y) || (ppt == pptInit + 1))) { nbox = nboxInit; pbox = pboxInit; while (nbox--) { if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) && (y2 < pbox->y2)) { unsigned long mask; int pix; pix = 0; if (dashIndex & 1) pix = 1; #if PSZ == 24 mask = cfbmask[(x2 & 3)<<1]; addrl += (y2 * nlwidth) + ((x2 *3)>> 2); #else mask = cfbmask[x2 & PIM]; addrl += (y2 * nlwidth) + (x2 >> PWSH); #endif *addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask); break; } else pbox++; } } #endif } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbfillsp.c0100664000076400007640000006600407120677563021563 0ustar constconst/************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbfillsp.c,v 5.24 94/04/17 20:28:48 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbfillsp.c,v 3.1 1996/12/09 11:50:54 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "mergerop.h" #if PSZ == 8 #include "cfb8bit.h" #endif #define MFB_CONSTS_ONLY #include "maskbits.h" #include "mi.h" #include "mispans.h" /* scanline filling for color frame buffer written by drewry, oct 1986 modified by smarks changes for compatibility with Little-endian systems Jul 1987; MIT:yba. these routines all clip. they assume that anything that has called them has already translated the points (i.e. pGC->miTranslate is non-zero, which is howit gets set in cfbCreateGC().) the number of new scnalines created by clipping == MaxRectsPerBand * nSpans. FillSolid is overloaded to be used for OpaqueStipple as well, if fgPixel == bgPixel. Note that for solids, PrivGC.rop == PrivGC.ropOpStip FillTiled is overloaded to be used for OpaqueStipple, if fgPixel != bgPixel. based on the fill style, it uses {RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip} */ #ifdef notdef #include static dumpspans(n, ppt, pwidth) int n; DDXPointPtr ppt; int *pwidth; { fprintf(stderr,"%d spans\n", n); while (n--) { fprintf(stderr, "[%d,%d] %d\n", ppt->x, ppt->y, *pwidth); ppt++; pwidth++; } fprintf(stderr, "\n"); } #endif /* Fill spans with tiles that aren't 32 bits wide */ void cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ void (*fill)(); int xrot, yrot; if (!(pGC->planemask)) return; #if PSZ == 24 if (pGC->tile.pixmap->drawable.width & 3) #else if (pGC->tile.pixmap->drawable.width & PIM) #endif { fill = cfbFillSpanTileOddGeneral; if ((pGC->planemask & PMSK) == PMSK) { if (pGC->alu == GXcopy) fill = cfbFillSpanTileOddCopy; } } else { fill = cfbFillSpanTile32sGeneral; if ((pGC->planemask & PMSK) == PMSK) { if (pGC->alu == GXcopy) fill = cfbFillSpanTile32sCopy; } } n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); if ( n == 0 ) return; pwidth = (int *)ALLOCATE_LOCAL(n * sizeof(int)); ppt = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!ppt || !pwidth) { if (ppt) DEALLOCATE_LOCAL(ppt); if (pwidth) DEALLOCATE_LOCAL(pwidth); return; } n = miClipSpans( cfbGetCompositeClip(pGC), pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); xrot = pDrawable->x + pGC->patOrg.x; yrot = pDrawable->y + pGC->patOrg.y; (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); DEALLOCATE_LOCAL(ppt); DEALLOCATE_LOCAL(pwidth); } #if PSZ == 8 void cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth; /* pointer to list of n widths */ int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; unsigned long *pdstBase; /* pointer to start of bitmap */ int nlwDst; /* width in longwords of bitmap */ register unsigned long *pdst; /* pointer to current word in bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ int nlw; int x, y, w, xrem, xSrc, ySrc; int stwidth, stippleWidth; int stippleHeight; register unsigned long bits, inputBits; register int partBitsLeft; int nextPartBits; int bitsLeft, bitsWhole; unsigned long *srcTemp, *srcStart; unsigned long *psrcBase; unsigned long startmask, endmask; if (pGC->fillStyle == FillStippled) cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); else cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); if (cfb8StippleRRop == GXnoop) return; n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans( cfbGetCompositeClip(pGC), pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); /* * OK, so what's going on here? We have two Drawables: * * The Stipple: * Depth = 1 * Width = stippleWidth * Words per scanline = stwidth * Pointer to pixels = pStipple->devPrivate.ptr */ pStipple = pGC->stipple; stwidth = pStipple->devKind >> PWSH; stippleWidth = pStipple->drawable.width; stippleHeight = pStipple->drawable.height; psrcBase = (unsigned long *) pStipple->devPrivate.ptr; /* * The Target: * Depth = PSZ * Width = determined from *pwidth * Words per scanline = nlwDst * Pointer to pixels = addrlBase */ cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) /* this replaces rotating the stipple. Instead we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and xrem always stay within the stipple bounds. */ modulus (pGC->patOrg.x, stippleWidth, xSrc); xSrc += pDrawable->x - stippleWidth; modulus (pGC->patOrg.y, stippleHeight, ySrc); ySrc += pDrawable->y - stippleHeight; bitsWhole = stippleWidth; while (n--) { x = ppt->x; y = ppt->y; ppt++; w = *pwidth++; pdst = pdstBase + y * nlwDst + (x >> PWSH); y = (y - ySrc) % stippleHeight; srcStart = psrcBase + y * stwidth; xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth; srcTemp = srcStart + (xrem >> MFB_PWSH); bitsLeft = stippleWidth - (xrem & ~MFB_PIM); xrem &= MFB_PIM; NextUnnaturalStippleWord if (partBitsLeft < xrem) FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d", partBitsLeft, xrem); NextSomeBits (inputBits, xrem); partBitsLeft -= xrem; if (((x & PIM) + w) <= PPW) { maskpartialbits (x, w, startmask) NextUnnaturalStippleBits *pdst = MaskRRopPixels(*pdst,bits,startmask); } else { maskbits (x, w, startmask, endmask, nlw); nextPartBits = (x & (PGSZB-1)) + w; if (nextPartBits < partBitsLeft) { if (startmask) { MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask) pdst++; NextBitGroup (inputBits); } while (nlw--) { RRopBitGroup (pdst, GetBitGroup (inputBits)); pdst++; NextBitGroup (inputBits); } if (endmask) { MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask) } } else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft) { NextUnnaturalStippleBitsFast if (startmask) { *pdst = MaskRRopPixels(*pdst,bits,startmask); pdst++; NextUnnaturalStippleBitsFast } while (nlw--) { *pdst = RRopPixels(*pdst,bits); pdst++; NextUnnaturalStippleBitsFast } if (endmask) *pdst = MaskRRopPixels (*pdst,bits,endmask); } else { NextUnnaturalStippleBits if (startmask) { *pdst = MaskRRopPixels(*pdst,bits,startmask); pdst++; NextUnnaturalStippleBits } while (nlw--) { *pdst = RRopPixels(*pdst,bits); pdst++; NextUnnaturalStippleBits } if (endmask) *pdst = MaskRRopPixels(*pdst,bits,endmask); } } } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } #else /* PSZ != 8 */ /* Fill spans with stipples that aren't 32 bits wide */ void cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ int iline; /* first line of tile to use */ unsigned long *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register unsigned long *pdst; /* pointer to current word in bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ register int w; int width, x, xrem, xSrc, ySrc; unsigned long tmpSrc, tmpDst1, tmpDst2; int stwidth, stippleWidth; unsigned long *psrcS; int rop, stiprop; int stippleHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; unsigned long fgfill, bgfill; if (!(pGC->planemask)) return; n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans( cfbGetCompositeClip(pGC), pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); rop = pGC->alu; if (pGC->fillStyle == FillStippled) { switch (rop) { case GXand: case GXcopy: case GXnoop: case GXor: stiprop = rop; break; default: stiprop = rop; rop = GXcopy; } } fgfill = PFILL(pGC->fgPixel); bgfill = PFILL(pGC->bgPixel); /* * OK, so what's going on here? We have two Drawables: * * The Stipple: * Depth = 1 * Width = stippleWidth * Words per scanline = stwidth * Pointer to pixels = pStipple->devPrivate.ptr */ pStipple = pGC->stipple; stwidth = pStipple->devKind / PGSZB; stippleWidth = pStipple->drawable.width; stippleHeight = pStipple->drawable.height; /* * The Target: * Depth = PSZ * Width = determined from *pwidth * Words per scanline = nlwidth * Pointer to pixels = addrlBase */ cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrlBase) /* this replaces rotating the stipple. Instead we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and xrem always stay within the stipple bounds. */ modulus (pGC->patOrg.x, stippleWidth, xSrc); xSrc += pDrawable->x - stippleWidth; modulus (pGC->patOrg.y, stippleHeight, ySrc); ySrc += pDrawable->y - stippleHeight; while (n--) { iline = (ppt->y - ySrc) % stippleHeight; x = ppt->x; pdst = addrlBase + (ppt->y * nlwidth); psrcS = (unsigned long *) pStipple->devPrivate.ptr + (iline * stwidth); if (*pwidth) { width = *pwidth; while(width > 0) { int xtemp, tmpx; register unsigned long *ptemp; register unsigned long *pdsttmp; /* * Do a stripe through the stipple & destination w pixels * wide. w is not more than: * - the width of the destination * - the width of the stipple * - the distance between x and the next word * boundary in the destination * - the distance between x and the next word * boundary in the stipple */ /* width of dest/stipple */ xrem = (x - xSrc) % stippleWidth; #if PSZ == 24 w = 1; #else w = min((stippleWidth - xrem), width); /* dist to word bound in dest */ w = min(w, PPW - (x & PIM)); /* dist to word bound in stip */ w = min(w, MFB_PPW - (x & MFB_PIM)); #endif xtemp = (xrem & MFB_PIM); ptemp = (unsigned long *)(psrcS + (xrem >> MFB_PWSH)); #if PSZ == 24 tmpx = x & 3; pdsttmp = pdst + ((x * 3)>>2); #else tmpx = x & PIM; pdsttmp = pdst + (x>>PWSH); #endif switch ( pGC->fillStyle ) { case FillOpaqueStippled: #if PSZ == 24 getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem); getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem); #else getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1); getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2); #endif break; case FillStippled: /* Fill tmpSrc with the source pixels */ #if PSZ == 24 getbits24(pdsttmp, tmpSrc, x); getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem); #else getbits(pdsttmp, tmpx, w, tmpSrc); getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1); #endif if (rop != stiprop) { #if PSZ == 24 putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop); #else putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop); #endif } else { tmpSrc = fgfill; } #if PSZ == 24 getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem); #else getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2); #endif break; } tmpDst2 |= tmpDst1; #if PSZ == 24 putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop); #else putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop); #endif x += w; width -= w; } } ppt++; pwidth++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } #endif /* PSZ == 8 */ #if PSZ == 8 void cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth; /* pointer to list of n widths */ unsigned long *src; /* pointer to bits in stipple, if needed */ int stippleHeight; /* height of the stipple */ PixmapPtr stipple; int nlwDst; /* width in longwords of the dest pixmap */ int x,y,w; /* current span */ unsigned long startmask; unsigned long endmask; register unsigned long *dst; /* pointer to bits we're writing */ register int nlw; unsigned long *dstTmp; int nlwTmp; unsigned long *pbits; /* pointer to start of pixmap */ register unsigned long xor; register unsigned long mask; register unsigned long bits; /* bits from stipple */ int wEnd; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; cfbPrivGCPtr devPriv; devPriv = cfbGetGCPrivate(pGC); cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); n = nInit * miFindMaxBand(devPriv->pCompositeClip); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(devPriv->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); stipple = devPriv->pRotatedPixmap; src = (unsigned long *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) while (n--) { w = *pwidth++; x = ppt->x; y = ppt->y; ppt++; dst = pbits + (y * nlwDst) + (x >> PWSH); if (((x & PIM) + w) <= PPW) { maskpartialbits(x, w, startmask); endmask = 0; nlw = 0; } else { maskbits (x, w, startmask, endmask, nlw); } bits = src[y % stippleHeight]; RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); #if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; if (w < (PGSZ*2)) { if (startmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dst = (*dst & ~(mask & startmask)) | (xor & (mask & startmask)); dst++; RotBitsLeft (bits, PGSZB); } while (nlw--) { WriteBitGroup (dst,xor,GetBitGroup(bits)) dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dst = (*dst & ~(mask & endmask)) | (xor & (mask & endmask)); } } else { /* XXX constants probably not OK here */ wEnd = 7 - (nlw & 7); nlw = (nlw >> 3) + 1; dstTmp = dst; nlwTmp = nlw; if (startmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dstTmp = (*dstTmp & ~(mask & startmask)) | (xor & (mask & startmask)); dstTmp++; RotBitsLeft (bits, PGSZB); } w = 7 - wEnd; while (w--) { dst = dstTmp; dstTmp++; nlw = nlwTmp; #if defined(__GNUC__) && defined(mc68020) mask = cfb8PixelMasks[GetBitGroup(bits)]; xor = xor & mask; mask = ~mask; while (nlw--) { *dst = (*dst & mask) | xor; dst += 8; } xor = devPriv->xor; #else #define SwitchBitsLoop(body) \ while (nlw--) \ { \ body \ dst += 8; \ } SwitchBitGroup(dst, xor, GetBitGroup(bits)); #undef SwitchBitsLoop #endif NextBitGroup (bits); } nlwTmp--; w = wEnd + 1; if (endmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; dst = dstTmp + (nlwTmp << 3); *dst = (*dst & ~(mask & endmask)) | (xor & (mask & endmask)); } while (w--) { nlw = nlwTmp; dst = dstTmp; dstTmp++; #if defined(__GNUC__) && defined(mc68020) mask = cfb8PixelMasks[GetBitGroup(bits)]; xor = xor & mask; mask = ~mask; while (nlw--) { *dst = (*dst & mask) | xor; dst += 8; } xor = devPriv->xor; #else #define SwitchBitsLoop(body) \ while (nlw--) \ { \ body \ dst += 8; \ } SwitchBitGroup(dst, xor, GetBitGroup(bits)); #undef SwitchBitsLoop #endif NextBitGroup (bits); } } } else #endif /* PPW == 4 */ { if (startmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, startmask); dst++; RotBitsLeft (bits, PGSZB); } while (nlw--) { RRopBitGroup(dst, GetBitGroup(bits)); dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, endmask); } } } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth; /* pointer to list of n widths */ unsigned long *src; /* pointer to bits in stipple, if needed */ int stippleHeight; /* height of the stipple */ PixmapPtr stipple; int nlwDst; /* width in longwords of the dest pixmap */ int x,y,w; /* current span */ unsigned long startmask; unsigned long endmask; register unsigned long *dst; /* pointer to bits we're writing */ register int nlw; unsigned long *dstTmp; int nlwTmp; unsigned long *pbits; /* pointer to start of pixmap */ register unsigned long xor; register unsigned long mask; register unsigned long bits; /* bits from stipple */ int wEnd; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; cfbPrivGCPtr devPriv; devPriv = cfbGetGCPrivate(pGC); cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); n = nInit * miFindMaxBand(devPriv->pCompositeClip); if ( n == 0 ) return; pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(devPriv->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); stipple = devPriv->pRotatedPixmap; src = (unsigned long *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) while (n--) { w = *pwidth++; x = ppt->x; y = ppt->y; ppt++; dst = pbits + (y * nlwDst) + (x >> PWSH); if (((x & PIM) + w) <= PPW) { maskpartialbits(x, w, startmask); endmask = 0; nlw = 0; } else { maskbits (x, w, startmask, endmask, nlw); } bits = src[y % stippleHeight]; RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); #if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; if (w < PGSZ*2) { if (startmask) { *dst = *dst & ~startmask | GetPixelGroup (bits) & startmask; dst++; RotBitsLeft (bits, PGSZB); } while (nlw--) { *dst++ = GetPixelGroup(bits); RotBitsLeft (bits, PGSZB); } if (endmask) { *dst = *dst & ~endmask | GetPixelGroup (bits) & endmask; } } else { /* XXX consts probably not OK here */ wEnd = 7 - (nlw & 7); nlw = (nlw >> 3) + 1; dstTmp = dst; nlwTmp = nlw; if (startmask) { *dstTmp = *dstTmp & ~startmask | GetPixelGroup (bits) & startmask; dstTmp++; RotBitsLeft (bits, PGSZB); } w = 7 - wEnd; while (w--) { nlw = nlwTmp; dst = dstTmp; dstTmp++; xor = GetPixelGroup (bits); while (nlw--) { *dst = xor; dst += 8; } NextBitGroup (bits); } nlwTmp--; w = wEnd + 1; if (endmask) { dst = dstTmp + (nlwTmp << 3); *dst = (*dst & ~endmask) | GetPixelGroup (bits) & endmask; } while (w--) { nlw = nlwTmp; dst = dstTmp; dstTmp++; xor = GetPixelGroup (bits); while (nlw--) { *dst = xor; dst += 8; } NextBitGroup (bits); } } } else #endif /* PPW == 4 */ { if (startmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, startmask); dst++; RotBitsLeft (bits, PGSZB); } while (nlw--) { RRopBitGroup(dst, GetBitGroup(bits)); dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, endmask); } } } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } #endif /* PSZ == 8 */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbgc.c0100664000076400007640000004376207120677563020671 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbgc.c,v 5.62 94/04/17 20:28:49 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "region.h" #include "mistruct.h" #include "mibstore.h" #include "migc.h" #include "cfbmskbits.h" #include "cfb8bit.h" #if PSZ == 8 # define useTEGlyphBlt cfbTEGlyphBlt8 #else # ifdef WriteBitGroup # define useTEGlyphBlt cfbImageGlyphBlt8 # else # define useTEGlyphBlt cfbTEGlyphBlt # endif #endif #ifdef WriteBitGroup # define useImageGlyphBlt cfbImageGlyphBlt8 # define usePolyGlyphBlt cfbPolyGlyphBlt8 #else # define useImageGlyphBlt miImageGlyphBlt # define usePolyGlyphBlt miPolyGlyphBlt #endif #ifdef FOUR_BIT_CODE # define usePushPixels cfbPushPixels8 #else # define usePushPixels mfbPushPixels #endif #ifdef PIXEL_ADDR # define ZeroPolyArc cfbZeroPolyArcSS8Copy #else # define ZeroPolyArc miZeroPolyArc #endif GCFuncs cfbGCFuncs = { cfbValidateGC, miChangeGC, miCopyGC, miDestroyGC, miChangeClip, miDestroyClip, miCopyClip, }; GCOps cfbTEOps1Rect = { cfbSolidSpansCopy, cfbSetSpans, cfbPutImage, cfbCopyArea, cfbCopyPlane, cfbPolyPoint, #ifdef PIXEL_ADDR cfb8LineSS1Rect, cfb8SegmentSS1Rect, #else cfbLineSS, cfbSegmentSS, #endif miPolyRectangle, ZeroPolyArc, cfbFillPoly1RectCopy, cfbPolyFillRect, cfbPolyFillArcSolidCopy, miPolyText8, miPolyText16, miImageText8, miImageText16, useTEGlyphBlt, usePolyGlyphBlt, usePushPixels #ifdef NEED_LINEHELPER ,NULL #endif }; GCOps cfbNonTEOps1Rect = { cfbSolidSpansCopy, cfbSetSpans, cfbPutImage, cfbCopyArea, cfbCopyPlane, cfbPolyPoint, #ifdef PIXEL_ADDR cfb8LineSS1Rect, cfb8SegmentSS1Rect, #else cfbLineSS, cfbSegmentSS, #endif miPolyRectangle, ZeroPolyArc, cfbFillPoly1RectCopy, cfbPolyFillRect, cfbPolyFillArcSolidCopy, miPolyText8, miPolyText16, miImageText8, miImageText16, useImageGlyphBlt, usePolyGlyphBlt, usePushPixels #ifdef NEED_LINEHELPER ,NULL #endif }; GCOps cfbTEOps = { cfbSolidSpansCopy, cfbSetSpans, cfbPutImage, cfbCopyArea, cfbCopyPlane, cfbPolyPoint, cfbLineSS, cfbSegmentSS, miPolyRectangle, ZeroPolyArc, miFillPolygon, cfbPolyFillRect, cfbPolyFillArcSolidCopy, miPolyText8, miPolyText16, miImageText8, miImageText16, useTEGlyphBlt, usePolyGlyphBlt, usePushPixels #ifdef NEED_LINEHELPER ,NULL #endif }; GCOps cfbNonTEOps = { cfbSolidSpansCopy, cfbSetSpans, cfbPutImage, cfbCopyArea, cfbCopyPlane, cfbPolyPoint, cfbLineSS, cfbSegmentSS, miPolyRectangle, #ifdef PIXEL_ADDR cfbZeroPolyArcSS8Copy, #else miZeroPolyArc, #endif miFillPolygon, cfbPolyFillRect, cfbPolyFillArcSolidCopy, miPolyText8, miPolyText16, miImageText8, miImageText16, useImageGlyphBlt, usePolyGlyphBlt, usePushPixels #ifdef NEED_LINEHELPER ,NULL #endif }; GCOps * cfbMatchCommon (pGC, devPriv) GCPtr pGC; cfbPrivGCPtr devPriv; { if (pGC->lineWidth != 0) return 0; if (pGC->lineStyle != LineSolid) return 0; if (pGC->fillStyle != FillSolid) return 0; if (devPriv->rop != GXcopy) return 0; if (pGC->font && FONTMAXBOUNDS(pGC->font,rightSideBearing) - FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && FONTMINBOUNDS(pGC->font,characterWidth) >= 0) { if (TERMINALFONT(pGC->font) #ifdef FOUR_BIT_CODE && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB #endif ) #ifdef NO_ONE_RECT return &cfbTEOps1Rect; #else if (devPriv->oneRect) return &cfbTEOps1Rect; else return &cfbTEOps; #endif else #ifdef NO_ONE_RECT return &cfbNonTEOps1Rect; #else if (devPriv->oneRect) return &cfbNonTEOps1Rect; else return &cfbNonTEOps; #endif } return 0; } Bool cfbCreateGC(pGC) register GCPtr pGC; { cfbPrivGC *pPriv; if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD) return (mfbCreateGC(pGC)); pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; /* * some of the output primitives aren't really necessary, since they * will be filled in ValidateGC because of dix/CreateGC() setting all * the change bits. Others are necessary because although they depend * on being a color frame buffer, they don't change */ pGC->ops = &cfbNonTEOps; pGC->funcs = &cfbGCFuncs; /* cfb wants to translate before scan conversion */ pGC->miTranslate = 1; pPriv = cfbGetGCPrivate(pGC); pPriv->rop = pGC->alu; pPriv->oneRect = FALSE; pPriv->fExpose = TRUE; pPriv->freeCompClip = FALSE; pPriv->pRotatedPixmap = (PixmapPtr) NULL; return TRUE; } /* Clipping conventions if the drawable is a window CT_REGION ==> pCompositeClip really is the composite CT_other ==> pCompositeClip is the window clip region if the drawable is a pixmap CT_REGION ==> pCompositeClip is the translated client region clipped to the pixmap boundary CT_other ==> pCompositeClip is the pixmap bounding box */ void cfbValidateGC(pGC, changes, pDrawable) register GCPtr pGC; unsigned long changes; DrawablePtr pDrawable; { int mask; /* stateChanges */ int index; /* used for stepping through bitfields */ int new_rrop; int new_line, new_text, new_fillspans, new_fillarea; int new_rotate; int xrot, yrot; /* flags for changing the proc vector */ cfbPrivGCPtr devPriv; int oneRect; new_rotate = pGC->lastWinOrg.x != pDrawable->x || pGC->lastWinOrg.y != pDrawable->y; pGC->lastWinOrg.x = pDrawable->x; pGC->lastWinOrg.y = pDrawable->y; devPriv = cfbGetGCPrivate(pGC); new_rrop = FALSE; new_line = FALSE; new_text = FALSE; new_fillspans = FALSE; new_fillarea = FALSE; /* * if the client clip is different or moved OR the subwindowMode has * changed OR the window's clip has changed since the last validation * we need to recompute the composite clip */ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) ) { miComputeCompositeClip (pGC, pDrawable); #ifdef NO_ONE_RECT devPriv->oneRect = FALSE; #else oneRect = REGION_NUM_RECTS(devPriv->pCompositeClip) == 1; if (oneRect != devPriv->oneRect) new_line = TRUE; devPriv->oneRect = oneRect; #endif } mask = changes; while (mask) { index = lowbit (mask); mask &= ~index; /* * this switch acculmulates a list of which procedures might have * to change due to changes in the GC. in some cases (e.g. * changing one 16 bit tile for another) we might not really need * a change, but the code is being paranoid. this sort of batching * wins if, for example, the alu and the font have been changed, * or any other pair of items that both change the same thing. */ switch (index) { case GCFunction: case GCForeground: new_rrop = TRUE; break; case GCPlaneMask: new_rrop = TRUE; new_text = TRUE; break; case GCBackground: break; case GCLineStyle: case GCLineWidth: new_line = TRUE; break; case GCJoinStyle: case GCCapStyle: break; case GCFillStyle: new_text = TRUE; new_fillspans = TRUE; new_line = TRUE; new_fillarea = TRUE; break; case GCFillRule: break; case GCTile: new_fillspans = TRUE; new_fillarea = TRUE; break; case GCStipple: if (pGC->stipple) { int width = pGC->stipple->drawable.width; PixmapPtr nstipple; if ((width <= PGSZ) && !(width & (width - 1)) && (nstipple = cfbCopyPixmap(pGC->stipple))) { cfbPadPixmap(nstipple); (*pGC->pScreen->DestroyPixmap)(pGC->stipple); pGC->stipple = nstipple; } } new_fillspans = TRUE; new_fillarea = TRUE; break; case GCTileStipXOrigin: new_rotate = TRUE; break; case GCTileStipYOrigin: new_rotate = TRUE; break; case GCFont: new_text = TRUE; break; case GCSubwindowMode: break; case GCGraphicsExposures: break; case GCClipXOrigin: break; case GCClipYOrigin: break; case GCClipMask: break; case GCDashOffset: break; case GCDashList: break; case GCArcMode: break; default: break; } } /* * If the drawable has changed, ensure suitable * entries are in the proc vector. */ if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) { new_fillspans = TRUE; /* deal with FillSpans later */ } if (new_rotate || new_fillspans) { Bool new_pix = FALSE; xrot = pGC->patOrg.x + pDrawable->x; yrot = pGC->patOrg.y + pDrawable->y; switch (pGC->fillStyle) { case FillTiled: if (!pGC->tileIsPixel) { int width = pGC->tile.pixmap->drawable.width * PSZ; if ((width <= PGSZ) && !(width & (width - 1))) { cfbCopyRotatePixmap(pGC->tile.pixmap, &devPriv->pRotatedPixmap, xrot, yrot); new_pix = TRUE; } } break; #ifdef FOUR_BIT_CODE case FillStippled: case FillOpaqueStippled: { int width = pGC->stipple->drawable.width; if ((width <= PGSZ) && !(width & (width - 1))) { mfbCopyRotatePixmap(pGC->stipple, &devPriv->pRotatedPixmap, xrot, yrot); new_pix = TRUE; } } break; #endif } if (!new_pix && devPriv->pRotatedPixmap) { (*pGC->pScreen->DestroyPixmap)(devPriv->pRotatedPixmap); devPriv->pRotatedPixmap = (PixmapPtr) NULL; } } if (new_rrop) { int old_rrop; old_rrop = devPriv->rop; devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, pGC->planemask, &devPriv->and, &devPriv->xor); if (old_rrop == devPriv->rop) new_rrop = FALSE; else { #ifdef PIXEL_ADDR new_line = TRUE; #endif #ifdef WriteBitGroup new_text = TRUE; #endif new_fillspans = TRUE; new_fillarea = TRUE; } } if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) { GCOps *newops; if (newops = cfbMatchCommon (pGC, devPriv)) { if (pGC->ops->devPrivate.val) miDestroyGCOps (pGC->ops); pGC->ops = newops; new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; } else { if (!pGC->ops->devPrivate.val) { pGC->ops = miCreateGCOps (pGC->ops); pGC->ops->devPrivate.val = 1; } } } /* deal with the changes we've collected */ if (new_line) { pGC->ops->FillPolygon = miFillPolygon; #ifdef NO_ONE_RECT if (pGC->fillStyle == FillSolid) { switch (devPriv->rop) { case GXcopy: pGC->ops->FillPolygon = cfbFillPoly1RectCopy; break; default: pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; break; } } #else if (devPriv->oneRect && pGC->fillStyle == FillSolid) { switch (devPriv->rop) { case GXcopy: pGC->ops->FillPolygon = cfbFillPoly1RectCopy; break; default: pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; break; } } #endif if (pGC->lineWidth == 0) { #ifdef PIXEL_ADDR if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) { switch (devPriv->rop) { case GXxor: pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor; break; case GXcopy: pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; break; default: pGC->ops->PolyArc = cfbZeroPolyArcSS8General; break; } } else #endif pGC->ops->PolyArc = miZeroPolyArc; } else pGC->ops->PolyArc = miPolyArc; pGC->ops->PolySegment = miPolySegment; switch (pGC->lineStyle) { case LineSolid: if(pGC->lineWidth == 0) { if (pGC->fillStyle == FillSolid) { #if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT) if (devPriv->oneRect && ((pDrawable->x >= pGC->pScreen->width - 32768) && (pDrawable->y >= pGC->pScreen->height - 32768))) { pGC->ops->Polylines = cfb8LineSS1Rect; pGC->ops->PolySegment = cfb8SegmentSS1Rect; } else #endif #ifdef NO_ONE_RECT { pGC->ops->Polylines = cfb8LineSS1Rect; pGC->ops->PolySegment = cfb8SegmentSS1Rect; } #else { pGC->ops->Polylines = cfbLineSS; pGC->ops->PolySegment = cfbSegmentSS; } #endif } else pGC->ops->Polylines = miZeroLine; } else pGC->ops->Polylines = miWideLine; break; case LineOnOffDash: case LineDoubleDash: if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) { pGC->ops->Polylines = cfbLineSD; pGC->ops->PolySegment = cfbSegmentSD; } else pGC->ops->Polylines = miWideDash; break; } } if (new_text && (pGC->font)) { if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0) { pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; pGC->ops->ImageGlyphBlt = miImageGlyphBlt; } else { #ifdef WriteBitGroup if (pGC->fillStyle == FillSolid) { if (devPriv->rop == GXcopy) pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8; else #ifdef FOUR_BIT_CODE pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8; #else pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; #endif } else #endif pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; /* special case ImageGlyphBlt for terminal emulator fonts */ #if !defined(WriteBitGroup) || PSZ == 8 if (TERMINALFONT(pGC->font) && (pGC->planemask & PMSK) == PMSK #ifdef FOUR_BIT_CODE && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB #endif ) { pGC->ops->ImageGlyphBlt = useTEGlyphBlt; } else #endif { #ifdef WriteBitGroup if (devPriv->rop == GXcopy && pGC->fillStyle == FillSolid && (pGC->planemask & PMSK) == PMSK) pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8; else #endif pGC->ops->ImageGlyphBlt = miImageGlyphBlt; } } } if (new_fillspans) { switch (pGC->fillStyle) { case FillSolid: switch (devPriv->rop) { case GXcopy: pGC->ops->FillSpans = cfbSolidSpansCopy; break; case GXxor: pGC->ops->FillSpans = cfbSolidSpansXor; break; default: pGC->ops->FillSpans = cfbSolidSpansGeneral; break; } break; case FillTiled: if (devPriv->pRotatedPixmap) { if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) pGC->ops->FillSpans = cfbTile32FSCopy; else pGC->ops->FillSpans = cfbTile32FSGeneral; } else pGC->ops->FillSpans = cfbUnnaturalTileFS; break; case FillStippled: #ifdef FOUR_BIT_CODE if (devPriv->pRotatedPixmap) pGC->ops->FillSpans = cfb8Stipple32FS; else #endif pGC->ops->FillSpans = cfbUnnaturalStippleFS; break; case FillOpaqueStippled: #ifdef FOUR_BIT_CODE if (devPriv->pRotatedPixmap) pGC->ops->FillSpans = cfb8OpaqueStipple32FS; else #endif pGC->ops->FillSpans = cfbUnnaturalStippleFS; break; default: FatalError("cfbValidateGC: illegal fillStyle\n"); } } /* end of new_fillspans */ if (new_fillarea) { #ifndef FOUR_BIT_CODE pGC->ops->PolyFillRect = miPolyFillRect; if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) { pGC->ops->PolyFillRect = cfbPolyFillRect; } #endif #ifdef FOUR_BIT_CODE pGC->ops->PushPixels = mfbPushPixels; if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy) pGC->ops->PushPixels = cfbPushPixels8; #endif pGC->ops->PolyFillArc = miPolyFillArc; if (pGC->fillStyle == FillSolid) { switch (devPriv->rop) { case GXcopy: pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy; break; default: pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral; break; } } } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbigblt8.c0100664000076400007640000000561207120677563021461 0ustar constconst/* * $XConsortium: cfbigblt8.c,v 1.9 94/04/17 20:28:52 dpw Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfbmskbits.h" #include "cfb8bit.h" void cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; pointer pglyphBase; { ExtentInfoRec info; /* used by QueryGlyphExtents() */ xRectangle backrect; int fillStyle; int alu; int fgPixel; int rop; int xor; int and; int pm; cfbPrivGC *priv; QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); if (info.overallWidth >= 0) { backrect.x = x; backrect.width = info.overallWidth; } else { backrect.x = x + info.overallWidth; backrect.width = -info.overallWidth; } backrect.y = y - FONTASCENT(pGC->font); backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); priv = cfbGetGCPrivate(pGC); /* this code cheats by knowing that ValidateGC isn't * necessary for PolyFillRect */ fgPixel = pGC->fgPixel; pGC->fgPixel = pGC->bgPixel; priv->xor = PFILL(pGC->bgPixel); (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect); pGC->fgPixel = fgPixel; priv->xor = PFILL(pGC->fgPixel); (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbglblt8.c0100664000076400007640000003070607120677563021466 0ustar constconst/* $XConsortium: cfbglblt8.c,v 5.31 94/04/17 20:28:51 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbglblt8.c,v 3.1 1996/08/13 11:27:34 dawes Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode * only. */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "cfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfbmskbits.h" #include "cfb8bit.h" #define BOX_OVERLAP(box1, box2, xoffset, yoffset) \ ((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \ ((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \ (box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \ ((int) (box2)->y1 + (yoffset)) <= (box1)->y2) #define BOX_CONTAINS(box1, box2, xoffset, yoffset) \ ((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \ ((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \ (box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \ ((int) (box2)->y2 + (yoffset)) <= (box1)->y2) #if defined(FOUR_BIT_CODE) || defined(WriteBitGroup) && !defined(GLYPHROP) #if GLYPHPADBYTES != 4 #define USE_LEFTBITS #endif #ifdef USE_LEFTBITS typedef unsigned char *glyphPointer; extern unsigned long endtab[]; #define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \ (dst) &= widthMask; \ (bits) += widthGlyph; #define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \ dst = BitRight (dst, off); #else typedef CARD32 *glyphPointer; #define GlyphBits(bits,width,dst) dst = *bits++; #define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off); #endif #ifdef GLYPHROP #define cfbPolyGlyphBlt8 cfbPolyGlyphRop8 #define cfbPolyGlyphBlt8Clipped cfbPolyGlyphRop8Clipped #undef WriteBitGroup #define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits) #endif static void cfbPolyGlyphBlt8Clipped(); #if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS) #define USE_STIPPLE_CODE #endif #if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS) #ifdef USE_STIPPLE_CODE #undef USE_STIPPLE_CODE #endif #include "stip68kgnu.h" #endif #if PSZ == 24 #define DST_INC 3 #else #define DST_INC (PGSZB >> PWSH) #endif /* cfbStippleStack/cfbStippleStackTE are coded in assembly language. * They are only provided on some architecures. */ #ifdef USE_STIPPLE_CODE extern void cfbStippleStack (), cfbStippleStackTE (); #endif void cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { register unsigned long c; #ifndef GLYPHROP register unsigned long pixel; #endif register unsigned long *dst; register glyphPointer glyphBits; register int xoff; FontPtr pfont = pGC->font; CharInfoPtr pci; unsigned long *dstLine; unsigned long *pdstBase; int hTmp; int bwidthDst; int widthDst; int h; int ew; BoxRec bbox; /* for clipping */ int widthDiff; int w; RegionPtr clip; BoxPtr extents; #ifdef USE_LEFTBITS int widthGlyph; unsigned long widthMask; #endif #ifndef STIPPLE #ifdef USE_STIPPLE_CODE void (*stipple)(); stipple = cfbStippleStack; if (FONTCONSTMETRICS(pfont)) stipple = cfbStippleStackTE; #endif #endif x += pDrawable->x; y += pDrawable->y; /* compute an approximate (but covering) bounding box */ bbox.x1 = 0; if ((ppci[0]->metrics.leftSideBearing < 0)) bbox.x1 = ppci[0]->metrics.leftSideBearing; h = nglyph - 1; w = ppci[h]->metrics.rightSideBearing; while (--h >= 0) w += ppci[h]->metrics.characterWidth; bbox.x2 = w; bbox.y1 = -FONTMAXBOUNDS(pfont,ascent); bbox.y2 = FONTMAXBOUNDS(pfont,descent); clip = cfbGetCompositeClip(pGC); extents = &clip->extents; if (!clip->data) { if (!BOX_CONTAINS(extents, &bbox, x, y)) { if (BOX_OVERLAP (extents, &bbox, x, y)) cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); return; } } else { /* check to make sure some of the text appears on the screen */ if (!BOX_OVERLAP (extents, &bbox, x, y)) return; bbox.x1 += x; bbox.x2 += x; bbox.y1 += y; bbox.y2 += y; switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox)) { case rgnPART: cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); case rgnOUT: return; } } #ifdef GLYPHROP cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); #else pixel = cfbGetGCPrivate(pGC)->xor; #endif cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) widthDst = bwidthDst / PGSZB; while (nglyph--) { pci = *ppci++; glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); xoff = x + pci->metrics.leftSideBearing; #if PSZ == 24 dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3); #else dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH); #endif x += pci->metrics.characterWidth; if (hTmp = pci->metrics.descent + pci->metrics.ascent) { #if PSZ == 24 xoff &= 0x03; #else xoff &= PIM; #endif /* PSZ == 24 */ #ifdef STIPPLE STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); #else #ifdef USE_STIPPLE_CODE (*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); #else #ifdef USE_LEFTBITS w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; widthGlyph = PADGLYPHWIDTHBYTES(w); widthMask = endtab[w]; #endif do { dst = dstLine; dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); dst += DST_INC; c = BitLeft(c,PGSZB - xoff); while (c) { WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst += DST_INC; } } while (--hTmp); #endif /* USE_STIPPLE_CODE else */ #endif /* STIPPLE else */ } } } static void cfbPolyGlyphBlt8Clipped (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ unsigned char *pglyphBase; /* start of array of glyphs */ { register unsigned long c; #ifndef GLYPHROP register unsigned long pixel; #endif register unsigned long *dst; register glyphPointer glyphBits; register int xoff; unsigned long c1; CharInfoPtr pci; FontPtr pfont = pGC->font; unsigned long *dstLine; unsigned long *pdstBase; CARD32 *cTmp, *clips; int maxAscent, maxDescent; int minLeftBearing; int hTmp; int widthDst; int bwidthDst; int ew; int xG, yG; BoxPtr pBox; int numRects; int widthDiff; int w; RegionPtr pRegion; int yBand; #ifdef GLYPHROP unsigned long bits; #endif #ifdef USE_LEFTBITS int widthGlyph; unsigned long widthMask; #endif #ifdef GLYPHROP cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); #else pixel = cfbGetGCPrivate(pGC)->xor; #endif cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, unsigned long) widthDst = bwidthDst / PGSZB; maxAscent = FONTMAXBOUNDS(pfont,ascent); maxDescent = FONTMAXBOUNDS(pfont,descent); minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing); pRegion = cfbGetCompositeClip(pGC); pBox = REGION_RECTS(pRegion); numRects = REGION_NUM_RECTS (pRegion); while (numRects && pBox->y2 <= y - maxAscent) { ++pBox; --numRects; } if (!numRects || pBox->y1 >= y + maxDescent) return; yBand = pBox->y1; while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing) { ++pBox; --numRects; } if (!numRects) return; clips = (CARD32 *)ALLOCATE_LOCAL ((maxAscent + maxDescent) * sizeof (CARD32)); while (nglyph--) { pci = *ppci++; glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; xG = x + pci->metrics.leftSideBearing; yG = y - pci->metrics.ascent; x += pci->metrics.characterWidth; if (hTmp = pci->metrics.descent + pci->metrics.ascent) { #if PSZ == 24 dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3); /* never use (xG*3)>>2 */ #else dstLine = pdstBase + yG * widthDst + (xG >> PWSH); #endif #if PSZ == 24 xoff = xG & 3; #else xoff = xG & PIM; #endif #ifdef USE_LEFTBITS w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; widthGlyph = PADGLYPHWIDTHBYTES(w); widthMask = endtab[w]; #endif switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips)) { case rgnPART: #ifdef USE_LEFTBITS cTmp = clips; do { dst = dstLine; dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) c &= *cTmp++; if (c) { WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); c = BitLeft(c,PGSZB - xoff); dst += DST_INC; while (c) { WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst += DST_INC; } } } while (--hTmp); break; #else /* !USE_LEFT_BITS */ { int h; h = hTmp; do { --h; clips[h] = clips[h] & glyphBits[h]; } while (h); } glyphBits = clips; /* fall through */ #endif /* USE_LEFT_BITS */ case rgnIN: #ifdef STIPPLE STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); #else #ifdef USE_STIPPLE_CODE cfbStippleStackTE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); #else do { dst = dstLine; dstLine = (unsigned long *) (((char *) dstLine) + bwidthDst); GlyphBits(glyphBits, w, c) if (c) { /* This code originally could read memory locations * that were not mapped. Hence we have to check the * trailing bits to see whether they are zero and if * then skip them correctly. This is no problem for * the GXcopy case, since there only the pixels that * are non-zero are written ... */ #ifndef GLYPHROP WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); c = BitLeft(c,PGSZB - xoff); dst += DST_INC; #else /* GLYPHROP */ if (bits = GetBitGroup(BitRight(c,xoff))) WriteBitGroup(dst, pixel, bits); c = BitLeft(c,PGSZB - xoff); dst += DST_INC; while (c && ((bits = GetBitGroup(c)) == 0)) { NextBitGroup(c); dst += DST_INC; } #endif /* GLYPHROP */ while (c) { WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst += DST_INC; } } } while (--hTmp); #endif /* USE_STIPPLE_CODE else */ #endif /* STIPPLE else */ break; } } } DEALLOCATE_LOCAL (clips); } #endif /* FOUR_BIT_CODE */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbpixmap.c0100664000076400007640000002504007120677563021563 0ustar constconst/* $XConsortium: cfbpixmap.c,v 5.14 94/04/17 20:28:56 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* pixmap management written by drewry, september 1986 on a monchrome device, a pixmap is a bitmap. */ #include "Xmd.h" #include "servermd.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "mi.h" #include "cfb.h" #include "cfbmskbits.h" extern unsigned long endtab[]; PixmapPtr cfbCreatePixmap (pScreen, width, height, depth) ScreenPtr pScreen; int width; int height; int depth; { PixmapPtr pPixmap; int datasize; int paddedWidth; paddedWidth = PixmapBytePad(width, depth); datasize = height * paddedWidth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) return NullPixmap; pPixmap->drawable.type = DRAWABLE_PIXMAP; pPixmap->drawable.class = 0; pPixmap->drawable.pScreen = pScreen; pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth); pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; #ifdef PIXPRIV pPixmap->devPrivate.ptr = datasize ? (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL; #else pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1); #endif return pPixmap; } Bool cfbDestroyPixmap(pPixmap) PixmapPtr pPixmap; { if(--pPixmap->refcnt) return TRUE; xfree(pPixmap); return TRUE; } PixmapPtr cfbCopyPixmap(pSrc) register PixmapPtr pSrc; { register PixmapPtr pDst; int size; ScreenPtr pScreen; size = pSrc->drawable.height * pSrc->devKind; pScreen = pSrc->drawable.pScreen; pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width, pSrc->drawable.height, pSrc->drawable.depth); if (!pDst) return NullPixmap; memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size); return pDst; } /* replicates a pattern to be a full 32 bits wide. relies on the fact that each scnaline is longword padded. doesn't do anything if pixmap is not a factor of 32 wide. changes width field of pixmap if successful, so that the fast cfbXRotatePixmap code gets used if we rotate the pixmap later. cfbYRotatePixmap code gets used if we rotate the pixmap later. calculate number of times to repeat for each scanline of pattern zero out area to be filled with replicate left shift and or in original as many times as needed */ void cfbPadPixmap(pPixmap) PixmapPtr pPixmap; { register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel); register int h; register unsigned long mask; register unsigned long *p; register unsigned long bits; /* real pattern bits */ register int i; int rep; /* repeat count for pattern */ if (width >= PGSZ) return; rep = PGSZ/width; if (rep*width != PGSZ) return; mask = endtab[width]; p = (unsigned long *)(pPixmap->devPrivate.ptr); for (h=0; h < pPixmap->drawable.height; h++) { *p &= mask; bits = *p; for(i=1; i>= width; #else bits <<= width; #endif *p |= bits; } p++; } pPixmap->drawable.width = PGSZ/(pPixmap->drawable.bitsPerPixel); } #ifdef notdef /* * cfb debugging routine -- assumes pixmap is 1 byte deep */ static cfbdumppixmap(pPix) PixmapPtr pPix; { unsigned int *pw; char *psrc, *pdst; int i, j; char line[66]; ErrorF( "pPixmap: 0x%x\n", pPix); ErrorF( "%d wide %d high\n", pPix->drawable.width, pPix->drawable.height); if (pPix->drawable.width > 64) { ErrorF( "too wide to see\n"); return; } pw = (unsigned int *) pPix->devPrivate.ptr; psrc = (char *) pw; /* for ( i=0; idrawable.height; ++i ) ErrorF( "0x%x\n", pw[i] ); */ for ( i = 0; i < pPix->drawable.height; ++i ) { pdst = line; for(j = 0; j < pPix->drawable.width; j++) { *pdst++ = *psrc++ ? 'X' : ' ' ; } *pdst++ = '\n'; *pdst++ = '\0'; ErrorF( "%s", line); } } #endif /* notdef */ /* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that * words are PGSZ bits wide, and that the least significant bit appears on the * left. */ void cfbXRotatePixmap(pPix, rw) PixmapPtr pPix; register int rw; { register unsigned long *pw, *pwFinal; register unsigned long t; int rot; if (pPix == NullPixmap) return; switch (((DrawablePtr) pPix)->bitsPerPixel) { case PSZ: break; case 1: mfbXRotatePixmap(pPix, rw); return; default: ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel); return; } pw = (unsigned long *)pPix->devPrivate.ptr; modulus (rw, (int) pPix->drawable.width, rot); if(pPix->drawable.width == PPW) { pwFinal = pw + pPix->drawable.height; while(pw < pwFinal) { t = *pw; *pw++ = SCRRIGHT(t, rot) | (SCRLEFT(t, (PPW-rot)) & cfbendtab[rot]); } } else { ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n"); #ifdef notdef register unsigned long *pwTmp; int size, tsize; tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth); pwTmp = (unsigned long *) ALLOCATE_LOCAL(pPix->drawable.height * tsize); if (!pwTmp) return; /* divide pw (the pixmap) in two vertically at (w - rot) and swap */ tsize >>= 2; size = pPix->devKind >> SIZE0F(PixelGroup); cfbQuickBlt((long *)pw, (long *)pwTmp, 0, 0, 0, 0, (int)pPix->drawable.width - rot, (int)pPix->drawable.height, size, tsize); cfbQuickBlt((long *)pw, (long *)pw, (int)pPix->drawable.width - rot, 0, 0, 0, rot, (int)pPix->drawable.height, size, size); cfbQuickBlt((long *)pwTmp, (long *)pw, 0, 0, rot, 0, (int)pPix->drawable.width - rot, (int)pPix->drawable.height, tsize, size); DEALLOCATE_LOCAL(pwTmp); #endif } } /* Rotates pixmap pPix by h lines. Assumes that h is always less than pPix->drawable.height works on any width. */ void cfbYRotatePixmap(pPix, rh) register PixmapPtr pPix; int rh; { int nbyDown; /* bytes to move down to row 0; also offset of row rh */ int nbyUp; /* bytes to move up to line rh; also offset of first line moved down to 0 */ char *pbase; char *ptmp; int rot; if (pPix == NullPixmap) return; switch (((DrawablePtr) pPix)->bitsPerPixel) { case PSZ: break; case 1: mfbYRotatePixmap(pPix, rh); return; default: ErrorF("cfbYRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel); return; } modulus (rh, (int) pPix->drawable.height, rot); pbase = (char *)pPix->devPrivate.ptr; nbyDown = rot * pPix->devKind; nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown; if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp))) return; memmove(ptmp, pbase, nbyUp); /* save the low rows */ memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */ DEALLOCATE_LOCAL(ptmp); } void cfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot) register PixmapPtr psrcPix, *ppdstPix; int xrot, yrot; { register PixmapPtr pdstPix; if ((pdstPix = *ppdstPix) && (pdstPix->devKind == psrcPix->devKind) && (pdstPix->drawable.height == psrcPix->drawable.height)) { memmove((char *)pdstPix->devPrivate.ptr, (char *)psrcPix->devPrivate.ptr, psrcPix->drawable.height * psrcPix->devKind); pdstPix->drawable.width = psrcPix->drawable.width; pdstPix->drawable.depth = psrcPix->drawable.depth; pdstPix->drawable.bitsPerPixel = psrcPix->drawable.bitsPerPixel; pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; } else { if (pdstPix) /* FIX XBUG 6168 */ (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix); *ppdstPix = pdstPix = cfbCopyPixmap(psrcPix); if (!pdstPix) return; } cfbPadPixmap(pdstPix); if (xrot) cfbXRotatePixmap(pdstPix, xrot); if (yrot) cfbYRotatePixmap(pdstPix, yrot); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbply1rct.c0100664000076400007640000001733007120677563021666 0ustar constconst/* * $XConsortium: cfbply1rct.c /main/16 1996/08/12 22:07:31 dpw $ * $XFree86: xc/programs/Xserver/cfb/cfbply1rct.c,v 3.3 1996/12/23 06:29:21 dawes Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "mistruct.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfbrrop.h" void RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) DrawablePtr pDrawable; GCPtr pGC; int shape; int mode; int count; DDXPointPtr ptsIn; { cfbPrivGCPtr devPriv; int nwidth; unsigned long *addrl, *addr; #if PSZ == 24 unsigned long startmask, endmask; register int pidx; #endif int maxy; int origin; register int vertex1, vertex2; int c; BoxPtr extents; int clip; int y; int *vertex1p, *vertex2p; int *endp; int x1, x2; int dx1, dx2; int dy1, dy2; int e1, e2; int step1, step2; int sign1, sign2; int h; int l, r; unsigned long mask, bits = ~((unsigned long)0); int nmiddle; RROP_DECLARE if (mode == CoordModePrevious) { miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); return; } devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) { miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); return; } #endif origin = *((int *) &pDrawable->x); vertex2 = origin - ((origin & 0x8000) << 1); extents = &devPriv->pCompositeClip->extents; RROP_FETCH_GCPRIV(devPriv); vertex1 = *((int *) &extents->x1) - vertex2; vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001; clip = 0; y = 32767; maxy = 0; vertex2p = (int *) ptsIn; endp = vertex2p + count; if (shape == Convex) { while (count--) { c = *vertex2p; clip |= (c - vertex1) | (vertex2 - c); c = intToY(c); if (c < y) { y = c; vertex1p = vertex2p; } vertex2p++; if (c > maxy) maxy = c; } } else { int yFlip = 0; dx1 = 1; x2 = -1; x1 = -1; while (count--) { c = *vertex2p; clip |= (c - vertex1) | (vertex2 - c); c = intToY(c); if (c < y) { y = c; vertex1p = vertex2p; } vertex2p++; if (c > maxy) maxy = c; if (c == x1) continue; if (dx1 > 0) { if (x2 < 0) x2 = c; else dx2 = dx1 = (c - x1) >> 31; } else if ((c - x1) >> 31 != dx1) { dx1 = ~dx1; yFlip++; } x1 = c; } x1 = (x2 - c) >> 31; if (x1 != dx1) yFlip++; if (x1 != dx2) yFlip++; if (yFlip != 2) clip = 0x8000; } if (y == maxy) return; if (clip & 0x80008000) { miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn); return; } #define AddrYPlus(a,y) (unsigned long *) (((unsigned char *) (a)) + (y) * nwidth) cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, unsigned long); addrl = AddrYPlus(addrl,y + pDrawable->y); origin = intToX(origin); vertex2p = vertex1p; vertex2 = vertex1 = *vertex2p++; if (vertex2p == endp) vertex2p = (int *) ptsIn; #define Setup(c,x,vertex,dx,dy,e,sign,step) {\ x = intToX(vertex); \ if (dy = intToY(c) - y) { \ dx = intToX(c) - x; \ step = 0; \ if (dx >= 0) \ { \ e = 0; \ sign = 1; \ if (dx >= dy) {\ step = dx / dy; \ dx = dx % dy; \ } \ } \ else \ { \ e = 1 - dy; \ sign = -1; \ dx = -dx; \ if (dx >= dy) { \ step = - (dx / dy); \ dx = dx % dy; \ } \ } \ } \ x += origin; \ vertex = c; \ } #define Step(x,dx,dy,e,sign,step) {\ x += step; \ if ((e += dx) > 0) \ { \ x += sign; \ e -= dy; \ } \ } for (;;) { if (y == intToY(vertex1)) { do { if (vertex1p == (int *) ptsIn) vertex1p = endp; c = *--vertex1p; Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1) } while (y >= intToY(vertex1)); h = dy1; } else { Step(x1,dx1,dy1,e1,sign1,step1) h = intToY(vertex1) - y; } if (y == intToY(vertex2)) { do { c = *vertex2p++; if (vertex2p == endp) vertex2p = (int *) ptsIn; Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) } while (y >= intToY(vertex2)); if (dy2 < h) h = dy2; } else { Step(x2,dx2,dy2,e2,sign2,step2) if ((c = (intToY(vertex2) - y)) < h) h = c; } /* fill spans for this segment */ y += h; for (;;) { l = x1; r = x2; nmiddle = x2 - x1; if (nmiddle < 0) { nmiddle = -nmiddle; l = x2; r = x1; } #if PPW > 1 c = l & PIM; l -= c; #endif #if PGSZ == 32 #define LWRD_SHIFT 2 #else /* PGSZ == 64 */ #define LWRD_SHIFT 3 #endif /* PGSZ */ #if PSZ == 24 addr = (unsigned long *)((char *)addrl + ((l * 3) & ~0x03)); #else /* PSZ == 24 */ #if PWSH > LWRD_SHIFT l = l >> (PWSH - LWRD_SHIFT); #endif #if PWSH < LWRD_SHIFT l = l << (LWRD_SHIFT - PWSH); #endif addr = (unsigned long *) (((char *) addrl) + l); #endif /* PSZ == 24 */ #if PSZ == 24 if (nmiddle <= 1){ if (nmiddle) RROP_SOLID24(addr, l); } else { maskbits(l, nmiddle, startmask, endmask, nmiddle); pidx = l & 3; if (startmask){ RROP_SOLID_MASK(addr, startmask, pidx-1); addr++; if (pidx == 3) pidx = 0; } while (--nmiddle >= 0){ RROP_SOLID(addr, pidx); addr++; if (++pidx == 3) pidx = 0; } if (endmask) RROP_SOLID_MASK(addr, endmask, pidx); } #else /* PSZ == 24 */ #if PPW > 1 if (c + nmiddle < PPW) { mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle); RROP_SOLID_MASK(addr,mask); } else { if (c) { mask = SCRRIGHT(bits, c); RROP_SOLID_MASK(addr,mask); nmiddle += c - PPW; addr++; } #endif nmiddle >>= PWSH; while (--nmiddle >= 0) { RROP_SOLID(addr); addr++; } #if PPW > 1 if (mask = ~SCRRIGHT(bits, r & PIM)) RROP_SOLID_MASK(addr,mask); } #endif #endif /* PSZ == 24 */ if (!--h) break; addrl = AddrYPlus (addrl, 1); Step(x1,dx1,dy1,e1,sign1,step1) Step(x2,dx2,dy2,e2,sign2,step2) } if (y == maxy) break; addrl = AddrYPlus (addrl, 1); } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbtile32.c0100664000076400007640000003027107712143416021361 0ustar constconst/* * Fill 32 bit tiled rectangles. Used by both PolyFillRect and PaintWindow. * no depth dependencies. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfbtile32.c,v 1.8 94/04/17 20:29:05 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbtile32.c,v 3.0 1996/06/29 09:05:53 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #include "mergerop.h" #include "mi.h" #include "mispans.h" #ifdef sparc #define SHARED_IDCACHE #endif #if PSZ == 24 #define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) /*#define STORE24(p,index) {\ register int idx = ((index) & 3)<< 1; \ *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<>cfb24Shift[idx])&cfbmask[idx])| \ (*(p)&cfbrmask[idx])); \ (p)--; \ }*/ #define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index) #define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask))) #define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \ (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p)))) /* XXX TJR: I doubt that this optimised case works (because the non-24 bit case was broken), so I've added the #if 0 below. Someone who knows what they're doing can re-enable it if they fix it */ #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) && 0 # define Expand(left,right) {\ int part = nlwMiddle & ((PGSZB*2)-1); \ nlwMiddle *= 3; \ nlwMiddle >>= PWSH + 3; \ while (h--) { \ srcpix = psrc[srcy]; \ MROP_PREBUILD(srcpix); \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; \ left \ p += part; \ switch (part) { \ case 7: \ STORE24(p - 7, xtmp - 7); \ case 6: \ STORE24(p - 6, xtmp - 6); \ case 5: \ STORE24(p - 5, xtmp - 5); \ case 4: \ STORE24(p - 4, xtmp - 4); \ case 3: \ STORE24(p - 3, xtmp - 3); \ case 2: \ STORE24(p - 2, xtmp - 2); \ case 1: \ STORE24(p - 1, xtmp - 1); \ } \ nlw = nlwMiddle; \ while (nlw) { \ STORE24 (p + 0, xtmp + 0); \ STORE24 (p + 1, xtmp + 1); \ STORE24 (p + 2, xtmp + 2); \ STORE24 (p + 3, xtmp + 3); \ STORE24 (p + 4, xtmp + 4); \ STORE24 (p + 5, xtmp + 5); \ STORE24 (p + 6, xtmp + 6); \ STORE24 (p + 7, xtmp + 7); \ p += 8; \ xtmp += 8; \ nlw--; \ } \ right \ p += nlwExtra; \ } \ } #else #define Expand(left,right) {\ while (h--) { \ srcpix = psrc[srcy]; \ MROP_PREBUILD(srcpix); \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; \ left \ while (nlw--) \ { \ STORE24(p,xtmp); \ if(xtmp&3) p++; \ xtmp++; \ } \ right \ p += nlwExtra; \ } \ } #endif #else /*PSZ != 24*/ #define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) #if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) # define Expand(left,right) {\ int part = nlwMiddle & 7; \ nlwMiddle >>= 3; \ while (h--) { \ srcpix = psrc[srcy]; \ MROP_PREBUILD(srcpix); \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; \ left \ p += part; \ switch (part) { \ case 7: \ STORE(p - 7); \ case 6: \ STORE(p - 6); \ case 5: \ STORE(p - 5); \ case 4: \ STORE(p - 4); \ case 3: \ STORE(p - 3); \ case 2: \ STORE(p - 2); \ case 1: \ STORE(p - 1); \ } \ nlw = nlwMiddle; \ while (nlw) { \ STORE (p + 0); \ STORE (p + 1); \ STORE (p + 2); \ STORE (p + 3); \ STORE (p + 4); \ STORE (p + 5); \ STORE (p + 6); \ STORE (p + 7); \ p += 8; \ nlw--; \ } \ right \ p += nlwExtra; \ } \ } #else #define Expand(left,right) {\ while (h--) { \ srcpix = psrc[srcy]; \ MROP_PREBUILD(srcpix); \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; \ left \ nlw = nlwMiddle; \ while (nlw--) \ { \ STORE(p); \ p++; \ } \ right \ p += nlwExtra; \ } \ } #endif #endif /*PSZ == 24*/ void MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; /* number of boxes to fill */ BoxPtr pBox; /* pointer to list of boxes to fill */ { register unsigned long srcpix; unsigned long *psrc; /* pointer to bits in tile, if needed */ int tileHeight; /* height of the tile */ int nlwDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ register int h; /* height of current box */ register unsigned long startmask; register unsigned long endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwExtra; /* to get from right of box to left of next span */ register int nlw; /* loop version of nlwMiddle */ register unsigned long *p; /* pointer to bits we're writing */ int y; /* current scan line */ int srcy; /* current tile position */ unsigned long *pbits;/* pointer to start of pixmap */ PixmapPtr tile; /* rotated, expanded tile */ MROP_DECLARE_REG() MROP_PREBUILT_DECLARE() #if PSZ == 24 unsigned long xtmp; #endif tile = cfbGetGCPrivate(pGC)->pRotatedPixmap; tileHeight = tile->drawable.height; psrc = (unsigned long *)tile->devPrivate.ptr; MROP_INITIALIZE(pGC->alu, pGC->planemask); cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) while (nBox--) { w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; #if PSZ == 24 xtmp = pBox->x1; p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2); /* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/ #else p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH); #endif srcy = y % tileHeight; #if PSZ == 24 if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3)) #else if ( ((pBox->x1 & PIM) + w) <= PPW) #endif { maskpartialbits(pBox->x1, w, startmask); nlwExtra = nlwDst; while (h--) { srcpix = psrc[srcy]; MROP_PREBUILD(srcpix); ++srcy; if (srcy == tileHeight) srcy = 0; *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); p += nlwExtra; } } else { maskbits(pBox->x1, w, startmask, endmask, nlwMiddle); nlwExtra = nlwDst - nlwMiddle; if (startmask) { nlwExtra -= 1; if (endmask) { Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;, *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) } else { Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;, ;) } } else { if (endmask) { Expand(;, *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) } else { Expand(;, ;) } } } pBox++; } } void MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidth;/* pointer to list of n widths */ unsigned long *pbits; /* pointer to start of bitmap */ int nlwDst; /* width in longwords of bitmap */ register unsigned long *p; /* pointer to current longword in bitmap */ register int w; /* current span width */ register int nlw; register int x; register unsigned long startmask; register unsigned long endmask; register unsigned long srcpix; int y; int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; PixmapPtr tile; unsigned long *psrc; /* pointer to bits in tile */ int tileHeight;/* height of the tile */ MROP_DECLARE_REG () MROP_PREBUILT_DECLARE() #if PSZ == 24 unsigned long xtmp; #endif n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans( cfbGetCompositeClip(pGC), pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); tile = cfbGetGCPrivate(pGC)->pRotatedPixmap; tileHeight = tile->drawable.height; psrc = (unsigned long *)tile->devPrivate.ptr; MROP_INITIALIZE(pGC->alu, pGC->planemask); cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) #if MROP == Mcopy if (!(tileHeight & (tileHeight-1))) { tileHeight--; while (n--) { x = ppt->x; y = ppt->y; ++ppt; w = *pwidth++; #if PSZ == 24 /* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/ xtmp = x; p = pbits + (y * nlwDst) + ((x >> 2)*3); #else p = pbits + (y * nlwDst) + (x >> PWSH); #endif srcpix = psrc[y & tileHeight]; MROP_PREBUILD(srcpix); #if PSZ == 24 if ((x & 3) + w < 5) #else if ((x & PIM) + w < PPW) #endif { maskpartialbits(x, w, startmask); *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); } else { maskbits(x, w, startmask, endmask, nlw); if (startmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); #if PSZ == 24 if(xtmp&3) p++; xtmp++; #else p++; #endif } while (nlw--) { #if PSZ == 24 STORE24(p,xtmp); if(xtmp&3) p++; ++xtmp; #else STORE(p); ++p; #endif } if (endmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); } } } } else #endif { while (n--) { x = ppt->x; y = ppt->y; ++ppt; w = *pwidth++; #if PSZ == 24 /* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/ p = pbits + (y * nlwDst) + ((x >> 2)*3); xtmp = x; #else p = pbits + (y * nlwDst) + (x >> PWSH); #endif srcpix = psrc[y % tileHeight]; MROP_PREBUILD(srcpix); #if PSZ == 24 if ((x & 3) + w < 5) #else if ((x & PIM) + w < PPW) #endif { maskpartialbits(x, w, startmask); *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); } else { maskbits(x, w, startmask, endmask, nlw); if (startmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); #if PSZ == 24 if(xtmp&3)p++; xtmp++; #else p++; #endif } while (nlw--) { #if PSZ == 24 STORE24(p,xtmp); if(xtmp&3)p++; xtmp++; #else STORE(p); ++p; #endif } if (endmask) { *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); } } } } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbhrzvert.c0100664000076400007640000003156607120677563022003 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: cfbhrzvert.c,v 1.8 94/04/17 20:28:51 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbhrzvert.c,v 3.2 1996/11/24 09:51:43 dawes Exp $ */ #include "X.h" #include "gc.h" #include "window.h" #include "pixmap.h" #include "region.h" #include "cfb.h" #include "cfbmskbits.h" /* horizontal solid line abs(len) > 1 */ cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len) register int rop; register unsigned long and; register unsigned long xor; register unsigned long *addrl; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int x1; /* initial point */ int y1; int len; /* length of line */ { register int nlmiddle; register unsigned long startmask; register unsigned long endmask; #if PSZ == 24 int leftIndex, rightIndex, xOffset; unsigned long piQxelAnd[3], piQxelXor[3]; piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000); piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000); piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF); piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000); piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000); piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF); leftIndex = x1 & 3; rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3; nlmiddle = len; if(leftIndex){ nlmiddle -= (4 - leftIndex); } if(rightIndex){ nlmiddle -= rightIndex; } if (nlmiddle < 0) nlmiddle = 0; nlmiddle >>= 2; addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0); switch(leftIndex+len){ case 4: switch(leftIndex){ case 0: *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); break; case 1: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); break; case 2: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); break; case 3: *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); break; } break; case 3: switch(leftIndex){ case 0: *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); break; case 1: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); break; case 2: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); break; } break; case 2: if(leftIndex){ *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); } else{ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); } *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); break; case 1: /*only if leftIndex = 0 and w = 1*/ *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); break; case 0: /*never*/ break; default: { if (rop == GXcopy){ switch(leftIndex){ case 0: break; case 1: *addrl++ = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrl++ = piQxelXor[1]; *addrl++ = piQxelXor[2]; break; case 2: *addrl++ = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *addrl++ = piQxelXor[2]; break; case 3: *addrl++ = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); break; } while(nlmiddle--){ *addrl++ = piQxelXor[0]; *addrl++ = piQxelXor[1]; *addrl++ = piQxelXor[2]; } switch(rightIndex){ case 0: break; case 1: *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); break; case 2: *addrl++ = piQxelXor[0]; *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); break; case 3: *addrl++ = piQxelXor[0]; *addrl++ = piQxelXor[1]; *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; } } else{ if(rop == GXxor){ switch(leftIndex){ case 0: break; case 1: *addrl++ ^= (piQxelXor[0]&0xFF000000); *addrl++ ^= piQxelXor[1]; *addrl++ ^= piQxelXor[2]; break; case 2: *addrl++ ^= (piQxelXor[1]& 0xFFFF0000); *addrl++ ^= piQxelXor[2]; break; case 3: *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00); break; } while(nlmiddle--){ *addrl++ ^= piQxelXor[0]; *addrl++ ^= piQxelXor[1]; *addrl++ ^= piQxelXor[2]; } switch(rightIndex){ case 0: break; case 1: *addrl ^= (piQxelXor[0]& 0xFFFFFF); break; case 2: *addrl++ ^= piQxelXor[0]; *addrl ^= (piQxelXor[1]&0xFFFF); break; case 3: *addrl++ ^= piQxelXor[0]; *addrl++ ^= piQxelXor[1]; *addrl ^= (piQxelXor[2]&0xFF); break; } } else{ switch(leftIndex){ case 0: break; case 1: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); break; case 2: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); break; case 3: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); break; } while(nlmiddle--){ *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl++ = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); } switch(rightIndex){ case 0: break; case 1: *addrl++ = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); break; case 2: *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); break; case 3: *addrl++ = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); *addrl++ = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); break; } } } } } #else addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); /* all bits inside same longword */ if ( ((x1 & PIM) + len) < PPW) { maskpartialbits(x1, len, startmask); *addrl = DoMaskRRop (*addrl, and, xor, startmask); } else { maskbits(x1, len, startmask, endmask, nlmiddle); if (rop == GXcopy) { if (startmask) { *addrl = (*addrl & ~startmask) | (xor & startmask); addrl++; } while (nlmiddle--) *addrl++ = xor; if (endmask) *addrl = (*addrl & ~endmask) | (xor & endmask); } else { if (startmask) { *addrl = DoMaskRRop (*addrl, and, xor, startmask); addrl++; } if (rop == GXxor) { while (nlmiddle--) *addrl++ ^= xor; } else { while (nlmiddle--) { *addrl = DoRRop (*addrl, and, xor); addrl++; } } if (endmask) *addrl = DoMaskRRop (*addrl, and, xor, endmask); } } #endif } /* vertical solid line */ void cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len) int rop; register unsigned long and, xor; register unsigned long *addrl; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int x1, y1; /* initial point */ register int len; /* length of line */ { #if PSZ == 24 int xIdx; unsigned long and2, xor2, offset, mask, mask2; #endif #ifdef PIXEL_ADDR register PixelType *bits = (PixelType *) addrl; #if PSZ == 24 nlwidth <<= PWSH; xIdx = x1 & 3; bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2)); #else nlwidth <<= PWSH; bits = bits + (y1 * nlwidth) + x1; #endif #if PSZ == 24 mask2 = 0; switch(xIdx){ case 0: mask = 0xFF000000; xor &= 0xFFFFFF; and |= 0xFF000000; break; case 3: mask = 0xFF; xor &= 0xFFFFFF; xor <<= 8; and <<= 8; and |= 0xFF; break; case 1: mask = 0xFFFFFF; mask2 = 0xFFFF0000; xor2 = (xor>>8) & 0xFFFF; xor &= 0xFF; xor <<= 24; and2 = (and >> 8 ) | 0xFFFF0000; and <<= 24; and |= 0xFFFFFF; break; case 2: mask = 0x0000FFFF; mask2 = 0xFFFFFF00; xor2 = (xor >> 16) & 0xFF; xor <<= 16; xor &= 0xFFFF0000; and2 = (and >> 16) | 0xFFFFFF00; and <<= 16; and |= 0xFFFF; break; } #endif /* * special case copy and xor to avoid a test per pixel */ if (rop == GXcopy) { #if PSZ == 24 switch(xIdx){ case 0: case 3: while (len--){ *bits = (*bits & mask)| xor; bits += nlwidth; } break; case 1: case 2: while (len--){ *bits = (*bits & mask)| xor; bits++; *bits = (*bits & mask2)| xor2; bits--; bits += nlwidth; } break; } #else while (len--) { *bits = xor; bits += nlwidth; } #endif } else if (rop == GXxor) { #if PSZ == 24 switch(xIdx){ case 0: case 3: while (len--){ *bits ^= xor; bits += nlwidth; } break; case 1: case 2: while (len--){ *bits ^= xor; bits++; *bits ^= xor2; bits--; bits += nlwidth; } break; } #else while (len--) { *bits ^= xor; bits += nlwidth; } #endif } else { #if PSZ == 24 switch(xIdx){ case 0: while (len--){ *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF); bits += nlwidth; } break; case 3: while (len--){ *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00); bits += nlwidth; } break; case 1: while (len--){ *bits = DoMaskRRop(*bits, and, xor, 0xFF000000); bits++; *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF); bits--; bits += nlwidth; } break; case 2: while (len--){ *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000); bits++; *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF); bits--; bits += nlwidth; } break; } #else while (len--) { *bits = DoRRop(*bits, and, xor); bits += nlwidth; } #endif } #else /* !PIXEL_ADDR */ #if PSZ == 24 addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2); and |= ~cfbmask[(x1 & 3)<<1]; xor &= cfbmask[(x1 & 3)<<1]; #else addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); and |= ~cfbmask[x1 & PIM]; xor &= cfbmask[x1 & PIM]; #endif while (len--) { *addrl = DoRRop (*addrl, and, xor); addrl += nlwidth; } #endif } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbpolypnt.c0100664000076400007640000001325007120677563021772 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: cfbpolypnt.c,v 5.17 94/04/17 20:28:57 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbpolypnt.c,v 3.0 1996/06/29 09:05:47 dawes Exp $ */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" #define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask) /* WARNING: pbox contains two shorts. This code assumes they are packed * and can be referenced together as an INT32. */ #define PointLoop(fill) { \ for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \ --nbox >= 0; \ pbox++) \ { \ c1 = *((INT32 *) &pbox->x1) - off; \ c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \ for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \ { \ pt = *ppt++; \ if (!isClipped(pt,c1,c2)) { \ fill \ } \ } \ } \ } #if PSZ == 24 # include "cfbrrop24.h" #endif void cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; xPoint *pptInit; { register INT32 pt; register INT32 c1, c2; register unsigned long ClipMask = 0x80008000; register unsigned long xor; #ifdef PIXEL_ADDR register PixelType *addrp; register int npwidth; PixelType *addrpt; #else register unsigned long *addrl; register int nlwidth; register int xoffset; unsigned long *addrlt; #endif #if PSZ == 24 RROP_DECLARE register int xtmp; register PixelType *p; #endif register INT32 *ppt; RegionPtr cclip; int nbox; register int i; register BoxPtr pbox; unsigned long and; int rop = pGC->alu; int off; cfbPrivGCPtr devPriv; xPoint *pptPrev; devPriv =cfbGetGCPrivate(pGC); rop = devPriv->rop; if (rop == GXnoop) return; cclip = devPriv->pCompositeClip; xor = devPriv->xor; if ((mode == CoordModePrevious) && (npt > 1)) { for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++) { pptPrev->x += (pptPrev-1)->x; pptPrev->y += (pptPrev-1)->y; } } off = *((int *) &pDrawable->x); off -= (off & 0x8000) << 1; #ifdef PIXEL_ADDR cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp); #if PSZ == 24 addrp = addrp + pDrawable->y * npwidth; #else addrp = addrp + pDrawable->y * npwidth + pDrawable->x; #endif if (rop == GXcopy) { #if PSZ == 24 RROP_COPY_SETUP(xor) #endif if (!(npwidth & (npwidth - 1))) { npwidth = ffs(npwidth) - 1; #if PSZ == 24 PointLoop( xtmp = pDrawable->x + intToX(pt); p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2); RROP_SOLID24_COPY(p, xtmp)) #else PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;) #endif } #ifdef sun else if (npwidth == 1152) { register int y; PointLoop(y = intToY(pt); *(addrp + (y << 10) + (y << 7) + intToX(pt)) = xor;) } #endif else { #if PSZ == 24 PointLoop( xtmp = pDrawable->x + intToX(pt); p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); RROP_SOLID24_COPY(p, xtmp)) #else PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;) #endif } } else { and = devPriv->and; #if PSZ == 24 RROP_SET_SETUP(xor, and) PointLoop( xtmp = pDrawable->x + intToX(pt); p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); RROP_SOLID24_SET(p, xtmp)) #else PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt); *addrpt = DoRRop (*addrpt, and, xor);) #endif } #else /* !PIXEL_ADDR */ cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl); addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH); xoffset = pDrawable->x & PIM; and = devPriv->and; #if PSZ == 24 PointLoop( addrlt = addrl + intToY(pt) * nlwidth + ((intToX(pt) + xoffset) >> PWSH); *addrlt = DoRRop (*addrlt, and | ~cfbmask[(intToX(pt) + xoffset) & PIM], xor & cfbmask[(intToX(pt) + xoffset) & PIM]); ) #else PointLoop( addrlt = addrl + intToY(pt) * nlwidth + ((intToX(pt) + xoffset) >> PWSH); *addrlt = DoRRop (*addrlt, and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1], xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]); ) #endif #endif /* PIXEL_ADDR */ } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbrctstp8.c0100664000076400007640000003410307120677563021674 0ustar constconst/* * Fill 32 bit stippled rectangles for 8 bit frame buffers */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Keith Packard, MIT X Consortium */ /* $XConsortium: cfbrctstp8.c,v 1.17 94/04/17 20:28:59 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbrctstp8.c,v 3.0 1996/12/09 11:50:55 dawes Exp $ */ #if PSZ == 8 #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #define MFB_CONSTS_ONLY #include "maskbits.h" void cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; /* number of boxes to fill */ register BoxPtr pBox; /* pointer to list of boxes to fill */ { unsigned long *src; int stippleHeight; int nlwDst; /* width in longwords of the dest pixmap */ int w; /* width of current box */ register int h; /* height of current box */ unsigned long startmask; unsigned long endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ register int nlw; /* loop version of nlwMiddle */ unsigned long *dstLine; register unsigned long *dst; /* pointer to bits we're writing */ unsigned long *dstTmp; int y; /* current scan line */ unsigned long *pbits;/* pointer to start of pixmap */ register unsigned long bits; /* bits from stipple */ int rot, lastStop, i; register unsigned long xor, and; cfbPrivGCPtr devPriv; PixmapPtr stipple; int wEnd; devPriv = cfbGetGCPrivate(pGC); stipple = devPriv->pRotatedPixmap; cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); stippleHeight = stipple->drawable.height; src = (unsigned long *)stipple->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) while (nBox--) { w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH); if (((pBox->x1 & PIM) + w) <= PPW) { maskpartialbits(pBox->x1, w, startmask); nlwMiddle = 0; endmask = 0; } else { maskbits (pBox->x1, w, startmask, endmask, nlwMiddle); } rot = (pBox->x1 & ((PGSZ-1) & ~PIM)); pBox++; y = y % stippleHeight; #if PPW == 4 if (cfb8StippleRRop == GXcopy) { if (w < PGSZ*2) { while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot) RotBitsLeft(bits,rot); dst = dstLine; dstLine += nlwDst; if (startmask) { *dst = *dst & ~startmask | GetPixelGroup (bits) & startmask; dst++; RotBitsLeft (bits, PGSZB); } nlw = nlwMiddle; while (nlw--) { *dst++ = GetPixelGroup(bits); RotBitsLeft (bits, PGSZB); } if (endmask) { *dst = *dst & ~endmask | GetPixelGroup (bits) & endmask; } } } else { wEnd = 7 - (nlwMiddle & 7); nlwMiddle = (nlwMiddle >> 3) + 1; while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot != 0) RotBitsLeft (bits, rot); dstTmp = dstLine; dstLine += nlwDst; if (startmask) { *dstTmp = *dstTmp & ~startmask | GetPixelGroup (bits) & startmask; dstTmp++; RotBitsLeft (bits, PGSZB); } w = 7 - wEnd; while (w--) { nlw = nlwMiddle; dst = dstTmp; dstTmp++; xor = GetPixelGroup (bits); while (nlw--) { *dst = xor; dst += 8; } NextBitGroup (bits); } nlwMiddle--; w = wEnd + 1; if (endmask) { dst = dstTmp + (nlwMiddle << 3); *dst = (*dst & ~endmask) | GetPixelGroup (bits) & endmask; } while (w--) { nlw = nlwMiddle; dst = dstTmp; dstTmp++; xor = GetPixelGroup (bits); while (nlw--) { *dst = xor; dst += 8; } NextBitGroup (bits); } nlwMiddle++; } } } else #endif /* PPW == 4 */ { while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot) RotBitsLeft(bits,rot); dst = dstLine; dstLine += nlwDst; if (startmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, startmask); dst++; RotBitsLeft (bits, PGSZB); } nlw = nlwMiddle; while (nlw--) { RRopBitGroup(dst, GetBitGroup(bits)); dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, endmask); } } } } } void cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; /* number of boxes to fill */ BoxPtr pBox; /* pointer to list of boxes to fill */ { int x, y, w, h; int nlwMiddle, nlwDst, nlwTmp; unsigned long startmask, endmask; register unsigned long *dst; unsigned long *dstLine, *pbits, *dstTmp; unsigned long *src; register unsigned long xor; register unsigned long bits, mask; int rot; int wEnd; cfbPrivGCPtr devPriv; PixmapPtr stipple; int stippleHeight; register int nlw; devPriv = cfbGetGCPrivate(pGC); stipple = devPriv->pRotatedPixmap; src = (unsigned long *)stipple->devPrivate.ptr; stippleHeight = stipple->drawable.height; cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) while (nBox--) { x = pBox->x1; w = pBox->x2 - x; if (((x & PIM) + w) <= PPW) { maskpartialbits(x, w, startmask); endmask = 0; nlwMiddle = 0; } else { maskbits (x, w, startmask, endmask, nlwMiddle); } rot = (x & ((PGSZ-1) & ~PIM)); y = pBox->y1; dstLine = pbits + (y * nlwDst) + (x >> PWSH); h = pBox->y2 - y; pBox++; y %= stippleHeight; #if PPW == 4 if (cfb8StippleRRop == GXcopy) { xor = devPriv->xor; if (w < PGSZ*2) { while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot != 0) RotBitsLeft (bits, rot); dst = dstLine; dstLine += nlwDst; if (startmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dst = (*dst & ~(mask & startmask)) | (xor & (mask & startmask)); dst++; RotBitsLeft (bits, PGSZB); } nlw = nlwMiddle; while (nlw--) { WriteBitGroup (dst,xor,GetBitGroup(bits)) dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dst = (*dst & ~(mask & endmask)) | (xor & (mask & endmask)); } } } else { wEnd = 7 - (nlwMiddle & 7); nlwMiddle = (nlwMiddle >> 3) + 1; while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot != 0) RotBitsLeft (bits, rot); dstTmp = dstLine; dstLine += nlwDst; if (startmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; *dstTmp = (*dstTmp & ~(mask & startmask)) | (xor & (mask & startmask)); dstTmp++; RotBitsLeft (bits, PGSZB); } w = 7 - wEnd; while (w--) { nlw = nlwMiddle; dst = dstTmp; dstTmp++; #if defined(__GNUC__) && defined(mc68020) mask = cfb8PixelMasks[GetBitGroup(bits)]; xor = xor & mask; mask = ~mask; while (nlw--) { *dst = (*dst & mask) | xor; dst += 8; } xor = devPriv->xor; #else #define SwitchBitsLoop(body) \ while (nlw--) \ { \ body \ dst += 8; \ } SwitchBitGroup(dst, xor, GetBitGroup(bits)); #undef SwitchBitsLoop #endif NextBitGroup (bits); } nlwMiddle--; w = wEnd + 1; if (endmask) { mask = cfb8PixelMasks[GetBitGroup(bits)]; dst = dstTmp + (nlwMiddle << 3); *dst = (*dst & ~(mask & endmask)) | (xor & (mask & endmask)); } while (w--) { nlw = nlwMiddle; dst = dstTmp; dstTmp++; #if defined(__GNUC__) && defined(mc68020) mask = cfb8PixelMasks[GetBitGroup(bits)]; xor = xor & mask; mask = ~mask; while (nlw--) { *dst = (*dst & mask) | xor; dst += 8; } xor = devPriv->xor; #else #define SwitchBitsLoop(body) \ while (nlw--) \ { \ body \ dst += 8; \ } SwitchBitGroup(dst, xor, GetBitGroup(bits)); #undef SwitchBitsLoop #endif NextBitGroup (bits); } nlwMiddle++; } } } else #endif /* PPW == 4 */ { while (h--) { bits = src[y]; y++; if (y == stippleHeight) y = 0; if (rot != 0) RotBitsLeft (bits, rot); dst = dstLine; dstLine += nlwDst; if (startmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, startmask); dst++; RotBitsLeft (bits, PGSZB); } nlw = nlwMiddle; while (nlw--) { RRopBitGroup(dst, GetBitGroup(bits)); dst++; RotBitsLeft (bits, PGSZB); } if (endmask) { xor = GetBitGroup(bits); *dst = MaskRRopPixels(*dst, xor, endmask); } } } } } void cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; register BoxPtr pBox; { unsigned long *pdstBase; /* pointer to start of bitmap */ unsigned long *pdstLine; /* current destination line */ int nlwDst; /* width in longwords of bitmap */ PixmapPtr pStipple; /* pointer to stipple we want to fill with */ int nlwMiddle; register int nlw; int x, y, w, h, xrem, xSrc, ySrc; int stwidth, stippleWidth; int stippleHeight; register unsigned long bits, inputBits; register int partBitsLeft; int nextPartBits; int bitsLeft, bitsWhole; register unsigned long *pdst; /* pointer to current word in bitmap */ unsigned long *srcTemp, *srcStart; unsigned long *psrcBase; unsigned long startmask, endmask; if (pGC->fillStyle == FillStippled) cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); else cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); if (cfb8StippleRRop == GXnoop) return; /* * OK, so what's going on here? We have two Drawables: * * The Stipple: * Depth = 1 * Width = stippleWidth * Words per scanline = stwidth * Pointer to pixels = pStipple->devPrivate.ptr */ pStipple = pGC->stipple; stwidth = pStipple->devKind >> PWSH; stippleWidth = pStipple->drawable.width; stippleHeight = pStipple->drawable.height; psrcBase = (unsigned long *) pStipple->devPrivate.ptr; /* * The Target: * Depth = PSZ * Width = determined from *pwidth * Words per scanline = nlwDst * Pointer to pixels = addrlBase */ xSrc = pDrawable->x; ySrc = pDrawable->y; cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) /* this replaces rotating the stipple. Instead we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and xrem always stay within the stipple bounds. */ xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth; ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight; bitsWhole = stippleWidth; while (nBox--) { x = pBox->x1; y = pBox->y1; w = pBox->x2 - x; h = pBox->y2 - y; pBox++; pdstLine = pdstBase + y * nlwDst + (x >> PWSH); y = (y - ySrc) % stippleHeight; srcStart = psrcBase + y * stwidth; xrem = ((x & ~PIM) - xSrc) % stippleWidth; if (((x & PIM) + w) < PPW) { maskpartialbits (x, w, startmask); nlwMiddle = 0; endmask = 0; } else { maskbits (x, w, startmask, endmask, nlwMiddle); } while (h--) { srcTemp = srcStart + (xrem >> MFB_PWSH); bitsLeft = stippleWidth - (xrem & ~MFB_PIM); NextUnnaturalStippleWord NextSomeBits (inputBits, (xrem & MFB_PIM)); partBitsLeft -= (xrem & MFB_PIM); NextUnnaturalStippleBits nlw = nlwMiddle; pdst = pdstLine; if (startmask) { *pdst = MaskRRopPixels(*pdst,bits,startmask); pdst++; NextUnnaturalStippleBits } while (nlw--) { *pdst = RRopPixels(*pdst,bits); pdst++; NextUnnaturalStippleBits } if (endmask) *pdst = MaskRRopPixels(*pdst,bits,endmask); pdstLine += nlwDst; y++; srcStart += stwidth; if (y == stippleHeight) { y = 0; srcStart = psrcBase; } } } } #endif /* PSZ == 8 */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbpush8.c0100664000076400007640000001142707120677563021340 0ustar constconst/* * Push Pixels for 8 bit displays. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XConsortium: cfbpush8.c,v 5.14 94/04/17 20:28:58 dpw Exp $ */ #if PSZ == 8 #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #define MFB_CONSTS_ONLY #include "maskbits.h" void cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) GCPtr pGC; PixmapPtr pBitmap; DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { register unsigned long *src, *dst; register unsigned long pixel; register unsigned long c, bits; unsigned long *pdstLine, *psrcLine; unsigned long *pdstBase; int srcWidth; int dstWidth; int xoff; int nBitmapLongs, nPixmapLongs; int nBitmapTmp, nPixmapTmp; unsigned long rightMask; BoxRec bbox; cfbPrivGCPtr devPriv; bbox.x1 = xOrg; bbox.y1 = yOrg; bbox.x2 = bbox.x1 + dx; bbox.y2 = bbox.y1 + dy; devPriv = cfbGetGCPrivate(pGC); switch (RECT_IN_REGION(pGC->pScreen, devPriv->pCompositeClip, &bbox)) { case rgnPART: mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg); case rgnOUT: return; } cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase) psrcLine = (unsigned long *) pBitmap->devPrivate.ptr; srcWidth = (int) pBitmap->devKind >> PWSH; pixel = devPriv->xor; xoff = xOrg & PIM; nBitmapLongs = (dx + xoff) >> MFB_PWSH; nPixmapLongs = (dx + PGSZB + xoff) >> PWSH; rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)]; pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH); while (dy--) { c = 0; nPixmapTmp = nPixmapLongs; nBitmapTmp = nBitmapLongs; src = psrcLine; dst = pdstLine; while (nBitmapTmp--) { bits = *src++; c |= BitRight (bits, xoff); WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; nPixmapTmp -= 8; c = 0; if (xoff) c = BitLeft (bits, PGSZ - xoff); } if (BitLeft (rightMask, xoff)) c |= BitRight (*src, xoff); c &= rightMask; switch (nPixmapTmp) { case 8: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 7: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 6: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 5: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 4: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 3: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 2: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 1: WriteBitGroup(dst, pixel, GetBitGroup(c)); NextBitGroup(c); dst++; case 0: break; } pdstLine += dstWidth; psrcLine += srcWidth; } } #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfballpriv.c0100664000076400007640000000531007120677563021734 0ustar constconst/* * $XConsortium: cfballpriv.c,v 1.5 94/04/17 20:28:42 dpw Exp $ * Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "resource.h" #include "colormap.h" #include "colormapst.h" #include "cfb.h" #include "mi.h" #include "mistruct.h" #include "dix.h" #include "cfbmskbits.h" #include "mibstore.h" int cfbWindowPrivateIndex; int cfbGCPrivateIndex; #ifdef CFB_NEED_SCREEN_PRIVATE int cfbScreenPrivateIndex; #endif extern RegionPtr (*cfbPuntCopyPlane)(); Bool cfbAllocatePrivates(pScreen, window_index, gc_index) ScreenPtr pScreen; int *window_index, *gc_index; { if (!window_index || !gc_index || *window_index == -1 && *gc_index == -1) { if (!mfbAllocatePrivates(pScreen, &cfbWindowPrivateIndex, &cfbGCPrivateIndex)) return FALSE; if (window_index) *window_index = cfbWindowPrivateIndex; if (gc_index) *gc_index = cfbGCPrivateIndex; } else { cfbWindowPrivateIndex = *window_index; cfbGCPrivateIndex = *gc_index; } if (!AllocateWindowPrivate(pScreen, cfbWindowPrivateIndex, sizeof(cfbPrivWin)) || !AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) return FALSE; cfbPuntCopyPlane = miCopyPlane; #ifdef CFB_NEED_SCREEN_PRIVATE cfbScreenPrivateIndex = AllocateScreenPrivateIndex (); if (cfbScreenPrivateIndex == -1) return FALSE; #endif return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbsolid.c0100664000076400007640000007725707120677563021420 0ustar constconst/* * $XConsortium: cfbsolid.c,v 1.9 94/04/17 20:29:02 dpw Exp $ * $XFree86: xc/programs/Xserver/cfb/cfbsolid.c,v 3.0 1996/06/29 09:05:51 dawes Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfbrrop.h" #include "mi.h" #include "mispans.h" #if defined(FAST_CONSTANT_OFFSET_MODE) && (RROP != GXcopy) # define Expand(left,right,leftAdjust) {\ int part = nmiddle & 3; \ int widthStep; \ widthStep = widthDst - nmiddle - leftAdjust; \ nmiddle >>= 2; \ pdst = pdstRect; \ while (h--) { \ left \ pdst += part; \ switch (part) { \ RROP_UNROLL_CASE3(pdst) \ } \ m = nmiddle; \ while (m) { \ pdst += 4; \ RROP_UNROLL_LOOP4(pdst,-4) \ m--; \ } \ right \ pdst += widthStep; \ } \ } #else # ifdef RROP_UNROLL # define Expand(left,right,leftAdjust) {\ int part = nmiddle & RROP_UNROLL_MASK; \ int widthStep; \ widthStep = widthDst - nmiddle - leftAdjust; \ nmiddle >>= RROP_UNROLL_SHIFT; \ pdst = pdstRect; \ while (h--) { \ left \ pdst += part; \ switch (part) { \ RROP_UNROLL_CASE(pdst) \ } \ m = nmiddle; \ while (m) { \ pdst += RROP_UNROLL; \ RROP_UNROLL_LOOP(pdst) \ m--; \ } \ right \ pdst += widthStep; \ } \ } # else # define Expand(left, right, leftAdjust) { \ while (h--) { \ pdst = pdstRect; \ left \ m = nmiddle; \ while (m--) {\ RROP_SOLID(pdst); \ pdst++; \ } \ right \ pdstRect += widthDst; \ } \ } # endif #endif void RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox) DrawablePtr pDrawable; GCPtr pGC; int nBox; BoxPtr pBox; { register int m; register unsigned long *pdst; RROP_DECLARE register unsigned long leftMask, rightMask; unsigned long *pdstBase, *pdstRect; int nmiddle; int h; int w; int widthDst; cfbPrivGCPtr devPriv; #if PSZ == 24 int leftIndex, rightIndex, xOffset; #endif devPriv = cfbGetGCPrivate(pGC); cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) RROP_FETCH_GC(pGC) for (; nBox; nBox--, pBox++) { pdstRect = pdstBase + pBox->y1 * widthDst; h = pBox->y2 - pBox->y1; w = pBox->x2 - pBox->x1; #if PSZ == 8 if (w == 1) { register char *pdstb = ((char *) pdstRect) + pBox->x1; int incr = widthDst * PGSZB; while (h--) { RROP_SOLID (pdstb); pdstb += incr; } } else { #endif #if PSZ == 24 leftIndex = pBox->x1 &3; /* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/ rightIndex = pBox->x2 &3; nmiddle = w - rightIndex; if(leftIndex){ nmiddle -= (4 - leftIndex); } nmiddle >>= 2; if(nmiddle < 0) nmiddle = 0; pdstRect += (pBox->x1 * 3) >> 2; pdst = pdstRect; switch(leftIndex+w){ case 4: switch(leftIndex){ case 0: while(h--){ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif pdst--; pdst += widthDst; } break; case 1: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); *pdst++ &= piQxelAnd[1]; *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif pdst--; pdst += widthDst; } break; case 2: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif pdst += widthDst; } break; case 3: while(h--){ #if RROP == GXcopy *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXxor *pdst ^= (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXand *pdst &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst |= (piQxelOr[2] & 0xFFFFFF00); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); #endif pdst += widthDst; } break; } break; case 3: switch(leftIndex){ case 0: while(h--){ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst--; pdst += widthDst; } break; case 1: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); *pdst++ &= piQxelAnd[1]; *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst--; pdst += widthDst; } break; case 2: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst += widthDst; } break; case 3: while(h--){ #if RROP == GXcopy *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXxor *pdst ^= (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXand *pdst &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst |= (piQxelOr[2] & 0xFFFFFF00); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); #endif pdst += widthDst; } break; } break; case 2: /* leftIndex + w = 2*/ switch(leftIndex){ case 2: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); *pdst-- &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst += widthDst; } break; case 1: while(h--){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst-- ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst-- |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); pdst--; #endif pdst += widthDst; } break; case 0: /*case 2 leftIndex == 0 */ while(h--){ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst-- ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst-- |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); pdst--; #endif pdst += widthDst; } break; } break; case 1: /*only if leftIndex = 0 and w = 1*/ while(h--){ #if RROP == GXcopy *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXxor *pdst ^= (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXand *pdst &= (piQxelAnd[0] | 0xFF000000); #endif #if RROP == GXor *pdst |= (piQxelOr[0] & 0xFFFFFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); #endif pdst += widthDst; } break; case 0: /*never*/ break; default: { while(h--){ pdst = pdstRect; switch(leftIndex){ case 0: break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); *pdst++ &= piQxelAnd[1]; *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif break; case 2: #if RROP == GXcopy *pdst++ = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif break; case 3: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); pdst++; #endif break; } m = nmiddle; while(m--){ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif } switch(rightIndex){ case 0: break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFF); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFFFFFF); #endif #if RROP == GXset *pdst++ = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); #endif break; case 2: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); *pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); *pdst++; #endif break; case 3: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst++ = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst++ ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst++ |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst++; #endif break; } pdstRect += widthDst; } } } #else /* PSZ != 24 */ pdstRect += (pBox->x1 >> PWSH); if ((pBox->x1 & PIM) + w <= PPW) { maskpartialbits(pBox->x1, w, leftMask); pdst = pdstRect; while (h--) { RROP_SOLID_MASK (pdst, leftMask); pdst += widthDst; } } else { maskbits (pBox->x1, w, leftMask, rightMask, nmiddle); if (leftMask) { if (rightMask) /* left mask and right mask */ { Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;, RROP_SOLID_MASK (pdst, rightMask);, 1) } else /* left mask and no right mask */ { Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;, ;, 1) } } else { if (rightMask) /* no left mask and right mask */ { Expand(;, RROP_SOLID_MASK (pdst, rightMask);, 0) } else /* no left mask and no right mask */ { Expand(;, ;, 0) } } } #endif #if PSZ == 8 } #endif } } void RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { unsigned long *pdstBase; int widthDst; RROP_DECLARE register unsigned long *pdst; register int nlmiddle; register unsigned long startmask, endmask; register int w; int x; /* next three parameters are post-clip */ int n; /* number of spans to fill */ DDXPointPtr ppt; /* pointer to list of start points */ int *pwidthFree;/* copies of the pointers to free */ DDXPointPtr pptFree; int *pwidth; cfbPrivGCPtr devPriv; #if PSZ == 24 int leftIndex, rightIndex, xOffset; #endif devPriv = cfbGetGCPrivate(pGC); RROP_FETCH_GCPRIV(devPriv) n = nInit * miFindMaxBand(devPriv->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(devPriv->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) while (n--) { x = ppt->x; pdst = pdstBase + (ppt->y * widthDst); ++ppt; w = *pwidth++; if (!w) continue; #if PSZ == 24 leftIndex = x &3; /* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/ rightIndex = (x+w)&3; nlmiddle = w - rightIndex; if(leftIndex){ nlmiddle -= (4 - leftIndex); } /* nlmiddle += 3;*/ nlmiddle >>= 2; if(nlmiddle < 0) nlmiddle = 0; pdst += (x >> 2)*3; pdst += leftIndex? (leftIndex -1):0; switch(leftIndex+w){ case 4: switch(leftIndex){ case 0: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif pdst--; break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); *pdst++ &= piQxelAnd[1]; *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif pdst--; break; case 2: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *pdst-- = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); *pdst-- ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst-- &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst-- |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst--; #endif break; case 3: #if RROP == GXcopy *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXxor *pdst ^= (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXand *pdst &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst |= (piQxelOr[2] & 0xFFFFFF00); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); #endif break; } break; case 3: switch(leftIndex){ case 0: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst--; break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); *pdst++ &= piQxelAnd[1]; *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif pdst--; break; case 2: /* pdst++;*/ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); *pdst-- ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst-- |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst--; #endif break; } break; case 2: /* leftIndex + w = 2*/ if(leftIndex){ #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst-- ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst-- |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); pdst--; #endif } else{ /*case 2 leftIndex === 0 */ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst-- ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst-- |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); pdst--; #endif } break; case 1: /*only if leftIndex = 0 and w = 1*/ #if RROP == GXcopy *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXxor *pdst ^= (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXand *pdst &= (piQxelAnd[0] | 0xFF000000); #endif #if RROP == GXor *pdst |= (piQxelOr[0] & 0xFFFFFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); #endif break; case 0: /*never*/ break; default: { switch(leftIndex){ case 0: break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *pdst++ = piQxelXor[1]; *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFF000000); *pdst++ ^= piQxelXor[1]; *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); *pdst++ &= piQxelAnd[1]; *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFF000000); *pdst++ |= piQxelOr[1]; *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif break; case 2: #if RROP == GXcopy *pdst++ = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= (piQxelAnd[1] | 0xFFFF); *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= (piQxelOr[1] & 0xFFFF0000); *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif break; case 3: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[2] | 0xFF); #endif #if RROP == GXor *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); pdst++; #endif break; } while(nlmiddle--){ #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst++ = piQxelXor[2]; #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst++ ^= piQxelXor[2]; #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst++ &= piQxelAnd[2]; #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst++ |= piQxelOr[2]; #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); pdst++; #endif } switch(rightIndex){ case 0: break; case 1: #if RROP == GXcopy *pdst++ = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXxor *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); #endif #if RROP == GXand *pdst++ &= (piQxelAnd[0] | 0xFF); #endif #if RROP == GXor *pdst++ |= (piQxelOr[0] & 0xFFFFFF); #endif #if RROP == GXset *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); #endif break; case 2: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= (piQxelXor[1] & 0xFFFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= (piQxelOr[1] & 0xFFFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); *pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); *pdst++; #endif break; case 3: #if RROP == GXcopy *pdst++ = piQxelXor[0]; *pdst++ = piQxelXor[1]; *pdst++ = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); #endif #if RROP == GXxor *pdst++ ^= piQxelXor[0]; *pdst++ ^= piQxelXor[1]; *pdst++ ^= (piQxelXor[2] & 0xFF); #endif #if RROP == GXand *pdst++ &= piQxelAnd[0]; *pdst++ &= piQxelAnd[1]; *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); #endif #if RROP == GXor *pdst++ |= piQxelOr[0]; *pdst++ |= piQxelOr[1]; *pdst++ |= (piQxelOr[2] & 0xFF); #endif #if RROP == GXset *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); pdst++; *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); pdst++; *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); pdst++; #endif break; } } } #else #if PSZ == 8 if (w <= PGSZB) { register char *addrb; addrb = ((char *) pdst) + x; while (w--) { RROP_SOLID (addrb); addrb++; } } #else if ((x & PIM) + w <= PPW) { pdst += x >> PWSH; maskpartialbits (x, w, startmask); RROP_SOLID_MASK (pdst, startmask); } #endif else { pdst += x >> PWSH; maskbits (x, w, startmask, endmask, nlmiddle); if (startmask) { RROP_SOLID_MASK (pdst, startmask); ++pdst; } RROP_SPAN(pdst,nlmiddle) if (endmask) { RROP_SOLID_MASK (pdst, endmask); } } #endif } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbscrinit.c0100664000076400007640000001457707120677563021755 0ustar constconst/************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: cfbscrinit.c,v 5.32 94/04/17 20:29:00 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "resource.h" #include "colormap.h" #include "colormapst.h" #include "cfb.h" #include "mi.h" #include "mistruct.h" #include "dix.h" #include "cfbmskbits.h" #include "mibstore.h" miBSFuncRec cfbBSFuncRec = { cfbSaveAreas, cfbRestoreAreas, (void (*)()) 0, (PixmapPtr (*)()) 0, (PixmapPtr (*)()) 0, }; Bool cfbCloseScreen (index, pScreen) int index; ScreenPtr pScreen; { int d; DepthPtr depths = pScreen->allowedDepths; for (d = 0; d < pScreen->numDepths; d++) xfree (depths[d].vids); xfree (depths); xfree (pScreen->visuals); #ifdef CFB_NEED_SCREEN_PRIVATE xfree (pScreen->devPrivates[cfbScreenPrivateIndex].ptr); #else xfree (pScreen->devPrivate); #endif return TRUE; } Bool cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bitmap */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { int i; extern RegionPtr (*cfbPuntCopyPlane)(); if (!cfbAllocatePrivates(pScreen, (int *) 0, (int *) 0)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; pScreen->QueryBestSize = mfbQueryBestSize; /* SaveScreen */ pScreen->GetImage = cfbGetImage; pScreen->GetSpans = cfbGetSpans; pScreen->CreateWindow = cfbCreateWindow; pScreen->DestroyWindow = cfbDestroyWindow; pScreen->PositionWindow = cfbPositionWindow; pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes; pScreen->RealizeWindow = cfbMapWindow; pScreen->UnrealizeWindow = cfbUnmapWindow; pScreen->PaintWindowBackground = cfbPaintWindow; pScreen->PaintWindowBorder = cfbPaintWindow; pScreen->CopyWindow = cfbCopyWindow; pScreen->CreatePixmap = cfbCreatePixmap; pScreen->DestroyPixmap = cfbDestroyPixmap; pScreen->RealizeFont = mfbRealizeFont; pScreen->UnrealizeFont = mfbUnrealizeFont; pScreen->CreateGC = cfbCreateGC; pScreen->CreateColormap = cfbInitializeColormap; pScreen->DestroyColormap = (void (*)())NoopDDA; #ifdef STATIC_COLOR pScreen->InstallColormap = cfbInstallColormap; pScreen->UninstallColormap = cfbUninstallColormap; pScreen->ListInstalledColormaps = cfbListInstalledColormaps; pScreen->StoreColors = (void (*)())NoopDDA; #endif pScreen->ResolveColor = cfbResolveColor; pScreen->BitmapToRegion = mfbPixmapToRegion; mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane); return TRUE; } #ifdef CFB_NEED_SCREEN_PRIVATE Bool cfbCreateScreenResources(pScreen) ScreenPtr pScreen; { Bool retval; pointer oldDevPrivate = pScreen->devPrivate; pScreen->devPrivate = pScreen->devPrivates[cfbScreenPrivateIndex].ptr; retval = miCreateScreenResources(pScreen); pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; pScreen->devPrivate = oldDevPrivate; return retval; } #endif cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bitmap */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { int i, j; #ifdef CFB_NEED_SCREEN_PRIVATE pointer oldDevPrivate; #endif VisualPtr visuals; DepthPtr depths; int nvisuals; int ndepths; int rootdepth; VisualID defaultVisual; rootdepth = 0; if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, &defaultVisual,((unsigned long)1<<(PSZ-1)), 8)) return FALSE; #ifdef CFB_NEED_SCREEN_PRIVATE oldDevPrivate = pScreen->devPrivate; #endif if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootdepth, ndepths, depths, defaultVisual, nvisuals, visuals, (miBSFuncPtr) 0)) return FALSE; /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = cfbCloseScreen; /* init backing store here so we can overwrite CloseScreen without stepping * on the backing store wrapped version */ miInitializeBackingStore (pScreen, &cfbBSFuncRec); #ifdef CFB_NEED_SCREEN_PRIVATE pScreen->CreateScreenResources = cfbCreateScreenResources; pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; pScreen->devPrivate = oldDevPrivate; #endif return TRUE; } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ Bool cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bitmap */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)) return FALSE; return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width); } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbmskbits.c0100664000076400007640000011341207120677563021742 0ustar constconst/************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: cfbmskbits.c,v 4.13 94/07/28 12:30:41 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.c,v 3.0 1996/06/29 09:05:41 dawes Exp $ */ /* * ========================================================================== * Converted to Color Frame Buffer by smarks@sun, April-May 1987. The "bit * numbering" in the doc below really means "byte numbering" now. * ========================================================================== */ /* these tables are used by several macros in the cfb code. the vax numbers everything left to right, so bit indices on the screen match bit indices in longwords. the pc-rt and Sun number bits on the screen the way they would be written on paper, (i.e. msb to the left), and so a bit index n on the screen is bit index 32-n in a longword see also cfbmskbits.h */ #include #include #include #include "cfb.h" #include "cfbmskbits.h" #define _cfbBits(a) (PixelGroup)(a) #if (BITMAP_BIT_ORDER == MSBFirst) #define cfbBits(v) _cfbBits(v) #else /* BITMAP_BIT_ORDER == LSBFirst */ #define cfbFlip2(a) ((((a) & 0x1) << 1) | (((a) & 0x2) >> 1)) #define cfbFlip4(a) ((cfbFlip2(a) << 2) | cfbFlip2(a >> 2)) #define cfbFlip8(a) ((cfbFlip4(a) << 4) | cfbFlip4(a >> 4)) #define cfbFlip16(a) ((cfbFlip8(a) << 8) | cfbFlip8(a >> 8)) #define cfbFlip32(a) ((cfbFlip16(a) << 16) | cfbFlip16(a >> 16)) #if PGSZ == 32 #define cfbBits(a) cfbFlip32(_cfbBits(a)) #else /* PGSZ == 64 */ #define cfbFlip64(a) ((cfbFlip32(a) << 32) | cfbFlip32(a >> 32)) #define cfbBits(a) cfbFlip64(_cfbBits(a)) #endif /* PGSZ */ #endif /* BITMAP_BIT_ORDER */ /* NOTE: the first element in starttab could be 0xffffffff. making it 0 lets us deal with a full first word in the middle loop, rather than having to do the multiple reads and masks that we'd have to do if we thought it was partial. */ #if PSZ == 4 #if PGSZ == 32 PixelGroup cfbstarttab[] = { cfbBits(0x00000000), cfbBits(0x0FFFFFFF), cfbBits(0x00FFFFFF), cfbBits(0x000FFFFF), cfbBits(0x0000FFFF), cfbBits(0x00000FFF), cfbBits(0x000000FF), cfbBits(0x0000000F) }; PixelGroup cfbendtab[] = { cfbBits(0x00000000), cfbBits(0xF0000000), cfbBits(0xFF000000), cfbBits(0xFFF00000), cfbBits(0xFFFF0000), cfbBits(0xFFFFF000), cfbBits(0xFFFFFF00), cfbBits(0xFFFFFFF0) }; #else /* PGSZ == 64 */ PixelGroup cfbstarttab[] = { cfbBits(0x0000000000000000), cfbBits(0x0FFFFFFFFFFFFFFF), cfbBits(0x00FFFFFFFFFFFFFF), cfbBits(0x000FFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x00000FFFFFFFFFFF), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x0000000FFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x000000000FFFFFFF), cfbBits(0x0000000000FFFFFF), cfbBits(0x00000000000FFFFF), cfbBits(0x000000000000FFFF), cfbBits(0x0000000000000FFF), cfbBits(0x00000000000000FF), cfbBits(0x000000000000000F), }; PixelGroup cfbendtab[] = { cfbBits(0x0000000000000000), cfbBits(0xF000000000000000), cfbBits(0xFF00000000000000), cfbBits(0xFFF0000000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFF00000000000), cfbBits(0xFFFFFF0000000000), cfbBits(0xFFFFFFF000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFF0000000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFFFFFFFFF00000), cfbBits(0xFFFFFFFFFFFF0000), cfbBits(0xFFFFFFFFFFFFF000), cfbBits(0xFFFFFFFFFFFFFF00), cfbBits(0xFFFFFFFFFFFFFFF0), }; #endif /* PGSZ */ #endif /* PSZ == 4 */ #if PSZ == 8 #if PGSZ == 32 PixelGroup cfbstarttab[] = { cfbBits(0x00000000), cfbBits(0x00FFFFFF), cfbBits(0x0000FFFF), cfbBits(0x000000FF) }; PixelGroup cfbendtab[] = { cfbBits(0x00000000), cfbBits(0xFF000000), cfbBits(0xFFFF0000), cfbBits(0xFFFFFF00) }; #else /* PGSZ == 64 */ PixelGroup cfbstarttab[] = { cfbBits(0x0000000000000000), cfbBits(0x00FFFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x0000000000FFFFFF), cfbBits(0x000000000000FFFF), cfbBits(0x00000000000000FF) }; PixelGroup cfbendtab[] = { cfbBits(0x0000000000000000), cfbBits(0xFF00000000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFFF0000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFFFFFFFFFF0000), cfbBits(0xFFFFFFFFFFFFFF00) }; #endif /* PGSZ */ #endif /* PSZ == 8 */ #if PSZ == 16 #if PGSZ == 32 PixelGroup cfbstarttab[] = { cfbBits(0x00000000), cfbBits(0x0000FFFF), }; PixelGroup cfbendtab[] = { cfbBits(0x00000000), cfbBits(0xFFFF0000), }; #else /* PGSZ == 64 */ PixelGroup cfbstarttab[] = { cfbBits(0x0000000000000000), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x000000000000FFFF), }; PixelGroup cfbendtab[] = { cfbBits(0x0000000000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFFFFF0000), }; #endif /* PGSZ */ #endif #if PSZ == 24 #if PGSZ == 32 PixelGroup cfbstarttab[] = { cfbBits(0x00000000), cfbBits(0x000000FF), cfbBits(0x0000FFFF), cfbBits(0x00FFFFFF), }; PixelGroup cfbendtab[] = { cfbBits(0x00000000), cfbBits(0xFFFFFF00), cfbBits(0xFFFF0000), cfbBits(0xFF000000), }; #else /* PGSZ == 64 */ PixelGroup cfbstarttab[] = { cfbBits(0x0000000000000000), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x000000000000FFFF), }; PixelGroup cfbendtab[] = { cfbBits(0x0000000000000000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFF000000000000), }; #endif /* PGSZ */ #endif /* PSZ == 24 */ #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbstarttab[] = { cfbBits(0x00000000), }; PixelGroup cfbendtab[] = { cfbBits(0x00000000), }; #else /* PGSZ == 64 */ PixelGroup cfbstarttab[] = { cfbBits(0x0000000000000000), cfbBits(0x00000000FFFFFFFF), }; PixelGroup cfbendtab[] = { cfbBits(0x0000000000000000), cfbBits(0xFFFFFFFF00000000), }; #endif /* PGSZ */ #endif /* PSZ == 32 */ /* a hack, for now, since the entries for 0 need to be all 1 bits, not all zeros. this means the code DOES NOT WORK for segments of length 0 (which is only a problem in the horizontal line code.) */ #if PSZ == 4 #if PGSZ == 32 PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0x0FFFFFFF), cfbBits(0x00FFFFFF), cfbBits(0x000FFFFF), cfbBits(0x0000FFFF), cfbBits(0x00000FFF), cfbBits(0x000000FF), cfbBits(0x0000000F) }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0xF0000000), cfbBits(0xFF000000), cfbBits(0xFFF00000), cfbBits(0xFFFF0000), cfbBits(0xFFFFF000), cfbBits(0xFFFFFF00), cfbBits(0xFFFFFFF0) }; #else /* PGSZ == 64 */ PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0x0FFFFFFFFFFFFFFF), cfbBits(0x00FFFFFFFFFFFFFF), cfbBits(0x000FFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x00000FFFFFFFFFFF), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x0000000FFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x000000000FFFFFFF), cfbBits(0x0000000000FFFFFF), cfbBits(0x00000000000FFFFF), cfbBits(0x000000000000FFFF), cfbBits(0x0000000000000FFF), cfbBits(0x00000000000000FF), cfbBits(0x000000000000000F), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0xF000000000000000), cfbBits(0xFF00000000000000), cfbBits(0xFFF0000000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFF00000000000), cfbBits(0xFFFFFF0000000000), cfbBits(0xFFFFFFF000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFF0000000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFFFFFFFFF00000), cfbBits(0xFFFFFFFFFFFF0000), cfbBits(0xFFFFFFFFFFFFF000), cfbBits(0xFFFFFFFFFFFFFF00), cfbBits(0xFFFFFFFFFFFFFFF0), }; #endif /* PGSZ */ #endif /* PSZ == 4 */ #if PSZ == 8 #if PGSZ == 32 PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0x00FFFFFF), cfbBits(0x0000FFFF), cfbBits(0x000000FF) }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0xFF000000), cfbBits(0xFFFF0000), cfbBits(0xFFFFFF00) }; #else /* PGSZ == 64 */ PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0x00FFFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x0000000000FFFFFF), cfbBits(0x000000000000FFFF), cfbBits(0x00000000000000FF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0xFF00000000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFFF0000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFFFFFFFFFF0000), cfbBits(0xFFFFFFFFFFFFFF00), }; #endif /* PGSZ */ #endif /* PSZ == 8 */ #if PSZ == 16 #if PGSZ == 32 PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0x0000FFFF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0xFFFF0000), }; #else /* PGSZ == 64 */ PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x000000000000FFFF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0xFFFF000000000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFFFFFFFF0000), }; #endif /* PGSZ */ #endif /* PSZ == 16 */ #if PSZ == 24 #if PGSZ == 32 PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0x000000FF), cfbBits(0x0000FFFF), cfbBits(0x00FFFFFF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFF), cfbBits(0xFFFFFF00), cfbBits(0xFFFF0000), cfbBits(0xFF000000), }; #else /* PGSZ == 64 */ PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0x000000FFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), cfbBits(0x0000000000FFFFFF), cfbBits(0x000000000000FFFF), cfbBits(0x00000000000000FF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0xFFFFFFFFFFFF0000), cfbBits(0xFFFFFFFFFF000000), cfbBits(0xFFFFFFFF00000000), cfbBits(0xFFFFFF0000000000), cfbBits(0xFFFF000000000000), cfbBits(0xFF00000000000000), }; #endif /* PGSZ */ #endif /* PSZ == 24 */ #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFF), }; #else /* PGSZ == 64 */ PixelGroup cfbstartpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0x00000000FFFFFFFF), }; PixelGroup cfbendpartial[] = { cfbBits(0xFFFFFFFFFFFFFFFF), cfbBits(0xFFFFFFFF00000000), }; #endif /* PGSZ */ #endif /* PSZ == 32 */ /* used for masking bits in bresenham lines mask[n] is used to mask out all but bit n in a longword (n is a screen position). rmask[n] is used to mask out the single bit at position n (n is a screen posiotion.) */ #if PSZ == 4 #if PGSZ == 32 PixelGroup cfbmask[] = { cfbBits(0xF0000000), cfbBits(0x0F000000), cfbBits(0x00F00000), cfbBits(0x000F0000), cfbBits(0x0000F000), cfbBits(0x00000F00), cfbBits(0x000000F0), cfbBits(0x0000000F) }; PixelGroup cfbrmask[] = { cfbBits(0x0FFFFFFF), cfbBits(0xF0FFFFFF), cfbBits(0xFF0FFFFF), cfbBits(0xFFF0FFFF), cfbBits(0xFFFF0FFF), cfbBits(0xFFFFF0FF), cfbBits(0xFFFFFF0F), cfbBits(0xFFFFFFF0) }; #else /* PGSZ == 64 */ PixelGroup cfbmask[] = { cfbBits(0xF000000000000000), cfbBits(0x0F00000000000000), cfbBits(0x00F0000000000000), cfbBits(0x000F000000000000), cfbBits(0x0000F00000000000), cfbBits(0x00000F0000000000), cfbBits(0x000000F000000000), cfbBits(0x0000000F00000000), cfbBits(0x00000000F0000000), cfbBits(0x000000000F000000), cfbBits(0x0000000000F00000), cfbBits(0x00000000000F0000), cfbBits(0x000000000000F000), cfbBits(0x0000000000000F00), cfbBits(0x00000000000000F0), cfbBits(0x000000000000000F), }; PixelGroup cfbrmask[] = { cfbBits(0x0FFFFFFFFFFFFFFF), cfbBits(0xF0FFFFFFFFFFFFFF), cfbBits(0xFF0FFFFFFFFFFFFF), cfbBits(0xFFF0FFFFFFFFFFFF), cfbBits(0xFFFF0FFFFFFFFFFF), cfbBits(0xFFFFF0FFFFFFFFFF), cfbBits(0xFFFFFF0FFFFFFFFF), cfbBits(0xFFFFFFF0FFFFFFFF), cfbBits(0xFFFFFFFF0FFFFFFF), cfbBits(0xFFFFFFFFF0FFFFFF), cfbBits(0xFFFFFFFFFF0FFFFF), cfbBits(0xFFFFFFFFFFF0FFFF), cfbBits(0xFFFFFFFFFFFF0FFF), cfbBits(0xFFFFFFFFFFFFF0FF), cfbBits(0xFFFFFFFFFFFFFF0F), cfbBits(0xFFFFFFFFFFFFFFF0), }; #endif /* PGSZ */ #endif /* PSZ == 4 */ #if PSZ == 8 #if PGSZ == 32 PixelGroup cfbmask[] = { cfbBits(0xFF000000), cfbBits(0x00FF0000), cfbBits(0x0000FF00), cfbBits(0x000000FF) }; PixelGroup cfbrmask[] = { cfbBits(0x00FFFFFF), cfbBits(0xFF00FFFF), cfbBits(0xFFFF00FF), cfbBits(0xFFFFFF00) }; #else /* PGSZ == 64 */ PixelGroup cfbmask[] = { cfbBits(0xFF00000000000000), cfbBits(0x00FF000000000000), cfbBits(0x0000FF0000000000), cfbBits(0x000000FF00000000), cfbBits(0x00000000FF000000), cfbBits(0x0000000000FF0000), cfbBits(0x000000000000FF00), cfbBits(0x00000000000000FF), }; PixelGroup cfbrmask[] = { cfbBits(0x00FFFFFFFFFFFFFF), cfbBits(0xFF00FFFFFFFFFFFF), cfbBits(0xFFFF00FFFFFFFFFF), cfbBits(0xFFFFFF00FFFFFFFF), cfbBits(0xFFFFFFFF00FFFFFF), cfbBits(0xFFFFFFFFFF00FFFF), cfbBits(0xFFFFFFFFFFFF00FF), cfbBits(0xFFFFFFFFFFFFFF00), }; #endif /* PGSZ */ #endif /* PSZ == 8 */ #if PSZ == 16 #if PGSZ == 32 PixelGroup cfbmask[] = { cfbBits(0xFFFF0000), cfbBits(0x0000FFFF), }; PixelGroup cfbrmask[] = { cfbBits(0x0000FFFF), cfbBits(0xFFFF0000), }; #else /* PGSZ == 64 */ PixelGroup cfbmask[] = { cfbBits(0xFFFF000000000000), cfbBits(0x0000FFFF00000000), cfbBits(0x00000000FFFF0000), cfbBits(0x000000000000FFFF), }; PixelGroup cfbrmask[] = { cfbBits(0x0000FFFFFFFFFFFF), cfbBits(0xFFFF0000FFFFFFFF), cfbBits(0xFFFFFFFF0000FFFF), cfbBits(0xFFFFFFFFFFFF0000), }; #endif /* PGSZ */ #endif /* PSZ == 16 */ #if PSZ == 24 #if PGSZ == 32 PixelGroup cfbmask[] = { cfbBits(0xFFFFFF00), cfbBits(0x00000000), cfbBits(0x000000FF), cfbBits(0xFFFF0000), cfbBits(0x0000FFFF), cfbBits(0xFF000000), cfbBits(0x00FFFFFF), cfbBits(0x00000000), }; PixelGroup cfbrmask[] = { cfbBits(0x000000FF), cfbBits(0xFFFFFFFF), cfbBits(0xFFFFFF00), cfbBits(0x0000FFFF), cfbBits(0xFFFF0000), cfbBits(0x00FFFFFF), cfbBits(0xFF000000), cfbBits(0xFFFFFFFF), }; #else /* PGSZ == 64 */ PixelGroup cfbmask[] = { cfbBits(0xFFFFFF0000000000), cfbBits(0x000000FFFFFF0000), cfbBits(0x000000000000FFFF), }; PixelGroup cfbmask2[] = { cfbBits(0x0000000000000000), cfbBits(0x0000000000000000), cfbBits(0xFF00000000000000), }; PixelGroup cfbrmask[] = { cfbBits(0x000000FFFFFFFFFF), cfbBits(0xFFFFFF000000FFFF), cfbBits(0xFFFFFFFFFFFF0000), }; PixelGroup cfbrmask2[] = { cfbBits(0x0000000000000000), cfbBits(0x0000000000000000), cfbBits(0x00FFFFFFFFFFFFFF), }; #endif /* PGSZ */ #endif /* PSZ == 24 */ #if PSZ == 32 #if PGSZ == 32 PixelGroup cfbmask[] = { cfbBits(0xFFFFFFFF), }; PixelGroup cfbrmask[] = { cfbBits(0xFFFFFFFF), }; #else /* PGSZ == 64 */ PixelGroup cfbmask[] = { cfbBits(0xFFFFFFFF00000000), cfbBits(0x00000000FFFFFFFF), }; PixelGroup cfbrmask[] = { cfbBits(0x00000000FFFFFFFF), cfbBits(0xFFFFFFFF00000000), }; #endif /* PGSZ */ #endif /* PSZ == 32 */ /* * QuartetBitsTable contains PPW+1 masks whose binary values are masks in the * low order quartet that contain the number of bits specified in the * index. This table is used by getstipplepixels. */ #if PSZ == 4 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 00000000 */ 0x00000080, /* 1 - 10000000 */ 0x000000C0, /* 2 - 11000000 */ 0x000000E0, /* 3 - 11100000 */ 0x000000F0, /* 4 - 11110000 */ 0x000000F8, /* 5 - 11111000 */ 0x000000FC, /* 6 - 11111100 */ 0x000000FE, /* 7 - 11111110 */ 0x000000FF /* 8 - 11111111 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 00000000 */ 0x00000001, /* 1 - 00000001 */ 0x00000003, /* 2 - 00000011 */ 0x00000007, /* 3 - 00000111 */ 0x0000000F, /* 4 - 00001111 */ 0x0000001F, /* 5 - 00011111 */ 0x0000003F, /* 6 - 00111111 */ 0x0000007F, /* 7 - 01111111 */ 0x000000FF /* 8 - 11111111 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 0000000000000000 */ 0x00008000, /* 1 - 1000000000000000 */ 0x0000C000, /* 2 - 1100000000000000 */ 0x0000E000, /* 3 - 1110000000000000 */ 0x0000F000, /* 4 - 1111000000000000 */ 0x0000F800, /* 5 - 1111100000000000 */ 0x0000FC00, /* 6 - 1111110000000000 */ 0x0000FE00, /* 7 - 1111111000000000 */ 0x0000FF00, /* 8 - 1111111100000000 */ 0x0000FF80, /* 9 - 1111111110000000 */ 0x0000FFC0, /* 10- 1111111111000000 */ 0x0000FFE0, /* 11- 1111111111100000 */ 0x0000FFF0, /* 12- 1111111111110000 */ 0x0000FFF8, /* 13- 1111111111111000 */ 0x0000FFFC, /* 14- 1111111111111100 */ 0x0000FFFE, /* 15- 1111111111111110 */ 0x0000FFFF, /* 16- 1111111111111111 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 0000000000000000 */ 0x00000001, /* 1 - 0000000000000001 */ 0x00000003, /* 2 - 0000000000000011 */ 0x00000007, /* 3 - 0000000000000111 */ 0x0000000F, /* 4 - 0000000000001111 */ 0x0000001F, /* 5 - 0000000000011111 */ 0x0000003F, /* 6 - 0000000000111111 */ 0x0000007F, /* 7 - 0000000001111111 */ 0x000000FF, /* 8 - 0000000011111111 */ 0x000001FF, /* 9 - 0000000111111111 */ 0x000003FF, /* 10- 0000001111111111 */ 0x000007FF, /* 11- 0000011111111111 */ 0x00000FFF, /* 12- 0000111111111111 */ 0x00001FFF, /* 13- 0001111111111111 */ 0x00003FFF, /* 14- 0011111111111111 */ 0x00007FFF, /* 15- 0111111111111111 */ 0x0000FFFF, /* 16- 1111111111111111 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif /* PGSZ */ }; #endif /* PSZ == 4 */ #if PSZ == 8 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 0000 */ 0x00000008, /* 1 - 1000 */ 0x0000000C, /* 2 - 1100 */ 0x0000000E, /* 3 - 1110 */ 0x0000000F /* 4 - 1111 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 0000 */ 0x00000001, /* 1 - 0001 */ 0x00000003, /* 2 - 0011 */ 0x00000007, /* 3 - 0111 */ 0x0000000F /* 4 - 1111 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 00000000 */ 0x00000080, /* 1 - 10000000 */ 0x000000C0, /* 2 - 11000000 */ 0x000000E0, /* 3 - 11100000 */ 0x000000F0, /* 4 - 11110000 */ 0x000000F8, /* 5 - 11111000 */ 0x000000FC, /* 6 - 11111100 */ 0x000000FE, /* 7 - 11111110 */ 0x000000FF /* 8 - 11111111 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 00000000 */ 0x00000001, /* 1 - 00000001 */ 0x00000003, /* 2 - 00000011 */ 0x00000007, /* 3 - 00000111 */ 0x0000000F, /* 4 - 10000111 */ 0x0000001F, /* 5 - 00011111 */ 0x0000003F, /* 6 - 00111111 */ 0x0000007F, /* 7 - 01111111 */ 0x000000FF /* 8 - 11111111 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif /* PGSZ */ }; #endif /* PSZ == 8 */ #if PSZ == 16 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 00 */ 0x00000002, /* 1 - 10 */ 0x00000003, /* 2 - 11 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 00 */ 0x00000001, /* 1 - 01 */ 0x00000003, /* 2 - 11 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 0000 */ 0x00000008, /* 1 - 1000 */ 0x0000000C, /* 2 - 1100 */ 0x0000000E, /* 3 - 1110 */ 0x0000000F, /* 4 - 1111 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 0000 */ 0x00000001, /* 1 - 0001 */ 0x00000003, /* 2 - 0011 */ 0x00000007, /* 3 - 0111 */ 0x0000000F, /* 4 - 1111 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif /* PGSZ */ }; #endif /* PSZ == 16 */ #if PSZ == 24 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 0 */ 0x00000001, /* 1 - 1 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 0 */ 0x00000001, /* 1 - 1 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 00 */ 0x00000002, /* 1 - 10 */ 0x00000003, /* 2 - 11*/ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 00 */ 0x00000001, /* 1 - 01 */ 0x00000003, /* 2 - 11 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif /* PGSZ */ }; #endif /* PSZ == 24 */ #if PSZ == 32 PixelGroup QuartetBitsTable[] = { #if PGSZ == 32 #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 0 */ 0x00000001, /* 1 - 1 */ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 0 */ 0x00000001, /* 1 - 1 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #else /* PGSZ == 64 */ #if (BITMAP_BIT_ORDER == MSBFirst) 0x00000000, /* 0 - 00 */ 0x00000002, /* 1 - 10 */ 0x00000003, /* 2 - 11*/ #else /* (BITMAP_BIT_ORDER == LSBFirst */ 0x00000000, /* 0 - 00 */ 0x00000001, /* 1 - 01 */ 0x00000003, /* 2 - 11 */ #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif /* PGSZ */ }; #endif /* PSZ == 32 */ /* * QuartetPixelMaskTable is used by getstipplepixels to get a pixel mask * corresponding to a quartet of bits. Note: the bit/byte order dependency * is handled by QuartetBitsTable above. */ #if PSZ == 4 #if PGSZ == 32 PixelGroup QuartetPixelMaskTable[] = { 0x00000000, 0x0000000F, 0x000000F0, 0x000000FF, 0x00000F00, 0x00000F0F, 0x00000FF0, 0x00000FFF, 0x0000F000, 0x0000F00F, 0x0000F0F0, 0x0000F0FF, 0x0000FF00, 0x0000FF0F, 0x0000FFF0, 0x0000FFFF, 0x000F0000, 0x000F000F, 0x000F00F0, 0x000F00FF, 0x000F0F00, 0x000F0F0F, 0x000F0FF0, 0x000F0FFF, 0x000FF000, 0x000FF00F, 0x000FF0F0, 0x000FF0FF, 0x000FFF00, 0x000FFF0F, 0x000FFFF0, 0x000FFFFF, 0x00F00000, 0x00F0000F, 0x00F000F0, 0x00F000FF, 0x00F00F00, 0x00F00F0F, 0x00F00FF0, 0x00F00FFF, 0x00F0F000, 0x00F0F00F, 0x00F0F0F0, 0x00F0F0FF, 0x00F0FF00, 0x00F0FF0F, 0x00F0FFF0, 0x00F0FFFF, 0x00FF0000, 0x00FF000F, 0x00FF00F0, 0x00FF00FF, 0x00FF0F00, 0x00FF0F0F, 0x00FF0FF0, 0x00FF0FFF, 0x00FFF000, 0x00FFF00F, 0x00FFF0F0, 0x00FFF0FF, 0x00FFFF00, 0x00FFFF0F, 0x00FFFFF0, 0x00FFFFFF, 0x0F000000, 0x0F00000F, 0x0F0000F0, 0x0F0000FF, 0x0F000F00, 0x0F000F0F, 0x0F000FF0, 0x0F000FFF, 0x0F00F000, 0x0F00F00F, 0x0F00F0F0, 0x0F00F0FF, 0x0F00FF00, 0x0F00FF0F, 0x0F00FFF0, 0x0F00FFFF, 0x0F0F0000, 0x0F0F000F, 0x0F0F00F0, 0x0F0F00FF, 0x0F0F0F00, 0x0F0F0F0F, 0x0F0F0FF0, 0x0F0F0FFF, 0x0F0FF000, 0x0F0FF00F, 0x0F0FF0F0, 0x0F0FF0FF, 0x0F0FFF00, 0x0F0FFF0F, 0x0F0FFFF0, 0x0F0FFFFF, 0x0FF00000, 0x0FF0000F, 0x0FF000F0, 0x0FF000FF, 0x0FF00F00, 0x0FF00F0F, 0x0FF00FF0, 0x0FF00FFF, 0x0FF0F000, 0x0FF0F00F, 0x0FF0F0F0, 0x0FF0F0FF, 0x0FF0FF00, 0x0FF0FF0F, 0x0FF0FFF0, 0x0FF0FFFF, 0x0FFF0000, 0x0FFF000F, 0x0FFF00F0, 0x0FFF00FF, 0x0FFF0F00, 0x0FFF0F0F, 0x0FFF0FF0, 0x0FFF0FFF, 0x0FFFF000, 0x0FFFF00F, 0x0FFFF0F0, 0x0FFFF0FF, 0x0FFFFF00, 0x0FFFFF0F, 0x0FFFFFF0, 0x0FFFFFFF, 0xF0000000, 0xF000000F, 0xF00000F0, 0xF00000FF, 0xF0000F00, 0xF0000F0F, 0xF0000FF0, 0xF0000FFF, 0xF000F000, 0xF000F00F, 0xF000F0F0, 0xF000F0FF, 0xF000FF00, 0xF000FF0F, 0xF000FFF0, 0xF000FFFF, 0xF00F0000, 0xF00F000F, 0xF00F00F0, 0xF00F00FF, 0xF00F0F00, 0xF00F0F0F, 0xF00F0FF0, 0xF00F0FFF, 0xF00FF000, 0xF00FF00F, 0xF00FF0F0, 0xF00FF0FF, 0xF00FFF00, 0xF00FFF0F, 0xF00FFFF0, 0xF00FFFFF, 0xF0F00000, 0xF0F0000F, 0xF0F000F0, 0xF0F000FF, 0xF0F00F00, 0xF0F00F0F, 0xF0F00FF0, 0xF0F00FFF, 0xF0F0F000, 0xF0F0F00F, 0xF0F0F0F0, 0xF0F0F0FF, 0xF0F0FF00, 0xF0F0FF0F, 0xF0F0FFF0, 0xF0F0FFFF, 0xF0FF0000, 0xF0FF000F, 0xF0FF00F0, 0xF0FF00FF, 0xF0FF0F00, 0xF0FF0F0F, 0xF0FF0FF0, 0xF0FF0FFF, 0xF0FFF000, 0xF0FFF00F, 0xF0FFF0F0, 0xF0FFF0FF, 0xF0FFFF00, 0xF0FFFF0F, 0xF0FFFFF0, 0xF0FFFFFF, 0xFF000000, 0xFF00000F, 0xFF0000F0, 0xFF0000FF, 0xFF000F00, 0xFF000F0F, 0xFF000FF0, 0xFF000FFF, 0xFF00F000, 0xFF00F00F, 0xFF00F0F0, 0xFF00F0FF, 0xFF00FF00, 0xFF00FF0F, 0xFF00FFF0, 0xFF00FFFF, 0xFF0F0000, 0xFF0F000F, 0xFF0F00F0, 0xFF0F00FF, 0xFF0F0F00, 0xFF0F0F0F, 0xFF0F0FF0, 0xFF0F0FFF, 0xFF0FF000, 0xFF0FF00F, 0xFF0FF0F0, 0xFF0FF0FF, 0xFF0FFF00, 0xFF0FFF0F, 0xFF0FFFF0, 0xFF0FFFFF, 0xFFF00000, 0xFFF0000F, 0xFFF000F0, 0xFFF000FF, 0xFFF00F00, 0xFFF00F0F, 0xFFF00FF0, 0xFFF00FFF, 0xFFF0F000, 0xFFF0F00F, 0xFFF0F0F0, 0xFFF0F0FF, 0xFFF0FF00, 0xFFF0FF0F, 0xFFF0FFF0, 0xFFF0FFFF, 0xFFFF0000, 0xFFFF000F, 0xFFFF00F0, 0xFFFF00FF, 0xFFFF0F00, 0xFFFF0F0F, 0xFFFF0FF0, 0xFFFF0FFF, 0xFFFFF000, 0xFFFFF00F, 0xFFFFF0F0, 0xFFFFF0FF, 0xFFFFFF00, 0xFFFFFF0F, 0xFFFFFFF0, 0xFFFFFFFF, }; #else /* PGSZ == 64 */ No QuartetPixelMaskTable for psz=PSZ this would be a 64K entry table, a bit much I think. Try breaking things in two: mask = table[index&0xff00]<<32 | table[index&0xff] #endif /* PGSZ */ #endif /* PSZ == 4 */ #if PSZ == 8 PixelGroup QuartetPixelMaskTable[] = { #if PGSZ == 32 0x00000000, 0x000000FF, 0x0000FF00, 0x0000FFFF, 0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00FFFFFF, 0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF, 0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFFFF #else /* PGSZ == 64 */ 0x0000000000000000, 0x00000000000000FF, 0x000000000000FF00, 0x000000000000FFFF, 0x0000000000FF0000, 0x0000000000FF00FF, 0x0000000000FFFF00, 0x0000000000FFFFFF, 0x00000000FF000000, 0x00000000FF0000FF, 0x00000000FF00FF00, 0x00000000FF00FFFF, 0x00000000FFFF0000, 0x00000000FFFF00FF, 0x00000000FFFFFF00, 0x00000000FFFFFFFF, 0x000000FF00000000, 0x000000FF000000FF, 0x000000FF0000FF00, 0x000000FF0000FFFF, 0x000000FF00FF0000, 0x000000FF00FF00FF, 0x000000FF00FFFF00, 0x000000FF00FFFFFF, 0x000000FFFF000000, 0x000000FFFF0000FF, 0x000000FFFF00FF00, 0x000000FFFF00FFFF, 0x000000FFFFFF0000, 0x000000FFFFFF00FF, 0x000000FFFFFFFF00, 0x000000FFFFFFFFFF, 0x0000FF0000000000, 0x0000FF00000000FF, 0x0000FF000000FF00, 0x0000FF000000FFFF, 0x0000FF0000FF0000, 0x0000FF0000FF00FF, 0x0000FF0000FFFF00, 0x0000FF0000FFFFFF, 0x0000FF00FF000000, 0x0000FF00FF0000FF, 0x0000FF00FF00FF00, 0x0000FF00FF00FFFF, 0x0000FF00FFFF0000, 0x0000FF00FFFF00FF, 0x0000FF00FFFFFF00, 0x0000FF00FFFFFFFF, 0x0000FFFF00000000, 0x0000FFFF000000FF, 0x0000FFFF0000FF00, 0x0000FFFF0000FFFF, 0x0000FFFF00FF0000, 0x0000FFFF00FF00FF, 0x0000FFFF00FFFF00, 0x0000FFFF00FFFFFF, 0x0000FFFFFF000000, 0x0000FFFFFF0000FF, 0x0000FFFFFF00FF00, 0x0000FFFFFF00FFFF, 0x0000FFFFFFFF0000, 0x0000FFFFFFFF00FF, 0x0000FFFFFFFFFF00, 0x0000FFFFFFFFFFFF, 0x00FF000000000000, 0x00FF0000000000FF, 0x00FF00000000FF00, 0x00FF00000000FFFF, 0x00FF000000FF0000, 0x00FF000000FF00FF, 0x00FF000000FFFF00, 0x00FF000000FFFFFF, 0x00FF0000FF000000, 0x00FF0000FF0000FF, 0x00FF0000FF00FF00, 0x00FF0000FF00FFFF, 0x00FF0000FFFF0000, 0x00FF0000FFFF00FF, 0x00FF0000FFFFFF00, 0x00FF0000FFFFFFFF, 0x00FF00FF00000000, 0x00FF00FF000000FF, 0x00FF00FF0000FF00, 0x00FF00FF0000FFFF, 0x00FF00FF00FF0000, 0x00FF00FF00FF00FF, 0x00FF00FF00FFFF00, 0x00FF00FF00FFFFFF, 0x00FF00FFFF000000, 0x00FF00FFFF0000FF, 0x00FF00FFFF00FF00, 0x00FF00FFFF00FFFF, 0x00FF00FFFFFF0000, 0x00FF00FFFFFF00FF, 0x00FF00FFFFFFFF00, 0x00FF00FFFFFFFFFF, 0x00FFFF0000000000, 0x00FFFF00000000FF, 0x00FFFF000000FF00, 0x00FFFF000000FFFF, 0x00FFFF0000FF0000, 0x00FFFF0000FF00FF, 0x00FFFF0000FFFF00, 0x00FFFF0000FFFFFF, 0x00FFFF00FF000000, 0x00FFFF00FF0000FF, 0x00FFFF00FF00FF00, 0x00FFFF00FF00FFFF, 0x00FFFF00FFFF0000, 0x00FFFF00FFFF00FF, 0x00FFFF00FFFFFF00, 0x00FFFF00FFFFFFFF, 0x00FFFFFF00000000, 0x00FFFFFF000000FF, 0x00FFFFFF0000FF00, 0x00FFFFFF0000FFFF, 0x00FFFFFF00FF0000, 0x00FFFFFF00FF00FF, 0x00FFFFFF00FFFF00, 0x00FFFFFF00FFFFFF, 0x00FFFFFFFF000000, 0x00FFFFFFFF0000FF, 0x00FFFFFFFF00FF00, 0x00FFFFFFFF00FFFF, 0x00FFFFFFFFFF0000, 0x00FFFFFFFFFF00FF, 0x00FFFFFFFFFFFF00, 0x00FFFFFFFFFFFFFF, 0xFF00000000000000, 0xFF000000000000FF, 0xFF0000000000FF00, 0xFF0000000000FFFF, 0xFF00000000FF0000, 0xFF00000000FF00FF, 0xFF00000000FFFF00, 0xFF00000000FFFFFF, 0xFF000000FF000000, 0xFF000000FF0000FF, 0xFF000000FF00FF00, 0xFF000000FF00FFFF, 0xFF000000FFFF0000, 0xFF000000FFFF00FF, 0xFF000000FFFFFF00, 0xFF000000FFFFFFFF, 0xFF0000FF00000000, 0xFF0000FF000000FF, 0xFF0000FF0000FF00, 0xFF0000FF0000FFFF, 0xFF0000FF00FF0000, 0xFF0000FF00FF00FF, 0xFF0000FF00FFFF00, 0xFF0000FF00FFFFFF, 0xFF0000FFFF000000, 0xFF0000FFFF0000FF, 0xFF0000FFFF00FF00, 0xFF0000FFFF00FFFF, 0xFF0000FFFFFF0000, 0xFF0000FFFFFF00FF, 0xFF0000FFFFFFFF00, 0xFF0000FFFFFFFFFF, 0xFF00FF0000000000, 0xFF00FF00000000FF, 0xFF00FF000000FF00, 0xFF00FF000000FFFF, 0xFF00FF0000FF0000, 0xFF00FF0000FF00FF, 0xFF00FF0000FFFF00, 0xFF00FF0000FFFFFF, 0xFF00FF00FF000000, 0xFF00FF00FF0000FF, 0xFF00FF00FF00FF00, 0xFF00FF00FF00FFFF, 0xFF00FF00FFFF0000, 0xFF00FF00FFFF00FF, 0xFF00FF00FFFFFF00, 0xFF00FF00FFFFFFFF, 0xFF00FFFF00000000, 0xFF00FFFF000000FF, 0xFF00FFFF0000FF00, 0xFF00FFFF0000FFFF, 0xFF00FFFF00FF0000, 0xFF00FFFF00FF00FF, 0xFF00FFFF00FFFF00, 0xFF00FFFF00FFFFFF, 0xFF00FFFFFF000000, 0xFF00FFFFFF0000FF, 0xFF00FFFFFF00FF00, 0xFF00FFFFFF00FFFF, 0xFF00FFFFFFFF0000, 0xFF00FFFFFFFF00FF, 0xFF00FFFFFFFFFF00, 0xFF00FFFFFFFFFFFF, 0xFFFF000000000000, 0xFFFF0000000000FF, 0xFFFF00000000FF00, 0xFFFF00000000FFFF, 0xFFFF000000FF0000, 0xFFFF000000FF00FF, 0xFFFF000000FFFF00, 0xFFFF000000FFFFFF, 0xFFFF0000FF000000, 0xFFFF0000FF0000FF, 0xFFFF0000FF00FF00, 0xFFFF0000FF00FFFF, 0xFFFF0000FFFF0000, 0xFFFF0000FFFF00FF, 0xFFFF0000FFFFFF00, 0xFFFF0000FFFFFFFF, 0xFFFF00FF00000000, 0xFFFF00FF000000FF, 0xFFFF00FF0000FF00, 0xFFFF00FF0000FFFF, 0xFFFF00FF00FF0000, 0xFFFF00FF00FF00FF, 0xFFFF00FF00FFFF00, 0xFFFF00FF00FFFFFF, 0xFFFF00FFFF000000, 0xFFFF00FFFF0000FF, 0xFFFF00FFFF00FF00, 0xFFFF00FFFF00FFFF, 0xFFFF00FFFFFF0000, 0xFFFF00FFFFFF00FF, 0xFFFF00FFFFFFFF00, 0xFFFF00FFFFFFFFFF, 0xFFFFFF0000000000, 0xFFFFFF00000000FF, 0xFFFFFF000000FF00, 0xFFFFFF000000FFFF, 0xFFFFFF0000FF0000, 0xFFFFFF0000FF00FF, 0xFFFFFF0000FFFF00, 0xFFFFFF0000FFFFFF, 0xFFFFFF00FF000000, 0xFFFFFF00FF0000FF, 0xFFFFFF00FF00FF00, 0xFFFFFF00FF00FFFF, 0xFFFFFF00FFFF0000, 0xFFFFFF00FFFF00FF, 0xFFFFFF00FFFFFF00, 0xFFFFFF00FFFFFFFF, 0xFFFFFFFF00000000, 0xFFFFFFFF000000FF, 0xFFFFFFFF0000FF00, 0xFFFFFFFF0000FFFF, 0xFFFFFFFF00FF0000, 0xFFFFFFFF00FF00FF, 0xFFFFFFFF00FFFF00, 0xFFFFFFFF00FFFFFF, 0xFFFFFFFFFF000000, 0xFFFFFFFFFF0000FF, 0xFFFFFFFFFF00FF00, 0xFFFFFFFFFF00FFFF, 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFF00FF, 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFFFFFF, #endif /* PGSZ */ }; #endif /* PSZ == 8 */ #if PSZ == 16 PixelGroup QuartetPixelMaskTable[] = { #if PGSZ == 32 0x00000000, 0x0000FFFF, 0xFFFF0000, 0xFFFFFFFF, #else /* PGSZ == 64 */ 0x0000000000000000, 0x000000000000FFFF, 0x00000000FFFF0000, 0x00000000FFFFFFFF, 0x0000FFFF00000000, 0x0000FFFF0000FFFF, 0x0000FFFFFFFF0000, 0x0000FFFFFFFFFFFF, 0xFFFF000000000000, 0xFFFF00000000FFFF, 0xFFFF0000FFFF0000, 0xFFFF0000FFFFFFFF, 0xFFFFFFFF00000000, 0xFFFFFFFF0000FFFF, 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFFFFFF, #endif /* PGSZ */ }; #endif /* PSZ == 16 */ #if PSZ == 24 PixelGroup QuartetPixelMaskTable[] = { #if PGSZ == 32 /* Four pixels consist three pixel groups....*/ 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/ /* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/ /* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/ /* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/ /* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/ /* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/ /* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/ /* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/ /* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/ /* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/ /* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/ /* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/ /* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/ /* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/ /* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/ /* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/ /* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/ #else /* PGSZ == 64 */ 0x0000000000000000, 0x0000000000FFFFFF, 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF #endif /* PGSZ */ }; #endif /* PSZ == 24 */ #if PSZ == 32 PixelGroup QuartetPixelMaskTable[] = { #if PGSZ == 32 0x00000000, 0xFFFFFFFF, #else /* PGSZ == 64 */ 0x0000000000000000, 0x00000000FFFFFFFF, 0xFFFFFFFF00000000, 0xFFFFFFFFFFFFFFFF #endif /* PGSZ */ }; #endif /* PSZ == 32 */ #if PSZ == 24 int cfb24Shift[] = #if (BITMAP_BIT_ORDER == MSBFirst) {8,0,16,16,8,24,0,0}; #else /* (BITMAP_BIT_ORDER == LSBFirst) */ {0,0,24,8,16,16,8,0}; #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/stipmips.s0100664000076400007640000001530107120677563021501 0ustar constconst/* * $XConsortium: stipmips.s,v 1.10 94/04/17 20:29:08 keith Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * MIPS assembly code for optimized text rendering. * * Other stippling could be done in assembly, but the payoff is * not nearly as large. Mostly because large areas are heavily * optimized already. */ #ifdef MIPSEL # define BitsR sll # define BitsL srl # define BO(o) o # define HO(o) o # define WO(o) o # define FourBits(dest,bits) and dest, bits, 0xf #else # define BitsR srl # define BitsL sll # define BO(o) 3-o # define HO(o) 2-o # define WO(o) o # define FourBits(dest,bits) srl dest, bits, 28 #endif /* reordering instructions would be fatal here */ .set noreorder /* * cfbStippleStack(addr, stipple, value, stride, Count, Shift) * 4 5 6 7 16(sp) 20(sp) * * Apply successive 32-bit stipples starting at addr, addr+stride, ... * * Used for text rendering, but only when no data could be lost * when the stipple is shifted left by Shift bits */ /* arguments */ #define addr $4 #define stipple $5 #define value $6 #define stride $7 #define Count 16($sp) #define Shift 20($sp) /* local variables */ #define count $14 #define shift $13 #define atemp $12 #define bits $11 #define lshift $9 #define sbase $8 #define stemp $2 #define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ #define CASE_MASK 0x1e0 /* first case mask */ #define ForEachLine $200 #define NextLine $201 #define NextLine1 $202 #define CaseBegin $203 #define ForEachBits $204 #define ForEachBits1 $205 #define NextBits $206 #ifdef TETEXT #define cfbStippleStack cfbStippleStackTE #endif .globl cfbStippleStack .ent cfbStippleStack 2 cfbStippleStack: .frame $sp, 0, $31 lw count, Count /* fetch stack params */ la sbase,CaseBegin /* load up switch table */ lw shift, Shift li lshift, 4 /* compute offset within */ subu lshift, lshift, shift /* stipple of remaining bits */ #ifdef MIPSEL addu shift, shift, CASE_SIZE /* first shift for LSB */ #else addu shift, shift, 28-CASE_SIZE /* first shift for MSB */ #endif /* do ... while (--count > 0); */ ForEachLine: lw bits, 0(stipple) /* get stipple bits */ move atemp, addr /* set up for this line */ #ifdef TETEXT /* Terminal emulator fonts are expanded and have many 0 rows */ beqz bits, NextLine /* skip out early on 0 */ #endif addu addr, addr, stride /* step for the loop */ BitsR stemp, bits, shift /* get first bits */ and stemp, stemp, CASE_MASK /* compute first branch */ addu stemp, stemp, sbase /* ... */ j stemp /* ... */ BitsL bits, bits, lshift /* set remaining bits */ ForEachBits: addu atemp, atemp, 4 ForEachBits1: FourBits(stemp, bits) /* compute jump for */ sll stemp, stemp, CASE_SIZE /* next four bits */ addu stemp, stemp, sbase /* ... */ j stemp /* ... */ BitsL bits, bits, 4 /* step for remaining bits */ CaseBegin: bnez bits, ForEachBits1 /* 0 */ addu atemp, atemp, 4 NextLine: addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* 1 */ sb value, BO(0)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* 2 */ sb value, BO(1)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* 3 */ sh value, HO(0)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* 4 */ sb value, BO(2)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop sb value, BO(0)(atemp) /* 5 */ bnez bits, ForEachBits sb value, BO(2)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop sb value, BO(1)(atemp) /* 6 */ bnez bits, ForEachBits sb value, BO(2)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop bnez bits, ForEachBits /* 7 */ swl value, BO(2)(atemp) /* untested on MSB */ addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* 8 */ sb value, BO(3)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop sb value, BO(0)(atemp) /* 9 */ bnez bits, ForEachBits sb value, BO(3)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop sb value, BO(1)(atemp) /* a */ bnez bits, ForEachBits sb value, BO(3)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop sh value, HO(0)(atemp) /* b */ bnez bits, ForEachBits sb value, BO(3)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop bnez bits, ForEachBits /* c */ sh value, HO(2)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop sb value, BO(0)(atemp) /* d */ bnez bits, ForEachBits sh value, HO(2)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop bnez bits, ForEachBits /* e */ swr value, BO(1)(atemp) /* untested on MSB */ addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop bnez bits, ForEachBits /* f */ sw value, WO(0)(atemp) addu count, count, -1 bnez count, ForEachLine addu stipple, stipple, 4 j $31 nop nop .end cfbStippleStack vnc_unixsrc/Xvnc/programs/Xserver/cfb/stipsparc.s0100664000076400007640000001440507446015423021635 0ustar constconst/* * $XConsortium: stipsparc.s,v 1.9 94/04/17 20:29:09 rws Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * SPARC assembly code for optimized text rendering. * * Other stippling could be done in assembly, but the payoff is * not nearly as large. Mostly because large areas are heavily * optimized already. */ /* not that I expect to ever see an LSB SPARC, but ... */ #ifdef LITTLE_ENDIAN # define BitsR sll # define BitsL srl # define BO(o) o # define HO(o) o # define WO(o) o # define FourBits(dest,bits) and bits, 0xf, dest #else # define BitsR srl # define BitsL sll # define BO(o) 3-o # define HO(o) 2-o # define WO(o) o # define FourBits(dest,bits) srl bits, 28, dest #endif /* * cfbStippleStack(addr, stipple, value, stride, Count, Shift) * 4 5 6 7 16(sp) 20(sp) * * Apply successive 32-bit stipples starting at addr, addr+stride, ... * * Used for text rendering, but only when no data could be lost * when the stipple is shifted left by Shift bits */ /* arguments */ #define addr %i0 #define stipple %i1 #define value %i2 #define stride %i3 #define count %i4 #define shift %i5 /* local variables */ #define atemp %l0 #define bits %l1 #define lshift %l2 #define sbase %l3 #define stemp %l4 #define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ #define CASE_MASK 0x1e0 /* first case mask */ #define ForEachLine LY1 #define NextLine LY2 #define CaseBegin LY3 #define ForEachBits LY4 #define NextBits LY5 #if defined(SVR4) || ( defined(linux) && defined(__ELF__) ) #ifdef TETEXT #define _cfbStippleStack cfbStippleStackTE #else #define _cfbStippleStack cfbStippleStack #endif #else #ifdef TETEXT #define _cfbStippleStack _cfbStippleStackTE #endif #endif .seg "text" .proc 16 .globl _cfbStippleStack _cfbStippleStack: save %sp,-64,%sp sethi %hi(CaseBegin),sbase /* load up switch table */ or sbase,%lo(CaseBegin),sbase mov 4,lshift /* compute offset within */ sub lshift, shift, lshift /* stipple of remaining bits */ #ifdef LITTLE_ENDIAN inc CASE_SIZE, shift /* first shift for LSB */ #else inc 28-CASE_SIZE, shift /* first shift for MSB */ #endif /* do ... while (--count > 0); */ ForEachLine: ld [stipple],bits /* get stipple bits */ mov addr,atemp /* set up for this line */ #ifdef TETEXT /* Terminal emulator fonts are expanded and have many 0 rows */ tst bits bz NextLine /* skip out early on 0 */ #endif add addr, stride, addr /* step for the loop */ BitsR bits, shift, stemp /* get first bits */ and stemp, CASE_MASK, stemp /* compute first jump */ BitsL bits, lshift, bits /* set remaining bits */ jmp sbase+stemp /* ... */ tst bits ForEachBits: inc 4, atemp ForEachBits1: FourBits(stemp, bits) /* compute jump for */ sll stemp, CASE_SIZE, stemp /* these four bits */ BitsL bits, 4, bits /* step for remaining bits */ jmp sbase+stemp /* jump */ tst bits CaseBegin: bnz,a ForEachBits1 /* 0 */ inc 4, atemp NextLine: deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 1 */ stb value, [atemp+BO(0)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 2 */ stb value, [atemp+BO(1)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 3 */ sth value, [atemp+HO(0)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 4 */ stb value, [atemp+BO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop stb value, [atemp+BO(0)] /* 5 */ bnz ForEachBits stb value, [atemp+BO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore stb value, [atemp+BO(1)] /* 6 */ bnz ForEachBits stb value, [atemp+BO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore sth value, [atemp+HO(0)] /* 7 */ bnz ForEachBits stb value, [atemp+BO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore bnz ForEachBits /* 8 */ stb value, [atemp+BO(3)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop stb value, [atemp+BO(0)] /* 9 */ bnz ForEachBits stb value, [atemp+BO(3)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore stb value, [atemp+BO(1)] /* a */ bnz ForEachBits stb value, [atemp+BO(3)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore sth value, [atemp+HO(0)] /* b */ bnz ForEachBits stb value, [atemp+BO(3)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore bnz ForEachBits /* c */ sth value, [atemp+HO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop stb value, [atemp+BO(0)] /* d */ bnz ForEachBits sth value, [atemp+HO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore stb value, [atemp+BO(1)] /* e */ bnz ForEachBits sth value, [atemp+HO(2)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore bnz ForEachBits /* f */ st value, [atemp+WO(0)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbpntwin.c0100664000076400007640000004073107120677563021610 0ustar constconst/* $XConsortium: cfbpntwin.c,v 5.18 94/04/17 20:28:57 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbpntwin.c,v 3.0 1996/06/29 09:05:45 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "windowstr.h" #include "regionstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "mi.h" void cfbPaintWindow(pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { register cfbPrivWin *pPrivWin; WindowPtr pBgWin; pPrivWin = cfbGetWindowPrivate(pWin); switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { case None: break; case ParentRelative: do { pWin = pWin->parent; } while (pWin->backgroundState == ParentRelative); (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, what); break; case BackgroundPixmap: if (pPrivWin->fastBackground) { cfbFillBoxTile32 ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pPrivWin->pRotatedBackground); } else { cfbFillBoxTileOdd ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->background.pixmap, (int) pWin->drawable.x, (int) pWin->drawable.y); } break; case BackgroundPixel: cfbFillBoxSolid ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->background.pixel); break; } break; case PW_BORDER: if (pWin->borderIsPixel) { cfbFillBoxSolid ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->border.pixel); } else if (pPrivWin->fastBorder) { cfbFillBoxTile32 ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pPrivWin->pRotatedBorder); } else { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); cfbFillBoxTileOdd ((DrawablePtr)pWin, (int)REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), pWin->border.pixmap, (int) pBgWin->drawable.x, (int) pBgWin->drawable.y); } break; } } /* * Use the RROP macros in copy mode */ #define RROP GXcopy #include "cfbrrop.h" #ifdef RROP_UNROLL # define Expand(left,right,leftAdjust) {\ int part = nmiddle & RROP_UNROLL_MASK; \ int widthStep; \ widthStep = widthDst - nmiddle - leftAdjust; \ nmiddle >>= RROP_UNROLL_SHIFT; \ while (h--) { \ left \ pdst += part; \ switch (part) { \ RROP_UNROLL_CASE(pdst) \ } \ m = nmiddle; \ while (m) { \ pdst += RROP_UNROLL; \ RROP_UNROLL_LOOP(pdst) \ m--; \ } \ right \ pdst += widthStep; \ } \ } #else # define Expand(left, right, leftAdjust) { \ int widthStep; \ widthStep = widthDst - nmiddle - leftAdjust; \ while (h--) { \ left \ m = nmiddle; \ while (m--) {\ RROP_SOLID(pdst); \ pdst++; \ } \ right \ pdst += widthStep; \ } \ } #endif void cfbFillBoxSolid (pDrawable, nBox, pBox, pixel) DrawablePtr pDrawable; int nBox; BoxPtr pBox; unsigned long pixel; { unsigned long *pdstBase; int widthDst; register int h; register unsigned long rrop_xor; register unsigned long *pdst; register unsigned long leftMask, rightMask; int nmiddle; register int m; int w; #if PSZ == 24 int leftIndex, rightIndex; unsigned long piQxelArray[3], xOffset, *pdstULC; /*upper left corner*/ piQxelArray[0] = (pixel&0xFFFFFF) | ((pixel&0xFF)<<24); piQxelArray[1] = ((pixel&0xFFFF00)>>8) | ((pixel&0xFFFF)<<16); piQxelArray[2] = ((pixel&0xFFFFFF)<<8) | ((pixel&0xFF0000)>>16); #endif cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase); rrop_xor = PFILL(pixel); for (; nBox; nBox--, pBox++) { pdst = pdstBase + pBox->y1 * widthDst; h = pBox->y2 - pBox->y1; w = pBox->x2 - pBox->x1; #if PSZ == 8 if (w == 1) { register char *pdstb = ((char *) pdst) + pBox->x1; int incr = widthDst * PGSZB; while (h--) { *pdstb = rrop_xor; pdstb += incr; } } else { #endif #if PSZ == 24 /* _Box has x1, y1, x2, y2*/ leftIndex = pBox->x1 & 3; rightIndex = ((leftIndex+w)<5)?0:(pBox->x2 &3); nmiddle = w - rightIndex; if(leftIndex){ nmiddle -= (4 - leftIndex); } nmiddle >>= 2; if(nmiddle < 0) nmiddle = 0; pdst = pdstBase + pBox->y1 * widthDst + ((pBox->x1*3) >> 2); switch(leftIndex+w){ case 4: switch(leftIndex){ case 0: while(h--){ *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst = piQxelArray[2]; pdst -=2; pdst += widthDst; } break; case 1: while(h--){ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst = piQxelArray[2]; pdst -=2; pdst += widthDst; } break; case 2: while(h--){ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst-- = piQxelArray[2]; pdst += widthDst; } break; case 3: while(h--){ *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); pdst += widthDst; } break; } break; case 3: switch(leftIndex){ case 0: while(h--){ *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst--; pdst += widthDst; } break; case 1: while(h--){ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst--; pdst += widthDst; } break; case 2: while(h--){ *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst += widthDst; } break; } break; case 2: while(h--){ if(leftIndex){ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); } else{ *pdst++ = piQxelArray[0]; } *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); pdst += widthDst; } break; case 1: /*only if leftIndex = 0 and w = 1*/ while(h--){ *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); pdst += widthDst; } break; case 0: /*never*/ break; default: { w = nmiddle; pdstULC = pdst; /* maskbits (pBox->x1, w, leftMask, rightMask, nmiddle);*/ while(h--){ nmiddle = w; pdst = pdstULC; switch(leftIndex){ case 0: break; case 1: *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst++ = piQxelArray[2]; break; case 2: *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst++ = piQxelArray[2]; break; case 3: *pdst++ = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); break; } while(nmiddle--){ *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst++ = piQxelArray[2]; } switch(rightIndex){ case 0: break; case 1: *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); break; case 2: *pdst++ = piQxelArray[0]; *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); break; case 3: *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); break; } pdstULC += widthDst; } } } #else pdst += (pBox->x1 >> PWSH); if ((pBox->x1 & PIM) + w <= PPW) { maskpartialbits(pBox->x1, w, leftMask); while (h--) { *pdst = (*pdst & ~leftMask) | (rrop_xor & leftMask); pdst += widthDst; } } else { maskbits (pBox->x1, w, leftMask, rightMask, nmiddle); if (leftMask) { if (rightMask) { Expand (RROP_SOLID_MASK (pdst, leftMask); pdst++; , RROP_SOLID_MASK (pdst, rightMask); , 1) } else { Expand (RROP_SOLID_MASK (pdst, leftMask); pdst++;, ;, 1) } } else { if (rightMask) { Expand (;, RROP_SOLID_MASK (pdst, rightMask);, 0) } else { Expand (;, ;, 0) } } } #endif #if PSZ == 8 } #endif } } void cfbFillBoxTile32 (pDrawable, nBox, pBox, tile) DrawablePtr pDrawable; int nBox; /* number of boxes to fill */ BoxPtr pBox; /* pointer to list of boxes to fill */ PixmapPtr tile; /* rotated, expanded tile */ { register unsigned long rrop_xor; register unsigned long *pdst; register int m; unsigned long *psrc; int tileHeight; int widthDst; int w; int h; register unsigned long leftMask; register unsigned long rightMask; int nmiddle; int y; int srcy; unsigned long *pdstBase; #if PSZ == 24 int leftIndex, rightIndex; unsigned long piQxelArray[3], xOffset, *pdstULC; #endif tileHeight = tile->drawable.height; psrc = (unsigned long *)tile->devPrivate.ptr; cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase); while (nBox--) { #if PSZ == 24 w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; leftIndex = pBox->x1 & 3; /* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/ rightIndex = pBox->x2 &3; nmiddle = w - rightIndex; if(leftIndex){ nmiddle -= (4 - leftIndex); } nmiddle >>= 2; if(nmiddle < 0) nmiddle = 0; pdst = pdstBase + ((pBox->x1 *3)>> 2) + pBox->y1 * widthDst; srcy = y % tileHeight; #define StepTile piQxelArray[0] = (psrc[srcy] & 0xFFFFFF) | ((psrc[srcy] & 0xFF)<<24); \ piQxelArray[1] = (psrc[srcy] & 0xFFFF00) | ((psrc[srcy] & 0xFFFF)<<16); \ piQxelArray[2] = ((psrc[srcy] & 0xFF0000)>>16) | \ ((psrc[srcy] & 0xFFFFFF)<<8); \ /*rrop_xor = psrc[srcy];*/ \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; switch(leftIndex+w){ case 4: switch(leftIndex){ case 0: while(h--){ StepTile *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst = piQxelArray[2]; pdst-=2; pdst += widthDst; } break; case 1: while(h--){ StepTile *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst = piQxelArray[2]; pdst-=2; pdst += widthDst; } break; case 2: while(h--){ StepTile *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst-- = piQxelArray[2]; pdst += widthDst; } break; case 3: while(h--){ StepTile *pdst = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); pdst += widthDst; } break; } break; case 3: switch(leftIndex){ case 0: while(h--){ StepTile *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst--; pdst += widthDst; } break; case 1: while(h--){ StepTile *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst--; pdst += widthDst; } break; case 2: while(h--){ StepTile *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst-- = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); pdst += widthDst; } break; } break; case 2: while(h--){ StepTile if(leftIndex){ *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); } else{ *pdst++ = piQxelArray[0]; } *pdst-- = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); pdst += widthDst; } break; case 1: /*only if leftIndex = 0 and w = 1*/ while(h--){ StepTile *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); pdst += widthDst; } break; case 0: /*never*/ break; default: { w = nmiddle; pdstULC = pdst; while(h--){ StepTile nmiddle = w; pdst = pdstULC; switch(leftIndex){ case 0: break; case 1: *pdst++ = ((*pdst) & 0xFFFFFF) | (piQxelArray[0] & 0xFF000000); *pdst++ = piQxelArray[1]; *pdst++ = piQxelArray[2]; break; case 2: *pdst++ = ((*pdst) & 0xFFFF) | (piQxelArray[1] & 0xFFFF0000); *pdst++ = piQxelArray[2]; break; case 3: *pdst++ = ((*pdst) & 0xFF) | (piQxelArray[2] & 0xFFFFFF00); break; } while(nmiddle--){ *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst++ = piQxelArray[2]; } switch(rightIndex){ case 0: break; case 1: *pdst = ((*pdst) & 0xFF000000) | (piQxelArray[0] & 0xFFFFFF); break; case 2: *pdst++ = piQxelArray[0]; *pdst = ((*pdst) & 0xFFFF0000) | (piQxelArray[1] & 0xFFFF); break; case 3: *pdst++ = piQxelArray[0]; *pdst++ = piQxelArray[1]; *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelArray[2] & 0xFF); break; } pdstULC += widthDst; } } } #else w = pBox->x2 - pBox->x1; h = pBox->y2 - pBox->y1; y = pBox->y1; pdst = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); srcy = y % tileHeight; #define StepTile rrop_xor = psrc[srcy]; \ ++srcy; \ if (srcy == tileHeight) \ srcy = 0; if ( ((pBox->x1 & PIM) + w) < PPW) { maskpartialbits(pBox->x1, w, leftMask); rightMask = ~leftMask; while (h--) { StepTile *pdst = (*pdst & rightMask) | (rrop_xor & leftMask); pdst += widthDst; } } else { maskbits(pBox->x1, w, leftMask, rightMask, nmiddle); if (leftMask) { if (rightMask) { Expand (StepTile RROP_SOLID_MASK(pdst, leftMask); pdst++;, RROP_SOLID_MASK(pdst, rightMask);, 1) } else { Expand (StepTile RROP_SOLID_MASK(pdst, leftMask); pdst++;, ;, 1) } } else { if (rightMask) { Expand (StepTile , RROP_SOLID_MASK(pdst, rightMask);, 0) } else { Expand (StepTile , ;, 0) } } } #endif pBox++; } } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfb8line.c0100664000076400007640000010160207120677563021303 0ustar constconst/* * $TOG: cfb8line.c /main/33 1997/07/17 19:33:47 kaleb $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium * * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.2.2.3 1997/07/19 04:59:19 dawes Exp $ * Jeff Anton'x fixes: cfb8line.c 97/02/07 */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "mistruct.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfbrrop.h" #include "miline.h" #ifdef PIXEL_ADDR #if defined(__GNUC__) && defined(mc68020) #define STUPID volatile #define REARRANGE #else #define STUPID #endif #ifdef __GNUC__ /* lame compiler doesn't even look at 'register' attributes */ #define I_H do{ #define I_T }while(0); #define IMPORTANT_START I_H I_H I_H I_H I_H I_H I_H I_H I_H I_H #define IMPORTANT_END I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T #else #define IMPORTANT_START #define IMPORTANT_END #endif #define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask) #ifdef POLYSEGMENT # ifdef sun # define WIDTH_FAST 1152 # endif # ifdef ultrix # define WIDTH_FAST 1024 # endif # ifdef Mips # define WIDTH_FAST 4096 # endif # ifdef WIDTH_FAST # if WIDTH_FAST == 1024 # define FAST_MUL(y) ((y) << 10) # endif # if WIDTH_FAST == 1152 # define FAST_MUL(y) (((y) << 10) + ((y) << 7)) # endif # if WIDTH_FAST == 1280 # define FAST_MUL(y) (((y) << 10) + ((y) << 8)) # endif # if WIDTH_FAST == 2048 # define FAST_MUL(y) ((y) << 11) # endif # if WIDTH_FAST == 4096 # define FAST_MUL(y) ((y) << 12) # endif # endif # if defined(WIDTH_SHIFT) # ifdef FAST_MUL # define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Shift)) # if RROP == GXcopy # define INCLUDE_OTHERS # define SERIOUS_UNROLLING # endif # define INCLUDE_DRAW # define NWIDTH(nwidth) WIDTH_FAST # define WIDTH_MUL(y,w) FAST_MUL(y) # endif # else # define FUNC_NAME(e) RROP_NAME(e) # define WIDTH_MUL(y,w) ((y) * (w)) # define NWIDTH(nwidth) (nwidth) # define INCLUDE_DRAW # if !defined (FAST_MUL) && RROP == GXcopy # define INCLUDE_OTHERS # define SERIOUS_UNROLLING # endif # endif #else # define INCLUDE_DRAW # define WIDTH_MUL(y,w) ((y) * (w)) # define NWIDTH(nwidth) nwidth # ifdef PREVIOUS # define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Previous)) # else # define FUNC_NAME(e) RROP_NAME(e) # if RROP == GXcopy # define INCLUDE_OTHERS # ifdef PLENTIFUL_REGISTERS # define SAVE_X2Y2 # endif # define ORIGIN # define SERIOUS_UNROLLING # else # define EITHER_MODE # endif # endif #endif #if PSZ == 24 #define PXL2ADR(x) ((x)*3 >> 2) #if RROP == GXcopy #define body_rop \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ break; \ case 1: \ *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ break; \ case 3: \ *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ break; \ case 2: \ *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ break; \ } #endif #if RROP == GXxor #define body_rop \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp ^= piQxelXor[0] & 0xFFFFFF; \ break; \ case 1: \ *addrp ^= piQxelXor[2] & 0xFFFFFF00; \ break; \ case 3: \ *addrp ^= piQxelXor[0] & 0xFF000000; \ *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \ break; \ case 2: \ *addrp ^= piQxelXor[1] & 0xFFFF0000; \ *(addrp+1) ^= piQxelXor[2] & 0xFF; \ break; \ } #endif #if RROP == GXand #define body_rop \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp &= piQxelAnd[0] | 0xFF000000; \ break; \ case 1: \ *addrp &= piQxelAnd[2] | 0xFF; \ break; \ case 3: \ *addrp &= 0xFFFFFF | piQxelAnd[0]; \ *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \ break; \ case 2: \ *addrp &= 0xFFFF | piQxelAnd[1]; \ *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \ break; \ } #endif #if RROP == GXor #define body_rop \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp |= piQxelOr[0] & 0xFFFFFF; \ break; \ case 1: \ *addrp |= piQxelOr[2] & 0xFFFFFF00; \ break; \ case 3: \ *addrp |= piQxelOr[0] & 0xFF000000; \ *(addrp+1) |= piQxelOr[1] & 0xFFFF; \ break; \ case 2: \ *addrp |= piQxelOr[1] & 0xFFFF0000; \ *(addrp+1) |= piQxelOr[2] & 0xFF; \ break; \ } #endif #if RROP == GXset #define body_rop \ addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ switch((unsigned long)addrb & 3){ \ case 0: \ *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \ ^ (piQxelXor[0] & 0xFFFFFF); \ break; \ case 1: \ *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \ ^ (piQxelXor[2] & 0xFFFFFF00); \ break; \ case 3: \ *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \ ^ (piQxelXor[0] & 0xFF000000); \ *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \ ^ (piQxelXor[1] & 0xFFFF); \ break; \ case 2: \ *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \ ^ (piQxelXor[1] & 0xFFFF0000); \ *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \ ^ (piQxelXor[2] & 0xFF); \ break; \ } #endif #endif /* PSZ == 24 */ #define BUGFIX_clip #ifdef INCLUDE_DRAW int #ifdef POLYSEGMENT FUNC_NAME(cfb8SegmentSS1Rect) (pDrawable, pGC, nseg, pSegInit) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegInit; #else FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, x1p,y1p,x2p,y2p) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit, pptInitOrig; int *x1p, *y1p, *x2p, *y2p; #endif /* POLYSEGEMENT */ { register long e; register int y1_or_e1; register PixelType *addrp; register int stepmajor; register int stepminor; #ifndef REARRANGE register long e3; #endif #ifdef mc68000 register short x1_or_len; #else register int x1_or_len; #endif RROP_DECLARE #ifdef SAVE_X2Y2 # define c2 y2 #else register int c2; #endif #ifndef ORIGIN register int _x1, _y1, _x2, _y2; /* only used for CoordModePrevious */ int extents_x1, extents_y1, extents_x2, extents_y2; #endif /* !ORIGIN */ #ifndef PREVIOUS register int upperleft, lowerright; CARD32 ClipMask = 0x80008000; #endif /* !PREVIOUS */ #ifdef POLYSEGMENT register int capStyle; #endif /* POLYSEGMENT */ #ifdef SAVE_X2Y2 register int x2, y2; # define X1 x1_or_len # define Y1 y1_or_e1 # define X2 x2 # define Y2 y2 #else # ifdef POLYSEGMENT # define X1 x1_or_len # define Y1 y1_or_e1 # else # define X1 intToX(y1_or_e1) # define Y1 intToY(y1_or_e1) # endif /* POLYSEGMENT */ # define X2 intToX(c2) # define Y2 intToY(c2) #endif /* SAVE_X2Y2 */ PixelType *addr; int nwidth; cfbPrivGCPtr devPriv; BoxPtr extents; int *ppt; #if PSZ == 24 int xBase; /* x of addr */ int xOffset; /* x of addrp */ int xOffset_t; /* x of t */ PixelType *addrLineEnd; char *addrb; int stepmajor3, stepminor3, majordx, minordx; #endif #ifdef BUGFIX_clip int ex_x1, ex_y1, ex_x2, ex_y2; #endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); devPriv = cfbGetGCPrivate(pGC); cfbGetPixelWidthAndPointer (pDrawable, nwidth, addr); #ifndef REARRANGE RROP_FETCH_GCPRIV(devPriv); #endif extents = &devPriv->pCompositeClip->extents; #ifndef PREVIOUS c2 = *((int *) &pDrawable->x); c2 -= (c2 & 0x8000) << 1; upperleft = *((int *) &extents->x1) - c2; lowerright = *((int *) &extents->x2) - c2 - 0x00010001; #endif /* !PREVIOUS */ #ifdef BUGFIX_clip ex_x1 = extents->x1 - pDrawable->x; ex_y1 = extents->y1 - pDrawable->y; ex_x2 = extents->x2 - pDrawable->x; ex_y2 = extents->y2 - pDrawable->y; #endif #if PSZ == 24 xBase = pDrawable->x; addr += WIDTH_MUL(pDrawable->y,nwidth); #else addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x; #endif #ifdef POLYSEGMENT capStyle = pGC->capStyle - CapNotLast; ppt = (int *) pSegInit; while (nseg--) #else /* POLYSEGMENT */ #ifdef EITHER_MODE mode -= CoordModePrevious; if (!mode) #endif /* EITHER_MODE */ #ifndef ORIGIN { /* CoordModePrevious */ ppt = (int *)pptInit + 1; _x1 = *x1p; _y1 = *y1p; extents_x1 = extents->x1 - pDrawable->x; extents_x2 = extents->x2 - pDrawable->x; extents_y1 = extents->y1 - pDrawable->y; extents_y2 = extents->y2 - pDrawable->y; if (_x1 < extents_x1 || _x1 >= extents_x2 || _y1 < extents_y1 || _y1 >= extents_y2) { c2 = *ppt++; intToCoord(c2, _x2, _y2); *x2p = _x1 + _x2; *y2p = _y1 + _y2; return 1; } #if PSZ == 24 addrLineEnd = addr + WIDTH_MUL(_y1, nwidth); xOffset = xBase + _x1; addrb = (char *)addrLineEnd + xOffset * 3; addrp = (PixelType *)((unsigned long)addrb & ~0x03); #else addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1; #endif _x2 = _x1; _y2 = _y1; } #endif /* !ORIGIN */ #ifdef EITHER_MODE else #endif /* EITHER_MODE */ #ifndef PREVIOUS { ppt = (int *) pptInit; c2 = *ppt++; if (isClipped (c2, upperleft, lowerright)) { return 1; } #ifdef SAVE_X2Y2 intToCoord(c2,x2,y2); #endif #if PSZ == 24 addrLineEnd = addr + WIDTH_MUL(Y2, nwidth); xOffset = xBase + X2; addrb = (char *)addrLineEnd + xOffset * 3; addrp = (PixelType *)((unsigned long)addrb & ~0x03); #else addrp = addr + WIDTH_MUL(Y2, nwidth) + X2; #endif } #endif /* !PREVIOUS */ while (--npt) #endif /* POLYSEGMENT */ { #ifdef POLYSEGMENT y1_or_e1 = ppt[0]; c2 = ppt[1]; ppt += 2; if (isClipped(y1_or_e1,upperleft,lowerright)|isClipped(c2,upperleft,lowerright)) break; intToCoord(y1_or_e1,x1_or_len,y1_or_e1); /* compute now to avoid needing x1, y1 later */ #if PSZ == 24 addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth); xOffset = xBase + x1_or_len; addrb = (char *)addrLineEnd + xOffset * 3; addrp = (PixelType *)((unsigned long)addrb & ~0x03); #else addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len; #endif #else /* !POLYSEGMENT */ #ifdef EITHER_MODE if (!mode) #endif /* EITHER_MODE */ #ifndef ORIGIN { /* CoordModePrevious */ _x1 = _x2; _y1 = _y2; c2 = *ppt++; intToCoord(c2, _x2, _y2); _x2 = _x1 + _x2; _y2 = _y1 + _y2; #ifdef BUGFIX_clip if (_x2 < ex_x1 || _x2 >= ex_x2 || _y2 < ex_y1 || _y2 >= ex_y2) #else if (_x2 < extents_x1 || _x2 >= extents_x2 || _y2 < extents_y1 || _y2 >= extents_y2) #endif { break; } CalcLineDeltas(_x1, _y1, _x2, _y2, x1_or_len, y1_or_e1, stepmajor, stepminor, 1, NWIDTH(nwidth), octant); } #endif /* !ORIGIN */ #ifdef EITHER_MODE else #endif /* EITHER_MODE */ #ifndef PREVIOUS { #ifndef SAVE_X2Y2 y1_or_e1 = c2; #else y1_or_e1 = y2; x1_or_len = x2; #endif /* SAVE_X2Y2 */ c2 = *ppt++; if (isClipped (c2, upperleft, lowerright)) break; #ifdef SAVE_X2Y2 intToCoord(c2,x2,y2); #endif CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1, stepmajor, stepminor, 1, NWIDTH(nwidth), octant); } #endif /* !PREVIOUS */ #endif /* POLYSEGMENT */ #ifdef POLYSEGMENT CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1, stepmajor, stepminor, 1, NWIDTH(nwidth), octant); /* * although the horizontal code works for polyline, it * slows down 10 pixel lines by 15%. Thus, this * code is optimized for horizontal segments and * random orientation lines, which seems like a reasonable * assumption */ if (y1_or_e1 != 0) { #endif /* POLYSEGMENT */ if (x1_or_len < y1_or_e1) { #ifdef REARRANGE register int e3; #endif e3 = x1_or_len; x1_or_len = y1_or_e1; y1_or_e1 = e3; e3 = stepminor; stepminor = stepmajor; stepmajor = e3; SetYMajorOctant(octant); } e = -x1_or_len; #ifdef POLYSEGMENT if (!capStyle) x1_or_len--; #endif { #ifdef REARRANGE register int e3; RROP_DECLARE RROP_FETCH_GCPRIV(devPriv); #endif y1_or_e1 = y1_or_e1 << 1; e3 = e << 1; FIXUP_ERROR(e, octant, bias); #if PSZ == 24 if (stepmajor == 1 || stepmajor == -1){ stepmajor3 = stepmajor * 3; stepminor3 = stepminor * sizeof (long); majordx = stepmajor; minordx = 0; } else { stepmajor3 = stepmajor * sizeof (long); stepminor3 = stepminor * 3; majordx = 0; minordx = stepminor; } #endif #if PSZ == 24 #define body {\ body_rop \ addrb += stepmajor3; \ xOffset += majordx; \ e += y1_or_e1; \ if (e >= 0){ \ addrb += stepminor3; \ xOffset += minordx; \ e += e3; \ } \ } #else /* PSZ == 24 */ #define body {\ RROP_SOLID(addrp); \ addrp += stepmajor; \ e += y1_or_e1; \ if (e >= 0) \ { \ addrp += stepminor; \ e += e3; \ } \ } #endif /* PSZ == 24 */ #ifdef LARGE_INSTRUCTION_CACHE # ifdef SERIOUS_UNROLLING # define UNROLL 16 # else # define UNROLL 4 # endif #define CASE(n) case -n: body while ((x1_or_len -= UNROLL) >= 0) { body body body body # if UNROLL >= 8 body body body body # endif # if UNROLL >= 12 body body body body # endif # if UNROLL >= 16 body body body body # endif } switch (x1_or_len) { CASE(1) CASE(2) CASE(3) # if UNROLL >= 8 CASE(4) CASE(5) CASE(6) CASE(7) # endif # if UNROLL >= 12 CASE(8) CASE(9) CASE(10) CASE(11) # endif # if UNROLL >= 16 CASE(12) CASE(13) CASE(14) CASE(15) # endif } #else /* !LARGE_INSTRUCTION_CACHE */ IMPORTANT_START IMPORTANT_START if (x1_or_len & 1) body x1_or_len >>= 1; while (x1_or_len--) { body body } IMPORTANT_END IMPORTANT_END #endif /* LARGE_INSTRUCTION_CACHE */ #ifdef POLYSEGMENT #if PSZ == 24 body_rop #else RROP_SOLID(addrp); #endif #endif #if PSZ == 24 addrp = (PixelType *)((unsigned long)addrb & ~0x03); #endif } #undef body #ifdef POLYSEGMENT } else { # ifdef REARRANGE register int e3; RROP_DECLARE RROP_FETCH_GCPRIV(devPriv); # endif /* REARRANGE */ if (stepmajor < 0) { #if PSZ == 24 xOffset -= x1_or_len; addrp = addrLineEnd + PXL2ADR(xOffset); #else addrp -= x1_or_len; #endif if (capStyle) x1_or_len++; else #if PSZ == 24 xOffset++; addrp = addrLineEnd + PXL2ADR(xOffset); #else addrp++; #endif } else { #if PSZ == 24 addrp = addrLineEnd + PXL2ADR(xOffset); #endif if (capStyle) x1_or_len++; } # if PSZ == 24 y1_or_e1 = xOffset & 3; # else /* Round addrp down to the next PixelGroup boundary, and * set y1_or_e1 to the excess (in pixels) * (assumes PGSZB is a power of 2). */ y1_or_e1 = (((unsigned long) addrp) & (PGSZB - 1)) / (PSZ / 8); addrp -= y1_or_e1; # endif /* PSZ == 24 */ #if PSZ == 24 { #if RROP == GXcopy register int nlmiddle; int leftIndex = xOffset & 3; int rightIndex = (xOffset + x1_or_len) & 3; #else register int pidx; #endif #if RROP == GXcopy nlmiddle = x1_or_len; if(leftIndex){ nlmiddle -= (4 - leftIndex); } if(rightIndex){ nlmiddle -= rightIndex; } nlmiddle >>= 2; switch(leftIndex+x1_or_len){ case 4: switch(leftIndex){ case 0: *addrp++ = piQxelXor[0]; *addrp++ = piQxelXor[1]; *addrp = piQxelXor[2]; break; case 1: *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrp++ = piQxelXor[1]; *addrp = piQxelXor[2]; break; case 2: *addrp++ =((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *addrp = piQxelXor[2]; break; case 3: *addrp =((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); break; } break; case 3: switch(leftIndex){ case 0: *addrp++ = piQxelXor[0]; *addrp++ = piQxelXor[1]; *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; case 1: *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrp++ = piQxelXor[1]; *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; case 2: *addrp++ =((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; } break; case 2: switch(leftIndex){ /* case 2: *addrp++ = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; */ case 1: *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); break; case 0: *addrp++ = piQxelXor[0]; *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); break; } break; case 1: /*only if leftIndex = 0 and w = 1*/ if(x1_or_len){ *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); } /* else{ *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); } */ break; case 0: /*never*/ break; default: { /* maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) */ switch(leftIndex){ case 0: break; case 1: *addrp++ = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); *addrp++ = piQxelXor[1]; *addrp++ = piQxelXor[2]; break; case 2: *addrp++ = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); *addrp++ = piQxelXor[2]; break; case 3: *addrp++ = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); break; } while(nlmiddle--){ *addrp++ = piQxelXor[0]; *addrp++ = piQxelXor[1]; *addrp++ = piQxelXor[2]; } switch(rightIndex++){ case 0: break; case 1: *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); break; case 2: *addrp++ = piQxelXor[0]; *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); break; case 3: *addrp++ = piQxelXor[0]; *addrp++ = piQxelXor[1]; *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); break; } /* if (e3){ e3 &= 0xFFFFFF; switch(rightIndex&3){ case 0: *addrp = ((*addrp) & (0xFF000000 | ~e3)) | (piQxelXor[0] & 0xFFFFFF & e3); break; case 1: *addrp++ = ((*addrp) & (0xFFFFFF | ~(e3<<24))) | (piQxelXor[0] & 0xFF000000 & (e3<<24)); *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8))) | (piQxelXor[1] & 0xFFFF & (e3 >> 8)); break; case 2: *addrp++ = ((*addrp) & (0xFFFF|~(e3 << 16))) | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16)); *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16))) | (piQxelXor[2] & 0xFF & (e3 >> 16)); break; case 3: *addrp++ = ((*addrp) & (0xFF|~(e3<<8))) | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8)); break; } } */ } } #else /* GXcopy */ addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03)); if (x1_or_len <= 1){ if (x1_or_len) RROP_SOLID24(addrp, xOffset); } else { maskbits(xOffset, x1_or_len, e, e3, x1_or_len); pidx = xOffset & 3; if (e){ RROP_SOLID_MASK(addrp, e, pidx-1); addrp++; if (pidx == 3) pidx = 0; } while (--x1_or_len >= 0){ RROP_SOLID(addrp, pidx); addrp++; if (++pidx == 3) pidx = 0; } if (e3) RROP_SOLID_MASK(addrp, e3, pidx); } #endif /* GXcopy */ } #else /* PSZ == 24 */ if (y1_or_e1 + x1_or_len <= PPW) { if (x1_or_len) { maskpartialbits(y1_or_e1, x1_or_len, e) RROP_SOLID_MASK((unsigned long *) addrp, e); } } else { maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) if (e) { RROP_SOLID_MASK((unsigned long *) addrp, e); addrp += PPW; } #if 0 RROP_SPAN_lu(addrp, x1_or_len) #else RROP_SPAN(addrp, x1_or_len) #endif if (e3) #if 0 RROP_SOLID_MASK_lu((unsigned long *) addrp, e3); #else RROP_SOLID_MASK((unsigned long *) addrp, e3); #endif } #endif /* PSZ == 24 */ } #endif /* POLYSEGMENT */ } #ifdef POLYSEGMENT if (nseg >= 0) return (xSegment *) ppt - pSegInit; #else if (npt) { #ifdef EITHER_MODE if (!mode) #endif /* EITHER_MODE */ #ifndef ORIGIN { *x1p = _x1; *y1p = _y1; *x2p = _x2; *y2p = _y2; } #endif /* !ORIGIN */ return ((DDXPointPtr) ppt - pptInit) - 1; } #endif /* POLYSEGMENT */ #ifndef POLYSEGMENT # ifndef ORIGIN # define C2 c2 # else # define C2 ppt[-1] # endif #ifdef EITHER_MODE if (pGC->capStyle != CapNotLast && ((mode ? (C2 != *((int *) pptInitOrig)) : ((_x2 != pptInitOrig->x) || (_y2 != pptInitOrig->y))) || (ppt == ((int *)pptInitOrig) + 2))) #endif /* EITHER_MODE */ #ifdef PREVIOUS if (pGC->capStyle != CapNotLast && ((_x2 != pptInitOrig->x) || (_y2 != pptInitOrig->y) || (ppt == ((int *)pptInitOrig) + 2))) #endif /* PREVIOUS */ #ifdef ORIGIN if (pGC->capStyle != CapNotLast && ((C2 != *((int *) pptInitOrig)) || (ppt == ((int *)pptInitOrig) + 2))) #endif /* !PREVIOUS */ { # ifdef REARRANGE RROP_DECLARE RROP_FETCH_GCPRIV(devPriv); # endif #if PSZ == 24 #if RROP == GXcopy switch(xOffset & 3){ case 0: *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); break; case 3: *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); break; case 1: *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); break; case 2: *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); break; } #endif #if RROP == GXxor switch(xOffset & 3){ case 0: *addrp ^= (piQxelXor[0] & 0xFFFFFF); break; case 3: *addrp ^= (piQxelXor[2] & 0xFFFFFF00); break; case 1: *addrp ^= (piQxelXor[0] & 0xFF000000); *(addrp+1) ^= (piQxelXor[1] & 0xFFFF); break; case 2: *addrp ^= (piQxelXor[1] & 0xFFFF0000); *(addrp+1) ^= (piQxelXor[2] & 0xFF); break; } #endif #if RROP == GXand switch(xOffset & 3){ case 0: *addrp &= (piQxelAnd[0] | 0xFF000000); break; case 3: *addrp &= (piQxelAnd[2] | 0xFF); break; case 1: *addrp &= (0xFFFFFF|piQxelAnd[0]); *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]); break; case 2: *addrp &= (0xFFFF|piQxelAnd[1]); *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]); break; } #endif #if RROP == GXor switch(xOffset & 3){ case 0: *addrp |= (piQxelOr[0] & 0xFFFFFF); break; case 3: *addrp |= (piQxelOr[2] & 0xFFFFFF00); break; case 1: *addrp |= (piQxelOr[0] & 0xFF000000); *(addrp+1) |= (piQxelOr[1] & 0xFFFF); break; case 2: *addrp |= (piQxelOr[1] & 0xFFFF0000); *(addrp+1) |= (piQxelOr[2] & 0xFF); break; } #endif #if RROP == GXset switch(xOffset & 3){ case 0: *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); break; case 3: *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); break; case 1: *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); break; case 2: *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); break; } #endif #else RROP_SOLID (addrp); # endif } #endif /* !POLYSEGMENT */ return -1; } #endif /* INCLUDE_DRAW */ #ifdef INCLUDE_OTHERS #ifdef POLYSEGMENT void cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegInit; { int (*func)(); void (*clip)(); int drawn; cfbPrivGCPtr devPriv; devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) { cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); return; } #endif switch (devPriv->rop) { case GXcopy: func = cfb8SegmentSS1RectCopy; clip = cfb8ClippedLineCopy; #ifdef FAST_MUL if (cfbGetPixelWidth (pDrawable) == WIDTH_FAST) func = cfb8SegmentSS1RectShiftCopy; #endif break; case GXxor: func = cfb8SegmentSS1RectXor; clip = cfb8ClippedLineXor; break; default: func = cfb8SegmentSS1RectGeneral; clip = cfb8ClippedLineGeneral; break; } while (nseg) { drawn = (*func) (pDrawable, pGC, nseg, pSegInit); if (drawn == -1) break; (*clip) (pDrawable, pGC, pSegInit[drawn-1].x1, pSegInit[drawn-1].y1, pSegInit[drawn-1].x2, pSegInit[drawn-1].y2, &devPriv->pCompositeClip->extents, pGC->capStyle == CapNotLast); pSegInit += drawn; nseg -= drawn; } } #else /* POLYSEGMENT */ void cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { int (*func)(); void (*clip)(); int drawn; cfbPrivGCPtr devPriv; int x1, y1, x2, y2; DDXPointPtr pptInitOrig = pptInit; devPriv = cfbGetGCPrivate(pGC); #ifdef NO_ONE_RECT if (REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) { cfbLineSS(pDrawable, pGC, mode, npt, pptInit); return; } #endif switch (devPriv->rop) { case GXcopy: func = cfb8LineSS1RectCopy; clip = cfb8ClippedLineCopy; if (mode == CoordModePrevious) func = cfb8LineSS1RectPreviousCopy; break; case GXxor: func = cfb8LineSS1RectXor; clip = cfb8ClippedLineXor; break; default: func = cfb8LineSS1RectGeneral; clip = cfb8ClippedLineGeneral; break; } if (mode == CoordModePrevious) { x1 = pptInit->x; y1 = pptInit->y; while (npt > 1) { drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, &x1, &y1, &x2, &y2); if (drawn == -1) break; (*clip) (pDrawable, pGC, x1, y1, x2, y2, &devPriv->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; x1 = x2; y1 = y2; } } else { while (npt > 1) { drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, &x1, &y1, &x2, &y2); if (drawn == -1) break; (*clip) (pDrawable, pGC, pptInit[drawn-1].x, pptInit[drawn-1].y, pptInit[drawn].x, pptInit[drawn].y, &devPriv->pCompositeClip->extents, drawn != npt - 1 || pGC->capStyle == CapNotLast); pptInit += drawn; npt -= drawn; } } } #endif /* else POLYSEGMENT */ #endif /* INCLUDE_OTHERS */ #if !defined(POLYSEGMENT) && !defined (PREVIOUS) void RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) DrawablePtr pDrawable; GCPtr pGC; int x1, y1, x2, y2; BoxPtr boxp; Bool shorten; { int oc1, oc2; int e, e1, e3, len; int adx, ady; PixelType *addr; int nwidth; int stepx, stepy; int xorg, yorg; int new_x1, new_y1, new_x2, new_y2; Bool pt1_clipped, pt2_clipped; int changex, changey, result; #if PSZ == 24 int xOffset; PixelType *addrLineEnd; char *addrb; int stepx3, stepy3; #endif int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); cfbGetPixelWidthAndPointer(pDrawable, nwidth, addr); xorg = pDrawable->x; yorg = pDrawable->y; x1 += xorg; y1 += yorg; x2 += xorg; y2 += yorg; oc1 = 0; oc2 = 0; OUTCODES (oc1, x1, y1, boxp); OUTCODES (oc2, x2, y2, boxp); if (oc1 & oc2) return; CalcLineDeltas(x1, y1, x2, y2, adx, ady, stepx, stepy, 1, nwidth, octant); if (adx <= ady) { int t; t = adx; adx = ady; ady = t; t = stepx; stepx = stepy; stepy = t; SetYMajorOctant(octant); } e = - adx; e1 = ady << 1; e3 = - (adx << 1); FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if (IsXMajorOctant(octant)) { result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) return; len = abs(new_x2 - new_x1) - 1; /* this routine needs the "-1" */ /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter * if x2,y2 isn't clipped, use the capstyle * (shorten == TRUE <--> CapNotLast) */ if (pt2_clipped || !shorten) len++; if (pt1_clipped) { /* must calculate new error terms */ changex = abs(new_x1 - x1); changey = abs(new_y1 - y1); e = e + changey * e3 + changex * e1; } } else /* Y_AXIS */ { result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1, &new_x1, &new_y1, &new_x2, &new_y2, ady, adx, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) return; len = abs(new_y2 - new_y1) - 1; /* this routine needs the "-1" */ /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter * if x2,y2 isn't clipped, use the capstyle * (shorten == TRUE <--> CapNotLast) */ if (pt2_clipped || !shorten) len++; if (pt1_clipped) { /* must calculate new error terms */ changex = abs(new_x1 - x1); changey = abs(new_y1 - y1); e = e + changex * e3 + changey * e1; } } x1 = new_x1; y1 = new_y1; { register PixelType *addrp; RROP_DECLARE RROP_FETCH_GC(pGC); #if PSZ == 24 xOffset = x1; addrLineEnd = addr + (y1 * nwidth); addrb = (char *)addrLineEnd + x1 * 3; if (stepx == 1 || stepx == -1){ stepx3 = stepx * 3; stepy3 = stepy * sizeof (long); } else { stepx3 = stepx * sizeof (long); stepy3 = stepy * 3; } #else addrp = addr + (y1 * nwidth) + x1; #endif #ifndef REARRANGE if (!ady) { #if PSZ == 24 #define body {\ body_rop \ addrb += stepx3; \ } #else #define body { RROP_SOLID(addrp); addrp += stepx; } #endif while (len >= PGSZB) { body body body body #if PGSZ == 64 body body body body #endif len -= PGSZB; } switch (len) { #if PGSZ == 64 case 7: body case 6: body case 5: body case 4: body #endif case 3: body case 2: body case 1: body } #undef body } else #endif /* !REARRANGE */ { #if PSZ == 24 #define body {\ body_rop \ addrb += stepx3; \ e += e1; \ if (e >= 0) \ { \ addrb += stepy3; \ e += e3; \ } \ } #else #define body {\ RROP_SOLID(addrp); \ addrp += stepx; \ e += e1; \ if (e >= 0) \ { \ addrp += stepy; \ e += e3; \ } \ } #endif #ifdef LARGE_INSTRUCTION_CACHE while ((len -= PGSZB) >= 0) { body body body body #if PGSZ == 64 body body body body #endif } switch (len) { case -1: body case -2: body case -3: body #if PGSZ == 64 case -4: body case -5: body case -6: body case -7: body #endif } #else /* !LARGE_INSTRUCTION_CACHE */ IMPORTANT_START; while ((len -= 2) >= 0) { body body; } if (len & 1) body; IMPORTANT_END; #endif /* LARGE_INSTRUCTION_CACHE */ } #if PSZ == 24 body_rop #else RROP_SOLID(addrp); #endif #undef body } } #endif /* !POLYSEGMENT && !PREVIOUS */ #endif /* PIXEL_ADDR */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbbitblt.c0100664000076400007640000005206107120677563021550 0ustar constconst/* * cfb copy area */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Keith Packard */ /* $XConsortium: cfbbitblt.c,v 5.51 94/05/27 11:00:56 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "cfb.h" #include "cfbmskbits.h" #include "cfb8bit.h" #include "fastblt.h" #define MFB_CONSTS_ONLY #include "maskbits.h" RegionPtr cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GC *pGC; int srcx, srcy; int width, height; int dstx, dsty; void (*doBitBlt)(); unsigned long bitPlane; { RegionPtr prgnSrcClip; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed; RegionRec rgnDst; DDXPointPtr pptSrc; register DDXPointPtr ppt; register BoxPtr pbox; int i; register int dx; register int dy; xRectangle origSource; DDXPointRec origDest; int numRects; BoxRec fastBox; int fastClip = 0; /* for fast clipping with pixmap source */ int fastExpose = 0; /* for fast exposures with pixmap source */ origSource.x = srcx; origSource.y = srcy; origSource.width = width; origSource.height = height; origDest.x = dstx; origDest.y = dsty; if ((pSrcDrawable != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); } srcx += pSrcDrawable->x; srcy += pSrcDrawable->y; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = cfbGetCompositeClip(pGC); } else { fastClip = 1; } } else { if (pGC->subWindowMode == IncludeInferiors) { if (!((WindowPtr) pSrcDrawable)->parent) { /* * special case bitblt from root window in * IncludeInferiors mode; just like from a pixmap */ fastClip = 1; } else if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = cfbGetCompositeClip(pGC); } else { prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); freeSrcClip = TRUE; } } else { prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } } fastBox.x1 = srcx; fastBox.y1 = srcy; fastBox.x2 = srcx + width; fastBox.y2 = srcy + height; /* Don't create a source region if we are doing a fast clip */ if (fastClip) { fastExpose = 1; /* * clip the source; if regions extend beyond the source size, * make sure exposure events get sent */ if (fastBox.x1 < pSrcDrawable->x) { fastBox.x1 = pSrcDrawable->x; fastExpose = 0; } if (fastBox.y1 < pSrcDrawable->y) { fastBox.y1 = pSrcDrawable->y; fastExpose = 0; } if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; fastExpose = 0; } if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; fastExpose = 0; } } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); } dstx += pDstDrawable->x; dsty += pDstDrawable->y; if (pDstDrawable->type == DRAWABLE_WINDOW) { if (!((WindowPtr)pDstDrawable)->realized) { if (!fastClip) REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } } dx = srcx - dstx; dy = srcy - dsty; /* Translate and clip the dst to the destination composite clip */ if (fastClip) { RegionPtr cclip; /* Translate the region directly */ fastBox.x1 -= dx; fastBox.x2 -= dx; fastBox.y1 -= dy; fastBox.y2 -= dy; /* If the destination composite clip is one rectangle we can do the clip directly. Otherwise we have to create a full blown region and call intersect */ /* XXX because CopyPlane uses this routine for 8-to-1 bit * copies, this next line *must* also correctly fetch the * composite clip from an mfb gc */ cclip = cfbGetCompositeClip(pGC); if (REGION_NUM_RECTS(cclip) == 1) { BoxPtr pBox = REGION_RECTS(cclip); if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; /* Check to see if the region is empty */ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) { REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0); } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); } } else { /* We must turn off fastClip now, since we must create a full blown region. It is intersected with the composite clip below. */ fastClip = 0; REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1); } } else { REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); } if (!fastClip) { REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, cfbGetCompositeClip(pGC)); } /* Do bit blitting */ numRects = REGION_NUM_RECTS(&rgnDst); if (numRects && width && height) { if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec)))) { REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } pbox = REGION_RECTS(&rgnDst); ppt = pptSrc; for (i = numRects; --i >= 0; pbox++, ppt++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane); DEALLOCATE_LOCAL(pptSrc); } prgnExposed = NULL; if ( cfbGetGCPrivate(pGC)->fExpose) { extern RegionPtr miHandleExposures(); /* Pixmap sources generate a NoExposed (we return NULL to do this) */ if (!fastExpose) prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, origSource.x, origSource.y, (int)origSource.width, (int)origSource.height, origDest.x, origDest.y, bitPlane); } REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return prgnExposed; } void cfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask) DrawablePtr pSrc, pDst; int alu; RegionPtr prgnDst; DDXPointPtr pptSrc; unsigned long planemask; { void (*blt)() = cfbDoBitbltGeneral; if ((planemask & PMSK) == PMSK) { switch (alu) { case GXcopy: blt = cfbDoBitbltCopy; break; case GXxor: blt = cfbDoBitbltXor; break; case GXor: blt = cfbDoBitbltOr; break; } } (*blt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask); } RegionPtr cfbCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GC *pGC; int srcx, srcy; int width, height; int dstx, dsty; { void (*doBitBlt) (); doBitBlt = cfbDoBitbltCopy; if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK) { doBitBlt = cfbDoBitbltGeneral; if ((pGC->planemask & PMSK) == PMSK) { switch (pGC->alu) { case GXxor: doBitBlt = cfbDoBitbltXor; break; case GXor: doBitBlt = cfbDoBitbltOr; break; } } } return cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0L); } #if PSZ == 8 void cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask, bitPlane) DrawablePtr pSrcDrawable; /* must be a bitmap */ DrawablePtr pDstDrawable; /* must be depth 8 drawable */ int rop; /* not used; caller must call cfb8CheckOpaqueStipple * beforehand to get cfb8StippleRRop set correctly */ unsigned long planemask; /* to apply to destination writes */ RegionPtr prgnDst; /* region in destination to draw to; * screen relative coords. if dest is a window; * drawable relative if dest is a pixmap */ DDXPointPtr pptSrc; /* drawable relative src coords to copy from; * must be one point for each box in prgnDst */ unsigned long bitPlane; /* not used; assumed always to be 1 */ { int srcx, srcy; /* upper left corner of box being copied in source */ int dstx, dsty; /* upper left corner of box being copied in dest */ int width, height; /* in pixels, unpadded, of box being copied */ int xoffSrc; /* bit # in leftmost word of row from which copying starts */ int xoffDst; /* byte # in leftmost word of row from which copying starts */ unsigned long *psrcBase, *pdstBase; /* start of drawable's pixel data */ int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/ int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */ unsigned long *psrcLine, *pdstLine; /* steps a row at a time thru src/dst; * may point into middle of row */ register unsigned long *psrc, *pdst; /* steps within the row */ register unsigned long bits, tmp; /* bits from source */ register int leftShift; register int rightShift; unsigned long startmask; /* left edge pixel mask */ unsigned long endmask; /* right edge pixel mask */ register int nlMiddle; /* number of words in middle of the row to draw */ register int nl; int firstoff; int secondoff; unsigned long src; int nbox; /* number of boxes in region to copy */ BoxPtr pbox; /* steps thru boxes in region */ int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after * the main "middle" loop */ cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) cfbGetLongWidthAndPointer (pDstDrawable, widthDst, pdstBase) nbox = REGION_NUM_RECTS(prgnDst); pbox = REGION_RECTS(prgnDst); while (nbox--) { dstx = pbox->x1; dsty = pbox->y1; srcx = pptSrc->x; srcy = pptSrc->y; width = pbox->x2 - pbox->x1; height = pbox->y2 - pbox->y1; pbox++; pptSrc++; psrcLine = psrcBase + srcy * widthSrc + (srcx >> MFB_PWSH); pdstLine = pdstBase + dsty * widthDst + (dstx >> PWSH); xoffSrc = srcx & MFB_PIM; /* finds starting bit in src */ xoffDst = dstx & PIM; /* finds starting byte in dst */ /* compute startmask, endmask, nlMiddle */ if (xoffDst + width < PPW) /* XXX should this be '<= PPW' ? */ { /* the copy only affects one word per row in destination */ maskpartialbits(dstx, width, startmask); endmask = 0; /* nothing on right edge */ nlMiddle = 0; /* nothing in middle */ } else { /* the copy will affect multiple words per row in destination */ maskbits(dstx, width, startmask, endmask, nlMiddle); } /* * compute constants for the first four bits to be * copied. This avoids troubles with partial first * writes, and difficult shift computation */ if (startmask) { firstoff = xoffSrc - xoffDst; if (firstoff > (MFB_PPW-PPW)) secondoff = MFB_PPW - firstoff; if (xoffDst) { srcx += (PPW-xoffDst); xoffSrc = srcx & MFB_PIM; } } leftShift = xoffSrc; rightShift = MFB_PPW - leftShift; pixelsRemainingOnRightEdge = (nlMiddle & 7) * PPW + ((dstx + width) & PIM); /* setup is done; now let's move some bits */ /* caller must call cfb8CheckOpaqueStipple before this function * to set cfb8StippleRRop! */ if (cfb8StippleRRop == GXcopy) { while (height--) { /* one iteration of this loop copies one row */ psrc = psrcLine; pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; bits = *psrc++; if (startmask) { if (firstoff < 0) tmp = BitRight (bits, -firstoff); else { tmp = BitLeft (bits, firstoff); /* * need a more cautious test for partialmask * case... */ if (firstoff >= (MFB_PPW-PPW)) { bits = *psrc++; if (firstoff != (MFB_PPW-PPW)) tmp |= BitRight (bits, secondoff); } } *pdst = (*pdst & ~startmask) | (GetPixelGroup(tmp) & startmask); pdst++; } nl = nlMiddle; while (nl >= 8) { nl -= 8; tmp = BitLeft(bits, leftShift); bits = *psrc++; if (rightShift != MFB_PPW) tmp |= BitRight(bits, rightShift); #ifdef FAST_CONSTANT_OFFSET_MODE # define StorePixels(pdst,o,pixels) (pdst)[o] = (pixels) # define EndStep(pdst,o) (pdst) += (o) # define StoreRopPixels(pdst,o,and,xor) (pdst)[o] = DoRRop((pdst)[o],and,xor); #else # define StorePixels(pdst,o,pixels) *(pdst)++ = (pixels) # define EndStep(pdst,o) # define StoreRopPixels(pdst,o,and,xor) *(pdst) = DoRRop(*(pdst),and,xor); (pdst)++; #endif #define Step(c) NextBitGroup(c); #define StoreBitsPlain(o,c) StorePixels(pdst,o,GetPixelGroup(c)) #define StoreRopBitsPlain(o,c) StoreRopPixels(pdst,o,\ cfb8StippleAnd[GetBitGroup(c)], \ cfb8StippleXor[GetBitGroup(c)]) #define StoreBits0(c) StoreBitsPlain(0,c) #define StoreRopBits0(c) StoreRopBitsPlain(0,c) #if (BITMAP_BIT_ORDER == MSBFirst) # define StoreBits(o,c) StoreBitsPlain(o,c) # define StoreRopBits(o,c) StoreRopBitsPlain(o,c) # define FirstStep(c) Step(c) #else /* BITMAP_BIT_ORDER == LSBFirst */ #if PGSZ == 64 # define StoreBits(o,c) StorePixels(pdst,o, (cfb8Pixels[c & 0xff])) # define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ (cfb8StippleAnd[c & 0xff]), \ (cfb8StippleXor[c & 0xff])) # define FirstStep(c) c = BitLeft (c, 8); #else /* 0x3c is 0xf << 2 (4 bits, long word) */ # define StoreBits(o,c) StorePixels(pdst,o,*((unsigned long *)\ (((char *) cfb8Pixels) + (c & 0x3c)))) # define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ *((unsigned long *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \ *((unsigned long *) (((char *) cfb8StippleXor) + (c & 0x3c)))) # define FirstStep(c) c = BitLeft (c, 2); #endif /* PGSZ */ #endif /* BITMAP_BIT_ORDER */ StoreBits0(tmp); FirstStep(tmp); StoreBits(1,tmp); Step(tmp); StoreBits(2,tmp); Step(tmp); StoreBits(3,tmp); Step(tmp); StoreBits(4,tmp); Step(tmp); StoreBits(5,tmp); Step(tmp); StoreBits(6,tmp); Step(tmp); StoreBits(7,tmp); EndStep (pdst,8); } /* do rest of middle and partial word on right edge */ if (pixelsRemainingOnRightEdge) { tmp = BitLeft(bits, leftShift); if (pixelsRemainingOnRightEdge > rightShift) { bits = *psrc++; tmp |= BitRight (bits, rightShift); } EndStep (pdst, nl); switch (nl) { case 7: StoreBitsPlain(-7,tmp); Step(tmp); case 6: StoreBitsPlain(-6,tmp); Step(tmp); case 5: StoreBitsPlain(-5,tmp); Step(tmp); case 4: StoreBitsPlain(-4,tmp); Step(tmp); case 3: StoreBitsPlain(-3,tmp); Step(tmp); case 2: StoreBitsPlain(-2,tmp); Step(tmp); case 1: StoreBitsPlain(-1,tmp); Step(tmp); } if (endmask) *pdst = (*pdst & ~endmask) | (GetPixelGroup(tmp) & endmask); } } } else /* cfb8StippleRRop != GXcopy */ { while (height--) { /* one iteration of this loop copies one row */ psrc = psrcLine; pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; bits = *psrc++; /* do partial word on left edge */ if (startmask) { if (firstoff < 0) tmp = BitRight (bits, -firstoff); else { tmp = BitLeft (bits, firstoff); if (firstoff >= (MFB_PPW-PPW)) { bits = *psrc++; if (firstoff != (MFB_PPW-PPW)) tmp |= BitRight (bits, secondoff); } } src = GetBitGroup(tmp); *pdst = MaskRRopPixels (*pdst, src, startmask); pdst++; } /* do middle of row */ nl = nlMiddle; while (nl >= 8) { nl -= 8; tmp = BitLeft(bits, leftShift); bits = *psrc++; if (rightShift != MFB_PPW) tmp |= BitRight(bits, rightShift); StoreRopBits0(tmp); FirstStep(tmp); StoreRopBits(1,tmp); Step(tmp); StoreRopBits(2,tmp); Step(tmp); StoreRopBits(3,tmp); Step(tmp); StoreRopBits(4,tmp); Step(tmp); StoreRopBits(5,tmp); Step(tmp); StoreRopBits(6,tmp); Step(tmp); StoreRopBits(7,tmp); EndStep(pdst,8); } /* do rest of middle and partial word on right edge */ if (pixelsRemainingOnRightEdge) { tmp = BitLeft(bits, leftShift); if (pixelsRemainingOnRightEdge > rightShift) { bits = *psrc++; /* XXX purify abr here */ tmp |= BitRight (bits, rightShift); } while (nl--) { src = GetBitGroup (tmp); *pdst = RRopPixels (*pdst, src); pdst++; NextBitGroup(tmp); } if (endmask) { src = GetBitGroup (tmp); *pdst = MaskRRopPixels (*pdst, src, endmask); } } } /* end copy one row */ } /* end alu is non-copy-mode case */ } /* end iteration over region boxes */ } #endif /* shared among all different cfb depths through linker magic */ RegionPtr (*cfbPuntCopyPlane)(); RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) DrawablePtr pSrcDrawable; DrawablePtr pDstDrawable; GCPtr pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long bitPlane; { RegionPtr ret; extern RegionPtr miHandleExposures(); void (*doBitBlt)(); #if PSZ == 8 if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8) { if (bitPlane == 1) { doBitBlt = cfbCopyPlane1to8; cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, bitPlane); } else ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); } else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 1) { extern int InverseAlu[16]; int oldalu; oldalu = pGC->alu; if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1) pGC->alu = InverseAlu[pGC->alu]; else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); ret = cfbBitBlt (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, cfbCopyPlane8to1, bitPlane); pGC->alu = oldalu; } else if (pSrcDrawable->bitsPerPixel == 8 && pDstDrawable->bitsPerPixel == 8) { PixmapPtr pBitmap; ScreenPtr pScreen = pSrcDrawable->pScreen; GCPtr pGC1; pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1); if (!pBitmap) return NULL; pGC1 = GetScratchGC (1, pScreen); if (!pGC1) { (*pScreen->DestroyPixmap) (pBitmap); return NULL; } /* * don't need to set pGC->fgPixel,bgPixel as copyPlane8to1 * ignores pixel values, expecting the rop to "do the * right thing", which GXcopy will. */ ValidateGC ((DrawablePtr) pBitmap, pGC1); /* no exposures here, scratch GC's don't get graphics expose */ (void) cfbBitBlt (pSrcDrawable, (DrawablePtr) pBitmap, pGC1, srcx, srcy, width, height, 0, 0, cfbCopyPlane8to1, bitPlane); cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); /* no exposures here, copy bits from inside a pixmap */ (void) cfbBitBlt ((DrawablePtr) pBitmap, pDstDrawable, pGC, 0, 0, width, height, dstx, dsty, cfbCopyPlane1to8, 1); FreeScratchGC (pGC1); (*pScreen->DestroyPixmap) (pBitmap); /* compute resultant exposures */ ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); } else #endif ret = (*cfbPuntCopyPlane) (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); return ret; } vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbmskbits.h0100664000076400007640000006645607120677563021766 0ustar constconst/************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright no- tice appear in all copies and that both that copyright no- tice and this permission notice appear in supporting docu- mentation, and that the names of Sun or X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. Sun and X Consortium make no representations about the suitability of this software for any purpose. It is provided "as is" without any express or implied warranty. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ /* $XConsortium: cfbmskbits.h,v 4.25 94/04/17 20:28:55 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbmskbits.h,v 3.3.2.1 1997/05/27 06:28:09 dawes Exp $ */ /* Optimizations for PSZ == 32 added by Kyle Marvin (marvin@vitec.com) */ #include "X.h" #include "Xmd.h" #include "servermd.h" #ifdef XFREE86 #define NO_COMPILER_H_EXTRAS #include "compiler.h" #endif /* * ========================================================================== * Converted from mfb to support memory-mapped color framebuffer by smarks@sun, * April-May 1987. * * The way I did the conversion was to consider each longword as an * array of four bytes instead of an array of 32 one-bit pixels. So * getbits() and putbits() retain much the same calling sequence, but * they move bytes around instead of bits. Of course, this entails the * removal of all of the one-bit-pixel dependencies from the other * files, but the major bit-hacking stuff should be covered here. * * I've created some new macros that make it easier to understand what's * going on in the pixel calculations, and that make it easier to change the * pixel size. * * name explanation * ---- ----------- * PSZ pixel size (in bits) * PGSZ pixel group size (in bits) * PGSZB pixel group size (in bytes) * PGSZBMSK mask with lowest PGSZB bits set to 1 * PPW pixels per word (pixels per pixel group) * PPWMSK mask with lowest PPW bits set to 1 * PLST index of last pixel in a word (should be PPW-1) * PIM pixel index mask (index within a pixel group) * PWSH pixel-to-word shift (should be log2(PPW)) * PMSK mask with lowest PSZ bits set to 1 * * * Here are some sample values. In the notation cfbA,B: A is PSZ, and * B is PGSZB. All the other values are derived from these * two. This table does not show all combinations! * * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8 * ---- ------ ------- ------ ------ ------ ------- * PSZ 8 24 32 8 24 32 * PGSZ 32 32 32 64 64 64 * PGSZB 4 4 4 8 8 8 * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF * PPW 4 1 1 8 2 2 * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3 * PLST 3 0 0 7 1 1 * PIM 0x3 0x0 0x0 0x7 0x1? 0x1 * PWSH 2 0 0 3 1 1 * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF * * * I have also added a new macro, PFILL, that takes one pixel and * replicates it throughout a word. This macro definition is dependent * upon pixel and word size; it doesn't use macros like PPW and so * forth. Examples: for monochrome, PFILL(1) => 0xffffffff, PFILL(0) => * 0x00000000. For 8-bit color, PFILL(0x5d) => 0x5d5d5d5d. This macro * is used primarily for replicating a plane mask into a word. * * Color framebuffers operations also support the notion of a plane * mask. This mask determines which planes of the framebuffer can be * altered; the others are left unchanged. I have added another * parameter to the putbits and putbitsrop macros that is the plane * mask. * ========================================================================== */ /* * PSZ needs to be defined before we get here. Usually it comes from a * -DPSZ=foo on the compilation command line. */ #ifndef PSZ #define PSZ 8 #endif /* * PixelGroup is the data type used to operate on groups of pixels. * We typedef it here to unsigned long with the assumption that you * want to manipulate as many pixels at a time as you can. If unsigned * long is not appropriate for your server, define it to something else * before including this file. In this case you will also have to define * PGSZB to the size in bytes of PixelGroup. */ #ifndef PixelGroup typedef unsigned long PixelGroup; #ifdef LONG64 #define PGSZB 8 #else #define PGSZB 4 #endif /* LONG64 */ #endif /* PixelGroup */ #define PGSZ (PGSZB << 3) #define PPW (PGSZ/PSZ) #define PLST (PPW-1) #define PIM PLST #define PMSK (((PixelGroup)1 << PSZ) - 1) #define PPWMSK (((PixelGroup)1 << PPW) - 1) /* instead of BITMSK */ #define PGSZBMSK (((PixelGroup)1 << PGSZB) - 1) /* set PWSH = log2(PPW) using brute force */ #if PPW == 1 #define PWSH 0 #else #if PPW == 2 #define PWSH 1 #else #if PPW == 4 #define PWSH 2 #else #if PPW == 8 #define PWSH 3 #else #if PPW == 16 #define PWSH 4 #endif /* PPW == 16 */ #endif /* PPW == 8 */ #endif /* PPW == 4 */ #endif /* PPW == 2 */ #endif /* PPW == 1 */ /* Defining PIXEL_ADDR means that individual pixels are addressable by this * machine (as type PixelType). A possible CFB architecture which supported * 8-bits-per-pixel on a non byte-addressable machine would not have this * defined. * * Defining FOUR_BIT_CODE means that cfb knows how to stipple on this machine; * eventually, stippling code for 16 and 32 bit devices should be written * which would allow them to also use FOUR_BIT_CODE. There isn't that * much to do in those cases, but it would make them quite a bit faster. */ #if PSZ == 8 #define PIXEL_ADDR typedef CARD8 PixelType; #define FOUR_BIT_CODE #endif #if PSZ == 16 #define PIXEL_ADDR typedef CARD16 PixelType; #endif #if PSZ == 24 #undef PMSK #define PMSK 0xFFFFFF /*#undef PIM #define PIM 3*/ #define PIXEL_ADDR typedef CARD32 PixelType; #endif #if PSZ == 32 #undef PMSK #define PMSK 0xFFFFFFFF #define PIXEL_ADDR typedef CARD32 PixelType; #endif /* the following notes use the following conventions: SCREEN LEFT SCREEN RIGHT in this file and maskbits.c, left and right refer to screen coordinates, NOT bit numbering in registers. cfbstarttab[n] pixels[0,n-1] = 0's pixels[n,PPW-1] = 1's cfbendtab[n] = pixels[0,n-1] = 1's pixels[n,PPW-1] = 0's cfbstartpartial[], cfbendpartial[] these are used as accelerators for doing putbits and masking out bits that are all contained between longword boudaries. the extra 256 bytes of data seems a small price to pay -- code is smaller, and narrow things (e.g. window borders) go faster. the names may seem misleading; they are derived not from which end of the word the bits are turned on, but at which end of a scanline the table tends to be used. look at the tables and macros to understand boundary conditions. (careful readers will note that starttab[n] = ~endtab[n] for n != 0) ----------------------------------------------------------------------- these two macros depend on the screen's bit ordering. in both of them x is a screen position. they are used to combine bits collected from multiple longwords into a single destination longword, and to unpack a single source longword into multiple destinations. SCRLEFT(dst, x) takes dst[x, PPW] and moves them to dst[0, PPW-x] the contents of the rest of dst are 0 ONLY IF dst is UNSIGNED. is cast as an unsigned. this is a right shift on the VAX, left shift on Sun and pc-rt. SCRRIGHT(dst, x) takes dst[0,x] and moves them to dst[PPW-x, PPW] the contents of the rest of dst are 0 ONLY IF dst is UNSIGNED. this is a left shift on the VAX, right shift on Sun and pc-rt. the remaining macros are cpu-independent; all bit order dependencies are built into the tables and the two macros above. maskbits(x, w, startmask, endmask, nlw) for a span of width w starting at position x, returns a mask for ragged pixels at start, mask for ragged pixels at end, and the number of whole longwords between the ends. maskpartialbits(x, w, mask) works like maskbits(), except all the pixels are in the same longword (i.e. (x&0xPIM + w) <= PPW) mask32bits(x, w, startmask, endmask, nlw) as maskbits, but does not calculate nlw. it is used by cfbGlyphBlt to put down glyphs <= PPW bits wide. getbits(psrc, x, w, dst) starting at position x in psrc (x < PPW), collect w pixels and put them in the screen left portion of dst. psrc is a longword pointer. this may span longword boundaries. it special-cases fetching all w bits from one longword. +--------+--------+ +--------+ | | m |n| | ==> | m |n| | +--------+--------+ +--------+ x x+w 0 w psrc psrc+1 dst m = PPW - x n = w - m implementation: get m pixels, move to screen-left of dst, zeroing rest of dst; get n pixels from next word, move screen-right by m, zeroing lower m pixels of word. OR the two things together. putbits(src, x, w, pdst, planemask) starting at position x in pdst, put down the screen-leftmost w bits of src. pdst is a longword pointer. this may span longword boundaries. it special-cases putting all w bits into the same longword. +--------+ +--------+--------+ | m |n| | ==> | | m |n| | +--------+ +--------+--------+ 0 w x x+w dst pdst pdst+1 m = PPW - x n = w - m implementation: get m pixels, shift screen-right by x, zero screen-leftmost x pixels; zero rightmost m bits of *pdst and OR in stuff from before the semicolon. shift src screen-left by m, zero bits n-32; zero leftmost n pixels of *(pdst+1) and OR in the stuff from before the semicolon. putbitsrop(src, x, w, pdst, planemask, ROP) like putbits but calls DoRop with the rasterop ROP (see cfb.h for DoRop) getleftbits(psrc, w, dst) get the leftmost w (w<=PPW) bits from *psrc and put them in dst. this is used by the cfbGlyphBlt code for glyphs <=PPW bits wide. */ #if (BITMAP_BIT_ORDER == MSBFirst) #define BitRight(lw,n) ((lw) >> (n)) #define BitLeft(lw,n) ((lw) << (n)) #else /* (BITMAP_BIT_ORDER == LSBFirst) */ #define BitRight(lw,n) ((lw) << (n)) #define BitLeft(lw,n) ((lw) >> (n)) #endif /* (BITMAP_BIT_ORDER == MSBFirst) */ #define SCRLEFT(lw, n) BitLeft (lw, (n) * PSZ) #define SCRRIGHT(lw, n) BitRight(lw, (n) * PSZ) /* * Note that the shift direction is independent of the byte ordering of the * machine. The following is portable code. */ #if PPW == 16 #define PFILL(p) ( ((p)&PMSK) | \ ((p)&PMSK) << PSZ | \ ((p)&PMSK) << 2*PSZ | \ ((p)&PMSK) << 3*PSZ | \ ((p)&PMSK) << 4*PSZ | \ ((p)&PMSK) << 5*PSZ | \ ((p)&PMSK) << 6*PSZ | \ ((p)&PMSK) << 7*PSZ | \ ((p)&PMSK) << 8*PSZ | \ ((p)&PMSK) << 9*PSZ | \ ((p)&PMSK) << 10*PSZ | \ ((p)&PMSK) << 11*PSZ | \ ((p)&PMSK) << 12*PSZ | \ ((p)&PMSK) << 13*PSZ | \ ((p)&PMSK) << 14*PSZ | \ ((p)&PMSK) << 15*PSZ ) #define PFILL2(p, pf) { \ pf = (p) & PMSK; \ pf |= (pf << PSZ); \ pf |= (pf << 2*PSZ); \ pf |= (pf << 4*PSZ); \ pf |= (pf << 8*PSZ); \ } #endif /* PPW == 16 */ #if PPW == 8 #define PFILL(p) ( ((p)&PMSK) | \ ((p)&PMSK) << PSZ | \ ((p)&PMSK) << 2*PSZ | \ ((p)&PMSK) << 3*PSZ | \ ((p)&PMSK) << 4*PSZ | \ ((p)&PMSK) << 5*PSZ | \ ((p)&PMSK) << 6*PSZ | \ ((p)&PMSK) << 7*PSZ ) #define PFILL2(p, pf) { \ pf = (p) & PMSK; \ pf |= (pf << PSZ); \ pf |= (pf << 2*PSZ); \ pf |= (pf << 4*PSZ); \ } #endif #if PPW == 4 #define PFILL(p) ( ((p)&PMSK) | \ ((p)&PMSK) << PSZ | \ ((p)&PMSK) << 2*PSZ | \ ((p)&PMSK) << 3*PSZ ) #define PFILL2(p, pf) { \ pf = (p) & PMSK; \ pf |= (pf << PSZ); \ pf |= (pf << 2*PSZ); \ } #endif #if PPW == 2 #define PFILL(p) ( ((p)&PMSK) | \ ((p)&PMSK) << PSZ ) #define PFILL2(p, pf) { \ pf = (p) & PMSK; \ pf |= (pf << PSZ); \ } #endif #if PPW == 1 #define PFILL(p) (p) #define PFILL2(p,pf) (pf = (p)) #endif /* * Reduced raster op - using precomputed values, perform the above * in three instructions */ #define DoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) #define DoMaskRRop(dst, and, xor, mask) \ (((dst) & ((and) | ~(mask))) ^ (xor & mask)) #if PSZ != 32 || PPW != 1 # if (PSZ == 24 && PPW == 1) #define maskbits(x, w, startmask, endmask, nlw) {\ startmask = cfbstarttab[(x)&3]; \ endmask = cfbendtab[((x)+(w)) & 3]; \ nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \ } #define mask32bits(x, w, startmask, endmask) \ startmask = cfbstarttab[(x)&3]; \ endmask = cfbendtab[((x)+(w)) & 3]; #define maskpartialbits(x, w, mask) \ mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3]; #define maskbits24(x, w, startmask, endmask, nlw) \ startmask = cfbstarttab24[(x) & 3]; \ endmask = cfbendtab24[((x)+(w)) & 3]; \ if (startmask){ \ nlw = (((w) - (4 - ((x) & 3))) >> 2); \ } else { \ nlw = (w) >> 2; \ } #define getbits24(psrc, dst, index) {\ register int idx; \ switch(idx = ((index)&3)<<1){ \ case 0: \ dst = (*(psrc) &cfbmask[idx]); \ break; \ case 6: \ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \ break; \ default: \ dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \ BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ }; \ } #define putbits24(src, x, w, pdst, planemask, index) {\ register PixelGroup dstpixel; \ register unsigned int idx; \ switch(idx = ((index)&3)<<1){ \ case 0: \ dstpixel = (*(pdst) &cfbmask[idx]); \ break; \ case 6: \ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ break; \ default: \ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ }; \ dstpixel &= ~(planemask); \ dstpixel |= (src & planemask); \ *(pdst) &= cfbrmask[idx]; \ switch(idx){ \ case 0: \ *(pdst) |= (dstpixel & cfbmask[idx]); \ break; \ case 2: \ case 4: \ pdst++;idx++; \ *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \ (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ pdst--;idx--; \ case 6: \ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ break; \ }; \ } #define putbitsrop24(src, x, pdst, planemask, rop) \ { \ register PixelGroup t1, dstpixel; \ register unsigned int idx; \ switch(idx = (x)<<1){ \ case 0: \ dstpixel = (*(pdst) &cfbmask[idx]); \ break; \ case 6: \ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ break; \ default: \ dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ }; \ DoRop(t1, rop, (src), dstpixel); \ dstpixel &= ~planemask; \ dstpixel |= (t1 & planemask); \ *(pdst) &= cfbrmask[idx]; \ switch(idx){ \ case 0: \ *(pdst) |= (dstpixel & cfbmask[idx]); \ break; \ case 2: \ case 4: \ *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \ (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \ case 6: \ *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ }; \ } # else /* PSZ == 24 && PPW == 1 */ #define maskbits(x, w, startmask, endmask, nlw) \ startmask = cfbstarttab[(x)&PIM]; \ endmask = cfbendtab[((x)+(w)) & PIM]; \ if (startmask) \ nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \ else \ nlw = (w) >> PWSH; #define maskpartialbits(x, w, mask) \ mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM]; #define mask32bits(x, w, startmask, endmask) \ startmask = cfbstarttab[(x)&PIM]; \ endmask = cfbendtab[((x)+(w)) & PIM]; /* FIXME */ #define maskbits24(x, w, startmask, endmask, nlw) \ abort() #define getbits24(psrc, dst, index) \ abort() #define putbits24(src, x, w, pdst, planemask, index) \ abort() #define putbitsrop24(src, x, pdst, planemask, rop) \ abort() #endif /* PSZ == 24 && PPW == 1 */ #define getbits(psrc, x, w, dst) \ if ( ((x) + (w)) <= PPW) \ { \ dst = SCRLEFT(*(psrc), (x)); \ } \ else \ { \ int m; \ m = PPW-(x); \ dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \ (SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \ } #define putbits(src, x, w, pdst, planemask) \ if ( ((x)+(w)) <= PPW) \ { \ PixelGroup tmpmask; \ maskpartialbits((x), (w), tmpmask); \ tmpmask &= PFILL(planemask); \ *(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \ } \ else \ { \ unsigned long m; \ unsigned long n; \ PixelGroup pm = PFILL(planemask); \ m = PPW-(x); \ n = (w) - m; \ *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \ (SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \ *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \ (SCRLEFT(src, m) & (cfbendtab[n] & pm)); \ } #if defined(__GNUC__) && defined(mc68020) #undef getbits #define FASTGETBITS(psrc, x, w, dst) \ asm ("bfextu %3{%1:%2},%0" \ : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) #define getbits(psrc,x,w,dst) \ { \ FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \ dst = SCRLEFT(dst,PPW-(w)); \ } #define FASTPUTBITS(src, x, w, pdst) \ asm ("bfins %3,%0{%1:%2}" \ : "=o" (*(char *)(pdst)) \ : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst))) #undef putbits #define putbits(src, x, w, pdst, planemask) \ { \ if (planemask != PMSK) { \ PixelGroup _m, _pm; \ FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \ PFILL2(planemask, _pm); \ _m &= (~_pm); \ _m |= (SCRRIGHT(src, PPW-(w)) & _pm); \ FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \ } else { \ FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \ } \ } #endif /* mc68020 */ #define putbitsrop(src, x, w, pdst, planemask, rop) \ if ( ((x)+(w)) <= PPW) \ { \ PixelGroup tmpmask; \ PixelGroup t1, t2; \ maskpartialbits((x), (w), tmpmask); \ PFILL2(planemask, t1); \ tmpmask &= t1; \ t1 = SCRRIGHT((src), (x)); \ DoRop(t2, rop, t1, *(pdst)); \ *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ } \ else \ { \ unsigned long m; \ unsigned long n; \ PixelGroup t1, t2; \ PixelGroup pm; \ PFILL2(planemask, pm); \ m = PPW-(x); \ n = (w) - m; \ t1 = SCRRIGHT((src), (x)); \ DoRop(t2, rop, t1, *(pdst)); \ *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\ t1 = SCRLEFT((src), m); \ DoRop(t2, rop, t1, *((pdst) + 1)); \ *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \ (t2 & (cfbendtab[n] & pm)); \ } #else /* PSZ == 32 && PPW == 1*/ /* * These macros can be optimized for 32-bit pixels since there is no * need to worry about left/right edge masking. These macros were * derived from the above using the following reductions: * * - x & PIW = 0 [since PIW = 0] * - all masking tables are only indexed by 0 [ due to above ] * - cfbstartab[0] and cfbendtab[0] = 0 [ no left/right edge masks] * - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask] * * Macro reduction based upon constants cannot be performed automatically * by the compiler since it does not know the contents of the masking * arrays in cfbmskbits.c. */ #define maskbits(x, w, startmask, endmask, nlw) \ startmask = endmask = 0; \ nlw = (w); #define maskpartialbits(x, w, mask) \ mask = 0xFFFFFFFF; #define mask32bits(x, w, startmask, endmask) \ startmask = endmask = 0; /* * For 32-bit operations, getbits(), putbits(), and putbitsrop() * will only be invoked with x = 0 and w = PPW (1). The getbits() * macro is only called within left/right edge logic, which doesn't * happen for 32-bit pixels. */ #define getbits(psrc, x, w, dst) (dst) = *(psrc) #define putbits(src, x, w, pdst, planemask) \ *(pdst) = (*(pdst) & ~planemask) | (src & planemask); #define putbitsrop(src, x, w, pdst, planemask, rop) \ { \ PixelGroup t1; \ DoRop(t1, rop, (src), *(pdst)); \ *(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \ } #endif /* PSZ != 32 */ /* * Use these macros only when you're using the MergeRop stuff * in ../mfb/mergerop.h */ /* useful only when not spanning destination longwords */ #if PSZ == 24 #define putbitsmropshort24(src,x,w,pdst,index) {\ PixelGroup _tmpmask; \ PixelGroup _t1; \ maskpartialbits ((x), (w), _tmpmask); \ _t1 = SCRRIGHT((src), (x)); \ DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \ } #endif #define putbitsmropshort(src,x,w,pdst) {\ PixelGroup _tmpmask; \ PixelGroup _t1; \ maskpartialbits ((x), (w), _tmpmask); \ _t1 = SCRRIGHT((src), (x)); \ *pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \ } /* useful only when spanning destination longwords */ #define putbitsmroplong(src,x,w,pdst) { \ PixelGroup _startmask, _endmask; \ int _m; \ PixelGroup _t1; \ _m = PPW - (x); \ _startmask = cfbstarttab[x]; \ _endmask = cfbendtab[(w) - _m]; \ _t1 = SCRRIGHT((src), (x)); \ pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \ _t1 = SCRLEFT ((src),_m); \ pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \ } #define putbitsmrop(src,x,w,pdst) \ if ((x) + (w) <= PPW) {\ putbitsmropshort(src,x,w,pdst); \ } else { \ putbitsmroplong(src,x,w,pdst); \ } #if GETLEFTBITS_ALIGNMENT == 1 #define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc) #define getleftbits24(psrc, w, dst, idx){ \ regiseter int index; \ switch(index = ((idx)&3)<<1){ \ case 0: \ dst = (*((unsigned int *) psrc))&cfbmask[index]; \ break; \ case 2: \ case 4: \ dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \ dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \ break; \ case 6: \ dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \ break; \ }; \ } #endif /* GETLEFTBITS_ALIGNMENT == 1 */ #define getglyphbits(psrc, x, w, dst) \ { \ dst = BitLeft((unsigned) *(psrc), (x)); \ if ( ((x) + (w)) > 32) \ dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \ } #if GETLEFTBITS_ALIGNMENT == 2 #define getleftbits(psrc, w, dst) \ { \ if ( ((int)(psrc)) & 0x01 ) \ getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \ else \ dst = *((unsigned int *) psrc); \ } #endif /* GETLEFTBITS_ALIGNMENT == 2 */ #if GETLEFTBITS_ALIGNMENT == 4 #define getleftbits(psrc, w, dst) \ { \ int off, off_b; \ off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \ getglyphbits( \ (unsigned int *)( ((char *)(psrc)) - off), \ (off_b), (w), (dst) \ ); \ } #endif /* GETLEFTBITS_ALIGNMENT == 4 */ /* * getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) * * Converts bits to pixels in a reasonable way. Takes w (1 <= w <= PPW) * bits from *psrcstip, starting at bit x; call this a quartet of bits. * Then, takes the pixels from *psrcpix corresponding to the one-bits (if * ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet * and puts these pixels into destpix. * * Example: * * getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest ) * * 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011 * * This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101. * It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this * quartet, so dest = 0x005D007F. * * XXX Works with both byte order. * XXX This works for all values of x and w within a doubleword. */ #if (BITMAP_BIT_ORDER == MSBFirst) #define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \ { \ PixelGroup q; \ int m; \ if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \ q = (*(psrcstip)) << m; \ if ( (x)+(w) > (PPW*PSZ) ) \ q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \ } \ else \ q = (*(psrcstip)) >> -m; \ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } #else /* BITMAP_BIT_ORDER == LSB */ /*================================================================ BEGIN ORL VNC modification Only use ldq_u on XFREE86 platforms */ #ifdef XFREE86 #define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \ { \ PixelGroup q; \ q = ldq_u(psrcstip) >> (xt); \ if ( ((xt)+(w)) > (PPW*PSZ) ) \ q |= (ldq_u((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } #else /* XFREE86 */ #define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \ { \ PixelGroup q; \ q = *(psrcstip) >> (xt); \ if ( ((xt)+(w)) > (PPW*PSZ) ) \ q |= (*((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } #endif /* XFREE86 */ /* END ORL VNC modification ================================================================*/ #if PSZ == 24 # if 0 #define getstipplepixels24( psrcstip,xt,w,ones,psrcpix,destpix,stipindex,srcindex,dstindex) \ { \ PixelGroup q, srcpix, srcstip; \ unsigned long src; \ register unsigned int sidx; \ register unsigned int didx; \ register unsigned int stipidx; \ sidx = ((srcindex) & 3)<<1; \ didx = ((dstindex) & 3)<<1; \ q = *(psrcstip) >> (xt); \ /* if((srcindex)!=0)*/ \ /* src = (((*(psrcpix)) << cfb24Shift[sidx]) & (cfbmask[sidx])) |*/ \ /* (((*((psrcpix)+1)) << cfb24Shift[sidx+1]) & (cfbmask[sidx+1])); */\ /* else */\ src = (*(psrcpix))&0xFFFFFF; \ if ( ((xt)+(w)) > PGSZ ) \ q |= (*((psrcstip)+1)) << (PGSZ -(xt)); \ q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ src &= QuartetPixelMaskTable[q]; \ *(destpix) &= cfbrmask[didx]; \ switch(didx) {\ case 0: \ *(destpix) |= (src &cfbmask[didx]); \ break; \ case 2: \ case 4: \ destpix++;didx++; \ *(destpix) = ((*(destpix)) & (cfbrmask[didx]))| \ (BitLeft(src, cfb24Shift[didx]) & (cfbmask[didx])); \ destpix--; didx--;\ case 6: \ *(destpix) |= (BitRight(src, cfb24Shift[didx]) & cfbmask[didx]); \ break; \ }; \ } # else #define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \ { \ PixelGroup q, srcpix, srcstip; \ unsigned long src; \ register unsigned int stipidx; \ q = *(psrcstip) >> (xt); \ q = ((ones) ? q : ~q) & 1; \ *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ } # endif #endif /* PSZ == 24 */ #endif extern PixelGroup cfbstarttab[]; extern PixelGroup cfbendtab[]; extern PixelGroup cfbstartpartial[]; extern PixelGroup cfbendpartial[]; extern PixelGroup cfbrmask[]; extern PixelGroup cfbmask[]; extern PixelGroup QuartetBitsTable[]; extern PixelGroup QuartetPixelMaskTable[]; #if PSZ == 24 extern int cfb24Shift[]; #endif vnc_unixsrc/Xvnc/programs/Xserver/cfb/stipsprc32.s0100664000076400007640000001447207446015423021645 0ustar constconst/* * $XConsortium: stipsprc32.s,v 1.3 94/04/17 20:29:10 rws Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * SPARC assembly code for optimized text rendering. * * Other stippling could be done in assembly, but the payoff is * not nearly as large. Mostly because large areas are heavily * optimized already. */ /* not that I expect to ever see an LSB SPARC, but ... */ #ifdef LITTLE_ENDIAN # define BitsR sll # define BitsL srl # define WO(o) 3-o # define FourBits(dest,bits) and bits, 0xf, dest #else # define BitsR srl # define BitsL sll # define WO(o) o # define FourBits(dest,bits) srl bits, 28, dest #endif /* * cfb32StippleStack(addr, stipple, value, stride, Count, Shift) * 4 5 6 7 16(sp) 20(sp) * * Apply successive 32-bit stipples starting at addr, addr+stride, ... * * Used for text rendering, but only when no data could be lost * when the stipple is shifted left by Shift bits */ /* arguments */ #define addr %i0 #define stipple %i1 #define value %i2 #define stride %i3 #define count %i4 #define shift %i5 /* local variables */ #define atemp %l0 #define bits %l1 #define lshift %l2 #define sbase %l3 #define stemp %l4 #define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ #define CASE_MASK 0x1e0 /* first case mask */ #define ForEachLine LY1 #define NextLine LY2 #define CaseBegin LY3 #define ForEachBits LY4 #define NextBits LY5 #if defined(SVR4) || ( defined(linux) && defined(__ELF__) ) #ifdef TETEXT #define _cfb32StippleStack cfb32StippleStackTE #else #define _cfb32StippleStack cfb32StippleStack #endif #else #ifdef TETEXT #define _cfb32StippleStack _cfb32StippleStackTE #endif #endif .seg "text" .proc 16 .globl _cfb32StippleStack _cfb32StippleStack: save %sp,-64,%sp sethi %hi(CaseBegin),sbase /* load up switch table */ or sbase,%lo(CaseBegin),sbase mov 4,lshift /* compute offset within */ sub lshift, shift, lshift /* stipple of remaining bits */ #ifdef LITTLE_ENDIAN inc CASE_SIZE, shift /* first shift for LSB */ #else inc 28-CASE_SIZE, shift /* first shift for MSB */ #endif /* do ... while (--count > 0); */ ForEachLine: ld [stipple],bits /* get stipple bits */ mov addr,atemp /* set up for this line */ #ifdef TETEXT /* Terminal emulator fonts are expanded and have many 0 rows */ tst bits bz NextLine /* skip out early on 0 */ #endif add addr, stride, addr /* step for the loop */ BitsR bits, shift, stemp /* get first bits */ and stemp, CASE_MASK, stemp /* compute first jump */ BitsL bits, lshift, bits /* set remaining bits */ jmp sbase+stemp /* ... */ tst bits ForEachBits: inc 16, atemp ForEachBits1: FourBits(stemp, bits) /* compute jump for */ sll stemp, CASE_SIZE, stemp /* these four bits */ BitsL bits, 4, bits /* step for remaining bits */ jmp sbase+stemp /* jump */ tst bits CaseBegin: bnz,a ForEachBits1 /* 0 */ inc 16, atemp NextLine: deccc 1, count NextLine1: bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 1 */ st value, [atemp+WO(12)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop bnz ForEachBits /* 2 */ st value, [atemp+WO(8)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop st value, [atemp+WO(8)] /* 3 */ bnz ForEachBits st value, [atemp+WO(12)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore bnz ForEachBits /* 4 */ st value, [atemp+WO(4)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop st value, [atemp+WO(4)] /* 5 */ bnz ForEachBits st value, [atemp+WO(12)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore st value, [atemp+WO(4)] /* 6 */ bnz ForEachBits st value, [atemp+WO(8)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore st value, [atemp+WO(4)] /* 7 */ st value, [atemp+WO(8)] bnz ForEachBits st value, [atemp+WO(12)] b NextLine1 deccc 1, count nop nop bnz ForEachBits /* 8 */ st value, [atemp+WO(0)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore nop st value, [atemp+WO(0)] /* 9 */ bnz ForEachBits st value, [atemp+WO(12)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore st value, [atemp+WO(0)] /* a */ bnz ForEachBits st value, [atemp+WO(8)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore st value, [atemp+WO(0)] /* b */ st value, [atemp+WO(8)] bnz ForEachBits st value, [atemp+WO(12)] b NextLine1 deccc 1, count nop nop st value, [atemp+WO(0)] /* c */ bnz ForEachBits st value, [atemp+WO(4)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore st value, [atemp+WO(0)] /* d */ st value, [atemp+WO(4)] bnz ForEachBits st value, [atemp+WO(12)] b NextLine1 deccc 1, count nop nop st value, [atemp+WO(0)] /* e */ st value, [atemp+WO(4)] bnz ForEachBits st value, [atemp+WO(8)] b NextLine1 deccc 1, count nop nop st value, [atemp+WO(0)] /* f */ st value, [atemp+WO(4)] st value, [atemp+WO(8)] bnz ForEachBits st value, [atemp+WO(12)] deccc 1, count bnz,a ForEachLine inc 4, stipple ret restore vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbmap.h0100664000076400007640000001732307120677563021054 0ustar constconst/* * $XConsortium: cfbmap.h,v 1.11 95/06/08 23:20:39 gildea Exp $ * $XFree86: xc/programs/Xserver/cfb/cfbmap.h,v 3.3 1996/06/29 09:05:40 dawes Exp $ * Copyright (c) 1991 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * Map names around so that multiple depths can be supported simultaneously */ /* a losing vendor cpp dumps core if we define NAME in terms of CATNAME */ #if PSZ != 8 #if PSZ == 32 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define NAME(subname) cfb32##subname #else #define NAME(subname) cfb32/**/subname #endif #endif #if PSZ == 24 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define NAME(subname) cfb24##subname #else #define NAME(subname) cfb24/**/subname #endif #endif #if PSZ == 16 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define NAME(subname) cfb16##subname #else #define NAME(subname) cfb16/**/subname #endif #endif #if PSZ == 4 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define NAME(subname) cfb4##subname #else #define NAME(subname) cfb4/**/subname #endif #endif #ifndef NAME cfb can not hack PSZ yet #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define CATNAME(prefix,subname) prefix##subname #else #define CATNAME(prefix,subname) prefix/**/subname #endif #define cfbScreenPrivateIndex NAME(ScreenPrivateIndex) #define QuartetBitsTable NAME(QuartetBitsTable) #define QuartetPixelMaskTable NAME(QuartetPixelMaskTable) #define cfbAllocatePrivates NAME(AllocatePrivates) #define cfbBSFuncRec NAME(BSFuncRec) #define cfbBitBlt NAME(BitBlt) #define cfbBresD NAME(BresD) #define cfbBresS NAME(BresS) #define cfbChangeWindowAttributes NAME(ChangeWindowAttributes) #define cfbCloseScreen NAME(CloseScreen) #define cfbCopyArea NAME(CopyArea) #define cfbCopyImagePlane NAME(CopyImagePlane) #define cfbCopyPixmap NAME(CopyPixmap) #define cfbCopyPlane NAME(CopyPlane) #define cfbCopyRotatePixmap NAME(CopyRotatePixmap) #define cfbCopyWindow NAME(CopyWindow) #define cfbCreateGC NAME(CreateGC) #define cfbCreatePixmap NAME(CreatePixmap) #define cfbCreateWindow NAME(CreateWindow) #define cfbCreateScreenResources NAME(CreateScreenResources) #define cfbDestroyPixmap NAME(DestroyPixmap) #define cfbDestroyWindow NAME(DestroyWindow) #define cfbDoBitblt NAME(DoBitblt) #define cfbDoBitbltCopy NAME(DoBitbltCopy) #define cfbDoBitbltGeneral NAME(DoBitbltGeneral) #define cfbDoBitbltOr NAME(DoBitbltOr) #define cfbDoBitbltXor NAME(DoBitbltXor) #define cfbFillBoxSolid NAME(FillBoxSolid) #define cfbFillBoxTile32 NAME(FillBoxTile32) #define cfbFillBoxTile32sCopy NAME(FillBoxTile32sCopy) #define cfbFillBoxTile32sGeneral NAME(FillBoxTile32sGeneral) #define cfbFillBoxTileOdd NAME(FillBoxTileOdd) #define cfbFillBoxTileOddCopy NAME(FillBoxTileOddCopy) #define cfbFillBoxTileOddGeneral NAME(FillBoxTileOddGeneral) #define cfbFillPoly1RectCopy NAME(FillPoly1RectCopy) #define cfbFillPoly1RectGeneral NAME(FillPoly1RectGeneral) #define cfbFillRectSolidCopy NAME(FillRectSolidCopy) #define cfbFillRectSolidGeneral NAME(FillRectSolidGeneral) #define cfbFillRectSolidXor NAME(FillRectSolidXor) #define cfbFillRectTile32Copy NAME(FillRectTile32Copy) #define cfbFillRectTile32General NAME(FillRectTile32General) #define cfbFillRectTileOdd NAME(FillRectTileOdd) #define cfbFillSpanTile32sCopy NAME(FillSpanTile32sCopy) #define cfbFillSpanTile32sGeneral NAME(FillSpanTile32sGeneral) #define cfbFillSpanTileOddCopy NAME(FillSpanTileOddCopy) #define cfbFillSpanTileOddGeneral NAME(FillSpanTileOddGeneral) #define cfbFinishScreenInit NAME(FinishScreenInit) #define cfbGCFuncs NAME(GCFuncs) #define cfbGetImage NAME(GetImage) #define cfbGetSpans NAME(GetSpans) #define cfbHorzS NAME(HorzS) #define cfbImageGlyphBlt8 NAME(ImageGlyphBlt8) #define cfbLineSD NAME(LineSD) #define cfbLineSS NAME(LineSS) #define cfbMapWindow NAME(MapWindow) #define cfbMatchCommon NAME(MatchCommon) #define cfbNonTEOps NAME(NonTEOps) #define cfbNonTEOps1Rect NAME(NonTEOps1Rect) #define cfbPadPixmap NAME(PadPixmap) #define cfbPaintWindow NAME(PaintWindow) #define cfbPolyGlyphBlt8 NAME(PolyGlyphBlt8) #define cfbPolyGlyphRop8 NAME(PolyGlyphRop8) #define cfbPolyFillArcSolidCopy NAME(PolyFillArcSolidCopy) #define cfbPolyFillArcSolidGeneral NAME(PolyFillArcSolidGeneral) #define cfbPolyFillRect NAME(PolyFillRect) #define cfbPolyPoint NAME(PolyPoint) #define cfbPositionWindow NAME(PositionWindow) #define cfbPutImage NAME(PutImage) #define cfbReduceRasterOp NAME(ReduceRasterOp) #define cfbRestoreAreas NAME(RestoreAreas) #define cfbSaveAreas NAME(SaveAreas) #define cfbScreenInit NAME(ScreenInit) #define cfbSegmentSD NAME(SegmentSD) #define cfbSegmentSS NAME(SegmentSS) #define cfbSetScanline NAME(SetScanline) #define cfbSetSpans NAME(SetSpans) #define cfbSetupScreen NAME(SetupScreen) #define cfbSolidSpansCopy NAME(SolidSpansCopy) #define cfbSolidSpansGeneral NAME(SolidSpansGeneral) #define cfbSolidSpansXor NAME(SolidSpansXor) #define cfbStippleStack NAME(StippleStack) #define cfbStippleStackTE NAME(StippleStackTE) #define cfbTEGlyphBlt NAME(TEGlyphBlt) #define cfbTEOps NAME(TEOps) #define cfbTEOps1Rect NAME(TEOps1Rect) #define cfbTile32FSCopy NAME(Tile32FSCopy) #define cfbTile32FSGeneral NAME(Tile32FSGeneral) #define cfbUnmapWindow NAME(UnmapWindow) #define cfbUnnaturalStippleFS NAME(UnnaturalStippleFS) #define cfbUnnaturalTileFS NAME(UnnaturalTileFS) #define cfbValidateGC NAME(ValidateGC) #define cfbVertS NAME(VertS) #define cfbXRotatePixmap NAME(XRotatePixmap) #define cfbYRotatePixmap NAME(YRotatePixmap) #define cfbendpartial NAME(endpartial) #define cfbendtab NAME(endtab) #define cfbmask NAME(mask) #define cfbrmask NAME(rmask) #define cfbstartpartial NAME(startpartial) #define cfbstarttab NAME(starttab) #define cfb8LineSS1Rect NAME(LineSS1Rect) #define cfb8SegmentSS1Rect NAME(SegmentSS1Rect) #define cfb8ClippedLineCopy NAME(ClippedLineCopy) #define cfb8ClippedLineXor NAME(ClippedLineXor) #define cfb8ClippedLineGeneral NAME(ClippedLineGeneral ) #define cfb8SegmentSS1RectCopy NAME(SegmentSS1RectCopy) #define cfb8SegmentSS1RectXor NAME(SegmentSS1RectXor) #define cfb8SegmentSS1RectGeneral NAME(SegmentSS1RectGeneral ) #define cfb8SegmentSS1RectShiftCopy NAME(SegmentSS1RectShiftCopy) #define cfb8LineSS1RectCopy NAME(LineSS1RectCopy) #define cfb8LineSS1RectXor NAME(LineSS1RectXor) #define cfb8LineSS1RectGeneral NAME(LineSS1RectGeneral ) #define cfb8LineSS1RectPreviousCopy NAME(LineSS1RectPreviousCopy) #define cfbZeroPolyArcSS8Copy NAME(ZeroPolyArcSSCopy) #define cfbZeroPolyArcSS8Xor NAME(ZeroPolyArcSSXor) #define cfbZeroPolyArcSS8General NAME(ZeroPolyArcSSGeneral) #endif /* PSZ != 8 */ vnc_unixsrc/Xvnc/programs/Xserver/cfb/cfbgetsp.c0100664000076400007640000001465307120677563021417 0ustar constconst/* $XConsortium: cfbgetsp.c,v 5.14 94/04/17 20:28:50 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/cfb/cfbgetsp.c,v 3.0.4.1 1997/07/13 14:44:57 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "Xmd.h" #include "servermd.h" #include "misc.h" #include "region.h" #include "gc.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "cfb.h" #include "cfbmskbits.h" /* GetSpans -- for each span, gets bits from drawable starting at ppt[i] * and continuing for pwidth[i] bits * Each scanline returned will be server scanline padded, i.e., it will come * out to an integral number of words. */ void cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) DrawablePtr pDrawable; /* drawable from which to get bits */ int wMax; /* largest value of all *pwidths */ register DDXPointPtr ppt; /* points to start copying from */ int *pwidth; /* list of number of bits to copy */ int nspans; /* number of scanlines to copy */ char *pchardstStart; /* where to put the bits */ { PixelGroup *pdstStart = (PixelGroup *)pchardstStart; register PixelGroup *pdst; /* where to put the bits */ register PixelGroup *psrc; /* where to get the bits */ register PixelGroup tmpSrc; /* scratch buffer for bits */ PixelGroup *psrcBase; /* start of src bitmap */ int widthSrc; /* width of pixmap in bytes */ register DDXPointPtr pptLast; /* one past last point to get */ int xEnd; /* last pixel to copy from */ register int nstart; int nend; PixelGroup startmask, endmask; int nlMiddle, nl, srcBit; int w; PixelGroup *pdstNext; #if PSZ == 24 register char *psrcb, *pdstb; register int xIndex = 0; #endif switch (pDrawable->bitsPerPixel) { case 1: mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); return; case PSZ: break; default: FatalError("cfbGetSpans: invalid depth\n"); } cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase) #ifdef PIXEL_ADDR # if PSZ != 24 if ((nspans == 1) && (*pwidth == 1)) { tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc)) + ppt->x); #if BITMAP_BIT_ORDER == MSBFirst tmpSrc <<= (sizeof (unsigned long) - sizeof (PixelType)) * 8; #endif *pdstStart = tmpSrc; return; } # endif /* PSZ != 24 */ #endif pdst = pdstStart; pptLast = ppt + nspans; while(ppt < pptLast) { #if PSZ == 24 xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(long) / 3); w = xEnd - ppt->x; psrc = psrcBase + ppt->y * widthSrc; srcBit = ppt->x; psrcb = (char *)psrc + (ppt->x * 3); xIndex = 0; pdstb = (char *)pdst; pdstNext = pdst + ((w * 3 + 3) >> 2); #else xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); w = xEnd - ppt->x; psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH); srcBit = ppt->x & PIM; pdstNext = pdst + ((w + PPW - 1) >> PWSH); #endif #if PSZ == 24 if (w < 0) FatalError("cfb24GetSpans: Internal error (w < 0)\n"); nl = w; while (nl--){ psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03); getbits24(psrc, tmpSrc, srcBit); pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03); putbits24(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0), xIndex); srcBit++; psrcb += 3; xIndex++; pdstb += 3; } pdst = pdstNext; #else /* PSZ == 24 */ if (srcBit + w <= PPW) { getbits(psrc, srcBit, w, tmpSrc); putbits(tmpSrc, 0, w, pdst, ~((unsigned long)0)); pdst++; } else { maskbits(ppt->x, w, startmask, endmask, nlMiddle); nstart = 0; if (startmask) { nstart = PPW - srcBit; getbits(psrc, srcBit, nstart, tmpSrc); putbits(tmpSrc, 0, nstart, pdst, ~((unsigned long)0)); if(srcBit + nstart >= PPW) psrc++; } nl = nlMiddle; while (nl--) { tmpSrc = *psrc; putbits(tmpSrc, nstart, PPW, pdst, ~((unsigned long)0)); psrc++; pdst++; } if (endmask) { nend = xEnd & PIM; getbits(psrc, 0, nend, tmpSrc); putbits(tmpSrc, nstart, nend, pdst, ~((unsigned long)0)); } pdst = pdstNext; } #endif /* PSZ == 24 */ ppt++; pwidth++; } } vnc_unixsrc/Xvnc/programs/Xserver/Imakefile0100664000076400007640000015512307120677563020533 0ustar constconstXCOMM $TOG: Imakefile /main/235 1997/05/25 15:12:21 kaleb $ /* * Server Master Makefile */ XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.85.2.8 1998/02/07 00:44:33 dawes Exp $ #include #ifdef XFree86Version /* Don't strip server binaries */ INSTPGMFLAGS = #endif #define PreFbLibs $(DIX) $(OS) $(FONT) $(XPDDX) #define BarePostFbLibs $(MFB) $(XPFBLIBS) $(MI) #define PostFbLibs BarePostFbLibs $(EXTENSIONS) #define NoMfbBarePostFbLibs $(XPFBLIBS) $(MI) #define NoMfbPostFbLibs NoMfbBarePostFbLibs $(EXTENSIONS) #define MFBBareLibs PreFbLibs BarePostFbLibs #define NoMFBBareLibs PreFbLibs NoMfbBarePostFbLibs #define MFBLibs PreFbLibs PostFbLibs #define NoMFBLibs PreFbLibs NoMfbPostFbLibs #define CFBLibs PreFbLibs $(CFB) PostFbLibs #define CFB4Libs PreFbLibs $(CFB4) PostFbLibs #define CFB8Libs PreFbLibs $(CFB8) PostFbLibs #define CFB16Libs PreFbLibs $(CFB16) PostFbLibs #define CFB24Libs PreFbLibs $(CFB24) PostFbLibs #define CFB32Libs PreFbLibs $(CFB32) PostFbLibs #if BuildPexExt PEXLIBS = PEX5/dipex/dispatch/LibraryTargetName(didipex) \ PEX5/dipex/swap/LibraryTargetName(diswapex) \ PEX5/dipex/objects/LibraryTargetName(diobpex) \ PEX5/dipex/dispatch/LibraryTargetName(didipex) \ PEX5/ddpex/mi/level4/LibraryTargetName(ddpex4) \ PEX5/ddpex/mi/level3/LibraryTargetName(ddpex3) \ PEX5/ddpex/mi/shared/LibraryTargetName(ddpexs) \ PEX5/ddpex/mi/level2/LibraryTargetName(ddpex2) \ PEX5/ddpex/mi/level1/LibraryTargetName(ddpex1) \ PEX5/ospex/LibraryTargetName(ospex) PEXDIR = PEX5 #endif #if BuildGlxExt /* && !GlxModule */ #if GlxStubLib GLXLIB = glxStub/LibraryTargetName(ServerGlx) GLXDIR = glxStub #else GLXLIB = GlxStaticServerLib GLXDIR = #endif #endif #if BuildXInputExt XINPUTEXT = Xi/LibraryTargetName(xinput) XIDIR = Xi #endif #if BuildXIE XIEEXT = XIE/dixie/LibraryTargetName(dixie) XIE/mixie/LibraryTargetName(mixie) #endif #if BuildXIE || BuildXIElib XIEDIR = XIE #endif #if BuildXKB XKBEXT = xkb/LibraryTargetName(xkb) XKBDIR = xkb #endif #if BuildLBX LBXEXT = lbx/LibraryTargetName(lbx) \ $(TOP)/lib/lbxutil/LibraryTargetName(lbxutil) LBXDIRS = lbx #endif #if BuildDBE DBEEXT = dbe/LibraryTargetName(dbe) #endif #if BuildDBE || BuildDBElib DBEDIR = dbe #endif #if BuildRECORD RECORDEXT = record/LibraryTargetName(record) #endif #if BuildRECORD || BuildRECORDlib RECORDDIR = record #endif #ifdef SiteExtensionLibs SITEEXTS = SiteExtensionLibs #endif #ifdef SiteExtensionDirs SITEEXTDIRS = SiteExtensionDirs #endif #if BuildXprint #ifndef XpRasterDDX #define XpRasterDDX NO #endif #ifndef XpColorPclDDX #define XpColorPclDDX YES #endif #ifndef XpMonoPclDDX #define XpMonoPclDDX NO #endif #ifndef XpPostScriptDDX #define XpPostScriptDDX YES #endif #if XpRasterDDX XPRASTLIB = Xprint/raster/LibraryTargetName(raster) #endif #if XpColorPclDDX XPPCLLIB = Xprint/pcl/LibraryTargetName(pcl) #endif #if XpMonoPclDDX XPMPCLLIB = Xprint/pcl-mono/LibraryTargetName(pcl) #endif #if XpPostScriptDDX XPPSLIB = Xprint/ps/LibraryTargetName(ps) #endif XPDDXLIBS = Xprint/LibraryTargetName(printer) $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB) XPDDXFBLIBS = $(MFB) $(CFB32) #if !PrintOnlyServer XPFBLIBS = $(XPDDXFBLIBS) XPDDX = $(XPDDXLIBS) #endif XPDDXDIR = Xprint #endif #if !BuildXprint || PrintOnlyServer XPFBLIBS = dix/LibraryTargetName(xpstubs) #endif OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \ $(XIEEXT) $(LBXEXT) $(DBEEXT) $(RECORDEXT) $(SITEEXTS) EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(XIEDIR) $(PEXDIR) $(GLXDIR) \ $(LBXDIRS) $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) EXTENSIONS = $(OTHEREXTS) $(PEXLIBS) $(GLXLIB) XAULIB = $(XAUTHSRC)/LibraryTargetName(Xau) XDMCPLIB = $(XDMCPLIBSRC)/LibraryTargetName(Xdmcp) #if BuildLBX || GzipFontCompression ZLIB = GzipLibrary #endif OS = os/LibraryTargetName(os) $(XAULIB) $(XDMCPLIB) BSDEMUL = $(DEPXBSDLIB) MFB = mfb/LibraryTargetName(mfb) CFB = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb) cfb24/LibraryTargetName(cfb) cfb32/LibraryTargetName(cfb) CFB8 = cfb/LibraryTargetName(cfb) CFB4 = cfb/LibraryTargetName(cfb) cfb4/LibraryTargetName(cfb) CFB16 = cfb/LibraryTargetName(cfb) cfb16/LibraryTargetName(cfb) CFB24 = cfb/LibraryTargetName(cfb) cfb24/LibraryTargetName(cfb) CFB32 = cfb/LibraryTargetName(cfb) cfb32/LibraryTargetName(cfb) MI = mi/LibraryTargetName(mi) DIX = dix/LibraryTargetName(dix) FONT = $(DEPFONTLIB) #ifdef ServerExtraSysLibs EXTRASYSLIBS = ServerExtraSysLibs #endif #if SystemV4 || defined(SGIArchitecture) || UseRgbTxt SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(EXTRASYSLIBS) #else SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries DBMLibrary $(EXTRASYSLIBS) #endif CBRT = mi/LibraryTargetName(cbrt) STDDIRS = include dix os mi $(XPDDXDIR) $(EXTDIRS) XCOMM XCOMM This turns off the default rule for compiling .c files because XCOMM this makefile does not really know how to build it. This is really XCOMM just a hack because of the Sun version of make and nfs. XCOMM .c.o: /* Build rule blocks, add one for each server * * If a server needs mfb, its build block should have a line like: * MFBDIR = mfb * Similarly, its build block should have: * CFB4DIR = cfb4 (if the server needs 4 bit cfb) * CFB8DIR = cfb (8 bit cfb) * CFB16DIR = cfb16 (16 bit cfb) * CFB24DIR = cfb24 (24 bit cfb) * CFB32DIR = cfb32 (32 bit cfb) * * If a server does not need all of the above components, simply * omit the relevant lines from the build block. * * Additional ddx directories can be split across three variables: * DDXDIR1, DDXDIR2, and DDXDIR3. Most servers only use DDXDIR1, * but if two servers can be built on a platform then DDXDIR1 is * typically set to the ddx directories that are shared by both * servers, DDXDIR2 is the directories unique to one of the servers, * and DDXDIR3 is the directories unique to the other server. * * If these guidelines are followed, a make at the top of the server * tree should result in each subdirectory being built only once, * even if multiple servers that share subdirectories are being built. */ #if XdecServer XCOMM XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond) XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/dec/ws DECDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) DECOBJS = hw/dec/ws/init.o hw/dec/ws/sdepthinit.o DECLIBS = hw/dec/ws/LibraryTargetName(dec) CFB8Libs ServerTarget(Xdec,$(DECDIRS),$(DECOBJS),$(DECLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xdec #endif #endif /* XdecServer */ #if XdecMultiDepthServer XCOMM XCOMM Digital MIPS based WS server (ultrix 4.2 and beyond) XCOMM Supports 8, 12, and 24 bit pixmaps XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/dec/ws DECDIRS1 = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) DECOBJS1 = hw/dec/ws/init.o hw/dec/ws/mdepthinit.o DECLIBS1 = hw/dec/ws/LibraryTargetName(dec) CFBLibs ServerTarget(Xdec_md,$(DECDIRS1),$(DECOBJS1),$(DECLIBS1),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xdec_md #endif #endif /* XdecMultiDepthServer */ #if XsunServer XCOMM XCOMM Sun server XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/sun #ifndef AmoebaArchitecture SUNOBJS = hw/sun/sunInit.o #else SUNOBJS = hw/sun/sunInitColor.o #endif SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs SUNSYSLIBS = $(WIDECHARSYSLIB) $(SYSLIBS) SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SUNSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif #endif /* XsunServer */ #if Xsun24Server XCOMM XCOMM Sun multiple pixmap depth (8, 12, 24) server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/sun SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) SUN24OBJS = hw/sun/sunInitMulti.o SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS),$(SUN24LIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun24 #endif #endif /* Xsun24Server */ #if XsunMonoServer XCOMM XCOMM Sun monochrome server XCOMM MFBDIR = mfb DDXDIR1 = hw/sun SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS) SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif #endif /* XsunMonoServer */ #if XsunAmoebaServer XCOMM XCOMM Sun server for Amoeba XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/sunAmoeba SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SUNOBJS = hw/sunAmoeba/sunInitColor.o SUNLIBS = hw/sunAmoeba/LibraryTargetName(sun) CFB8Libs ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif #endif /* XsunAmoebaServer */ #if XsunAmoebaMonoServer XCOMM XCOMM Sun monochrome server for Amoeba XCOMM MFBDIR = mfb DDXDIR1 = hw/sunAmoeba SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) SUNMOBJS = hw/sunAmoeba/sunInitMono.o hw/sunAmoeba/sunInExMono.o SUNMLIBS = hw/sunAmoeba/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS) ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif #endif /* XsunAmoebaMonoServer */ #if XsunLynxServer XCOMM XCOMM Sun server for LynxOS microSPARC 2.4.0 XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/sunLynx SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SUNOBJS = hw/sunLynx/sunLyInit.o SUNLIBS = hw/sunLynx/libsun.a CFB8Libs ServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsun #endif #endif /* XsunLynxServer */ #if XsunLynxMonoServer XCOMM XCOMM Sun monochrome server for LynxOS microSPARC 2.4.0 XCOMM MFBDIR = mfb DDXDIR1 = hw/sunLynx SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) SUNMOBJS = hw/sunLynx/sunInitMono.o hw/sunLynx/sunInExMono.o SUNMLIBS = hw/sunLynx/libsun.a MFBBareLibs $(OTHEREXTS) ServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XsunMono #endif #endif /* XsunLynxMonoServer */ #if XibmServer XCOMM XCOMM IBM server XCOMM #if SpecialMalloc IBMALLOCLIB = hw/ibm/common/LibraryTargetName(ibmalloc) #else IBMALLOCLIB = #endif MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/ibm IBMDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) IBMOBJS = hw/ibm/common/ibmcomm.o hw/ibm/common/ibmDate.o IBMLIBS = hw/ibm/AIX/hft.o hw/ibm/LibraryTargetName(ibm) $(IBMALLOCLIB) CFB8Libs ServerTarget(Xibm,$(IBMDIRS),$(IBMOBJS),$(IBMLIBS),$(SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xibm #endif #endif /* XibmServer */ #if XhpServer XCOMM XCOMM Hewlett Packard CFB Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB32DIR = cfb32 DDXDIR1 = hw/hp HPOBJS = hw/hp/hp.o HPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) HPLIBS = CFB32Libs HPSYSLIBS = $(CBRT) $(SYSLIBS) ServerTarget(Xhp,$(HPSUBDIRS),$(HPOBJS),$(HPLIBS),$(HPSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xhp #endif #endif /* XhpServer */ #if XsvgaServer XCOMM XCOMM SVGA CFB Server XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/svga SVGASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) SVGAOBJS = hw/svga/svga.o SVGALIBS = CFB8Libs SVGASYSLIBS = $(CBRT) -lm -lmalloc SetUIDServerTarget(Xsvga,$(SVGASUBDIRS),$(SVGAOBJS),$(SVGALIBS),$(SVGASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall Xsvga #endif #endif /* XsvgaServer */ #ifdef XFree86Version XF86INIT = $(XF86COMSRC)/xf86Init.o $(XF86CONFIGSRC)/xf86IniExt.o XF86MINIT = $(XF86COMSRC)/xf86Init_m.o $(XF86CONFIGSRC)/xf86MIniExt.o XF86CONFIG = $(XF86CONFIGSRC)/xf86_Option.o XF86COMLIB = $(XF86COMSRC)/LibraryTargetName(xf86) XF86OSLIB = $(XF86OSSRC)/LibraryTargetName(xf86_os) XF86HWLIB = $(XF86HWSRC)/LibraryTargetName(xf86_hw) XF86LIBS = $(XF86INIT) $(XF86CONFIG) $(XF86COMLIB) $(XF86OSLIB) \ $(XF86HWLIB) $(XF86OSLIB) XF86MLIBS = $(XF86MINIT) $(XF86CONFIG) $(XF86COMLIB) $(XF86OSLIB) \ $(XF86HWLIB) $(XF86OSLIB) XF68INIT = $(XF68COMSRC)/xf86Init.o $(XF68CONFIGSRC)/xf86IniExt.o XF68MINIT = $(XF68COMSRC)/xf86Init_m.o $(XF68CONFIGSRC)/xf86MIniExt.o XF68CONFIG = $(XF68CONFIGSRC)/xf86_Option.o XF68COMLIB = $(XF68COMSRC)/LibraryTargetName(xf86) XF68OSLIB = $(XF68OSSRC)/LibraryTargetName(xf86_os) XF68LIBS = $(XF68INIT) $(XF68CONFIG) $(XF68COMLIB) $(XF68OSLIB) XF68MLIBS = $(XF68MINIT) $(XF68CONFIG) $(XF68COMLIB) $(XF68OSLIB) XF98INIT = $(XF98COMSRC)/xf86Init.o $(XF98CONFIGSRC)/xf86IniExt.o XF98MINIT = $(XF98COMSRC)/xf86Init_m.o $(XF98CONFIGSRC)/xf86MIniExt.o XF98CONFIG = $(XF98CONFIGSRC)/xf86_Option.o XF98COMLIB = $(XF98COMSRC)/LibraryTargetName(xf86) XF98OSLIB = $(XF98OSSRC)/LibraryTargetName(xf86_os) XF98HWLIB = $(XF98HWSRC)/LibraryTargetName(xf86_hw) XF98HWNECLIB = $(XF98HWNECSRC)/LibraryTargetName(xf86_hw) XF98HWPWSKBLIB = $(XF98HWPWSKBSRC)/LibraryTargetName(xf86_hw) XF98HWPWLBLIB = $(XF98HWPWLBSRC)/LibraryTargetName(xf86_hw) XF98HWGA968LIB = $(XF98HWGA968SRC)/LibraryTargetName(xf86_hw) XF98LIBS = $(XF98INIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWLIB) $(XF98OSLIB) XF98LIBSNEC = $(XF98INIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWNECLIB) $(XF98OSLIB) XF98LIBSPWSKB = $(XF98INIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWPWSKBLIB) $(XF98OSLIB) XF98LIBSPWLB = $(XF98INIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWPWLBLIB) $(XF98OSLIB) XF98LIBSGA968 = $(XF98INIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWGA968LIB) $(XF98OSLIB) XF98MLIBS = $(XF98MINIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWLIB) $(XF98OSLIB) XF98MLIBSNEC = $(XF98MINIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWNECLIB) $(XF98OSLIB) XF98MLIBSPWSKB = $(XF98MINIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWPWSKBLIB) $(XF98OSLIB) XF98MLIBSPWLB = $(XF98MINIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWPWLBLIB) $(XF98OSLIB) XF98MLIBSGA968 = $(XF98MINIT) $(XF98CONFIG) $(XF98COMLIB) \ $(XF98HWGA968LIB) $(XF98OSLIB) #endif #if HasParallelMake XCOMM XCOMM force non-parallel build of XF86 servers to prevent MUTEX overrides XCOMM #if XF86SVGAServer XF86SVGA = XF86_SVGA #endif #if XF86VGA16Server XF86VGA16 = XF86_VGA16 #endif #if XF86W32Server XF86W32 = XF86_W32 #endif #if XF86MonoServer XF86MONO = XF86_Mono #endif #if XF86S3Server XF86S3 = XF86_S3 #endif #if XF86S3VServer XF86S3V = XF86_S3V #endif #if XF86I8514Server XF868514 = XF86_8514 #endif #if XF86Mach8Server XF86MACH8 = XF86_Mach8 #endif #if XF86Mach32Server XF86MACH32 = XF86_Mach32 #endif #if XF86Mach64Server XF86MACH64 = XF86_Mach64 #endif #if XF86P9000Server XF86P9000 = XF86_P9000 #endif #if XF86AGXServer XF86AGX = XF86_AGX #endif #if XF86I128Server XF86I128 = XF86_I128 #endif #if XF86TGAServer XF86TGA = XF86_TGA #endif #if XF68FBDevServer XF68FBDEV = XF68_FBDev #endif #if XF98GANBWAPServer XF98GANBWAP = XF98_GANBWAP #endif #if XF98NEC480Server XF98NEC480 = XF98_NEC480 #endif #if XF98NKVNECServer XF98NKVNEC = XF98_NKVNEC #endif #if XF98WABSServer XF98WABS = XF98_WABS #endif #if XF98WABEPServer XF98WABEP = XF98_WABEP #endif #if XF98WSNAServer XF98WSNA = XF98_WSNA #endif #if XF98TGUIServer XF98TGUI = XF98_TGUI #endif #if XF98MGAServer XF98MGA = XF98_MGA #endif #if XF98SVGAServer XF98SVGA = XF98_SVGA #endif #if XF98EGCServer XF98EGC = XF98_EGC #endif #if XF98NECS3Server XF98NECS3 = XF98_NECS3 #endif #if XF98PWSKBServer XF98PWSKB = XF98_PWSKB #endif #if XF98PWLBServer XF98PWLB = XF98_PWLB #endif #if XF98GA968Server XF98GA968 = XF98_GA968 #endif #if XnestServer XNEST = Xnest #endif #if XVirtualFramebufferServer XVFB = Xvfb #endif #if defined(XF86SVGAServer) || defined(XF98GANBWAPServer) || \ defined(XF98NEC480Server) || defined(XF98NKVNECServer) || \ defined(XF98WABSServer) || defined(XF98WABEPServer) || \ defined(XF98WSNAServer) || defined(XF98TGUIServer) || \ defined(XF98MGAServer) || defined(XF98SVGAServer) || \ defined(XF86VGA16Server) || defined(XF98EGCServer) || \ defined(XF86W32Server) || defined(XF86MonoServer) || \ defined(XF86S3Server) || defined(XF86S3VServer) || \ defined(XF98NECS3Server) || defined(XF98PWSKBServer) || \ defined(XF98PWLBServer) || defined(XF98GA968Server) || \ defined(XF86I8514Server) || defined(XF86Mach8Server) || \ defined(XF86Mach32Server) || defined(XF86Mach64Server) || \ defined(XF86P9000Server) || defined(XF86AGXServer) || \ defined(XF86I128Server) || defined(XF86TGAServer) || \ defined(XF68FBDevServer) || \ defined(XnestServer) || defined(XVirtualFramebufferServer) MakeMutex($(XF86SVGA) $(XF98GANBWAP) $(XF98NEC480) $(XF98NKVNEC) $(XF98WABS) \ $(XF98WABEP) $(XF98WSNA) $(XF98TGUI) $(XF98MGA) $(XF98SVGA) \ $(XF86VGA16) \ $(XF98EGC) $(XF86W32) $(XF86MONO) $(XF86S3) $(XF86S3V) $(XF98NECS3) \ $(XF98PWSKB) $(XF98PWLB) $(XF98GA968) $(XF868514) $(XF86MACH8) \ $(XF86MACH32) $(XF86MACH64) $(XF86P9000) $(XF86AGX) $(XF86I128) \ $(XF86TGA) $(XF68FBDEV) $(XNEST) $(XVFB)) #endif MakeMutex($(STDDIRS) mfb cfb cfb16 cfb32) #endif #if XF86SVGAServer XCOMM XCOMM XFree86 SVGA Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86SVGASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86SVGAOBJS = $(XF86COMSRC)/XF86_SVGA.o $(XF86SRC)/vga256/vga256Conf.o \ $(XF86SRC)/xaa/xaavga256/xaavga256.o \ $(XF86SRC)/xaa/xaa16/xaa16.o $(XF86SRC)/xaa/xaa24/xaa24.o \ $(XF86SRC)/xaa/xaa32/xaa32.o XF86SVGALIBS = $(VGADRIVERSRC)/LibraryTargetName(driver256) \ $(XF86SRC)/xaa/LibraryTargetName(xaa) \ $(XF86SRC)/vga256/LibraryTargetName(vga256) \ $(XF86LIBS) CFBLibs XF86SVGASYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86SVGASUBDIRS) $(XF86SVGAOBJS) $(XF86SVGALIBS) $(XF86SVGASYSLIBS)) #endif #if HasGnuMake $(XF86SVGAOBJS) $(XF86SVGALIBS) $(XF86SVGASYSLIBS):: $(XF86SVGASUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_SVGA,$(XF86SVGASUBDIRS),$(XF86SVGAOBJS),$(XF86SVGALIBS),$(XF86SVGASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_SVGA #endif #ifdef OS2Architecture LinkFile(XF86_SVGA.def,SVGA.def) InstallLinkKitNonExecFile(SVGA.def,$(LINKKITDIR)) #endif #endif /* XF86SVGAServer */ #if XF86VGA16Server XCOMM XCOMM XFree86 VGA 16 color Server XCOMM DDXDIR1 = hw/xfree86 #if XF86VGA16DualServer XF86VGA16MONOOBJS = $(XF86SRC)/mono/monoConf.o XF86VGA16MONOLIBS = $(MONODRIVERSRC)/LibraryTargetName(monodrv) \ $(XF86SRC)/mono/LibraryTargetName(mono) #endif XF86VGA16SUBDIRS = $(STDDIRS) $(DDXDIR1) $(DEPDIRS) XF86VGA16OBJS = $(XF86COMSRC)/XF86_VGA16.o $(XF86SRC)/vga16/vga16Conf.o \ $(XF86SRC)/vga16/misc/vga16misc.o $(XF86VGA16MONOOBJS) XF86VGA16LIBS = $(VGA16DRIVERSRC)/LibraryTargetName(driver16) \ $(XF86SRC)/vga16/LibraryTargetName(vga16) \ $(XF86VGA16MONOLIBS) $(XF86MLIBS) NoMFBBareLibs $(OTHEREXTS) XF86VGA16SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86VGA16SUBDIRS) $(XF86VGA16OBJS) $(XF86VGA16LIBS) $(XF86VGA16SYSLIBS)) #endif #if HasGnuMake $(XF86VGA16OBJS) $(XF86VGA16LIBS) $(XF86VGA16SYSLIBS):: $(XF86VGA16SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_VGA16,$(XF86VGA16SUBDIRS),$(XF86VGA16OBJS),$(XF86VGA16LIBS),$(XF86VGA16SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_VGA16 #endif #ifdef OS2Architecture LinkFile(XF86_VGA16.def,VGA16.def) InstallLinkKitNonExecFile(VGA16.def,$(LINKKITDIR)) #endif #endif /* XF86VGA16Server */ #if XF86W32Server XCOMM XCOMM XFree86 W32 Server XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/xfree86 XF86W32SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) XF86W32OBJS = $(XF86COMSRC)/XF86_W32.o $(XF86ACCELSRC)/et4000w32/w32Conf.o XF86W32LIBS = $(XF86ACCELSRC)/et4000w32/w32/LibraryTargetName(w32) \ $(XF86ACCELSRC)/et4000w32/cfb.w32/LibraryTargetName(cfb) \ $(XF86ACCELSRC)/et4000w32/w32/LibraryTargetName(w32) \ $(XF86ACCELSRC)/et4000w32/asm/LibraryTargetName(asm) \ $(XF86LIBS) CFB8Libs XF86W32SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86W32SUBDIRS) $(XF86W32OBJS) $(XF86W32LIBS) $(XF86W32SYSLIBS)) #endif #if HasGnuMake $(XF86W32OBJS) $(XF86W32LIBS) $(XF86W32SYSLIBS):: $(XF86W32SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_W32,$(XF86W32SUBDIRS),$(XF86W32OBJS),$(XF86W32LIBS),$(XF86W32SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_W32 #endif #ifdef OS2Architecture LinkFile(XF86_W32.def,W32.def) InstallLinkKitNonExecFile(W32.def,$(LINKKITDIR)) #endif #endif #if XF86MonoServer XCOMM XCOMM XFree86 Monochrome VGA Server XCOMM DDXDIR1 = hw/xfree86 #if XF86MonoDualServer XF86MONOMONOOBJS = $(XF86SRC)/mono/monoConf.o XF86MONOMONOLIBS = $(MONODRIVERSRC)/LibraryTargetName(monodrv) \ $(XF86SRC)/mono/LibraryTargetName(mono) #endif XF86MONOSUBDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) XF86MONOOBJS = $(XF86COMSRC)/XF86_Mono.o $(XF86SRC)/vga2/vga2Conf.o \ $(XF86SRC)/vga2/misc/vga2misc.o $(XF86MONOMONOOBJS) XF86MONOLIBS = $(VGA2DRIVERSRC)/LibraryTargetName(driver2) \ $(XF86SRC)/vga2/LibraryTargetName(vga2) \ $(XF86MONOMONOLIBS) $(XF86MLIBS) NoMFBBareLibs $(OTHEREXTS) XF86MONOSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86MONOSUBDIRS) $(XF86MONOOBJS) $(XF86MONOLIBS) $(XF86MONOSYSLIBS)) #endif #if HasGnuMake $(XF86MONOOBJS) $(XF86MONOLIBS) $(XF86MONOSYSLIBS):: $(XF86MONOSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_Mono,$(XF86MONOSUBDIRS),$(XF86MONOOBJS),$(XF86MONOLIBS),$(XF86MONOSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_Mono #endif #ifdef OS2Architecture LinkFile(XF86_Mono.def,Mono.def) InstallLinkKitNonExecFile(Mono.def,$(LINKKITDIR)) #endif #endif /* XF86MonoServer */ #if XF86S3Server XCOMM XCOMM XFree86 S3 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86S3SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86S3OBJS = $(XF86COMSRC)/XF86_S3.o $(XF86ACCELSRC)/s3/s3Conf.o \ $(S3DRIVERSRC)/newmmio/newmmio.o \ $(S3DRIVERSRC)/mmio_928/mmio_928.o \ $(S3DRIVERSRC)/s3_generic/s3_generic.o XF86S3LIBS = $(XF86ACCELSRC)/s3/LibraryTargetName(s3) \ $(XF86ACCELSRC)/s3/s3newmmio/LibraryTargetName(s3newmmio) \ $(XF86ACCELSRC)/s3/s3mmio/LibraryTargetName(s3mmio) $(XF86LIBS) \ CFBLibs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86S3SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86S3SUBDIRS) $(XF86S3OBJS) $(XF86S3LIBS) $(XF86S3SYSLIBS)) #endif SetUIDServerTarget(XF86_S3,$(XF86S3SUBDIRS),$(XF86S3OBJS),$(XF86S3LIBS),$(XF86S3SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_S3 #endif #ifdef OS2Architecture LinkFile(XF86_S3.def,S3.def) InstallLinkKitNonExecFile(S3.def,$(LINKKITDIR)) #endif #endif /* XF86S3Server */ #if XF86S3VServer XCOMM XCOMM XFree86 S3 ViRGE Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86S3VSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86S3VOBJS = $(XF86COMSRC)/XF86_S3.o $(XF86ACCELSRC)/s3_virge/s3vConf.o \ $(S3VDRIVERSRC)/s3_virge/s3_virge.o XF86S3VLIBS = $(XF86ACCELSRC)/s3_virge/LibraryTargetName(s3v) $(XF86LIBS) \ CFBLibs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86S3VSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86S3VSUBDIRS) $(XF86S3VOBJS) $(XF86S3VLIBS) $(XF86S3VSYSLIBS)) #endif #if HasGnuMake $(XF86S3VOBJS) $(XF86S3VLIBS) $(XF86S3VSYSLIBS):: $(XF86S3VSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_S3V,$(XF86S3VSUBDIRS),$(XF86S3VOBJS),$(XF86S3VLIBS),$(XF86S3VSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_S3V #endif #ifdef OS2Architecture LinkFile(XF86_S3V.def,S3V.def) InstallLinkKitNonExecFile(S3V.def,$(LINKKITDIR)) #endif #endif /* XF86S3VServer */ #if XF86I8514Server XCOMM XCOMM XFree86 8514 Server XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/xfree86 XF868514SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) XF868514OBJS = $(XF86COMSRC)/XF86_8514.o XF868514LIBS = $(XF86ACCELSRC)/ibm8514/LibraryTargetName(8514) $(XF86LIBS) \ CFB8Libs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF868514SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF868514SUBDIRS) $(XF868514OBJS) $(XF868514LIBS) $(XF868514SYSLIBS)) #endif #if HasGnuMake $(XF868514OBJS) $(XF868514LIBS) $(XF868514SYSLIBS):: $(XF868514SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_8514,$(XF868514SUBDIRS),$(XF868514OBJS),$(XF868514LIBS),$(XF868514SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_8514 #endif #ifdef OS2Architecture LinkFile(XF86_8514.def,8514.def) InstallLinkKitNonExecFile(8514.def,$(LINKKITDIR)) #endif #endif /* XF86I8514Server */ #if XF86Mach8Server XCOMM XCOMM XFree86 Mach8 Server XCOMM MFBDIR = mfb CFB8DIR = cfb DDXDIR1 = hw/xfree86 XF86MACH8SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) XF86MACH8OBJS = $(XF86COMSRC)/XF86_Mach8.o XF86MACH8LIBS = $(XF86ACCELSRC)/mach8/LibraryTargetName(mach8) $(XF86LIBS) \ CFB8Libs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86MACH8SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86MACH8SUBDIRS) $(XF86MACH8OBJS) $(XF86MACH8LIBS) $(XF86MACH8SYSLIBS)) #endif #if HasGnuMake $(XF86MACH8OBJS) $(XF86MACH8LIBS) $(XF86MACH8SYSLIBS):: $(XF86MACH8SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_Mach8,$(XF86MACH8SUBDIRS),$(XF86MACH8OBJS),$(XF86MACH8LIBS),$(XF86MACH8SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_Mach8 #endif #ifdef OS2Architecture LinkFile(XF86_Mach8.def,Mach8.def) InstallLinkKitNonExecFile(Mach8.def,$(LINKKITDIR)) #endif #endif /* XF86Mach8Server */ #if XF86Mach32Server XCOMM XCOMM XFree86 Mach32 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 DDXDIR1 = hw/xfree86 XF86MACH32SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(DDXDIR1) \ $(DEPDIRS) XF86MACH32OBJS = $(XF86COMSRC)/XF86_Mach32.o XF86MACH32LIBS = $(XF86ACCELSRC)/mach32/LibraryTargetName(mach32) $(XF86LIBS) \ CFB16Libs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86MACH32SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86MACH32SUBDIRS) $(XF86MACH32OBJS) $(XF86MACH32LIBS) $(XF86MACH32SYSLIBS)) #endif #if HasGnuMake $(XF86MACH32OBJS) $(XF86MACH32LIBS) $(XF86MACH32SYSLIBS):: $(XF86MACH32SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_Mach32,$(XF86MACH32SUBDIRS),$(XF86MACH32OBJS),$(XF86MACH32LIBS),$(XF86MACH32SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_Mach32 #endif #ifdef OS2Architecture LinkFile(XF86_Mach32.def,Mach32.def) InstallLinkKitNonExecFile(Mach32.def,$(LINKKITDIR)) #endif #endif /* XF86Mach32Server */ #if XF86Mach64Server XCOMM XCOMM XFree86 Mach64 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86MACH64SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86MACH64OBJS = $(XF86COMSRC)/XF86_Mach64.o XF86MACH64LIBS = $(XF86ACCELSRC)/mach64/LibraryTargetName(mach64) \ $(XF86LIBS) CFBLibs XF86MACH64SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86MACH64SUBDIRS) $(XF86MACH64OBJS) $(XF86MACH64LIBS) $(XF86MACH64SYSLIBS)) #endif #if HasGnuMake $(XF86MACH64OBJS) $(XF86MACH64LIBS) $(XF86MACH64SYSLIBS):: $(XF86MACH64SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_Mach64,$(XF86MACH64SUBDIRS),$(XF86MACH64OBJS),$(XF86MACH64LIBS),$(XF86MACH64SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_Mach64 #endif #ifdef OS2Architecture LinkFile(XF86_Mach64.def,Mach64.def) InstallLinkKitNonExecFile(Mach64.def,$(LINKKITDIR)) #endif #endif /* XF86Mach64Server */ #if XF86P9000Server XCOMM XCOMM XFree86 P9000 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86P9000SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86P9000OBJS = $(XF86COMSRC)/XF86_P9000.o XF86P9000LIBS = $(XF86ACCELSRC)/p9000/LibraryTargetName(p9000) \ $(XF86LIBS) CFBLibs XF86P9000SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86P9000SUBDIRS) $(XF86P9000OBJS) $(XF86P9000LIBS) $(XF86P9000SYSLIBS)) #endif #if HasGnuMake $(XF86P9000OBJS) $(XF86P9000LIBS) $(XF86P9000SYSLIBS):: $(XF86P9000SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_P9000,$(XF86P9000SUBDIRS),$(XF86P9000OBJS),$(XF86P9000LIBS),$(XF86P9000SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_P9000 #endif #ifdef OS2Architecture LinkFile(XF86_P9000.def,P9000.def) InstallLinkKitNonExecFile(P9000.def,$(LINKKITDIR)) #endif #endif /* XF86P9000Server */ #if XF86AGXServer XCOMM XCOMM XFree86 AGX Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86AGXSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86AGXOBJS = $(XF86COMSRC)/XF86_AGX.o XF86AGXLIBS = $(XF86ACCELSRC)/agx/LibraryTargetName(agx) $(XF86LIBS) CFBLibs XF86AGXSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86AGXSUBDIRS) $(XF86AGXOBJS) $(XF86AGXLIBS) $(XF86AGXSYSLIBS)) #endif #if HasGnuMake $(XF86AGXOBJS) $(XF86AGXLIBS) $(XF86AGXSYSLIBS):: $(XF86AGXSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_AGX,$(XF86AGXSUBDIRS),$(XF86AGXOBJS),$(XF86AGXLIBS),$(XF86AGXSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_AGX #endif #ifdef OS2Architecture LinkFile(XF86_AGX.def,AGX.def) InstallLinkKitNonExecFile(AGX.def,$(LINKKITDIR)) #endif #endif /* XF86AGXServer */ #if XF98GANBWAPServer XCOMM XCOMM XFree98 GA-98NB/WAP Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98GANBWAPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98GANBWAPOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98GANBWAPLIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(driverganbwap) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(ganbwap) $(XF98LIBS) \ CFBLibs XF98GANBWAPSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98GANBWAPSUBDIRS) $(XF98GANBWAPOBJS) $(XF98GANBWAPLIBS) $(XF98GANBWAPSYSLIBS)) #endif #if HasGnuMake $(XF98GANBWAPOBJS) $(XF98GANBWAPLIBS) $(XF98GANBWAPSYSLIBS):: $(XF98GANBWAPSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_GANBWAP,$(XF98GANBWAPSUBDIRS),$(XF98GANBWAPOBJS),$(XF98GANBWAPLIBS),$(XF98GANBWAPSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_GANBWAP #endif #endif /* XF98GANBWAPServer */ #if XF98NEC480Server XCOMM XCOMM XFree98 NEC480 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98NEC480SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98NEC480OBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/nec480Conf.o\ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98NEC480LIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(drivernec480) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(nec480) $(XF98LIBS) \ CFBLibs XF98NEC480SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98NEC480SUBDIRS) $(XF98NEC480OBJS) $(XF98NEC480LIBS) $(XF98NEC480SYSLIBS)) #endif #if HasGnuMake $(XF98NEC480OBJS) $(XF98NEC480LIBS) $(XF98NEC480SYSLIBS):: $(XF98NEC480SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_NEC480,$(XF98NEC480SUBDIRS),$(XF98NEC480OBJS),$(XF98NEC480LIBS),$(XF98NEC480SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_NEC480 #endif #endif /* XF98NEC480Server */ #if XF98NKVNECServer XCOMM XCOMM XFree98 NEC-CIRRUS/EPSON NKV/NKV2 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98NKVNECSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98NKVNECOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98NKVNECLIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(drivernkvnec) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(nkvnec) $(XF98LIBS) \ CFBLibs XF98NKVNECSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98NKVNECSUBDIRS) $(XF98NKVNECOBJS) $(XF98NKVNECLIBS) $(XF98NKVNECSYSLIBS)) #endif #if HasGnuMake $(XF98NKVNECOBJS) $(XF98NKVNECLIBS) $(XF98NKVNECSYSLIBS):: $(XF98NKVNECSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_NKVNEC,$(XF98NKVNECSUBDIRS),$(XF98NKVNECOBJS),$(XF98NKVNECLIBS),$(XF98NKVNECSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_NKVNEC #endif #endif /* XF98NKVNECServer */ #if XF98WABSServer XCOMM XCOMM XFree98 WAB-S Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98WABSSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98WABSOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98WABSLIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(driverwabs) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(wabs) $(XF98LIBS) CFBLibs XF98WABSSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98WABSSUBDIRS) $(XF98WABSOBJS) $(XF98WABSLIBS) $(XF98WABSSYSLIBS)) #endif #if HasGnuMake $(XF98WABSOBJS) $(XF98WABSLIBS) $(XF98WABSSYSLIBS):: $(XF98WABSSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_WABS,$(XF98WABSSUBDIRS),$(XF98WABSOBJS),$(XF98WABSLIBS),$(XF98WABSSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_WABS #endif #endif /* XF98WABSServer */ #if XF98WABEPServer XCOMM XCOMM XFree98 WAB-EP Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98WABEPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98WABEPOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98WABEPLIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(driverwabep) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(wabep) $(XF98LIBS) CFBLibs XF98WABEPSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98WABEPSUBDIRS) $(XF98WABEPOBJS) $(XF98WABEPLIBS) $(XF98WABEPSYSLIBS)) #endif #if HasGnuMake $(XF98WABEPOBJS) $(XF98WABEPLIBS) $(XF98WABEPSYSLIBS):: $(XF98WABEPSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_WABEP,$(XF98WABEPSUBDIRS),$(XF98WABEPOBJS),$(XF98WABEPLIBS),$(XF98WABEPSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_WABEP #endif #endif /* XF98WABEPServer */ #if XF98WSNAServer XCOMM XCOMM XFree98 WSN-A2F Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98WSNASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98WSNAOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98WSNALIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(driverwsna) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(wsna) $(XF98LIBS) CFBLibs XF98WSNASYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98WSNASUBDIRS) $(XF98WSNAOBJS) $(XF98WSNALIBS) $(XF98WSNASYSLIBS)) #endif #if HasGnuMake $(XF98WSNAOBJS) $(XF98WSNALIBS) $(XF98WSNASYSLIBS):: $(XF98WSNASUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_WSNA,$(XF98WSNASUBDIRS),$(XF98WSNAOBJS),$(XF98WSNALIBS),$(XF98WSNASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_WSNA #endif #endif /* XF98WSNAServer */ #if XF98TGUIServer XCOMM XCOMM XFree98 Trident Cyber9320/9680 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98TGUISUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98TGUIOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/tguiConf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98TGUILIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(drivertrident) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(trident) $(XF98LIBS) CFBLibs XF98TGUISYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98TGUISUBDIRS) $(XF98TGUIOBJS) $(XF98TGUILIBS) $(XF98TGUISYSLIBS)) #endif #if HasGnuMake $(XF98TGUIOBJS) $(XF98TGUILIBS) $(XF98TGUISYSLIBS):: $(XF98TGUISUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_TGUI,$(XF98TGUISUBDIRS),$(XF98TGUIOBJS),$(XF98TGUILIBS),$(XF98TGUISYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_TGUI #endif #endif /* XF98TGUIServer */ #if XF98MGAServer XCOMM XCOMM XFree98 Matrox Millennium/Mystique Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98MGASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98MGAOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/mgaConf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98MGALIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(drivermga) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(mga) $(XF98LIBS) CFBLibs XF98MGASYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98MGASUBDIRS) $(XF98MGAOBJS) $(XF98MGALIBS) $(XF98MGASYSLIBS)) #endif #if HasGnuMake $(XF98MGAOBJS) $(XF98MGALIBS) $(XF98MGASYSLIBS):: $(XF98MGASUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_MGA,$(XF98MGASUBDIRS),$(XF98MGAOBJS),$(XF98MGALIBS),$(XF98MGASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_MGA #endif #endif /* XF98MGAServer */ #if XF98SVGAServer XCOMM XCOMM XFree98 Cirrus Logic CLGD7555 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98SVGASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98SVGAOBJS = $(XF98COMSRC)/XF86_SVGA.o $(XF98SRC)/vga256/vga256Conf.o \ $(XF98SRC)/xaa/xaa16/xaa16.o $(XF98SRC)/xaa/xaa24/xaa24.o $(XF98SRC)/xaa/xaa32/xaa32.o $(XF98SRC)/xaa/xaavga256/xaavga256.o XF98SVGALIBS = $(XF98VGADRIVERSRC)/LibraryTargetName(driversvga) \ $(XF98SRC)/xaa/LibraryTargetName(xaa) \ $(XF98SRC)/vga256/LibraryTargetName(vga256) $(XF98LIBS) CFBLibs XF98SVGASYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98SVGASUBDIRS) $(XF98SVGAOBJS) $(XF98SVGALIBS) $(XF98SVGASYSLIBS)) #endif #if HasGnuMake $(XF98SVGAOBJS) $(XF98SVGALIBS) $(XF98SVGASYSLIBS):: $(XF98SVGASUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_SVGA,$(XF98SVGASUBDIRS),$(XF98SVGAOBJS),$(XF98SVGALIBS),$(XF98SVGASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_SVGA #endif #endif /* XF98SVGAServer */ #if XF98EGCServer XCOMM XCOMM XFree98 EGC Server XCOMM DDXDIR2 = hw/xfree98 XF98EGCSUBDIRS = $(STDDIRS) $(DDXDIR2) $(DEPDIRS) XF98EGCOBJS = $(XF98COMSRC)/XF86_VGA16.o $(XF98SRC)/vga16/vga16Conf.o \ $(XF98SRC)/vga16/misc/vga16misc.o XF98EGCLIBS = $(XF98VGA16DRIVERSRC)/LibraryTargetName(driver16) \ $(XF98SRC)/vga16/LibraryTargetName(vga16) $(XF98MLIBS) \ NoMFBBareLibs $(OTHEREXTS) XF98EGCSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98EGCSUBDIRS) $(XF98EGCOBJS) $(XF98EGCLIBS) $(XF98EGCSYSLIBS)) #endif #if HasGnuMake $(XF98EGCOBJS) $(XF98EGCLIBS) $(XF98EGCSYSLIBS):: $(XF98EGCSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_EGC,$(XF98EGCSUBDIRS),$(XF98EGCOBJS),$(XF98EGCLIBS),$(XF98EGCSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_EGC #endif #endif /* XF98EGCServer */ #if XF98NECS3Server XCOMM XCOMM XFree98 NEC S3 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98NECS3SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) \ $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98NECS3OBJS = $(XF98COMSRC)/XF86_S3.o $(XF98ACCELSRC)/s3nec/s3Conf.o \ $(XF98NECS3DRIVERSRC)/newmmio/newmmio.o \ $(XF98NECS3DRIVERSRC)/mmio_928/mmio_928.o \ $(XF98NECS3DRIVERSRC)/s3_generic/s3_generic.o XF98NECS3LIBS = $(XF98ACCELSRC)/s3nec/LibraryTargetName(s3nec) \ $(XF98ACCELSRC)/s3nec/s3newmmio/LibraryTargetName(s3necnewmmio) \ $(XF98ACCELSRC)/s3nec/s3mmio/LibraryTargetName(s3necmmio) \ $(XF98LIBSNEC) CFBLibs \ $(XF98ACCELSRC)/cache/LibraryTargetName(xf86cache) XF98NECS3SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98NECS3SUBDIRS) $(XF98NECS3OBJS) $(XF98NECS3LIBS) $(XF98NECS3SYSLIBS)) #endif #if HasGnuMake $(XF98NECS3OBJS) $(XF98NECS3LIBS) $(XF98NECS3SYSLIBS):: $(XF98NECS3SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_NECS3,$(XF98NECS3SUBDIRS),$(XF98NECS3OBJS),$(XF98NECS3LIBS),$(XF98NECS3SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_NECS3 #endif #endif /* XF98NECS3Server */ #if XF98PWSKBServer XCOMM XCOMM XFree98 S3 PW/PCSKB Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98PWSKBSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) \ $(CFB24DIR) $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98PWSKBOBJS = $(XF98COMSRC)/XF86_S3.o $(XF98ACCELSRC)/s3pwskb/s3Conf.o \ $(XF98PWSKBDRIVERSRC)/newmmio/newmmio.o \ $(XF98PWSKBDRIVERSRC)/mmio_928/mmio_928.o \ $(XF98PWSKBDRIVERSRC)/s3_generic/s3_generic.o XF98PWSKBLIBS = $(XF98ACCELSRC)/s3pwskb/LibraryTargetName(s3pwskb) \ $(XF98ACCELSRC)/s3pwskb/s3newmmio/LibraryTargetName(s3pwskbnewmmio) \ $(XF98ACCELSRC)/s3pwskb/s3mmio/LibraryTargetName(s3pwskbmmio) \ $(XF98LIBSPWSKB) CFBLibs \ $(XF98ACCELSRC)/cache/LibraryTargetName(xf86cache) XF98PWSKBSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98PWSKBSUBDIRS) $(XF98PWSKBOBJS) $(XF98PWSKBLIBS) $(XF98PWSKBSYSLIBS)) #endif #if HasGnuMake $(XF98PWSKBOBJS) $(XF98PWSKBLIBS) $(XF98PWSKBSYSLIBS):: $(XF98PWSKBSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_PWSKB,$(XF98PWSKBSUBDIRS),$(XF98PWSKBOBJS),$(XF98PWSKBLIBS),$(XF98PWSKBSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_PWSKB #endif #endif /* XF98PWSKBServer */ #if XF98PWLBServer XCOMM XCOMM XFree98 S3 PW/LB Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98PWLBSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) \ $(DDXDIR2) $(DEPDIRS) XF98PWLBOBJS = $(XF98COMSRC)/XF86_S3.o $(XF98ACCELSRC)/s3pwlb/s3Conf.o \ $(XF98PWLBDRIVERSRC)/newmmio/newmmio.o \ $(XF98PWLBDRIVERSRC)/mmio_928/mmio_928.o \ $(XF98PWLBDRIVERSRC)/s3_generic/s3_generic.o XF98PWLBLIBS = $(XF98ACCELSRC)/s3pwlb/LibraryTargetName(s3pwlb) \ $(XF98ACCELSRC)/s3pwlb/s3newmmio/LibraryTargetName(s3pwlbnewmmio) \ $(XF98ACCELSRC)/s3pwlb/s3mmio/LibraryTargetName(s3pwlbmmio) \ $(XF98LIBSPWLB) CFBLibs \ $(XF98ACCELSRC)/cache/LibraryTargetName(xf86cache) XF98PWLBSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98PWLBSUBDIRS) $(XF98PWLBOBJS) $(XF98PWLBLIBS) $(XF98PWLBSYSLIBS)) #endif #if HasGnuMake $(XF98PWLBOBJS) $(XF98PWLBLIBS) $(XF98PWLBSYSLIBS):: $(XF98PWLBSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_PWLB,$(XF98PWLBSUBDIRS),$(XF98PWLBOBJS),$(XF98PWLBLIBS),$(XF98PWLBSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_PWLB #endif #endif /* XF98PWLBServer */ #if XF98GA968Server XCOMM XCOMM XFree98 S3 GA-968 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR2 = hw/xfree98 XF98GA968SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR2) $(DEPDIRS) XF98GA968OBJS = $(XF98COMSRC)/XF86_S3.o $(XF98ACCELSRC)/s3ga968/s3Conf.o \ $(XF98GA968DRIVERSRC)/newmmio/newmmio.o \ $(XF98GA968DRIVERSRC)/mmio_928/mmio_928.o \ $(XF98GA968DRIVERSRC)/s3_generic/s3_generic.o XF98GA968LIBS = $(XF98ACCELSRC)/s3ga968/LibraryTargetName(s3ga968) \ $(XF98ACCELSRC)/s3ga968/s3newmmio/LibraryTargetName(s3ga968newmmio) \ $(XF98ACCELSRC)/s3ga968/s3mmio/LibraryTargetName(s3ga968mmio) \ $(XF98LIBSGA968) CFBLibs \ $(XF98ACCELSRC)/cache/LibraryTargetName(xf86cache) XF98GA968SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF98GA968SUBDIRS) $(XF98GA968OBJS) $(XF98GA968LIBS) $(XF98GA968SYSLIBS)) #endif #if HasGnuMake $(XF98GA968OBJS) $(XF98GA968LIBS) $(XF98GA968SYSLIBS):: $(XF98GA968SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF98_GA968,$(XF98GA968SUBDIRS),$(XF98GA968OBJS),$(XF98GA968LIBS),$(XF98GA968SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF98_GA968 #endif #endif /* XF98GA968Server */ #if XF86I128Server XCOMM XCOMM XFree86 I128 Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86I128SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86I128OBJS = $(XF86COMSRC)/XF86_I128.o \ $(XF86SRC)/xaa/xaa8/xaa8.o $(XF86SRC)/xaa/xaa16/xaa16.o \ $(XF86SRC)/xaa/xaa24/xaa24.o $(XF86SRC)/xaa/xaa32/xaa32.o XF86I128LIBS = $(XF86ACCELSRC)/i128/LibraryTargetName(i128) \ $(XF86SRC)/xaa/LibraryTargetName(xaa) $(XF86LIBS) \ CFBLibs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86I128SYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86I128SUBDIRS) $(XF86I128OBJS) $(XF86I128LIBS) $(XF86I128SYSLIBS)) #endif #if HasGnuMake $(XF86I128OBJS) $(XF86I128LIBS) $(XF86I128SYSLIBS):: $(XF86I128SUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_I128,$(XF86I128SUBDIRS),$(XF86I128OBJS),$(XF86I128LIBS),$(XF86I128SYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_I128 #endif #ifdef OS2Architecture LinkFile(XF86_I128.def,I128.def) InstallLinkKitNonExecFile(I128.def,$(LINKKITDIR)) #endif #endif /* XF86I128Server */ #if XF86TGAServer XCOMM XCOMM XFree86 TGA Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/xfree86 XF86TGASUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) \ $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XF86TGAOBJS = $(XF86COMSRC)/XF86_TGA.o \ $(XF86SRC)/xaa/xaa8/xaa8.o $(XF86SRC)/xaa/xaa16/xaa16.o \ $(XF86SRC)/xaa/xaa24/xaa24.o $(XF86SRC)/xaa/xaa32/xaa32.o XF86TGALIBS = $(XF86ACCELSRC)/tga/LibraryTargetName(tga) \ $(XF86SRC)/xaa/LibraryTargetName(xaa) $(XF86LIBS) \ CFBLibs $(XF86ACCELSRC)/cache/LibraryTargetName(xf86cache) XF86TGASYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF86TGASUBDIRS) $(XF86TGAOBJS) $(XF86TGALIBS) $(XF86TGASYSLIBS)) #endif #if HasGnuMake $(XF86TGAOBJS) $(XF86TGALIBS) $(XF86TGASYSLIBS):: $(XF86TGASUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF86_TGA,$(XF86TGASUBDIRS),$(XF86TGAOBJS),$(XF86TGALIBS),$(XF86TGASYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF86_TGA #endif #ifdef OS2Architecture LinkFile(XF86_TGA.def,TGA.def) InstallLinkKitNonExecFile(TGA.def,$(LINKKITDIR)) #endif #endif #if XF68FBDevServer XCOMM XCOMM XFree68 Linux/m68k Frame Buffer Device Server XCOMM MFBDIR = mfb DDXDIR3 = hw/xfree68 #if XF68FBDevIPLAN2p2 IPLAN2P2DIR = iplan2p2 FBDEVFBLIBS:= $(FBDEVFBLIBS) iplan2p2/LibraryTargetName(ipl2p2) #endif #if XF68FBDevIPLAN2p4 IPLAN2P4DIR = iplan2p4 FBDEVFBLIBS:= $(FBDEVFBLIBS) iplan2p4/LibraryTargetName(ipl2p4) #endif #if XF68FBDevIPLAN2p8 IPLAN2P8DIR = iplan2p8 FBDEVFBLIBS:= $(FBDEVFBLIBS) iplan2p8/LibraryTargetName(ipl2p8) #endif #if XF68FBDevILBM ILBMDIR = ilbm FBDEVFBLIBS:= $(FBDEVFBLIBS) ilbm/LibraryTargetName(ilbm) #endif #if XF68FBDevAFB AFBDIR = afb FBDEVFBLIBS:= $(FBDEVFBLIBS) afb/LibraryTargetName(afb) #endif #if XF68FBDevCFB8 CFB8DIR = cfb FBDEVFBLIBS:= $(FBDEVFBLIBS) $(CFB8) #endif #if XF68FBDevCFB16 CFB16DIR = cfb16 FBDEVFBLIBS:= $(FBDEVFBLIBS) $(CFB16) #endif #if XF68FBDevCFB32 CFB32DIR = cfb32 FBDEVFBLIBS:= $(FBDEVFBLIBS) $(CFB32) #endif XF68FBDevSUBDIRS = $(STDDIRS) $(MFBDIR) $(IPLAN2P2DIR) $(IPLAN2P4DIR) \ $(IPLAN2P8DIR) $(ILBMDIR) $(AFBDIR) $(CFB8DIR) \ $(CFB16DIR) $(CFB32DIR) $(DDXDIR3) $(DEPDIRS) XF68FBDevOBJS = $(XF68COMSRC)/XF68_FBDev.o XF68FBDevLIBS = $(XF68SRC)/fbdev/LibraryTargetName(fbdev) $(XF68LIBS) \ PreFbLibs $(FBDEVFBLIBS) PostFbLibs XF68FBDevSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XF68FBDevSUBDIRS) $(XF68FBDevOBJS) $(XF68FBDevLIBS) $(XF68FBDevSYSLIBS)) #endif #if HasGnuMake $(XF68FBDevOBJS) $(XF68FBDevLIBS) $(XF68FBDevSYSLIBS):: $(XF68FBDevSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif SetUIDServerTarget(XF68_FBDev,$(XF68FBDevSUBDIRS),$(XF68FBDevOBJS),$(XF68FBDevLIBS),$(XF68FBDevSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XF68_FBDev #endif #endif /* XF68FBDevServer */ #if XprtServer XCOMM XCOMM Print Server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB32DIR = cfb32 XPSUBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB32DIR) $(DEPDIRS) #if PrintOnlyServer XPOBJS = Xprint/ddxInit.o Xprint/miinitext.o XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs #else XPOBJS = Xprint/ddxInit.o XPLIBS = PreFbLibs PostFbLibs #endif #if (defined(SunArchitecture) || defined(SparcArchitecture)) && defined(SVR4Architecture) XPSYSLIBS = $(CBRT) $(SYSLIBS) -lw #else XPSYSLIBS = $(CBRT) $(SYSLIBS) #endif #if HasParallelMake MakeMutex($(XPSUBDIRS) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS)) #endif #if HasGnuMake $(XPOBJS) $(XPLIBS) $(XPSYSLIBS):: $(XPSUBDIRS) @if [ -f $@ ]; then touch $@; fi #endif ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS),$(XPLIBS),$(XPSYSLIBS)) #endif /* XprtServer */ #if XnestServer XCOMM XCOMM Server with Xlib-based ddx XCOMM #ifndef Win32Architecture XNESTDDXDIR = hw/xnest #else XNESTDDXDIR = hw #endif XNESTDIRS = $(STDDIRS) $(XNESTDDXDIR) $(DEPDIRS) #if !defined(LynxOSArchitecture) && !defined(Win32Architecture) XNESTOBJS = #else XNESTOBJS = dix/main.o #endif XNEST = hw/xnest/LibraryTargetName(xnest) XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XNEST) XNESTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) #if HasParallelMake MakeMutex($(XNESTDIRS) $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS)) #endif #if HasGnuMake $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS):: $(XNESTDIRS) @if [ -f $@ ]; then touch $@; fi #endif ServerTarget(Xnest,$(XNESTDIRS),$(XNESTOBJS),$(XNESTLIBS),$(XNESTSYSLIBS)) #ifdef OS2Architecture InstallLinkKitNonExecFile(Xnest.def,$(LINKKITDIR)) #endif #endif /* XnestServer */ #if XnonServer XCOMM XCOMM non server, just compile sources for build test XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB32DIR = cfb32 #if HasParallelMake MakeMutex($(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS)) #endif Xnon: $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DEPDIRS) #endif /* XnonServer */ #if XVirtualFramebufferServer XCOMM XCOMM server with Virtual (malloced) framebuffer XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 #ifndef Win32Architecture XVFBDDXDIR = hw/vfb #else XVFBDDXDIR = hw #endif XVFBDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(XVFBDDXDIR) $(DEPDIRS) #if !defined(LynxOSArchitecture) && !defined(Win32Architecture) XVFBOBJS = hw/vfb/stubs.o #else XVFBOBJS = hw/vfb/stubs.o dix/main.o #endif XVFB = hw/vfb/LibraryTargetName(vfb) XVFBLIBS = PreFbLibs $(XVFB) $(CFB) PostFbLibs XVFBSYSLIBS = $(SYSLIBS) #if HasParallelMake MakeMutex($(XVFBDIRS) $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS)) #endif #if HasGnuMake $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS):: $(XVFBDIRS) @if [ -f $@ ]; then touch $@; fi #endif ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS),$(XVFBLIBS),$(XVFBSYSLIBS)) #endif /* XVirtualFramebufferServer */ #if XvncServer XCOMM XCOMM VNC X server XCOMM MFBDIR = mfb CFB8DIR = cfb CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 DDXDIR1 = hw/vnc XVNCDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) XVNCOBJS = #include XVNC = hw/vnc/libvnc.a $(VNCLIBS) XVNCLIBS = PreFbLibs $(XVNC) $(CFB) PostFbLibs XVNCSYSLIBS = $(SYSLIBS) $(VNCSYSLIBS) ServerTarget(Xvnc,$(XVNCDIRS),$(XVNCOBJS),$(XVNCLIBS),$(XVNCSYSLIBS)) #endif /* XvncServer */ #if UseXserverWrapper SetUIDProgramTarget(Xwrapper,os/wrapper.o,NullParameter,NullParameter,NullParameter) InstallProgramWithFlags(Xwrapper,$(BINDIR),$(INSTUIDFLAGS)) #endif CFBDIRS = $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) DDXDIRS = $(DDXDIR1) $(DDXDIR2) $(DDXDIR3) $(XVFBDDXDIR) $(XNESTDDXDIR) SUBDIRS = $(STDDIRS) $(MFBDIR) $(CFBDIRS) $(IPLANDIRS) $(ILBMDIR) $(AFBDIR) \ $(DDXDIRS) #if defined(ServerToInstall) && !defined(OS2Architecture) install:: -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) ServerToInstall X) #endif #define IHaveSubdirs DependSubdirs($(SUBDIRS)) MakeLintLibSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) ForceSubdirs($(DEPDIRS) $(SUBDIRS)) InstallManPage(Xserver,$(MANDIR)) vnc_unixsrc/Xvnc/programs/Xserver/Xvnc.man0100664000076400007640000001352610470262522020320 0ustar constconst'\" t .\" ** The above line should force tbl to be a preprocessor ** .\" Man page for Xvnc .\" .\" Copyright (C) 1998 Marcus.Brinkmann@ruhr-uni-bochum.de .\" Copyright (C) 2000, 2001 Red Hat, Inc. .\" Copyright (C) 2001, 2002 Constantin Kaplinsky .\" .\" You may distribute under the terms of the GNU General Public .\" License as specified in the file LICENCE.TXT that comes with the .\" TightVNC distribution. .\" .TH Xvnc 1 "August 2006" "" "TightVNC" .SH NAME Xvnc \- an X server providing VNC connectivity .SH SYNOPSIS .TP \fBXvnc\fR [:\fIdisplay\fR] [\-geometry \fIwidth\fRx\fIheight\fR] [\-depth \fIdepth\fR] [\-pixelformat rgb\fINNN\fR|bgr\fINNN\fR] [\-udpinputport \fIport\fR] [\-rfbport \fIport\fR] [\-rfbwait \fItime\fR] [\-nocursor] [\-rfbauth \fIpasswd-file\fR] [\-httpd \fIdir\fR] [\-httpport \fIport\fR] [\-deferupdate \fItime\fR] [\-economictranslate] [\-lazytight] [\-desktop \fIname\fR] [\-alwaysshared] [\-nevershared] [\-dontdisconnect] [\-viewonly] [\-localhost] [\-interface ipaddr] [\-inetd] [\-compatiblekbd] [\fIX-options\fR...] .SH DESCRIPTION \fBXvnc\fR is a VNC (Virtual Network Computing) server. It acts like an X server with a virtual display. The display can be seen by a VNC viewer application, which may be running on a different machine: see \fBvncviewer\fR(1). Xvnc is built inside the source code tree of XFree86, and shares many options with it. Normally, you don't need to start Xvnc manually; use the \fBvncserver\fR(1) wrapper script instead. This script sets reasonable defaults for Xvnc session, checks many error conditions etc. Please read the \fBBUGS\fR section if you plan to use VNC on an untrusted network. .SH OPTIONS Xvnc supports many standard X server options and a number of VNC-specific options. To see what standard X server options are supported, please look at the \fBXvnc\fR \fI\-help\fR output and read the \fBXserver\fR(1) manual page for details on those options. The VNC-specific options are as follows: .TP \fB\-geometry\fR \fIwidth\fR\fBx\fR\fIheight\fR Set desktop width and height. .TP \fB\-depth\fR \fIdepth\fR Set the colour depth of the visual to provide, in bits per pixel. Must be a value between 8 and 32. .TP \fB\-pixelformat\fR \fBrgb\fR\fINNN\fR|\fBbgr\fR\fINNN\fR Set colour format for pixels representation. The viewer can do the conversion to any other pixel format, but it is faster if the depth and pixel format of the server is the same as the equivalent values on the viewer display. .TP \fB\-udpinputport\fR \fIport\fR UDP port for keyboard/pointer data. .TP \fB\-rfbport\fR \fIport\fR TCP port for RFB protocol. The RFB protocol is used for commnunication between VNC server and clients. .TP \fB\-rfbwait\fR \fItime\fR Maximum time, in milliseconds, to wait for an RFB client (VNC viewer). .TP \fB\-nocursor\fR Don't put up a pointer cursor on the desktop. .TP \fB\-rfbauth\fR \fIpasswd-file\fR Use authentication on RFB protocol from the specified file. The \fIpasswd-file\fR can be created using the \fBvncpasswd\fR(1) utility. .TP \fB\-httpd\fR \fIdir\fR Serve files via HTTP protocol from the specified directory. Normally, Java viewer classes are stored in such directory. .TP \fB\-httpport\fR \fIport\fR TCP port on which Xvnc should listen for incoming HTTP connections (to allow access to the desktop from any Java-capable browser). .TP \fB\-deferupdate\fR \fItime\fR Time in milliseconds, to defer screen updates (default 40). Deferring updates helps to coalesce many small desktop changes into a few larger updates thus saving network bandwidth. .TP \fB\-economictranslate\fR Use less memory-hungry pixel format translation. .TP \fB\-lazytight\fR Disable the "gradient" filter in Tight encoding (TightVNC-specific). The "gradient" filter often helps to improve data compression ratios, but may slow down the server performance. Please note that this filter is never used when a client enables JPEG compression in the Tight encoding. .TP \fB\-desktop\fR \fIname\fR Set VNC desktop name ("x11" by default). .TP \fB\-alwaysshared\fR Always treat new clients as shared, never disconnect existing client on a new client connection. .TP \fB\-nevershared\fR Never treat new clients as shared, do not allow several simultaneous client connections. .TP \fB\-dontdisconnect\fR Don't disconnect existing clients when a new non-shared connection comes in, refuse new connection instead. .TP \fB\-viewonly\fR Don't accept keboard and pointer events from clients. All clients will be able to see the desktop but won't be able to control it. .TP \fB\-localhost\fR Only allow loopback connections from localhost. This option is useful in conjunction with SSH tunneling. .TP \fB\-interface\fR \fIipaddr\fR Listen for client connections only on the network interface with given \fIipaddr\fR. .TP \fB\-inetd\fR Xvnc is launched by inetd. This option causes \fBXvnc\fR to redirect network input/output to stdin/stdout. .TP \fB\-compatiblekbd\fR Set META and ALT keys to the same X modifier flag, as in the original version of Xvnc by AT&T labs (TightVNC-specific). .SH BUGS There are many security problems in current Xvnc implementation. It's recommended to restrict network access to Xvnc servers from untrusted network adresses. Probably, the best way to secure Xvnc server is to allow only loopback connections from the server machine (the \fI\-localhost\fR option) and to use SSH tunneling for remote access to the Xvnc server. For details on SSH tunneling, see . .SH SEE ALSO \fBvncserver\fR(1), \fBvncviewer\fR(1), \fBvncpasswd\fR(1), \fBvncconnect\fR(1), \fBsshd\fR(1) .SH AUTHORS Original VNC was developed in AT&T Laboratories Cambridge. TightVNC additions were implemented by Constantin Kaplinsky. Many other people participated in development, testing and support. \fBMan page authors:\fR .br Marcus Brinkmann , .br Tim Waugh , .br Constantin Kaplinsky vnc_unixsrc/Xvnc/programs/Xserver/cfb32/0040775000076400007640000000000010616336472017610 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/cfb32/Imakefile0100664000076400007640000000021707120677563021423 0ustar constconstXCOMM $XConsortium: Imakefile,v 1.1 91/12/28 13:32:46 rws Exp $ #define PixelSize 32 #define LinkDirectory ../cfb #include "../cfb/Imakefile" vnc_unixsrc/Xvnc/programs/Xserver/cfb24/0040775000076400007640000000000010616336472017611 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/cfb24/Imakefile0100664000076400007640000000025107120677563021422 0ustar constconstXCOMM $XFree86: xc/programs/Xserver/cfb24/Imakefile,v 3.0 1996/06/29 09:06:07 dawes Exp $ #define PixelSize 24 #define LinkDirectory ../cfb #include "../cfb/Imakefile" vnc_unixsrc/Xvnc/programs/Xserver/cfb24/cfbrrop24.h0100664000076400007640000000447707120677563021603 0ustar constconst/* $XFree86: xc/programs/Xserver/cfb24/cfbrrop24.h,v 3.0 1996/06/29 09:06:09 dawes Exp $ */ #define RROP_DECLARE register unsigned long rrop_and, rrop_xor; \ unsigned long piQxelAnd[3], piQxelXor[3], spiQxelAnd[8], spiQxelXor[8]; #define RROP_COPY_SETUP(ptn) \ spiQxelXor[0] = ptn & 0xFFFFFF; \ spiQxelXor[2] = ptn << 24; \ spiQxelXor[3] = (ptn & 0xFFFF00)>> 8; \ spiQxelXor[4] = ptn << 16; \ spiQxelXor[5] = (ptn & 0xFF0000)>> 16; \ spiQxelXor[6] = ptn << 8; \ spiQxelXor[1] = spiQxelXor[7] = 0; #define RROP_SOLID24_COPY(dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \ idx++; \ *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \ } #define RROP_SET_SETUP(xor, and) \ spiQxelXor[0] = xor & 0xFFFFFF; \ spiQxelXor[1] = xor << 24; \ spiQxelXor[2] = xor << 16; \ spiQxelXor[3] = xor << 8; \ spiQxelXor[4] = (xor >> 8) & 0xFFFF; \ spiQxelXor[5] = (xor >> 16) & 0xFF; \ spiQxelAnd[0] = (and & 0xFFFFFF) | 0xFF000000; \ spiQxelAnd[1] = (and << 24) | 0xFFFFFF; \ spiQxelAnd[2] = (and << 16) | 0xFFFF; \ spiQxelAnd[3] = (and << 8) | 0xFF; \ spiQxelAnd[4] = ((and >> 8) & 0xFFFF) | 0xFFFF0000; \ spiQxelAnd[5] = ((and >> 16) & 0xFF) | 0xFFFFFF00; \ piQxelAnd[0] = (and & 0xFFFFFF)|(and << 24); \ piQxelAnd[1] = (and << 16)|((and >> 8) & 0xFFFF); \ piQxelAnd[2] = (and << 8)|((and >> 16) & 0xFF); \ piQxelXor[0] = (xor & 0xFFFFFF)|(xor << 24); \ piQxelXor[1] = (xor << 16)|((xor >> 8) & 0xFFFF); \ piQxelXor[2] = (xor << 8)|((xor >> 16) & 0xFF); #define RROP_SOLID24_SET(dst,index) {\ switch((index) & 3){ \ case 0: \ *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \ break; \ case 3: \ *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \ break; \ case 1: \ *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \ break; \ case 2: \ *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \ *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \ break; \ } \ } vnc_unixsrc/Xvnc/programs/Xserver/cfb16/0040775000076400007640000000000010616336472017612 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/cfb16/Imakefile0100664000076400007640000000021707120677563021425 0ustar constconstXCOMM $XConsortium: Imakefile,v 1.1 91/12/28 13:32:27 rws Exp $ #define PixelSize 16 #define LinkDirectory ../cfb #include "../cfb/Imakefile" vnc_unixsrc/Xvnc/programs/Xserver/mfb/0040775000076400007640000000000010616336472017455 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbscrinit.c0100664000076400007640000001363607120677563021774 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbscrinit.c,v 5.17 94/04/17 20:28:34 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.0 1994/06/18 16:29:52 dawes Exp $ */ #include "X.h" #include "Xproto.h" /* for xColorItem */ #include "Xmd.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "resource.h" #include "colormap.h" #include "mfb.h" #include "mistruct.h" #include "dix.h" #include "mi.h" #include "mibstore.h" #include "migc.h" #include "servermd.h" #ifdef PIXMAP_PER_WINDOW int frameWindowPrivateIndex; #endif int mfbWindowPrivateIndex; int mfbGCPrivateIndex; static unsigned long mfbGeneration = 0; static VisualRec visual = { /* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ 0, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 }; static VisualID VID; static DepthRec depth = { /* depth numVid vids */ 1, 1, &VID }; miBSFuncRec mfbBSFuncRec = { mfbSaveAreas, mfbRestoreAreas, (void (*)()) 0, (PixmapPtr (*)()) 0, (PixmapPtr (*)()) 0, }; Bool mfbAllocatePrivates(pScreen, pWinIndex, pGCIndex) ScreenPtr pScreen; int *pWinIndex, *pGCIndex; { if (mfbGeneration != serverGeneration) { #ifdef PIXMAP_PER_WINDOW frameWindowPrivateIndex = AllocateWindowPrivateIndex(); #endif mfbWindowPrivateIndex = AllocateWindowPrivateIndex(); mfbGCPrivateIndex = miAllocateGCPrivateIndex(); miRegisterGCPrivateIndex(mfbGCPrivateIndex); visual.vid = FakeClientID(0); VID = visual.vid; mfbGeneration = serverGeneration; } if (pWinIndex) *pWinIndex = mfbWindowPrivateIndex; if (pGCIndex) *pGCIndex = mfbGCPrivateIndex; return (AllocateWindowPrivate(pScreen, mfbWindowPrivateIndex, sizeof(mfbPrivWin)) && AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC))); } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ Bool mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bitmap */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ { if (!mfbAllocatePrivates(pScreen, (int *)NULL, (int *)NULL)) return FALSE; pScreen->defColormap = (Colormap) FakeClientID(0); /* whitePixel, blackPixel */ pScreen->QueryBestSize = mfbQueryBestSize; /* SaveScreen */ pScreen->GetImage = mfbGetImage; pScreen->GetSpans = mfbGetSpans; pScreen->CreateWindow = mfbCreateWindow; pScreen->DestroyWindow = mfbDestroyWindow; pScreen->PositionWindow = mfbPositionWindow; pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes; pScreen->RealizeWindow = mfbMapWindow; pScreen->UnrealizeWindow = mfbUnmapWindow; pScreen->PaintWindowBackground = mfbPaintWindow; pScreen->PaintWindowBorder = mfbPaintWindow; pScreen->CopyWindow = mfbCopyWindow; pScreen->CreatePixmap = mfbCreatePixmap; pScreen->DestroyPixmap = mfbDestroyPixmap; pScreen->RealizeFont = mfbRealizeFont; pScreen->UnrealizeFont = mfbUnrealizeFont; pScreen->CreateGC = mfbCreateGC; pScreen->CreateColormap = mfbCreateColormap; pScreen->DestroyColormap = mfbDestroyColormap; pScreen->InstallColormap = mfbInstallColormap; pScreen->UninstallColormap = mfbUninstallColormap; pScreen->ListInstalledColormaps = mfbListInstalledColormaps; pScreen->StoreColors = (void (*)())NoopDDA; pScreen->ResolveColor = mfbResolveColor; pScreen->BitmapToRegion = mfbPixmapToRegion; return miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, 1, 1, &depth, VID, 1, &visual, &mfbBSFuncRec); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbplygblt.c0100664000076400007640000002707307120677563021776 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbplygblt.c,v 5.14 94/04/17 20:28:29 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.0 1995/06/14 12:43:48 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "regionstr.h" #include "maskbits.h" #include "miscstruct.h" /* we should eventually special-case fixed-width fonts, although its more important for ImageText, which is meant for terminal emulators. this works for fonts with glyphs <= 32 bits wide. the clipping calculations are done for worst-case fonts. we make no assumptions about the heights, widths, or bearings of the glyphs. if we knew that the glyphs are all the same height, we could clip the tops and bottoms per clipping box, rather than per character per clipping box. if we knew that the glyphs' left and right bearings were well-behaved, we could clip a single character at the start, output until the last unclipped character, and then clip the last one. this is all straightforward to determine based on max-bounds and min-bounds from the font. there is some inefficiency introduced in the per-character clipping to make what's going on clearer. (it is possible, for example, for a font to be defined in which the next-to-last character in a font would be clipped out, but the last one wouldn't. the code below deals with this.) PolyText looks at the fg color and the rasterop; mfbValidateGC swaps in the right routine after looking at the reduced ratserop in the private field of the GC. the register allocations are provisional; in particualr startmask and endmask might not be the right things. pglyph, xoff, pdst, and tmpSrc are fairly obvious, though. to avoid source proliferation, this file is compiled three times: MFBPOLYGLYPHBLT OPEQ mfbPolyGlyphBltWhite |= mfbPolyGlyphBltBlack &=~ mfbPolyGlyphBltInvert ^= */ void MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs (unused in R5) */ { ExtentInfoRec info; /* used by QueryGlyphExtents() */ BoxRec bbox; /* string's bounding box */ CharInfoPtr pci; int xorg, yorg; /* origin of drawable in bitmap */ int widthDst; /* width of dst in longwords */ /* these keep track of the character origin */ PixelType *pdstBase; /* points to longword with character origin */ int xchar; /* xorigin of char (mod 32) */ /* these are used for placing the glyph */ register int xoff; /* x offset of left edge of glyph (mod 32) */ register PixelType *pdst; /* pointer to current longword in dst */ int w; /* width of glyph in bits */ int h; /* height of glyph */ int widthGlyph; /* width of glyph, in bytes */ register unsigned char *pglyph; /* pointer to current row of glyph */ /* used for putting down glyph */ register PixelType tmpSrc; /* for getting bits from glyph */ register PixelType startmask; register PixelType endmask; register int nFirst;/* bits of glyph in current longword */ if (!(pGC->planemask & 1)) return; xorg = pDrawable->x; yorg = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); x += xorg; y += yorg; QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); bbox.x1 = x + info.overallLeft; bbox.x2 = x + info.overallRight; bbox.y1 = y - info.overallAscent; bbox.y2 = y + info.overallDescent; switch (RECT_IN_REGION(pGC->pScreen, ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox)) { case rgnOUT: break; case rgnIN: pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); xchar = x & PIM; while(nglyph--) { pci = *ppci; pglyph = FONTGLYPHBITS(pglyphBase, pci); w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; h = pci->metrics.ascent + pci->metrics.descent; widthGlyph = GLYPHWIDTHBYTESPADDED(pci); /* start at top scanline of glyph */ pdst = pdstBase; /* find correct word in scanline and x offset within it for left edge of glyph */ xoff = xchar + pci->metrics.leftSideBearing; if (xoff > PLST) { pdst++; xoff &= PIM; } else if (xoff < 0) { xoff += PPW; pdst--; } pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst); if ((xoff + w) <= PPW) { /* glyph all in one longword */ maskpartialbits(xoff, w, startmask); while (h--) { getleftbits(pglyph, w, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } else { /* glyph crosses longword boundary */ maskPPWbits(xoff, w, startmask, endmask); nFirst = PPW - xoff; while (h--) { getleftbits(pglyph, w, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } /* glyph crosses longwords boundary */ /* update character origin */ x += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; if (xchar > PLST) { xchar -= PPW; pdstBase++; } else if (xchar < 0) { xchar += PPW; pdstBase--; } ppci++; } /* while nglyph-- */ break; case rgnPART: { TEXTPOS *ppos; RegionPtr cclip; int nbox; BoxPtr pbox; int xpos; /* x position of char origin */ int i; BoxRec clip; int leftEdge, rightEdge; int topEdge, bottomEdge; int glyphRow; /* first row of glyph not wholly clipped out */ int glyphCol; /* leftmost visible column of glyph */ int getWidth; /* bits to get from glyph */ if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS)))) return; pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); xpos = x; xchar = xpos & PIM; for (i=0; imetrics.leftSideBearing; ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing; ppos[i].topEdge = y - pci->metrics.ascent; ppos[i].bottomEdge = y + pci->metrics.descent; ppos[i].pdstBase = pdstBase; ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci); xpos += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; if (xchar > PLST) { xchar &= PIM; pdstBase++; } else if (xchar < 0) { xchar += PPW; pdstBase--; } } cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; pbox = REGION_RECTS(cclip); nbox = REGION_NUM_RECTS(cclip); for (; --nbox >= 0; pbox++) { clip.x1 = max(bbox.x1, pbox->x1); clip.y1 = max(bbox.y1, pbox->y1); clip.x2 = min(bbox.x2, pbox->x2); clip.y2 = min(bbox.y2, pbox->y2); if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1)) continue; for(i=0; i clip.x2) rightEdge = clip.x2; else rightEdge = ppos[i].rightEdge; w = rightEdge - leftEdge; if (w <= 0) continue; /* clip the top and bottom edges */ if (ppos[i].topEdge < clip.y1) topEdge = clip.y1; else topEdge = ppos[i].topEdge; if (ppos[i].bottomEdge > clip.y2) bottomEdge = clip.y2; else bottomEdge = ppos[i].bottomEdge; h = bottomEdge - topEdge; if (h <= 0) continue; glyphRow = (topEdge - y) + pci->metrics.ascent; widthGlyph = ppos[i].widthGlyph; pglyph = FONTGLYPHBITS(pglyphBase, pci); pglyph += (glyphRow * widthGlyph); pdst = ppos[i].pdstBase; glyphCol = (leftEdge - ppos[i].xpos) - (pci->metrics.leftSideBearing); getWidth = w + glyphCol; xoff = xchar + (leftEdge - ppos[i].xpos); if (xoff > PLST) { xoff &= PIM; pdst++; } else if (xoff < 0) { xoff += PPW; pdst--; } pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst); if ((xoff + w) <= PPW) { maskpartialbits(xoff, w, startmask); while (h--) { getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } else { maskPPWbits(xoff, w, startmask, endmask); nFirst = PPW - xoff; while (h--) { getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } } /* for each glyph */ } /* while nbox-- */ DEALLOCATE_LOCAL(ppos); break; } default: break; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbpntwin.c0100664000076400007640000001046407120677563021634 0ustar constconst/* $XConsortium: mfbpntwin.c,v 5.12 94/04/17 20:28:30 dpw Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "windowstr.h" #include "regionstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "mi.h" void mfbPaintWindow(pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { register mfbPrivWin *pPrivWin; pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr); switch (what) { case PW_BACKGROUND: switch (pWin->backgroundState) { case None: return; case ParentRelative: do { pWin = pWin->parent; } while (pWin->backgroundState == ParentRelative); (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, what); return; case BackgroundPixmap: if (pPrivWin->fastBackground) { mfbTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXcopy, pPrivWin->pRotatedBackground); return; } break; case BackgroundPixel: if (pWin->background.pixel & 1) mfbSolidWhiteArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXset, NullPixmap); else mfbSolidBlackArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXclear, NullPixmap); return; } break; case PW_BORDER: if (pWin->borderIsPixel) { if (pWin->border.pixel & 1) mfbSolidWhiteArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXset, NullPixmap); else mfbSolidBlackArea((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXclear, NullPixmap); return; } else if (pPrivWin->fastBorder) { mfbTileAreaPPWCopy((DrawablePtr)pWin, REGION_NUM_RECTS(pRegion), REGION_RECTS(pRegion), GXcopy, pPrivWin->pRotatedBorder); return; } break; } miPaintWindow(pWin, pRegion, what); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/Imakefile0100664000076400007640000001055207120677563021273 0ustar constconstXCOMM $XConsortium: Imakefile /main/42 1996/11/04 16:09:42 kaleb $ XCOMM $XFree86: xc/programs/Xserver/mfb/Imakefile,v 3.2 1996/12/23 07:09:36 dawes Exp $ #include SRCS1 = mfbgc.c mfbwindow.c mfbfont.c \ mfbfillrct.c mfbpntwin.c maskbits.c mfbpixmap.c \ mfbimage.c mfbline.c mfbbres.c mfbhrzvert.c mfbbresd.c \ mfbpushpxl.c mfbzerarc.c mfbfillarc.c \ mfbfillsp.c mfbsetsp.c mfbscrinit.c mfbscrclse.c mfbclip.c \ mfbbitblt.c mfbgetsp.c mfbpolypnt.c \ mfbbltC.c mfbbltX.c mfbbltCI.c mfbbltO.c mfbbltG.c \ mfbcmap.c mfbtileC.c mfbtileG.c mfbmisc.c mfbbstore.c SRCS = $(SRCS1) mfbseg.c mfbpgbwht.c mfbpgbblak.c mfbpgbinv.c mfbigbwht.c \ mfbigbblak.c mfbpawhite.c mfbpablack.c mfbpainv.c mfbtewhite.c \ mfbteblack.c mfbbltC.c mfbbltX.c mfbbltCI.c mfbbltO.c mfbbltG.c \ mfbtileC.c mfbtileG.c mfbplywhite.c mfbplyblack.c mfbplyinv.c OBJS = mfbgc.o mfbwindow.o mfbfont.o \ mfbfillrct.o mfbpntwin.o maskbits.o mfbpixmap.o \ mfbimage.o mfbline.o mfbbres.o mfbhrzvert.o mfbbresd.o mfbseg.o \ mfbpushpxl.o mfbzerarc.o mfbfillarc.o \ mfbfillsp.o mfbsetsp.o mfbscrinit.o mfbscrclse.o mfbclip.o \ mfbbitblt.o mfbgetsp.o mfbpolypnt.o \ mfbbltC.o mfbbltX.o mfbbltCI.o mfbbltO.o mfbbltG.o \ mfbpgbwht.o mfbpgbblak.o mfbpgbinv.o \ mfbigbwht.o mfbigbblak.o mfbcmap.o \ mfbpawhite.o mfbpablack.o mfbpainv.o mfbtileC.o mfbtileG.o \ mfbtewhite.o mfbteblack.o mfbmisc.o mfbbstore.o \ mfbplywhite.o mfbplyblack.o mfbplyinv.o INCLUDES = -I. -I../mi -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) LINTDEFS = -DMFBPOLYGLYPHBLT=mfbPolyGlyphBltWhite \ -DMFBIMAGEGLYPHBLT=mfbImageGlyphBltWhite \ -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE -DOPEQ=MFB_OPEQ_WHITE LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln ../mi/llib-lmi.ln NormalLibraryObjectRule() NormalLibraryTarget(mfb,$(OBJS)) LintLibraryTarget(mfb,$(SRCS1)) NormalLintTarget($(LINTDEFS) $(SRCS1)) ObjectFromSpecialSource(mfbseg,mfbline,-DPOLYSEGMENT) ObjectFromSpecialSource(mfbpgbwht,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltWhite -DOPEQ=MFB_OPEQ_WHITE) ObjectFromSpecialSource(mfbpgbblak,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltBlack -DOPEQ=MFB_OPEQ_BLACK) ObjectFromSpecialSource(mfbpgbinv,mfbplygblt,-DMFBPOLYGLYPHBLT=mfbPolyGlyphBltInvert -DOPEQ=MFB_OPEQ_INVERT) ObjectFromSpecialSource(mfbigbwht,mfbimggblt,-DMFBIMAGEGLYPHBLT=mfbImageGlyphBltWhite -DOPEQ=MFB_OPEQ_WHITE) ObjectFromSpecialSource(mfbigbblak,mfbimggblt,-DMFBIMAGEGLYPHBLT=mfbImageGlyphBltBlack -DOPEQ=MFB_OPEQ_BLACK) ObjectFromSpecialSource(mfbpawhite,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidWhiteArea -DMFBSTIPPLEFILLAREA=mfbStippleWhiteArea -DOPEQ=MFB_OPEQ_WHITE -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE) ObjectFromSpecialSource(mfbpablack,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidBlackArea -DMFBSTIPPLEFILLAREA=mfbStippleBlackArea -DOPEQ=MFB_OPEQ_BLACK -DEQWHOLEWORD=MFB_EQWHOLEWORD_BLACK) ObjectFromSpecialSource(mfbpainv,mfbpntarea,-DMFBSOLIDFILLAREA=mfbSolidInvertArea -DMFBSTIPPLEFILLAREA=mfbStippleInvertArea -DOPEQ=MFB_OPEQ_INVERT -DEQWHOLEWORD=MFB_EQWHOLEWORD_INVERT) ObjectFromSpecialSource(mfbtewhite,mfbtegblt,-DMFBTEGLYPHBLT=mfbTEGlyphBltWhite -DOP=MFB_OP_WHITE -DCLIPTETEXT=mfbImageGlyphBltWhite) ObjectFromSpecialSource(mfbteblack,mfbtegblt,-DMFBTEGLYPHBLT=mfbTEGlyphBltBlack -DOP=MFB_OP_BLACK -DCLIPTETEXT=mfbImageGlyphBltBlack) ObjectFromSpecialSource(mfbplywhite,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyWhite -DOPEQ=MFB_OPEQ_WHITE -DEQWHOLEWORD=MFB_EQWHOLEWORD_WHITE) ObjectFromSpecialSource(mfbplyblack,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyBlack -DOPEQ=MFB_OPEQ_BLACK -DEQWHOLEWORD=MFB_EQWHOLEWORD_BLACK) ObjectFromSpecialSource(mfbplyinv,mfbply1rct,-DMFBFILLPOLY1RECT=mfbFillPolyInvert -DOPEQ=MFB_OPEQ_INVERT -DEQWHOLEWORD=MFB_EQWHOLEWORD_INVERT) ObjectFromSpecialSource(mfbbltC,mfbblt,-DMROP=Mcopy) ObjectFromSpecialSource(mfbbltX,mfbblt,-DMROP=Mxor) ObjectFromSpecialSource(mfbbltCI,mfbblt,-DMROP=McopyInverted) ObjectFromSpecialSource(mfbbltO,mfbblt,-DMROP=Mor) ObjectFromSpecialSource(mfbbltG,mfbblt,-DMROP=0) ObjectFromSpecialSource(mfbtileC,mfbtile,-DMROP=Mcopy) ObjectFromSpecialSource(mfbtileG,mfbtile,-DMROP=0) SpecialCObjectRule(mfbpixmap,$(ICONFIGFILES),$(_NOOP_)) InstallLinkKitLibrary(mfb,$(LINKKITDIR)/lib) InstallLinkKitNonExecFile(fastblt.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mfb.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mergerop.h,$(LINKKITDIR)/include) DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbbitblt.c0100664000076400007640000003304307120677563021573 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbbitblt.c,v 5.25 94/04/17 20:28:16 dpw Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "regionstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mi.h" #include "mfb.h" #include "maskbits.h" /* CopyArea and CopyPlane for a monchrome frame buffer clip the source rectangle to the source's available bits. (this avoids copying unnecessary pieces that will just get exposed anyway.) this becomes the new shape of the destination. clip the destination region to the composite clip in the GC. this requires translating the destination region to (dstx, dsty). build a list of source points, one for each rectangle in the destination. this is a simple translation. go do the multiple rectangle copies do graphics exposures */ /** Optimized for drawing pixmaps into windows, especially when drawing into ** unobscured windows. Calls to the general-purpose region code were ** replaced with rectangle-to-rectangle clipping comparisions. This is ** possible, since the pixmap is a single rectangle. In an unobscured ** window, the destination clip is also a single rectangle, and region ** code can be avoided entirely. This is a big savings, since the region ** code uses XAlloc() and makes many function calls. ** ** In addition, if source is a pixmap, there is no need to call the ** expensive miHandleExposures() routine. Instead, we simply return NULL. ** ** Previously, drawing a pixmap into an unobscured window executed at least ** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code. ** ** Now, the same operation requires no XAlloc()'s, no region function calls, ** and much less overhead. Nice for drawing lots of small pixmaps. */ void mfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc) DrawablePtr pSrc, pDst; int alu; RegionPtr prgnDst; DDXPointPtr pptSrc; { switch (alu) { case GXcopy: mfbDoBitbltCopy (pSrc, pDst, alu, prgnDst, pptSrc); break; case GXxor: mfbDoBitbltXor (pSrc, pDst, alu, prgnDst, pptSrc); break; case GXcopyInverted: mfbDoBitbltCopyInverted (pSrc, pDst, alu, prgnDst, pptSrc); break; case GXor: mfbDoBitbltOr (pSrc, pDst, alu, prgnDst, pptSrc); break; default: mfbDoBitbltGeneral (pSrc, pDst, alu, prgnDst, pptSrc); break; } } RegionPtr mfbCopyArea(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; register GC *pGC; int srcx, srcy; int width, height; int dstx, dsty; { RegionPtr prgnSrcClip; /* may be a new region, or just a copy */ Bool freeSrcClip = FALSE; RegionPtr prgnExposed; RegionRec rgnDst; DDXPointPtr pptSrc; register DDXPointPtr ppt; register BoxPtr pbox; int i; register int dx; register int dy; xRectangle origSource; DDXPointRec origDest; int numRects; BoxRec fastBox; int fastClip = 0; /* for fast clipping with pixmap source */ int fastExpose = 0; /* for fast exposures with pixmap source */ void (*localDoBitBlt)(); origSource.x = srcx; origSource.y = srcy; origSource.width = width; origSource.height = height; origDest.x = dstx; origDest.y = dsty; if ((pSrcDrawable != pDstDrawable) && pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); } switch (pGC->alu) { case GXcopy: localDoBitBlt = mfbDoBitbltCopy; break; case GXcopyInverted: localDoBitBlt = mfbDoBitbltCopyInverted; break; case GXxor: localDoBitBlt = mfbDoBitbltXor; break; case GXor: localDoBitBlt = mfbDoBitbltOr; break; default: localDoBitBlt = mfbDoBitbltGeneral; break; } srcx += pSrcDrawable->x; srcy += pSrcDrawable->y; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; } else { fastClip = 1; } } else { if (pGC->subWindowMode == IncludeInferiors) { if (!((WindowPtr) pSrcDrawable)->parent) { /* * special case bitblt from root window in * IncludeInferiors mode; just like from a pixmap */ fastClip = 1; } else if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE)) { prgnSrcClip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; } else { prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); freeSrcClip = TRUE; } } else { prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } } fastBox.x1 = srcx; fastBox.y1 = srcy; fastBox.x2 = srcx + width; fastBox.y2 = srcy + height; /* Don't create a source region if we are doing a fast clip */ if (fastClip) { fastExpose = 1; /* * clip the source; if regions extend beyond the source size, * make sure exposure events get sent */ if (fastBox.x1 < pSrcDrawable->x) { fastBox.x1 = pSrcDrawable->x; fastExpose = 0; } if (fastBox.y1 < pSrcDrawable->y) { fastBox.y1 = pSrcDrawable->y; fastExpose = 0; } if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) { fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; fastExpose = 0; } if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) { fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; fastExpose = 0; } } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); } dstx += pDstDrawable->x; dsty += pDstDrawable->y; if (pDstDrawable->type == DRAWABLE_WINDOW) { if (!((WindowPtr)pDstDrawable)->realized) { if (!fastClip) REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } } dx = srcx - dstx; dy = srcy - dsty; /* Translate and clip the dst to the destination composite clip */ if (fastClip) { RegionPtr cclip; /* Translate the region directly */ fastBox.x1 -= dx; fastBox.x2 -= dx; fastBox.y1 -= dy; fastBox.y2 -= dy; /* If the destination composite clip is one rectangle we can do the clip directly. Otherwise we have to create a full blown region and call intersect */ cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; if (REGION_NUM_RECTS(cclip) == 1) { BoxPtr pBox = REGION_RECTS(cclip); if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; /* Check to see if the region is empty */ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) { REGION_INIT(pGC->pScreen, &rgnDst, NullBox, 0); } else { REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); } } else { /* We must turn off fastClip now, since we must create a full blown region. It is intersected with the composite clip below. */ fastClip = 0; REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1); } } else { REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); } if (!fastClip) { REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); } /* Do bit blitting */ numRects = REGION_NUM_RECTS(&rgnDst); if (numRects && width && height) { if(!(pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec)))) { REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return NULL; } pbox = REGION_RECTS(&rgnDst); ppt = pptSrc; for (i = numRects; --i >= 0; pbox++, ppt++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } if (pGC->planemask & 1) (*localDoBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); } prgnExposed = NULL; if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose) { /* Pixmap sources generate a NoExposed (we return NULL to do this) */ if (!fastExpose) prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, origSource.x, origSource.y, (int)origSource.width, (int)origSource.height, origDest.x, origDest.y, (unsigned long)0); } REGION_UNINIT(pGC->pScreen, &rgnDst); if (freeSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); return prgnExposed; } /* * Devices which use mfb for 1-bit pixmap support * must register a function for n-to-1 copy operations */ static unsigned long copyPlaneGeneration; static int copyPlaneScreenIndex = -1; Bool mfbRegisterCopyPlaneProc (pScreen, proc) ScreenPtr pScreen; RegionPtr (*proc)(); { if (copyPlaneGeneration != serverGeneration) { copyPlaneScreenIndex = AllocateScreenPrivateIndex(); if (copyPlaneScreenIndex < 0) return FALSE; copyPlaneGeneration = serverGeneration; } pScreen->devPrivates[copyPlaneScreenIndex].fptr = (pointer (*)()) proc; return TRUE; } /* if fg == 1 and bg ==0, we can do an ordinary CopyArea. if fg == bg, we can do a CopyArea with alu = mfbReduceRop(alu, fg) if fg == 0 and bg == 1, we use the same rasterop, with source operand inverted. CopyArea deals with all of the graphics exposure events. This code depends on knowing that we can change the alu in the GC without having to call ValidateGC() before calling CopyArea(). */ RegionPtr mfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane) DrawablePtr pSrcDrawable, pDstDrawable; register GC *pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long plane; { int alu; RegionPtr prgnExposed; RegionPtr (*copyPlane)(); if (pSrcDrawable->depth != 1) { if (copyPlaneScreenIndex >= 0 && (copyPlane = (RegionPtr (*)()) pSrcDrawable->pScreen->devPrivates[copyPlaneScreenIndex].fptr) ) { return (*copyPlane) (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); } else { FatalError ("No copyPlane proc registered for depth %d\n", pSrcDrawable->depth); } } if (plane != 1) return NULL; if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) { prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); } else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) { alu = pGC->alu; pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); pGC->alu = alu; } else /* need to invert the src */ { alu = pGC->alu; pGC->alu = InverseAlu[alu]; prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); pGC->alu = alu; } return prgnExposed; } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbgetsp.c0100664000076400007640000001223107120677563021431 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbgetsp.c,v 5.10 94/04/17 20:28:24 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "misc.h" #include "region.h" #include "gc.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "servermd.h" /* GetSpans -- for each span, gets bits from drawable starting at ppt[i] * and continuing for pwidth[i] bits * Each scanline returned will be server scanline padded, i.e., it will come * out to an integral number of words. */ /*ARGSUSED*/ void mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) DrawablePtr pDrawable; /* drawable from which to get bits */ int wMax; /* largest value of all *pwidths */ register DDXPointPtr ppt; /* points to start copying from */ int *pwidth; /* list of number of bits to copy */ int nspans; /* number of scanlines to copy */ char *pchardstStart; /* where to put the bits */ { PixelType *pdstStart = (PixelType *)pchardstStart; register PixelType *pdst; /* where to put the bits */ register PixelType *psrc; /* where to get the bits */ register PixelType tmpSrc; /* scratch buffer for bits */ PixelType *psrcBase; /* start of src bitmap */ int widthSrc; /* width of pixmap in bytes */ register DDXPointPtr pptLast; /* one past last point to get */ int xEnd; /* last pixel to copy from */ register int nstart; int nend; int srcStartOver; PixelType startmask, endmask; unsigned int srcBit; int nlMiddle, nl; int w; pptLast = ppt + nspans; mfbGetPixelWidthAndPointer(pDrawable, widthSrc, psrcBase); pdst = pdstStart; while(ppt < pptLast) { /* XXX should this really be << PWSH, or * 8, or * PGSZB? */ xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); pwidth++; psrc = mfbScanline(psrcBase, ppt->x, ppt->y, widthSrc); w = xEnd - ppt->x; srcBit = ppt->x & PIM; if (srcBit + w <= PPW) { getandputbits0(psrc, srcBit, w, pdst); pdst++; } else { maskbits(ppt->x, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - srcBit; else nstart = 0; if (endmask) nend = xEnd & PIM; srcStartOver = srcBit + nstart > PLST; if (startmask) { getandputbits0(psrc, srcBit, nstart, pdst); if(srcStartOver) psrc++; } nl = nlMiddle; #ifdef FASTPUTBITS Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;); #else while (nl--) { tmpSrc = *psrc; putbits(tmpSrc, nstart, PPW, pdst); psrc++; pdst++; } #endif if (endmask) { putbits(*psrc, nstart, nend, pdst); if(nstart + nend > PPW) pdst++; } if (startmask || endmask) pdst++; } ppt++; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfb.h0100664000076400007640000007115607120677563020406 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfb.h,v 5.31 94/04/17 20:28:15 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.2 1997/01/14 22:22:44 dawes Exp $ */ /* Monochrome Frame Buffer definitions written by drewry, september 1986 */ #include "pixmap.h" #include "region.h" #include "gc.h" #include "colormap.h" #include "miscstruct.h" #include "mibstore.h" extern int InverseAlu[]; /* warning: PixelType definition duplicated in maskbits.h */ #ifndef PixelType #define PixelType unsigned long #endif /* PixelType */ /* mfbbitblt.c */ extern void mfbDoBitblt( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); extern RegionPtr mfbCopyArea( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/ #endif ); extern Bool mfbRegisterCopyPlaneProc( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, RegionPtr (* /*proc*/)( #if NeedNestedPrototypes DrawablePtr /* pSrcDrawable */, DrawablePtr /* pDstDrawable */, GCPtr /* pGC */, int /* srcx */, int /* srcy */, int /* width */, int /* height */, int /* dstx */, int /* dsty */, unsigned long /* bitPlane */ #endif ) #endif ); extern RegionPtr mfbCopyPlane( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr/*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ #endif ); /* mfbbltC.c */ extern void mfbDoBitbltCopy( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); /* mfbbltCI.c */ extern void mfbDoBitbltCopyInverted( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); /* mfbbltG.c */ extern void mfbDoBitbltGeneral( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); /* mfbbltO.c */ extern void mfbDoBitbltOr( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); /* mfbbltX.c */ extern void mfbDoBitbltXor( #if NeedFunctionPrototypes DrawablePtr /*pSrc*/, DrawablePtr /*pDst*/, int /*alu*/, RegionPtr /*prgnDst*/, DDXPointPtr /*pptSrc*/ #endif ); /* mfbbres.c */ extern void mfbBresS( #if NeedFunctionPrototypes int /*rop*/, PixelType * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, int /*axis*/, int /*x1*/, int /*y1*/, int /*e*/, int /*e1*/, int /*e2*/, int /*len*/ #endif ); /* mfbbresd.c */ extern void mfbBresD( #if NeedFunctionPrototypes int /*fgrop*/, int /*bgrop*/, int * /*pdashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pdashOffset*/, int /*isDoubleDash*/, PixelType * /*addrl*/, int /*nlwidth*/, int /*signdx*/, int /*signdy*/, int /*axis*/, int /*x1*/, int /*y1*/, int /*e*/, int /*e1*/, int /*e2*/, int /*len*/ #endif ); /* mfbbstore.c */ extern void mfbSaveAreas( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnSave*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ #endif ); extern void mfbRestoreAreas( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, RegionPtr /*prgnRestore*/, int /*xorg*/, int /*yorg*/, WindowPtr /*pWin*/ #endif ); /* mfbclip.c */ extern RegionPtr mfbPixmapToRegion( #if NeedFunctionPrototypes PixmapPtr /*pPix*/ #endif ); /* mfbcmap.c */ extern int mfbListInstalledColormaps( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, Colormap * /*pmaps*/ #endif ); extern void mfbInstallColormap( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); extern void mfbUninstallColormap( #if NeedFunctionPrototypes ColormapPtr /*pmap*/ #endif ); extern void mfbResolveColor( #if NeedFunctionPrototypes unsigned short * /*pred*/, unsigned short * /*pgreen*/, unsigned short * /*pblue*/, VisualPtr /*pVisual*/ #endif ); extern Bool mfbCreateColormap( #if NeedFunctionPrototypes ColormapPtr /*pMap*/ #endif ); extern void mfbDestroyColormap( #if NeedFunctionPrototypes ColormapPtr /*pMap*/ #endif ); extern Bool mfbCreateDefColormap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); /* mfbfillarc.c */ extern void mfbPolyFillArcSolid( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* mfbfillrct.c */ extern void mfbPolyFillRect( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ #endif ); /* mfbfillsp.c */ extern void mfbBlackSolidFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbWhiteSolidFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbInvertSolidFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbWhiteStippleFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbBlackStippleFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbInvertStippleFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbTileFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbUnnaturalTileFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); extern void mfbUnnaturalStippleFS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*nInit*/, DDXPointPtr /*pptInit*/, int * /*pwidthInit*/, int /*fSorted*/ #endif ); /* mfbfont.c */ extern Bool mfbRealizeFont( #if NeedFunctionPrototypes ScreenPtr /*pscr*/, FontPtr /*pFont*/ #endif ); extern Bool mfbUnrealizeFont( #if NeedFunctionPrototypes ScreenPtr /*pscr*/, FontPtr /*pFont*/ #endif ); /* mfbgc.c */ extern Bool mfbCreateGC( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); extern void mfbValidateGC( #if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned long /*changes*/, DrawablePtr /*pDrawable*/ #endif ); extern int mfbReduceRop( #if NeedFunctionPrototypes int /*alu*/, Pixel /*src*/ #endif ); /* mfbgetsp.c */ extern void mfbGetSpans( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*wMax*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, char * /*pdstStart*/ #endif ); /* mfbhrzvert.c */ extern int mfbHorzS( #if NeedFunctionPrototypes int /*rop*/, PixelType * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ #endif ); extern int mfbVertS( #if NeedFunctionPrototypes int /*rop*/, PixelType * /*addrl*/, int /*nlwidth*/, int /*x1*/, int /*y1*/, int /*len*/ #endif ); /* mfbigbblak.c */ extern void mfbImageGlyphBltBlack( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbigbwht.c */ extern void mfbImageGlyphBltWhite( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbimage.c */ extern void mfbPutImage( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pImage*/ #endif ); extern void mfbGetImage( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ #endif ); /* mfbline.c */ extern void mfbLineSS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); extern void mfbLineSD( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pptInit*/ #endif ); /* mfbmisc.c */ extern void mfbQueryBestSize( #if NeedFunctionPrototypes int /*class*/, unsigned short * /*pwidth*/, unsigned short * /*pheight*/, ScreenPtr /*pScreen*/ #endif ); /* mfbpablack.c */ extern void mfbSolidBlackArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*nop*/ #endif ); extern void mfbStippleBlackArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*pstipple*/ #endif ); /* mfbpainv.c */ extern void mfbSolidInvertArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*nop*/ #endif ); extern void mfbStippleInvertArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*pstipple*/ #endif ); /* mfbpawhite.c */ extern void mfbSolidWhiteArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*nop*/ #endif ); extern void mfbStippleWhiteArea( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*pstipple*/ #endif ); /* mfbpgbblak.c */ extern void mfbPolyGlyphBltBlack( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbpgbinv.c */ extern void mfbPolyGlyphBltInvert( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbpgbwht.c */ extern void mfbPolyGlyphBltWhite( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbpixmap.c */ extern PixmapPtr mfbCreatePixmap( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, int /*height*/, int /*depth*/ #endif ); extern Bool mfbDestroyPixmap( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern PixmapPtr mfbCopyPixmap( #if NeedFunctionPrototypes PixmapPtr /*pSrc*/ #endif ); extern void mfbPadPixmap( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/ #endif ); extern void mfbXRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rw*/ #endif ); extern void mfbYRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*pPix*/, int /*rh*/ #endif ); extern void mfbCopyRotatePixmap( #if NeedFunctionPrototypes PixmapPtr /*psrcPix*/, PixmapPtr * /*ppdstPix*/, int /*xrot*/, int /*yrot*/ #endif ); /* mfbplyblack.c */ extern void mfbFillPolyBlack( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* mfbplyinv.c */ extern void mfbFillPolyInvert( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* mfbplywhite.c */ extern void mfbFillPolyWhite( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* mfbpntwin.c */ extern void mfbPaintWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*pRegion*/, int /*what*/ #endif ); /* mfbpolypnt.c */ extern void mfbPolyPoint( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ #endif ); /* mfbpushpxl.c */ extern void mfbSolidPP( #if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDrawable*/, int /*dx*/, int /*dy*/, int /*xOrg*/, int /*yOrg*/ #endif ); extern void mfbPushPixels( #if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDrawable*/, int /*dx*/, int /*dy*/, int /*xOrg*/, int /*yOrg*/ #endif ); /* mfbscrclse.c */ extern Bool mfbCloseScreen( #if NeedFunctionPrototypes int /*index*/, ScreenPtr /*pScreen*/ #endif ); /* mfbscrinit.c */ extern Bool mfbAllocatePrivates( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int * /*pWinIndex*/, int * /*pGCIndex*/ #endif ); extern Bool mfbScreenInit( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/ #endif ); /* mfbseg.c */ extern void mfbSegmentSS( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ #endif ); extern void mfbSegmentSD( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSeg*/ #endif ); /* mfbsetsp.c */ extern int mfbSetScanline( #if NeedFunctionPrototypes int /*y*/, int /*xOrigin*/, int /*xStart*/, int /*xEnd*/, PixelType * /*psrc*/, int /*alu*/, PixelType * /*pdstBase*/, int /*widthDst*/ #endif ); extern void mfbSetSpans( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, char * /*psrc*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, int /*fSorted*/ #endif ); /* mfbteblack.c */ extern void mfbTEGlyphBltBlack( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbtewhite.c */ extern void mfbTEGlyphBltWhite( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr/*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mfbtileC.c */ extern void mfbTileAreaPPWCopy( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*ptile*/ #endif ); /* mfbtileG.c */ extern void mfbTileAreaPPWGeneral( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*ptile*/ #endif ); extern void mfbTileAreaPPW( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*ptile*/ #endif ); /* mfbwindow.c */ extern Bool mfbCreateWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern Bool mfbDestroyWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern Bool mfbMapWindow( #if NeedFunctionPrototypes WindowPtr /*pWindow*/ #endif ); extern Bool mfbPositionWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/ #endif ); extern Bool mfbUnmapWindow( #if NeedFunctionPrototypes WindowPtr /*pWindow*/ #endif ); extern void mfbCopyWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, DDXPointRec /*ptOldOrg*/, RegionPtr /*prgnSrc*/ #endif ); extern Bool mfbChangeWindowAttributes( #if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned long /*mask*/ #endif ); /* mfbzerarc.c */ extern void mfbZeroPolyArcSS( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* private filed of pixmap pixmap.devPrivate = (PixelType *)pointer_to_bits pixmap.devKind = width_of_pixmap_in_bytes private field of screen a pixmap, for which we allocate storage. devPrivate is a pointer to the bits in the hardware framebuffer. note that devKind can be poked to make the code work for framebuffers that are wider than their displayable screen (e.g. the early vsII, which displayed 960 pixels across, but was 1024 in the hardware.) private field of GC Freeing pCompositeClip is done based on the value of freeCompClip; if freeCompClip is not carefully maintained, we will end up losing storage or freeing something that isn't ours. */ typedef struct { unsigned char rop; /* reduction of rasterop to 1 of 3 */ unsigned char ropOpStip; /* rop for opaque stipple */ unsigned char ropFillArea; /* == alu, rop, or ropOpStip */ unsigned fExpose:1; /* callexposure handling ? */ unsigned freeCompClip:1; PixmapPtr pRotatedPixmap; /* tile/stipple rotated to align */ RegionPtr pCompositeClip; /* free this based on freeCompClip flag rather than NULLness */ void (* FillArea)( /* fills regions; look at the code */ #if NeedNestedPrototypes DrawablePtr /*pDraw*/, int /*nbox*/, BoxPtr /*pbox*/, int /*alu*/, PixmapPtr /*nop*/ #endif ); } mfbPrivGC; typedef mfbPrivGC *mfbPrivGCPtr; extern int mfbGCPrivateIndex; /* index into GC private array */ extern int mfbWindowPrivateIndex; /* index into Window private array */ #ifdef PIXMAP_PER_WINDOW extern int frameWindowPrivateIndex; /* index into Window private array */ #endif /* private field of window */ typedef struct { unsigned char fastBorder; /* non-zero if border tile is 32 bits wide */ unsigned char fastBackground; unsigned short unused; /* pad for alignment with Sun compiler */ DDXPointRec oldRotate; PixmapPtr pRotatedBackground; PixmapPtr pRotatedBorder; } mfbPrivWin; /* Common macros for extracting drawing information */ #define mfbGetTypedWidth(pDrawable,type) (\ (((pDrawable)->type == DRAWABLE_WINDOW) ? \ (int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (type)) #define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char) #define mfbGetPixelWidth(pDrawable) mfbGetTypedWidth(pDrawable, PixelType) #define mfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ PixmapPtr _pPix; \ if ((pDrawable)->type == DRAWABLE_WINDOW) \ _pPix = (PixmapPtr) (pDrawable)->pScreen->devPrivate; \ else \ _pPix = (PixmapPtr) (pDrawable); \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ (width) = ((int) _pPix->devKind) / sizeof (wtype); \ } #define mfbGetByteWidthAndPointer(pDrawable, width, pointer) \ mfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char) #define mfbGetPixelWidthAndPointer(pDrawable, width, pointer) \ mfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) #define mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\ PixmapPtr _pPix = (PixmapPtr) (pWin)->drawable.pScreen->devPrivate; \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ (width) = ((int) _pPix->devKind) / sizeof (wtype); \ } #define mfbGetWindowPixelWidthAndPointer(pWin, width, pointer) \ mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType) #define mfbGetWindowByteWidthAndPointer(pWin, width, pointer) \ mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char) /* mfb uses the following macros to calculate addresses in drawables. * To support banked framebuffers, the macros come in four flavors. * All four collapse into the same definition on unbanked devices. * * mfbScanlineFoo - calculate address and do bank switching * mfbScanlineFooNoBankSwitch - calculate address, don't bank switch * mfbScanlineFooSrc - calculate address, switch source bank * mfbScanlineFooDst - calculate address, switch destination bank */ /* The NoBankSwitch versions are the same for banked and unbanked cases */ #define mfbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off) #define mfbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off)) #define mfbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \ mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w)) #define mfbScanlineNoBankSwitch(_ptr, _x, _y, _w) \ mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH)) #ifdef MFB_LINE_BANK #include "mfblinebank.h" /* get macro definitions from this file */ #else /* !MFB_LINE_BANK - unbanked case */ #define mfbScanlineInc(_ptr, _off) mfbScanlineIncNoBankSwitch(_ptr, _off) #define mfbScanlineIncSrc(_ptr, _off) mfbScanlineInc(_ptr, _off) #define mfbScanlineIncDst(_ptr, _off) mfbScanlineInc(_ptr, _off) #define mfbScanlineOffset(_ptr, _off) mfbScanlineOffsetNoBankSwitch(_ptr, _off) #define mfbScanlineOffsetSrc(_ptr, _off) mfbScanlineOffset(_ptr, _off) #define mfbScanlineOffsetDst(_ptr, _off) mfbScanlineOffset(_ptr, _off) #define mfbScanlineSrc(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w) #define mfbScanlineDst(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w) #define mfbScanlineDeltaSrc(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w) #define mfbScanlineDeltaDst(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w) #endif /* MFB_LINE_BANK */ #define mfbScanlineDelta(_ptr, _y, _w) \ mfbScanlineOffset(_ptr, (_y) * (_w)) #define mfbScanline(_ptr, _x, _y, _w) \ mfbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH)) /* precomputed information about each glyph for GlyphBlt code. this saves recalculating the per glyph information for each box. */ typedef struct _pos{ int xpos; /* xposition of glyph's origin */ int xchar; /* x position mod 32 */ int leftEdge; int rightEdge; int topEdge; int bottomEdge; PixelType *pdstBase; /* longword with character origin */ int widthGlyph; /* width in bytes of this glyph */ } TEXTPOS; /* reduced raster ops for mfb */ #define RROP_BLACK GXclear #define RROP_WHITE GXset #define RROP_NOP GXnoop #define RROP_INVERT GXinvert /* macros for mfbbitblt.c, mfbfillsp.c these let the code do one switch on the rop per call, rather than a switch on the rop per item (span or rectangle.) */ #define fnCLEAR(src, dst) (0) #define fnAND(src, dst) (src & dst) #define fnANDREVERSE(src, dst) (src & ~dst) #define fnCOPY(src, dst) (src) #define fnANDINVERTED(src, dst) (~src & dst) #define fnNOOP(src, dst) (dst) #define fnXOR(src, dst) (src ^ dst) #define fnOR(src, dst) (src | dst) #define fnNOR(src, dst) (~(src | dst)) #define fnEQUIV(src, dst) (~src ^ dst) #define fnINVERT(src, dst) (~dst) #define fnORREVERSE(src, dst) (src | ~dst) #define fnCOPYINVERTED(src, dst)(~src) #define fnORINVERTED(src, dst) (~src | dst) #define fnNAND(src, dst) (~(src & dst)) #define fnSET(src, dst) (~0) /* Using a "switch" statement is much faster in most cases * since the compiler can do a look-up table or multi-way branch * instruction, depending on the architecture. The result on * A Sun 3/50 is at least 2.5 times faster, assuming a uniform * distribution of RasterOp operation types. * * However, doing some profiling on a running system reveals * GXcopy is the operation over 99.5% of the time and * GXxor is the next most frequent (about .4%), so we make special * checks for those first. * * Note that this requires a change to the "calling sequence" * since we can't engineer a "switch" statement to have an lvalue. */ #define DoRop(result, alu, src, dst) \ { \ if (alu == GXcopy) \ result = fnCOPY (src, dst); \ else if (alu == GXxor) \ result = fnXOR (src, dst); \ else \ switch (alu) \ { \ case GXclear: \ result = fnCLEAR (src, dst); \ break; \ case GXand: \ result = fnAND (src, dst); \ break; \ case GXandReverse: \ result = fnANDREVERSE (src, dst); \ break; \ case GXandInverted: \ result = fnANDINVERTED (src, dst); \ break; \ case GXnoop: \ result = fnNOOP (src, dst); \ break; \ case GXor: \ result = fnOR (src, dst); \ break; \ case GXnor: \ result = fnNOR (src, dst); \ break; \ case GXequiv: \ result = fnEQUIV (src, dst); \ break; \ case GXinvert: \ result = fnINVERT (src, dst); \ break; \ case GXorReverse: \ result = fnORREVERSE (src, dst); \ break; \ case GXcopyInverted: \ result = fnCOPYINVERTED (src, dst); \ break; \ case GXorInverted: \ result = fnORINVERTED (src, dst); \ break; \ case GXnand: \ result = fnNAND (src, dst); \ break; \ case GXset: \ result = fnSET (src, dst); \ break; \ } \ } /* C expression fragments for various operations. These get passed in * as -D's on the compile command line. See mfb/Imakefile. This * fixes XBUG 6319. * * This seems like a good place to point out that mfb's use of the * words black and white is an unfortunate misnomer. In mfb code, black * means zero, and white means one. */ #define MFB_OPEQ_WHITE |= #define MFB_OPEQ_BLACK &=~ #define MFB_OPEQ_INVERT ^= #define MFB_EQWHOLEWORD_WHITE =~0 #define MFB_EQWHOLEWORD_BLACK =0 #define MFB_EQWHOLEWORD_INVERT ^=~0 #define MFB_OP_WHITE /* nothing */ #define MFB_OP_BLACK ~ vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbimggblt.c0100664000076400007640000003277707120677563021755 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbimggblt.c,v 5.17 94/04/17 20:28:25 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.0 1995/06/14 12:43:46 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "maskbits.h" /* we should eventually special-case fixed-width fonts for ImageText. this works for fonts with glyphs <= 32 bits wide. the clipping calculations are done for worst-case fonts. we make no assumptions about the heights, widths, or bearings of the glyphs. if we knew that the glyphs are all the same height, we could clip the tops and bottoms per clipping box, rather than per character per clipping box. if we knew that the glyphs' left and right bearings were wlle-behaved, we could clip a single character at the start, output until the last unclipped character, and then clip the last one. this is all straightforward to determine based on max-bounds and min-bounds from the font. there is some inefficiency introduced in the per-character clipping to make what's going on clearer. (it is possible, for example, for a font to be defined in which the next-to-last character in a font would be clipped out, but the last one wouldn't. the code below deals with this.) Image text looks at the bits in the glyph and the fg and bg in the GC. it paints a rectangle, as defined in the protocol dcoument, and the paints the characters. to avoid source proliferation, this file is compiled three times: MFBIMAGEGLYPHBLT OPEQ mfbImageGlyphBltWhite |= mfbImageGlyphBltBlack &=~ the register allocations for startmask and endmask may not be the right thing. are there two other deserving candidates? xoff, pdst, pglyph, and tmpSrc seem like the right things, though. */ void MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { ExtentInfoRec info; /* used by QueryGlyphExtents() */ BoxRec bbox; /* string's bounding box */ xRectangle backrect;/* backing rectangle to paint. in the general case, NOT necessarily the same as the string's bounding box */ CharInfoPtr pci; int xorg, yorg; /* origin of drawable in bitmap */ int widthDst; /* width of dst in longwords */ /* these keep track of the character origin */ PixelType *pdstBase; /* points to longword with character origin */ int xchar; /* xorigin of char (mod 32) */ /* these are used for placing the glyph */ register int xoff; /* x offset of left edge of glyph (mod 32) */ register PixelType *pdst; /* pointer to current longword in dst */ int w; /* width of glyph in bits */ int h; /* height of glyph */ int widthGlyph; /* width of glyph, in bytes */ register unsigned char *pglyph; /* pointer to current row of glyph */ /* used for putting down glyph */ register PixelType tmpSrc; /* for getting bits from glyph */ register PixelType startmask; register PixelType endmask; register int nFirst;/* bits of glyph in current longword */ void (* oldFillArea)(); /* we might temporarily usurp this field in devPriv */ if (!(pGC->planemask & 1)) return; xorg = pDrawable->x; yorg = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); backrect.x = x; backrect.y = y - FONTASCENT(pGC->font); backrect.width = info.overallWidth; backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); x += xorg; y += yorg; bbox.x1 = x + info.overallLeft; bbox.x2 = x + info.overallRight; bbox.y1 = y - info.overallAscent; bbox.y2 = y + info.overallDescent; /* UNCLEAN CODE we know the mfbPolyFillRect uses only three fields in devPrivate[mfbGCPrivateIndex].ptr, two of which (the rotated tile/stipple and the ropFillArea) are irrelevant for solid filling, so we just poke the FillArea field. the GC is now in an inconsistent state, but we'll fix it as soon as PolyFillRect returns. fortunately, the server is single threaded. NOTE: if you are not using the standard mfbFillRectangle code, you need to poke any fields in the GC the rectangle stuff need (probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGCPrivateIndex].ptr (probably rop or ropFillArea.) You could just call ValidateGC, but that is usually not a cheap thing to do. */ oldFillArea = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea; /* pcc doesn't like this. why? ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = ((pGC->bgPixel & 1) ? mfbSolidWhiteArea : mfbSolidBlackArea); */ if (pGC->bgPixel & 1) ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidWhiteArea; else ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = mfbSolidBlackArea; mfbPolyFillRect(pDrawable, pGC, 1, &backrect); ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->FillArea = oldFillArea; /* the faint-hearted can open their eyes now */ switch (RECT_IN_REGION(pGC->pScreen, ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox)) { case rgnOUT: break; case rgnIN: pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); xchar = x & PIM; while(nglyph--) { pci = *ppci; pglyph = FONTGLYPHBITS(pglyphBase, pci); w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; h = pci->metrics.ascent + pci->metrics.descent; widthGlyph = GLYPHWIDTHBYTESPADDED(pci); /* start at top scanline of glyph */ pdst = pdstBase; /* find correct word in scanline and x offset within it for left edge of glyph */ xoff = xchar + pci->metrics.leftSideBearing; if (xoff > PLST) { pdst++; xoff &= PIM; } else if (xoff < 0) { xoff += PPW; pdst--; } pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst); if ((xoff + w) <= PPW) { /* glyph all in one longword */ maskpartialbits(xoff, w, startmask); while (h--) { getleftbits(pglyph, w, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } else { /* glyph crosses longword boundary */ maskPPWbits(xoff, w, startmask, endmask); nFirst = PPW - xoff; while (h--) { getleftbits(pglyph, w, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } /* glyph crosses longwords boundary */ /* update character origin */ x += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; if (xchar > PLST) { xchar -= PPW; pdstBase++; } else if (xchar < 0) { xchar += PPW; pdstBase--; } ppci++; } /* while nglyph-- */ break; case rgnPART: { TEXTPOS *ppos; int nbox; BoxPtr pbox; RegionPtr cclip; int xpos; /* x position of char origin */ int i; BoxRec clip; int leftEdge, rightEdge; int topEdge, bottomEdge; int glyphRow; /* first row of glyph not wholly clipped out */ int glyphCol; /* leftmost visible column of glyph */ int getWidth; /* bits to get from glyph */ if(!(ppos = (TEXTPOS *)ALLOCATE_LOCAL(nglyph * sizeof(TEXTPOS)))) return; pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); xpos = x; xchar = xpos & PIM; for (i=0; imetrics.leftSideBearing; ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing; ppos[i].topEdge = y - pci->metrics.ascent; ppos[i].bottomEdge = y + pci->metrics.descent; ppos[i].pdstBase = pdstBase; ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci); xpos += pci->metrics.characterWidth; xchar += pci->metrics.characterWidth; if (xchar > PLST) { xchar &= PIM; pdstBase++; } else if (xchar < 0) { xchar += PPW; pdstBase--; } } cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; pbox = REGION_RECTS(cclip); nbox = REGION_NUM_RECTS(cclip); /* HACK ALERT since we continue out of the loop below so often, it is easier to increment pbox at the top than at the end. don't try this at home. */ pbox--; while(nbox--) { pbox++; clip.x1 = max(bbox.x1, pbox->x1); clip.y1 = max(bbox.y1, pbox->y1); clip.x2 = min(bbox.x2, pbox->x2); clip.y2 = min(bbox.y2, pbox->y2); if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1)) continue; for(i=0; i clip.x2) rightEdge = clip.x2; else rightEdge = ppos[i].rightEdge; w = rightEdge - leftEdge; if (w <= 0) continue; /* clip the top and bottom edges */ if (ppos[i].topEdge < clip.y1) topEdge = clip.y1; else topEdge = ppos[i].topEdge; if (ppos[i].bottomEdge > clip.y2) bottomEdge = clip.y2; else bottomEdge = ppos[i].bottomEdge; h = bottomEdge - topEdge; if (h <= 0) continue; glyphRow = (topEdge - y) + pci->metrics.ascent; widthGlyph = ppos[i].widthGlyph; pglyph = FONTGLYPHBITS(pglyphBase, pci); pglyph += (glyphRow * widthGlyph); pdst = ppos[i].pdstBase; glyphCol = (leftEdge - ppos[i].xpos) - (pci->metrics.leftSideBearing); getWidth = w + glyphCol; xoff = xchar + (leftEdge - ppos[i].xpos); if (xoff > PLST) { xoff &= PIM; pdst++; } else if (xoff < 0) { xoff += PPW; pdst--; } pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst); if ((xoff + w) <= PPW) { maskpartialbits(xoff, w, startmask); while (h--) { getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } else { maskPPWbits(xoff, w, startmask, endmask); nFirst = PPW - xoff; while (h--) { getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); pglyph += widthGlyph; mfbScanlineInc(pdst, widthDst); } } } /* for each glyph */ } /* while nbox-- */ DEALLOCATE_LOCAL(ppos); break; } default: break; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbzerarc.c0100664000076400007640000001746407120677563021612 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mfbzerarc.c /main/21 1995/12/06 16:55:48 dpw $ */ /* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.1 1996/01/05 13:19:46 dawes Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" * by M. L. V. Pitteway * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "mizerarc.h" #include "mi.h" /* * Note: LEFTMOST must be the bit leftmost in the actual screen * representation. This depends also on the IMAGE_BYTE_ORDER. * LONG2CHARS() takes care of the re-ordering as required. (DHD) */ #if (BITMAP_BIT_ORDER == MSBFirst) #define LEFTMOST ((PixelType) LONG2CHARS(((unsigned long)1 << PLST))) #else #define LEFTMOST ((PixelType) LONG2CHARS(1)) #endif #define PixelateWhite(addr,yoff,xoff) \ *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) |= \ SCRRIGHT (LEFTMOST, ((xoff) & PIM)) #define PixelateBlack(addr,yoff,xoff) \ *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) &= \ ~(SCRRIGHT (LEFTMOST, ((xoff) & PIM))) #define Pixelate(base,yoff,xoff) \ { \ paddr = mfbScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \ pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \ *paddr = (*paddr & ~pmask) | (pixel & pmask); \ } #define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff); static void mfbZeroArcSS(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { miZeroArcRec info; Bool do360; register int x, y, a, b, d, mask; register int k1, k3, dx, dy; PixelType *addrl; PixelType *yorgl, *yorgol; PixelType pixel; int nlwidth, yoffset, dyoffset; PixelType pmask; register PixelType *paddr; if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop == RROP_BLACK) pixel = 0; else pixel = ~0; mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrl); do360 = miZeroArcSetup(arc, &info, TRUE); yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth); yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth); info.xorg += pDraw->x; info.xorgo += pDraw->x; MIARCSETUP(); yoffset = y ? nlwidth : 0; dyoffset = 0; mask = info.initialMask; if (!(arc->width & 1)) { DoPix(2, yorgl, 0, info.xorgo); DoPix(8, yorgol, 0, info.xorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int xoffset = nlwidth; PixelType *yorghl = mfbScanlineDeltaNoBankSwitch(yorgl, info.h, nlwidth); int xorghp = info.xorg + info.h; int xorghn = info.xorg - info.h; if (pixel) { while (1) { PixelateWhite(yorgl, yoffset, info.xorg + x); PixelateWhite(yorgl, yoffset, info.xorg - x); PixelateWhite(yorgol, -yoffset, info.xorg - x); PixelateWhite(yorgol, -yoffset, info.xorg + x); if (a < 0) break; PixelateWhite(yorghl, -xoffset, xorghp - y); PixelateWhite(yorghl, -xoffset, xorghn + y); PixelateWhite(yorghl, xoffset, xorghn + y); PixelateWhite(yorghl, xoffset, xorghp - y); xoffset += nlwidth; MIARCCIRCLESTEP(yoffset += nlwidth;); } } else { while (1) { PixelateBlack(yorgl, yoffset, info.xorg + x); PixelateBlack(yorgl, yoffset, info.xorg - x); PixelateBlack(yorgol, -yoffset, info.xorg - x); PixelateBlack(yorgol, -yoffset, info.xorg + x); if (a < 0) break; PixelateBlack(yorghl, -xoffset, xorghp - y); PixelateBlack(yorghl, -xoffset, xorghn + y); PixelateBlack(yorghl, xoffset, xorghn + y); PixelateBlack(yorghl, xoffset, xorghp - y); xoffset += nlwidth; MIARCCIRCLESTEP(yoffset += nlwidth;); } } x = info.w; yoffset = info.h * nlwidth; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = nlwidth;); Pixelate(yorgl, yoffset, info.xorg + x); Pixelate(yorgl, yoffset, info.xorgo - x); Pixelate(yorgol, -yoffset, info.xorgo - x); Pixelate(yorgol, -yoffset, info.xorg + x); MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(dyoffset = nlwidth;); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(1, yorgl, yoffset, info.xorg + x); DoPix(2, yorgl, yoffset, info.xorgo - x); DoPix(4, yorgol, -yoffset, info.xorgo - x); DoPix(8, yorgol, -yoffset, info.xorg + x); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(1, yorgl, yoffset, info.xorg + x); DoPix(4, yorgol, -yoffset, info.xorgo - x); if (arc->height & 1) { DoPix(2, yorgl, yoffset, info.xorgo - x); DoPix(8, yorgol, -yoffset, info.xorg + x); } } void mfbZeroPolyArcSS(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register xArc *arc; register int i; BoxRec box; int x2, y2; RegionPtr cclip; if (!pGC->planemask & 1) return; cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miCanZeroArc(arc)) { box.x1 = arc->x + pDraw->x; box.y1 = arc->y + pDraw->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)arc->width + 1; box.x2 = x2; y2 = box.y1 + (int)arc->height + 1; box.y2 = y2; if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) mfbZeroArcSS(pDraw, pGC, arc); else miZeroPolyArc(pDraw, pGC, 1, arc); } else miPolyArc(pDraw, pGC, 1, arc); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbpntarea.c0100664000076400007640000002046007120677563021744 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbpntarea.c,v 5.7 94/04/17 20:28:29 dpw Exp $ */ #include "X.h" #include "windowstr.h" #include "regionstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" /* the solid fillers are called for rectangles and window backgrounds. the boxes are already translated. maybe this should always take a pixmap instead of a drawable? NOTE: iy = ++iy < tileHeight ? iy : 0 is equivalent to iy%= tileheight, and saves a division. */ /* MFBSOLIDFILLAREA OPEQ EQWHOLEOWRD mfbSolidWhiteArea |= = ~0 mfbSolidBlackArea &=~ = 0 mfbSolidInvertArea ^= ^= ~0 EQWHOLEWORD is used to write whole longwords. it could use OPEQ, but *p++ |= ~0 on at least two compilers generates much worse code than *p++ = ~0. similarly for *p++ &= ~~0 and *p++ = 0. */ /*ARGSUSED*/ void MFBSOLIDFILLAREA(pDraw, nbox, pbox, alu, nop) DrawablePtr pDraw; int nbox; BoxPtr pbox; int alu; PixmapPtr nop; { int nlwidth; /* width in longwords of the drawable */ int w; /* width of current box */ register int h; /* height of current box */ register PixelType *p; /* pointer to bits we're writing */ register int nlw; /* loop version of nlwMiddle */ register PixelType startmask; register PixelType endmask;/* masks for reggedy bits at either end of line */ register int nlwExtra; /* to get from right of box to left of next span */ int nlwMiddle; /* number of longwords between sides of boxes */ PixelType *pbits; /* pointer to start of drawable */ mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); while (nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); if ( ((pbox->x1 & PIM) + w) < PPW) { maskpartialbits(pbox->x1, w, startmask); nlwExtra = nlwidth; Duff(h, *p OPEQ startmask; mfbScanlineInc(p, nlwExtra)); } else { maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); nlwExtra = nlwidth - nlwMiddle; if (startmask && endmask) { nlwExtra -= 1; while (h--) { nlw = nlwMiddle; *p OPEQ startmask; p++; Duff(nlw, *p++ EQWHOLEWORD); *p OPEQ endmask; mfbScanlineInc(p, nlwExtra); } } else if (startmask && !endmask) { nlwExtra -= 1; while (h--) { nlw = nlwMiddle; *p OPEQ startmask; p++; Duff(nlw, *p++ EQWHOLEWORD); mfbScanlineInc(p, nlwExtra); } } else if (!startmask && endmask) { while (h--) { nlw = nlwMiddle; Duff(nlw, *p++ EQWHOLEWORD); *p OPEQ endmask; mfbScanlineInc(p, nlwExtra); } } else /* no ragged bits at either end */ { while (h--) { nlw = nlwMiddle; Duff(nlw, *p++ EQWHOLEWORD); mfbScanlineInc(p, nlwExtra); } } } pbox++; } } /* stipple a list of boxes you can use the reduced rasterop for stipples. if rrop is black, AND the destination with (not stipple pattern). if rrop is white OR the destination with the stipple pattern. if rrop is invert, XOR the destination with the stipple pattern. MFBSTIPPLEFILLAREA OPEQ mfbStippleWhiteArea |= mfbStippleBlackArea &=~ mfbStippleInveryArea ^= */ /*ARGSUSED*/ void MFBSTIPPLEFILLAREA(pDraw, nbox, pbox, alu, pstipple) DrawablePtr pDraw; int nbox; BoxPtr pbox; int alu; PixmapPtr pstipple; { register PixelType *psrc; /* pointer to bits in tile, if needed */ int tileHeight; /* height of the tile */ register PixelType srcpix; int nlwidth; /* width in longwords of the drawable */ int w; /* width of current box */ register int nlw; /* loop version of nlwMiddle */ register PixelType *p; /* pointer to bits we're writing */ register int h; /* height of current box */ PixelType startmask; PixelType endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwExtra; /* to get from right of box to left of next span */ register int iy; /* index of current scanline in tile */ PixelType *pbits; /* pointer to start of drawable */ mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); tileHeight = pstipple->drawable.height; psrc = (PixelType *)(pstipple->devPrivate.ptr); while (nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; iy = pbox->y1 % tileHeight; p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); if ( ((pbox->x1 & PIM) + w) < PPW) { maskpartialbits(pbox->x1, w, startmask); nlwExtra = nlwidth; while (h--) { srcpix = psrc[iy]; iy = ++iy < tileHeight ? iy : 0; *p OPEQ (srcpix & startmask); mfbScanlineInc(p, nlwExtra); } } else { maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); nlwExtra = nlwidth - nlwMiddle; if (startmask && endmask) { nlwExtra -= 1; while (h--) { srcpix = psrc[iy]; iy = ++iy < tileHeight ? iy : 0; nlw = nlwMiddle; *p OPEQ (srcpix & startmask); p++; Duff (nlw, *p++ OPEQ srcpix); *p OPEQ (srcpix & endmask); mfbScanlineInc(p, nlwExtra); } } else if (startmask && !endmask) { nlwExtra -= 1; while (h--) { srcpix = psrc[iy]; iy = ++iy < tileHeight ? iy : 0; nlw = nlwMiddle; *p OPEQ (srcpix & startmask); p++; Duff(nlw, *p++ OPEQ srcpix); mfbScanlineInc(p, nlwExtra); } } else if (!startmask && endmask) { while (h--) { srcpix = psrc[iy]; iy = ++iy < tileHeight ? iy : 0; nlw = nlwMiddle; Duff(nlw, *p++ OPEQ srcpix); *p OPEQ (srcpix & endmask); mfbScanlineInc(p, nlwExtra); } } else /* no ragged bits at either end */ { while (h--) { srcpix = psrc[iy]; iy = ++iy < tileHeight ? iy : 0; nlw = nlwMiddle; Duff(nlw, *p++ OPEQ srcpix); mfbScanlineInc(p, nlwExtra); } } } pbox++; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbbres.c0100664000076400007640000001751607120677563021255 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbbres.c,v 1.22 94/04/17 20:28:17 dpw Exp $ */ #include "X.h" #include "misc.h" #include "mfb.h" #include "maskbits.h" #include "miline.h" /* Solid bresenham line */ /* NOTES e2 is used less often than e1, so it's not in a register */ void mfbBresS(rop, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) int rop; /* a reduced rasterop */ PixelType *addrlbase; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int signdx, signdy; /* signs of directions */ int axis; /* major axis (Y_AXIS or X_AXIS) */ int x1, y1; /* initial point */ register int e; /* error accumulator */ register int e1; /* bresenham increments */ int e2; int len; /* length of line */ { register int yinc; /* increment to next scanline, in bytes */ register PixelType *addrl; /* bitmask long pointer */ register PixelType bit; /* current bit being set/cleared/etc. */ PixelType leftbit = mask[0]; /* leftmost bit to process in new word */ PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */ register int e3 = e2-e1; PixelType tmp; /* point to longword containing first point */ addrl = mfbScanline(addrlbase, x1, y1, nlwidth); yinc = signdy * nlwidth; e = e-e1; /* to make looping easier */ bit = mask[x1 & PIM]; if (!len) return; if (rop == RROP_BLACK) { if (axis == X_AXIS) { if (signdx > 0) { tmp = *addrl; for (;;) { tmp &= ~bit; if (!--len) break; bit = SCRRIGHT(bit,1); e += e1; if (e >= 0) { *addrl = tmp; mfbScanlineInc(addrl, yinc); e += e3; if (!bit) { bit = leftbit; addrl ++; } tmp = *addrl; } else if (!bit) { *addrl = tmp; bit = leftbit; addrl ++; tmp = *addrl; } } *addrl = tmp; } else { tmp = *addrl; for (;;) { tmp &= ~bit; if (!--len) break; e += e1; bit = SCRLEFT(bit,1); if (e >= 0) { *addrl = tmp; mfbScanlineInc(addrl, yinc); e += e3; if (!bit) { bit = rightbit; addrl --; } tmp = *addrl; } else if (!bit) { *addrl = tmp; bit = rightbit; addrl --; tmp = *addrl; } } *addrl = tmp; } } /* if X_AXIS */ else { if (signdx > 0) { while(len--) { *addrl &= ~bit; e += e1; if (e >= 0) { bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } e += e3; } mfbScanlineInc(addrl, yinc); } } else { while(len--) { *addrl &= ~bit; e += e1; if (e >= 0) { bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit;addrl --; } e += e3; } mfbScanlineInc(addrl, yinc); } } } /* else Y_AXIS */ } else if (rop == RROP_WHITE) { if (axis == X_AXIS) { if (signdx > 0) { tmp = *addrl; for (;;) { tmp |= bit; if (!--len) break; e += e1; bit = SCRRIGHT(bit,1); if (e >= 0) { *addrl = tmp; mfbScanlineInc(addrl, yinc); e += e3; if (!bit) { bit = leftbit; addrl ++; } tmp = *addrl; } else if (!bit) { *addrl = tmp; bit = leftbit; addrl ++; tmp = *addrl; } } *addrl = tmp; } else { tmp = *addrl; for (;;) { tmp |= bit; if (!--len) break; e += e1; bit = SCRLEFT(bit,1); if (e >= 0) { *addrl = tmp; mfbScanlineInc(addrl, yinc); e += e3; if (!bit) { bit = rightbit; addrl --; } tmp = *addrl; } else if (!bit) { *addrl = tmp; bit = rightbit; addrl --; tmp = *addrl; } } *addrl = tmp; } } /* if X_AXIS */ else { if (signdx > 0) { while(len--) { *addrl |= bit; e += e1; if (e >= 0) { bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } e += e3; } mfbScanlineInc(addrl, yinc); } } else { while(len--) { *addrl |= bit; e += e1; if (e >= 0) { bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit;addrl --; } e += e3; } mfbScanlineInc(addrl, yinc); } } } /* else Y_AXIS */ } else if (rop == RROP_INVERT) { if (axis == X_AXIS) { if (signdx > 0) { while(len--) { *addrl ^= bit; e += e1; if (e >= 0) { mfbScanlineInc(addrl, yinc); e += e3; } bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } } } else { while(len--) { *addrl ^= bit; e += e1; if (e >= 0) { mfbScanlineInc(addrl, yinc); e += e3; } bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit;addrl --; } } } } /* if X_AXIS */ else { if (signdx > 0) { while(len--) { *addrl ^= bit; e += e1; if (e >= 0) { bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } e += e3; } mfbScanlineInc(addrl, yinc); } } else { while(len--) { *addrl ^= bit; e += e1; if (e >= 0) { bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit; addrl --; } e += e3; } mfbScanlineInc(addrl, yinc); } } } /* else Y_AXIS */ } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbbstore.c0100664000076400007640000001147607120677563021617 0ustar constconst/* $XConsortium: mfbbstore.c,v 5.7 94/04/17 20:28:18 dpw Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "mfb.h" #include "X.h" #include "mibstore.h" #include "regionstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" /*- *----------------------------------------------------------------------- * mfbSaveAreas -- * Function called by miSaveAreas to actually fetch the areas to be * saved into the backing pixmap. This is very simple to do, since * mfbDoBitblt is designed for this very thing. The region to save is * already destination-relative and we're given the offset to the * window origin, so we have only to create an array of points of the * u.l. corners of the boxes in the region translated to the screen * coordinate system and fetch the screen pixmap out of its devPrivate * field.... * * Results: * None. * * Side Effects: * Data are copied from the screen into the pixmap. * *----------------------------------------------------------------------- */ void mfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin) PixmapPtr pPixmap; /* Backing pixmap */ RegionPtr prgnSave; /* Region to save (pixmap-relative) */ int xorg; /* X origin of region */ int yorg; /* Y origin of region */ WindowPtr pWin; { register DDXPointPtr pPt; DDXPointPtr pPtsInit; register BoxPtr pBox; register int numRects; numRects = REGION_NUM_RECTS(prgnSave); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec)); if (!pPtsInit) return; pBox = REGION_RECTS(prgnSave); pPt = pPtsInit; while (numRects--) { pPt->x = pBox->x1 + xorg; pPt->y = pBox->y1 + yorg; pPt++; pBox++; } mfbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivate, (DrawablePtr)pPixmap, GXcopy, prgnSave, pPtsInit); DEALLOCATE_LOCAL(pPtsInit); } /*- *----------------------------------------------------------------------- * mfbRestoreAreas -- * Function called by miRestoreAreas to actually fetch the areas to be * restored from the backing pixmap. This is very simple to do, since * mfbDoBitblt is designed for this very thing. The region to restore is * already destination-relative and we're given the offset to the * window origin, so we have only to create an array of points of the * u.l. corners of the boxes in the region translated to the pixmap * coordinate system and fetch the screen pixmap out of its devPrivate * field.... * * Results: * None. * * Side Effects: * Data are copied from the pixmap into the screen. * *----------------------------------------------------------------------- */ void mfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin) PixmapPtr pPixmap; /* Backing pixmap */ RegionPtr prgnRestore; /* Region to restore (screen-relative)*/ int xorg; /* X origin of window */ int yorg; /* Y origin of window */ WindowPtr pWin; { register DDXPointPtr pPt; DDXPointPtr pPtsInit; register BoxPtr pBox; register int numRects; numRects = REGION_NUM_RECTS(prgnRestore); pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec)); if (!pPtsInit) return; pBox = REGION_RECTS(prgnRestore); pPt = pPtsInit; while (numRects--) { pPt->x = pBox->x1 - xorg; pPt->y = pBox->y1 - yorg; pPt++; pBox++; } mfbDoBitblt((DrawablePtr)pPixmap, (DrawablePtr)pPixmap->drawable.pScreen->devPrivate, GXcopy, prgnRestore, pPtsInit); DEALLOCATE_LOCAL(pPtsInit); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbsetsp.c0100664000076400007640000002004507120677563021447 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbsetsp.c,v 5.8 94/04/17 20:28:34 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "misc.h" #include "regionstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "servermd.h" /* mfbSetScanline -- copies the bits from psrc to the drawable starting at * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc * starts on the scanline. (I.e., if this scanline passes through multiple * boxes, we may not want to start grabbing bits at psrc but at some offset * further on.) */ mfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst) int y; int xOrigin; /* where this scanline starts */ int xStart; /* first bit to use from scanline */ int xEnd; /* last bit to use from scanline + 1 */ register PixelType *psrc; register int alu; /* raster op */ PixelType *pdstBase; /* start of the drawable */ int widthDst; /* width of drawable in words */ { int w; /* width of scanline in bits */ register PixelType *pdst; /* where to put the bits */ register PixelType tmpSrc; /* scratch buffer to collect bits in */ int dstBit; /* offset in bits from beginning of * word */ register int nstart; /* number of bits from first partial */ register int nend; /* " " last partial word */ int offSrc; PixelType startmask, endmask; int nlMiddle, nl; pdst = mfbScanline(pdstBase, xStart, y, widthDst); psrc += (xStart - xOrigin) >> PWSH; offSrc = (xStart - xOrigin) & PIM; w = xEnd - xStart; dstBit = xStart & PIM; if (dstBit + w <= PPW) { getandputrop(psrc, offSrc, dstBit, w, pdst, alu) } else { maskbits(xStart, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - dstBit; else nstart = 0; if (endmask) nend = xEnd & PIM; else nend = 0; if (startmask) { getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu) pdst++; offSrc += nstart; if (offSrc > PLST) { psrc++; offSrc -= PPW; } } nl = nlMiddle; while (nl--) { getbits(psrc, offSrc, PPW, tmpSrc); DoRop(*pdst, alu, tmpSrc, *pdst); pdst++; psrc++; } if (endmask) { getandputrop0(psrc, offSrc, nend, pdst, alu); } } } /* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines * are in increasing Y order. * Source bit lines are server scanline padded so that they always begin * on a word boundary. */ void mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *pcharsrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { PixelType *psrc = (PixelType *)pcharsrc; PixelType *pdstBase; /* start of dst bitmap */ int widthDst; /* width of bitmap in words */ register BoxPtr pbox, pboxLast, pboxTest; register DDXPointPtr pptLast; int alu; RegionPtr prgnDst; int xStart, xEnd; int yMax; alu = pGC->alu; prgnDst = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; pptLast = ppt + nspans; yMax = pDrawable->y + (int) pDrawable->height; mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); pbox = REGION_RECTS(prgnDst); pboxLast = pbox + REGION_NUM_RECTS(prgnDst); if(fSorted) { /* scan lines sorted in ascending order. Because they are sorted, we * don't have to check each scanline against each clip box. We can be * sure that this scanline only has to be clipped to boxes at or after the * beginning of this y-band */ pboxTest = pbox; while(ppt < pptLast) { pbox = pboxTest; if(ppt->y >= yMax) break; while(pbox < pboxLast) { if(pbox->y1 > ppt->y) { /* scanline is before clip box */ break; } else if(pbox->y2 <= ppt->y) { /* clip box is before scanline */ pboxTest = ++pbox; continue; } else if(pbox->x1 > ppt->x + *pwidth) { /* clip box is to right of scanline */ break; } else if(pbox->x2 <= ppt->x) { /* scanline is to right of clip box */ pbox++; continue; } /* at least some of the scanline is in the current clip box */ xStart = max(pbox->x1, ppt->x); xEnd = min(ppt->x + *pwidth, pbox->x2); mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, pdstBase, widthDst); if(ppt->x + *pwidth <= pbox->x2) { /* End of the line, as it were */ break; } else pbox++; } /* We've tried this line against every box; it must be outside them * all. move on to the next point */ ppt++; psrc += PixmapWidthInPadUnits(*pwidth, 1); pwidth++; } } else { /* scan lines not sorted. We must clip each line against all the boxes */ while(ppt < pptLast) { if(ppt->y >= 0 && ppt->y < yMax) { for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) { if(pbox->y1 > ppt->y) { /* rest of clip region is above this scanline, * skip it */ break; } if(pbox->y2 <= ppt->y) { /* clip box is below scanline */ pbox++; break; } if(pbox->x1 <= ppt->x + *pwidth && pbox->x2 > ppt->x) { xStart = max(pbox->x1, ppt->x); xEnd = min(pbox->x2, ppt->x + *pwidth); mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, pdstBase, widthDst); } } } psrc += PixmapWidthInPadUnits(*pwidth, 1); ppt++; pwidth++; } } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbbresd.c0100664000076400007640000001350607120677563021414 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbbresd.c,v 1.10 94/04/17 20:28:18 dpw Exp $ */ #include "X.h" #include "misc.h" #include "mfb.h" #include "maskbits.h" #include "miline.h" /* Dashed bresenham line */ #define StepDash\ if (!--dashRemaining) { \ if (++ dashIndex == numInDashList) \ dashIndex = 0; \ dashRemaining = pDash[dashIndex]; \ rop = fgrop; \ if (dashIndex & 1) \ rop = bgrop; \ } void mfbBresD(fgrop, bgrop, pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) int fgrop, bgrop; int *pdashIndex; /* current dash */ unsigned char *pDash; /* dash list */ int numInDashList; /* total length of dash list */ int *pdashOffset; /* offset into current dash */ int isDoubleDash; PixelType *addrlbase; /* pointer to base of bitmap */ int nlwidth; /* width in longwords of bitmap */ int signdx, signdy; /* signs of directions */ int axis; /* major axis (Y_AXIS or X_AXIS) */ int x1, y1; /* initial point */ register int e; /* error accumulator */ register int e1; /* bresenham increments */ int e2; int len; /* length of line */ { register int yinc; /* increment to next scanline, in bytes */ register PixelType *addrl; register int e3 = e2-e1; register unsigned long bit; PixelType leftbit = mask[0]; /* leftmost bit to process in new word */ PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */ int dashIndex; int dashOffset; int dashRemaining; int rop; dashOffset = *pdashOffset; dashIndex = *pdashIndex; dashRemaining = pDash[dashIndex] - dashOffset; rop = fgrop; if (!isDoubleDash) bgrop = -1; if (dashIndex & 1) rop = bgrop; /* point to longword containing first point */ addrl = mfbScanline(addrlbase, x1, y1, nlwidth); yinc = signdy * nlwidth; e = e-e1; /* to make looping easier */ bit = mask[x1 & PIM]; if (axis == X_AXIS) { if (signdx > 0) { while(len--) { if (rop == RROP_BLACK) *addrl &= ~bit; else if (rop == RROP_WHITE) *addrl |= bit; else if (rop == RROP_INVERT) *addrl ^= bit; e += e1; if (e >= 0) { mfbScanlineInc(addrl, yinc); e += e3; } bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } StepDash } } else { while(len--) { if (rop == RROP_BLACK) *addrl &= ~bit; else if (rop == RROP_WHITE) *addrl |= bit; else if (rop == RROP_INVERT) *addrl ^= bit; e += e1; if (e >= 0) { mfbScanlineInc(addrl, yinc); e += e3; } bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit;addrl --; } StepDash } } } /* if X_AXIS */ else { if (signdx > 0) { while(len--) { if (rop == RROP_BLACK) *addrl &= ~bit; else if (rop == RROP_WHITE) *addrl |= bit; else if (rop == RROP_INVERT) *addrl ^= bit; e += e1; if (e >= 0) { bit = SCRRIGHT(bit,1); if (!bit) { bit = leftbit;addrl ++; } e += e3; } mfbScanlineInc(addrl, yinc); StepDash } } else { while(len--) { if (rop == RROP_BLACK) *addrl &= ~bit; else if (rop == RROP_WHITE) *addrl |= bit; else if (rop == RROP_INVERT) *addrl ^= bit; e += e1; if (e >= 0) { bit = SCRLEFT(bit,1); if (!bit) { bit = rightbit;addrl --; } e += e3; } mfbScanlineInc(addrl, yinc); StepDash } } } /* else Y_AXIS */ *pdashIndex = dashIndex; *pdashOffset = pDash[dashIndex] - dashRemaining; } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbfillrct.c0100664000076400007640000001446107120677563021755 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbfillrct.c,v 5.10 94/04/17 20:28:21 dpw Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" #include "miscstruct.h" #include "regionstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #define MODEQ(a, b) ((a) %= (b)) void mfbPaintOddSize(); /* filled rectangles. translate the rectangles, clip them, and call the helper function in the GC. */ #define NUM_STACK_RECTS 1024 void mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { xRectangle *prect; RegionPtr prgnClip; register BoxPtr pbox; register BoxPtr pboxClipped; BoxPtr pboxClippedBase; BoxPtr pextent; BoxRec stackRects[NUM_STACK_RECTS]; int numRects; int n; int xorg, yorg; mfbPrivGC *priv; int alu; void (* pfn) (); PixmapPtr ppix; if (!(pGC->planemask & 1)) return; priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; alu = priv->ropFillArea; pfn = priv->FillArea; ppix = priv->pRotatedPixmap; prgnClip = priv->pCompositeClip; prect = prectInit; xorg = pDrawable->x; yorg = pDrawable->y; if (xorg || yorg) { prect = prectInit; n = nrectFill; Duff (n, prect->x += xorg; prect->y += yorg; prect++); } prect = prectInit; numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; if (numRects > NUM_STACK_RECTS) { pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); if (!pboxClippedBase) return; } else pboxClippedBase = stackRects; pboxClipped = pboxClippedBase; if (REGION_NUM_RECTS(prgnClip) == 1) { int x1, y1, x2, y2, bx2, by2; pextent = REGION_RECTS(prgnClip); x1 = pextent->x1; y1 = pextent->y1; x2 = pextent->x2; y2 = pextent->y2; while (nrectFill--) { if ((pboxClipped->x1 = prect->x) < x1) pboxClipped->x1 = x1; if ((pboxClipped->y1 = prect->y) < y1) pboxClipped->y1 = y1; bx2 = (int) prect->x + (int) prect->width; if (bx2 > x2) bx2 = x2; pboxClipped->x2 = bx2; by2 = (int) prect->y + (int) prect->height; if (by2 > y2) by2 = y2; pboxClipped->y2 = by2; prect++; if ((pboxClipped->x1 < pboxClipped->x2) && (pboxClipped->y1 < pboxClipped->y2)) { pboxClipped++; } } } else { int x1, y1, x2, y2, bx2, by2; pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); x1 = pextent->x1; y1 = pextent->y1; x2 = pextent->x2; y2 = pextent->y2; while (nrectFill--) { BoxRec box; if ((box.x1 = prect->x) < x1) box.x1 = x1; if ((box.y1 = prect->y) < y1) box.y1 = y1; bx2 = (int) prect->x + (int) prect->width; if (bx2 > x2) bx2 = x2; box.x2 = bx2; by2 = (int) prect->y + (int) prect->height; if (by2 > y2) by2 = y2; box.y2 = by2; prect++; if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) continue; n = REGION_NUM_RECTS (prgnClip); pbox = REGION_RECTS(prgnClip); /* clip the rectangle to each box in the clip region this is logically equivalent to calling Intersect() */ while(n--) { pboxClipped->x1 = max(box.x1, pbox->x1); pboxClipped->y1 = max(box.y1, pbox->y1); pboxClipped->x2 = min(box.x2, pbox->x2); pboxClipped->y2 = min(box.y2, pbox->y2); pbox++; /* see if clipping left anything */ if(pboxClipped->x1 < pboxClipped->x2 && pboxClipped->y1 < pboxClipped->y2) { pboxClipped++; } } } } if (pboxClipped != pboxClippedBase) (*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, alu, ppix); if (pboxClippedBase != stackRects) DEALLOCATE_LOCAL(pboxClippedBase); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mergerop.h0100664000076400007640000002573507120677563021464 0ustar constconst/* * $XConsortium: mergerop.h,v 1.11 95/06/08 23:20:39 gildea Exp $ * $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.1 1996/06/29 09:10:20 dawes Exp $ * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #ifndef _MERGEROP_H_ #define _MERGEROP_H_ #ifndef GXcopy #include "X.h" #endif typedef struct _mergeRopBits { unsigned long ca1, cx1, ca2, cx2; } mergeRopRec, *mergeRopPtr; extern mergeRopRec mergeRopBits[16]; #if PPW != PGSZ /* cfb */ #define DeclareMergeRop() unsigned long _ca1, _cx1, _ca2, _cx2; #define DeclarePrebuiltMergeRop() unsigned long _cca, _ccx; #else /* mfb */ #define DeclareMergeRop() unsigned long _ca1, _cx1, _ca2, _cx2; #define DeclarePrebuiltMergeRop() unsigned long _cca, _ccx; #endif #if PPW != PGSZ /* cfb */ #define InitializeMergeRop(alu,pm) {\ unsigned long _pm; \ mergeRopPtr _bits; \ _pm = PFILL(pm); \ _bits = &mergeRopBits[alu]; \ _ca1 = _bits->ca1 & _pm; \ _cx1 = _bits->cx1 | ~_pm; \ _ca2 = _bits->ca2 & _pm; \ _cx2 = _bits->cx2 & _pm; \ } #else /* mfb */ #define InitializeMergeRop(alu,pm) {\ mergeRopPtr _bits; \ _bits = &mergeRopBits[alu]; \ _ca1 = _bits->ca1; \ _cx1 = _bits->cx1; \ _ca2 = _bits->ca2; \ _cx2 = _bits->cx2; \ } #endif /* AND has higher precedence than XOR */ #define DoMergeRop(src, dst) \ ((dst) & ((src) & _ca1 ^ _cx1) ^ ((src) & _ca2 ^ _cx2)) #define DoMergeRop24(src,dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \ ((((src) & _ca1 ^ _cx1)<>cfb24Shift[idx])&cfbmask[idx]) ^ \ ((((src) & _ca2 ^ _cx2)>>cfb24Shift[idx])&cfbmask[idx]))); \ (dst)--; \ } #define DoPrebuiltMergeRop(dst) ((dst) & _cca ^ _ccx) #define DoPrebuiltMergeRop24(dst,index) { \ register int idx = ((index) & 3)<< 1; \ *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) &\ (( _cca <>cfb24Shift[idx])&cfbmask[idx]) ^ \ (( _ccx >>cfb24Shift[idx])&cfbmask[idx]))); \ (dst)--; \ } #define DoMaskPrebuiltMergeRop(dst,mask) \ ((dst) & (_cca | ~(mask)) ^ (_ccx & (mask))) #define PrebuildMergeRop(src) ((_cca = (src) & _ca1 ^ _cx1), \ (_ccx = (src) & _ca2 ^ _cx2)) #define DoMaskMergeRop(src, dst, mask) \ ((dst) & (((src) & _ca1 ^ _cx1) | ~(mask)) ^ (((src) & _ca2 ^ _cx2) & (mask))) #define DoMaskMergeRop24(src, dst, mask, index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \ ((((((src) & _ca1 ^ _cx1) |(~mask))<>cfb24Shift[idx])&cfbmask[idx]) ^ \ (((((src) & _ca2 ^ _cx2)&(mask))>>cfb24Shift[idx])&cfbmask[idx])))); \ (dst)--; \ } #ifndef MROP #define MROP 0 #endif #define Mclear (1<> cfb24Shift[(idx)<<1])| \ ((*((pix)+1) & cfbmask[((idx)<<1)+1]) << cfb24Shift[((idx)<<1)+1])) #define MROP_SOLID24P(src,dst,sindex, index) \ MROP_SOLID24(MROP_PIXEL24(src,sindex),dst,index) #define MROP_MASK24P(src,dst,mask,sindex,index) \ MROP_MASK24(MROP_PIXEL24(src,sindex),dst,mask,index) #if (MROP) == Mcopy #define MROP_DECLARE() #define MROP_DECLARE_REG() #define MROP_INITIALIZE(alu,pm) #define MROP_SOLID(src,dst) (src) #define MROP_SOLID24(src,dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx])|(((src)<>cfb24Shift[idx])&cfbmask[idx]); \ } #define MROP_MASK(src,dst,mask) ((dst) & ~(mask) | (src) & (mask)) #define MROP_MASK24(src,dst,mask,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \ ((((src)&(mask))<>cfb24Shift[idx])&cfbmask[idx])) | \ ((((src)&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \ } #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Copy) #endif #if (MROP) == McopyInverted #define MROP_DECLARE() #define MROP_DECLARE_REG() #define MROP_INITIALIZE(alu,pm) #define MROP_SOLID(src,dst) (~(src)) #define MROP_SOLID24(src,dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx])|(((~(src))<>cfb24Shift[idx])&cfbmask[idx]); \ (dst)--; \ } #define MROP_MASK(src,dst,mask) ((dst) & ~(mask) | (~(src)) & (mask)) #define MROP_MASK24(src,dst,mask,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \ ((((~(src))&(mask))<>cfb24Shift[idx])&cfbmask[idx])) | \ ((((~(src))&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \ (dst)--; \ } #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyInverted) #endif #if (MROP) == Mxor #define MROP_DECLARE() #define MROP_DECLARE_REG() #define MROP_INITIALIZE(alu,pm) #define MROP_SOLID(src,dst) ((src) ^ (dst)) #define MROP_SOLID24(src,dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) ^= (((src)<>cfb24Shift[idx])&cfbmask[idx]); \ (dst)--; \ } #define MROP_MASK(src,dst,mask) (((src) & (mask)) ^ (dst)) #define MROP_MASK24(src,dst,mask,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) ^= ((((src)&(mask))<>cfb24Shift[idx])&cfbmask[idx]); \ (dst)--; \ } #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Xor) #endif #if (MROP) == Mor #define MROP_DECLARE() #define MROP_DECLARE_REG() #define MROP_INITIALIZE(alu,pm) #define MROP_SOLID(src,dst) ((src) | (dst)) #define MROP_SOLID24(src,dst,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) |= (((src)<>cfb24Shift[idx])&cfbmask[idx]); \ (dst)--; \ } #define MROP_MASK(src,dst,mask) (((src) & (mask)) | (dst)) #define MROP_MASK24(src,dst,mask,index) {\ register int idx = ((index) & 3)<< 1; \ *(dst) |= ((((src)&(mask))<>cfb24Shift[idx])&cfbmask[idx]); \ (dst)--; \ } #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Or) #endif #if (MROP) == (Mcopy|Mxor|MandReverse|Mor) #define MROP_DECLARE() unsigned long _ca1, _cx1; #define MROP_DECLARE_REG() register MROP_DECLARE() #define MROP_INITIALIZE(alu,pm) { \ mergeRopPtr _bits; \ _bits = &mergeRopBits[alu]; \ _ca1 = _bits->ca1; \ _cx1 = _bits->cx1; \ } #define MROP_SOLID(src,dst) \ ((dst) & ((src) & _ca1 ^ _cx1) ^ (src)) #define MROP_MASK(src,dst,mask) \ ((dst) & (((src) & _ca1 ^ _cx1) | ~(mask)) ^ ((src) & (mask))) #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyXorAndReverseOr) #define MROP_PREBUILD(src) PrebuildMergeRop(src) #define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop() #define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst) #define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index) #define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask) #define MROP_PREBUILT_MASK24(src,dst,mask,index) DoMaskPrebuiltMergeRop24(dst,mask,index) #endif #if (MROP) == 0 #define MROP_DECLARE() DeclareMergeRop() #define MROP_DECLARE_REG() register DeclareMergeRop() #define MROP_INITIALIZE(alu,pm) InitializeMergeRop(alu,pm) #define MROP_SOLID(src,dst) DoMergeRop(src,dst) #define MROP_SOLID24(src,dst,index) DoMergeRop24(src,dst,index) #define MROP_MASK(src,dst,mask) DoMaskMergeRop(src, dst, mask) #define MROP_MASK24(src,dst,mask,index) DoMaskMergeRop24(src, dst, mask,index) #define MROP_NAME(prefix) MROP_NAME_CAT(prefix,General) #define MROP_PREBUILD(src) PrebuildMergeRop(src) #define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop() #define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst) #define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index) #define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask) #define MROP_PREBUILT_MASK24(src,dst,mask,index) \ DoMaskPrebuiltMergeRop24(dst,mask,index) #endif #ifndef MROP_PREBUILD #define MROP_PREBUILD(src) #define MROP_PREBUILT_DECLARE() #define MROP_PREBUILT_SOLID(src,dst) MROP_SOLID(src,dst) #define MROP_PREBUILT_SOLID24(src,dst,index) MROP_SOLID24(src,dst,index) #define MROP_PREBUILT_MASK(src,dst,mask) MROP_MASK(src,dst,mask) #define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index) #endif #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define MROP_NAME_CAT(prefix,suffix) prefix##suffix #else #define MROP_NAME_CAT(prefix,suffix) prefix/**/suffix #endif #endif vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbpushpxl.c0100664000076400007640000002034007120677563022012 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbpushpxl.c,v 5.6 94/04/17 20:28:31 dpw Exp $ */ #include "X.h" #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "miscstruct.h" #include "maskbits.h" #include "regionstr.h" #include "mfb.h" /* mfbSolidPP is courtesy of xhacks@csri.toronto.edu For fillStyle==FillSolid, a monochrome PushPixels can be reduced to a ROP in the following way: (Note that the ROP is the same as the result of ROP(src=0x3,dst=0x5)) src=0011 0000 0011 dst=0101 0101 0101 rop fg=0 fg=1 GXclear 0x0 0000 0100 0100 0 GXand 0x1 0001 0100 0101 s&d GXandReverse 0x2 0010 0100 0110 s&~d GXcopy 0x3 0011 0100 0111 s GXandInverted 0x4 0100 0101 0100 ~s&d GXnoop 0x5 0101 0101 0101 d GXxor 0x6 0110 0101 0110 s^d GXor 0x7 0111 0101 0111 s|d GXnor 0x8 1000 0110 0100 ~s&~d GXequiv 0x9 1001 0110 0101 ~s^d GXinvert 0xa 1010 0110 0110 ~d GXorReverse 0xb 1011 0110 0111 s|~d GXcopyInverted 0xc 1100 0111 0100 ~s GXorInverted 0xd 1101 0111 0101 ~s|d GXnand 0xe 1110 0111 0110 ~s|~d GXset 0xf 1111 0111 0111 1 For src=0: newRop = 0x4|(rop>>2) For src=1: newRop = 0x4|(rop&3) */ /* mfbSolidPP -- squeegees the forground color of pGC through pBitMap * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit * is set in the bitmap, the fill style is put onto the drawable using * the GC's logical function. The drawable is not changed where the bitmap * has a zero bit or outside the area covered by the stencil. */ void mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { unsigned char alu; RegionRec rgnDst; DDXPointPtr pptSrc; BoxRec srcBox; register DDXPointPtr ppt; register BoxPtr pbox; int i; if (!pGC->planemask & 1) return; /* compute the reduced rop function */ alu = pGC->alu; if (!(pGC->fgPixel&1)) alu >>= 2; alu = (alu & 0x3) | 0x4; if (alu == GXnoop) return; srcBox.x1 = xOrg; srcBox.y1 = yOrg; srcBox.x2 = xOrg + dx; srcBox.y2 = yOrg + dy; REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1); /* clip the shape of the dst to the destination composite clip */ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); if (!REGION_NIL(&rgnDst)) { i = REGION_NUM_RECTS(&rgnDst); pptSrc = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec)); if(pptSrc) { for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc; --i >= 0; pbox++, ppt++) { ppt->x = pbox->x1 - xOrg; ppt->y = pbox->y1 - yOrg; } mfbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); } } REGION_UNINIT(pGC->pScreen, &rgnDst); } #define NPT 128 /* mfbPushPixels -- squeegees the forground color of pGC through pBitMap * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit * is set in the bitmap, the fill style is put onto the drawable using * the GC's logical function. The drawable is not changed where the bitmap * has a zero bit or outside the area covered by the stencil. */ void mfbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { int h, dxDivPPW, ibEnd; PixelType *pwLineStart; register PixelType *pw, *pwEnd; register PixelType mask; register int ib; register PixelType w; register int ipt; /* index into above arrays */ Bool fInBox; DDXPointRec pt[NPT]; int width[NPT]; /* Now scan convert the pixmap and use the result to call fillspans in * in the drawable with the original GC */ ipt = 0; dxDivPPW = dx/PPW; for(h = 0; h < dy; h++) { pw = (PixelType *) (((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind)); pwLineStart = pw; /* Process all words which are fully in the pixmap */ fInBox = FALSE; pwEnd = pwLineStart + dxDivPPW; while(pw < pwEnd) { w = *pw; mask = endtab[1]; for(ib = 0; ib < PPW; ib++) { if(w & mask) { if(!fInBox) { pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } /* end box */ fInBox = FALSE; } } mask = SCRRIGHT(mask, 1); } pw++; } ibEnd = dx & PIM; if(ibEnd) { /* Process final partial word on line */ w = *pw; mask = endtab[1]; for(ib = 0; ib < ibEnd; ib++) { if(w & mask) { if(!fInBox) { /* start new box */ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; fInBox = TRUE; } } else { if(fInBox) { /* end box */ width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } fInBox = FALSE; } } mask = SCRRIGHT(mask, 1); } } /* If scanline ended with last bit set, end the box */ if(fInBox) { width[ipt] = dx + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } } } /* Flush any remaining spans */ if (ipt) { (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbwindow.c0100664000076400007640000002443207120677563021624 0ustar constconst/* $XConsortium: mfbwindow.c,v 5.14 94/04/17 20:28:36 dpw Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "scrnintstr.h" #include "windowstr.h" #include "mfb.h" #include "mistruct.h" #include "regionstr.h" #include "maskbits.h" extern WindowPtr *WindowTable; Bool mfbCreateWindow(pWin) register WindowPtr pWin; { register mfbPrivWin *pPrivWin; pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr); pPrivWin->pRotatedBorder = NullPixmap; pPrivWin->pRotatedBackground = NullPixmap; pPrivWin->fastBackground = FALSE; pPrivWin->fastBorder = FALSE; return (TRUE); } /* This always returns true, because Xfree can't fail. It might be possible * on some devices for Destroy to fail */ Bool mfbDestroyWindow(pWin) WindowPtr pWin; { register mfbPrivWin *pPrivWin; pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr); if (pPrivWin->pRotatedBorder) (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBorder); if (pPrivWin->pRotatedBackground) (*pWin->drawable.pScreen->DestroyPixmap)(pPrivWin->pRotatedBackground); return (TRUE); } /*ARGSUSED*/ Bool mfbMapWindow(pWindow) WindowPtr pWindow; { return (TRUE); } /* (x, y) is the upper left corner of the window on the screen do we really need to pass this? (is it a;ready in pWin->absCorner?) we only do the rotation for pixmaps that are 32 bits wide (padded or otherwise.) mfbChangeWindowAttributes() has already put a copy of the pixmap in pPrivWin->pRotated* */ /*ARGSUSED*/ Bool mfbPositionWindow(pWin, x, y) register WindowPtr pWin; int x, y; { register mfbPrivWin *pPrivWin; int reset = 0; pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr); if (pWin->backgroundState == BackgroundPixmap && pPrivWin->fastBackground) { mfbXRotatePixmap(pPrivWin->pRotatedBackground, pWin->drawable.x - pPrivWin->oldRotate.x); mfbYRotatePixmap(pPrivWin->pRotatedBackground, pWin->drawable.y - pPrivWin->oldRotate.y); reset = 1; } if (!pWin->borderIsPixel && pPrivWin->fastBorder) { while (pWin->backgroundState == ParentRelative) pWin = pWin->parent; mfbXRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.x - pPrivWin->oldRotate.x); mfbYRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.y - pPrivWin->oldRotate.y); reset = 1; } if (reset) { pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } /* This is the "wrong" fix to the right problem, but it doesn't really * cost very much. When the window is moved, we need to invalidate any * RotatedPixmap that exists in any GC currently validated against this * window. */ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; /* Again, we have no failure modes indicated by any of the routines * we've called, so we have to assume it worked */ return (TRUE); } /*ARGSUSED*/ Bool mfbUnmapWindow(pWindow) WindowPtr pWindow; { return (TRUE); } /* UNCLEAN! this code calls the bitblt helper code directly. mfbCopyWindow copies only the parts of the destination that are visible in the source. */ void mfbCopyWindow(pWin, ptOldOrg, prgnSrc) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr prgnSrc; { DDXPointPtr pptSrc; register DDXPointPtr ppt; RegionPtr prgnDst; register BoxPtr pbox; register int dx, dy; register int i, nbox; WindowPtr pwinRoot; pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip, prgnSrc); pbox = REGION_RECTS(prgnDst); nbox = REGION_NUM_RECTS(prgnDst); if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) return; ppt = pptSrc; for (i=nbox; --i >= 0; ppt++, pbox++) { ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; } mfbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, GXcopy, prgnDst, pptSrc); DEALLOCATE_LOCAL(pptSrc); REGION_DESTROY(pWin->drawable.pScreen, prgnDst); } /* swap in correct PaintWindow* routine. If we can use a fast output routine (i.e. the pixmap is paddable to 32 bits), also pre-rotate a copy of it in devPrivate. */ Bool mfbChangeWindowAttributes(pWin, mask) register WindowPtr pWin; register unsigned long mask; { register unsigned long index; register mfbPrivWin *pPrivWin; WindowPtr pBgWin; pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr); /* * When background state changes from ParentRelative and * we had previously rotated the fast border pixmap to match * the parent relative origin, rerotate to match window */ if (mask & (CWBackPixmap | CWBackPixel) && pWin->backgroundState != ParentRelative && pPrivWin->fastBorder && (pPrivWin->oldRotate.x != pWin->drawable.x || pPrivWin->oldRotate.y != pWin->drawable.y)) { mfbXRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.x - pPrivWin->oldRotate.x); mfbYRotatePixmap(pPrivWin->pRotatedBorder, pWin->drawable.y - pPrivWin->oldRotate.y); pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } while(mask) { index = lowbit (mask); mask &= ~index; switch(index) { case CWBackPixmap: if (pWin->backgroundState == None) { pPrivWin->fastBackground = FALSE; } else if (pWin->backgroundState == ParentRelative) { pPrivWin->fastBackground = FALSE; /* Rotate border to match parent origin */ if (pPrivWin->pRotatedBorder) { for (pBgWin = pWin->parent; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); mfbXRotatePixmap(pPrivWin->pRotatedBorder, pBgWin->drawable.x - pPrivWin->oldRotate.x); mfbYRotatePixmap(pPrivWin->pRotatedBorder, pBgWin->drawable.y - pPrivWin->oldRotate.y); pPrivWin->oldRotate.x = pBgWin->drawable.x; pPrivWin->oldRotate.y = pBgWin->drawable.y; } } else if ((pWin->background.pixmap->drawable.width <= PPW) && !(pWin->background.pixmap->drawable.width & (pWin->background.pixmap->drawable.width - 1))) { mfbCopyRotatePixmap(pWin->background.pixmap, &pPrivWin->pRotatedBackground, pWin->drawable.x, pWin->drawable.y); if (pPrivWin->pRotatedBackground) { pPrivWin->fastBackground = TRUE; pPrivWin->oldRotate.x = pWin->drawable.x; pPrivWin->oldRotate.y = pWin->drawable.y; } else { pPrivWin->fastBackground = FALSE; } } else { pPrivWin->fastBackground = FALSE; } break; case CWBackPixel: pPrivWin->fastBackground = FALSE; break; case CWBorderPixmap: if ((pWin->border.pixmap->drawable.width <= PPW) && !(pWin->border.pixmap->drawable.width & (pWin->border.pixmap->drawable.width - 1))) { for (pBgWin = pWin; pBgWin->backgroundState == ParentRelative; pBgWin = pBgWin->parent); mfbCopyRotatePixmap(pWin->border.pixmap, &pPrivWin->pRotatedBorder, pBgWin->drawable.x, pBgWin->drawable.y); if (pPrivWin->pRotatedBorder) { pPrivWin->fastBorder = TRUE; pPrivWin->oldRotate.x = pBgWin->drawable.x; pPrivWin->oldRotate.y = pBgWin->drawable.y; } else { pPrivWin->fastBorder = FALSE; } } else { pPrivWin->fastBorder = FALSE; } break; case CWBorderPixel: pPrivWin->fastBorder = FALSE; break; } } /* Again, we have no failure modes indicated by any of the routines * we've called, so we have to assume it worked */ return (TRUE); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbfillarc.c0100664000076400007640000002044407120677563021730 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mfbfillarc.c /main/16 1995/12/06 16:54:28 dpw $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "mifillarc.h" #include "mi.h" static void mfbFillEllipseSolid(pDraw, arc, rop) DrawablePtr pDraw; xArc *arc; register int rop; { int x, y, e; int yk, xk, ym, xm, dx, dy, xorg, yorg; register int slw; miFillArcRec info; PixelType *addrlt, *addrlb; register PixelType *addrl; register int n; int nlwidth; register int xpos; PixelType startmask, endmask; int nlmiddle; mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt); miFillArcSetup(arc, &info); MIFILLARCSETUP(); xorg += pDraw->x; yorg += pDraw->y; addrlb = addrlt; addrlt += nlwidth * (yorg - y); addrlb += nlwidth * (yorg + y + dy); while (y) { addrlt += nlwidth; addrlb -= nlwidth; MIFILLARCSTEP(slw); if (!slw) continue; xpos = xorg - x; addrl = mfbScanlineOffset(addrlt, (xpos >> PWSH)); if (((xpos & PIM) + slw) < PPW) { maskpartialbits(xpos, slw, startmask); if (rop == RROP_BLACK) *addrl &= ~startmask; else if (rop == RROP_WHITE) *addrl |= startmask; else *addrl ^= startmask; if (miFillArcLower(slw)) { addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH)); if (rop == RROP_BLACK) *addrl &= ~startmask; else if (rop == RROP_WHITE) *addrl |= startmask; else *addrl ^= startmask; } continue; } maskbits(xpos, slw, startmask, endmask, nlmiddle); if (startmask) { if (rop == RROP_BLACK) *addrl++ &= ~startmask; else if (rop == RROP_WHITE) *addrl++ |= startmask; else *addrl++ ^= startmask; } n = nlmiddle; if (rop == RROP_BLACK) while (n--) *addrl++ = 0; else if (rop == RROP_WHITE) while (n--) *addrl++ = ~0; else while (n--) *addrl++ ^= ~0; if (endmask) { if (rop == RROP_BLACK) *addrl &= ~endmask; else if (rop == RROP_WHITE) *addrl |= endmask; else *addrl ^= endmask; } if (!miFillArcLower(slw)) continue; addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH)); if (startmask) { if (rop == RROP_BLACK) *addrl++ &= ~startmask; else if (rop == RROP_WHITE) *addrl++ |= startmask; else *addrl++ ^= startmask; } n = nlmiddle; if (rop == RROP_BLACK) while (n--) *addrl++ = 0; else if (rop == RROP_WHITE) while (n--) *addrl++ = ~0; else while (n--) *addrl++ ^= ~0; if (endmask) { if (rop == RROP_BLACK) *addrl &= ~endmask; else if (rop == RROP_WHITE) *addrl |= endmask; else *addrl ^= endmask; } } } #define FILLSPAN(xl,xr,addr) \ if (xr >= xl) \ { \ width = xr - xl + 1; \ addrl = mfbScanlineOffset(addr, (xl >> PWSH)); \ if (((xl & PIM) + width) < PPW) \ { \ maskpartialbits(xl, width, startmask); \ if (rop == RROP_BLACK) \ *addrl &= ~startmask; \ else if (rop == RROP_WHITE) \ *addrl |= startmask; \ else \ *addrl ^= startmask; \ } \ else \ { \ maskbits(xl, width, startmask, endmask, nlmiddle); \ if (startmask) \ { \ if (rop == RROP_BLACK) \ *addrl++ &= ~startmask; \ else if (rop == RROP_WHITE) \ *addrl++ |= startmask; \ else \ *addrl++ ^= startmask; \ } \ n = nlmiddle; \ if (rop == RROP_BLACK) \ while (n--) \ *addrl++ = 0; \ else if (rop == RROP_WHITE) \ while (n--) \ *addrl++ = ~0; \ else \ while (n--) \ *addrl++ ^= ~0; \ if (endmask) \ { \ if (rop == RROP_BLACK) \ *addrl &= ~endmask; \ else if (rop == RROP_WHITE) \ *addrl |= endmask; \ else \ *addrl ^= endmask; \ } \ } \ } #define FILLSLICESPANS(flip,addr) \ if (!flip) \ { \ FILLSPAN(xl, xr, addr); \ } \ else \ { \ xc = xorg - x; \ FILLSPAN(xc, xr, addr); \ xc += slw - 1; \ FILLSPAN(xl, xc, addr); \ } static void mfbFillArcSliceSolidCopy(pDraw, pGC, arc, rop) DrawablePtr pDraw; GCPtr pGC; xArc *arc; register int rop; { register PixelType *addrl; register int n; int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; register int x, y, e; miFillArcRec info; miArcSliceRec slice; int xl, xr, xc; PixelType *addrlt, *addrlb; int nlwidth; int width; PixelType startmask, endmask; int nlmiddle; mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt); miFillArcSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); xorg += pDraw->x; yorg += pDraw->y; addrlb = addrlt; addrlt = mfbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth); addrlb = mfbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth); slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; while (y > 0) { mfbScanlineIncNoBankSwitch(addrlt, nlwidth); mfbScanlineIncNoBankSwitch(addrlb, -nlwidth); MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { MIARCSLICEUPPER(xl, xr, slice, slw); FILLSLICESPANS(slice.flip_top, addrlt); } if (miFillSliceLower(slice)) { MIARCSLICELOWER(xl, xr, slice, slw); FILLSLICESPANS(slice.flip_bot, addrlb); } } } void mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs) register DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { mfbPrivGC *priv; register xArc *arc; register int i; BoxRec box; int x2, y2; RegionPtr cclip; int rop; priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; rop = priv->rop; if ((rop == RROP_NOP) || !(pGC->planemask & 1)) return; cclip = priv->pCompositeClip; for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miFillArcEmpty(arc)) continue; if (miCanFillArc(arc)) { box.x1 = arc->x + pDraw->x; box.y1 = arc->y + pDraw->y; /* * Because box.x2 and box.y2 get truncated to 16 bits, and the * RECT_IN_REGION test treats the resulting number as a signed * integer, the RECT_IN_REGION test alone can go the wrong way. * This can result in a server crash because the rendering * routines in this file deal directly with cpu addresses * of pixels to be stored, and do not clip or otherwise check * that all such addresses are within their respective pixmaps. * So we only allow the RECT_IN_REGION test to be used for * values that can be expressed correctly in a signed short. */ x2 = box.x1 + (int)arc->width + 1; box.x2 = x2; y2 = box.y1 + (int)arc->height + 1; box.y2 = y2; if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) { if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) mfbFillEllipseSolid(pDraw, arc, rop); else mfbFillArcSliceSolidCopy(pDraw, pGC, arc, rop); continue; } } miPolyFillArc(pDraw, pGC, 1, arc); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/fastblt.h0100664000076400007640000000657407120677563021303 0ustar constconst/* $XConsortium: fastblt.h,v 1.7 94/04/17 20:28:07 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * Fast bitblt macros for certain hardware. If your machine has an addressing * mode of small constant + register, you'll probably want this magic specific * code. It's 25% faster for the R2000. I haven't studied the Sparc * instruction set, but I suspect it also has this addressing mode. Also, * unrolling the loop by 32 is possibly excessive for mfb. The number of times * the loop is actually looped through is pretty small. */ /* * WARNING: These macros make *a lot* of assumptions about * the environment they are invoked in. Plenty of implicit * arguments, lots of side effects. Don't use them casually. */ #define SwitchOdd(n) case n: BodyOdd(n) #define SwitchEven(n) case n: BodyEven(n) /* to allow mfb and cfb to share code... */ #ifndef BitRight #define BitRight(a,b) SCRRIGHT(a,b) #define BitLeft(a,b) SCRLEFT(a,b) #endif #ifdef LARGE_INSTRUCTION_CACHE #define UNROLL 8 #define PackedLoop \ switch (nl & (UNROLL-1)) { \ SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \ SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \ } \ while ((nl -= UNROLL) >= 0) { \ LoopReset \ BodyEven( 8) \ BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \ BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \ } #else #define UNROLL 4 #define PackedLoop \ switch (nl & (UNROLL-1)) { \ SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \ } \ while ((nl -= UNROLL) >= 0) { \ LoopReset \ BodyEven( 4) \ BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \ } #endif #if PPW == 32 #define DuffL(counter,label,body) \ switch (counter & 3) { \ label: \ body \ case 3: \ body \ case 2: \ body \ case 1: \ body \ case 0: \ if ((counter -= 4) >= 0) \ goto label; \ } #else /* PPW == 64 */ #define DuffL(counter,label,body) \ switch (counter & 7) { \ label: \ body \ case 7: \ body \ case 6: \ body \ case 5: \ body \ case 4: \ body \ case 3: \ body \ case 2: \ body \ case 1: \ body \ case 0: \ if ((counter -= 8) >= 0) \ goto label; \ } #endif /* PPW */ vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbcmap.c0100664000076400007640000001437107120677563021236 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbcmap.c,v 5.6 94/04/17 20:28:19 dpw Exp $ */ #include "X.h" #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" /* A monochrome frame buffer is a static gray colormap with two entries. * We have a "required list" of length 1. Because we can only support 1 * colormap, we never have to change it, but we may have to change the * name we call it. If someone installs a new colormap, we know it must * look just like the old one (because we've checked in dispatch that it was * a valid colormap identifier, and all the colormap IDs for this device * look the same). Nevertheless, we still have to uninstall the old colormap * and install the new one. Similarly, if someone uninstalls a colormap, * we have to install the default map, even though we know those two looked * alike. * The required list concept is pretty much irrelevant when you can only * have one map installed at a time. */ static ColormapPtr InstalledMaps[MAXSCREENS]; int mfbListInstalledColormaps(pScreen, pmaps) ScreenPtr pScreen; Colormap *pmaps; { /* By the time we are processing requests, we can guarantee that there * is always a colormap installed */ *pmaps = InstalledMaps[pScreen->myNum]->mid; return (1); } void mfbInstallColormap(pmap) ColormapPtr pmap; { int index = pmap->pScreen->myNum; ColormapPtr oldpmap = InstalledMaps[index]; if(pmap != oldpmap) { /* Uninstall pInstalledMap. No hardware changes required, just * notify all interested parties. */ if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (pointer)&oldpmap->mid); /* Install pmap */ InstalledMaps[index] = pmap; WalkTree(pmap->pScreen, TellGainedMap, (pointer)&pmap->mid); } } void mfbUninstallColormap(pmap) ColormapPtr pmap; { int index = pmap->pScreen->myNum; ColormapPtr curpmap = InstalledMaps[index]; if(pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, RT_COLORMAP); (*pmap->pScreen->InstallColormap)(curpmap); } } } /*ARGSUSED*/ void mfbResolveColor (pred, pgreen, pblue, pVisual) unsigned short *pred; unsigned short *pgreen; unsigned short *pblue; VisualPtr pVisual; { /* * Gets intensity from RGB. If intensity is >= half, pick white, else * pick black. This may well be more trouble than it's worth. */ *pred = *pgreen = *pblue = (((30L * *pred + 59L * *pgreen + 11L * *pblue) >> 8) >= (((1<<8)-1)*50)) ? ~0 : 0; } Bool mfbCreateColormap(pMap) ColormapPtr pMap; { ScreenPtr pScreen; unsigned short red0, green0, blue0; unsigned short red1, green1, blue1; Pixel pix; pScreen = pMap->pScreen; if (pScreen->whitePixel == 0) { red0 = green0 = blue0 = ~0; red1 = green1 = blue1 = 0; } else { red0 = green0 = blue0 = 0; red1 = green1 = blue1 = ~0; } /* this is a monochrome colormap, it only has two entries, just fill * them in by hand. If it were a more complex static map, it would be * worth writing a for loop or three to initialize it */ /* this will be pixel 0 */ pix = 0; if (AllocColor(pMap, &red0, &green0, &blue0, &pix, 0) != Success) return FALSE; /* this will be pixel 1 */ if (AllocColor(pMap, &red1, &green1, &blue1, &pix, 0) != Success) return FALSE; return TRUE; } /*ARGSUSED*/ void mfbDestroyColormap (pMap) ColormapPtr pMap; { return; } Bool mfbCreateDefColormap (pScreen) ScreenPtr pScreen; { VisualPtr pVisual; ColormapPtr pColormap; for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; if (CreateColormap (pScreen->defColormap, pScreen, pVisual, &pColormap, AllocNone, 0) != Success) { return FALSE; } (*pScreen->InstallColormap) (pColormap); return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbtegblt.c0100664000076400007640000003256707120677563021606 0ustar constconst/* $XConsortium: mfbtegblt.c,v 5.14 94/04/17 20:28:35 dpw Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "maskbits.h" /* this works for fonts with glyphs <= PPW bits wide. This should be called only with a terminal-emulator font; this means that the FIXED_METRICS flag is set, and that glyphbounds == charbounds. in theory, this goes faster; even if it doesn't, it reduces the flicker caused by writing a string over itself with image text (since the background gets repainted per character instead of per string.) this seems to be important for some converted X10 applications. Image text looks at the bits in the glyph and the fg and bg in the GC. it paints a rectangle, as defined in the protocol dcoument, and the paints the characters. to avoid source proliferation, this file is compiled two times: MFBTEGLYPHBLT OP mfbTEGlyphBltWhite (white text, black bg ) mfbTEGlyphBltBlack ~ (black text, white bg ) */ #if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS) #define FASTCHARS #endif /* * this macro "knows" that only characters <= 8 bits wide will * fit this case (which is why it is independent of GLYPHPADBYTES) */ #if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4) #if GLYPHPADBYTES == 1 #define ShiftAmnt 24 #else #define ShiftAmnt 16 #endif /* * Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its * first argument more than once. Thus the imbedded char++ have to be moved. * (DHD) */ #if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER #if PPW == 32 #define GetBits4 c = (*char1++ << ShiftAmnt) | \ SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \ SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \ SCRRIGHT (*char4++ << ShiftAmnt, xoff4); #else /* PPW */ #define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \ (SCRRIGHT (*char2++ << ShiftAmnt, xoff2) << 32 ) | \ (SCRRIGHT (*char3++ << ShiftAmnt, xoff3) << 32 ) | \ (SCRRIGHT (*char4++ << ShiftAmnt, xoff4) << 32 ) | \ (*char5++ << ShiftAmnt) | \ SCRRIGHT (*char6++ << ShiftAmnt, xoff6) | \ SCRRIGHT (*char7++ << ShiftAmnt, xoff7) | \ SCRRIGHT (*char8++ << ShiftAmnt, xoff8); #endif /* PPW */ #else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */ #if PPW == 32 #define GetBits4 c = (*char1++ << ShiftAmnt) | \ SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \ SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \ SCRRIGHT (*char4 << ShiftAmnt, xoff4); \ char2++; char3++; char4++; #else /* PPW == 64 */ #define GetBits4 c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 ) | \ (SCRRIGHT (*char2 << ShiftAmnt, xoff2) << 32 ) | \ (SCRRIGHT (*char3 << ShiftAmnt, xoff3) << 32 ) | \ (SCRRIGHT (*char4 << ShiftAmnt, xoff4) << 32 ) | \ (*char5++ << ShiftAmnt) | \ SCRRIGHT (*char6 << ShiftAmnt, xoff6) | \ SCRRIGHT (*char7 << ShiftAmnt, xoff7) | \ SCRRIGHT (*char8 << ShiftAmnt, xoff8); \ char2++; char3++; char4++; char6++; char7++; char8++; #endif /* PPW */ #endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */ #else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */ #if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER #if PPW == 32 #define GetBits4 c = *char1++ | \ SCRRIGHT (*char2++, xoff2) | \ SCRRIGHT (*char3++, xoff3) | \ SCRRIGHT (*char4++, xoff4); #else /* PPW == 64 */ #define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \ (SCRRIGHT (*char2++, xoff2) << 64 ) | \ (SCRRIGHT (*char3++, xoff3) << 64 ) | \ (SCRRIGHT (*char4++, xoff4) << 64 ) | \ SCRRIGHT (*char5++, xoff5) | \ SCRRIGHT (*char6++, xoff6) | \ SCRRIGHT (*char7++, xoff7) | \ SCRRIGHT (*char8++, xoff8)); #endif /* PPW */ #else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */ #if PPW == 32 #define GetBits4 c = *char1++ | \ SCRRIGHT (*char2, xoff2) | \ SCRRIGHT (*char3, xoff3) | \ SCRRIGHT (*char4, xoff4); \ char2++; char3++; char4++; #else /* PPW == 64 */ #define GetBits4 c = (unsigned long)(((*char1++) << 64 ) | \ (SCRRIGHT (*char2, xoff2) << 64 ) | \ (SCRRIGHT (*char3, xoff3) << 64 ) | \ (SCRRIGHT (*char4, xoff4) << 64 ) | \ SCRRIGHT (*char5, xoff5) | \ SCRRIGHT (*char6, xoff6) | \ SCRRIGHT (*char7, xoff7) | \ SCRRIGHT (*char8, xoff8)); \ char2++; char3++; char4++; \ char5++; char6++; char7++; char8++; #endif /* PPW */ #endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */ #endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */ #if GLYPHPADBYTES == 1 typedef unsigned char *glyphPointer; #define USE_LEFTBITS #endif #if GLYPHPADBYTES == 2 typedef unsigned short *glyphPointer; #define USE_LEFTBITS #endif #if GLYPHPADBYTES == 4 typedef unsigned int *glyphPointer; #endif #ifdef USE_LEFTBITS #define GetBits1 getleftbits (char1, widthGlyph, c); \ c &= glyphMask; \ char1 = (glyphPointer) (((char *) char1) + glyphBytes); #else #define GetBits1 c = *char1++; #endif void MFBTEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { FontPtr pfont = pGC->font; int widthDst; PixelType *pdstBase; /* pointer to longword with top row of current glyph */ int h; /* height of glyph and char */ register int xpos; /* current x */ int ypos; /* current y */ int widthGlyph; int hTmp; /* counter for height */ register PixelType startmask, endmask; int nfirst; /* used if glyphs spans a longword boundary */ BoxRec bbox; /* for clipping */ int widthGlyphs; register PixelType *dst; register PixelType c; register int xoff1, xoff2, xoff3, xoff4; register glyphPointer char1, char2, char3, char4; #if PPW == 64 register int xoff5, xoff6, xoff7, xoff8; register glyphPointer char5, char6, char7, char8; #endif /* PPW */ #ifdef USE_LEFTBITS register PixelType glyphMask; register PixelType tmpSrc; register int glyphBytes; #endif if (!(pGC->planemask & 1)) return; mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); xpos = x + pDrawable->x; ypos = y + pDrawable->y; widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); h = FONTASCENT(pfont) + FONTDESCENT(pfont); xpos += FONTMAXBOUNDS(pfont,leftSideBearing); ypos -= FONTASCENT(pfont); bbox.x1 = xpos; bbox.x2 = xpos + (widthGlyph * nglyph); bbox.y1 = ypos; bbox.y2 = ypos + h; switch (RECT_IN_REGION(pGC->pScreen, ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox)) { case rgnPART: /* this is the WRONG thing to do, but it works. calling the non-terminal text is easy, but slow, given what we know about the font. the right thing to do is something like: for each clip rectangle compute at which row the glyph starts to be in it, and at which row the glyph ceases to be in it compute which is the first glyph inside the left edge, and the last one inside the right edge draw a fractional first glyph, using only the rows we know are in draw all the whole glyphs, using the appropriate rows draw any pieces of the last glyph, using the right rows this way, the code would take advantage of knowing that all glyphs are the same height and don't overlap. one day... */ CLIPTETEXT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); case rgnOUT: return; } pdstBase = mfbScanlineDeltaNoBankSwitch(pdstBase, ypos, widthDst); widthGlyphs = widthGlyph * PGSZB; #ifdef USE_LEFTBITS glyphMask = endtab[widthGlyph]; glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci); #endif if (nglyph >= PGSZB && widthGlyphs <= PPW) { while (nglyph >= PGSZB) { nglyph -= PGSZB; xoff1 = xpos & PIM; xoff2 = widthGlyph; xoff3 = xoff2 + widthGlyph; xoff4 = xoff3 + widthGlyph; #if PPW == 64 xoff5 = xoff4 + widthGlyph; xoff6 = xoff5 + widthGlyph; xoff7 = xoff6 + widthGlyph; xoff8 = xoff7 + widthGlyph; #endif /* PPW */ char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); #if PPW == 64 char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char6 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char7 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); char8 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); #endif /* PPW */ hTmp = h; dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */ #ifndef FASTCHARS if (xoff1 + widthGlyphs <= PPW) { maskpartialbits (xoff1, widthGlyphs, startmask); #endif while (hTmp--) { GetBits4 #ifdef FASTCHARS # if BITMAP_BIT_ORDER == MSBFirst c >>= PPW - widthGlyphs; # endif FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst); #else *(dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask; #endif mfbScanlineInc(dst, widthDst); } #ifndef FASTCHARS } else { maskPPWbits (xoff1, widthGlyphs, startmask, endmask); nfirst = PPW - xoff1; while (hTmp--) { GetBits4 dst[0] = dst[0] & ~startmask | OP(SCRRIGHT(c,xoff1)) & startmask; dst[1] = dst[1] & ~endmask | OP(SCRLEFT(c,nfirst)) & endmask; mfbScanlineInc(dst, widthDst); } } #endif xpos += widthGlyphs; } } while(nglyph--) { xoff1 = xpos & PIM; char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); hTmp = h; dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); #ifndef FASTCHARS if (xoff1 + widthGlyph <= PPW) { maskpartialbits (xoff1, widthGlyph, startmask); #endif while (hTmp--) { #ifdef FASTCHARS #ifdef USE_LEFTBITS FASTGETBITS (char1,0,widthGlyph,c); char1 = (glyphPointer) (((char *) char1) + glyphBytes); #else c = *char1++; #if BITMAP_BIT_ORDER == MSBFirst c >>= PPW - widthGlyph; #endif #endif FASTPUTBITS (OP(c),xoff1,widthGlyph,dst); #else GetBits1 (*dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask; #endif mfbScanlineInc(dst, widthDst); } #ifndef FASTCHARS } else { maskPPWbits (xoff1, widthGlyph, startmask, endmask); nfirst = PPW - xoff1; while (hTmp--) { GetBits1 dst[0] = dst[0] & ~startmask | OP(SCRRIGHT(c,xoff1)) & startmask; dst[1] = dst[1] & ~endmask | OP(SCRLEFT(c,nfirst)) & endmask; mfbScanlineInc(dst, widthDst); } } #endif xpos += widthGlyph; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbblt.c0100664000076400007640000003340707120677563021100 0ustar constconst/* * mfb copy area */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Keith Packard */ /* $XConsortium: mfbblt.c,v 1.11 94/04/17 20:28:16 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.0 1994/08/12 14:03:38 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "maskbits.h" #include "fastblt.h" #include "mergerop.h" void MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc) DrawablePtr pSrc, pDst; int alu; RegionPtr prgnDst; DDXPointPtr pptSrc; { PixelType *psrcBase, *pdstBase; /* start of src and dst bitmaps */ int widthSrc, widthDst; /* add to get to same position in next line */ BoxPtr pbox; int nbox; BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; /* temporaries for shuffling rectangles */ DDXPointPtr pptTmp, pptNew1, pptNew2; /* shuffling boxes entails shuffling the source points too */ int w, h; int xdir; /* 1 = left right, -1 = right left/ */ int ydir; /* 1 = top down, -1 = bottom up */ PixelType *psrcLine, *pdstLine; /* pointers to line with current src and dst */ register PixelType *psrc;/* pointer to current src longword */ register PixelType *pdst;/* pointer to current dst longword */ MROP_DECLARE_REG() /* following used for looping through a line */ PixelType startmask, endmask; /* masks for writing ends of dst */ int nlMiddle; /* whole longwords in dst */ int xoffSrc, xoffDst; register int leftShift, rightShift; register PixelType bits; register PixelType bits1; register int nl; /* temp copy of nlMiddle */ /* place to store full source word */ int nstart; /* number of ragged bits at start of dst */ int nend; /* number of ragged bits at end of dst */ int srcStartOver; /* pulling nstart bits from src overflows into the next word? */ int careful; int tmpSrc; MROP_INITIALIZE(alu,0); mfbGetPixelWidthAndPointer(pSrc, widthSrc, psrcBase); mfbGetPixelWidthAndPointer(pDst, widthDst, pdstBase); /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. */ careful = ((pSrc == pDst) || ((pSrc->type == DRAWABLE_WINDOW) && (pDst->type == DRAWABLE_WINDOW))); pbox = REGION_RECTS(prgnDst); nbox = REGION_NUM_RECTS(prgnDst); pboxNew1 = NULL; pptNew1 = NULL; pboxNew2 = NULL; pptNew2 = NULL; if (careful && (pptSrc->y < pbox->y1)) { /* walk source botttom to top */ ydir = -1; widthSrc = -widthSrc; widthDst = -widthDst; if (nbox > 1) { /* keep ordering in each band, reverse order of bands */ pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); if(!pboxNew1) return; pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if(!pptNew1) { DEALLOCATE_LOCAL(pboxNew1); return; } pboxBase = pboxNext = pbox+nbox-1; while (pboxBase >= pbox) { while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) pboxNext--; pboxTmp = pboxNext+1; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp <= pboxBase) { *pboxNew1++ = *pboxTmp++; *pptNew1++ = *pptTmp++; } pboxBase = pboxNext; } pboxNew1 -= nbox; pbox = pboxNew1; pptNew1 -= nbox; pptSrc = pptNew1; } } else { /* walk source top to bottom */ ydir = 1; } if (careful && (pptSrc->x < pbox->x1)) { /* walk source right to left */ xdir = -1; if (nbox > 1) { /* reverse order of rects in each band */ pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); if(!pboxNew2 || !pptNew2) { if (pptNew2) DEALLOCATE_LOCAL(pptNew2); if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); } return; } pboxBase = pboxNext = pbox; while (pboxBase < pbox+nbox) { while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; pptTmp = pptSrc + (pboxTmp - pbox); while (pboxTmp != pboxBase) { *pboxNew2++ = *--pboxTmp; *pptNew2++ = *--pptTmp; } pboxBase = pboxNext; } pboxNew2 -= nbox; pbox = pboxNew2; pptNew2 -= nbox; pptSrc = pptNew2; } } else { /* walk source left to right */ xdir = 1; } while(nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; if (ydir == -1) /* start at last scanline of rectangle */ { psrcLine = mfbScanlineDeltaSrc(psrcBase, -(pptSrc->y+h-1), widthSrc); pdstLine = mfbScanlineDeltaDst(pdstBase, -(pbox->y2-1), widthDst); } else /* start at first scanline */ { psrcLine = mfbScanlineDeltaSrc(psrcBase, pptSrc->y, widthSrc); pdstLine = mfbScanlineDeltaDst(pdstBase, pbox->y1, widthDst); } if ((pbox->x1 & PIM) + w <= PPW) { maskpartialbits (pbox->x1, w, startmask); endmask = 0; nlMiddle = 0; } else { maskbits(pbox->x1, w, startmask, endmask, nlMiddle); } if (xdir == 1) { xoffSrc = pptSrc->x & PIM; xoffDst = pbox->x1 & PIM; pdstLine += (pbox->x1 >> PWSH); psrcLine += (pptSrc->x >> PWSH); #ifdef DO_UNALIGNED_BITBLT nl = xoffSrc - xoffDst; psrcLine = (PixelType *) (((unsigned char *) psrcLine) + nl); #else if (xoffSrc == xoffDst) #endif { while (h--) { psrc = psrcLine; pdst = pdstLine; if (startmask) { *pdst = MROP_MASK(*psrc, *pdst, startmask); psrc++; pdst++; } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else #ifdef NOTDEF /* you'd think this would be faster -- * a single instruction instead of 6 * but measurements show it to be ~15% slower */ while ((nl -= 6) >= 0) { asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0" : "=m" (*(char *)pdst) : "m" (*(char *)psrc) : "d0", "d1", "d2", "d3", "a2", "a3"); pdst += 6; } nl += 6; while (nl--) *pdst++ = *psrc++; #endif DuffL(nl, label1, *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;) #endif if (endmask) *pdst = MROP_MASK(*psrc, *pdst, endmask); mfbScanlineIncDst(pdstLine, widthDst); mfbScanlineIncSrc(psrcLine, widthSrc); } } #ifndef DO_UNALIGNED_BITBLT else { if (xoffSrc > xoffDst) { leftShift = (xoffSrc - xoffDst); rightShift = PPW - leftShift; } else { rightShift = (xoffDst - xoffSrc); leftShift = PPW - rightShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; bits = 0; if (xoffSrc > xoffDst) bits = *psrc++; if (startmask) { bits1 = BitLeft(bits,leftShift); if (BitLeft(startmask, rightShift)) { bits = *psrc++; bits1 |= BitRight(bits,rightShift); } *pdst = MROP_MASK(bits1, *pdst, startmask); pdst++; } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc += nl & (UNROLL-1); pdst += nl & (UNROLL-1); #define BodyOdd(n) \ bits = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); #define BodyEven(n) \ bits1 = psrc[-n]; \ pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); #define LoopReset \ pdst += UNROLL; \ psrc += UNROLL; #else #define BodyOdd(n) \ bits = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ pdst++; #define BodyEven(n) \ bits1 = *psrc++; \ *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ pdst++; #define LoopReset ; #endif /* !FAST_CONSTANT_OFFSET_MODE */ PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl,label2, bits1 = BitLeft(bits, leftShift); bits = *psrc++; *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); pdst++; ) #endif if (endmask) { bits1 = BitLeft(bits, leftShift); if (BitLeft(endmask, rightShift)) { bits = *psrc; bits1 |= BitRight(bits, rightShift); } *pdst = MROP_MASK (bits1, *pdst, endmask); } mfbScanlineIncDst(pdstLine, widthDst); mfbScanlineIncSrc(psrcLine, widthSrc); } } #endif /* DO_UNALIGNED_BITBLT */ } else /* xdir == -1 */ { xoffSrc = (pptSrc->x + w - 1) & PIM; xoffDst = (pbox->x2 - 1) & PIM; pdstLine += ((pbox->x2-1) >> PWSH) + 1; psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; #ifdef DO_UNALIGNED_BITBLT nl = xoffSrc - xoffDst; psrcLine = (PixelType *) (((unsigned char *) psrcLine) + nl); #else if (xoffSrc == xoffDst) #endif { while (h--) { psrc = psrcLine; pdst = pdstLine; if (endmask) { pdst--; psrc--; *pdst = MROP_MASK (*psrc, *pdst, endmask); } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE #ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1); #define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]); #define BodyEven(n) BodyOdd(n) #define LoopReset \ pdst -= UNROLL;\ psrc -= UNROLL; #else #define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst); #define BodyEven(n) BodyOdd(n) #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL(nl,label3, --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);) #endif if (startmask) { --pdst; --psrc; *pdst = MROP_MASK(*psrc, *pdst, startmask); } mfbScanlineIncDst(pdstLine, widthDst); mfbScanlineIncSrc(psrcLine, widthSrc); } } #ifndef DO_UNALIGNED_BITBLT else { if (xoffDst > xoffSrc) { rightShift = (xoffDst - xoffSrc); leftShift = PPW - rightShift; } else { leftShift = (xoffSrc - xoffDst); rightShift = PPW - leftShift; } while (h--) { psrc = psrcLine; pdst = pdstLine; bits = 0; if (xoffDst > xoffSrc) bits = *--psrc; if (endmask) { bits1 = BitRight(bits, rightShift); if (BitRight(endmask, leftShift)) { bits = *--psrc; bits1 |= BitLeft(bits, leftShift); } pdst--; *pdst = MROP_MASK(bits1, *pdst, endmask); } nl = nlMiddle; #ifdef LARGE_INSTRUCTION_CACHE bits1 = bits; #ifdef FAST_CONSTANT_OFFSET_MODE psrc -= nl & (UNROLL - 1); pdst -= nl & (UNROLL - 1); #define BodyOdd(n) \ bits = psrc[n-1]; \ pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]); #define BodyEven(n) \ bits1 = psrc[n-1]; \ pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]); #define LoopReset \ pdst -= UNROLL; \ psrc -= UNROLL; #else #define BodyOdd(n) \ bits = *--psrc; --pdst; \ *pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst); #define BodyEven(n) \ bits1 = *--psrc; --pdst; \ *pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst); #define LoopReset ; #endif PackedLoop #undef BodyOdd #undef BodyEven #undef LoopReset #else DuffL (nl, label4, bits1 = BitRight(bits, rightShift); bits = *--psrc; --pdst; *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst); ) #endif if (startmask) { bits1 = BitRight(bits, rightShift); if (BitRight (startmask, leftShift)) { bits = *--psrc; bits1 |= BitLeft(bits, leftShift); } --pdst; *pdst = MROP_MASK(bits1, *pdst, startmask); } mfbScanlineIncDst(pdstLine, widthDst); mfbScanlineIncSrc(psrcLine, widthSrc); } } #endif } pbox++; pptSrc++; } if (pboxNew2) { DEALLOCATE_LOCAL(pptNew2); DEALLOCATE_LOCAL(pboxNew2); } if (pboxNew1) { DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbimage.c0100664000076400007640000001317507120677563021401 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbimage.c,v 5.10 94/04/17 20:28:25 dpw Exp $ */ #include "X.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "mfb.h" #include "mi.h" #include "Xmd.h" #include "maskbits.h" #include "servermd.h" /* Put and Get images on a monochrome frame buffer * * we do this by creating a temporary pixmap and making its * pointer to bits point to the buffer read in from the client. * this works because of the padding rules specified at startup * * Note that CopyArea must know how to copy a bitmap into the server-format * temporary pixmap. * * For speed, mfbPutImage should allocate the temporary pixmap on the stack. * * even though an XYBitmap and an XYPixmap have the same * format (for this device), PutImage has different semantics for the * two. XYPixmap just does the copy; XYBitmap takes gc.fgPixel for * a 1 bit, gc.bgPixel for a 0 bit, which we notice is exactly * like CopyPlane. * * written by drewry, september 1986 */ /*ARGSUSED*/ void mfbPutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pImage) DrawablePtr dst; GCPtr pGC; int depth, x, y, w, h; int leftPad; int format; char *pImage; { PixmapPtr pPixmap; if (!(pGC->planemask & 1)) return; /* 0 may confuse CreatePixmap, and will sometimes be passed by the mi text code */ if ((w == 0) || (h == 0)) return; pPixmap = GetScratchPixmapHeader(dst->pScreen, w+leftPad, h, 1, 1, BitmapBytePad(w+leftPad), (pointer)pImage); if (!pPixmap) return; ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose = FALSE; if (format != XYBitmap) (*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0, w, h, x, y); else (*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0, w, h, x, y, 1); ((mfbPrivGC*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->fExpose = TRUE; FreeScratchPixmapHeader(pPixmap); } /* * pdstLine points to space allocated by caller, which he can do since * he knows dimensions of the pixmap * we can call mfbDoBitblt because the dispatcher has promised not to send us * anything that would require going over the edge of the screen. * * XYPixmap and ZPixmap are the same for mfb. * For any planemask with bit 0 == 0, just fill the dst with 0. */ /*ARGSUSED*/ void mfbGetImage( pDrawable, sx, sy, w, h, format, planeMask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planeMask; char *pdstLine; { PixmapPtr pPixmap; BoxRec box; DDXPointRec ptSrc; RegionRec rgnDst; if (planeMask & 0x1) { ScreenPtr pScreen = pDrawable->pScreen; PixmapPtr pPixmap; pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine); if (!pPixmap) return; ptSrc.x = sx + pDrawable->x; ptSrc.y = sy + pDrawable->y; box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; REGION_INIT(pScreen, &rgnDst, &box, 1); mfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, &ptSrc); REGION_UNINIT(pScreen, &rgnDst); FreeScratchPixmapHeader(pPixmap); } else { bzero(pdstLine, BitmapBytePad(w) * h); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbclip.c0100664000076400007640000001664307120677563021251 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbclip.c,v 5.6 94/04/17 20:28:19 dpw Exp $ */ #include "X.h" #include "miscstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "regionstr.h" #include "gc.h" #include "maskbits.h" #include "mi.h" #define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ (!((reg)->data->numRects && \ ((r-1)->y1 == (ry1)) && \ ((r-1)->y2 == (ry2)) && \ ((r-1)->x1 <= (rx1)) && \ ((r-1)->x2 >= (rx2))))) \ { \ if ((reg)->data->numRects == (reg)->data->size) \ { \ miRectAlloc(reg, 1); \ fr = REGION_BOXPTR(reg); \ r = fr + (reg)->data->numRects; \ } \ r->x1 = (rx1); \ r->y1 = (ry1); \ r->x2 = (rx2); \ r->y2 = (ry2); \ (reg)->data->numRects++; \ if(r->x1 < (reg)->extents.x1) \ (reg)->extents.x1 = r->x1; \ if(r->x2 > (reg)->extents.x2) \ (reg)->extents.x2 = r->x2; \ r++; \ } /* Convert bitmap clip mask into clipping region. * First, goes through each line and makes boxes by noting the transitions * from 0 to 1 and 1 to 0. * Then it coalesces the current line with the previous if they have boxes * at the same X coordinates. */ RegionPtr mfbPixmapToRegion(pPix) PixmapPtr pPix; { register RegionPtr pReg; register PixelType *pw, w; register int ib; int width, h, base, rx1, crects; PixelType *pwLineEnd; int irectPrevStart, irectLineStart; register BoxPtr prectO, prectN; BoxPtr FirstRect, rects, prectLineStart; Bool fInBox, fSame; register PixelType mask0 = mask[0]; PixelType *pwLine; int nWidth; pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1); if(!pReg) return NullRegion; FirstRect = REGION_BOXPTR(pReg); rects = FirstRect; pwLine = (PixelType *) pPix->devPrivate.ptr; nWidth = pPix->devKind / PGSZB; width = pPix->drawable.width; pReg->extents.x1 = width - 1; pReg->extents.x2 = 0; irectPrevStart = -1; for(h = 0; h < pPix->drawable.height; h++) { pw = pwLine; pwLine += nWidth; irectLineStart = rects - FirstRect; /* If the Screen left most bit of the word is set, we're starting in * a box */ if(*pw & mask0) { fInBox = TRUE; rx1 = 0; } else fInBox = FALSE; /* Process all words which are fully in the pixmap */ pwLineEnd = pw + (width >> PWSH); for (base = 0; pw < pwLineEnd; base += PPW) { w = *pw++; if (fInBox) { if (!~w) continue; } else { if (!w) continue; } for(ib = 0; ib < PPW; ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if(w & mask0) { if(!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = SCRLEFT(w, 1); } } if(width & PIM) { /* Process final partial word on line */ w = *pw++; for(ib = 0; ib < (width & PIM); ib++) { /* If the Screen left most bit of the word is set, we're * starting a box */ if(w & mask0) { if(!fInBox) { rx1 = base + ib; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { /* end box */ ADDRECT(pReg, rects, FirstRect, rx1, h, base + ib, h + 1); fInBox = FALSE; } } /* Shift the word VISUALLY left one. */ w = SCRLEFT(w, 1); } } /* If scanline ended with last bit set, end the box */ if(fInBox) { ADDRECT(pReg, rects, FirstRect, rx1, h, base + (width & PIM), h + 1); } /* if all rectangles on this line have the same x-coords as * those on the previous line, then add 1 to all the previous y2s and * throw away all the rectangles from this line */ fSame = FALSE; if(irectPrevStart != -1) { crects = irectLineStart - irectPrevStart; if(crects == ((rects - FirstRect) - irectLineStart)) { prectO = FirstRect + irectPrevStart; prectN = prectLineStart = FirstRect + irectLineStart; fSame = TRUE; while(prectO < prectLineStart) { if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) { fSame = FALSE; break; } prectO++; prectN++; } if (fSame) { prectO = FirstRect + irectPrevStart; while(prectO < prectLineStart) { prectO->y2 += 1; prectO++; } rects -= crects; pReg->data->numRects -= crects; } } } if(!fSame) irectPrevStart = irectLineStart; } if (!pReg->data->numRects) pReg->extents.x1 = pReg->extents.x2 = 0; else { pReg->extents.y1 = REGION_BOXPTR(pReg)->y1; pReg->extents.y2 = REGION_END(pReg)->y2; if (pReg->data->numRects == 1) { xfree(pReg->data); pReg->data = (RegDataPtr)NULL; } } #ifdef DEBUG if (!miValidRegion(pReg)) FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); #endif return(pReg); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbline.c0100664000076400007640000004332007120677563021241 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbline.c,v 5.19 94/07/28 14:28:21 dpw Exp $ */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "mistruct.h" #include "mfb.h" #include "maskbits.h" #include "miline.h" /* single-pixel lines on a color frame buffer NON-SLOPED LINES horizontal lines are always drawn left to right; we have to move the endpoints right by one after they're swapped. horizontal lines will be confined to a single band of a region. the code finds that band (giving up if the lower bound of the band is above the line we're drawing); then it finds the first box in that band that contains part of the line. we clip the line to subsequent boxes in that band. vertical lines are always drawn top to bottom (y-increasing.) this requires adding one to the y-coordinate of each endpoint after swapping. SLOPED LINES when clipping a sloped line, we bring the second point inside the clipping box, rather than one beyond it, and then add 1 to the length of the line before drawing it. this lets us use the same box for finding the outcodes for both endpoints. since the equation for clipping the second endpoint to an edge gives us 1 beyond the edge, we then have to move the point towards the first point by one step on the major axis. eventually, there will be a diagram here to explain what's going on. the method uses Cohen-Sutherland outcodes to determine outsideness, and a method similar to Pike's layers for doing the actual clipping. */ void #ifdef POLYSEGMENT mfbSegmentSS (pDrawable, pGC, nseg, pSeg) DrawablePtr pDrawable; GCPtr pGC; int nseg; register xSegment *pSeg; #else mfbLineSS (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; #endif { int nboxInit; register int nbox; BoxPtr pboxInit; register BoxPtr pbox; #ifndef POLYSEGMENT register DDXPointPtr ppt; /* pointer to list of translated points */ #endif unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ PixelType *addrlBase; /* pointer to start of drawable */ PixelType *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); /* a bunch of temporaries */ register int y1, y2; register int x1, x2; RegionPtr cclip; int alu; if (!(pGC->planemask & 1)) return; cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; alu = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); xorg = pDrawable->x; yorg = pDrawable->y; #ifdef POLYSEGMENT while (nseg--) #else ppt = pptInit; x2 = ppt->x + xorg; y2 = ppt->y + yorg; while(--npt) #endif { nbox = nboxInit; pbox = pboxInit; #ifdef POLYSEGMENT x1 = pSeg->x1 + xorg; y1 = pSeg->y1 + yorg; x2 = pSeg->x2 + xorg; y2 = pSeg->y2 + yorg; pSeg++; #else x1 = x2; y1 = y2; ++ppt; if (mode == CoordModePrevious) { xorg = x1; yorg = y1; } x2 = ppt->x + xorg; y2 = ppt->y + yorg; #endif if (x1 == x2) /* vertical line */ { /* make the line go top to bottom of screen, keeping endpoint semantics */ if (y1 > y2) { register int tmp; tmp = y2; y2 = y1 + 1; y1 = tmp + 1; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) y1--; #endif } #ifdef POLYSEGMENT else if (pGC->capStyle != CapNotLast) y2++; #endif /* get to first band that might contain part of line */ while ((nbox) && (pbox->y2 <= y1)) { pbox++; nbox--; } if (nbox) { /* stop when lower edge of box is beyond end of line */ while((nbox) && (y2 >= pbox->y1)) { if ((x1 >= pbox->x1) && (x1 < pbox->x2)) { int y1t, y2t; /* this box has part of the line in it */ y1t = max(y1, pbox->y1); y2t = min(y2, pbox->y2); if (y1t != y2t) { mfbVertS (alu, addrlBase, nlwidth, x1, y1t, y2t-y1t); } } nbox--; pbox++; } } #ifndef POLYSEGMENT y2 = ppt->y + yorg; #endif } else if (y1 == y2) /* horizontal line */ { /* force line from left to right, keeping endpoint semantics */ if (x1 > x2) { register int tmp; tmp = x2; x2 = x1 + 1; x1 = tmp + 1; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) x1--; #endif } #ifdef POLYSEGMENT else if (pGC->capStyle != CapNotLast) x2++; #endif /* find the correct band */ while( (nbox) && (pbox->y2 <= y1)) { pbox++; nbox--; } /* try to draw the line, if we haven't gone beyond it */ if ((nbox) && (pbox->y1 <= y1)) { int tmp; /* when we leave this band, we're done */ tmp = pbox->y1; while((nbox) && (pbox->y1 == tmp)) { int x1t, x2t; if (pbox->x2 <= x1) { /* skip boxes until one might contain start point */ nbox--; pbox++; continue; } /* stop if left of box is beyond right of line */ if (pbox->x1 >= x2) { nbox = 0; break; } x1t = max(x1, pbox->x1); x2t = min(x2, pbox->x2); if (x1t != x2t) { mfbHorzS (alu, addrlBase, nlwidth, x1t, y1, x2t-x1t); } nbox--; pbox++; } } #ifndef POLYSEGMENT x2 = ppt->x + xorg; #endif } else /* sloped line */ { CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; SetYMajorOctant(octant); } FIXUP_ERROR(e, octant, bias); /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ while(nbox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pbox); OUTCODES(oc2, x2, y2, pbox); if ((oc1 | oc2) == 0) { if (axis == X_AXIS) len = adx; else len = ady; #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) len++; #endif mfbBresS (alu, addrlBase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len); break; } else if (oc1 & oc2) { pbox++; } else { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pbox++; continue; } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); #ifdef POLYSEGMENT if (clip2 != 0 || pGC->capStyle != CapNotLast) len++; #else len += (clip2 != 0); #endif if (len) { /* unwind bresenham error term to first point */ if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); else err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); } else err = e; mfbBresS (alu, addrlBase, nlwidth, signdx, signdy, axis, new_x1, new_y1, err, e1, e2, len); } pbox++; } } /* while (nbox--) */ } /* sloped line */ } /* while (nline--) */ #ifndef POLYSEGMENT /* paint the last point if the end style isn't CapNotLast. (Assume that a projecting, butt, or round cap that is one pixel wide is the same as the single pixel of the endpoint.) */ if ((pGC->capStyle != CapNotLast) && ((ppt->x + xorg != pptInit->x + pDrawable->x) || (ppt->y + yorg != pptInit->y + pDrawable->y) || (ppt == pptInit + 1))) { PixelType _mask; if (alu == RROP_BLACK) _mask = rmask[x2 & PIM]; else _mask = mask[x2 & PIM]; nbox = nboxInit; pbox = pboxInit; while (nbox--) { if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) && (y2 < pbox->y2)) { addrl = mfbScanline(addrlBase, x2, y2, nlwidth); switch(alu) { case RROP_BLACK: *addrl &= _mask; break; case RROP_WHITE: *addrl |= _mask; break; case RROP_INVERT: *addrl ^= _mask; break; } break; } else pbox++; } } #endif } /* * Draw dashed 1-pixel lines. */ void #ifdef POLYSEGMENT mfbSegmentSD (pDrawable, pGC, nseg, pSeg) DrawablePtr pDrawable; register GCPtr pGC; int nseg; register xSegment *pSeg; #else mfbLineSD( pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; register GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; #endif { int nboxInit; register int nbox; BoxPtr pboxInit; register BoxPtr pbox; #ifndef POLYSEGMENT register DDXPointPtr ppt; /* pointer to list of translated points */ #endif register unsigned int oc1; /* outcode of point 1 */ register unsigned int oc2; /* outcode of point 2 */ PixelType *addrl; /* address of destination pixmap */ int nlwidth; /* width in longwords of destination pixmap */ int xorg, yorg; /* origin of window */ int adx; /* abs values of dx and dy */ int ady; int signdx; /* sign of dx and dy */ int signdy; int e, e1, e2; /* bresenham error and increments */ int len; /* length of segment */ int axis; /* major axis */ int octant; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); int x1, x2, y1, y2; RegionPtr cclip; int fgrop, bgrop; unsigned char *pDash; int dashOffset; int numInDashList; int dashIndex; int isDoubleDash; int dashIndexTmp, dashOffsetTmp; int unclippedlen; if (!(pGC->planemask & 1)) return; cclip = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; fgrop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); /* compute initial dash values */ pDash = (unsigned char *) pGC->dash; numInDashList = pGC->numInDashList; isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashIndex = 0; dashOffset = 0; miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, numInDashList, &dashOffset); if (isDoubleDash) bgrop = mfbReduceRop(pGC->alu, pGC->bgPixel); xorg = pDrawable->x; yorg = pDrawable->y; #ifdef POLYSEGMENT while (nseg--) #else ppt = pptInit; x2 = ppt->x + xorg; y2 = ppt->y + yorg; while(--npt) #endif { nbox = nboxInit; pbox = pboxInit; #ifdef POLYSEGMENT x1 = pSeg->x1 + xorg; y1 = pSeg->y1 + yorg; x2 = pSeg->x2 + xorg; y2 = pSeg->y2 + yorg; pSeg++; #else x1 = x2; y1 = y2; ++ppt; if (mode == CoordModePrevious) { xorg = x1; yorg = y1; } x2 = ppt->x + xorg; y2 = ppt->y + yorg; #endif CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { axis = X_AXIS; e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; unclippedlen = adx; } else { axis = Y_AXIS; e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; unclippedlen = ady; SetYMajorOctant(octant); } FIXUP_ERROR(e, octant, bias); /* we have bresenham parameters and two points. all we have to do now is clip and draw. */ while(nbox--) { oc1 = 0; oc2 = 0; OUTCODES(oc1, x1, y1, pbox); OUTCODES(oc2, x2, y2, pbox); if ((oc1 | oc2) == 0) { #ifdef POLYSEGMENT if (pGC->capStyle != CapNotLast) unclippedlen++; dashIndexTmp = dashIndex; dashOffsetTmp = dashOffset; mfbBresD (fgrop, bgrop, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen); break; #else mfbBresD (fgrop, bgrop, &dashIndex, pDash, numInDashList, &dashOffset, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, unclippedlen); goto dontStep; #endif } else if (oc1 & oc2) { pbox++; } else /* have to clip */ { int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; int clip1 = 0, clip2 = 0; int clipdx, clipdy; int err; if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &clip1, &clip2, octant, bias, oc1, oc2) == -1) { pbox++; continue; } dashIndexTmp = dashIndex; dashOffsetTmp = dashOffset; if (clip1) { int dlen; if (axis == X_AXIS) dlen = abs(new_x1 - x1); else dlen = abs(new_y1 - y1); miStepDash (dlen, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp); } if (axis == X_AXIS) len = abs(new_x2 - new_x1); else len = abs(new_y2 - new_y1); #ifdef POLYSEGMENT if (clip2 != 0 || pGC->capStyle != CapNotLast) len++; #else len += (clip2 != 0); #endif if (len) { /* unwind bresenham error term to first point */ if (clip1) { clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); if (axis == X_AXIS) err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); else err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); } else err = e; mfbBresD (fgrop, bgrop, &dashIndexTmp, pDash, numInDashList, &dashOffsetTmp, isDoubleDash, addrl, nlwidth, signdx, signdy, axis, new_x1, new_y1, err, e1, e2, len); } pbox++; } } /* while (nbox--) */ #ifndef POLYSEGMENT /* * walk the dash list around to the next line */ miStepDash (unclippedlen, &dashIndex, pDash, numInDashList, &dashOffset); dontStep: ; #endif } /* while (nline--) */ #ifndef POLYSEGMENT /* paint the last point if the end style isn't CapNotLast. (Assume that a projecting, butt, or round cap that is one pixel wide is the same as the single pixel of the endpoint.) */ if ((pGC->capStyle != CapNotLast) && ((dashIndex & 1) == 0 || isDoubleDash) && ((ppt->x + xorg != pptInit->x + pDrawable->x) || (ppt->y + yorg != pptInit->y + pDrawable->y) || (ppt == pptInit + 1))) { nbox = nboxInit; pbox = pboxInit; while (nbox--) { if ((x2 >= pbox->x1) && (y2 >= pbox->y1) && (x2 < pbox->x2) && (y2 < pbox->y2)) { unsigned long _mask; int rop; rop = fgrop; if (dashIndex & 1) rop = bgrop; if (rop == RROP_BLACK) _mask = rmask[x2 & PIM]; else _mask = mask[x2 & PIM]; addrl = mfbScanline(addrl, x2, y2, nlwidth); if (rop == RROP_BLACK) *addrl &= _mask; else if (rop == RROP_WHITE) *addrl |= _mask; else *addrl ^= _mask; break; } else pbox++; } } #endif } vnc_unixsrc/Xvnc/programs/Xserver/mfb/maskbits.c0100664000076400007640000135561407120677563021457 0ustar constconst/* $XConsortium: maskbits.c,v 1.16 95/04/07 18:59:14 kaleb Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "maskbits.h" #include "servermd.h" /* these tables are used by several macros in the mfb code. the vax numbers everything left to right, so bit indices on the screen match bit indices in longwords. the pc-rt and Sun number bits on the screen the way they would be written on paper, (i.e. msb to the left), and so a bit index n on the screen is bit index PPW-n in a longword see also maskbits.h */ #if (BITMAP_BIT_ORDER == MSBFirst) /* NOTE: the first element in starttab could be 0xffffffff. making it 0 lets us deal with a full first word in the middle loop, rather than having to do the multiple reads and masks that we'd have to do if we thought it was partial. */ PixelType starttab[PPW+1] = { LONG2CHARS( 0x00000000 ), #if PPW == 64 LONG2CHARS( 0x7FFFFFFFFFFFFFFF ), LONG2CHARS( 0x3FFFFFFFFFFFFFFF ), LONG2CHARS( 0x1FFFFFFFFFFFFFFF ), LONG2CHARS( 0x0FFFFFFFFFFFFFFF ), LONG2CHARS( 0x07FFFFFFFFFFFFFF ), LONG2CHARS( 0x03FFFFFFFFFFFFFF ), LONG2CHARS( 0x01FFFFFFFFFFFFFF ), LONG2CHARS( 0x00FFFFFFFFFFFFFF ), LONG2CHARS( 0x007FFFFFFFFFFFFF ), LONG2CHARS( 0x003FFFFFFFFFFFFF ), LONG2CHARS( 0x001FFFFFFFFFFFFF ), LONG2CHARS( 0x000FFFFFFFFFFFFF ), LONG2CHARS( 0x0007FFFFFFFFFFFF ), LONG2CHARS( 0x0003FFFFFFFFFFFF ), LONG2CHARS( 0x0001FFFFFFFFFFFF ), LONG2CHARS( 0x0000FFFFFFFFFFFF ), LONG2CHARS( 0x00007FFFFFFFFFFF ), LONG2CHARS( 0x00003FFFFFFFFFFF ), LONG2CHARS( 0x00001FFFFFFFFFFF ), LONG2CHARS( 0x00000FFFFFFFFFFF ), LONG2CHARS( 0x000007FFFFFFFFFF ), LONG2CHARS( 0x000003FFFFFFFFFF ), LONG2CHARS( 0x000001FFFFFFFFFF ), LONG2CHARS( 0x000000FFFFFFFFFF ), LONG2CHARS( 0x0000007FFFFFFFFF ), LONG2CHARS( 0x0000003FFFFFFFFF ), LONG2CHARS( 0x0000001FFFFFFFFF ), LONG2CHARS( 0x0000000FFFFFFFFF ), LONG2CHARS( 0x00000007FFFFFFFF ), LONG2CHARS( 0x00000003FFFFFFFF ), LONG2CHARS( 0x00000001FFFFFFFF ), LONG2CHARS( 0x00000000FFFFFFFF ), #endif /* PPW == 64 */ LONG2CHARS( 0x7FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000000 ) }; PixelType endtab[PPW+1] = { #if PPW == 32 LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFFE ), LONG2CHARS( 0xFFFFFFFF ) #else /* PPW */ LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x8000000000000000 ), LONG2CHARS( 0xC000000000000000 ), LONG2CHARS( 0xE000000000000000 ), LONG2CHARS( 0xF000000000000000 ), LONG2CHARS( 0xF800000000000000 ), LONG2CHARS( 0xFC00000000000000 ), LONG2CHARS( 0xFE00000000000000 ), LONG2CHARS( 0xFF00000000000000 ), LONG2CHARS( 0xFF80000000000000 ), LONG2CHARS( 0xFFC0000000000000 ), LONG2CHARS( 0xFFE0000000000000 ), LONG2CHARS( 0xFFF0000000000000 ), LONG2CHARS( 0xFFF8000000000000 ), LONG2CHARS( 0xFFFC000000000000 ), LONG2CHARS( 0xFFFE000000000000 ), LONG2CHARS( 0xFFFF000000000000 ), LONG2CHARS( 0xFFFF800000000000 ), LONG2CHARS( 0xFFFFC00000000000 ), LONG2CHARS( 0xFFFFE00000000000 ), LONG2CHARS( 0xFFFFF00000000000 ), LONG2CHARS( 0xFFFFF80000000000 ), LONG2CHARS( 0xFFFFFC0000000000 ), LONG2CHARS( 0xFFFFFE0000000000 ), LONG2CHARS( 0xFFFFFF0000000000 ), LONG2CHARS( 0xFFFFFF8000000000 ), LONG2CHARS( 0xFFFFFFC000000000 ), LONG2CHARS( 0xFFFFFFE000000000 ), LONG2CHARS( 0xFFFFFFF000000000 ), LONG2CHARS( 0xFFFFFFF800000000 ), LONG2CHARS( 0xFFFFFFFC00000000 ), LONG2CHARS( 0xFFFFFFFE00000000 ), LONG2CHARS( 0xFFFFFFFF00000000 ), LONG2CHARS( 0xFFFFFFFF80000000 ), LONG2CHARS( 0xFFFFFFFFC0000000 ), LONG2CHARS( 0xFFFFFFFFE0000000 ), LONG2CHARS( 0xFFFFFFFFF0000000 ), LONG2CHARS( 0xFFFFFFFFF8000000 ), LONG2CHARS( 0xFFFFFFFFFC000000 ), LONG2CHARS( 0xFFFFFFFFFE000000 ), LONG2CHARS( 0xFFFFFFFFFF000000 ), LONG2CHARS( 0xFFFFFFFFFF800000 ), LONG2CHARS( 0xFFFFFFFFFFC00000 ), LONG2CHARS( 0xFFFFFFFFFFE00000 ), LONG2CHARS( 0xFFFFFFFFFFF00000 ), LONG2CHARS( 0xFFFFFFFFFFF80000 ), LONG2CHARS( 0xFFFFFFFFFFFC0000 ), LONG2CHARS( 0xFFFFFFFFFFFE0000 ), LONG2CHARS( 0xFFFFFFFFFFFF0000 ), LONG2CHARS( 0xFFFFFFFFFFFF8000 ), LONG2CHARS( 0xFFFFFFFFFFFFC000 ), LONG2CHARS( 0xFFFFFFFFFFFFE000 ), LONG2CHARS( 0xFFFFFFFFFFFFF000 ), LONG2CHARS( 0xFFFFFFFFFFFFF800 ), LONG2CHARS( 0xFFFFFFFFFFFFFC00 ), LONG2CHARS( 0xFFFFFFFFFFFFFE00 ), LONG2CHARS( 0xFFFFFFFFFFFFFF00 ), LONG2CHARS( 0xFFFFFFFFFFFFFF80 ), LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFFFFFFFFFC ), LONG2CHARS( 0xFFFFFFFFFFFFFFFE ), LONG2CHARS( 0xFFFFFFFFFFFFFFFF ) #endif /* PPW */ }; #if NEED_OLD_MFB_MASKS /* a hack, for now, since the entries for 0 need to be all 1 bits, not all zeros. this means the code DOES NOT WORK for segments of length 0 (which is only a problem in the horizontal line code.) */ PixelType startpartial[33] = { LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x7FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000000 ) }; PixelType endpartial[33] = { LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFFE ), LONG2CHARS( 0xFFFFFFFF ) }; #endif /* NEED_OLD_MFB_MASKS */ #if PPW == 32 PixelType partmasks[PPW][PPW] = { {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFFE )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0x70000000 ), LONG2CHARS( 0x78000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0x7F000000 ), LONG2CHARS( 0x7F800000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0x7FF00000 ), LONG2CHARS( 0x7FF80000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0x7FFF0000 ), LONG2CHARS( 0x7FFF8000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0x7FFFF000 ), LONG2CHARS( 0x7FFFF800 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0x7FFFFF00 ), LONG2CHARS( 0x7FFFFF80 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0x7FFFFFF0 ), LONG2CHARS( 0x7FFFFFF8 ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0x7FFFFFFF )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x38000000 ), LONG2CHARS( 0x3C000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x3F800000 ), LONG2CHARS( 0x3FC00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x3FF80000 ), LONG2CHARS( 0x3FFC0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x3FFF8000 ), LONG2CHARS( 0x3FFFC000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x3FFFF800 ), LONG2CHARS( 0x3FFFFC00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x3FFFFF80 ), LONG2CHARS( 0x3FFFFFC0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x3FFFFFF8 ), LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x1C000000 ), LONG2CHARS( 0x1E000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x1FC00000 ), LONG2CHARS( 0x1FE00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x1FFC0000 ), LONG2CHARS( 0x1FFE0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x1FFFC000 ), LONG2CHARS( 0x1FFFE000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x1FFFFC00 ), LONG2CHARS( 0x1FFFFE00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x1FFFFFC0 ), LONG2CHARS( 0x1FFFFFE0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x1FFFFFFC ), LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x0E000000 ), LONG2CHARS( 0x0F000000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x0FE00000 ), LONG2CHARS( 0x0FF00000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x0FFE0000 ), LONG2CHARS( 0x0FFF0000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x0FFFE000 ), LONG2CHARS( 0x0FFFF000 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x0FFFFE00 ), LONG2CHARS( 0x0FFFFF00 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x0FFFFFE0 ), LONG2CHARS( 0x0FFFFFF0 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x0FFFFFFE ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x07000000 ), LONG2CHARS( 0x07800000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x07F00000 ), LONG2CHARS( 0x07F80000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x07FF0000 ), LONG2CHARS( 0x07FF8000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x07FFF000 ), LONG2CHARS( 0x07FFF800 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x07FFFF00 ), LONG2CHARS( 0x07FFFF80 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x07FFFFF0 ), LONG2CHARS( 0x07FFFFF8 ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x03800000 ), LONG2CHARS( 0x03C00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x03F80000 ), LONG2CHARS( 0x03FC0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x03FF8000 ), LONG2CHARS( 0x03FFC000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x03FFF800 ), LONG2CHARS( 0x03FFFC00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x03FFFF80 ), LONG2CHARS( 0x03FFFFC0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x03FFFFF8 ), LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x01C00000 ), LONG2CHARS( 0x01E00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x01FC0000 ), LONG2CHARS( 0x01FE0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x01FFC000 ), LONG2CHARS( 0x01FFE000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x01FFFC00 ), LONG2CHARS( 0x01FFFE00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x01FFFFC0 ), LONG2CHARS( 0x01FFFFE0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x01FFFFFC ), LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x00E00000 ), LONG2CHARS( 0x00F00000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x00FE0000 ), LONG2CHARS( 0x00FF0000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x00FFE000 ), LONG2CHARS( 0x00FFF000 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x00FFFE00 ), LONG2CHARS( 0x00FFFF00 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x00FFFFE0 ), LONG2CHARS( 0x00FFFFF0 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x00FFFFFE ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00700000 ), LONG2CHARS( 0x00780000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x007F0000 ), LONG2CHARS( 0x007F8000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x007FF000 ), LONG2CHARS( 0x007FF800 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x007FFF00 ), LONG2CHARS( 0x007FFF80 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x007FFFF0 ), LONG2CHARS( 0x007FFFF8 ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00380000 ), LONG2CHARS( 0x003C0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x003F8000 ), LONG2CHARS( 0x003FC000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x003FF800 ), LONG2CHARS( 0x003FFC00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x003FFF80 ), LONG2CHARS( 0x003FFFC0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x003FFFF8 ), LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x001C0000 ), LONG2CHARS( 0x001E0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x001FC000 ), LONG2CHARS( 0x001FE000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x001FFC00 ), LONG2CHARS( 0x001FFE00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x001FFFC0 ), LONG2CHARS( 0x001FFFE0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x001FFFFC ), LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x000E0000 ), LONG2CHARS( 0x000F0000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x000FE000 ), LONG2CHARS( 0x000FF000 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x000FFE00 ), LONG2CHARS( 0x000FFF00 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x000FFFE0 ), LONG2CHARS( 0x000FFFF0 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x000FFFFE ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x00070000 ), LONG2CHARS( 0x00078000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x0007F000 ), LONG2CHARS( 0x0007F800 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x0007FF00 ), LONG2CHARS( 0x0007FF80 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x0007FFF0 ), LONG2CHARS( 0x0007FFF8 ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00038000 ), LONG2CHARS( 0x0003C000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0003F800 ), LONG2CHARS( 0x0003FC00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0003FF80 ), LONG2CHARS( 0x0003FFC0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0003FFF8 ), LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x0001C000 ), LONG2CHARS( 0x0001E000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0001FC00 ), LONG2CHARS( 0x0001FE00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0001FFC0 ), LONG2CHARS( 0x0001FFE0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0001FFFC ), LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0000E000 ), LONG2CHARS( 0x0000F000 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0000FE00 ), LONG2CHARS( 0x0000FF00 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0000FFE0 ), LONG2CHARS( 0x0000FFF0 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0000FFFE ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x00007000 ), LONG2CHARS( 0x00007800 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x00007F00 ), LONG2CHARS( 0x00007F80 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x00007FF0 ), LONG2CHARS( 0x00007FF8 ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00003800 ), LONG2CHARS( 0x00003C00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00003F80 ), LONG2CHARS( 0x00003FC0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00003FF8 ), LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00001C00 ), LONG2CHARS( 0x00001E00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00001FC0 ), LONG2CHARS( 0x00001FE0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00001FFC ), LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00000E00 ), LONG2CHARS( 0x00000F00 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00000FE0 ), LONG2CHARS( 0x00000FF0 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00000FFE ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000700 ), LONG2CHARS( 0x00000780 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x000007F0 ), LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000380 ), LONG2CHARS( 0x000003C0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000003F8 ), LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x000001C0 ), LONG2CHARS( 0x000001E0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000001FC ), LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000000E0 ), LONG2CHARS( 0x000000F0 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000000FE ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x00000070 ), LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000038 ), LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x0000001C ), LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000000E ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, }; #else /* PPW == 64 */ unsigned long partmasks[PPW][PPW] = { { LONG2CHARS( 0xFFFFFFFFFFFFFFFF ), LONG2CHARS( 0x8000000000000000 ), LONG2CHARS( 0xC000000000000000 ), LONG2CHARS( 0xE000000000000000 ), LONG2CHARS( 0xF000000000000000 ), LONG2CHARS( 0xF800000000000000 ), LONG2CHARS( 0xFC00000000000000 ), LONG2CHARS( 0xFE00000000000000 ), LONG2CHARS( 0xFF00000000000000 ), LONG2CHARS( 0xFF80000000000000 ), LONG2CHARS( 0xFFC0000000000000 ), LONG2CHARS( 0xFFE0000000000000 ), LONG2CHARS( 0xFFF0000000000000 ), LONG2CHARS( 0xFFF8000000000000 ), LONG2CHARS( 0xFFFC000000000000 ), LONG2CHARS( 0xFFFE000000000000 ), LONG2CHARS( 0xFFFF000000000000 ), LONG2CHARS( 0xFFFF800000000000 ), LONG2CHARS( 0xFFFFC00000000000 ), LONG2CHARS( 0xFFFFE00000000000 ), LONG2CHARS( 0xFFFFF00000000000 ), LONG2CHARS( 0xFFFFF80000000000 ), LONG2CHARS( 0xFFFFFC0000000000 ), LONG2CHARS( 0xFFFFFE0000000000 ), LONG2CHARS( 0xFFFFFF0000000000 ), LONG2CHARS( 0xFFFFFF8000000000 ), LONG2CHARS( 0xFFFFFFC000000000 ), LONG2CHARS( 0xFFFFFFE000000000 ), LONG2CHARS( 0xFFFFFFF000000000 ), LONG2CHARS( 0xFFFFFFF800000000 ), LONG2CHARS( 0xFFFFFFFC00000000 ), LONG2CHARS( 0xFFFFFFFE00000000 ), LONG2CHARS( 0xFFFFFFFF00000000 ), LONG2CHARS( 0xFFFFFFFF80000000 ), LONG2CHARS( 0xFFFFFFFFC0000000 ), LONG2CHARS( 0xFFFFFFFFE0000000 ), LONG2CHARS( 0xFFFFFFFFF0000000 ), LONG2CHARS( 0xFFFFFFFFF8000000 ), LONG2CHARS( 0xFFFFFFFFFC000000 ), LONG2CHARS( 0xFFFFFFFFFE000000 ), LONG2CHARS( 0xFFFFFFFFFF000000 ), LONG2CHARS( 0xFFFFFFFFFF800000 ), LONG2CHARS( 0xFFFFFFFFFFC00000 ), LONG2CHARS( 0xFFFFFFFFFFE00000 ), LONG2CHARS( 0xFFFFFFFFFFF00000 ), LONG2CHARS( 0xFFFFFFFFFFF80000 ), LONG2CHARS( 0xFFFFFFFFFFFC0000 ), LONG2CHARS( 0xFFFFFFFFFFFE0000 ), LONG2CHARS( 0xFFFFFFFFFFFF0000 ), LONG2CHARS( 0xFFFFFFFFFFFF8000 ), LONG2CHARS( 0xFFFFFFFFFFFFC000 ), LONG2CHARS( 0xFFFFFFFFFFFFE000 ), LONG2CHARS( 0xFFFFFFFFFFFFF000 ), LONG2CHARS( 0xFFFFFFFFFFFFF800 ), LONG2CHARS( 0xFFFFFFFFFFFFFC00 ), LONG2CHARS( 0xFFFFFFFFFFFFFE00 ), LONG2CHARS( 0xFFFFFFFFFFFFFF00 ), LONG2CHARS( 0xFFFFFFFFFFFFFF80 ), LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFFFFFFFFFC ), LONG2CHARS( 0xFFFFFFFFFFFFFFFE ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x4000000000000000 ), LONG2CHARS( 0x6000000000000000 ), LONG2CHARS( 0x7000000000000000 ), LONG2CHARS( 0x7800000000000000 ), LONG2CHARS( 0x7C00000000000000 ), LONG2CHARS( 0x7E00000000000000 ), LONG2CHARS( 0x7F00000000000000 ), LONG2CHARS( 0x7F80000000000000 ), LONG2CHARS( 0x7FC0000000000000 ), LONG2CHARS( 0x7FE0000000000000 ), LONG2CHARS( 0x7FF0000000000000 ), LONG2CHARS( 0x7FF8000000000000 ), LONG2CHARS( 0x7FFC000000000000 ), LONG2CHARS( 0x7FFE000000000000 ), LONG2CHARS( 0x7FFF000000000000 ), LONG2CHARS( 0x7FFF800000000000 ), LONG2CHARS( 0x7FFFC00000000000 ), LONG2CHARS( 0x7FFFE00000000000 ), LONG2CHARS( 0x7FFFF00000000000 ), LONG2CHARS( 0x7FFFF80000000000 ), LONG2CHARS( 0x7FFFFC0000000000 ), LONG2CHARS( 0x7FFFFE0000000000 ), LONG2CHARS( 0x7FFFFF0000000000 ), LONG2CHARS( 0x7FFFFF8000000000 ), LONG2CHARS( 0x7FFFFFC000000000 ), LONG2CHARS( 0x7FFFFFE000000000 ), LONG2CHARS( 0x7FFFFFF000000000 ), LONG2CHARS( 0x7FFFFFF800000000 ), LONG2CHARS( 0x7FFFFFFC00000000 ), LONG2CHARS( 0x7FFFFFFE00000000 ), LONG2CHARS( 0x7FFFFFFF00000000 ), LONG2CHARS( 0x7FFFFFFF80000000 ), LONG2CHARS( 0x7FFFFFFFC0000000 ), LONG2CHARS( 0x7FFFFFFFE0000000 ), LONG2CHARS( 0x7FFFFFFFF0000000 ), LONG2CHARS( 0x7FFFFFFFF8000000 ), LONG2CHARS( 0x7FFFFFFFFC000000 ), LONG2CHARS( 0x7FFFFFFFFE000000 ), LONG2CHARS( 0x7FFFFFFFFF000000 ), LONG2CHARS( 0x7FFFFFFFFF800000 ), LONG2CHARS( 0x7FFFFFFFFFC00000 ), LONG2CHARS( 0x7FFFFFFFFFE00000 ), LONG2CHARS( 0x7FFFFFFFFFF00000 ), LONG2CHARS( 0x7FFFFFFFFFF80000 ), LONG2CHARS( 0x7FFFFFFFFFFC0000 ), LONG2CHARS( 0x7FFFFFFFFFFE0000 ), LONG2CHARS( 0x7FFFFFFFFFFF0000 ), LONG2CHARS( 0x7FFFFFFFFFFF8000 ), LONG2CHARS( 0x7FFFFFFFFFFFC000 ), LONG2CHARS( 0x7FFFFFFFFFFFE000 ), LONG2CHARS( 0x7FFFFFFFFFFFF000 ), LONG2CHARS( 0x7FFFFFFFFFFFF800 ), LONG2CHARS( 0x7FFFFFFFFFFFFC00 ), LONG2CHARS( 0x7FFFFFFFFFFFFE00 ), LONG2CHARS( 0x7FFFFFFFFFFFFF00 ), LONG2CHARS( 0x7FFFFFFFFFFFFF80 ), LONG2CHARS( 0x7FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x7FFFFFFFFFFFFFFC ), LONG2CHARS( 0x7FFFFFFFFFFFFFFE ), LONG2CHARS( 0x7FFFFFFFFFFFFFFF ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x2000000000000000 ), LONG2CHARS( 0x3000000000000000 ), LONG2CHARS( 0x3800000000000000 ), LONG2CHARS( 0x3C00000000000000 ), LONG2CHARS( 0x3E00000000000000 ), LONG2CHARS( 0x3F00000000000000 ), LONG2CHARS( 0x3F80000000000000 ), LONG2CHARS( 0x3FC0000000000000 ), LONG2CHARS( 0x3FE0000000000000 ), LONG2CHARS( 0x3FF0000000000000 ), LONG2CHARS( 0x3FF8000000000000 ), LONG2CHARS( 0x3FFC000000000000 ), LONG2CHARS( 0x3FFE000000000000 ), LONG2CHARS( 0x3FFF000000000000 ), LONG2CHARS( 0x3FFF800000000000 ), LONG2CHARS( 0x3FFFC00000000000 ), LONG2CHARS( 0x3FFFE00000000000 ), LONG2CHARS( 0x3FFFF00000000000 ), LONG2CHARS( 0x3FFFF80000000000 ), LONG2CHARS( 0x3FFFFC0000000000 ), LONG2CHARS( 0x3FFFFE0000000000 ), LONG2CHARS( 0x3FFFFF0000000000 ), LONG2CHARS( 0x3FFFFF8000000000 ), LONG2CHARS( 0x3FFFFFC000000000 ), LONG2CHARS( 0x3FFFFFE000000000 ), LONG2CHARS( 0x3FFFFFF000000000 ), LONG2CHARS( 0x3FFFFFF800000000 ), LONG2CHARS( 0x3FFFFFFC00000000 ), LONG2CHARS( 0x3FFFFFFE00000000 ), LONG2CHARS( 0x3FFFFFFF00000000 ), LONG2CHARS( 0x3FFFFFFF80000000 ), LONG2CHARS( 0x3FFFFFFFC0000000 ), LONG2CHARS( 0x3FFFFFFFE0000000 ), LONG2CHARS( 0x3FFFFFFFF0000000 ), LONG2CHARS( 0x3FFFFFFFF8000000 ), LONG2CHARS( 0x3FFFFFFFFC000000 ), LONG2CHARS( 0x3FFFFFFFFE000000 ), LONG2CHARS( 0x3FFFFFFFFF000000 ), LONG2CHARS( 0x3FFFFFFFFF800000 ), LONG2CHARS( 0x3FFFFFFFFFC00000 ), LONG2CHARS( 0x3FFFFFFFFFE00000 ), LONG2CHARS( 0x3FFFFFFFFFF00000 ), LONG2CHARS( 0x3FFFFFFFFFF80000 ), LONG2CHARS( 0x3FFFFFFFFFFC0000 ), LONG2CHARS( 0x3FFFFFFFFFFE0000 ), LONG2CHARS( 0x3FFFFFFFFFFF0000 ), LONG2CHARS( 0x3FFFFFFFFFFF8000 ), LONG2CHARS( 0x3FFFFFFFFFFFC000 ), LONG2CHARS( 0x3FFFFFFFFFFFE000 ), LONG2CHARS( 0x3FFFFFFFFFFFF000 ), LONG2CHARS( 0x3FFFFFFFFFFFF800 ), LONG2CHARS( 0x3FFFFFFFFFFFFC00 ), LONG2CHARS( 0x3FFFFFFFFFFFFE00 ), LONG2CHARS( 0x3FFFFFFFFFFFFF00 ), LONG2CHARS( 0x3FFFFFFFFFFFFF80 ), LONG2CHARS( 0x3FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x3FFFFFFFFFFFFFFC ), LONG2CHARS( 0x3FFFFFFFFFFFFFFE ), LONG2CHARS( 0x3FFFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x1000000000000000 ), LONG2CHARS( 0x1800000000000000 ), LONG2CHARS( 0x1C00000000000000 ), LONG2CHARS( 0x1E00000000000000 ), LONG2CHARS( 0x1F00000000000000 ), LONG2CHARS( 0x1F80000000000000 ), LONG2CHARS( 0x1FC0000000000000 ), LONG2CHARS( 0x1FE0000000000000 ), LONG2CHARS( 0x1FF0000000000000 ), LONG2CHARS( 0x1FF8000000000000 ), LONG2CHARS( 0x1FFC000000000000 ), LONG2CHARS( 0x1FFE000000000000 ), LONG2CHARS( 0x1FFF000000000000 ), LONG2CHARS( 0x1FFF800000000000 ), LONG2CHARS( 0x1FFFC00000000000 ), LONG2CHARS( 0x1FFFE00000000000 ), LONG2CHARS( 0x1FFFF00000000000 ), LONG2CHARS( 0x1FFFF80000000000 ), LONG2CHARS( 0x1FFFFC0000000000 ), LONG2CHARS( 0x1FFFFE0000000000 ), LONG2CHARS( 0x1FFFFF0000000000 ), LONG2CHARS( 0x1FFFFF8000000000 ), LONG2CHARS( 0x1FFFFFC000000000 ), LONG2CHARS( 0x1FFFFFE000000000 ), LONG2CHARS( 0x1FFFFFF000000000 ), LONG2CHARS( 0x1FFFFFF800000000 ), LONG2CHARS( 0x1FFFFFFC00000000 ), LONG2CHARS( 0x1FFFFFFE00000000 ), LONG2CHARS( 0x1FFFFFFF00000000 ), LONG2CHARS( 0x1FFFFFFF80000000 ), LONG2CHARS( 0x1FFFFFFFC0000000 ), LONG2CHARS( 0x1FFFFFFFE0000000 ), LONG2CHARS( 0x1FFFFFFFF0000000 ), LONG2CHARS( 0x1FFFFFFFF8000000 ), LONG2CHARS( 0x1FFFFFFFFC000000 ), LONG2CHARS( 0x1FFFFFFFFE000000 ), LONG2CHARS( 0x1FFFFFFFFF000000 ), LONG2CHARS( 0x1FFFFFFFFF800000 ), LONG2CHARS( 0x1FFFFFFFFFC00000 ), LONG2CHARS( 0x1FFFFFFFFFE00000 ), LONG2CHARS( 0x1FFFFFFFFFF00000 ), LONG2CHARS( 0x1FFFFFFFFFF80000 ), LONG2CHARS( 0x1FFFFFFFFFFC0000 ), LONG2CHARS( 0x1FFFFFFFFFFE0000 ), LONG2CHARS( 0x1FFFFFFFFFFF0000 ), LONG2CHARS( 0x1FFFFFFFFFFF8000 ), LONG2CHARS( 0x1FFFFFFFFFFFC000 ), LONG2CHARS( 0x1FFFFFFFFFFFE000 ), LONG2CHARS( 0x1FFFFFFFFFFFF000 ), LONG2CHARS( 0x1FFFFFFFFFFFF800 ), LONG2CHARS( 0x1FFFFFFFFFFFFC00 ), LONG2CHARS( 0x1FFFFFFFFFFFFE00 ), LONG2CHARS( 0x1FFFFFFFFFFFFF00 ), LONG2CHARS( 0x1FFFFFFFFFFFFF80 ), LONG2CHARS( 0x1FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x1FFFFFFFFFFFFFFC ), LONG2CHARS( 0x1FFFFFFFFFFFFFFE ), LONG2CHARS( 0x1FFFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0800000000000000 ), LONG2CHARS( 0x0C00000000000000 ), LONG2CHARS( 0x0E00000000000000 ), LONG2CHARS( 0x0F00000000000000 ), LONG2CHARS( 0x0F80000000000000 ), LONG2CHARS( 0x0FC0000000000000 ), LONG2CHARS( 0x0FE0000000000000 ), LONG2CHARS( 0x0FF0000000000000 ), LONG2CHARS( 0x0FF8000000000000 ), LONG2CHARS( 0x0FFC000000000000 ), LONG2CHARS( 0x0FFE000000000000 ), LONG2CHARS( 0x0FFF000000000000 ), LONG2CHARS( 0x0FFF800000000000 ), LONG2CHARS( 0x0FFFC00000000000 ), LONG2CHARS( 0x0FFFE00000000000 ), LONG2CHARS( 0x0FFFF00000000000 ), LONG2CHARS( 0x0FFFF80000000000 ), LONG2CHARS( 0x0FFFFC0000000000 ), LONG2CHARS( 0x0FFFFE0000000000 ), LONG2CHARS( 0x0FFFFF0000000000 ), LONG2CHARS( 0x0FFFFF8000000000 ), LONG2CHARS( 0x0FFFFFC000000000 ), LONG2CHARS( 0x0FFFFFE000000000 ), LONG2CHARS( 0x0FFFFFF000000000 ), LONG2CHARS( 0x0FFFFFF800000000 ), LONG2CHARS( 0x0FFFFFFC00000000 ), LONG2CHARS( 0x0FFFFFFE00000000 ), LONG2CHARS( 0x0FFFFFFF00000000 ), LONG2CHARS( 0x0FFFFFFF80000000 ), LONG2CHARS( 0x0FFFFFFFC0000000 ), LONG2CHARS( 0x0FFFFFFFE0000000 ), LONG2CHARS( 0x0FFFFFFFF0000000 ), LONG2CHARS( 0x0FFFFFFFF8000000 ), LONG2CHARS( 0x0FFFFFFFFC000000 ), LONG2CHARS( 0x0FFFFFFFFE000000 ), LONG2CHARS( 0x0FFFFFFFFF000000 ), LONG2CHARS( 0x0FFFFFFFFF800000 ), LONG2CHARS( 0x0FFFFFFFFFC00000 ), LONG2CHARS( 0x0FFFFFFFFFE00000 ), LONG2CHARS( 0x0FFFFFFFFFF00000 ), LONG2CHARS( 0x0FFFFFFFFFF80000 ), LONG2CHARS( 0x0FFFFFFFFFFC0000 ), LONG2CHARS( 0x0FFFFFFFFFFE0000 ), LONG2CHARS( 0x0FFFFFFFFFFF0000 ), LONG2CHARS( 0x0FFFFFFFFFFF8000 ), LONG2CHARS( 0x0FFFFFFFFFFFC000 ), LONG2CHARS( 0x0FFFFFFFFFFFE000 ), LONG2CHARS( 0x0FFFFFFFFFFFF000 ), LONG2CHARS( 0x0FFFFFFFFFFFF800 ), LONG2CHARS( 0x0FFFFFFFFFFFFC00 ), LONG2CHARS( 0x0FFFFFFFFFFFFE00 ), LONG2CHARS( 0x0FFFFFFFFFFFFF00 ), LONG2CHARS( 0x0FFFFFFFFFFFFF80 ), LONG2CHARS( 0x0FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x0FFFFFFFFFFFFFFC ), LONG2CHARS( 0x0FFFFFFFFFFFFFFE ), LONG2CHARS( 0x0FFFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0400000000000000 ), LONG2CHARS( 0x0600000000000000 ), LONG2CHARS( 0x0700000000000000 ), LONG2CHARS( 0x0780000000000000 ), LONG2CHARS( 0x07C0000000000000 ), LONG2CHARS( 0x07E0000000000000 ), LONG2CHARS( 0x07F0000000000000 ), LONG2CHARS( 0x07F8000000000000 ), LONG2CHARS( 0x07FC000000000000 ), LONG2CHARS( 0x07FE000000000000 ), LONG2CHARS( 0x07FF000000000000 ), LONG2CHARS( 0x07FF800000000000 ), LONG2CHARS( 0x07FFC00000000000 ), LONG2CHARS( 0x07FFE00000000000 ), LONG2CHARS( 0x07FFF00000000000 ), LONG2CHARS( 0x07FFF80000000000 ), LONG2CHARS( 0x07FFFC0000000000 ), LONG2CHARS( 0x07FFFE0000000000 ), LONG2CHARS( 0x07FFFF0000000000 ), LONG2CHARS( 0x07FFFF8000000000 ), LONG2CHARS( 0x07FFFFC000000000 ), LONG2CHARS( 0x07FFFFE000000000 ), LONG2CHARS( 0x07FFFFF000000000 ), LONG2CHARS( 0x07FFFFF800000000 ), LONG2CHARS( 0x07FFFFFC00000000 ), LONG2CHARS( 0x07FFFFFE00000000 ), LONG2CHARS( 0x07FFFFFF00000000 ), LONG2CHARS( 0x07FFFFFF80000000 ), LONG2CHARS( 0x07FFFFFFC0000000 ), LONG2CHARS( 0x07FFFFFFE0000000 ), LONG2CHARS( 0x07FFFFFFF0000000 ), LONG2CHARS( 0x07FFFFFFF8000000 ), LONG2CHARS( 0x07FFFFFFFC000000 ), LONG2CHARS( 0x07FFFFFFFE000000 ), LONG2CHARS( 0x07FFFFFFFF000000 ), LONG2CHARS( 0x07FFFFFFFF800000 ), LONG2CHARS( 0x07FFFFFFFFC00000 ), LONG2CHARS( 0x07FFFFFFFFE00000 ), LONG2CHARS( 0x07FFFFFFFFF00000 ), LONG2CHARS( 0x07FFFFFFFFF80000 ), LONG2CHARS( 0x07FFFFFFFFFC0000 ), LONG2CHARS( 0x07FFFFFFFFFE0000 ), LONG2CHARS( 0x07FFFFFFFFFF0000 ), LONG2CHARS( 0x07FFFFFFFFFF8000 ), LONG2CHARS( 0x07FFFFFFFFFFC000 ), LONG2CHARS( 0x07FFFFFFFFFFE000 ), LONG2CHARS( 0x07FFFFFFFFFFF000 ), LONG2CHARS( 0x07FFFFFFFFFFF800 ), LONG2CHARS( 0x07FFFFFFFFFFFC00 ), LONG2CHARS( 0x07FFFFFFFFFFFE00 ), LONG2CHARS( 0x07FFFFFFFFFFFF00 ), LONG2CHARS( 0x07FFFFFFFFFFFF80 ), LONG2CHARS( 0x07FFFFFFFFFFFFC0 ), LONG2CHARS( 0x07FFFFFFFFFFFFE0 ), LONG2CHARS( 0x07FFFFFFFFFFFFF0 ), LONG2CHARS( 0x07FFFFFFFFFFFFF8 ), LONG2CHARS( 0x07FFFFFFFFFFFFFC ), LONG2CHARS( 0x07FFFFFFFFFFFFFE ), LONG2CHARS( 0x07FFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0200000000000000 ), LONG2CHARS( 0x0300000000000000 ), LONG2CHARS( 0x0380000000000000 ), LONG2CHARS( 0x03C0000000000000 ), LONG2CHARS( 0x03E0000000000000 ), LONG2CHARS( 0x03F0000000000000 ), LONG2CHARS( 0x03F8000000000000 ), LONG2CHARS( 0x03FC000000000000 ), LONG2CHARS( 0x03FE000000000000 ), LONG2CHARS( 0x03FF000000000000 ), LONG2CHARS( 0x03FF800000000000 ), LONG2CHARS( 0x03FFC00000000000 ), LONG2CHARS( 0x03FFE00000000000 ), LONG2CHARS( 0x03FFF00000000000 ), LONG2CHARS( 0x03FFF80000000000 ), LONG2CHARS( 0x03FFFC0000000000 ), LONG2CHARS( 0x03FFFE0000000000 ), LONG2CHARS( 0x03FFFF0000000000 ), LONG2CHARS( 0x03FFFF8000000000 ), LONG2CHARS( 0x03FFFFC000000000 ), LONG2CHARS( 0x03FFFFE000000000 ), LONG2CHARS( 0x03FFFFF000000000 ), LONG2CHARS( 0x03FFFFF800000000 ), LONG2CHARS( 0x03FFFFFC00000000 ), LONG2CHARS( 0x03FFFFFE00000000 ), LONG2CHARS( 0x03FFFFFF00000000 ), LONG2CHARS( 0x03FFFFFF80000000 ), LONG2CHARS( 0x03FFFFFFC0000000 ), LONG2CHARS( 0x03FFFFFFE0000000 ), LONG2CHARS( 0x03FFFFFFF0000000 ), LONG2CHARS( 0x03FFFFFFF8000000 ), LONG2CHARS( 0x03FFFFFFFC000000 ), LONG2CHARS( 0x03FFFFFFFE000000 ), LONG2CHARS( 0x03FFFFFFFF000000 ), LONG2CHARS( 0x03FFFFFFFF800000 ), LONG2CHARS( 0x03FFFFFFFFC00000 ), LONG2CHARS( 0x03FFFFFFFFE00000 ), LONG2CHARS( 0x03FFFFFFFFF00000 ), LONG2CHARS( 0x03FFFFFFFFF80000 ), LONG2CHARS( 0x03FFFFFFFFFC0000 ), LONG2CHARS( 0x03FFFFFFFFFE0000 ), LONG2CHARS( 0x03FFFFFFFFFF0000 ), LONG2CHARS( 0x03FFFFFFFFFF8000 ), LONG2CHARS( 0x03FFFFFFFFFFC000 ), LONG2CHARS( 0x03FFFFFFFFFFE000 ), LONG2CHARS( 0x03FFFFFFFFFFF000 ), LONG2CHARS( 0x03FFFFFFFFFFF800 ), LONG2CHARS( 0x03FFFFFFFFFFFC00 ), LONG2CHARS( 0x03FFFFFFFFFFFE00 ), LONG2CHARS( 0x03FFFFFFFFFFFF00 ), LONG2CHARS( 0x03FFFFFFFFFFFF80 ), LONG2CHARS( 0x03FFFFFFFFFFFFC0 ), LONG2CHARS( 0x03FFFFFFFFFFFFE0 ), LONG2CHARS( 0x03FFFFFFFFFFFFF0 ), LONG2CHARS( 0x03FFFFFFFFFFFFF8 ), LONG2CHARS( 0x03FFFFFFFFFFFFFC ), LONG2CHARS( 0x03FFFFFFFFFFFFFE ), LONG2CHARS( 0x03FFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0100000000000000 ), LONG2CHARS( 0x0180000000000000 ), LONG2CHARS( 0x01C0000000000000 ), LONG2CHARS( 0x01E0000000000000 ), LONG2CHARS( 0x01F0000000000000 ), LONG2CHARS( 0x01F8000000000000 ), LONG2CHARS( 0x01FC000000000000 ), LONG2CHARS( 0x01FE000000000000 ), LONG2CHARS( 0x01FF000000000000 ), LONG2CHARS( 0x01FF800000000000 ), LONG2CHARS( 0x01FFC00000000000 ), LONG2CHARS( 0x01FFE00000000000 ), LONG2CHARS( 0x01FFF00000000000 ), LONG2CHARS( 0x01FFF80000000000 ), LONG2CHARS( 0x01FFFC0000000000 ), LONG2CHARS( 0x01FFFE0000000000 ), LONG2CHARS( 0x01FFFF0000000000 ), LONG2CHARS( 0x01FFFF8000000000 ), LONG2CHARS( 0x01FFFFC000000000 ), LONG2CHARS( 0x01FFFFE000000000 ), LONG2CHARS( 0x01FFFFF000000000 ), LONG2CHARS( 0x01FFFFF800000000 ), LONG2CHARS( 0x01FFFFFC00000000 ), LONG2CHARS( 0x01FFFFFE00000000 ), LONG2CHARS( 0x01FFFFFF00000000 ), LONG2CHARS( 0x01FFFFFF80000000 ), LONG2CHARS( 0x01FFFFFFC0000000 ), LONG2CHARS( 0x01FFFFFFE0000000 ), LONG2CHARS( 0x01FFFFFFF0000000 ), LONG2CHARS( 0x01FFFFFFF8000000 ), LONG2CHARS( 0x01FFFFFFFC000000 ), LONG2CHARS( 0x01FFFFFFFE000000 ), LONG2CHARS( 0x01FFFFFFFF000000 ), LONG2CHARS( 0x01FFFFFFFF800000 ), LONG2CHARS( 0x01FFFFFFFFC00000 ), LONG2CHARS( 0x01FFFFFFFFE00000 ), LONG2CHARS( 0x01FFFFFFFFF00000 ), LONG2CHARS( 0x01FFFFFFFFF80000 ), LONG2CHARS( 0x01FFFFFFFFFC0000 ), LONG2CHARS( 0x01FFFFFFFFFE0000 ), LONG2CHARS( 0x01FFFFFFFFFF0000 ), LONG2CHARS( 0x01FFFFFFFFFF8000 ), LONG2CHARS( 0x01FFFFFFFFFFC000 ), LONG2CHARS( 0x01FFFFFFFFFFE000 ), LONG2CHARS( 0x01FFFFFFFFFFF000 ), LONG2CHARS( 0x01FFFFFFFFFFF800 ), LONG2CHARS( 0x01FFFFFFFFFFFC00 ), LONG2CHARS( 0x01FFFFFFFFFFFE00 ), LONG2CHARS( 0x01FFFFFFFFFFFF00 ), LONG2CHARS( 0x01FFFFFFFFFFFF80 ), LONG2CHARS( 0x01FFFFFFFFFFFFC0 ), LONG2CHARS( 0x01FFFFFFFFFFFFE0 ), LONG2CHARS( 0x01FFFFFFFFFFFFF0 ), LONG2CHARS( 0x01FFFFFFFFFFFFF8 ), LONG2CHARS( 0x01FFFFFFFFFFFFFC ), LONG2CHARS( 0x01FFFFFFFFFFFFFE ), LONG2CHARS( 0x01FFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0080000000000000 ), LONG2CHARS( 0x00C0000000000000 ), LONG2CHARS( 0x00E0000000000000 ), LONG2CHARS( 0x00F0000000000000 ), LONG2CHARS( 0x00F8000000000000 ), LONG2CHARS( 0x00FC000000000000 ), LONG2CHARS( 0x00FE000000000000 ), LONG2CHARS( 0x00FF000000000000 ), LONG2CHARS( 0x00FF800000000000 ), LONG2CHARS( 0x00FFC00000000000 ), LONG2CHARS( 0x00FFE00000000000 ), LONG2CHARS( 0x00FFF00000000000 ), LONG2CHARS( 0x00FFF80000000000 ), LONG2CHARS( 0x00FFFC0000000000 ), LONG2CHARS( 0x00FFFE0000000000 ), LONG2CHARS( 0x00FFFF0000000000 ), LONG2CHARS( 0x00FFFF8000000000 ), LONG2CHARS( 0x00FFFFC000000000 ), LONG2CHARS( 0x00FFFFE000000000 ), LONG2CHARS( 0x00FFFFF000000000 ), LONG2CHARS( 0x00FFFFF800000000 ), LONG2CHARS( 0x00FFFFFC00000000 ), LONG2CHARS( 0x00FFFFFE00000000 ), LONG2CHARS( 0x00FFFFFF00000000 ), LONG2CHARS( 0x00FFFFFF80000000 ), LONG2CHARS( 0x00FFFFFFC0000000 ), LONG2CHARS( 0x00FFFFFFE0000000 ), LONG2CHARS( 0x00FFFFFFF0000000 ), LONG2CHARS( 0x00FFFFFFF8000000 ), LONG2CHARS( 0x00FFFFFFFC000000 ), LONG2CHARS( 0x00FFFFFFFE000000 ), LONG2CHARS( 0x00FFFFFFFF000000 ), LONG2CHARS( 0x00FFFFFFFF800000 ), LONG2CHARS( 0x00FFFFFFFFC00000 ), LONG2CHARS( 0x00FFFFFFFFE00000 ), LONG2CHARS( 0x00FFFFFFFFF00000 ), LONG2CHARS( 0x00FFFFFFFFF80000 ), LONG2CHARS( 0x00FFFFFFFFFC0000 ), LONG2CHARS( 0x00FFFFFFFFFE0000 ), LONG2CHARS( 0x00FFFFFFFFFF0000 ), LONG2CHARS( 0x00FFFFFFFFFF8000 ), LONG2CHARS( 0x00FFFFFFFFFFC000 ), LONG2CHARS( 0x00FFFFFFFFFFE000 ), LONG2CHARS( 0x00FFFFFFFFFFF000 ), LONG2CHARS( 0x00FFFFFFFFFFF800 ), LONG2CHARS( 0x00FFFFFFFFFFFC00 ), LONG2CHARS( 0x00FFFFFFFFFFFE00 ), LONG2CHARS( 0x00FFFFFFFFFFFF00 ), LONG2CHARS( 0x00FFFFFFFFFFFF80 ), LONG2CHARS( 0x00FFFFFFFFFFFFC0 ), LONG2CHARS( 0x00FFFFFFFFFFFFE0 ), LONG2CHARS( 0x00FFFFFFFFFFFFF0 ), LONG2CHARS( 0x00FFFFFFFFFFFFF8 ), LONG2CHARS( 0x00FFFFFFFFFFFFFC ), LONG2CHARS( 0x00FFFFFFFFFFFFFE ), LONG2CHARS( 0x00FFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0040000000000000 ), LONG2CHARS( 0x0060000000000000 ), LONG2CHARS( 0x0070000000000000 ), LONG2CHARS( 0x0078000000000000 ), LONG2CHARS( 0x007C000000000000 ), LONG2CHARS( 0x007E000000000000 ), LONG2CHARS( 0x007F000000000000 ), LONG2CHARS( 0x007F800000000000 ), LONG2CHARS( 0x007FC00000000000 ), LONG2CHARS( 0x007FE00000000000 ), LONG2CHARS( 0x007FF00000000000 ), LONG2CHARS( 0x007FF80000000000 ), LONG2CHARS( 0x007FFC0000000000 ), LONG2CHARS( 0x007FFE0000000000 ), LONG2CHARS( 0x007FFF0000000000 ), LONG2CHARS( 0x007FFF8000000000 ), LONG2CHARS( 0x007FFFC000000000 ), LONG2CHARS( 0x007FFFE000000000 ), LONG2CHARS( 0x007FFFF000000000 ), LONG2CHARS( 0x007FFFF800000000 ), LONG2CHARS( 0x007FFFFC00000000 ), LONG2CHARS( 0x007FFFFE00000000 ), LONG2CHARS( 0x007FFFFF00000000 ), LONG2CHARS( 0x007FFFFF80000000 ), LONG2CHARS( 0x007FFFFFC0000000 ), LONG2CHARS( 0x007FFFFFE0000000 ), LONG2CHARS( 0x007FFFFFF0000000 ), LONG2CHARS( 0x007FFFFFF8000000 ), LONG2CHARS( 0x007FFFFFFC000000 ), LONG2CHARS( 0x007FFFFFFE000000 ), LONG2CHARS( 0x007FFFFFFF000000 ), LONG2CHARS( 0x007FFFFFFF800000 ), LONG2CHARS( 0x007FFFFFFFC00000 ), LONG2CHARS( 0x007FFFFFFFE00000 ), LONG2CHARS( 0x007FFFFFFFF00000 ), LONG2CHARS( 0x007FFFFFFFF80000 ), LONG2CHARS( 0x007FFFFFFFFC0000 ), LONG2CHARS( 0x007FFFFFFFFE0000 ), LONG2CHARS( 0x007FFFFFFFFF0000 ), LONG2CHARS( 0x007FFFFFFFFF8000 ), LONG2CHARS( 0x007FFFFFFFFFC000 ), LONG2CHARS( 0x007FFFFFFFFFE000 ), LONG2CHARS( 0x007FFFFFFFFFF000 ), LONG2CHARS( 0x007FFFFFFFFFF800 ), LONG2CHARS( 0x007FFFFFFFFFFC00 ), LONG2CHARS( 0x007FFFFFFFFFFE00 ), LONG2CHARS( 0x007FFFFFFFFFFF00 ), LONG2CHARS( 0x007FFFFFFFFFFF80 ), LONG2CHARS( 0x007FFFFFFFFFFFC0 ), LONG2CHARS( 0x007FFFFFFFFFFFE0 ), LONG2CHARS( 0x007FFFFFFFFFFFF0 ), LONG2CHARS( 0x007FFFFFFFFFFFF8 ), LONG2CHARS( 0x007FFFFFFFFFFFFC ), LONG2CHARS( 0x007FFFFFFFFFFFFE ), LONG2CHARS( 0x007FFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0020000000000000 ), LONG2CHARS( 0x0030000000000000 ), LONG2CHARS( 0x0038000000000000 ), LONG2CHARS( 0x003C000000000000 ), LONG2CHARS( 0x003E000000000000 ), LONG2CHARS( 0x003F000000000000 ), LONG2CHARS( 0x003F800000000000 ), LONG2CHARS( 0x003FC00000000000 ), LONG2CHARS( 0x003FE00000000000 ), LONG2CHARS( 0x003FF00000000000 ), LONG2CHARS( 0x003FF80000000000 ), LONG2CHARS( 0x003FFC0000000000 ), LONG2CHARS( 0x003FFE0000000000 ), LONG2CHARS( 0x003FFF0000000000 ), LONG2CHARS( 0x003FFF8000000000 ), LONG2CHARS( 0x003FFFC000000000 ), LONG2CHARS( 0x003FFFE000000000 ), LONG2CHARS( 0x003FFFF000000000 ), LONG2CHARS( 0x003FFFF800000000 ), LONG2CHARS( 0x003FFFFC00000000 ), LONG2CHARS( 0x003FFFFE00000000 ), LONG2CHARS( 0x003FFFFF00000000 ), LONG2CHARS( 0x003FFFFF80000000 ), LONG2CHARS( 0x003FFFFFC0000000 ), LONG2CHARS( 0x003FFFFFE0000000 ), LONG2CHARS( 0x003FFFFFF0000000 ), LONG2CHARS( 0x003FFFFFF8000000 ), LONG2CHARS( 0x003FFFFFFC000000 ), LONG2CHARS( 0x003FFFFFFE000000 ), LONG2CHARS( 0x003FFFFFFF000000 ), LONG2CHARS( 0x003FFFFFFF800000 ), LONG2CHARS( 0x003FFFFFFFC00000 ), LONG2CHARS( 0x003FFFFFFFE00000 ), LONG2CHARS( 0x003FFFFFFFF00000 ), LONG2CHARS( 0x003FFFFFFFF80000 ), LONG2CHARS( 0x003FFFFFFFFC0000 ), LONG2CHARS( 0x003FFFFFFFFE0000 ), LONG2CHARS( 0x003FFFFFFFFF0000 ), LONG2CHARS( 0x003FFFFFFFFF8000 ), LONG2CHARS( 0x003FFFFFFFFFC000 ), LONG2CHARS( 0x003FFFFFFFFFE000 ), LONG2CHARS( 0x003FFFFFFFFFF000 ), LONG2CHARS( 0x003FFFFFFFFFF800 ), LONG2CHARS( 0x003FFFFFFFFFFC00 ), LONG2CHARS( 0x003FFFFFFFFFFE00 ), LONG2CHARS( 0x003FFFFFFFFFFF00 ), LONG2CHARS( 0x003FFFFFFFFFFF80 ), LONG2CHARS( 0x003FFFFFFFFFFFC0 ), LONG2CHARS( 0x003FFFFFFFFFFFE0 ), LONG2CHARS( 0x003FFFFFFFFFFFF0 ), LONG2CHARS( 0x003FFFFFFFFFFFF8 ), LONG2CHARS( 0x003FFFFFFFFFFFFC ), LONG2CHARS( 0x003FFFFFFFFFFFFE ), LONG2CHARS( 0x003FFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0010000000000000 ), LONG2CHARS( 0x0018000000000000 ), LONG2CHARS( 0x001C000000000000 ), LONG2CHARS( 0x001E000000000000 ), LONG2CHARS( 0x001F000000000000 ), LONG2CHARS( 0x001F800000000000 ), LONG2CHARS( 0x001FC00000000000 ), LONG2CHARS( 0x001FE00000000000 ), LONG2CHARS( 0x001FF00000000000 ), LONG2CHARS( 0x001FF80000000000 ), LONG2CHARS( 0x001FFC0000000000 ), LONG2CHARS( 0x001FFE0000000000 ), LONG2CHARS( 0x001FFF0000000000 ), LONG2CHARS( 0x001FFF8000000000 ), LONG2CHARS( 0x001FFFC000000000 ), LONG2CHARS( 0x001FFFE000000000 ), LONG2CHARS( 0x001FFFF000000000 ), LONG2CHARS( 0x001FFFF800000000 ), LONG2CHARS( 0x001FFFFC00000000 ), LONG2CHARS( 0x001FFFFE00000000 ), LONG2CHARS( 0x001FFFFF00000000 ), LONG2CHARS( 0x001FFFFF80000000 ), LONG2CHARS( 0x001FFFFFC0000000 ), LONG2CHARS( 0x001FFFFFE0000000 ), LONG2CHARS( 0x001FFFFFF0000000 ), LONG2CHARS( 0x001FFFFFF8000000 ), LONG2CHARS( 0x001FFFFFFC000000 ), LONG2CHARS( 0x001FFFFFFE000000 ), LONG2CHARS( 0x001FFFFFFF000000 ), LONG2CHARS( 0x001FFFFFFF800000 ), LONG2CHARS( 0x001FFFFFFFC00000 ), LONG2CHARS( 0x001FFFFFFFE00000 ), LONG2CHARS( 0x001FFFFFFFF00000 ), LONG2CHARS( 0x001FFFFFFFF80000 ), LONG2CHARS( 0x001FFFFFFFFC0000 ), LONG2CHARS( 0x001FFFFFFFFE0000 ), LONG2CHARS( 0x001FFFFFFFFF0000 ), LONG2CHARS( 0x001FFFFFFFFF8000 ), LONG2CHARS( 0x001FFFFFFFFFC000 ), LONG2CHARS( 0x001FFFFFFFFFE000 ), LONG2CHARS( 0x001FFFFFFFFFF000 ), LONG2CHARS( 0x001FFFFFFFFFF800 ), LONG2CHARS( 0x001FFFFFFFFFFC00 ), LONG2CHARS( 0x001FFFFFFFFFFE00 ), LONG2CHARS( 0x001FFFFFFFFFFF00 ), LONG2CHARS( 0x001FFFFFFFFFFF80 ), LONG2CHARS( 0x001FFFFFFFFFFFC0 ), LONG2CHARS( 0x001FFFFFFFFFFFE0 ), LONG2CHARS( 0x001FFFFFFFFFFFF0 ), LONG2CHARS( 0x001FFFFFFFFFFFF8 ), LONG2CHARS( 0x001FFFFFFFFFFFFC ), LONG2CHARS( 0x001FFFFFFFFFFFFE ), LONG2CHARS( 0x001FFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0008000000000000 ), LONG2CHARS( 0x000C000000000000 ), LONG2CHARS( 0x000E000000000000 ), LONG2CHARS( 0x000F000000000000 ), LONG2CHARS( 0x000F800000000000 ), LONG2CHARS( 0x000FC00000000000 ), LONG2CHARS( 0x000FE00000000000 ), LONG2CHARS( 0x000FF00000000000 ), LONG2CHARS( 0x000FF80000000000 ), LONG2CHARS( 0x000FFC0000000000 ), LONG2CHARS( 0x000FFE0000000000 ), LONG2CHARS( 0x000FFF0000000000 ), LONG2CHARS( 0x000FFF8000000000 ), LONG2CHARS( 0x000FFFC000000000 ), LONG2CHARS( 0x000FFFE000000000 ), LONG2CHARS( 0x000FFFF000000000 ), LONG2CHARS( 0x000FFFF800000000 ), LONG2CHARS( 0x000FFFFC00000000 ), LONG2CHARS( 0x000FFFFE00000000 ), LONG2CHARS( 0x000FFFFF00000000 ), LONG2CHARS( 0x000FFFFF80000000 ), LONG2CHARS( 0x000FFFFFC0000000 ), LONG2CHARS( 0x000FFFFFE0000000 ), LONG2CHARS( 0x000FFFFFF0000000 ), LONG2CHARS( 0x000FFFFFF8000000 ), LONG2CHARS( 0x000FFFFFFC000000 ), LONG2CHARS( 0x000FFFFFFE000000 ), LONG2CHARS( 0x000FFFFFFF000000 ), LONG2CHARS( 0x000FFFFFFF800000 ), LONG2CHARS( 0x000FFFFFFFC00000 ), LONG2CHARS( 0x000FFFFFFFE00000 ), LONG2CHARS( 0x000FFFFFFFF00000 ), LONG2CHARS( 0x000FFFFFFFF80000 ), LONG2CHARS( 0x000FFFFFFFFC0000 ), LONG2CHARS( 0x000FFFFFFFFE0000 ), LONG2CHARS( 0x000FFFFFFFFF0000 ), LONG2CHARS( 0x000FFFFFFFFF8000 ), LONG2CHARS( 0x000FFFFFFFFFC000 ), LONG2CHARS( 0x000FFFFFFFFFE000 ), LONG2CHARS( 0x000FFFFFFFFFF000 ), LONG2CHARS( 0x000FFFFFFFFFF800 ), LONG2CHARS( 0x000FFFFFFFFFFC00 ), LONG2CHARS( 0x000FFFFFFFFFFE00 ), LONG2CHARS( 0x000FFFFFFFFFFF00 ), LONG2CHARS( 0x000FFFFFFFFFFF80 ), LONG2CHARS( 0x000FFFFFFFFFFFC0 ), LONG2CHARS( 0x000FFFFFFFFFFFE0 ), LONG2CHARS( 0x000FFFFFFFFFFFF0 ), LONG2CHARS( 0x000FFFFFFFFFFFF8 ), LONG2CHARS( 0x000FFFFFFFFFFFFC ), LONG2CHARS( 0x000FFFFFFFFFFFFE ), LONG2CHARS( 0x000FFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0004000000000000 ), LONG2CHARS( 0x0006000000000000 ), LONG2CHARS( 0x0007000000000000 ), LONG2CHARS( 0x0007800000000000 ), LONG2CHARS( 0x0007C00000000000 ), LONG2CHARS( 0x0007E00000000000 ), LONG2CHARS( 0x0007F00000000000 ), LONG2CHARS( 0x0007F80000000000 ), LONG2CHARS( 0x0007FC0000000000 ), LONG2CHARS( 0x0007FE0000000000 ), LONG2CHARS( 0x0007FF0000000000 ), LONG2CHARS( 0x0007FF8000000000 ), LONG2CHARS( 0x0007FFC000000000 ), LONG2CHARS( 0x0007FFE000000000 ), LONG2CHARS( 0x0007FFF000000000 ), LONG2CHARS( 0x0007FFF800000000 ), LONG2CHARS( 0x0007FFFC00000000 ), LONG2CHARS( 0x0007FFFE00000000 ), LONG2CHARS( 0x0007FFFF00000000 ), LONG2CHARS( 0x0007FFFF80000000 ), LONG2CHARS( 0x0007FFFFC0000000 ), LONG2CHARS( 0x0007FFFFE0000000 ), LONG2CHARS( 0x0007FFFFF0000000 ), LONG2CHARS( 0x0007FFFFF8000000 ), LONG2CHARS( 0x0007FFFFFC000000 ), LONG2CHARS( 0x0007FFFFFE000000 ), LONG2CHARS( 0x0007FFFFFF000000 ), LONG2CHARS( 0x0007FFFFFF800000 ), LONG2CHARS( 0x0007FFFFFFC00000 ), LONG2CHARS( 0x0007FFFFFFE00000 ), LONG2CHARS( 0x0007FFFFFFF00000 ), LONG2CHARS( 0x0007FFFFFFF80000 ), LONG2CHARS( 0x0007FFFFFFFC0000 ), LONG2CHARS( 0x0007FFFFFFFE0000 ), LONG2CHARS( 0x0007FFFFFFFF0000 ), LONG2CHARS( 0x0007FFFFFFFF8000 ), LONG2CHARS( 0x0007FFFFFFFFC000 ), LONG2CHARS( 0x0007FFFFFFFFE000 ), LONG2CHARS( 0x0007FFFFFFFFF000 ), LONG2CHARS( 0x0007FFFFFFFFF800 ), LONG2CHARS( 0x0007FFFFFFFFFC00 ), LONG2CHARS( 0x0007FFFFFFFFFE00 ), LONG2CHARS( 0x0007FFFFFFFFFF00 ), LONG2CHARS( 0x0007FFFFFFFFFF80 ), LONG2CHARS( 0x0007FFFFFFFFFFC0 ), LONG2CHARS( 0x0007FFFFFFFFFFE0 ), LONG2CHARS( 0x0007FFFFFFFFFFF0 ), LONG2CHARS( 0x0007FFFFFFFFFFF8 ), LONG2CHARS( 0x0007FFFFFFFFFFFC ), LONG2CHARS( 0x0007FFFFFFFFFFFE ), LONG2CHARS( 0x0007FFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0002000000000000 ), LONG2CHARS( 0x0003000000000000 ), LONG2CHARS( 0x0003800000000000 ), LONG2CHARS( 0x0003C00000000000 ), LONG2CHARS( 0x0003E00000000000 ), LONG2CHARS( 0x0003F00000000000 ), LONG2CHARS( 0x0003F80000000000 ), LONG2CHARS( 0x0003FC0000000000 ), LONG2CHARS( 0x0003FE0000000000 ), LONG2CHARS( 0x0003FF0000000000 ), LONG2CHARS( 0x0003FF8000000000 ), LONG2CHARS( 0x0003FFC000000000 ), LONG2CHARS( 0x0003FFE000000000 ), LONG2CHARS( 0x0003FFF000000000 ), LONG2CHARS( 0x0003FFF800000000 ), LONG2CHARS( 0x0003FFFC00000000 ), LONG2CHARS( 0x0003FFFE00000000 ), LONG2CHARS( 0x0003FFFF00000000 ), LONG2CHARS( 0x0003FFFF80000000 ), LONG2CHARS( 0x0003FFFFC0000000 ), LONG2CHARS( 0x0003FFFFE0000000 ), LONG2CHARS( 0x0003FFFFF0000000 ), LONG2CHARS( 0x0003FFFFF8000000 ), LONG2CHARS( 0x0003FFFFFC000000 ), LONG2CHARS( 0x0003FFFFFE000000 ), LONG2CHARS( 0x0003FFFFFF000000 ), LONG2CHARS( 0x0003FFFFFF800000 ), LONG2CHARS( 0x0003FFFFFFC00000 ), LONG2CHARS( 0x0003FFFFFFE00000 ), LONG2CHARS( 0x0003FFFFFFF00000 ), LONG2CHARS( 0x0003FFFFFFF80000 ), LONG2CHARS( 0x0003FFFFFFFC0000 ), LONG2CHARS( 0x0003FFFFFFFE0000 ), LONG2CHARS( 0x0003FFFFFFFF0000 ), LONG2CHARS( 0x0003FFFFFFFF8000 ), LONG2CHARS( 0x0003FFFFFFFFC000 ), LONG2CHARS( 0x0003FFFFFFFFE000 ), LONG2CHARS( 0x0003FFFFFFFFF000 ), LONG2CHARS( 0x0003FFFFFFFFF800 ), LONG2CHARS( 0x0003FFFFFFFFFC00 ), LONG2CHARS( 0x0003FFFFFFFFFE00 ), LONG2CHARS( 0x0003FFFFFFFFFF00 ), LONG2CHARS( 0x0003FFFFFFFFFF80 ), LONG2CHARS( 0x0003FFFFFFFFFFC0 ), LONG2CHARS( 0x0003FFFFFFFFFFE0 ), LONG2CHARS( 0x0003FFFFFFFFFFF0 ), LONG2CHARS( 0x0003FFFFFFFFFFF8 ), LONG2CHARS( 0x0003FFFFFFFFFFFC ), LONG2CHARS( 0x0003FFFFFFFFFFFE ), LONG2CHARS( 0x0003FFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0001000000000000 ), LONG2CHARS( 0x0001800000000000 ), LONG2CHARS( 0x0001C00000000000 ), LONG2CHARS( 0x0001E00000000000 ), LONG2CHARS( 0x0001F00000000000 ), LONG2CHARS( 0x0001F80000000000 ), LONG2CHARS( 0x0001FC0000000000 ), LONG2CHARS( 0x0001FE0000000000 ), LONG2CHARS( 0x0001FF0000000000 ), LONG2CHARS( 0x0001FF8000000000 ), LONG2CHARS( 0x0001FFC000000000 ), LONG2CHARS( 0x0001FFE000000000 ), LONG2CHARS( 0x0001FFF000000000 ), LONG2CHARS( 0x0001FFF800000000 ), LONG2CHARS( 0x0001FFFC00000000 ), LONG2CHARS( 0x0001FFFE00000000 ), LONG2CHARS( 0x0001FFFF00000000 ), LONG2CHARS( 0x0001FFFF80000000 ), LONG2CHARS( 0x0001FFFFC0000000 ), LONG2CHARS( 0x0001FFFFE0000000 ), LONG2CHARS( 0x0001FFFFF0000000 ), LONG2CHARS( 0x0001FFFFF8000000 ), LONG2CHARS( 0x0001FFFFFC000000 ), LONG2CHARS( 0x0001FFFFFE000000 ), LONG2CHARS( 0x0001FFFFFF000000 ), LONG2CHARS( 0x0001FFFFFF800000 ), LONG2CHARS( 0x0001FFFFFFC00000 ), LONG2CHARS( 0x0001FFFFFFE00000 ), LONG2CHARS( 0x0001FFFFFFF00000 ), LONG2CHARS( 0x0001FFFFFFF80000 ), LONG2CHARS( 0x0001FFFFFFFC0000 ), LONG2CHARS( 0x0001FFFFFFFE0000 ), LONG2CHARS( 0x0001FFFFFFFF0000 ), LONG2CHARS( 0x0001FFFFFFFF8000 ), LONG2CHARS( 0x0001FFFFFFFFC000 ), LONG2CHARS( 0x0001FFFFFFFFE000 ), LONG2CHARS( 0x0001FFFFFFFFF000 ), LONG2CHARS( 0x0001FFFFFFFFF800 ), LONG2CHARS( 0x0001FFFFFFFFFC00 ), LONG2CHARS( 0x0001FFFFFFFFFE00 ), LONG2CHARS( 0x0001FFFFFFFFFF00 ), LONG2CHARS( 0x0001FFFFFFFFFF80 ), LONG2CHARS( 0x0001FFFFFFFFFFC0 ), LONG2CHARS( 0x0001FFFFFFFFFFE0 ), LONG2CHARS( 0x0001FFFFFFFFFFF0 ), LONG2CHARS( 0x0001FFFFFFFFFFF8 ), LONG2CHARS( 0x0001FFFFFFFFFFFC ), LONG2CHARS( 0x0001FFFFFFFFFFFE ), LONG2CHARS( 0x0001FFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000800000000000 ), LONG2CHARS( 0x0000C00000000000 ), LONG2CHARS( 0x0000E00000000000 ), LONG2CHARS( 0x0000F00000000000 ), LONG2CHARS( 0x0000F80000000000 ), LONG2CHARS( 0x0000FC0000000000 ), LONG2CHARS( 0x0000FE0000000000 ), LONG2CHARS( 0x0000FF0000000000 ), LONG2CHARS( 0x0000FF8000000000 ), LONG2CHARS( 0x0000FFC000000000 ), LONG2CHARS( 0x0000FFE000000000 ), LONG2CHARS( 0x0000FFF000000000 ), LONG2CHARS( 0x0000FFF800000000 ), LONG2CHARS( 0x0000FFFC00000000 ), LONG2CHARS( 0x0000FFFE00000000 ), LONG2CHARS( 0x0000FFFF00000000 ), LONG2CHARS( 0x0000FFFF80000000 ), LONG2CHARS( 0x0000FFFFC0000000 ), LONG2CHARS( 0x0000FFFFE0000000 ), LONG2CHARS( 0x0000FFFFF0000000 ), LONG2CHARS( 0x0000FFFFF8000000 ), LONG2CHARS( 0x0000FFFFFC000000 ), LONG2CHARS( 0x0000FFFFFE000000 ), LONG2CHARS( 0x0000FFFFFF000000 ), LONG2CHARS( 0x0000FFFFFF800000 ), LONG2CHARS( 0x0000FFFFFFC00000 ), LONG2CHARS( 0x0000FFFFFFE00000 ), LONG2CHARS( 0x0000FFFFFFF00000 ), LONG2CHARS( 0x0000FFFFFFF80000 ), LONG2CHARS( 0x0000FFFFFFFC0000 ), LONG2CHARS( 0x0000FFFFFFFE0000 ), LONG2CHARS( 0x0000FFFFFFFF0000 ), LONG2CHARS( 0x0000FFFFFFFF8000 ), LONG2CHARS( 0x0000FFFFFFFFC000 ), LONG2CHARS( 0x0000FFFFFFFFE000 ), LONG2CHARS( 0x0000FFFFFFFFF000 ), LONG2CHARS( 0x0000FFFFFFFFF800 ), LONG2CHARS( 0x0000FFFFFFFFFC00 ), LONG2CHARS( 0x0000FFFFFFFFFE00 ), LONG2CHARS( 0x0000FFFFFFFFFF00 ), LONG2CHARS( 0x0000FFFFFFFFFF80 ), LONG2CHARS( 0x0000FFFFFFFFFFC0 ), LONG2CHARS( 0x0000FFFFFFFFFFE0 ), LONG2CHARS( 0x0000FFFFFFFFFFF0 ), LONG2CHARS( 0x0000FFFFFFFFFFF8 ), LONG2CHARS( 0x0000FFFFFFFFFFFC ), LONG2CHARS( 0x0000FFFFFFFFFFFE ), LONG2CHARS( 0x0000FFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000400000000000 ), LONG2CHARS( 0x0000600000000000 ), LONG2CHARS( 0x0000700000000000 ), LONG2CHARS( 0x0000780000000000 ), LONG2CHARS( 0x00007C0000000000 ), LONG2CHARS( 0x00007E0000000000 ), LONG2CHARS( 0x00007F0000000000 ), LONG2CHARS( 0x00007F8000000000 ), LONG2CHARS( 0x00007FC000000000 ), LONG2CHARS( 0x00007FE000000000 ), LONG2CHARS( 0x00007FF000000000 ), LONG2CHARS( 0x00007FF800000000 ), LONG2CHARS( 0x00007FFC00000000 ), LONG2CHARS( 0x00007FFE00000000 ), LONG2CHARS( 0x00007FFF00000000 ), LONG2CHARS( 0x00007FFF80000000 ), LONG2CHARS( 0x00007FFFC0000000 ), LONG2CHARS( 0x00007FFFE0000000 ), LONG2CHARS( 0x00007FFFF0000000 ), LONG2CHARS( 0x00007FFFF8000000 ), LONG2CHARS( 0x00007FFFFC000000 ), LONG2CHARS( 0x00007FFFFE000000 ), LONG2CHARS( 0x00007FFFFF000000 ), LONG2CHARS( 0x00007FFFFF800000 ), LONG2CHARS( 0x00007FFFFFC00000 ), LONG2CHARS( 0x00007FFFFFE00000 ), LONG2CHARS( 0x00007FFFFFF00000 ), LONG2CHARS( 0x00007FFFFFF80000 ), LONG2CHARS( 0x00007FFFFFFC0000 ), LONG2CHARS( 0x00007FFFFFFE0000 ), LONG2CHARS( 0x00007FFFFFFF0000 ), LONG2CHARS( 0x00007FFFFFFF8000 ), LONG2CHARS( 0x00007FFFFFFFC000 ), LONG2CHARS( 0x00007FFFFFFFE000 ), LONG2CHARS( 0x00007FFFFFFFF000 ), LONG2CHARS( 0x00007FFFFFFFF800 ), LONG2CHARS( 0x00007FFFFFFFFC00 ), LONG2CHARS( 0x00007FFFFFFFFE00 ), LONG2CHARS( 0x00007FFFFFFFFF00 ), LONG2CHARS( 0x00007FFFFFFFFF80 ), LONG2CHARS( 0x00007FFFFFFFFFC0 ), LONG2CHARS( 0x00007FFFFFFFFFE0 ), LONG2CHARS( 0x00007FFFFFFFFFF0 ), LONG2CHARS( 0x00007FFFFFFFFFF8 ), LONG2CHARS( 0x00007FFFFFFFFFFC ), LONG2CHARS( 0x00007FFFFFFFFFFE ), LONG2CHARS( 0x00007FFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000200000000000 ), LONG2CHARS( 0x0000300000000000 ), LONG2CHARS( 0x0000380000000000 ), LONG2CHARS( 0x00003C0000000000 ), LONG2CHARS( 0x00003E0000000000 ), LONG2CHARS( 0x00003F0000000000 ), LONG2CHARS( 0x00003F8000000000 ), LONG2CHARS( 0x00003FC000000000 ), LONG2CHARS( 0x00003FE000000000 ), LONG2CHARS( 0x00003FF000000000 ), LONG2CHARS( 0x00003FF800000000 ), LONG2CHARS( 0x00003FFC00000000 ), LONG2CHARS( 0x00003FFE00000000 ), LONG2CHARS( 0x00003FFF00000000 ), LONG2CHARS( 0x00003FFF80000000 ), LONG2CHARS( 0x00003FFFC0000000 ), LONG2CHARS( 0x00003FFFE0000000 ), LONG2CHARS( 0x00003FFFF0000000 ), LONG2CHARS( 0x00003FFFF8000000 ), LONG2CHARS( 0x00003FFFFC000000 ), LONG2CHARS( 0x00003FFFFE000000 ), LONG2CHARS( 0x00003FFFFF000000 ), LONG2CHARS( 0x00003FFFFF800000 ), LONG2CHARS( 0x00003FFFFFC00000 ), LONG2CHARS( 0x00003FFFFFE00000 ), LONG2CHARS( 0x00003FFFFFF00000 ), LONG2CHARS( 0x00003FFFFFF80000 ), LONG2CHARS( 0x00003FFFFFFC0000 ), LONG2CHARS( 0x00003FFFFFFE0000 ), LONG2CHARS( 0x00003FFFFFFF0000 ), LONG2CHARS( 0x00003FFFFFFF8000 ), LONG2CHARS( 0x00003FFFFFFFC000 ), LONG2CHARS( 0x00003FFFFFFFE000 ), LONG2CHARS( 0x00003FFFFFFFF000 ), LONG2CHARS( 0x00003FFFFFFFF800 ), LONG2CHARS( 0x00003FFFFFFFFC00 ), LONG2CHARS( 0x00003FFFFFFFFE00 ), LONG2CHARS( 0x00003FFFFFFFFF00 ), LONG2CHARS( 0x00003FFFFFFFFF80 ), LONG2CHARS( 0x00003FFFFFFFFFC0 ), LONG2CHARS( 0x00003FFFFFFFFFE0 ), LONG2CHARS( 0x00003FFFFFFFFFF0 ), LONG2CHARS( 0x00003FFFFFFFFFF8 ), LONG2CHARS( 0x00003FFFFFFFFFFC ), LONG2CHARS( 0x00003FFFFFFFFFFE ), LONG2CHARS( 0x00003FFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000100000000000 ), LONG2CHARS( 0x0000180000000000 ), LONG2CHARS( 0x00001C0000000000 ), LONG2CHARS( 0x00001E0000000000 ), LONG2CHARS( 0x00001F0000000000 ), LONG2CHARS( 0x00001F8000000000 ), LONG2CHARS( 0x00001FC000000000 ), LONG2CHARS( 0x00001FE000000000 ), LONG2CHARS( 0x00001FF000000000 ), LONG2CHARS( 0x00001FF800000000 ), LONG2CHARS( 0x00001FFC00000000 ), LONG2CHARS( 0x00001FFE00000000 ), LONG2CHARS( 0x00001FFF00000000 ), LONG2CHARS( 0x00001FFF80000000 ), LONG2CHARS( 0x00001FFFC0000000 ), LONG2CHARS( 0x00001FFFE0000000 ), LONG2CHARS( 0x00001FFFF0000000 ), LONG2CHARS( 0x00001FFFF8000000 ), LONG2CHARS( 0x00001FFFFC000000 ), LONG2CHARS( 0x00001FFFFE000000 ), LONG2CHARS( 0x00001FFFFF000000 ), LONG2CHARS( 0x00001FFFFF800000 ), LONG2CHARS( 0x00001FFFFFC00000 ), LONG2CHARS( 0x00001FFFFFE00000 ), LONG2CHARS( 0x00001FFFFFF00000 ), LONG2CHARS( 0x00001FFFFFF80000 ), LONG2CHARS( 0x00001FFFFFFC0000 ), LONG2CHARS( 0x00001FFFFFFE0000 ), LONG2CHARS( 0x00001FFFFFFF0000 ), LONG2CHARS( 0x00001FFFFFFF8000 ), LONG2CHARS( 0x00001FFFFFFFC000 ), LONG2CHARS( 0x00001FFFFFFFE000 ), LONG2CHARS( 0x00001FFFFFFFF000 ), LONG2CHARS( 0x00001FFFFFFFF800 ), LONG2CHARS( 0x00001FFFFFFFFC00 ), LONG2CHARS( 0x00001FFFFFFFFE00 ), LONG2CHARS( 0x00001FFFFFFFFF00 ), LONG2CHARS( 0x00001FFFFFFFFF80 ), LONG2CHARS( 0x00001FFFFFFFFFC0 ), LONG2CHARS( 0x00001FFFFFFFFFE0 ), LONG2CHARS( 0x00001FFFFFFFFFF0 ), LONG2CHARS( 0x00001FFFFFFFFFF8 ), LONG2CHARS( 0x00001FFFFFFFFFFC ), LONG2CHARS( 0x00001FFFFFFFFFFE ), LONG2CHARS( 0x00001FFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000080000000000 ), LONG2CHARS( 0x00000C0000000000 ), LONG2CHARS( 0x00000E0000000000 ), LONG2CHARS( 0x00000F0000000000 ), LONG2CHARS( 0x00000F8000000000 ), LONG2CHARS( 0x00000FC000000000 ), LONG2CHARS( 0x00000FE000000000 ), LONG2CHARS( 0x00000FF000000000 ), LONG2CHARS( 0x00000FF800000000 ), LONG2CHARS( 0x00000FFC00000000 ), LONG2CHARS( 0x00000FFE00000000 ), LONG2CHARS( 0x00000FFF00000000 ), LONG2CHARS( 0x00000FFF80000000 ), LONG2CHARS( 0x00000FFFC0000000 ), LONG2CHARS( 0x00000FFFE0000000 ), LONG2CHARS( 0x00000FFFF0000000 ), LONG2CHARS( 0x00000FFFF8000000 ), LONG2CHARS( 0x00000FFFFC000000 ), LONG2CHARS( 0x00000FFFFE000000 ), LONG2CHARS( 0x00000FFFFF000000 ), LONG2CHARS( 0x00000FFFFF800000 ), LONG2CHARS( 0x00000FFFFFC00000 ), LONG2CHARS( 0x00000FFFFFE00000 ), LONG2CHARS( 0x00000FFFFFF00000 ), LONG2CHARS( 0x00000FFFFFF80000 ), LONG2CHARS( 0x00000FFFFFFC0000 ), LONG2CHARS( 0x00000FFFFFFE0000 ), LONG2CHARS( 0x00000FFFFFFF0000 ), LONG2CHARS( 0x00000FFFFFFF8000 ), LONG2CHARS( 0x00000FFFFFFFC000 ), LONG2CHARS( 0x00000FFFFFFFE000 ), LONG2CHARS( 0x00000FFFFFFFF000 ), LONG2CHARS( 0x00000FFFFFFFF800 ), LONG2CHARS( 0x00000FFFFFFFFC00 ), LONG2CHARS( 0x00000FFFFFFFFE00 ), LONG2CHARS( 0x00000FFFFFFFFF00 ), LONG2CHARS( 0x00000FFFFFFFFF80 ), LONG2CHARS( 0x00000FFFFFFFFFC0 ), LONG2CHARS( 0x00000FFFFFFFFFE0 ), LONG2CHARS( 0x00000FFFFFFFFFF0 ), LONG2CHARS( 0x00000FFFFFFFFFF8 ), LONG2CHARS( 0x00000FFFFFFFFFFC ), LONG2CHARS( 0x00000FFFFFFFFFFE ), LONG2CHARS( 0x00000FFFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000040000000000 ), LONG2CHARS( 0x0000060000000000 ), LONG2CHARS( 0x0000070000000000 ), LONG2CHARS( 0x0000078000000000 ), LONG2CHARS( 0x000007C000000000 ), LONG2CHARS( 0x000007E000000000 ), LONG2CHARS( 0x000007F000000000 ), LONG2CHARS( 0x000007F800000000 ), LONG2CHARS( 0x000007FC00000000 ), LONG2CHARS( 0x000007FE00000000 ), LONG2CHARS( 0x000007FF00000000 ), LONG2CHARS( 0x000007FF80000000 ), LONG2CHARS( 0x000007FFC0000000 ), LONG2CHARS( 0x000007FFE0000000 ), LONG2CHARS( 0x000007FFF0000000 ), LONG2CHARS( 0x000007FFF8000000 ), LONG2CHARS( 0x000007FFFC000000 ), LONG2CHARS( 0x000007FFFE000000 ), LONG2CHARS( 0x000007FFFF000000 ), LONG2CHARS( 0x000007FFFF800000 ), LONG2CHARS( 0x000007FFFFC00000 ), LONG2CHARS( 0x000007FFFFE00000 ), LONG2CHARS( 0x000007FFFFF00000 ), LONG2CHARS( 0x000007FFFFF80000 ), LONG2CHARS( 0x000007FFFFFC0000 ), LONG2CHARS( 0x000007FFFFFE0000 ), LONG2CHARS( 0x000007FFFFFF0000 ), LONG2CHARS( 0x000007FFFFFF8000 ), LONG2CHARS( 0x000007FFFFFFC000 ), LONG2CHARS( 0x000007FFFFFFE000 ), LONG2CHARS( 0x000007FFFFFFF000 ), LONG2CHARS( 0x000007FFFFFFF800 ), LONG2CHARS( 0x000007FFFFFFFC00 ), LONG2CHARS( 0x000007FFFFFFFE00 ), LONG2CHARS( 0x000007FFFFFFFF00 ), LONG2CHARS( 0x000007FFFFFFFF80 ), LONG2CHARS( 0x000007FFFFFFFFC0 ), LONG2CHARS( 0x000007FFFFFFFFE0 ), LONG2CHARS( 0x000007FFFFFFFFF0 ), LONG2CHARS( 0x000007FFFFFFFFF8 ), LONG2CHARS( 0x000007FFFFFFFFFC ), LONG2CHARS( 0x000007FFFFFFFFFE ), LONG2CHARS( 0x000007FFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000020000000000 ), LONG2CHARS( 0x0000030000000000 ), LONG2CHARS( 0x0000038000000000 ), LONG2CHARS( 0x000003C000000000 ), LONG2CHARS( 0x000003E000000000 ), LONG2CHARS( 0x000003F000000000 ), LONG2CHARS( 0x000003F800000000 ), LONG2CHARS( 0x000003FC00000000 ), LONG2CHARS( 0x000003FE00000000 ), LONG2CHARS( 0x000003FF00000000 ), LONG2CHARS( 0x000003FF80000000 ), LONG2CHARS( 0x000003FFC0000000 ), LONG2CHARS( 0x000003FFE0000000 ), LONG2CHARS( 0x000003FFF0000000 ), LONG2CHARS( 0x000003FFF8000000 ), LONG2CHARS( 0x000003FFFC000000 ), LONG2CHARS( 0x000003FFFE000000 ), LONG2CHARS( 0x000003FFFF000000 ), LONG2CHARS( 0x000003FFFF800000 ), LONG2CHARS( 0x000003FFFFC00000 ), LONG2CHARS( 0x000003FFFFE00000 ), LONG2CHARS( 0x000003FFFFF00000 ), LONG2CHARS( 0x000003FFFFF80000 ), LONG2CHARS( 0x000003FFFFFC0000 ), LONG2CHARS( 0x000003FFFFFE0000 ), LONG2CHARS( 0x000003FFFFFF0000 ), LONG2CHARS( 0x000003FFFFFF8000 ), LONG2CHARS( 0x000003FFFFFFC000 ), LONG2CHARS( 0x000003FFFFFFE000 ), LONG2CHARS( 0x000003FFFFFFF000 ), LONG2CHARS( 0x000003FFFFFFF800 ), LONG2CHARS( 0x000003FFFFFFFC00 ), LONG2CHARS( 0x000003FFFFFFFE00 ), LONG2CHARS( 0x000003FFFFFFFF00 ), LONG2CHARS( 0x000003FFFFFFFF80 ), LONG2CHARS( 0x000003FFFFFFFFC0 ), LONG2CHARS( 0x000003FFFFFFFFE0 ), LONG2CHARS( 0x000003FFFFFFFFF0 ), LONG2CHARS( 0x000003FFFFFFFFF8 ), LONG2CHARS( 0x000003FFFFFFFFFC ), LONG2CHARS( 0x000003FFFFFFFFFE ), LONG2CHARS( 0x000003FFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000010000000000 ), LONG2CHARS( 0x0000018000000000 ), LONG2CHARS( 0x000001C000000000 ), LONG2CHARS( 0x000001E000000000 ), LONG2CHARS( 0x000001F000000000 ), LONG2CHARS( 0x000001F800000000 ), LONG2CHARS( 0x000001FC00000000 ), LONG2CHARS( 0x000001FE00000000 ), LONG2CHARS( 0x000001FF00000000 ), LONG2CHARS( 0x000001FF80000000 ), LONG2CHARS( 0x000001FFC0000000 ), LONG2CHARS( 0x000001FFE0000000 ), LONG2CHARS( 0x000001FFF0000000 ), LONG2CHARS( 0x000001FFF8000000 ), LONG2CHARS( 0x000001FFFC000000 ), LONG2CHARS( 0x000001FFFE000000 ), LONG2CHARS( 0x000001FFFF000000 ), LONG2CHARS( 0x000001FFFF800000 ), LONG2CHARS( 0x000001FFFFC00000 ), LONG2CHARS( 0x000001FFFFE00000 ), LONG2CHARS( 0x000001FFFFF00000 ), LONG2CHARS( 0x000001FFFFF80000 ), LONG2CHARS( 0x000001FFFFFC0000 ), LONG2CHARS( 0x000001FFFFFE0000 ), LONG2CHARS( 0x000001FFFFFF0000 ), LONG2CHARS( 0x000001FFFFFF8000 ), LONG2CHARS( 0x000001FFFFFFC000 ), LONG2CHARS( 0x000001FFFFFFE000 ), LONG2CHARS( 0x000001FFFFFFF000 ), LONG2CHARS( 0x000001FFFFFFF800 ), LONG2CHARS( 0x000001FFFFFFFC00 ), LONG2CHARS( 0x000001FFFFFFFE00 ), LONG2CHARS( 0x000001FFFFFFFF00 ), LONG2CHARS( 0x000001FFFFFFFF80 ), LONG2CHARS( 0x000001FFFFFFFFC0 ), LONG2CHARS( 0x000001FFFFFFFFE0 ), LONG2CHARS( 0x000001FFFFFFFFF0 ), LONG2CHARS( 0x000001FFFFFFFFF8 ), LONG2CHARS( 0x000001FFFFFFFFFC ), LONG2CHARS( 0x000001FFFFFFFFFE ), LONG2CHARS( 0x000001FFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000008000000000 ), LONG2CHARS( 0x000000C000000000 ), LONG2CHARS( 0x000000E000000000 ), LONG2CHARS( 0x000000F000000000 ), LONG2CHARS( 0x000000F800000000 ), LONG2CHARS( 0x000000FC00000000 ), LONG2CHARS( 0x000000FE00000000 ), LONG2CHARS( 0x000000FF00000000 ), LONG2CHARS( 0x000000FF80000000 ), LONG2CHARS( 0x000000FFC0000000 ), LONG2CHARS( 0x000000FFE0000000 ), LONG2CHARS( 0x000000FFF0000000 ), LONG2CHARS( 0x000000FFF8000000 ), LONG2CHARS( 0x000000FFFC000000 ), LONG2CHARS( 0x000000FFFE000000 ), LONG2CHARS( 0x000000FFFF000000 ), LONG2CHARS( 0x000000FFFF800000 ), LONG2CHARS( 0x000000FFFFC00000 ), LONG2CHARS( 0x000000FFFFE00000 ), LONG2CHARS( 0x000000FFFFF00000 ), LONG2CHARS( 0x000000FFFFF80000 ), LONG2CHARS( 0x000000FFFFFC0000 ), LONG2CHARS( 0x000000FFFFFE0000 ), LONG2CHARS( 0x000000FFFFFF0000 ), LONG2CHARS( 0x000000FFFFFF8000 ), LONG2CHARS( 0x000000FFFFFFC000 ), LONG2CHARS( 0x000000FFFFFFE000 ), LONG2CHARS( 0x000000FFFFFFF000 ), LONG2CHARS( 0x000000FFFFFFF800 ), LONG2CHARS( 0x000000FFFFFFFC00 ), LONG2CHARS( 0x000000FFFFFFFE00 ), LONG2CHARS( 0x000000FFFFFFFF00 ), LONG2CHARS( 0x000000FFFFFFFF80 ), LONG2CHARS( 0x000000FFFFFFFFC0 ), LONG2CHARS( 0x000000FFFFFFFFE0 ), LONG2CHARS( 0x000000FFFFFFFFF0 ), LONG2CHARS( 0x000000FFFFFFFFF8 ), LONG2CHARS( 0x000000FFFFFFFFFC ), LONG2CHARS( 0x000000FFFFFFFFFE ), LONG2CHARS( 0x000000FFFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000004000000000 ), LONG2CHARS( 0x0000006000000000 ), LONG2CHARS( 0x0000007000000000 ), LONG2CHARS( 0x0000007800000000 ), LONG2CHARS( 0x0000007C00000000 ), LONG2CHARS( 0x0000007E00000000 ), LONG2CHARS( 0x0000007F00000000 ), LONG2CHARS( 0x0000007F80000000 ), LONG2CHARS( 0x0000007FC0000000 ), LONG2CHARS( 0x0000007FE0000000 ), LONG2CHARS( 0x0000007FF0000000 ), LONG2CHARS( 0x0000007FF8000000 ), LONG2CHARS( 0x0000007FFC000000 ), LONG2CHARS( 0x0000007FFE000000 ), LONG2CHARS( 0x0000007FFF000000 ), LONG2CHARS( 0x0000007FFF800000 ), LONG2CHARS( 0x0000007FFFC00000 ), LONG2CHARS( 0x0000007FFFE00000 ), LONG2CHARS( 0x0000007FFFF00000 ), LONG2CHARS( 0x0000007FFFF80000 ), LONG2CHARS( 0x0000007FFFFC0000 ), LONG2CHARS( 0x0000007FFFFE0000 ), LONG2CHARS( 0x0000007FFFFF0000 ), LONG2CHARS( 0x0000007FFFFF8000 ), LONG2CHARS( 0x0000007FFFFFC000 ), LONG2CHARS( 0x0000007FFFFFE000 ), LONG2CHARS( 0x0000007FFFFFF000 ), LONG2CHARS( 0x0000007FFFFFF800 ), LONG2CHARS( 0x0000007FFFFFFC00 ), LONG2CHARS( 0x0000007FFFFFFE00 ), LONG2CHARS( 0x0000007FFFFFFF00 ), LONG2CHARS( 0x0000007FFFFFFF80 ), LONG2CHARS( 0x0000007FFFFFFFC0 ), LONG2CHARS( 0x0000007FFFFFFFE0 ), LONG2CHARS( 0x0000007FFFFFFFF0 ), LONG2CHARS( 0x0000007FFFFFFFF8 ), LONG2CHARS( 0x0000007FFFFFFFFC ), LONG2CHARS( 0x0000007FFFFFFFFE ), LONG2CHARS( 0x0000007FFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000002000000000 ), LONG2CHARS( 0x0000003000000000 ), LONG2CHARS( 0x0000003800000000 ), LONG2CHARS( 0x0000003C00000000 ), LONG2CHARS( 0x0000003E00000000 ), LONG2CHARS( 0x0000003F00000000 ), LONG2CHARS( 0x0000003F80000000 ), LONG2CHARS( 0x0000003FC0000000 ), LONG2CHARS( 0x0000003FE0000000 ), LONG2CHARS( 0x0000003FF0000000 ), LONG2CHARS( 0x0000003FF8000000 ), LONG2CHARS( 0x0000003FFC000000 ), LONG2CHARS( 0x0000003FFE000000 ), LONG2CHARS( 0x0000003FFF000000 ), LONG2CHARS( 0x0000003FFF800000 ), LONG2CHARS( 0x0000003FFFC00000 ), LONG2CHARS( 0x0000003FFFE00000 ), LONG2CHARS( 0x0000003FFFF00000 ), LONG2CHARS( 0x0000003FFFF80000 ), LONG2CHARS( 0x0000003FFFFC0000 ), LONG2CHARS( 0x0000003FFFFE0000 ), LONG2CHARS( 0x0000003FFFFF0000 ), LONG2CHARS( 0x0000003FFFFF8000 ), LONG2CHARS( 0x0000003FFFFFC000 ), LONG2CHARS( 0x0000003FFFFFE000 ), LONG2CHARS( 0x0000003FFFFFF000 ), LONG2CHARS( 0x0000003FFFFFF800 ), LONG2CHARS( 0x0000003FFFFFFC00 ), LONG2CHARS( 0x0000003FFFFFFE00 ), LONG2CHARS( 0x0000003FFFFFFF00 ), LONG2CHARS( 0x0000003FFFFFFF80 ), LONG2CHARS( 0x0000003FFFFFFFC0 ), LONG2CHARS( 0x0000003FFFFFFFE0 ), LONG2CHARS( 0x0000003FFFFFFFF0 ), LONG2CHARS( 0x0000003FFFFFFFF8 ), LONG2CHARS( 0x0000003FFFFFFFFC ), LONG2CHARS( 0x0000003FFFFFFFFE ), LONG2CHARS( 0x0000003FFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000001000000000 ), LONG2CHARS( 0x0000001800000000 ), LONG2CHARS( 0x0000001C00000000 ), LONG2CHARS( 0x0000001E00000000 ), LONG2CHARS( 0x0000001F00000000 ), LONG2CHARS( 0x0000001F80000000 ), LONG2CHARS( 0x0000001FC0000000 ), LONG2CHARS( 0x0000001FE0000000 ), LONG2CHARS( 0x0000001FF0000000 ), LONG2CHARS( 0x0000001FF8000000 ), LONG2CHARS( 0x0000001FFC000000 ), LONG2CHARS( 0x0000001FFE000000 ), LONG2CHARS( 0x0000001FFF000000 ), LONG2CHARS( 0x0000001FFF800000 ), LONG2CHARS( 0x0000001FFFC00000 ), LONG2CHARS( 0x0000001FFFE00000 ), LONG2CHARS( 0x0000001FFFF00000 ), LONG2CHARS( 0x0000001FFFF80000 ), LONG2CHARS( 0x0000001FFFFC0000 ), LONG2CHARS( 0x0000001FFFFE0000 ), LONG2CHARS( 0x0000001FFFFF0000 ), LONG2CHARS( 0x0000001FFFFF8000 ), LONG2CHARS( 0x0000001FFFFFC000 ), LONG2CHARS( 0x0000001FFFFFE000 ), LONG2CHARS( 0x0000001FFFFFF000 ), LONG2CHARS( 0x0000001FFFFFF800 ), LONG2CHARS( 0x0000001FFFFFFC00 ), LONG2CHARS( 0x0000001FFFFFFE00 ), LONG2CHARS( 0x0000001FFFFFFF00 ), LONG2CHARS( 0x0000001FFFFFFF80 ), LONG2CHARS( 0x0000001FFFFFFFC0 ), LONG2CHARS( 0x0000001FFFFFFFE0 ), LONG2CHARS( 0x0000001FFFFFFFF0 ), LONG2CHARS( 0x0000001FFFFFFFF8 ), LONG2CHARS( 0x0000001FFFFFFFFC ), LONG2CHARS( 0x0000001FFFFFFFFE ), LONG2CHARS( 0x0000001FFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000800000000 ), LONG2CHARS( 0x0000000C00000000 ), LONG2CHARS( 0x0000000E00000000 ), LONG2CHARS( 0x0000000F00000000 ), LONG2CHARS( 0x0000000F80000000 ), LONG2CHARS( 0x0000000FC0000000 ), LONG2CHARS( 0x0000000FE0000000 ), LONG2CHARS( 0x0000000FF0000000 ), LONG2CHARS( 0x0000000FF8000000 ), LONG2CHARS( 0x0000000FFC000000 ), LONG2CHARS( 0x0000000FFE000000 ), LONG2CHARS( 0x0000000FFF000000 ), LONG2CHARS( 0x0000000FFF800000 ), LONG2CHARS( 0x0000000FFFC00000 ), LONG2CHARS( 0x0000000FFFE00000 ), LONG2CHARS( 0x0000000FFFF00000 ), LONG2CHARS( 0x0000000FFFF80000 ), LONG2CHARS( 0x0000000FFFFC0000 ), LONG2CHARS( 0x0000000FFFFE0000 ), LONG2CHARS( 0x0000000FFFFF0000 ), LONG2CHARS( 0x0000000FFFFF8000 ), LONG2CHARS( 0x0000000FFFFFC000 ), LONG2CHARS( 0x0000000FFFFFE000 ), LONG2CHARS( 0x0000000FFFFFF000 ), LONG2CHARS( 0x0000000FFFFFF800 ), LONG2CHARS( 0x0000000FFFFFFC00 ), LONG2CHARS( 0x0000000FFFFFFE00 ), LONG2CHARS( 0x0000000FFFFFFF00 ), LONG2CHARS( 0x0000000FFFFFFF80 ), LONG2CHARS( 0x0000000FFFFFFFC0 ), LONG2CHARS( 0x0000000FFFFFFFE0 ), LONG2CHARS( 0x0000000FFFFFFFF0 ), LONG2CHARS( 0x0000000FFFFFFFF8 ), LONG2CHARS( 0x0000000FFFFFFFFC ), LONG2CHARS( 0x0000000FFFFFFFFE ), LONG2CHARS( 0x0000000FFFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000400000000 ), LONG2CHARS( 0x0000000600000000 ), LONG2CHARS( 0x0000000700000000 ), LONG2CHARS( 0x0000000780000000 ), LONG2CHARS( 0x00000007C0000000 ), LONG2CHARS( 0x00000007E0000000 ), LONG2CHARS( 0x00000007F0000000 ), LONG2CHARS( 0x00000007F8000000 ), LONG2CHARS( 0x00000007FC000000 ), LONG2CHARS( 0x00000007FE000000 ), LONG2CHARS( 0x00000007FF000000 ), LONG2CHARS( 0x00000007FF800000 ), LONG2CHARS( 0x00000007FFC00000 ), LONG2CHARS( 0x00000007FFE00000 ), LONG2CHARS( 0x00000007FFF00000 ), LONG2CHARS( 0x00000007FFF80000 ), LONG2CHARS( 0x00000007FFFC0000 ), LONG2CHARS( 0x00000007FFFE0000 ), LONG2CHARS( 0x00000007FFFF0000 ), LONG2CHARS( 0x00000007FFFF8000 ), LONG2CHARS( 0x00000007FFFFC000 ), LONG2CHARS( 0x00000007FFFFE000 ), LONG2CHARS( 0x00000007FFFFF000 ), LONG2CHARS( 0x00000007FFFFF800 ), LONG2CHARS( 0x00000007FFFFFC00 ), LONG2CHARS( 0x00000007FFFFFE00 ), LONG2CHARS( 0x00000007FFFFFF00 ), LONG2CHARS( 0x00000007FFFFFF80 ), LONG2CHARS( 0x00000007FFFFFFC0 ), LONG2CHARS( 0x00000007FFFFFFE0 ), LONG2CHARS( 0x00000007FFFFFFF0 ), LONG2CHARS( 0x00000007FFFFFFF8 ), LONG2CHARS( 0x00000007FFFFFFFC ), LONG2CHARS( 0x00000007FFFFFFFE ), LONG2CHARS( 0x00000007FFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000200000000 ), LONG2CHARS( 0x0000000300000000 ), LONG2CHARS( 0x0000000380000000 ), LONG2CHARS( 0x00000003C0000000 ), LONG2CHARS( 0x00000003E0000000 ), LONG2CHARS( 0x00000003F0000000 ), LONG2CHARS( 0x00000003F8000000 ), LONG2CHARS( 0x00000003FC000000 ), LONG2CHARS( 0x00000003FE000000 ), LONG2CHARS( 0x00000003FF000000 ), LONG2CHARS( 0x00000003FF800000 ), LONG2CHARS( 0x00000003FFC00000 ), LONG2CHARS( 0x00000003FFE00000 ), LONG2CHARS( 0x00000003FFF00000 ), LONG2CHARS( 0x00000003FFF80000 ), LONG2CHARS( 0x00000003FFFC0000 ), LONG2CHARS( 0x00000003FFFE0000 ), LONG2CHARS( 0x00000003FFFF0000 ), LONG2CHARS( 0x00000003FFFF8000 ), LONG2CHARS( 0x00000003FFFFC000 ), LONG2CHARS( 0x00000003FFFFE000 ), LONG2CHARS( 0x00000003FFFFF000 ), LONG2CHARS( 0x00000003FFFFF800 ), LONG2CHARS( 0x00000003FFFFFC00 ), LONG2CHARS( 0x00000003FFFFFE00 ), LONG2CHARS( 0x00000003FFFFFF00 ), LONG2CHARS( 0x00000003FFFFFF80 ), LONG2CHARS( 0x00000003FFFFFFC0 ), LONG2CHARS( 0x00000003FFFFFFE0 ), LONG2CHARS( 0x00000003FFFFFFF0 ), LONG2CHARS( 0x00000003FFFFFFF8 ), LONG2CHARS( 0x00000003FFFFFFFC ), LONG2CHARS( 0x00000003FFFFFFFE ), LONG2CHARS( 0x00000003FFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000100000000 ), LONG2CHARS( 0x0000000180000000 ), LONG2CHARS( 0x00000001C0000000 ), LONG2CHARS( 0x00000001E0000000 ), LONG2CHARS( 0x00000001F0000000 ), LONG2CHARS( 0x00000001F8000000 ), LONG2CHARS( 0x00000001FC000000 ), LONG2CHARS( 0x00000001FE000000 ), LONG2CHARS( 0x00000001FF000000 ), LONG2CHARS( 0x00000001FF800000 ), LONG2CHARS( 0x00000001FFC00000 ), LONG2CHARS( 0x00000001FFE00000 ), LONG2CHARS( 0x00000001FFF00000 ), LONG2CHARS( 0x00000001FFF80000 ), LONG2CHARS( 0x00000001FFFC0000 ), LONG2CHARS( 0x00000001FFFE0000 ), LONG2CHARS( 0x00000001FFFF0000 ), LONG2CHARS( 0x00000001FFFF8000 ), LONG2CHARS( 0x00000001FFFFC000 ), LONG2CHARS( 0x00000001FFFFE000 ), LONG2CHARS( 0x00000001FFFFF000 ), LONG2CHARS( 0x00000001FFFFF800 ), LONG2CHARS( 0x00000001FFFFFC00 ), LONG2CHARS( 0x00000001FFFFFE00 ), LONG2CHARS( 0x00000001FFFFFF00 ), LONG2CHARS( 0x00000001FFFFFF80 ), LONG2CHARS( 0x00000001FFFFFFC0 ), LONG2CHARS( 0x00000001FFFFFFE0 ), LONG2CHARS( 0x00000001FFFFFFF0 ), LONG2CHARS( 0x00000001FFFFFFF8 ), LONG2CHARS( 0x00000001FFFFFFFC ), LONG2CHARS( 0x00000001FFFFFFFE ), LONG2CHARS( 0x00000001FFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000080000000 ), LONG2CHARS( 0x00000000C0000000 ), LONG2CHARS( 0x00000000E0000000 ), LONG2CHARS( 0x00000000F0000000 ), LONG2CHARS( 0x00000000F8000000 ), LONG2CHARS( 0x00000000FC000000 ), LONG2CHARS( 0x00000000FE000000 ), LONG2CHARS( 0x00000000FF000000 ), LONG2CHARS( 0x00000000FF800000 ), LONG2CHARS( 0x00000000FFC00000 ), LONG2CHARS( 0x00000000FFE00000 ), LONG2CHARS( 0x00000000FFF00000 ), LONG2CHARS( 0x00000000FFF80000 ), LONG2CHARS( 0x00000000FFFC0000 ), LONG2CHARS( 0x00000000FFFE0000 ), LONG2CHARS( 0x00000000FFFF0000 ), LONG2CHARS( 0x00000000FFFF8000 ), LONG2CHARS( 0x00000000FFFFC000 ), LONG2CHARS( 0x00000000FFFFE000 ), LONG2CHARS( 0x00000000FFFFF000 ), LONG2CHARS( 0x00000000FFFFF800 ), LONG2CHARS( 0x00000000FFFFFC00 ), LONG2CHARS( 0x00000000FFFFFE00 ), LONG2CHARS( 0x00000000FFFFFF00 ), LONG2CHARS( 0x00000000FFFFFF80 ), LONG2CHARS( 0x00000000FFFFFFC0 ), LONG2CHARS( 0x00000000FFFFFFE0 ), LONG2CHARS( 0x00000000FFFFFFF0 ), LONG2CHARS( 0x00000000FFFFFFF8 ), LONG2CHARS( 0x00000000FFFFFFFC ), LONG2CHARS( 0x00000000FFFFFFFE ), LONG2CHARS( 0x00000000FFFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000040000000 ), LONG2CHARS( 0x0000000060000000 ), LONG2CHARS( 0x0000000070000000 ), LONG2CHARS( 0x0000000078000000 ), LONG2CHARS( 0x000000007C000000 ), LONG2CHARS( 0x000000007E000000 ), LONG2CHARS( 0x000000007F000000 ), LONG2CHARS( 0x000000007F800000 ), LONG2CHARS( 0x000000007FC00000 ), LONG2CHARS( 0x000000007FE00000 ), LONG2CHARS( 0x000000007FF00000 ), LONG2CHARS( 0x000000007FF80000 ), LONG2CHARS( 0x000000007FFC0000 ), LONG2CHARS( 0x000000007FFE0000 ), LONG2CHARS( 0x000000007FFF0000 ), LONG2CHARS( 0x000000007FFF8000 ), LONG2CHARS( 0x000000007FFFC000 ), LONG2CHARS( 0x000000007FFFE000 ), LONG2CHARS( 0x000000007FFFF000 ), LONG2CHARS( 0x000000007FFFF800 ), LONG2CHARS( 0x000000007FFFFC00 ), LONG2CHARS( 0x000000007FFFFE00 ), LONG2CHARS( 0x000000007FFFFF00 ), LONG2CHARS( 0x000000007FFFFF80 ), LONG2CHARS( 0x000000007FFFFFC0 ), LONG2CHARS( 0x000000007FFFFFE0 ), LONG2CHARS( 0x000000007FFFFFF0 ), LONG2CHARS( 0x000000007FFFFFF8 ), LONG2CHARS( 0x000000007FFFFFFC ), LONG2CHARS( 0x000000007FFFFFFE ), LONG2CHARS( 0x000000007FFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000020000000 ), LONG2CHARS( 0x0000000030000000 ), LONG2CHARS( 0x0000000038000000 ), LONG2CHARS( 0x000000003C000000 ), LONG2CHARS( 0x000000003E000000 ), LONG2CHARS( 0x000000003F000000 ), LONG2CHARS( 0x000000003F800000 ), LONG2CHARS( 0x000000003FC00000 ), LONG2CHARS( 0x000000003FE00000 ), LONG2CHARS( 0x000000003FF00000 ), LONG2CHARS( 0x000000003FF80000 ), LONG2CHARS( 0x000000003FFC0000 ), LONG2CHARS( 0x000000003FFE0000 ), LONG2CHARS( 0x000000003FFF0000 ), LONG2CHARS( 0x000000003FFF8000 ), LONG2CHARS( 0x000000003FFFC000 ), LONG2CHARS( 0x000000003FFFE000 ), LONG2CHARS( 0x000000003FFFF000 ), LONG2CHARS( 0x000000003FFFF800 ), LONG2CHARS( 0x000000003FFFFC00 ), LONG2CHARS( 0x000000003FFFFE00 ), LONG2CHARS( 0x000000003FFFFF00 ), LONG2CHARS( 0x000000003FFFFF80 ), LONG2CHARS( 0x000000003FFFFFC0 ), LONG2CHARS( 0x000000003FFFFFE0 ), LONG2CHARS( 0x000000003FFFFFF0 ), LONG2CHARS( 0x000000003FFFFFF8 ), LONG2CHARS( 0x000000003FFFFFFC ), LONG2CHARS( 0x000000003FFFFFFE ), LONG2CHARS( 0x000000003FFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000010000000 ), LONG2CHARS( 0x0000000018000000 ), LONG2CHARS( 0x000000001C000000 ), LONG2CHARS( 0x000000001E000000 ), LONG2CHARS( 0x000000001F000000 ), LONG2CHARS( 0x000000001F800000 ), LONG2CHARS( 0x000000001FC00000 ), LONG2CHARS( 0x000000001FE00000 ), LONG2CHARS( 0x000000001FF00000 ), LONG2CHARS( 0x000000001FF80000 ), LONG2CHARS( 0x000000001FFC0000 ), LONG2CHARS( 0x000000001FFE0000 ), LONG2CHARS( 0x000000001FFF0000 ), LONG2CHARS( 0x000000001FFF8000 ), LONG2CHARS( 0x000000001FFFC000 ), LONG2CHARS( 0x000000001FFFE000 ), LONG2CHARS( 0x000000001FFFF000 ), LONG2CHARS( 0x000000001FFFF800 ), LONG2CHARS( 0x000000001FFFFC00 ), LONG2CHARS( 0x000000001FFFFE00 ), LONG2CHARS( 0x000000001FFFFF00 ), LONG2CHARS( 0x000000001FFFFF80 ), LONG2CHARS( 0x000000001FFFFFC0 ), LONG2CHARS( 0x000000001FFFFFE0 ), LONG2CHARS( 0x000000001FFFFFF0 ), LONG2CHARS( 0x000000001FFFFFF8 ), LONG2CHARS( 0x000000001FFFFFFC ), LONG2CHARS( 0x000000001FFFFFFE ), LONG2CHARS( 0x000000001FFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000008000000 ), LONG2CHARS( 0x000000000C000000 ), LONG2CHARS( 0x000000000E000000 ), LONG2CHARS( 0x000000000F000000 ), LONG2CHARS( 0x000000000F800000 ), LONG2CHARS( 0x000000000FC00000 ), LONG2CHARS( 0x000000000FE00000 ), LONG2CHARS( 0x000000000FF00000 ), LONG2CHARS( 0x000000000FF80000 ), LONG2CHARS( 0x000000000FFC0000 ), LONG2CHARS( 0x000000000FFE0000 ), LONG2CHARS( 0x000000000FFF0000 ), LONG2CHARS( 0x000000000FFF8000 ), LONG2CHARS( 0x000000000FFFC000 ), LONG2CHARS( 0x000000000FFFE000 ), LONG2CHARS( 0x000000000FFFF000 ), LONG2CHARS( 0x000000000FFFF800 ), LONG2CHARS( 0x000000000FFFFC00 ), LONG2CHARS( 0x000000000FFFFE00 ), LONG2CHARS( 0x000000000FFFFF00 ), LONG2CHARS( 0x000000000FFFFF80 ), LONG2CHARS( 0x000000000FFFFFC0 ), LONG2CHARS( 0x000000000FFFFFE0 ), LONG2CHARS( 0x000000000FFFFFF0 ), LONG2CHARS( 0x000000000FFFFFF8 ), LONG2CHARS( 0x000000000FFFFFFC ), LONG2CHARS( 0x000000000FFFFFFE ), LONG2CHARS( 0x000000000FFFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000004000000 ), LONG2CHARS( 0x0000000006000000 ), LONG2CHARS( 0x0000000007000000 ), LONG2CHARS( 0x0000000007800000 ), LONG2CHARS( 0x0000000007C00000 ), LONG2CHARS( 0x0000000007E00000 ), LONG2CHARS( 0x0000000007F00000 ), LONG2CHARS( 0x0000000007F80000 ), LONG2CHARS( 0x0000000007FC0000 ), LONG2CHARS( 0x0000000007FE0000 ), LONG2CHARS( 0x0000000007FF0000 ), LONG2CHARS( 0x0000000007FF8000 ), LONG2CHARS( 0x0000000007FFC000 ), LONG2CHARS( 0x0000000007FFE000 ), LONG2CHARS( 0x0000000007FFF000 ), LONG2CHARS( 0x0000000007FFF800 ), LONG2CHARS( 0x0000000007FFFC00 ), LONG2CHARS( 0x0000000007FFFE00 ), LONG2CHARS( 0x0000000007FFFF00 ), LONG2CHARS( 0x0000000007FFFF80 ), LONG2CHARS( 0x0000000007FFFFC0 ), LONG2CHARS( 0x0000000007FFFFE0 ), LONG2CHARS( 0x0000000007FFFFF0 ), LONG2CHARS( 0x0000000007FFFFF8 ), LONG2CHARS( 0x0000000007FFFFFC ), LONG2CHARS( 0x0000000007FFFFFE ), LONG2CHARS( 0x0000000007FFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000002000000 ), LONG2CHARS( 0x0000000003000000 ), LONG2CHARS( 0x0000000003800000 ), LONG2CHARS( 0x0000000003C00000 ), LONG2CHARS( 0x0000000003E00000 ), LONG2CHARS( 0x0000000003F00000 ), LONG2CHARS( 0x0000000003F80000 ), LONG2CHARS( 0x0000000003FC0000 ), LONG2CHARS( 0x0000000003FE0000 ), LONG2CHARS( 0x0000000003FF0000 ), LONG2CHARS( 0x0000000003FF8000 ), LONG2CHARS( 0x0000000003FFC000 ), LONG2CHARS( 0x0000000003FFE000 ), LONG2CHARS( 0x0000000003FFF000 ), LONG2CHARS( 0x0000000003FFF800 ), LONG2CHARS( 0x0000000003FFFC00 ), LONG2CHARS( 0x0000000003FFFE00 ), LONG2CHARS( 0x0000000003FFFF00 ), LONG2CHARS( 0x0000000003FFFF80 ), LONG2CHARS( 0x0000000003FFFFC0 ), LONG2CHARS( 0x0000000003FFFFE0 ), LONG2CHARS( 0x0000000003FFFFF0 ), LONG2CHARS( 0x0000000003FFFFF8 ), LONG2CHARS( 0x0000000003FFFFFC ), LONG2CHARS( 0x0000000003FFFFFE ), LONG2CHARS( 0x0000000003FFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000001000000 ), LONG2CHARS( 0x0000000001800000 ), LONG2CHARS( 0x0000000001C00000 ), LONG2CHARS( 0x0000000001E00000 ), LONG2CHARS( 0x0000000001F00000 ), LONG2CHARS( 0x0000000001F80000 ), LONG2CHARS( 0x0000000001FC0000 ), LONG2CHARS( 0x0000000001FE0000 ), LONG2CHARS( 0x0000000001FF0000 ), LONG2CHARS( 0x0000000001FF8000 ), LONG2CHARS( 0x0000000001FFC000 ), LONG2CHARS( 0x0000000001FFE000 ), LONG2CHARS( 0x0000000001FFF000 ), LONG2CHARS( 0x0000000001FFF800 ), LONG2CHARS( 0x0000000001FFFC00 ), LONG2CHARS( 0x0000000001FFFE00 ), LONG2CHARS( 0x0000000001FFFF00 ), LONG2CHARS( 0x0000000001FFFF80 ), LONG2CHARS( 0x0000000001FFFFC0 ), LONG2CHARS( 0x0000000001FFFFE0 ), LONG2CHARS( 0x0000000001FFFFF0 ), LONG2CHARS( 0x0000000001FFFFF8 ), LONG2CHARS( 0x0000000001FFFFFC ), LONG2CHARS( 0x0000000001FFFFFE ), LONG2CHARS( 0x0000000001FFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000800000 ), LONG2CHARS( 0x0000000000C00000 ), LONG2CHARS( 0x0000000000E00000 ), LONG2CHARS( 0x0000000000F00000 ), LONG2CHARS( 0x0000000000F80000 ), LONG2CHARS( 0x0000000000FC0000 ), LONG2CHARS( 0x0000000000FE0000 ), LONG2CHARS( 0x0000000000FF0000 ), LONG2CHARS( 0x0000000000FF8000 ), LONG2CHARS( 0x0000000000FFC000 ), LONG2CHARS( 0x0000000000FFE000 ), LONG2CHARS( 0x0000000000FFF000 ), LONG2CHARS( 0x0000000000FFF800 ), LONG2CHARS( 0x0000000000FFFC00 ), LONG2CHARS( 0x0000000000FFFE00 ), LONG2CHARS( 0x0000000000FFFF00 ), LONG2CHARS( 0x0000000000FFFF80 ), LONG2CHARS( 0x0000000000FFFFC0 ), LONG2CHARS( 0x0000000000FFFFE0 ), LONG2CHARS( 0x0000000000FFFFF0 ), LONG2CHARS( 0x0000000000FFFFF8 ), LONG2CHARS( 0x0000000000FFFFFC ), LONG2CHARS( 0x0000000000FFFFFE ), LONG2CHARS( 0x0000000000FFFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000400000 ), LONG2CHARS( 0x0000000000600000 ), LONG2CHARS( 0x0000000000700000 ), LONG2CHARS( 0x0000000000780000 ), LONG2CHARS( 0x00000000007C0000 ), LONG2CHARS( 0x00000000007E0000 ), LONG2CHARS( 0x00000000007F0000 ), LONG2CHARS( 0x00000000007F8000 ), LONG2CHARS( 0x00000000007FC000 ), LONG2CHARS( 0x00000000007FE000 ), LONG2CHARS( 0x00000000007FF000 ), LONG2CHARS( 0x00000000007FF800 ), LONG2CHARS( 0x00000000007FFC00 ), LONG2CHARS( 0x00000000007FFE00 ), LONG2CHARS( 0x00000000007FFF00 ), LONG2CHARS( 0x00000000007FFF80 ), LONG2CHARS( 0x00000000007FFFC0 ), LONG2CHARS( 0x00000000007FFFE0 ), LONG2CHARS( 0x00000000007FFFF0 ), LONG2CHARS( 0x00000000007FFFF8 ), LONG2CHARS( 0x00000000007FFFFC ), LONG2CHARS( 0x00000000007FFFFE ), LONG2CHARS( 0x00000000007FFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000200000 ), LONG2CHARS( 0x0000000000300000 ), LONG2CHARS( 0x0000000000380000 ), LONG2CHARS( 0x00000000003C0000 ), LONG2CHARS( 0x00000000003E0000 ), LONG2CHARS( 0x00000000003F0000 ), LONG2CHARS( 0x00000000003F8000 ), LONG2CHARS( 0x00000000003FC000 ), LONG2CHARS( 0x00000000003FE000 ), LONG2CHARS( 0x00000000003FF000 ), LONG2CHARS( 0x00000000003FF800 ), LONG2CHARS( 0x00000000003FFC00 ), LONG2CHARS( 0x00000000003FFE00 ), LONG2CHARS( 0x00000000003FFF00 ), LONG2CHARS( 0x00000000003FFF80 ), LONG2CHARS( 0x00000000003FFFC0 ), LONG2CHARS( 0x00000000003FFFE0 ), LONG2CHARS( 0x00000000003FFFF0 ), LONG2CHARS( 0x00000000003FFFF8 ), LONG2CHARS( 0x00000000003FFFFC ), LONG2CHARS( 0x00000000003FFFFE ), LONG2CHARS( 0x00000000003FFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000100000 ), LONG2CHARS( 0x0000000000180000 ), LONG2CHARS( 0x00000000001C0000 ), LONG2CHARS( 0x00000000001E0000 ), LONG2CHARS( 0x00000000001F0000 ), LONG2CHARS( 0x00000000001F8000 ), LONG2CHARS( 0x00000000001FC000 ), LONG2CHARS( 0x00000000001FE000 ), LONG2CHARS( 0x00000000001FF000 ), LONG2CHARS( 0x00000000001FF800 ), LONG2CHARS( 0x00000000001FFC00 ), LONG2CHARS( 0x00000000001FFE00 ), LONG2CHARS( 0x00000000001FFF00 ), LONG2CHARS( 0x00000000001FFF80 ), LONG2CHARS( 0x00000000001FFFC0 ), LONG2CHARS( 0x00000000001FFFE0 ), LONG2CHARS( 0x00000000001FFFF0 ), LONG2CHARS( 0x00000000001FFFF8 ), LONG2CHARS( 0x00000000001FFFFC ), LONG2CHARS( 0x00000000001FFFFE ), LONG2CHARS( 0x00000000001FFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000080000 ), LONG2CHARS( 0x00000000000C0000 ), LONG2CHARS( 0x00000000000E0000 ), LONG2CHARS( 0x00000000000F0000 ), LONG2CHARS( 0x00000000000F8000 ), LONG2CHARS( 0x00000000000FC000 ), LONG2CHARS( 0x00000000000FE000 ), LONG2CHARS( 0x00000000000FF000 ), LONG2CHARS( 0x00000000000FF800 ), LONG2CHARS( 0x00000000000FFC00 ), LONG2CHARS( 0x00000000000FFE00 ), LONG2CHARS( 0x00000000000FFF00 ), LONG2CHARS( 0x00000000000FFF80 ), LONG2CHARS( 0x00000000000FFFC0 ), LONG2CHARS( 0x00000000000FFFE0 ), LONG2CHARS( 0x00000000000FFFF0 ), LONG2CHARS( 0x00000000000FFFF8 ), LONG2CHARS( 0x00000000000FFFFC ), LONG2CHARS( 0x00000000000FFFFE ), LONG2CHARS( 0x00000000000FFFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000040000 ), LONG2CHARS( 0x0000000000060000 ), LONG2CHARS( 0x0000000000070000 ), LONG2CHARS( 0x0000000000078000 ), LONG2CHARS( 0x000000000007C000 ), LONG2CHARS( 0x000000000007E000 ), LONG2CHARS( 0x000000000007F000 ), LONG2CHARS( 0x000000000007F800 ), LONG2CHARS( 0x000000000007FC00 ), LONG2CHARS( 0x000000000007FE00 ), LONG2CHARS( 0x000000000007FF00 ), LONG2CHARS( 0x000000000007FF80 ), LONG2CHARS( 0x000000000007FFC0 ), LONG2CHARS( 0x000000000007FFE0 ), LONG2CHARS( 0x000000000007FFF0 ), LONG2CHARS( 0x000000000007FFF8 ), LONG2CHARS( 0x000000000007FFFC ), LONG2CHARS( 0x000000000007FFFE ), LONG2CHARS( 0x000000000007FFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000020000 ), LONG2CHARS( 0x0000000000030000 ), LONG2CHARS( 0x0000000000038000 ), LONG2CHARS( 0x000000000003C000 ), LONG2CHARS( 0x000000000003E000 ), LONG2CHARS( 0x000000000003F000 ), LONG2CHARS( 0x000000000003F800 ), LONG2CHARS( 0x000000000003FC00 ), LONG2CHARS( 0x000000000003FE00 ), LONG2CHARS( 0x000000000003FF00 ), LONG2CHARS( 0x000000000003FF80 ), LONG2CHARS( 0x000000000003FFC0 ), LONG2CHARS( 0x000000000003FFE0 ), LONG2CHARS( 0x000000000003FFF0 ), LONG2CHARS( 0x000000000003FFF8 ), LONG2CHARS( 0x000000000003FFFC ), LONG2CHARS( 0x000000000003FFFE ), LONG2CHARS( 0x000000000003FFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000010000 ), LONG2CHARS( 0x0000000000018000 ), LONG2CHARS( 0x000000000001C000 ), LONG2CHARS( 0x000000000001E000 ), LONG2CHARS( 0x000000000001F000 ), LONG2CHARS( 0x000000000001F800 ), LONG2CHARS( 0x000000000001FC00 ), LONG2CHARS( 0x000000000001FE00 ), LONG2CHARS( 0x000000000001FF00 ), LONG2CHARS( 0x000000000001FF80 ), LONG2CHARS( 0x000000000001FFC0 ), LONG2CHARS( 0x000000000001FFE0 ), LONG2CHARS( 0x000000000001FFF0 ), LONG2CHARS( 0x000000000001FFF8 ), LONG2CHARS( 0x000000000001FFFC ), LONG2CHARS( 0x000000000001FFFE ), LONG2CHARS( 0x000000000001FFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000008000 ), LONG2CHARS( 0x000000000000C000 ), LONG2CHARS( 0x000000000000E000 ), LONG2CHARS( 0x000000000000F000 ), LONG2CHARS( 0x000000000000F800 ), LONG2CHARS( 0x000000000000FC00 ), LONG2CHARS( 0x000000000000FE00 ), LONG2CHARS( 0x000000000000FF00 ), LONG2CHARS( 0x000000000000FF80 ), LONG2CHARS( 0x000000000000FFC0 ), LONG2CHARS( 0x000000000000FFE0 ), LONG2CHARS( 0x000000000000FFF0 ), LONG2CHARS( 0x000000000000FFF8 ), LONG2CHARS( 0x000000000000FFFC ), LONG2CHARS( 0x000000000000FFFE ), LONG2CHARS( 0x000000000000FFFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000004000 ), LONG2CHARS( 0x0000000000006000 ), LONG2CHARS( 0x0000000000007000 ), LONG2CHARS( 0x0000000000007800 ), LONG2CHARS( 0x0000000000007C00 ), LONG2CHARS( 0x0000000000007E00 ), LONG2CHARS( 0x0000000000007F00 ), LONG2CHARS( 0x0000000000007F80 ), LONG2CHARS( 0x0000000000007FC0 ), LONG2CHARS( 0x0000000000007FE0 ), LONG2CHARS( 0x0000000000007FF0 ), LONG2CHARS( 0x0000000000007FF8 ), LONG2CHARS( 0x0000000000007FFC ), LONG2CHARS( 0x0000000000007FFE ), LONG2CHARS( 0x0000000000007FFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000002000 ), LONG2CHARS( 0x0000000000003000 ), LONG2CHARS( 0x0000000000003800 ), LONG2CHARS( 0x0000000000003C00 ), LONG2CHARS( 0x0000000000003E00 ), LONG2CHARS( 0x0000000000003F00 ), LONG2CHARS( 0x0000000000003F80 ), LONG2CHARS( 0x0000000000003FC0 ), LONG2CHARS( 0x0000000000003FE0 ), LONG2CHARS( 0x0000000000003FF0 ), LONG2CHARS( 0x0000000000003FF8 ), LONG2CHARS( 0x0000000000003FFC ), LONG2CHARS( 0x0000000000003FFE ), LONG2CHARS( 0x0000000000003FFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000001000 ), LONG2CHARS( 0x0000000000001800 ), LONG2CHARS( 0x0000000000001C00 ), LONG2CHARS( 0x0000000000001E00 ), LONG2CHARS( 0x0000000000001F00 ), LONG2CHARS( 0x0000000000001F80 ), LONG2CHARS( 0x0000000000001FC0 ), LONG2CHARS( 0x0000000000001FE0 ), LONG2CHARS( 0x0000000000001FF0 ), LONG2CHARS( 0x0000000000001FF8 ), LONG2CHARS( 0x0000000000001FFC ), LONG2CHARS( 0x0000000000001FFE ), LONG2CHARS( 0x0000000000001FFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000800 ), LONG2CHARS( 0x0000000000000C00 ), LONG2CHARS( 0x0000000000000E00 ), LONG2CHARS( 0x0000000000000F00 ), LONG2CHARS( 0x0000000000000F80 ), LONG2CHARS( 0x0000000000000FC0 ), LONG2CHARS( 0x0000000000000FE0 ), LONG2CHARS( 0x0000000000000FF0 ), LONG2CHARS( 0x0000000000000FF8 ), LONG2CHARS( 0x0000000000000FFC ), LONG2CHARS( 0x0000000000000FFE ), LONG2CHARS( 0x0000000000000FFF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000400 ), LONG2CHARS( 0x0000000000000600 ), LONG2CHARS( 0x0000000000000700 ), LONG2CHARS( 0x0000000000000780 ), LONG2CHARS( 0x00000000000007C0 ), LONG2CHARS( 0x00000000000007E0 ), LONG2CHARS( 0x00000000000007F0 ), LONG2CHARS( 0x00000000000007F8 ), LONG2CHARS( 0x00000000000007FC ), LONG2CHARS( 0x00000000000007FE ), LONG2CHARS( 0x00000000000007FF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000200 ), LONG2CHARS( 0x0000000000000300 ), LONG2CHARS( 0x0000000000000380 ), LONG2CHARS( 0x00000000000003C0 ), LONG2CHARS( 0x00000000000003E0 ), LONG2CHARS( 0x00000000000003F0 ), LONG2CHARS( 0x00000000000003F8 ), LONG2CHARS( 0x00000000000003FC ), LONG2CHARS( 0x00000000000003FE ), LONG2CHARS( 0x00000000000003FF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000100 ), LONG2CHARS( 0x0000000000000180 ), LONG2CHARS( 0x00000000000001C0 ), LONG2CHARS( 0x00000000000001E0 ), LONG2CHARS( 0x00000000000001F0 ), LONG2CHARS( 0x00000000000001F8 ), LONG2CHARS( 0x00000000000001FC ), LONG2CHARS( 0x00000000000001FE ), LONG2CHARS( 0x00000000000001FF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000080 ), LONG2CHARS( 0x00000000000000C0 ), LONG2CHARS( 0x00000000000000E0 ), LONG2CHARS( 0x00000000000000F0 ), LONG2CHARS( 0x00000000000000F8 ), LONG2CHARS( 0x00000000000000FC ), LONG2CHARS( 0x00000000000000FE ), LONG2CHARS( 0x00000000000000FF ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000040 ), LONG2CHARS( 0x0000000000000060 ), LONG2CHARS( 0x0000000000000070 ), LONG2CHARS( 0x0000000000000078 ), LONG2CHARS( 0x000000000000007C ), LONG2CHARS( 0x000000000000007E ), LONG2CHARS( 0x000000000000007F ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000020 ), LONG2CHARS( 0x0000000000000030 ), LONG2CHARS( 0x0000000000000038 ), LONG2CHARS( 0x000000000000003C ), LONG2CHARS( 0x000000000000003E ), LONG2CHARS( 0x000000000000003F ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000010 ), LONG2CHARS( 0x0000000000000018 ), LONG2CHARS( 0x000000000000001C ), LONG2CHARS( 0x000000000000001E ), LONG2CHARS( 0x000000000000001F ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000008 ), LONG2CHARS( 0x000000000000000C ), LONG2CHARS( 0x000000000000000E ), LONG2CHARS( 0x000000000000000F ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000004 ), LONG2CHARS( 0x0000000000000006 ), LONG2CHARS( 0x0000000000000007 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000002 ), LONG2CHARS( 0x0000000000000003 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000001 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, }; #endif /* PPW */ #else /* LSBFirst */ /* NOTE: the first element in starttab could be LONG2CHARS( 0xffffffff. making it 0 lets us deal with a full first word in the middle loop ), rather than having to do the multiple reads and masks that we'd have to do if we thought it was partial. */ PixelType starttab[PPW+1] = { #if PPW == 32 LONG2CHARS( 0x00000000 ), LONG2CHARS( 0xFFFFFFFE ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0x00000000 ) #else /* PPW == 64 */ LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0xFFFFFFFFFFFFFFFE ), LONG2CHARS( 0xFFFFFFFFFFFFFFFC ), LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ), LONG2CHARS( 0xFFFFFFFFFFFFFF80 ), LONG2CHARS( 0xFFFFFFFFFFFFFF00 ), LONG2CHARS( 0xFFFFFFFFFFFFFE00 ), LONG2CHARS( 0xFFFFFFFFFFFFFC00 ), LONG2CHARS( 0xFFFFFFFFFFFFF800 ), LONG2CHARS( 0xFFFFFFFFFFFFF000 ), LONG2CHARS( 0xFFFFFFFFFFFFE000 ), LONG2CHARS( 0xFFFFFFFFFFFFC000 ), LONG2CHARS( 0xFFFFFFFFFFFF8000 ), LONG2CHARS( 0xFFFFFFFFFFFF0000 ), LONG2CHARS( 0xFFFFFFFFFFFE0000 ), LONG2CHARS( 0xFFFFFFFFFFFC0000 ), LONG2CHARS( 0xFFFFFFFFFFF80000 ), LONG2CHARS( 0xFFFFFFFFFFF00000 ), LONG2CHARS( 0xFFFFFFFFFFE00000 ), LONG2CHARS( 0xFFFFFFFFFFC00000 ), LONG2CHARS( 0xFFFFFFFFFF800000 ), LONG2CHARS( 0xFFFFFFFFFF000000 ), LONG2CHARS( 0xFFFFFFFFFE000000 ), LONG2CHARS( 0xFFFFFFFFFC000000 ), LONG2CHARS( 0xFFFFFFFFF8000000 ), LONG2CHARS( 0xFFFFFFFFF0000000 ), LONG2CHARS( 0xFFFFFFFFE0000000 ), LONG2CHARS( 0xFFFFFFFFC0000000 ), LONG2CHARS( 0xFFFFFFFF80000000 ), LONG2CHARS( 0xFFFFFFFF00000000 ), LONG2CHARS( 0xFFFFFFFE00000000 ), LONG2CHARS( 0xFFFFFFFC00000000 ), LONG2CHARS( 0xFFFFFFF800000000 ), LONG2CHARS( 0xFFFFFFF000000000 ), LONG2CHARS( 0xFFFFFFE000000000 ), LONG2CHARS( 0xFFFFFFC000000000 ), LONG2CHARS( 0xFFFFFF8000000000 ), LONG2CHARS( 0xFFFFFF0000000000 ), LONG2CHARS( 0xFFFFFE0000000000 ), LONG2CHARS( 0xFFFFFC0000000000 ), LONG2CHARS( 0xFFFFF80000000000 ), LONG2CHARS( 0xFFFFF00000000000 ), LONG2CHARS( 0xFFFFE00000000000 ), LONG2CHARS( 0xFFFFC00000000000 ), LONG2CHARS( 0xFFFF800000000000 ), LONG2CHARS( 0xFFFF000000000000 ), LONG2CHARS( 0xFFFE000000000000 ), LONG2CHARS( 0xFFFC000000000000 ), LONG2CHARS( 0xFFF8000000000000 ), LONG2CHARS( 0xFFF0000000000000 ), LONG2CHARS( 0xFFE0000000000000 ), LONG2CHARS( 0xFFC0000000000000 ), LONG2CHARS( 0xFF80000000000000 ), LONG2CHARS( 0xFF00000000000000 ), LONG2CHARS( 0xFE00000000000000 ), LONG2CHARS( 0xFC00000000000000 ), LONG2CHARS( 0xF800000000000000 ), LONG2CHARS( 0xF000000000000000 ), LONG2CHARS( 0xE000000000000000 ), LONG2CHARS( 0xC000000000000000 ), LONG2CHARS( 0x8000000000000000 ), LONG2CHARS( 0x0000000000000000 ) #endif /* PPW */ }; PixelType endtab[PPW+1] = { LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x7FFFFFFF ), LONG2CHARS( 0xFFFFFFFF ) #if PPW == 64 , LONG2CHARS( 0x00000001FFFFFFFF ), LONG2CHARS( 0x00000003FFFFFFFF ), LONG2CHARS( 0x00000007FFFFFFFF ), LONG2CHARS( 0x0000000FFFFFFFFF ), LONG2CHARS( 0x0000001FFFFFFFFF ), LONG2CHARS( 0x0000003FFFFFFFFF ), LONG2CHARS( 0x0000007FFFFFFFFF ), LONG2CHARS( 0x000000FFFFFFFFFF ), LONG2CHARS( 0x000001FFFFFFFFFF ), LONG2CHARS( 0x000003FFFFFFFFFF ), LONG2CHARS( 0x000007FFFFFFFFFF ), LONG2CHARS( 0x00000FFFFFFFFFFF ), LONG2CHARS( 0x00001FFFFFFFFFFF ), LONG2CHARS( 0x00003FFFFFFFFFFF ), LONG2CHARS( 0x00007FFFFFFFFFFF ), LONG2CHARS( 0x0000FFFFFFFFFFFF ), LONG2CHARS( 0x0001FFFFFFFFFFFF ), LONG2CHARS( 0x0003FFFFFFFFFFFF ), LONG2CHARS( 0x0007FFFFFFFFFFFF ), LONG2CHARS( 0x000FFFFFFFFFFFFF ), LONG2CHARS( 0x001FFFFFFFFFFFFF ), LONG2CHARS( 0x003FFFFFFFFFFFFF ), LONG2CHARS( 0x007FFFFFFFFFFFFF ), LONG2CHARS( 0x00FFFFFFFFFFFFFF ), LONG2CHARS( 0x01FFFFFFFFFFFFFF ), LONG2CHARS( 0x03FFFFFFFFFFFFFF ), LONG2CHARS( 0x07FFFFFFFFFFFFFF ), LONG2CHARS( 0x0FFFFFFFFFFFFFFF ), LONG2CHARS( 0x1FFFFFFFFFFFFFFF ), LONG2CHARS( 0x3FFFFFFFFFFFFFFF ), LONG2CHARS( 0x7FFFFFFFFFFFFFFF ), LONG2CHARS( 0xFFFFFFFFFFFFFFFF ) #endif /* PPW */ }; #ifdef NEED_OLD_MFB_MASKS /* a hack ), for now, since the entries for 0 need to be all 1 bits ), not all zeros. this means the code DOES NOT WORK for segments of length 0 (which is only a problem in the horizontal line code.) */ PixelType startpartial[33] = { LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0xFFFFFFFE ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0x00000000 ) }; PixelType endpartial[33] = { LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x7FFFFFFF ), LONG2CHARS( 0xFFFFFFFF ) }; #endif #if PPW == 32 PixelType partmasks[PPW][PPW] = { {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ), LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ), LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000007FF ), LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00007FFF ), LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0007FFFF ), LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x007FFFFF ), LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x07FFFFFF ), LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x7FFFFFFF )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x0000000E ), LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x000000FE ), LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x00000FFE ), LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x0000FFFE ), LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x000FFFFE ), LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x00FFFFFE ), LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x0FFFFFFE ), LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0xFFFFFFFE )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000001C ), LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000001FC ), LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00001FFC ), LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0001FFFC ), LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x001FFFFC ), LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x01FFFFFC ), LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x1FFFFFFC ), LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x00000038 ), LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000003F8 ), LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00003FF8 ), LONG2CHARS( 0X00007FF8 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0003FFF8 ), LONG2CHARS( 0X0007FFF8 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x003FFFF8 ), LONG2CHARS( 0X007FFFF8 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x03FFFFF8 ), LONG2CHARS( 0X07FFFFF8 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x3FFFFFF8 ), LONG2CHARS( 0X7FFFFFF8 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000070 ), LONG2CHARS( 0X000000F0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000007F0 ), LONG2CHARS( 0X00000FF0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00007FF0 ), LONG2CHARS( 0X0000FFF0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0007FFF0 ), LONG2CHARS( 0X000FFFF0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x007FFFF0 ), LONG2CHARS( 0X00FFFFF0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x07FFFFF0 ), LONG2CHARS( 0X0FFFFFF0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x7FFFFFF0 ), LONG2CHARS( 0XFFFFFFF0 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x000000E0 ), LONG2CHARS( 0X000001E0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x00000FE0 ), LONG2CHARS( 0X00001FE0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x0000FFE0 ), LONG2CHARS( 0X0001FFE0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x000FFFE0 ), LONG2CHARS( 0X001FFFE0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x00FFFFE0 ), LONG2CHARS( 0X01FFFFE0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x0FFFFFE0 ), LONG2CHARS( 0X1FFFFFE0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0xFFFFFFE0 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000001C0 ), LONG2CHARS( 0X000003C0 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00001FC0 ), LONG2CHARS( 0X00003FC0 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0001FFC0 ), LONG2CHARS( 0X0003FFC0 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x001FFFC0 ), LONG2CHARS( 0X003FFFC0 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x01FFFFC0 ), LONG2CHARS( 0X03FFFFC0 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x1FFFFFC0 ), LONG2CHARS( 0X3FFFFFC0 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x00000380 ), LONG2CHARS( 0X00000780 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00003F80 ), LONG2CHARS( 0X00007F80 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0003FF80 ), LONG2CHARS( 0X0007FF80 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x003FFF80 ), LONG2CHARS( 0X007FFF80 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x03FFFF80 ), LONG2CHARS( 0X07FFFF80 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x3FFFFF80 ), LONG2CHARS( 0X7FFFFF80 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000700 ), LONG2CHARS( 0X00000F00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00007F00 ), LONG2CHARS( 0X0000FF00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0007FF00 ), LONG2CHARS( 0X000FFF00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x007FFF00 ), LONG2CHARS( 0X00FFFF00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x07FFFF00 ), LONG2CHARS( 0X0FFFFF00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x7FFFFF00 ), LONG2CHARS( 0XFFFFFF00 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000E00 ), LONG2CHARS( 0X00001E00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x0000FE00 ), LONG2CHARS( 0X0001FE00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x000FFE00 ), LONG2CHARS( 0X001FFE00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x00FFFE00 ), LONG2CHARS( 0X01FFFE00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x0FFFFE00 ), LONG2CHARS( 0X1FFFFE00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0xFFFFFE00 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00001C00 ), LONG2CHARS( 0X00003C00 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0001FC00 ), LONG2CHARS( 0X0003FC00 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x001FFC00 ), LONG2CHARS( 0X003FFC00 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x01FFFC00 ), LONG2CHARS( 0X03FFFC00 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x1FFFFC00 ), LONG2CHARS( 0X3FFFFC00 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00003800 ), LONG2CHARS( 0X00007800 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0003F800 ), LONG2CHARS( 0X0007F800 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x003FF800 ), LONG2CHARS( 0X007FF800 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x03FFF800 ), LONG2CHARS( 0X07FFF800 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x3FFFF800 ), LONG2CHARS( 0X7FFFF800 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00007000 ), LONG2CHARS( 0X0000F000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0007F000 ), LONG2CHARS( 0X000FF000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x007FF000 ), LONG2CHARS( 0X00FFF000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x07FFF000 ), LONG2CHARS( 0X0FFFF000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x7FFFF000 ), LONG2CHARS( 0XFFFFF000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x0000E000 ), LONG2CHARS( 0X0001E000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x000FE000 ), LONG2CHARS( 0X001FE000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x00FFE000 ), LONG2CHARS( 0X01FFE000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x0FFFE000 ), LONG2CHARS( 0X1FFFE000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0xFFFFE000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0001C000 ), LONG2CHARS( 0X0003C000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x001FC000 ), LONG2CHARS( 0X003FC000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x01FFC000 ), LONG2CHARS( 0X03FFC000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x1FFFC000 ), LONG2CHARS( 0X3FFFC000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x00038000 ), LONG2CHARS( 0X00078000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x003F8000 ), LONG2CHARS( 0X007F8000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x03FF8000 ), LONG2CHARS( 0X07FF8000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x3FFF8000 ), LONG2CHARS( 0X7FFF8000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00070000 ), LONG2CHARS( 0X000F0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x007F0000 ), LONG2CHARS( 0X00FF0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x07FF0000 ), LONG2CHARS( 0X0FFF0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x7FFF0000 ), LONG2CHARS( 0XFFFF0000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x000E0000 ), LONG2CHARS( 0X001E0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x00FE0000 ), LONG2CHARS( 0X01FE0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x0FFE0000 ), LONG2CHARS( 0X1FFE0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0xFFFE0000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x001C0000 ), LONG2CHARS( 0X003C0000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x01FC0000 ), LONG2CHARS( 0X03FC0000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x1FFC0000 ), LONG2CHARS( 0X3FFC0000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x00380000 ), LONG2CHARS( 0X00780000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x03F80000 ), LONG2CHARS( 0X07F80000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x3FF80000 ), LONG2CHARS( 0X7FF80000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00700000 ), LONG2CHARS( 0X00F00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x07F00000 ), LONG2CHARS( 0X0FF00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x7FF00000 ), LONG2CHARS( 0XFFF00000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00E00000 ), LONG2CHARS( 0X01E00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x0FE00000 ), LONG2CHARS( 0X1FE00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0xFFE00000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x01C00000 ), LONG2CHARS( 0X03C00000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x1FC00000 ), LONG2CHARS( 0X3FC00000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x03800000 ), LONG2CHARS( 0X07800000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x3F800000 ), LONG2CHARS( 0X7F800000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x07000000 ), LONG2CHARS( 0X0F000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x7F000000 ), LONG2CHARS( 0XFF000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x0E000000 ), LONG2CHARS( 0X1E000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0xFE000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x1C000000 ), LONG2CHARS( 0X3C000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x38000000 ), LONG2CHARS( 0X78000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x70000000 ), LONG2CHARS( 0XF0000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0xE0000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, }; #else /* PPW == 64 */ unsigned long partmasks[PPW][PPW] = { { LONG2CHARS( 0xFFFFFFFFFFFFFFFF ), LONG2CHARS( 0x0000000000000001 ), LONG2CHARS( 0x0000000000000003 ), LONG2CHARS( 0x0000000000000007 ), LONG2CHARS( 0x000000000000000F ), LONG2CHARS( 0x000000000000001F ), LONG2CHARS( 0x000000000000003F ), LONG2CHARS( 0x000000000000007F ), LONG2CHARS( 0x00000000000000FF ), LONG2CHARS( 0x00000000000001FF ), LONG2CHARS( 0x00000000000003FF ), LONG2CHARS( 0x00000000000007FF ), LONG2CHARS( 0x0000000000000FFF ), LONG2CHARS( 0x0000000000001FFF ), LONG2CHARS( 0x0000000000003FFF ), LONG2CHARS( 0x0000000000007FFF ), LONG2CHARS( 0x000000000000FFFF ), LONG2CHARS( 0x000000000001FFFF ), LONG2CHARS( 0x000000000003FFFF ), LONG2CHARS( 0x000000000007FFFF ), LONG2CHARS( 0x00000000000FFFFF ), LONG2CHARS( 0x00000000001FFFFF ), LONG2CHARS( 0x00000000003FFFFF ), LONG2CHARS( 0x00000000007FFFFF ), LONG2CHARS( 0x0000000000FFFFFF ), LONG2CHARS( 0x0000000001FFFFFF ), LONG2CHARS( 0x0000000003FFFFFF ), LONG2CHARS( 0x0000000007FFFFFF ), LONG2CHARS( 0x000000000FFFFFFF ), LONG2CHARS( 0x000000001FFFFFFF ), LONG2CHARS( 0x000000003FFFFFFF ), LONG2CHARS( 0x000000007FFFFFFF ), LONG2CHARS( 0x00000000FFFFFFFF ), LONG2CHARS( 0x00000001FFFFFFFF ), LONG2CHARS( 0x00000003FFFFFFFF ), LONG2CHARS( 0x00000007FFFFFFFF ), LONG2CHARS( 0x0000000FFFFFFFFF ), LONG2CHARS( 0x0000001FFFFFFFFF ), LONG2CHARS( 0x0000003FFFFFFFFF ), LONG2CHARS( 0x0000007FFFFFFFFF ), LONG2CHARS( 0x000000FFFFFFFFFF ), LONG2CHARS( 0x000001FFFFFFFFFF ), LONG2CHARS( 0x000003FFFFFFFFFF ), LONG2CHARS( 0x000007FFFFFFFFFF ), LONG2CHARS( 0x00000FFFFFFFFFFF ), LONG2CHARS( 0x00001FFFFFFFFFFF ), LONG2CHARS( 0x00003FFFFFFFFFFF ), LONG2CHARS( 0x00007FFFFFFFFFFF ), LONG2CHARS( 0x0000FFFFFFFFFFFF ), LONG2CHARS( 0x0001FFFFFFFFFFFF ), LONG2CHARS( 0x0003FFFFFFFFFFFF ), LONG2CHARS( 0x0007FFFFFFFFFFFF ), LONG2CHARS( 0x000FFFFFFFFFFFFF ), LONG2CHARS( 0x001FFFFFFFFFFFFF ), LONG2CHARS( 0x003FFFFFFFFFFFFF ), LONG2CHARS( 0x007FFFFFFFFFFFFF ), LONG2CHARS( 0x00FFFFFFFFFFFFFF ), LONG2CHARS( 0x01FFFFFFFFFFFFFF ), LONG2CHARS( 0x03FFFFFFFFFFFFFF ), LONG2CHARS( 0x07FFFFFFFFFFFFFF ), LONG2CHARS( 0x0FFFFFFFFFFFFFFF ), LONG2CHARS( 0x1FFFFFFFFFFFFFFF ), LONG2CHARS( 0x3FFFFFFFFFFFFFFF ), LONG2CHARS( 0x7FFFFFFFFFFFFFFF ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000002 ), LONG2CHARS( 0x0000000000000006 ), LONG2CHARS( 0x000000000000000E ), LONG2CHARS( 0x000000000000001E ), LONG2CHARS( 0x000000000000003E ), LONG2CHARS( 0x000000000000007E ), LONG2CHARS( 0x00000000000000FE ), LONG2CHARS( 0x00000000000001FE ), LONG2CHARS( 0x00000000000003FE ), LONG2CHARS( 0x00000000000007FE ), LONG2CHARS( 0x0000000000000FFE ), LONG2CHARS( 0x0000000000001FFE ), LONG2CHARS( 0x0000000000003FFE ), LONG2CHARS( 0x0000000000007FFE ), LONG2CHARS( 0x000000000000FFFE ), LONG2CHARS( 0x000000000001FFFE ), LONG2CHARS( 0x000000000003FFFE ), LONG2CHARS( 0x000000000007FFFE ), LONG2CHARS( 0x00000000000FFFFE ), LONG2CHARS( 0x00000000001FFFFE ), LONG2CHARS( 0x00000000003FFFFE ), LONG2CHARS( 0x00000000007FFFFE ), LONG2CHARS( 0x0000000000FFFFFE ), LONG2CHARS( 0x0000000001FFFFFE ), LONG2CHARS( 0x0000000003FFFFFE ), LONG2CHARS( 0x0000000007FFFFFE ), LONG2CHARS( 0x000000000FFFFFFE ), LONG2CHARS( 0x000000001FFFFFFE ), LONG2CHARS( 0x000000003FFFFFFE ), LONG2CHARS( 0x000000007FFFFFFE ), LONG2CHARS( 0x00000000FFFFFFFE ), LONG2CHARS( 0x00000001FFFFFFFE ), LONG2CHARS( 0x00000003FFFFFFFE ), LONG2CHARS( 0x00000007FFFFFFFE ), LONG2CHARS( 0x0000000FFFFFFFFE ), LONG2CHARS( 0x0000001FFFFFFFFE ), LONG2CHARS( 0x0000003FFFFFFFFE ), LONG2CHARS( 0x0000007FFFFFFFFE ), LONG2CHARS( 0x000000FFFFFFFFFE ), LONG2CHARS( 0x000001FFFFFFFFFE ), LONG2CHARS( 0x000003FFFFFFFFFE ), LONG2CHARS( 0x000007FFFFFFFFFE ), LONG2CHARS( 0x00000FFFFFFFFFFE ), LONG2CHARS( 0x00001FFFFFFFFFFE ), LONG2CHARS( 0x00003FFFFFFFFFFE ), LONG2CHARS( 0x00007FFFFFFFFFFE ), LONG2CHARS( 0x0000FFFFFFFFFFFE ), LONG2CHARS( 0x0001FFFFFFFFFFFE ), LONG2CHARS( 0x0003FFFFFFFFFFFE ), LONG2CHARS( 0x0007FFFFFFFFFFFE ), LONG2CHARS( 0x000FFFFFFFFFFFFE ), LONG2CHARS( 0x001FFFFFFFFFFFFE ), LONG2CHARS( 0x003FFFFFFFFFFFFE ), LONG2CHARS( 0x007FFFFFFFFFFFFE ), LONG2CHARS( 0x00FFFFFFFFFFFFFE ), LONG2CHARS( 0x01FFFFFFFFFFFFFE ), LONG2CHARS( 0x03FFFFFFFFFFFFFE ), LONG2CHARS( 0x07FFFFFFFFFFFFFE ), LONG2CHARS( 0x0FFFFFFFFFFFFFFE ), LONG2CHARS( 0x1FFFFFFFFFFFFFFE ), LONG2CHARS( 0x3FFFFFFFFFFFFFFE ), LONG2CHARS( 0x7FFFFFFFFFFFFFFE ), LONG2CHARS( 0xFFFFFFFFFFFFFFFE ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000004 ), LONG2CHARS( 0x000000000000000C ), LONG2CHARS( 0x000000000000001C ), LONG2CHARS( 0x000000000000003C ), LONG2CHARS( 0x000000000000007C ), LONG2CHARS( 0x00000000000000FC ), LONG2CHARS( 0x00000000000001FC ), LONG2CHARS( 0x00000000000003FC ), LONG2CHARS( 0x00000000000007FC ), LONG2CHARS( 0x0000000000000FFC ), LONG2CHARS( 0x0000000000001FFC ), LONG2CHARS( 0x0000000000003FFC ), LONG2CHARS( 0x0000000000007FFC ), LONG2CHARS( 0x000000000000FFFC ), LONG2CHARS( 0x000000000001FFFC ), LONG2CHARS( 0x000000000003FFFC ), LONG2CHARS( 0x000000000007FFFC ), LONG2CHARS( 0x00000000000FFFFC ), LONG2CHARS( 0x00000000001FFFFC ), LONG2CHARS( 0x00000000003FFFFC ), LONG2CHARS( 0x00000000007FFFFC ), LONG2CHARS( 0x0000000000FFFFFC ), LONG2CHARS( 0x0000000001FFFFFC ), LONG2CHARS( 0x0000000003FFFFFC ), LONG2CHARS( 0x0000000007FFFFFC ), LONG2CHARS( 0x000000000FFFFFFC ), LONG2CHARS( 0x000000001FFFFFFC ), LONG2CHARS( 0x000000003FFFFFFC ), LONG2CHARS( 0x000000007FFFFFFC ), LONG2CHARS( 0x00000000FFFFFFFC ), LONG2CHARS( 0x00000001FFFFFFFC ), LONG2CHARS( 0x00000003FFFFFFFC ), LONG2CHARS( 0x00000007FFFFFFFC ), LONG2CHARS( 0x0000000FFFFFFFFC ), LONG2CHARS( 0x0000001FFFFFFFFC ), LONG2CHARS( 0x0000003FFFFFFFFC ), LONG2CHARS( 0x0000007FFFFFFFFC ), LONG2CHARS( 0x000000FFFFFFFFFC ), LONG2CHARS( 0x000001FFFFFFFFFC ), LONG2CHARS( 0x000003FFFFFFFFFC ), LONG2CHARS( 0x000007FFFFFFFFFC ), LONG2CHARS( 0x00000FFFFFFFFFFC ), LONG2CHARS( 0x00001FFFFFFFFFFC ), LONG2CHARS( 0x00003FFFFFFFFFFC ), LONG2CHARS( 0x00007FFFFFFFFFFC ), LONG2CHARS( 0x0000FFFFFFFFFFFC ), LONG2CHARS( 0x0001FFFFFFFFFFFC ), LONG2CHARS( 0x0003FFFFFFFFFFFC ), LONG2CHARS( 0x0007FFFFFFFFFFFC ), LONG2CHARS( 0x000FFFFFFFFFFFFC ), LONG2CHARS( 0x001FFFFFFFFFFFFC ), LONG2CHARS( 0x003FFFFFFFFFFFFC ), LONG2CHARS( 0x007FFFFFFFFFFFFC ), LONG2CHARS( 0x00FFFFFFFFFFFFFC ), LONG2CHARS( 0x01FFFFFFFFFFFFFC ), LONG2CHARS( 0x03FFFFFFFFFFFFFC ), LONG2CHARS( 0x07FFFFFFFFFFFFFC ), LONG2CHARS( 0x0FFFFFFFFFFFFFFC ), LONG2CHARS( 0x1FFFFFFFFFFFFFFC ), LONG2CHARS( 0x3FFFFFFFFFFFFFFC ), LONG2CHARS( 0x7FFFFFFFFFFFFFFC ), LONG2CHARS( 0xFFFFFFFFFFFFFFFC ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000008 ), LONG2CHARS( 0x0000000000000018 ), LONG2CHARS( 0x0000000000000038 ), LONG2CHARS( 0x0000000000000078 ), LONG2CHARS( 0x00000000000000F8 ), LONG2CHARS( 0x00000000000001F8 ), LONG2CHARS( 0x00000000000003F8 ), LONG2CHARS( 0x00000000000007F8 ), LONG2CHARS( 0x0000000000000FF8 ), LONG2CHARS( 0x0000000000001FF8 ), LONG2CHARS( 0x0000000000003FF8 ), LONG2CHARS( 0x0000000000007FF8 ), LONG2CHARS( 0x000000000000FFF8 ), LONG2CHARS( 0x000000000001FFF8 ), LONG2CHARS( 0x000000000003FFF8 ), LONG2CHARS( 0x000000000007FFF8 ), LONG2CHARS( 0x00000000000FFFF8 ), LONG2CHARS( 0x00000000001FFFF8 ), LONG2CHARS( 0x00000000003FFFF8 ), LONG2CHARS( 0x00000000007FFFF8 ), LONG2CHARS( 0x0000000000FFFFF8 ), LONG2CHARS( 0x0000000001FFFFF8 ), LONG2CHARS( 0x0000000003FFFFF8 ), LONG2CHARS( 0x0000000007FFFFF8 ), LONG2CHARS( 0x000000000FFFFFF8 ), LONG2CHARS( 0x000000001FFFFFF8 ), LONG2CHARS( 0x000000003FFFFFF8 ), LONG2CHARS( 0x000000007FFFFFF8 ), LONG2CHARS( 0x00000000FFFFFFF8 ), LONG2CHARS( 0x00000001FFFFFFF8 ), LONG2CHARS( 0x00000003FFFFFFF8 ), LONG2CHARS( 0x00000007FFFFFFF8 ), LONG2CHARS( 0x0000000FFFFFFFF8 ), LONG2CHARS( 0x0000001FFFFFFFF8 ), LONG2CHARS( 0x0000003FFFFFFFF8 ), LONG2CHARS( 0x0000007FFFFFFFF8 ), LONG2CHARS( 0x000000FFFFFFFFF8 ), LONG2CHARS( 0x000001FFFFFFFFF8 ), LONG2CHARS( 0x000003FFFFFFFFF8 ), LONG2CHARS( 0x000007FFFFFFFFF8 ), LONG2CHARS( 0x00000FFFFFFFFFF8 ), LONG2CHARS( 0x00001FFFFFFFFFF8 ), LONG2CHARS( 0x00003FFFFFFFFFF8 ), LONG2CHARS( 0x00007FFFFFFFFFF8 ), LONG2CHARS( 0x0000FFFFFFFFFFF8 ), LONG2CHARS( 0x0001FFFFFFFFFFF8 ), LONG2CHARS( 0x0003FFFFFFFFFFF8 ), LONG2CHARS( 0x0007FFFFFFFFFFF8 ), LONG2CHARS( 0x000FFFFFFFFFFFF8 ), LONG2CHARS( 0x001FFFFFFFFFFFF8 ), LONG2CHARS( 0x003FFFFFFFFFFFF8 ), LONG2CHARS( 0x007FFFFFFFFFFFF8 ), LONG2CHARS( 0x00FFFFFFFFFFFFF8 ), LONG2CHARS( 0x01FFFFFFFFFFFFF8 ), LONG2CHARS( 0x03FFFFFFFFFFFFF8 ), LONG2CHARS( 0x07FFFFFFFFFFFFF8 ), LONG2CHARS( 0x0FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x1FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x3FFFFFFFFFFFFFF8 ), LONG2CHARS( 0x7FFFFFFFFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF8 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000010 ), LONG2CHARS( 0x0000000000000030 ), LONG2CHARS( 0x0000000000000070 ), LONG2CHARS( 0x00000000000000F0 ), LONG2CHARS( 0x00000000000001F0 ), LONG2CHARS( 0x00000000000003F0 ), LONG2CHARS( 0x00000000000007F0 ), LONG2CHARS( 0x0000000000000FF0 ), LONG2CHARS( 0x0000000000001FF0 ), LONG2CHARS( 0x0000000000003FF0 ), LONG2CHARS( 0x0000000000007FF0 ), LONG2CHARS( 0x000000000000FFF0 ), LONG2CHARS( 0x000000000001FFF0 ), LONG2CHARS( 0x000000000003FFF0 ), LONG2CHARS( 0x000000000007FFF0 ), LONG2CHARS( 0x00000000000FFFF0 ), LONG2CHARS( 0x00000000001FFFF0 ), LONG2CHARS( 0x00000000003FFFF0 ), LONG2CHARS( 0x00000000007FFFF0 ), LONG2CHARS( 0x0000000000FFFFF0 ), LONG2CHARS( 0x0000000001FFFFF0 ), LONG2CHARS( 0x0000000003FFFFF0 ), LONG2CHARS( 0x0000000007FFFFF0 ), LONG2CHARS( 0x000000000FFFFFF0 ), LONG2CHARS( 0x000000001FFFFFF0 ), LONG2CHARS( 0x000000003FFFFFF0 ), LONG2CHARS( 0x000000007FFFFFF0 ), LONG2CHARS( 0x00000000FFFFFFF0 ), LONG2CHARS( 0x00000001FFFFFFF0 ), LONG2CHARS( 0x00000003FFFFFFF0 ), LONG2CHARS( 0x00000007FFFFFFF0 ), LONG2CHARS( 0x0000000FFFFFFFF0 ), LONG2CHARS( 0x0000001FFFFFFFF0 ), LONG2CHARS( 0x0000003FFFFFFFF0 ), LONG2CHARS( 0x0000007FFFFFFFF0 ), LONG2CHARS( 0x000000FFFFFFFFF0 ), LONG2CHARS( 0x000001FFFFFFFFF0 ), LONG2CHARS( 0x000003FFFFFFFFF0 ), LONG2CHARS( 0x000007FFFFFFFFF0 ), LONG2CHARS( 0x00000FFFFFFFFFF0 ), LONG2CHARS( 0x00001FFFFFFFFFF0 ), LONG2CHARS( 0x00003FFFFFFFFFF0 ), LONG2CHARS( 0x00007FFFFFFFFFF0 ), LONG2CHARS( 0x0000FFFFFFFFFFF0 ), LONG2CHARS( 0x0001FFFFFFFFFFF0 ), LONG2CHARS( 0x0003FFFFFFFFFFF0 ), LONG2CHARS( 0x0007FFFFFFFFFFF0 ), LONG2CHARS( 0x000FFFFFFFFFFFF0 ), LONG2CHARS( 0x001FFFFFFFFFFFF0 ), LONG2CHARS( 0x003FFFFFFFFFFFF0 ), LONG2CHARS( 0x007FFFFFFFFFFFF0 ), LONG2CHARS( 0x00FFFFFFFFFFFFF0 ), LONG2CHARS( 0x01FFFFFFFFFFFFF0 ), LONG2CHARS( 0x03FFFFFFFFFFFFF0 ), LONG2CHARS( 0x07FFFFFFFFFFFFF0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFF0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFF0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFF0 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000020 ), LONG2CHARS( 0x0000000000000060 ), LONG2CHARS( 0x00000000000000E0 ), LONG2CHARS( 0x00000000000001E0 ), LONG2CHARS( 0x00000000000003E0 ), LONG2CHARS( 0x00000000000007E0 ), LONG2CHARS( 0x0000000000000FE0 ), LONG2CHARS( 0x0000000000001FE0 ), LONG2CHARS( 0x0000000000003FE0 ), LONG2CHARS( 0x0000000000007FE0 ), LONG2CHARS( 0x000000000000FFE0 ), LONG2CHARS( 0x000000000001FFE0 ), LONG2CHARS( 0x000000000003FFE0 ), LONG2CHARS( 0x000000000007FFE0 ), LONG2CHARS( 0x00000000000FFFE0 ), LONG2CHARS( 0x00000000001FFFE0 ), LONG2CHARS( 0x00000000003FFFE0 ), LONG2CHARS( 0x00000000007FFFE0 ), LONG2CHARS( 0x0000000000FFFFE0 ), LONG2CHARS( 0x0000000001FFFFE0 ), LONG2CHARS( 0x0000000003FFFFE0 ), LONG2CHARS( 0x0000000007FFFFE0 ), LONG2CHARS( 0x000000000FFFFFE0 ), LONG2CHARS( 0x000000001FFFFFE0 ), LONG2CHARS( 0x000000003FFFFFE0 ), LONG2CHARS( 0x000000007FFFFFE0 ), LONG2CHARS( 0x00000000FFFFFFE0 ), LONG2CHARS( 0x00000001FFFFFFE0 ), LONG2CHARS( 0x00000003FFFFFFE0 ), LONG2CHARS( 0x00000007FFFFFFE0 ), LONG2CHARS( 0x0000000FFFFFFFE0 ), LONG2CHARS( 0x0000001FFFFFFFE0 ), LONG2CHARS( 0x0000003FFFFFFFE0 ), LONG2CHARS( 0x0000007FFFFFFFE0 ), LONG2CHARS( 0x000000FFFFFFFFE0 ), LONG2CHARS( 0x000001FFFFFFFFE0 ), LONG2CHARS( 0x000003FFFFFFFFE0 ), LONG2CHARS( 0x000007FFFFFFFFE0 ), LONG2CHARS( 0x00000FFFFFFFFFE0 ), LONG2CHARS( 0x00001FFFFFFFFFE0 ), LONG2CHARS( 0x00003FFFFFFFFFE0 ), LONG2CHARS( 0x00007FFFFFFFFFE0 ), LONG2CHARS( 0x0000FFFFFFFFFFE0 ), LONG2CHARS( 0x0001FFFFFFFFFFE0 ), LONG2CHARS( 0x0003FFFFFFFFFFE0 ), LONG2CHARS( 0x0007FFFFFFFFFFE0 ), LONG2CHARS( 0x000FFFFFFFFFFFE0 ), LONG2CHARS( 0x001FFFFFFFFFFFE0 ), LONG2CHARS( 0x003FFFFFFFFFFFE0 ), LONG2CHARS( 0x007FFFFFFFFFFFE0 ), LONG2CHARS( 0x00FFFFFFFFFFFFE0 ), LONG2CHARS( 0x01FFFFFFFFFFFFE0 ), LONG2CHARS( 0x03FFFFFFFFFFFFE0 ), LONG2CHARS( 0x07FFFFFFFFFFFFE0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFE0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFE0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFE0 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000040 ), LONG2CHARS( 0x00000000000000C0 ), LONG2CHARS( 0x00000000000001C0 ), LONG2CHARS( 0x00000000000003C0 ), LONG2CHARS( 0x00000000000007C0 ), LONG2CHARS( 0x0000000000000FC0 ), LONG2CHARS( 0x0000000000001FC0 ), LONG2CHARS( 0x0000000000003FC0 ), LONG2CHARS( 0x0000000000007FC0 ), LONG2CHARS( 0x000000000000FFC0 ), LONG2CHARS( 0x000000000001FFC0 ), LONG2CHARS( 0x000000000003FFC0 ), LONG2CHARS( 0x000000000007FFC0 ), LONG2CHARS( 0x00000000000FFFC0 ), LONG2CHARS( 0x00000000001FFFC0 ), LONG2CHARS( 0x00000000003FFFC0 ), LONG2CHARS( 0x00000000007FFFC0 ), LONG2CHARS( 0x0000000000FFFFC0 ), LONG2CHARS( 0x0000000001FFFFC0 ), LONG2CHARS( 0x0000000003FFFFC0 ), LONG2CHARS( 0x0000000007FFFFC0 ), LONG2CHARS( 0x000000000FFFFFC0 ), LONG2CHARS( 0x000000001FFFFFC0 ), LONG2CHARS( 0x000000003FFFFFC0 ), LONG2CHARS( 0x000000007FFFFFC0 ), LONG2CHARS( 0x00000000FFFFFFC0 ), LONG2CHARS( 0x00000001FFFFFFC0 ), LONG2CHARS( 0x00000003FFFFFFC0 ), LONG2CHARS( 0x00000007FFFFFFC0 ), LONG2CHARS( 0x0000000FFFFFFFC0 ), LONG2CHARS( 0x0000001FFFFFFFC0 ), LONG2CHARS( 0x0000003FFFFFFFC0 ), LONG2CHARS( 0x0000007FFFFFFFC0 ), LONG2CHARS( 0x000000FFFFFFFFC0 ), LONG2CHARS( 0x000001FFFFFFFFC0 ), LONG2CHARS( 0x000003FFFFFFFFC0 ), LONG2CHARS( 0x000007FFFFFFFFC0 ), LONG2CHARS( 0x00000FFFFFFFFFC0 ), LONG2CHARS( 0x00001FFFFFFFFFC0 ), LONG2CHARS( 0x00003FFFFFFFFFC0 ), LONG2CHARS( 0x00007FFFFFFFFFC0 ), LONG2CHARS( 0x0000FFFFFFFFFFC0 ), LONG2CHARS( 0x0001FFFFFFFFFFC0 ), LONG2CHARS( 0x0003FFFFFFFFFFC0 ), LONG2CHARS( 0x0007FFFFFFFFFFC0 ), LONG2CHARS( 0x000FFFFFFFFFFFC0 ), LONG2CHARS( 0x001FFFFFFFFFFFC0 ), LONG2CHARS( 0x003FFFFFFFFFFFC0 ), LONG2CHARS( 0x007FFFFFFFFFFFC0 ), LONG2CHARS( 0x00FFFFFFFFFFFFC0 ), LONG2CHARS( 0x01FFFFFFFFFFFFC0 ), LONG2CHARS( 0x03FFFFFFFFFFFFC0 ), LONG2CHARS( 0x07FFFFFFFFFFFFC0 ), LONG2CHARS( 0x0FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x1FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x3FFFFFFFFFFFFFC0 ), LONG2CHARS( 0x7FFFFFFFFFFFFFC0 ), LONG2CHARS( 0xFFFFFFFFFFFFFFC0 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000080 ), LONG2CHARS( 0x0000000000000180 ), LONG2CHARS( 0x0000000000000380 ), LONG2CHARS( 0x0000000000000780 ), LONG2CHARS( 0x0000000000000F80 ), LONG2CHARS( 0x0000000000001F80 ), LONG2CHARS( 0x0000000000003F80 ), LONG2CHARS( 0x0000000000007F80 ), LONG2CHARS( 0x000000000000FF80 ), LONG2CHARS( 0x000000000001FF80 ), LONG2CHARS( 0x000000000003FF80 ), LONG2CHARS( 0x000000000007FF80 ), LONG2CHARS( 0x00000000000FFF80 ), LONG2CHARS( 0x00000000001FFF80 ), LONG2CHARS( 0x00000000003FFF80 ), LONG2CHARS( 0x00000000007FFF80 ), LONG2CHARS( 0x0000000000FFFF80 ), LONG2CHARS( 0x0000000001FFFF80 ), LONG2CHARS( 0x0000000003FFFF80 ), LONG2CHARS( 0x0000000007FFFF80 ), LONG2CHARS( 0x000000000FFFFF80 ), LONG2CHARS( 0x000000001FFFFF80 ), LONG2CHARS( 0x000000003FFFFF80 ), LONG2CHARS( 0x000000007FFFFF80 ), LONG2CHARS( 0x00000000FFFFFF80 ), LONG2CHARS( 0x00000001FFFFFF80 ), LONG2CHARS( 0x00000003FFFFFF80 ), LONG2CHARS( 0x00000007FFFFFF80 ), LONG2CHARS( 0x0000000FFFFFFF80 ), LONG2CHARS( 0x0000001FFFFFFF80 ), LONG2CHARS( 0x0000003FFFFFFF80 ), LONG2CHARS( 0x0000007FFFFFFF80 ), LONG2CHARS( 0x000000FFFFFFFF80 ), LONG2CHARS( 0x000001FFFFFFFF80 ), LONG2CHARS( 0x000003FFFFFFFF80 ), LONG2CHARS( 0x000007FFFFFFFF80 ), LONG2CHARS( 0x00000FFFFFFFFF80 ), LONG2CHARS( 0x00001FFFFFFFFF80 ), LONG2CHARS( 0x00003FFFFFFFFF80 ), LONG2CHARS( 0x00007FFFFFFFFF80 ), LONG2CHARS( 0x0000FFFFFFFFFF80 ), LONG2CHARS( 0x0001FFFFFFFFFF80 ), LONG2CHARS( 0x0003FFFFFFFFFF80 ), LONG2CHARS( 0x0007FFFFFFFFFF80 ), LONG2CHARS( 0x000FFFFFFFFFFF80 ), LONG2CHARS( 0x001FFFFFFFFFFF80 ), LONG2CHARS( 0x003FFFFFFFFFFF80 ), LONG2CHARS( 0x007FFFFFFFFFFF80 ), LONG2CHARS( 0x00FFFFFFFFFFFF80 ), LONG2CHARS( 0x01FFFFFFFFFFFF80 ), LONG2CHARS( 0x03FFFFFFFFFFFF80 ), LONG2CHARS( 0x07FFFFFFFFFFFF80 ), LONG2CHARS( 0x0FFFFFFFFFFFFF80 ), LONG2CHARS( 0x1FFFFFFFFFFFFF80 ), LONG2CHARS( 0x3FFFFFFFFFFFFF80 ), LONG2CHARS( 0x7FFFFFFFFFFFFF80 ), LONG2CHARS( 0xFFFFFFFFFFFFFF80 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000100 ), LONG2CHARS( 0x0000000000000300 ), LONG2CHARS( 0x0000000000000700 ), LONG2CHARS( 0x0000000000000F00 ), LONG2CHARS( 0x0000000000001F00 ), LONG2CHARS( 0x0000000000003F00 ), LONG2CHARS( 0x0000000000007F00 ), LONG2CHARS( 0x000000000000FF00 ), LONG2CHARS( 0x000000000001FF00 ), LONG2CHARS( 0x000000000003FF00 ), LONG2CHARS( 0x000000000007FF00 ), LONG2CHARS( 0x00000000000FFF00 ), LONG2CHARS( 0x00000000001FFF00 ), LONG2CHARS( 0x00000000003FFF00 ), LONG2CHARS( 0x00000000007FFF00 ), LONG2CHARS( 0x0000000000FFFF00 ), LONG2CHARS( 0x0000000001FFFF00 ), LONG2CHARS( 0x0000000003FFFF00 ), LONG2CHARS( 0x0000000007FFFF00 ), LONG2CHARS( 0x000000000FFFFF00 ), LONG2CHARS( 0x000000001FFFFF00 ), LONG2CHARS( 0x000000003FFFFF00 ), LONG2CHARS( 0x000000007FFFFF00 ), LONG2CHARS( 0x00000000FFFFFF00 ), LONG2CHARS( 0x00000001FFFFFF00 ), LONG2CHARS( 0x00000003FFFFFF00 ), LONG2CHARS( 0x00000007FFFFFF00 ), LONG2CHARS( 0x0000000FFFFFFF00 ), LONG2CHARS( 0x0000001FFFFFFF00 ), LONG2CHARS( 0x0000003FFFFFFF00 ), LONG2CHARS( 0x0000007FFFFFFF00 ), LONG2CHARS( 0x000000FFFFFFFF00 ), LONG2CHARS( 0x000001FFFFFFFF00 ), LONG2CHARS( 0x000003FFFFFFFF00 ), LONG2CHARS( 0x000007FFFFFFFF00 ), LONG2CHARS( 0x00000FFFFFFFFF00 ), LONG2CHARS( 0x00001FFFFFFFFF00 ), LONG2CHARS( 0x00003FFFFFFFFF00 ), LONG2CHARS( 0x00007FFFFFFFFF00 ), LONG2CHARS( 0x0000FFFFFFFFFF00 ), LONG2CHARS( 0x0001FFFFFFFFFF00 ), LONG2CHARS( 0x0003FFFFFFFFFF00 ), LONG2CHARS( 0x0007FFFFFFFFFF00 ), LONG2CHARS( 0x000FFFFFFFFFFF00 ), LONG2CHARS( 0x001FFFFFFFFFFF00 ), LONG2CHARS( 0x003FFFFFFFFFFF00 ), LONG2CHARS( 0x007FFFFFFFFFFF00 ), LONG2CHARS( 0x00FFFFFFFFFFFF00 ), LONG2CHARS( 0x01FFFFFFFFFFFF00 ), LONG2CHARS( 0x03FFFFFFFFFFFF00 ), LONG2CHARS( 0x07FFFFFFFFFFFF00 ), LONG2CHARS( 0x0FFFFFFFFFFFFF00 ), LONG2CHARS( 0x1FFFFFFFFFFFFF00 ), LONG2CHARS( 0x3FFFFFFFFFFFFF00 ), LONG2CHARS( 0x7FFFFFFFFFFFFF00 ), LONG2CHARS( 0xFFFFFFFFFFFFFF00 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000200 ), LONG2CHARS( 0x0000000000000600 ), LONG2CHARS( 0x0000000000000E00 ), LONG2CHARS( 0x0000000000001E00 ), LONG2CHARS( 0x0000000000003E00 ), LONG2CHARS( 0x0000000000007E00 ), LONG2CHARS( 0x000000000000FE00 ), LONG2CHARS( 0x000000000001FE00 ), LONG2CHARS( 0x000000000003FE00 ), LONG2CHARS( 0x000000000007FE00 ), LONG2CHARS( 0x00000000000FFE00 ), LONG2CHARS( 0x00000000001FFE00 ), LONG2CHARS( 0x00000000003FFE00 ), LONG2CHARS( 0x00000000007FFE00 ), LONG2CHARS( 0x0000000000FFFE00 ), LONG2CHARS( 0x0000000001FFFE00 ), LONG2CHARS( 0x0000000003FFFE00 ), LONG2CHARS( 0x0000000007FFFE00 ), LONG2CHARS( 0x000000000FFFFE00 ), LONG2CHARS( 0x000000001FFFFE00 ), LONG2CHARS( 0x000000003FFFFE00 ), LONG2CHARS( 0x000000007FFFFE00 ), LONG2CHARS( 0x00000000FFFFFE00 ), LONG2CHARS( 0x00000001FFFFFE00 ), LONG2CHARS( 0x00000003FFFFFE00 ), LONG2CHARS( 0x00000007FFFFFE00 ), LONG2CHARS( 0x0000000FFFFFFE00 ), LONG2CHARS( 0x0000001FFFFFFE00 ), LONG2CHARS( 0x0000003FFFFFFE00 ), LONG2CHARS( 0x0000007FFFFFFE00 ), LONG2CHARS( 0x000000FFFFFFFE00 ), LONG2CHARS( 0x000001FFFFFFFE00 ), LONG2CHARS( 0x000003FFFFFFFE00 ), LONG2CHARS( 0x000007FFFFFFFE00 ), LONG2CHARS( 0x00000FFFFFFFFE00 ), LONG2CHARS( 0x00001FFFFFFFFE00 ), LONG2CHARS( 0x00003FFFFFFFFE00 ), LONG2CHARS( 0x00007FFFFFFFFE00 ), LONG2CHARS( 0x0000FFFFFFFFFE00 ), LONG2CHARS( 0x0001FFFFFFFFFE00 ), LONG2CHARS( 0x0003FFFFFFFFFE00 ), LONG2CHARS( 0x0007FFFFFFFFFE00 ), LONG2CHARS( 0x000FFFFFFFFFFE00 ), LONG2CHARS( 0x001FFFFFFFFFFE00 ), LONG2CHARS( 0x003FFFFFFFFFFE00 ), LONG2CHARS( 0x007FFFFFFFFFFE00 ), LONG2CHARS( 0x00FFFFFFFFFFFE00 ), LONG2CHARS( 0x01FFFFFFFFFFFE00 ), LONG2CHARS( 0x03FFFFFFFFFFFE00 ), LONG2CHARS( 0x07FFFFFFFFFFFE00 ), LONG2CHARS( 0x0FFFFFFFFFFFFE00 ), LONG2CHARS( 0x1FFFFFFFFFFFFE00 ), LONG2CHARS( 0x3FFFFFFFFFFFFE00 ), LONG2CHARS( 0x7FFFFFFFFFFFFE00 ), LONG2CHARS( 0xFFFFFFFFFFFFFE00 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000400 ), LONG2CHARS( 0x0000000000000C00 ), LONG2CHARS( 0x0000000000001C00 ), LONG2CHARS( 0x0000000000003C00 ), LONG2CHARS( 0x0000000000007C00 ), LONG2CHARS( 0x000000000000FC00 ), LONG2CHARS( 0x000000000001FC00 ), LONG2CHARS( 0x000000000003FC00 ), LONG2CHARS( 0x000000000007FC00 ), LONG2CHARS( 0x00000000000FFC00 ), LONG2CHARS( 0x00000000001FFC00 ), LONG2CHARS( 0x00000000003FFC00 ), LONG2CHARS( 0x00000000007FFC00 ), LONG2CHARS( 0x0000000000FFFC00 ), LONG2CHARS( 0x0000000001FFFC00 ), LONG2CHARS( 0x0000000003FFFC00 ), LONG2CHARS( 0x0000000007FFFC00 ), LONG2CHARS( 0x000000000FFFFC00 ), LONG2CHARS( 0x000000001FFFFC00 ), LONG2CHARS( 0x000000003FFFFC00 ), LONG2CHARS( 0x000000007FFFFC00 ), LONG2CHARS( 0x00000000FFFFFC00 ), LONG2CHARS( 0x00000001FFFFFC00 ), LONG2CHARS( 0x00000003FFFFFC00 ), LONG2CHARS( 0x00000007FFFFFC00 ), LONG2CHARS( 0x0000000FFFFFFC00 ), LONG2CHARS( 0x0000001FFFFFFC00 ), LONG2CHARS( 0x0000003FFFFFFC00 ), LONG2CHARS( 0x0000007FFFFFFC00 ), LONG2CHARS( 0x000000FFFFFFFC00 ), LONG2CHARS( 0x000001FFFFFFFC00 ), LONG2CHARS( 0x000003FFFFFFFC00 ), LONG2CHARS( 0x000007FFFFFFFC00 ), LONG2CHARS( 0x00000FFFFFFFFC00 ), LONG2CHARS( 0x00001FFFFFFFFC00 ), LONG2CHARS( 0x00003FFFFFFFFC00 ), LONG2CHARS( 0x00007FFFFFFFFC00 ), LONG2CHARS( 0x0000FFFFFFFFFC00 ), LONG2CHARS( 0x0001FFFFFFFFFC00 ), LONG2CHARS( 0x0003FFFFFFFFFC00 ), LONG2CHARS( 0x0007FFFFFFFFFC00 ), LONG2CHARS( 0x000FFFFFFFFFFC00 ), LONG2CHARS( 0x001FFFFFFFFFFC00 ), LONG2CHARS( 0x003FFFFFFFFFFC00 ), LONG2CHARS( 0x007FFFFFFFFFFC00 ), LONG2CHARS( 0x00FFFFFFFFFFFC00 ), LONG2CHARS( 0x01FFFFFFFFFFFC00 ), LONG2CHARS( 0x03FFFFFFFFFFFC00 ), LONG2CHARS( 0x07FFFFFFFFFFFC00 ), LONG2CHARS( 0x0FFFFFFFFFFFFC00 ), LONG2CHARS( 0x1FFFFFFFFFFFFC00 ), LONG2CHARS( 0x3FFFFFFFFFFFFC00 ), LONG2CHARS( 0x7FFFFFFFFFFFFC00 ), LONG2CHARS( 0xFFFFFFFFFFFFFC00 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000800 ), LONG2CHARS( 0x0000000000001800 ), LONG2CHARS( 0x0000000000003800 ), LONG2CHARS( 0x0000000000007800 ), LONG2CHARS( 0x000000000000F800 ), LONG2CHARS( 0x000000000001F800 ), LONG2CHARS( 0x000000000003F800 ), LONG2CHARS( 0x000000000007F800 ), LONG2CHARS( 0x00000000000FF800 ), LONG2CHARS( 0x00000000001FF800 ), LONG2CHARS( 0x00000000003FF800 ), LONG2CHARS( 0x00000000007FF800 ), LONG2CHARS( 0x0000000000FFF800 ), LONG2CHARS( 0x0000000001FFF800 ), LONG2CHARS( 0x0000000003FFF800 ), LONG2CHARS( 0x0000000007FFF800 ), LONG2CHARS( 0x000000000FFFF800 ), LONG2CHARS( 0x000000001FFFF800 ), LONG2CHARS( 0x000000003FFFF800 ), LONG2CHARS( 0x000000007FFFF800 ), LONG2CHARS( 0x00000000FFFFF800 ), LONG2CHARS( 0x00000001FFFFF800 ), LONG2CHARS( 0x00000003FFFFF800 ), LONG2CHARS( 0x00000007FFFFF800 ), LONG2CHARS( 0x0000000FFFFFF800 ), LONG2CHARS( 0x0000001FFFFFF800 ), LONG2CHARS( 0x0000003FFFFFF800 ), LONG2CHARS( 0x0000007FFFFFF800 ), LONG2CHARS( 0x000000FFFFFFF800 ), LONG2CHARS( 0x000001FFFFFFF800 ), LONG2CHARS( 0x000003FFFFFFF800 ), LONG2CHARS( 0x000007FFFFFFF800 ), LONG2CHARS( 0x00000FFFFFFFF800 ), LONG2CHARS( 0x00001FFFFFFFF800 ), LONG2CHARS( 0x00003FFFFFFFF800 ), LONG2CHARS( 0x00007FFFFFFFF800 ), LONG2CHARS( 0x0000FFFFFFFFF800 ), LONG2CHARS( 0x0001FFFFFFFFF800 ), LONG2CHARS( 0x0003FFFFFFFFF800 ), LONG2CHARS( 0x0007FFFFFFFFF800 ), LONG2CHARS( 0x000FFFFFFFFFF800 ), LONG2CHARS( 0x001FFFFFFFFFF800 ), LONG2CHARS( 0x003FFFFFFFFFF800 ), LONG2CHARS( 0x007FFFFFFFFFF800 ), LONG2CHARS( 0x00FFFFFFFFFFF800 ), LONG2CHARS( 0x01FFFFFFFFFFF800 ), LONG2CHARS( 0x03FFFFFFFFFFF800 ), LONG2CHARS( 0x07FFFFFFFFFFF800 ), LONG2CHARS( 0x0FFFFFFFFFFFF800 ), LONG2CHARS( 0x1FFFFFFFFFFFF800 ), LONG2CHARS( 0x3FFFFFFFFFFFF800 ), LONG2CHARS( 0x7FFFFFFFFFFFF800 ), LONG2CHARS( 0xFFFFFFFFFFFFF800 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000001000 ), LONG2CHARS( 0x0000000000003000 ), LONG2CHARS( 0x0000000000007000 ), LONG2CHARS( 0x000000000000F000 ), LONG2CHARS( 0x000000000001F000 ), LONG2CHARS( 0x000000000003F000 ), LONG2CHARS( 0x000000000007F000 ), LONG2CHARS( 0x00000000000FF000 ), LONG2CHARS( 0x00000000001FF000 ), LONG2CHARS( 0x00000000003FF000 ), LONG2CHARS( 0x00000000007FF000 ), LONG2CHARS( 0x0000000000FFF000 ), LONG2CHARS( 0x0000000001FFF000 ), LONG2CHARS( 0x0000000003FFF000 ), LONG2CHARS( 0x0000000007FFF000 ), LONG2CHARS( 0x000000000FFFF000 ), LONG2CHARS( 0x000000001FFFF000 ), LONG2CHARS( 0x000000003FFFF000 ), LONG2CHARS( 0x000000007FFFF000 ), LONG2CHARS( 0x00000000FFFFF000 ), LONG2CHARS( 0x00000001FFFFF000 ), LONG2CHARS( 0x00000003FFFFF000 ), LONG2CHARS( 0x00000007FFFFF000 ), LONG2CHARS( 0x0000000FFFFFF000 ), LONG2CHARS( 0x0000001FFFFFF000 ), LONG2CHARS( 0x0000003FFFFFF000 ), LONG2CHARS( 0x0000007FFFFFF000 ), LONG2CHARS( 0x000000FFFFFFF000 ), LONG2CHARS( 0x000001FFFFFFF000 ), LONG2CHARS( 0x000003FFFFFFF000 ), LONG2CHARS( 0x000007FFFFFFF000 ), LONG2CHARS( 0x00000FFFFFFFF000 ), LONG2CHARS( 0x00001FFFFFFFF000 ), LONG2CHARS( 0x00003FFFFFFFF000 ), LONG2CHARS( 0x00007FFFFFFFF000 ), LONG2CHARS( 0x0000FFFFFFFFF000 ), LONG2CHARS( 0x0001FFFFFFFFF000 ), LONG2CHARS( 0x0003FFFFFFFFF000 ), LONG2CHARS( 0x0007FFFFFFFFF000 ), LONG2CHARS( 0x000FFFFFFFFFF000 ), LONG2CHARS( 0x001FFFFFFFFFF000 ), LONG2CHARS( 0x003FFFFFFFFFF000 ), LONG2CHARS( 0x007FFFFFFFFFF000 ), LONG2CHARS( 0x00FFFFFFFFFFF000 ), LONG2CHARS( 0x01FFFFFFFFFFF000 ), LONG2CHARS( 0x03FFFFFFFFFFF000 ), LONG2CHARS( 0x07FFFFFFFFFFF000 ), LONG2CHARS( 0x0FFFFFFFFFFFF000 ), LONG2CHARS( 0x1FFFFFFFFFFFF000 ), LONG2CHARS( 0x3FFFFFFFFFFFF000 ), LONG2CHARS( 0x7FFFFFFFFFFFF000 ), LONG2CHARS( 0xFFFFFFFFFFFFF000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000002000 ), LONG2CHARS( 0x0000000000006000 ), LONG2CHARS( 0x000000000000E000 ), LONG2CHARS( 0x000000000001E000 ), LONG2CHARS( 0x000000000003E000 ), LONG2CHARS( 0x000000000007E000 ), LONG2CHARS( 0x00000000000FE000 ), LONG2CHARS( 0x00000000001FE000 ), LONG2CHARS( 0x00000000003FE000 ), LONG2CHARS( 0x00000000007FE000 ), LONG2CHARS( 0x0000000000FFE000 ), LONG2CHARS( 0x0000000001FFE000 ), LONG2CHARS( 0x0000000003FFE000 ), LONG2CHARS( 0x0000000007FFE000 ), LONG2CHARS( 0x000000000FFFE000 ), LONG2CHARS( 0x000000001FFFE000 ), LONG2CHARS( 0x000000003FFFE000 ), LONG2CHARS( 0x000000007FFFE000 ), LONG2CHARS( 0x00000000FFFFE000 ), LONG2CHARS( 0x00000001FFFFE000 ), LONG2CHARS( 0x00000003FFFFE000 ), LONG2CHARS( 0x00000007FFFFE000 ), LONG2CHARS( 0x0000000FFFFFE000 ), LONG2CHARS( 0x0000001FFFFFE000 ), LONG2CHARS( 0x0000003FFFFFE000 ), LONG2CHARS( 0x0000007FFFFFE000 ), LONG2CHARS( 0x000000FFFFFFE000 ), LONG2CHARS( 0x000001FFFFFFE000 ), LONG2CHARS( 0x000003FFFFFFE000 ), LONG2CHARS( 0x000007FFFFFFE000 ), LONG2CHARS( 0x00000FFFFFFFE000 ), LONG2CHARS( 0x00001FFFFFFFE000 ), LONG2CHARS( 0x00003FFFFFFFE000 ), LONG2CHARS( 0x00007FFFFFFFE000 ), LONG2CHARS( 0x0000FFFFFFFFE000 ), LONG2CHARS( 0x0001FFFFFFFFE000 ), LONG2CHARS( 0x0003FFFFFFFFE000 ), LONG2CHARS( 0x0007FFFFFFFFE000 ), LONG2CHARS( 0x000FFFFFFFFFE000 ), LONG2CHARS( 0x001FFFFFFFFFE000 ), LONG2CHARS( 0x003FFFFFFFFFE000 ), LONG2CHARS( 0x007FFFFFFFFFE000 ), LONG2CHARS( 0x00FFFFFFFFFFE000 ), LONG2CHARS( 0x01FFFFFFFFFFE000 ), LONG2CHARS( 0x03FFFFFFFFFFE000 ), LONG2CHARS( 0x07FFFFFFFFFFE000 ), LONG2CHARS( 0x0FFFFFFFFFFFE000 ), LONG2CHARS( 0x1FFFFFFFFFFFE000 ), LONG2CHARS( 0x3FFFFFFFFFFFE000 ), LONG2CHARS( 0x7FFFFFFFFFFFE000 ), LONG2CHARS( 0xFFFFFFFFFFFFE000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000004000 ), LONG2CHARS( 0x000000000000C000 ), LONG2CHARS( 0x000000000001C000 ), LONG2CHARS( 0x000000000003C000 ), LONG2CHARS( 0x000000000007C000 ), LONG2CHARS( 0x00000000000FC000 ), LONG2CHARS( 0x00000000001FC000 ), LONG2CHARS( 0x00000000003FC000 ), LONG2CHARS( 0x00000000007FC000 ), LONG2CHARS( 0x0000000000FFC000 ), LONG2CHARS( 0x0000000001FFC000 ), LONG2CHARS( 0x0000000003FFC000 ), LONG2CHARS( 0x0000000007FFC000 ), LONG2CHARS( 0x000000000FFFC000 ), LONG2CHARS( 0x000000001FFFC000 ), LONG2CHARS( 0x000000003FFFC000 ), LONG2CHARS( 0x000000007FFFC000 ), LONG2CHARS( 0x00000000FFFFC000 ), LONG2CHARS( 0x00000001FFFFC000 ), LONG2CHARS( 0x00000003FFFFC000 ), LONG2CHARS( 0x00000007FFFFC000 ), LONG2CHARS( 0x0000000FFFFFC000 ), LONG2CHARS( 0x0000001FFFFFC000 ), LONG2CHARS( 0x0000003FFFFFC000 ), LONG2CHARS( 0x0000007FFFFFC000 ), LONG2CHARS( 0x000000FFFFFFC000 ), LONG2CHARS( 0x000001FFFFFFC000 ), LONG2CHARS( 0x000003FFFFFFC000 ), LONG2CHARS( 0x000007FFFFFFC000 ), LONG2CHARS( 0x00000FFFFFFFC000 ), LONG2CHARS( 0x00001FFFFFFFC000 ), LONG2CHARS( 0x00003FFFFFFFC000 ), LONG2CHARS( 0x00007FFFFFFFC000 ), LONG2CHARS( 0x0000FFFFFFFFC000 ), LONG2CHARS( 0x0001FFFFFFFFC000 ), LONG2CHARS( 0x0003FFFFFFFFC000 ), LONG2CHARS( 0x0007FFFFFFFFC000 ), LONG2CHARS( 0x000FFFFFFFFFC000 ), LONG2CHARS( 0x001FFFFFFFFFC000 ), LONG2CHARS( 0x003FFFFFFFFFC000 ), LONG2CHARS( 0x007FFFFFFFFFC000 ), LONG2CHARS( 0x00FFFFFFFFFFC000 ), LONG2CHARS( 0x01FFFFFFFFFFC000 ), LONG2CHARS( 0x03FFFFFFFFFFC000 ), LONG2CHARS( 0x07FFFFFFFFFFC000 ), LONG2CHARS( 0x0FFFFFFFFFFFC000 ), LONG2CHARS( 0x1FFFFFFFFFFFC000 ), LONG2CHARS( 0x3FFFFFFFFFFFC000 ), LONG2CHARS( 0x7FFFFFFFFFFFC000 ), LONG2CHARS( 0xFFFFFFFFFFFFC000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000008000 ), LONG2CHARS( 0x0000000000018000 ), LONG2CHARS( 0x0000000000038000 ), LONG2CHARS( 0x0000000000078000 ), LONG2CHARS( 0x00000000000F8000 ), LONG2CHARS( 0x00000000001F8000 ), LONG2CHARS( 0x00000000003F8000 ), LONG2CHARS( 0x00000000007F8000 ), LONG2CHARS( 0x0000000000FF8000 ), LONG2CHARS( 0x0000000001FF8000 ), LONG2CHARS( 0x0000000003FF8000 ), LONG2CHARS( 0x0000000007FF8000 ), LONG2CHARS( 0x000000000FFF8000 ), LONG2CHARS( 0x000000001FFF8000 ), LONG2CHARS( 0x000000003FFF8000 ), LONG2CHARS( 0x000000007FFF8000 ), LONG2CHARS( 0x00000000FFFF8000 ), LONG2CHARS( 0x00000001FFFF8000 ), LONG2CHARS( 0x00000003FFFF8000 ), LONG2CHARS( 0x00000007FFFF8000 ), LONG2CHARS( 0x0000000FFFFF8000 ), LONG2CHARS( 0x0000001FFFFF8000 ), LONG2CHARS( 0x0000003FFFFF8000 ), LONG2CHARS( 0x0000007FFFFF8000 ), LONG2CHARS( 0x000000FFFFFF8000 ), LONG2CHARS( 0x000001FFFFFF8000 ), LONG2CHARS( 0x000003FFFFFF8000 ), LONG2CHARS( 0x000007FFFFFF8000 ), LONG2CHARS( 0x00000FFFFFFF8000 ), LONG2CHARS( 0x00001FFFFFFF8000 ), LONG2CHARS( 0x00003FFFFFFF8000 ), LONG2CHARS( 0x00007FFFFFFF8000 ), LONG2CHARS( 0x0000FFFFFFFF8000 ), LONG2CHARS( 0x0001FFFFFFFF8000 ), LONG2CHARS( 0x0003FFFFFFFF8000 ), LONG2CHARS( 0x0007FFFFFFFF8000 ), LONG2CHARS( 0x000FFFFFFFFF8000 ), LONG2CHARS( 0x001FFFFFFFFF8000 ), LONG2CHARS( 0x003FFFFFFFFF8000 ), LONG2CHARS( 0x007FFFFFFFFF8000 ), LONG2CHARS( 0x00FFFFFFFFFF8000 ), LONG2CHARS( 0x01FFFFFFFFFF8000 ), LONG2CHARS( 0x03FFFFFFFFFF8000 ), LONG2CHARS( 0x07FFFFFFFFFF8000 ), LONG2CHARS( 0x0FFFFFFFFFFF8000 ), LONG2CHARS( 0x1FFFFFFFFFFF8000 ), LONG2CHARS( 0x3FFFFFFFFFFF8000 ), LONG2CHARS( 0x7FFFFFFFFFFF8000 ), LONG2CHARS( 0xFFFFFFFFFFFF8000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000010000 ), LONG2CHARS( 0x0000000000030000 ), LONG2CHARS( 0x0000000000070000 ), LONG2CHARS( 0x00000000000F0000 ), LONG2CHARS( 0x00000000001F0000 ), LONG2CHARS( 0x00000000003F0000 ), LONG2CHARS( 0x00000000007F0000 ), LONG2CHARS( 0x0000000000FF0000 ), LONG2CHARS( 0x0000000001FF0000 ), LONG2CHARS( 0x0000000003FF0000 ), LONG2CHARS( 0x0000000007FF0000 ), LONG2CHARS( 0x000000000FFF0000 ), LONG2CHARS( 0x000000001FFF0000 ), LONG2CHARS( 0x000000003FFF0000 ), LONG2CHARS( 0x000000007FFF0000 ), LONG2CHARS( 0x00000000FFFF0000 ), LONG2CHARS( 0x00000001FFFF0000 ), LONG2CHARS( 0x00000003FFFF0000 ), LONG2CHARS( 0x00000007FFFF0000 ), LONG2CHARS( 0x0000000FFFFF0000 ), LONG2CHARS( 0x0000001FFFFF0000 ), LONG2CHARS( 0x0000003FFFFF0000 ), LONG2CHARS( 0x0000007FFFFF0000 ), LONG2CHARS( 0x000000FFFFFF0000 ), LONG2CHARS( 0x000001FFFFFF0000 ), LONG2CHARS( 0x000003FFFFFF0000 ), LONG2CHARS( 0x000007FFFFFF0000 ), LONG2CHARS( 0x00000FFFFFFF0000 ), LONG2CHARS( 0x00001FFFFFFF0000 ), LONG2CHARS( 0x00003FFFFFFF0000 ), LONG2CHARS( 0x00007FFFFFFF0000 ), LONG2CHARS( 0x0000FFFFFFFF0000 ), LONG2CHARS( 0x0001FFFFFFFF0000 ), LONG2CHARS( 0x0003FFFFFFFF0000 ), LONG2CHARS( 0x0007FFFFFFFF0000 ), LONG2CHARS( 0x000FFFFFFFFF0000 ), LONG2CHARS( 0x001FFFFFFFFF0000 ), LONG2CHARS( 0x003FFFFFFFFF0000 ), LONG2CHARS( 0x007FFFFFFFFF0000 ), LONG2CHARS( 0x00FFFFFFFFFF0000 ), LONG2CHARS( 0x01FFFFFFFFFF0000 ), LONG2CHARS( 0x03FFFFFFFFFF0000 ), LONG2CHARS( 0x07FFFFFFFFFF0000 ), LONG2CHARS( 0x0FFFFFFFFFFF0000 ), LONG2CHARS( 0x1FFFFFFFFFFF0000 ), LONG2CHARS( 0x3FFFFFFFFFFF0000 ), LONG2CHARS( 0x7FFFFFFFFFFF0000 ), LONG2CHARS( 0xFFFFFFFFFFFF0000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000020000 ), LONG2CHARS( 0x0000000000060000 ), LONG2CHARS( 0x00000000000E0000 ), LONG2CHARS( 0x00000000001E0000 ), LONG2CHARS( 0x00000000003E0000 ), LONG2CHARS( 0x00000000007E0000 ), LONG2CHARS( 0x0000000000FE0000 ), LONG2CHARS( 0x0000000001FE0000 ), LONG2CHARS( 0x0000000003FE0000 ), LONG2CHARS( 0x0000000007FE0000 ), LONG2CHARS( 0x000000000FFE0000 ), LONG2CHARS( 0x000000001FFE0000 ), LONG2CHARS( 0x000000003FFE0000 ), LONG2CHARS( 0x000000007FFE0000 ), LONG2CHARS( 0x00000000FFFE0000 ), LONG2CHARS( 0x00000001FFFE0000 ), LONG2CHARS( 0x00000003FFFE0000 ), LONG2CHARS( 0x00000007FFFE0000 ), LONG2CHARS( 0x0000000FFFFE0000 ), LONG2CHARS( 0x0000001FFFFE0000 ), LONG2CHARS( 0x0000003FFFFE0000 ), LONG2CHARS( 0x0000007FFFFE0000 ), LONG2CHARS( 0x000000FFFFFE0000 ), LONG2CHARS( 0x000001FFFFFE0000 ), LONG2CHARS( 0x000003FFFFFE0000 ), LONG2CHARS( 0x000007FFFFFE0000 ), LONG2CHARS( 0x00000FFFFFFE0000 ), LONG2CHARS( 0x00001FFFFFFE0000 ), LONG2CHARS( 0x00003FFFFFFE0000 ), LONG2CHARS( 0x00007FFFFFFE0000 ), LONG2CHARS( 0x0000FFFFFFFE0000 ), LONG2CHARS( 0x0001FFFFFFFE0000 ), LONG2CHARS( 0x0003FFFFFFFE0000 ), LONG2CHARS( 0x0007FFFFFFFE0000 ), LONG2CHARS( 0x000FFFFFFFFE0000 ), LONG2CHARS( 0x001FFFFFFFFE0000 ), LONG2CHARS( 0x003FFFFFFFFE0000 ), LONG2CHARS( 0x007FFFFFFFFE0000 ), LONG2CHARS( 0x00FFFFFFFFFE0000 ), LONG2CHARS( 0x01FFFFFFFFFE0000 ), LONG2CHARS( 0x03FFFFFFFFFE0000 ), LONG2CHARS( 0x07FFFFFFFFFE0000 ), LONG2CHARS( 0x0FFFFFFFFFFE0000 ), LONG2CHARS( 0x1FFFFFFFFFFE0000 ), LONG2CHARS( 0x3FFFFFFFFFFE0000 ), LONG2CHARS( 0x7FFFFFFFFFFE0000 ), LONG2CHARS( 0xFFFFFFFFFFFE0000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000040000 ), LONG2CHARS( 0x00000000000C0000 ), LONG2CHARS( 0x00000000001C0000 ), LONG2CHARS( 0x00000000003C0000 ), LONG2CHARS( 0x00000000007C0000 ), LONG2CHARS( 0x0000000000FC0000 ), LONG2CHARS( 0x0000000001FC0000 ), LONG2CHARS( 0x0000000003FC0000 ), LONG2CHARS( 0x0000000007FC0000 ), LONG2CHARS( 0x000000000FFC0000 ), LONG2CHARS( 0x000000001FFC0000 ), LONG2CHARS( 0x000000003FFC0000 ), LONG2CHARS( 0x000000007FFC0000 ), LONG2CHARS( 0x00000000FFFC0000 ), LONG2CHARS( 0x00000001FFFC0000 ), LONG2CHARS( 0x00000003FFFC0000 ), LONG2CHARS( 0x00000007FFFC0000 ), LONG2CHARS( 0x0000000FFFFC0000 ), LONG2CHARS( 0x0000001FFFFC0000 ), LONG2CHARS( 0x0000003FFFFC0000 ), LONG2CHARS( 0x0000007FFFFC0000 ), LONG2CHARS( 0x000000FFFFFC0000 ), LONG2CHARS( 0x000001FFFFFC0000 ), LONG2CHARS( 0x000003FFFFFC0000 ), LONG2CHARS( 0x000007FFFFFC0000 ), LONG2CHARS( 0x00000FFFFFFC0000 ), LONG2CHARS( 0x00001FFFFFFC0000 ), LONG2CHARS( 0x00003FFFFFFC0000 ), LONG2CHARS( 0x00007FFFFFFC0000 ), LONG2CHARS( 0x0000FFFFFFFC0000 ), LONG2CHARS( 0x0001FFFFFFFC0000 ), LONG2CHARS( 0x0003FFFFFFFC0000 ), LONG2CHARS( 0x0007FFFFFFFC0000 ), LONG2CHARS( 0x000FFFFFFFFC0000 ), LONG2CHARS( 0x001FFFFFFFFC0000 ), LONG2CHARS( 0x003FFFFFFFFC0000 ), LONG2CHARS( 0x007FFFFFFFFC0000 ), LONG2CHARS( 0x00FFFFFFFFFC0000 ), LONG2CHARS( 0x01FFFFFFFFFC0000 ), LONG2CHARS( 0x03FFFFFFFFFC0000 ), LONG2CHARS( 0x07FFFFFFFFFC0000 ), LONG2CHARS( 0x0FFFFFFFFFFC0000 ), LONG2CHARS( 0x1FFFFFFFFFFC0000 ), LONG2CHARS( 0x3FFFFFFFFFFC0000 ), LONG2CHARS( 0x7FFFFFFFFFFC0000 ), LONG2CHARS( 0xFFFFFFFFFFFC0000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000080000 ), LONG2CHARS( 0x0000000000180000 ), LONG2CHARS( 0x0000000000380000 ), LONG2CHARS( 0x0000000000780000 ), LONG2CHARS( 0x0000000000F80000 ), LONG2CHARS( 0x0000000001F80000 ), LONG2CHARS( 0x0000000003F80000 ), LONG2CHARS( 0x0000000007F80000 ), LONG2CHARS( 0x000000000FF80000 ), LONG2CHARS( 0x000000001FF80000 ), LONG2CHARS( 0x000000003FF80000 ), LONG2CHARS( 0x000000007FF80000 ), LONG2CHARS( 0x00000000FFF80000 ), LONG2CHARS( 0x00000001FFF80000 ), LONG2CHARS( 0x00000003FFF80000 ), LONG2CHARS( 0x00000007FFF80000 ), LONG2CHARS( 0x0000000FFFF80000 ), LONG2CHARS( 0x0000001FFFF80000 ), LONG2CHARS( 0x0000003FFFF80000 ), LONG2CHARS( 0x0000007FFFF80000 ), LONG2CHARS( 0x000000FFFFF80000 ), LONG2CHARS( 0x000001FFFFF80000 ), LONG2CHARS( 0x000003FFFFF80000 ), LONG2CHARS( 0x000007FFFFF80000 ), LONG2CHARS( 0x00000FFFFFF80000 ), LONG2CHARS( 0x00001FFFFFF80000 ), LONG2CHARS( 0x00003FFFFFF80000 ), LONG2CHARS( 0x00007FFFFFF80000 ), LONG2CHARS( 0x0000FFFFFFF80000 ), LONG2CHARS( 0x0001FFFFFFF80000 ), LONG2CHARS( 0x0003FFFFFFF80000 ), LONG2CHARS( 0x0007FFFFFFF80000 ), LONG2CHARS( 0x000FFFFFFFF80000 ), LONG2CHARS( 0x001FFFFFFFF80000 ), LONG2CHARS( 0x003FFFFFFFF80000 ), LONG2CHARS( 0x007FFFFFFFF80000 ), LONG2CHARS( 0x00FFFFFFFFF80000 ), LONG2CHARS( 0x01FFFFFFFFF80000 ), LONG2CHARS( 0x03FFFFFFFFF80000 ), LONG2CHARS( 0x07FFFFFFFFF80000 ), LONG2CHARS( 0x0FFFFFFFFFF80000 ), LONG2CHARS( 0x1FFFFFFFFFF80000 ), LONG2CHARS( 0x3FFFFFFFFFF80000 ), LONG2CHARS( 0x7FFFFFFFFFF80000 ), LONG2CHARS( 0xFFFFFFFFFFF80000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000100000 ), LONG2CHARS( 0x0000000000300000 ), LONG2CHARS( 0x0000000000700000 ), LONG2CHARS( 0x0000000000F00000 ), LONG2CHARS( 0x0000000001F00000 ), LONG2CHARS( 0x0000000003F00000 ), LONG2CHARS( 0x0000000007F00000 ), LONG2CHARS( 0x000000000FF00000 ), LONG2CHARS( 0x000000001FF00000 ), LONG2CHARS( 0x000000003FF00000 ), LONG2CHARS( 0x000000007FF00000 ), LONG2CHARS( 0x00000000FFF00000 ), LONG2CHARS( 0x00000001FFF00000 ), LONG2CHARS( 0x00000003FFF00000 ), LONG2CHARS( 0x00000007FFF00000 ), LONG2CHARS( 0x0000000FFFF00000 ), LONG2CHARS( 0x0000001FFFF00000 ), LONG2CHARS( 0x0000003FFFF00000 ), LONG2CHARS( 0x0000007FFFF00000 ), LONG2CHARS( 0x000000FFFFF00000 ), LONG2CHARS( 0x000001FFFFF00000 ), LONG2CHARS( 0x000003FFFFF00000 ), LONG2CHARS( 0x000007FFFFF00000 ), LONG2CHARS( 0x00000FFFFFF00000 ), LONG2CHARS( 0x00001FFFFFF00000 ), LONG2CHARS( 0x00003FFFFFF00000 ), LONG2CHARS( 0x00007FFFFFF00000 ), LONG2CHARS( 0x0000FFFFFFF00000 ), LONG2CHARS( 0x0001FFFFFFF00000 ), LONG2CHARS( 0x0003FFFFFFF00000 ), LONG2CHARS( 0x0007FFFFFFF00000 ), LONG2CHARS( 0x000FFFFFFFF00000 ), LONG2CHARS( 0x001FFFFFFFF00000 ), LONG2CHARS( 0x003FFFFFFFF00000 ), LONG2CHARS( 0x007FFFFFFFF00000 ), LONG2CHARS( 0x00FFFFFFFFF00000 ), LONG2CHARS( 0x01FFFFFFFFF00000 ), LONG2CHARS( 0x03FFFFFFFFF00000 ), LONG2CHARS( 0x07FFFFFFFFF00000 ), LONG2CHARS( 0x0FFFFFFFFFF00000 ), LONG2CHARS( 0x1FFFFFFFFFF00000 ), LONG2CHARS( 0x3FFFFFFFFFF00000 ), LONG2CHARS( 0x7FFFFFFFFFF00000 ), LONG2CHARS( 0xFFFFFFFFFFF00000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000200000 ), LONG2CHARS( 0x0000000000600000 ), LONG2CHARS( 0x0000000000E00000 ), LONG2CHARS( 0x0000000001E00000 ), LONG2CHARS( 0x0000000003E00000 ), LONG2CHARS( 0x0000000007E00000 ), LONG2CHARS( 0x000000000FE00000 ), LONG2CHARS( 0x000000001FE00000 ), LONG2CHARS( 0x000000003FE00000 ), LONG2CHARS( 0x000000007FE00000 ), LONG2CHARS( 0x00000000FFE00000 ), LONG2CHARS( 0x00000001FFE00000 ), LONG2CHARS( 0x00000003FFE00000 ), LONG2CHARS( 0x00000007FFE00000 ), LONG2CHARS( 0x0000000FFFE00000 ), LONG2CHARS( 0x0000001FFFE00000 ), LONG2CHARS( 0x0000003FFFE00000 ), LONG2CHARS( 0x0000007FFFE00000 ), LONG2CHARS( 0x000000FFFFE00000 ), LONG2CHARS( 0x000001FFFFE00000 ), LONG2CHARS( 0x000003FFFFE00000 ), LONG2CHARS( 0x000007FFFFE00000 ), LONG2CHARS( 0x00000FFFFFE00000 ), LONG2CHARS( 0x00001FFFFFE00000 ), LONG2CHARS( 0x00003FFFFFE00000 ), LONG2CHARS( 0x00007FFFFFE00000 ), LONG2CHARS( 0x0000FFFFFFE00000 ), LONG2CHARS( 0x0001FFFFFFE00000 ), LONG2CHARS( 0x0003FFFFFFE00000 ), LONG2CHARS( 0x0007FFFFFFE00000 ), LONG2CHARS( 0x000FFFFFFFE00000 ), LONG2CHARS( 0x001FFFFFFFE00000 ), LONG2CHARS( 0x003FFFFFFFE00000 ), LONG2CHARS( 0x007FFFFFFFE00000 ), LONG2CHARS( 0x00FFFFFFFFE00000 ), LONG2CHARS( 0x01FFFFFFFFE00000 ), LONG2CHARS( 0x03FFFFFFFFE00000 ), LONG2CHARS( 0x07FFFFFFFFE00000 ), LONG2CHARS( 0x0FFFFFFFFFE00000 ), LONG2CHARS( 0x1FFFFFFFFFE00000 ), LONG2CHARS( 0x3FFFFFFFFFE00000 ), LONG2CHARS( 0x7FFFFFFFFFE00000 ), LONG2CHARS( 0xFFFFFFFFFFE00000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000400000 ), LONG2CHARS( 0x0000000000C00000 ), LONG2CHARS( 0x0000000001C00000 ), LONG2CHARS( 0x0000000003C00000 ), LONG2CHARS( 0x0000000007C00000 ), LONG2CHARS( 0x000000000FC00000 ), LONG2CHARS( 0x000000001FC00000 ), LONG2CHARS( 0x000000003FC00000 ), LONG2CHARS( 0x000000007FC00000 ), LONG2CHARS( 0x00000000FFC00000 ), LONG2CHARS( 0x00000001FFC00000 ), LONG2CHARS( 0x00000003FFC00000 ), LONG2CHARS( 0x00000007FFC00000 ), LONG2CHARS( 0x0000000FFFC00000 ), LONG2CHARS( 0x0000001FFFC00000 ), LONG2CHARS( 0x0000003FFFC00000 ), LONG2CHARS( 0x0000007FFFC00000 ), LONG2CHARS( 0x000000FFFFC00000 ), LONG2CHARS( 0x000001FFFFC00000 ), LONG2CHARS( 0x000003FFFFC00000 ), LONG2CHARS( 0x000007FFFFC00000 ), LONG2CHARS( 0x00000FFFFFC00000 ), LONG2CHARS( 0x00001FFFFFC00000 ), LONG2CHARS( 0x00003FFFFFC00000 ), LONG2CHARS( 0x00007FFFFFC00000 ), LONG2CHARS( 0x0000FFFFFFC00000 ), LONG2CHARS( 0x0001FFFFFFC00000 ), LONG2CHARS( 0x0003FFFFFFC00000 ), LONG2CHARS( 0x0007FFFFFFC00000 ), LONG2CHARS( 0x000FFFFFFFC00000 ), LONG2CHARS( 0x001FFFFFFFC00000 ), LONG2CHARS( 0x003FFFFFFFC00000 ), LONG2CHARS( 0x007FFFFFFFC00000 ), LONG2CHARS( 0x00FFFFFFFFC00000 ), LONG2CHARS( 0x01FFFFFFFFC00000 ), LONG2CHARS( 0x03FFFFFFFFC00000 ), LONG2CHARS( 0x07FFFFFFFFC00000 ), LONG2CHARS( 0x0FFFFFFFFFC00000 ), LONG2CHARS( 0x1FFFFFFFFFC00000 ), LONG2CHARS( 0x3FFFFFFFFFC00000 ), LONG2CHARS( 0x7FFFFFFFFFC00000 ), LONG2CHARS( 0xFFFFFFFFFFC00000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000800000 ), LONG2CHARS( 0x0000000001800000 ), LONG2CHARS( 0x0000000003800000 ), LONG2CHARS( 0x0000000007800000 ), LONG2CHARS( 0x000000000F800000 ), LONG2CHARS( 0x000000001F800000 ), LONG2CHARS( 0x000000003F800000 ), LONG2CHARS( 0x000000007F800000 ), LONG2CHARS( 0x00000000FF800000 ), LONG2CHARS( 0x00000001FF800000 ), LONG2CHARS( 0x00000003FF800000 ), LONG2CHARS( 0x00000007FF800000 ), LONG2CHARS( 0x0000000FFF800000 ), LONG2CHARS( 0x0000001FFF800000 ), LONG2CHARS( 0x0000003FFF800000 ), LONG2CHARS( 0x0000007FFF800000 ), LONG2CHARS( 0x000000FFFF800000 ), LONG2CHARS( 0x000001FFFF800000 ), LONG2CHARS( 0x000003FFFF800000 ), LONG2CHARS( 0x000007FFFF800000 ), LONG2CHARS( 0x00000FFFFF800000 ), LONG2CHARS( 0x00001FFFFF800000 ), LONG2CHARS( 0x00003FFFFF800000 ), LONG2CHARS( 0x00007FFFFF800000 ), LONG2CHARS( 0x0000FFFFFF800000 ), LONG2CHARS( 0x0001FFFFFF800000 ), LONG2CHARS( 0x0003FFFFFF800000 ), LONG2CHARS( 0x0007FFFFFF800000 ), LONG2CHARS( 0x000FFFFFFF800000 ), LONG2CHARS( 0x001FFFFFFF800000 ), LONG2CHARS( 0x003FFFFFFF800000 ), LONG2CHARS( 0x007FFFFFFF800000 ), LONG2CHARS( 0x00FFFFFFFF800000 ), LONG2CHARS( 0x01FFFFFFFF800000 ), LONG2CHARS( 0x03FFFFFFFF800000 ), LONG2CHARS( 0x07FFFFFFFF800000 ), LONG2CHARS( 0x0FFFFFFFFF800000 ), LONG2CHARS( 0x1FFFFFFFFF800000 ), LONG2CHARS( 0x3FFFFFFFFF800000 ), LONG2CHARS( 0x7FFFFFFFFF800000 ), LONG2CHARS( 0xFFFFFFFFFF800000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000001000000 ), LONG2CHARS( 0x0000000003000000 ), LONG2CHARS( 0x0000000007000000 ), LONG2CHARS( 0x000000000F000000 ), LONG2CHARS( 0x000000001F000000 ), LONG2CHARS( 0x000000003F000000 ), LONG2CHARS( 0x000000007F000000 ), LONG2CHARS( 0x00000000FF000000 ), LONG2CHARS( 0x00000001FF000000 ), LONG2CHARS( 0x00000003FF000000 ), LONG2CHARS( 0x00000007FF000000 ), LONG2CHARS( 0x0000000FFF000000 ), LONG2CHARS( 0x0000001FFF000000 ), LONG2CHARS( 0x0000003FFF000000 ), LONG2CHARS( 0x0000007FFF000000 ), LONG2CHARS( 0x000000FFFF000000 ), LONG2CHARS( 0x000001FFFF000000 ), LONG2CHARS( 0x000003FFFF000000 ), LONG2CHARS( 0x000007FFFF000000 ), LONG2CHARS( 0x00000FFFFF000000 ), LONG2CHARS( 0x00001FFFFF000000 ), LONG2CHARS( 0x00003FFFFF000000 ), LONG2CHARS( 0x00007FFFFF000000 ), LONG2CHARS( 0x0000FFFFFF000000 ), LONG2CHARS( 0x0001FFFFFF000000 ), LONG2CHARS( 0x0003FFFFFF000000 ), LONG2CHARS( 0x0007FFFFFF000000 ), LONG2CHARS( 0x000FFFFFFF000000 ), LONG2CHARS( 0x001FFFFFFF000000 ), LONG2CHARS( 0x003FFFFFFF000000 ), LONG2CHARS( 0x007FFFFFFF000000 ), LONG2CHARS( 0x00FFFFFFFF000000 ), LONG2CHARS( 0x01FFFFFFFF000000 ), LONG2CHARS( 0x03FFFFFFFF000000 ), LONG2CHARS( 0x07FFFFFFFF000000 ), LONG2CHARS( 0x0FFFFFFFFF000000 ), LONG2CHARS( 0x1FFFFFFFFF000000 ), LONG2CHARS( 0x3FFFFFFFFF000000 ), LONG2CHARS( 0x7FFFFFFFFF000000 ), LONG2CHARS( 0xFFFFFFFFFF000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000002000000 ), LONG2CHARS( 0x0000000006000000 ), LONG2CHARS( 0x000000000E000000 ), LONG2CHARS( 0x000000001E000000 ), LONG2CHARS( 0x000000003E000000 ), LONG2CHARS( 0x000000007E000000 ), LONG2CHARS( 0x00000000FE000000 ), LONG2CHARS( 0x00000001FE000000 ), LONG2CHARS( 0x00000003FE000000 ), LONG2CHARS( 0x00000007FE000000 ), LONG2CHARS( 0x0000000FFE000000 ), LONG2CHARS( 0x0000001FFE000000 ), LONG2CHARS( 0x0000003FFE000000 ), LONG2CHARS( 0x0000007FFE000000 ), LONG2CHARS( 0x000000FFFE000000 ), LONG2CHARS( 0x000001FFFE000000 ), LONG2CHARS( 0x000003FFFE000000 ), LONG2CHARS( 0x000007FFFE000000 ), LONG2CHARS( 0x00000FFFFE000000 ), LONG2CHARS( 0x00001FFFFE000000 ), LONG2CHARS( 0x00003FFFFE000000 ), LONG2CHARS( 0x00007FFFFE000000 ), LONG2CHARS( 0x0000FFFFFE000000 ), LONG2CHARS( 0x0001FFFFFE000000 ), LONG2CHARS( 0x0003FFFFFE000000 ), LONG2CHARS( 0x0007FFFFFE000000 ), LONG2CHARS( 0x000FFFFFFE000000 ), LONG2CHARS( 0x001FFFFFFE000000 ), LONG2CHARS( 0x003FFFFFFE000000 ), LONG2CHARS( 0x007FFFFFFE000000 ), LONG2CHARS( 0x00FFFFFFFE000000 ), LONG2CHARS( 0x01FFFFFFFE000000 ), LONG2CHARS( 0x03FFFFFFFE000000 ), LONG2CHARS( 0x07FFFFFFFE000000 ), LONG2CHARS( 0x0FFFFFFFFE000000 ), LONG2CHARS( 0x1FFFFFFFFE000000 ), LONG2CHARS( 0x3FFFFFFFFE000000 ), LONG2CHARS( 0x7FFFFFFFFE000000 ), LONG2CHARS( 0xFFFFFFFFFE000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000004000000 ), LONG2CHARS( 0x000000000C000000 ), LONG2CHARS( 0x000000001C000000 ), LONG2CHARS( 0x000000003C000000 ), LONG2CHARS( 0x000000007C000000 ), LONG2CHARS( 0x00000000FC000000 ), LONG2CHARS( 0x00000001FC000000 ), LONG2CHARS( 0x00000003FC000000 ), LONG2CHARS( 0x00000007FC000000 ), LONG2CHARS( 0x0000000FFC000000 ), LONG2CHARS( 0x0000001FFC000000 ), LONG2CHARS( 0x0000003FFC000000 ), LONG2CHARS( 0x0000007FFC000000 ), LONG2CHARS( 0x000000FFFC000000 ), LONG2CHARS( 0x000001FFFC000000 ), LONG2CHARS( 0x000003FFFC000000 ), LONG2CHARS( 0x000007FFFC000000 ), LONG2CHARS( 0x00000FFFFC000000 ), LONG2CHARS( 0x00001FFFFC000000 ), LONG2CHARS( 0x00003FFFFC000000 ), LONG2CHARS( 0x00007FFFFC000000 ), LONG2CHARS( 0x0000FFFFFC000000 ), LONG2CHARS( 0x0001FFFFFC000000 ), LONG2CHARS( 0x0003FFFFFC000000 ), LONG2CHARS( 0x0007FFFFFC000000 ), LONG2CHARS( 0x000FFFFFFC000000 ), LONG2CHARS( 0x001FFFFFFC000000 ), LONG2CHARS( 0x003FFFFFFC000000 ), LONG2CHARS( 0x007FFFFFFC000000 ), LONG2CHARS( 0x00FFFFFFFC000000 ), LONG2CHARS( 0x01FFFFFFFC000000 ), LONG2CHARS( 0x03FFFFFFFC000000 ), LONG2CHARS( 0x07FFFFFFFC000000 ), LONG2CHARS( 0x0FFFFFFFFC000000 ), LONG2CHARS( 0x1FFFFFFFFC000000 ), LONG2CHARS( 0x3FFFFFFFFC000000 ), LONG2CHARS( 0x7FFFFFFFFC000000 ), LONG2CHARS( 0xFFFFFFFFFC000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000008000000 ), LONG2CHARS( 0x0000000018000000 ), LONG2CHARS( 0x0000000038000000 ), LONG2CHARS( 0x0000000078000000 ), LONG2CHARS( 0x00000000F8000000 ), LONG2CHARS( 0x00000001F8000000 ), LONG2CHARS( 0x00000003F8000000 ), LONG2CHARS( 0x00000007F8000000 ), LONG2CHARS( 0x0000000FF8000000 ), LONG2CHARS( 0x0000001FF8000000 ), LONG2CHARS( 0x0000003FF8000000 ), LONG2CHARS( 0x0000007FF8000000 ), LONG2CHARS( 0x000000FFF8000000 ), LONG2CHARS( 0x000001FFF8000000 ), LONG2CHARS( 0x000003FFF8000000 ), LONG2CHARS( 0x000007FFF8000000 ), LONG2CHARS( 0x00000FFFF8000000 ), LONG2CHARS( 0x00001FFFF8000000 ), LONG2CHARS( 0x00003FFFF8000000 ), LONG2CHARS( 0x00007FFFF8000000 ), LONG2CHARS( 0x0000FFFFF8000000 ), LONG2CHARS( 0x0001FFFFF8000000 ), LONG2CHARS( 0x0003FFFFF8000000 ), LONG2CHARS( 0x0007FFFFF8000000 ), LONG2CHARS( 0x000FFFFFF8000000 ), LONG2CHARS( 0x001FFFFFF8000000 ), LONG2CHARS( 0x003FFFFFF8000000 ), LONG2CHARS( 0x007FFFFFF8000000 ), LONG2CHARS( 0x00FFFFFFF8000000 ), LONG2CHARS( 0x01FFFFFFF8000000 ), LONG2CHARS( 0x03FFFFFFF8000000 ), LONG2CHARS( 0x07FFFFFFF8000000 ), LONG2CHARS( 0x0FFFFFFFF8000000 ), LONG2CHARS( 0x1FFFFFFFF8000000 ), LONG2CHARS( 0x3FFFFFFFF8000000 ), LONG2CHARS( 0x7FFFFFFFF8000000 ), LONG2CHARS( 0xFFFFFFFFF8000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000010000000 ), LONG2CHARS( 0x0000000030000000 ), LONG2CHARS( 0x0000000070000000 ), LONG2CHARS( 0x00000000F0000000 ), LONG2CHARS( 0x00000001F0000000 ), LONG2CHARS( 0x00000003F0000000 ), LONG2CHARS( 0x00000007F0000000 ), LONG2CHARS( 0x0000000FF0000000 ), LONG2CHARS( 0x0000001FF0000000 ), LONG2CHARS( 0x0000003FF0000000 ), LONG2CHARS( 0x0000007FF0000000 ), LONG2CHARS( 0x000000FFF0000000 ), LONG2CHARS( 0x000001FFF0000000 ), LONG2CHARS( 0x000003FFF0000000 ), LONG2CHARS( 0x000007FFF0000000 ), LONG2CHARS( 0x00000FFFF0000000 ), LONG2CHARS( 0x00001FFFF0000000 ), LONG2CHARS( 0x00003FFFF0000000 ), LONG2CHARS( 0x00007FFFF0000000 ), LONG2CHARS( 0x0000FFFFF0000000 ), LONG2CHARS( 0x0001FFFFF0000000 ), LONG2CHARS( 0x0003FFFFF0000000 ), LONG2CHARS( 0x0007FFFFF0000000 ), LONG2CHARS( 0x000FFFFFF0000000 ), LONG2CHARS( 0x001FFFFFF0000000 ), LONG2CHARS( 0x003FFFFFF0000000 ), LONG2CHARS( 0x007FFFFFF0000000 ), LONG2CHARS( 0x00FFFFFFF0000000 ), LONG2CHARS( 0x01FFFFFFF0000000 ), LONG2CHARS( 0x03FFFFFFF0000000 ), LONG2CHARS( 0x07FFFFFFF0000000 ), LONG2CHARS( 0x0FFFFFFFF0000000 ), LONG2CHARS( 0x1FFFFFFFF0000000 ), LONG2CHARS( 0x3FFFFFFFF0000000 ), LONG2CHARS( 0x7FFFFFFFF0000000 ), LONG2CHARS( 0xFFFFFFFFF0000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000020000000 ), LONG2CHARS( 0x0000000060000000 ), LONG2CHARS( 0x00000000E0000000 ), LONG2CHARS( 0x00000001E0000000 ), LONG2CHARS( 0x00000003E0000000 ), LONG2CHARS( 0x00000007E0000000 ), LONG2CHARS( 0x0000000FE0000000 ), LONG2CHARS( 0x0000001FE0000000 ), LONG2CHARS( 0x0000003FE0000000 ), LONG2CHARS( 0x0000007FE0000000 ), LONG2CHARS( 0x000000FFE0000000 ), LONG2CHARS( 0x000001FFE0000000 ), LONG2CHARS( 0x000003FFE0000000 ), LONG2CHARS( 0x000007FFE0000000 ), LONG2CHARS( 0x00000FFFE0000000 ), LONG2CHARS( 0x00001FFFE0000000 ), LONG2CHARS( 0x00003FFFE0000000 ), LONG2CHARS( 0x00007FFFE0000000 ), LONG2CHARS( 0x0000FFFFE0000000 ), LONG2CHARS( 0x0001FFFFE0000000 ), LONG2CHARS( 0x0003FFFFE0000000 ), LONG2CHARS( 0x0007FFFFE0000000 ), LONG2CHARS( 0x000FFFFFE0000000 ), LONG2CHARS( 0x001FFFFFE0000000 ), LONG2CHARS( 0x003FFFFFE0000000 ), LONG2CHARS( 0x007FFFFFE0000000 ), LONG2CHARS( 0x00FFFFFFE0000000 ), LONG2CHARS( 0x01FFFFFFE0000000 ), LONG2CHARS( 0x03FFFFFFE0000000 ), LONG2CHARS( 0x07FFFFFFE0000000 ), LONG2CHARS( 0x0FFFFFFFE0000000 ), LONG2CHARS( 0x1FFFFFFFE0000000 ), LONG2CHARS( 0x3FFFFFFFE0000000 ), LONG2CHARS( 0x7FFFFFFFE0000000 ), LONG2CHARS( 0xFFFFFFFFE0000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000040000000 ), LONG2CHARS( 0x00000000C0000000 ), LONG2CHARS( 0x00000001C0000000 ), LONG2CHARS( 0x00000003C0000000 ), LONG2CHARS( 0x00000007C0000000 ), LONG2CHARS( 0x0000000FC0000000 ), LONG2CHARS( 0x0000001FC0000000 ), LONG2CHARS( 0x0000003FC0000000 ), LONG2CHARS( 0x0000007FC0000000 ), LONG2CHARS( 0x000000FFC0000000 ), LONG2CHARS( 0x000001FFC0000000 ), LONG2CHARS( 0x000003FFC0000000 ), LONG2CHARS( 0x000007FFC0000000 ), LONG2CHARS( 0x00000FFFC0000000 ), LONG2CHARS( 0x00001FFFC0000000 ), LONG2CHARS( 0x00003FFFC0000000 ), LONG2CHARS( 0x00007FFFC0000000 ), LONG2CHARS( 0x0000FFFFC0000000 ), LONG2CHARS( 0x0001FFFFC0000000 ), LONG2CHARS( 0x0003FFFFC0000000 ), LONG2CHARS( 0x0007FFFFC0000000 ), LONG2CHARS( 0x000FFFFFC0000000 ), LONG2CHARS( 0x001FFFFFC0000000 ), LONG2CHARS( 0x003FFFFFC0000000 ), LONG2CHARS( 0x007FFFFFC0000000 ), LONG2CHARS( 0x00FFFFFFC0000000 ), LONG2CHARS( 0x01FFFFFFC0000000 ), LONG2CHARS( 0x03FFFFFFC0000000 ), LONG2CHARS( 0x07FFFFFFC0000000 ), LONG2CHARS( 0x0FFFFFFFC0000000 ), LONG2CHARS( 0x1FFFFFFFC0000000 ), LONG2CHARS( 0x3FFFFFFFC0000000 ), LONG2CHARS( 0x7FFFFFFFC0000000 ), LONG2CHARS( 0xFFFFFFFFC0000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000080000000 ), LONG2CHARS( 0x0000000180000000 ), LONG2CHARS( 0x0000000380000000 ), LONG2CHARS( 0x0000000780000000 ), LONG2CHARS( 0x0000000F80000000 ), LONG2CHARS( 0x0000001F80000000 ), LONG2CHARS( 0x0000003F80000000 ), LONG2CHARS( 0x0000007F80000000 ), LONG2CHARS( 0x000000FF80000000 ), LONG2CHARS( 0x000001FF80000000 ), LONG2CHARS( 0x000003FF80000000 ), LONG2CHARS( 0x000007FF80000000 ), LONG2CHARS( 0x00000FFF80000000 ), LONG2CHARS( 0x00001FFF80000000 ), LONG2CHARS( 0x00003FFF80000000 ), LONG2CHARS( 0x00007FFF80000000 ), LONG2CHARS( 0x0000FFFF80000000 ), LONG2CHARS( 0x0001FFFF80000000 ), LONG2CHARS( 0x0003FFFF80000000 ), LONG2CHARS( 0x0007FFFF80000000 ), LONG2CHARS( 0x000FFFFF80000000 ), LONG2CHARS( 0x001FFFFF80000000 ), LONG2CHARS( 0x003FFFFF80000000 ), LONG2CHARS( 0x007FFFFF80000000 ), LONG2CHARS( 0x00FFFFFF80000000 ), LONG2CHARS( 0x01FFFFFF80000000 ), LONG2CHARS( 0x03FFFFFF80000000 ), LONG2CHARS( 0x07FFFFFF80000000 ), LONG2CHARS( 0x0FFFFFFF80000000 ), LONG2CHARS( 0x1FFFFFFF80000000 ), LONG2CHARS( 0x3FFFFFFF80000000 ), LONG2CHARS( 0x7FFFFFFF80000000 ), LONG2CHARS( 0xFFFFFFFF80000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000100000000 ), LONG2CHARS( 0x0000000300000000 ), LONG2CHARS( 0x0000000700000000 ), LONG2CHARS( 0x0000000F00000000 ), LONG2CHARS( 0x0000001F00000000 ), LONG2CHARS( 0x0000003F00000000 ), LONG2CHARS( 0x0000007F00000000 ), LONG2CHARS( 0x000000FF00000000 ), LONG2CHARS( 0x000001FF00000000 ), LONG2CHARS( 0x000003FF00000000 ), LONG2CHARS( 0x000007FF00000000 ), LONG2CHARS( 0x00000FFF00000000 ), LONG2CHARS( 0x00001FFF00000000 ), LONG2CHARS( 0x00003FFF00000000 ), LONG2CHARS( 0x00007FFF00000000 ), LONG2CHARS( 0x0000FFFF00000000 ), LONG2CHARS( 0x0001FFFF00000000 ), LONG2CHARS( 0x0003FFFF00000000 ), LONG2CHARS( 0x0007FFFF00000000 ), LONG2CHARS( 0x000FFFFF00000000 ), LONG2CHARS( 0x001FFFFF00000000 ), LONG2CHARS( 0x003FFFFF00000000 ), LONG2CHARS( 0x007FFFFF00000000 ), LONG2CHARS( 0x00FFFFFF00000000 ), LONG2CHARS( 0x01FFFFFF00000000 ), LONG2CHARS( 0x03FFFFFF00000000 ), LONG2CHARS( 0x07FFFFFF00000000 ), LONG2CHARS( 0x0FFFFFFF00000000 ), LONG2CHARS( 0x1FFFFFFF00000000 ), LONG2CHARS( 0x3FFFFFFF00000000 ), LONG2CHARS( 0x7FFFFFFF00000000 ), LONG2CHARS( 0xFFFFFFFF00000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000200000000 ), LONG2CHARS( 0x0000000600000000 ), LONG2CHARS( 0x0000000E00000000 ), LONG2CHARS( 0x0000001E00000000 ), LONG2CHARS( 0x0000003E00000000 ), LONG2CHARS( 0x0000007E00000000 ), LONG2CHARS( 0x000000FE00000000 ), LONG2CHARS( 0x000001FE00000000 ), LONG2CHARS( 0x000003FE00000000 ), LONG2CHARS( 0x000007FE00000000 ), LONG2CHARS( 0x00000FFE00000000 ), LONG2CHARS( 0x00001FFE00000000 ), LONG2CHARS( 0x00003FFE00000000 ), LONG2CHARS( 0x00007FFE00000000 ), LONG2CHARS( 0x0000FFFE00000000 ), LONG2CHARS( 0x0001FFFE00000000 ), LONG2CHARS( 0x0003FFFE00000000 ), LONG2CHARS( 0x0007FFFE00000000 ), LONG2CHARS( 0x000FFFFE00000000 ), LONG2CHARS( 0x001FFFFE00000000 ), LONG2CHARS( 0x003FFFFE00000000 ), LONG2CHARS( 0x007FFFFE00000000 ), LONG2CHARS( 0x00FFFFFE00000000 ), LONG2CHARS( 0x01FFFFFE00000000 ), LONG2CHARS( 0x03FFFFFE00000000 ), LONG2CHARS( 0x07FFFFFE00000000 ), LONG2CHARS( 0x0FFFFFFE00000000 ), LONG2CHARS( 0x1FFFFFFE00000000 ), LONG2CHARS( 0x3FFFFFFE00000000 ), LONG2CHARS( 0x7FFFFFFE00000000 ), LONG2CHARS( 0xFFFFFFFE00000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000400000000 ), LONG2CHARS( 0x0000000C00000000 ), LONG2CHARS( 0x0000001C00000000 ), LONG2CHARS( 0x0000003C00000000 ), LONG2CHARS( 0x0000007C00000000 ), LONG2CHARS( 0x000000FC00000000 ), LONG2CHARS( 0x000001FC00000000 ), LONG2CHARS( 0x000003FC00000000 ), LONG2CHARS( 0x000007FC00000000 ), LONG2CHARS( 0x00000FFC00000000 ), LONG2CHARS( 0x00001FFC00000000 ), LONG2CHARS( 0x00003FFC00000000 ), LONG2CHARS( 0x00007FFC00000000 ), LONG2CHARS( 0x0000FFFC00000000 ), LONG2CHARS( 0x0001FFFC00000000 ), LONG2CHARS( 0x0003FFFC00000000 ), LONG2CHARS( 0x0007FFFC00000000 ), LONG2CHARS( 0x000FFFFC00000000 ), LONG2CHARS( 0x001FFFFC00000000 ), LONG2CHARS( 0x003FFFFC00000000 ), LONG2CHARS( 0x007FFFFC00000000 ), LONG2CHARS( 0x00FFFFFC00000000 ), LONG2CHARS( 0x01FFFFFC00000000 ), LONG2CHARS( 0x03FFFFFC00000000 ), LONG2CHARS( 0x07FFFFFC00000000 ), LONG2CHARS( 0x0FFFFFFC00000000 ), LONG2CHARS( 0x1FFFFFFC00000000 ), LONG2CHARS( 0x3FFFFFFC00000000 ), LONG2CHARS( 0x7FFFFFFC00000000 ), LONG2CHARS( 0xFFFFFFFC00000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000800000000 ), LONG2CHARS( 0x0000001800000000 ), LONG2CHARS( 0x0000003800000000 ), LONG2CHARS( 0x0000007800000000 ), LONG2CHARS( 0x000000F800000000 ), LONG2CHARS( 0x000001F800000000 ), LONG2CHARS( 0x000003F800000000 ), LONG2CHARS( 0x000007F800000000 ), LONG2CHARS( 0x00000FF800000000 ), LONG2CHARS( 0x00001FF800000000 ), LONG2CHARS( 0x00003FF800000000 ), LONG2CHARS( 0x00007FF800000000 ), LONG2CHARS( 0x0000FFF800000000 ), LONG2CHARS( 0x0001FFF800000000 ), LONG2CHARS( 0x0003FFF800000000 ), LONG2CHARS( 0x0007FFF800000000 ), LONG2CHARS( 0x000FFFF800000000 ), LONG2CHARS( 0x001FFFF800000000 ), LONG2CHARS( 0x003FFFF800000000 ), LONG2CHARS( 0x007FFFF800000000 ), LONG2CHARS( 0x00FFFFF800000000 ), LONG2CHARS( 0x01FFFFF800000000 ), LONG2CHARS( 0x03FFFFF800000000 ), LONG2CHARS( 0x07FFFFF800000000 ), LONG2CHARS( 0x0FFFFFF800000000 ), LONG2CHARS( 0x1FFFFFF800000000 ), LONG2CHARS( 0x3FFFFFF800000000 ), LONG2CHARS( 0x7FFFFFF800000000 ), LONG2CHARS( 0xFFFFFFF800000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000001000000000 ), LONG2CHARS( 0x0000003000000000 ), LONG2CHARS( 0x0000007000000000 ), LONG2CHARS( 0x000000F000000000 ), LONG2CHARS( 0x000001F000000000 ), LONG2CHARS( 0x000003F000000000 ), LONG2CHARS( 0x000007F000000000 ), LONG2CHARS( 0x00000FF000000000 ), LONG2CHARS( 0x00001FF000000000 ), LONG2CHARS( 0x00003FF000000000 ), LONG2CHARS( 0x00007FF000000000 ), LONG2CHARS( 0x0000FFF000000000 ), LONG2CHARS( 0x0001FFF000000000 ), LONG2CHARS( 0x0003FFF000000000 ), LONG2CHARS( 0x0007FFF000000000 ), LONG2CHARS( 0x000FFFF000000000 ), LONG2CHARS( 0x001FFFF000000000 ), LONG2CHARS( 0x003FFFF000000000 ), LONG2CHARS( 0x007FFFF000000000 ), LONG2CHARS( 0x00FFFFF000000000 ), LONG2CHARS( 0x01FFFFF000000000 ), LONG2CHARS( 0x03FFFFF000000000 ), LONG2CHARS( 0x07FFFFF000000000 ), LONG2CHARS( 0x0FFFFFF000000000 ), LONG2CHARS( 0x1FFFFFF000000000 ), LONG2CHARS( 0x3FFFFFF000000000 ), LONG2CHARS( 0x7FFFFFF000000000 ), LONG2CHARS( 0xFFFFFFF000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000002000000000 ), LONG2CHARS( 0x0000006000000000 ), LONG2CHARS( 0x000000E000000000 ), LONG2CHARS( 0x000001E000000000 ), LONG2CHARS( 0x000003E000000000 ), LONG2CHARS( 0x000007E000000000 ), LONG2CHARS( 0x00000FE000000000 ), LONG2CHARS( 0x00001FE000000000 ), LONG2CHARS( 0x00003FE000000000 ), LONG2CHARS( 0x00007FE000000000 ), LONG2CHARS( 0x0000FFE000000000 ), LONG2CHARS( 0x0001FFE000000000 ), LONG2CHARS( 0x0003FFE000000000 ), LONG2CHARS( 0x0007FFE000000000 ), LONG2CHARS( 0x000FFFE000000000 ), LONG2CHARS( 0x001FFFE000000000 ), LONG2CHARS( 0x003FFFE000000000 ), LONG2CHARS( 0x007FFFE000000000 ), LONG2CHARS( 0x00FFFFE000000000 ), LONG2CHARS( 0x01FFFFE000000000 ), LONG2CHARS( 0x03FFFFE000000000 ), LONG2CHARS( 0x07FFFFE000000000 ), LONG2CHARS( 0x0FFFFFE000000000 ), LONG2CHARS( 0x1FFFFFE000000000 ), LONG2CHARS( 0x3FFFFFE000000000 ), LONG2CHARS( 0x7FFFFFE000000000 ), LONG2CHARS( 0xFFFFFFE000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000004000000000 ), LONG2CHARS( 0x000000C000000000 ), LONG2CHARS( 0x000001C000000000 ), LONG2CHARS( 0x000003C000000000 ), LONG2CHARS( 0x000007C000000000 ), LONG2CHARS( 0x00000FC000000000 ), LONG2CHARS( 0x00001FC000000000 ), LONG2CHARS( 0x00003FC000000000 ), LONG2CHARS( 0x00007FC000000000 ), LONG2CHARS( 0x0000FFC000000000 ), LONG2CHARS( 0x0001FFC000000000 ), LONG2CHARS( 0x0003FFC000000000 ), LONG2CHARS( 0x0007FFC000000000 ), LONG2CHARS( 0x000FFFC000000000 ), LONG2CHARS( 0x001FFFC000000000 ), LONG2CHARS( 0x003FFFC000000000 ), LONG2CHARS( 0x007FFFC000000000 ), LONG2CHARS( 0x00FFFFC000000000 ), LONG2CHARS( 0x01FFFFC000000000 ), LONG2CHARS( 0x03FFFFC000000000 ), LONG2CHARS( 0x07FFFFC000000000 ), LONG2CHARS( 0x0FFFFFC000000000 ), LONG2CHARS( 0x1FFFFFC000000000 ), LONG2CHARS( 0x3FFFFFC000000000 ), LONG2CHARS( 0x7FFFFFC000000000 ), LONG2CHARS( 0xFFFFFFC000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000008000000000 ), LONG2CHARS( 0x0000018000000000 ), LONG2CHARS( 0x0000038000000000 ), LONG2CHARS( 0x0000078000000000 ), LONG2CHARS( 0x00000F8000000000 ), LONG2CHARS( 0x00001F8000000000 ), LONG2CHARS( 0x00003F8000000000 ), LONG2CHARS( 0x00007F8000000000 ), LONG2CHARS( 0x0000FF8000000000 ), LONG2CHARS( 0x0001FF8000000000 ), LONG2CHARS( 0x0003FF8000000000 ), LONG2CHARS( 0x0007FF8000000000 ), LONG2CHARS( 0x000FFF8000000000 ), LONG2CHARS( 0x001FFF8000000000 ), LONG2CHARS( 0x003FFF8000000000 ), LONG2CHARS( 0x007FFF8000000000 ), LONG2CHARS( 0x00FFFF8000000000 ), LONG2CHARS( 0x01FFFF8000000000 ), LONG2CHARS( 0x03FFFF8000000000 ), LONG2CHARS( 0x07FFFF8000000000 ), LONG2CHARS( 0x0FFFFF8000000000 ), LONG2CHARS( 0x1FFFFF8000000000 ), LONG2CHARS( 0x3FFFFF8000000000 ), LONG2CHARS( 0x7FFFFF8000000000 ), LONG2CHARS( 0xFFFFFF8000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000010000000000 ), LONG2CHARS( 0x0000030000000000 ), LONG2CHARS( 0x0000070000000000 ), LONG2CHARS( 0x00000F0000000000 ), LONG2CHARS( 0x00001F0000000000 ), LONG2CHARS( 0x00003F0000000000 ), LONG2CHARS( 0x00007F0000000000 ), LONG2CHARS( 0x0000FF0000000000 ), LONG2CHARS( 0x0001FF0000000000 ), LONG2CHARS( 0x0003FF0000000000 ), LONG2CHARS( 0x0007FF0000000000 ), LONG2CHARS( 0x000FFF0000000000 ), LONG2CHARS( 0x001FFF0000000000 ), LONG2CHARS( 0x003FFF0000000000 ), LONG2CHARS( 0x007FFF0000000000 ), LONG2CHARS( 0x00FFFF0000000000 ), LONG2CHARS( 0x01FFFF0000000000 ), LONG2CHARS( 0x03FFFF0000000000 ), LONG2CHARS( 0x07FFFF0000000000 ), LONG2CHARS( 0x0FFFFF0000000000 ), LONG2CHARS( 0x1FFFFF0000000000 ), LONG2CHARS( 0x3FFFFF0000000000 ), LONG2CHARS( 0x7FFFFF0000000000 ), LONG2CHARS( 0xFFFFFF0000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000020000000000 ), LONG2CHARS( 0x0000060000000000 ), LONG2CHARS( 0x00000E0000000000 ), LONG2CHARS( 0x00001E0000000000 ), LONG2CHARS( 0x00003E0000000000 ), LONG2CHARS( 0x00007E0000000000 ), LONG2CHARS( 0x0000FE0000000000 ), LONG2CHARS( 0x0001FE0000000000 ), LONG2CHARS( 0x0003FE0000000000 ), LONG2CHARS( 0x0007FE0000000000 ), LONG2CHARS( 0x000FFE0000000000 ), LONG2CHARS( 0x001FFE0000000000 ), LONG2CHARS( 0x003FFE0000000000 ), LONG2CHARS( 0x007FFE0000000000 ), LONG2CHARS( 0x00FFFE0000000000 ), LONG2CHARS( 0x01FFFE0000000000 ), LONG2CHARS( 0x03FFFE0000000000 ), LONG2CHARS( 0x07FFFE0000000000 ), LONG2CHARS( 0x0FFFFE0000000000 ), LONG2CHARS( 0x1FFFFE0000000000 ), LONG2CHARS( 0x3FFFFE0000000000 ), LONG2CHARS( 0x7FFFFE0000000000 ), LONG2CHARS( 0xFFFFFE0000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000040000000000 ), LONG2CHARS( 0x00000C0000000000 ), LONG2CHARS( 0x00001C0000000000 ), LONG2CHARS( 0x00003C0000000000 ), LONG2CHARS( 0x00007C0000000000 ), LONG2CHARS( 0x0000FC0000000000 ), LONG2CHARS( 0x0001FC0000000000 ), LONG2CHARS( 0x0003FC0000000000 ), LONG2CHARS( 0x0007FC0000000000 ), LONG2CHARS( 0x000FFC0000000000 ), LONG2CHARS( 0x001FFC0000000000 ), LONG2CHARS( 0x003FFC0000000000 ), LONG2CHARS( 0x007FFC0000000000 ), LONG2CHARS( 0x00FFFC0000000000 ), LONG2CHARS( 0x01FFFC0000000000 ), LONG2CHARS( 0x03FFFC0000000000 ), LONG2CHARS( 0x07FFFC0000000000 ), LONG2CHARS( 0x0FFFFC0000000000 ), LONG2CHARS( 0x1FFFFC0000000000 ), LONG2CHARS( 0x3FFFFC0000000000 ), LONG2CHARS( 0x7FFFFC0000000000 ), LONG2CHARS( 0xFFFFFC0000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000080000000000 ), LONG2CHARS( 0x0000180000000000 ), LONG2CHARS( 0x0000380000000000 ), LONG2CHARS( 0x0000780000000000 ), LONG2CHARS( 0x0000F80000000000 ), LONG2CHARS( 0x0001F80000000000 ), LONG2CHARS( 0x0003F80000000000 ), LONG2CHARS( 0x0007F80000000000 ), LONG2CHARS( 0x000FF80000000000 ), LONG2CHARS( 0x001FF80000000000 ), LONG2CHARS( 0x003FF80000000000 ), LONG2CHARS( 0x007FF80000000000 ), LONG2CHARS( 0x00FFF80000000000 ), LONG2CHARS( 0x01FFF80000000000 ), LONG2CHARS( 0x03FFF80000000000 ), LONG2CHARS( 0x07FFF80000000000 ), LONG2CHARS( 0x0FFFF80000000000 ), LONG2CHARS( 0x1FFFF80000000000 ), LONG2CHARS( 0x3FFFF80000000000 ), LONG2CHARS( 0x7FFFF80000000000 ), LONG2CHARS( 0xFFFFF80000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000100000000000 ), LONG2CHARS( 0x0000300000000000 ), LONG2CHARS( 0x0000700000000000 ), LONG2CHARS( 0x0000F00000000000 ), LONG2CHARS( 0x0001F00000000000 ), LONG2CHARS( 0x0003F00000000000 ), LONG2CHARS( 0x0007F00000000000 ), LONG2CHARS( 0x000FF00000000000 ), LONG2CHARS( 0x001FF00000000000 ), LONG2CHARS( 0x003FF00000000000 ), LONG2CHARS( 0x007FF00000000000 ), LONG2CHARS( 0x00FFF00000000000 ), LONG2CHARS( 0x01FFF00000000000 ), LONG2CHARS( 0x03FFF00000000000 ), LONG2CHARS( 0x07FFF00000000000 ), LONG2CHARS( 0x0FFFF00000000000 ), LONG2CHARS( 0x1FFFF00000000000 ), LONG2CHARS( 0x3FFFF00000000000 ), LONG2CHARS( 0x7FFFF00000000000 ), LONG2CHARS( 0xFFFFF00000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000200000000000 ), LONG2CHARS( 0x0000600000000000 ), LONG2CHARS( 0x0000E00000000000 ), LONG2CHARS( 0x0001E00000000000 ), LONG2CHARS( 0x0003E00000000000 ), LONG2CHARS( 0x0007E00000000000 ), LONG2CHARS( 0x000FE00000000000 ), LONG2CHARS( 0x001FE00000000000 ), LONG2CHARS( 0x003FE00000000000 ), LONG2CHARS( 0x007FE00000000000 ), LONG2CHARS( 0x00FFE00000000000 ), LONG2CHARS( 0x01FFE00000000000 ), LONG2CHARS( 0x03FFE00000000000 ), LONG2CHARS( 0x07FFE00000000000 ), LONG2CHARS( 0x0FFFE00000000000 ), LONG2CHARS( 0x1FFFE00000000000 ), LONG2CHARS( 0x3FFFE00000000000 ), LONG2CHARS( 0x7FFFE00000000000 ), LONG2CHARS( 0xFFFFE00000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000400000000000 ), LONG2CHARS( 0x0000C00000000000 ), LONG2CHARS( 0x0001C00000000000 ), LONG2CHARS( 0x0003C00000000000 ), LONG2CHARS( 0x0007C00000000000 ), LONG2CHARS( 0x000FC00000000000 ), LONG2CHARS( 0x001FC00000000000 ), LONG2CHARS( 0x003FC00000000000 ), LONG2CHARS( 0x007FC00000000000 ), LONG2CHARS( 0x00FFC00000000000 ), LONG2CHARS( 0x01FFC00000000000 ), LONG2CHARS( 0x03FFC00000000000 ), LONG2CHARS( 0x07FFC00000000000 ), LONG2CHARS( 0x0FFFC00000000000 ), LONG2CHARS( 0x1FFFC00000000000 ), LONG2CHARS( 0x3FFFC00000000000 ), LONG2CHARS( 0x7FFFC00000000000 ), LONG2CHARS( 0xFFFFC00000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000800000000000 ), LONG2CHARS( 0x0001800000000000 ), LONG2CHARS( 0x0003800000000000 ), LONG2CHARS( 0x0007800000000000 ), LONG2CHARS( 0x000F800000000000 ), LONG2CHARS( 0x001F800000000000 ), LONG2CHARS( 0x003F800000000000 ), LONG2CHARS( 0x007F800000000000 ), LONG2CHARS( 0x00FF800000000000 ), LONG2CHARS( 0x01FF800000000000 ), LONG2CHARS( 0x03FF800000000000 ), LONG2CHARS( 0x07FF800000000000 ), LONG2CHARS( 0x0FFF800000000000 ), LONG2CHARS( 0x1FFF800000000000 ), LONG2CHARS( 0x3FFF800000000000 ), LONG2CHARS( 0x7FFF800000000000 ), LONG2CHARS( 0xFFFF800000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0001000000000000 ), LONG2CHARS( 0x0003000000000000 ), LONG2CHARS( 0x0007000000000000 ), LONG2CHARS( 0x000F000000000000 ), LONG2CHARS( 0x001F000000000000 ), LONG2CHARS( 0x003F000000000000 ), LONG2CHARS( 0x007F000000000000 ), LONG2CHARS( 0x00FF000000000000 ), LONG2CHARS( 0x01FF000000000000 ), LONG2CHARS( 0x03FF000000000000 ), LONG2CHARS( 0x07FF000000000000 ), LONG2CHARS( 0x0FFF000000000000 ), LONG2CHARS( 0x1FFF000000000000 ), LONG2CHARS( 0x3FFF000000000000 ), LONG2CHARS( 0x7FFF000000000000 ), LONG2CHARS( 0xFFFF000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0002000000000000 ), LONG2CHARS( 0x0006000000000000 ), LONG2CHARS( 0x000E000000000000 ), LONG2CHARS( 0x001E000000000000 ), LONG2CHARS( 0x003E000000000000 ), LONG2CHARS( 0x007E000000000000 ), LONG2CHARS( 0x00FE000000000000 ), LONG2CHARS( 0x01FE000000000000 ), LONG2CHARS( 0x03FE000000000000 ), LONG2CHARS( 0x07FE000000000000 ), LONG2CHARS( 0x0FFE000000000000 ), LONG2CHARS( 0x1FFE000000000000 ), LONG2CHARS( 0x3FFE000000000000 ), LONG2CHARS( 0x7FFE000000000000 ), LONG2CHARS( 0xFFFE000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0004000000000000 ), LONG2CHARS( 0x000C000000000000 ), LONG2CHARS( 0x001C000000000000 ), LONG2CHARS( 0x003C000000000000 ), LONG2CHARS( 0x007C000000000000 ), LONG2CHARS( 0x00FC000000000000 ), LONG2CHARS( 0x01FC000000000000 ), LONG2CHARS( 0x03FC000000000000 ), LONG2CHARS( 0x07FC000000000000 ), LONG2CHARS( 0x0FFC000000000000 ), LONG2CHARS( 0x1FFC000000000000 ), LONG2CHARS( 0x3FFC000000000000 ), LONG2CHARS( 0x7FFC000000000000 ), LONG2CHARS( 0xFFFC000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0008000000000000 ), LONG2CHARS( 0x0018000000000000 ), LONG2CHARS( 0x0038000000000000 ), LONG2CHARS( 0x0078000000000000 ), LONG2CHARS( 0x00F8000000000000 ), LONG2CHARS( 0x01F8000000000000 ), LONG2CHARS( 0x03F8000000000000 ), LONG2CHARS( 0x07F8000000000000 ), LONG2CHARS( 0x0FF8000000000000 ), LONG2CHARS( 0x1FF8000000000000 ), LONG2CHARS( 0x3FF8000000000000 ), LONG2CHARS( 0x7FF8000000000000 ), LONG2CHARS( 0xFFF8000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0010000000000000 ), LONG2CHARS( 0x0030000000000000 ), LONG2CHARS( 0x0070000000000000 ), LONG2CHARS( 0x00F0000000000000 ), LONG2CHARS( 0x01F0000000000000 ), LONG2CHARS( 0x03F0000000000000 ), LONG2CHARS( 0x07F0000000000000 ), LONG2CHARS( 0x0FF0000000000000 ), LONG2CHARS( 0x1FF0000000000000 ), LONG2CHARS( 0x3FF0000000000000 ), LONG2CHARS( 0x7FF0000000000000 ), LONG2CHARS( 0xFFF0000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0020000000000000 ), LONG2CHARS( 0x0060000000000000 ), LONG2CHARS( 0x00E0000000000000 ), LONG2CHARS( 0x01E0000000000000 ), LONG2CHARS( 0x03E0000000000000 ), LONG2CHARS( 0x07E0000000000000 ), LONG2CHARS( 0x0FE0000000000000 ), LONG2CHARS( 0x1FE0000000000000 ), LONG2CHARS( 0x3FE0000000000000 ), LONG2CHARS( 0x7FE0000000000000 ), LONG2CHARS( 0xFFE0000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0040000000000000 ), LONG2CHARS( 0x00C0000000000000 ), LONG2CHARS( 0x01C0000000000000 ), LONG2CHARS( 0x03C0000000000000 ), LONG2CHARS( 0x07C0000000000000 ), LONG2CHARS( 0x0FC0000000000000 ), LONG2CHARS( 0x1FC0000000000000 ), LONG2CHARS( 0x3FC0000000000000 ), LONG2CHARS( 0x7FC0000000000000 ), LONG2CHARS( 0xFFC0000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0080000000000000 ), LONG2CHARS( 0x0180000000000000 ), LONG2CHARS( 0x0380000000000000 ), LONG2CHARS( 0x0780000000000000 ), LONG2CHARS( 0x0F80000000000000 ), LONG2CHARS( 0x1F80000000000000 ), LONG2CHARS( 0x3F80000000000000 ), LONG2CHARS( 0x7F80000000000000 ), LONG2CHARS( 0xFF80000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0100000000000000 ), LONG2CHARS( 0x0300000000000000 ), LONG2CHARS( 0x0700000000000000 ), LONG2CHARS( 0x0F00000000000000 ), LONG2CHARS( 0x1F00000000000000 ), LONG2CHARS( 0x3F00000000000000 ), LONG2CHARS( 0x7F00000000000000 ), LONG2CHARS( 0xFF00000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0200000000000000 ), LONG2CHARS( 0x0600000000000000 ), LONG2CHARS( 0x0E00000000000000 ), LONG2CHARS( 0x1E00000000000000 ), LONG2CHARS( 0x3E00000000000000 ), LONG2CHARS( 0x7E00000000000000 ), LONG2CHARS( 0xFE00000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0400000000000000 ), LONG2CHARS( 0x0C00000000000000 ), LONG2CHARS( 0x1C00000000000000 ), LONG2CHARS( 0x3C00000000000000 ), LONG2CHARS( 0x7C00000000000000 ), LONG2CHARS( 0xFC00000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0800000000000000 ), LONG2CHARS( 0x1800000000000000 ), LONG2CHARS( 0x3800000000000000 ), LONG2CHARS( 0x7800000000000000 ), LONG2CHARS( 0xF800000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x1000000000000000 ), LONG2CHARS( 0x3000000000000000 ), LONG2CHARS( 0x7000000000000000 ), LONG2CHARS( 0xF000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x2000000000000000 ), LONG2CHARS( 0x6000000000000000 ), LONG2CHARS( 0xE000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x4000000000000000 ), LONG2CHARS( 0xC000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, { LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x8000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), LONG2CHARS( 0x0000000000000000 ), }, }; #endif /* PPW */ #endif /* used for masking bits in bresenham lines mask[n] is used to mask out all but bit n in a longword (n is a screen position). rmask[n] is used to mask out the single bit at position n (n is a screen posiotion.) */ #define _1_ ((PixelType)1) #if (BITMAP_BIT_ORDER == MSBFirst) PixelType mask[PPW] = { #if PPW == 64 LONG2CHARS( _1_<<63 ), LONG2CHARS( 1L<<62 ), LONG2CHARS( 1L<<61 ), LONG2CHARS( 1L<<60 ), LONG2CHARS( 1L<<59 ), LONG2CHARS( 1L<<58 ), LONG2CHARS( 1L<<57 ), LONG2CHARS( 1L<<56 ), LONG2CHARS( 1L<<55 ), LONG2CHARS( 1L<<54 ), LONG2CHARS( 1L<<53 ), LONG2CHARS( 1L<<52 ), LONG2CHARS( 1L<<51 ), LONG2CHARS( 1L<<50 ), LONG2CHARS( 1L<<49 ), LONG2CHARS( 1L<<48 ), LONG2CHARS( 1L<<47 ), LONG2CHARS( 1L<<46 ), LONG2CHARS( 1L<<45 ), LONG2CHARS( 1L<<44 ), LONG2CHARS( 1L<<43 ), LONG2CHARS( 1L<<42 ), LONG2CHARS( 1L<<41 ), LONG2CHARS( 1L<<40 ), LONG2CHARS( 1L<<39 ), LONG2CHARS( 1L<<38 ), LONG2CHARS( 1L<<37 ), LONG2CHARS( 1L<<36 ), LONG2CHARS( 1L<<35 ), LONG2CHARS( 1L<<34 ), LONG2CHARS( 1L<<33 ), LONG2CHARS( 1L<<32 ), #endif /* PPW */ LONG2CHARS( _1_<<31 ), LONG2CHARS( 1<<30 ), LONG2CHARS( 1<<29 ), LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<26 ), LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<23 ), LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<20 ), LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<17 ), LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<14 ), LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<11 ), LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<8 ), LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<5 ), LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<2 ), LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<0 ) }; PixelType rmask[] = { #if PPW == 64 0xffffffffffffffff ^ LONG2CHARS( _1_<<63 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<62 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<61 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<60 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<59 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<58 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<57 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<56 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<55 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<54 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<53 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<52 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<51 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<50 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<49 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<48 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<47 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<46 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<45 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<44 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<43 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<42 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<41 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<40 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<39 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<38 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<37 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<36 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<35 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<34 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<33 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<32 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<31 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<30 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<29 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<28 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<27 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<26 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<25 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<24 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<23 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<22 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<21 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<20 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<19 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<18 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<17 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<16 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<15 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<14 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<13 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<12 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<11 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<10 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<9 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<8 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<7 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<6 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<5 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<4 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<3 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<2 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<1 ), 0xffffffffffffffff ^ LONG2CHARS( 1L<<0 ) #else /* PPW */ 0xffffffff ^ LONG2CHARS( _1_<<31 ), 0xffffffff ^ LONG2CHARS( 1<<30 ), 0xffffffff ^ LONG2CHARS( 1<<29 ), 0xffffffff ^ LONG2CHARS( 1<<28), 0xffffffff ^ LONG2CHARS( 1<<27 ), 0xffffffff ^ LONG2CHARS( 1<<26), 0xffffffff ^ LONG2CHARS( 1<<25 ), 0xffffffff ^ LONG2CHARS( 1<<24 ), 0xffffffff ^ LONG2CHARS( 1<<23 ), 0xffffffff ^ LONG2CHARS( 1<<22), 0xffffffff ^ LONG2CHARS( 1<<21 ), 0xffffffff ^ LONG2CHARS( 1<<20), 0xffffffff ^ LONG2CHARS( 1<<19 ), 0xffffffff ^ LONG2CHARS( 1<<18 ), 0xffffffff ^ LONG2CHARS( 1<<17 ), 0xffffffff ^ LONG2CHARS( 1<<16), 0xffffffff ^ LONG2CHARS( 1<<15 ), 0xffffffff ^ LONG2CHARS( 1<<14), 0xffffffff ^ LONG2CHARS( 1<<13 ), 0xffffffff ^ LONG2CHARS( 1<<12 ), 0xffffffff ^ LONG2CHARS( 1<<11 ), 0xffffffff ^ LONG2CHARS( 1<<10), 0xffffffff ^ LONG2CHARS( 1<<9 ), 0xffffffff ^ LONG2CHARS( 1<<8), 0xffffffff ^ LONG2CHARS( 1<<7 ), 0xffffffff ^ LONG2CHARS( 1<<6), 0xffffffff ^ LONG2CHARS( 1<<5 ), 0xffffffff ^ LONG2CHARS( 1<<4), 0xffffffff ^ LONG2CHARS( 1<<3 ), 0xffffffff ^ LONG2CHARS( 1<<2), 0xffffffff ^ LONG2CHARS( 1<<1 ), 0xffffffff ^ LONG2CHARS( 1<<0) #endif /* PPW */ }; #else /* LSBFirst */ PixelType mask[] = { LONG2CHARS( 1<<0 ), LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<2), LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<5), LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<8), LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<11), LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<14), LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<17), LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<20), LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<23), LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<26), LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<29), LONG2CHARS( 1<<30 ), LONG2CHARS( _1_<<31 ) #if PPW == 64 , LONG2CHARS( 1L<<32), LONG2CHARS( 1L<<33 ), LONG2CHARS( 1L<<34 ), LONG2CHARS( 1L<<35), LONG2CHARS( 1L<<36 ), LONG2CHARS( 1L<<37 ), LONG2CHARS( 1L<<38), LONG2CHARS( 1L<<39 ), LONG2CHARS( 1L<<40 ), LONG2CHARS( 1L<<41), LONG2CHARS( 1L<<42 ), LONG2CHARS( 1L<<43 ), LONG2CHARS( 1L<<44), LONG2CHARS( 1L<<45 ), LONG2CHARS( 1L<<46 ), LONG2CHARS( 1L<<47), LONG2CHARS( 1L<<48 ), LONG2CHARS( 1L<<49 ), LONG2CHARS( 1L<<50), LONG2CHARS( 1L<<51 ), LONG2CHARS( 1L<<52 ), LONG2CHARS( 1L<<53), LONG2CHARS( 1L<<54 ), LONG2CHARS( 1L<<55 ), LONG2CHARS( 1L<<56), LONG2CHARS( 1L<<57 ), LONG2CHARS( 1L<<58 ), LONG2CHARS( 1L<<59), LONG2CHARS( 1L<<60 ), LONG2CHARS( 1L<<61 ), LONG2CHARS( 1L<<62 ), LONG2CHARS( _1_<<63 ), #endif /* PPW */ }; PixelType rmask[] = { #if PPW == 32 0xffffffff ^ LONG2CHARS( 1<<0), 0xffffffff ^ LONG2CHARS( 1<<1), 0xffffffff ^ LONG2CHARS( 1<<2), 0xffffffff ^ LONG2CHARS( 1<<3), 0xffffffff ^ LONG2CHARS( 1<<4), 0xffffffff ^ LONG2CHARS( 1<<5), 0xffffffff ^ LONG2CHARS( 1<<6), 0xffffffff ^ LONG2CHARS( 1<<7), 0xffffffff ^ LONG2CHARS( 1<<8), 0xffffffff ^ LONG2CHARS( 1<<9), 0xffffffff ^ LONG2CHARS( 1<<10), 0xffffffff ^ LONG2CHARS( 1<<11), 0xffffffff ^ LONG2CHARS( 1<<12), 0xffffffff ^ LONG2CHARS( 1<<13), 0xffffffff ^ LONG2CHARS( 1<<14), 0xffffffff ^ LONG2CHARS( 1<<15), 0xffffffff ^ LONG2CHARS( 1<<16), 0xffffffff ^ LONG2CHARS( 1<<17), 0xffffffff ^ LONG2CHARS( 1<<18), 0xffffffff ^ LONG2CHARS( 1<<19), 0xffffffff ^ LONG2CHARS( 1<<20), 0xffffffff ^ LONG2CHARS( 1<<21), 0xffffffff ^ LONG2CHARS( 1<<22), 0xffffffff ^ LONG2CHARS( 1<<23), 0xffffffff ^ LONG2CHARS( 1<<24), 0xffffffff ^ LONG2CHARS( 1<<25), 0xffffffff ^ LONG2CHARS( 1<<26), 0xffffffff ^ LONG2CHARS( 1<<27), 0xffffffff ^ LONG2CHARS( 1<<28), 0xffffffff ^ LONG2CHARS( 1<<29), 0xffffffff ^ LONG2CHARS( 1<<30), 0xffffffff ^ LONG2CHARS( _1_<<31) #else /* PPW */ 0xffffffffffffffff ^ LONG2CHARS( 1L<<0), 0xffffffffffffffff ^ LONG2CHARS( 1L<<1), 0xffffffffffffffff ^ LONG2CHARS( 1L<<2), 0xffffffffffffffff ^ LONG2CHARS( 1L<<3), 0xffffffffffffffff ^ LONG2CHARS( 1L<<4), 0xffffffffffffffff ^ LONG2CHARS( 1L<<5), 0xffffffffffffffff ^ LONG2CHARS( 1L<<6), 0xffffffffffffffff ^ LONG2CHARS( 1L<<7), 0xffffffffffffffff ^ LONG2CHARS( 1L<<8), 0xffffffffffffffff ^ LONG2CHARS( 1L<<9), 0xffffffffffffffff ^ LONG2CHARS( 1L<<10), 0xffffffffffffffff ^ LONG2CHARS( 1L<<11), 0xffffffffffffffff ^ LONG2CHARS( 1L<<12), 0xffffffffffffffff ^ LONG2CHARS( 1L<<13), 0xffffffffffffffff ^ LONG2CHARS( 1L<<14), 0xffffffffffffffff ^ LONG2CHARS( 1L<<15), 0xffffffffffffffff ^ LONG2CHARS( 1L<<16), 0xffffffffffffffff ^ LONG2CHARS( 1L<<17), 0xffffffffffffffff ^ LONG2CHARS( 1L<<18), 0xffffffffffffffff ^ LONG2CHARS( 1L<<19), 0xffffffffffffffff ^ LONG2CHARS( 1L<<20), 0xffffffffffffffff ^ LONG2CHARS( 1L<<21), 0xffffffffffffffff ^ LONG2CHARS( 1L<<22), 0xffffffffffffffff ^ LONG2CHARS( 1L<<23), 0xffffffffffffffff ^ LONG2CHARS( 1L<<24), 0xffffffffffffffff ^ LONG2CHARS( 1L<<25), 0xffffffffffffffff ^ LONG2CHARS( 1L<<26), 0xffffffffffffffff ^ LONG2CHARS( 1L<<27), 0xffffffffffffffff ^ LONG2CHARS( 1L<<28), 0xffffffffffffffff ^ LONG2CHARS( 1L<<29), 0xffffffffffffffff ^ LONG2CHARS( 1L<<30), 0xffffffffffffffff ^ LONG2CHARS( 1L<<31), 0xffffffffffffffff ^ LONG2CHARS( 1L<<32), 0xffffffffffffffff ^ LONG2CHARS( 1L<<33), 0xffffffffffffffff ^ LONG2CHARS( 1L<<34), 0xffffffffffffffff ^ LONG2CHARS( 1L<<35), 0xffffffffffffffff ^ LONG2CHARS( 1L<<36), 0xffffffffffffffff ^ LONG2CHARS( 1L<<37), 0xffffffffffffffff ^ LONG2CHARS( 1L<<38), 0xffffffffffffffff ^ LONG2CHARS( 1L<<39), 0xffffffffffffffff ^ LONG2CHARS( 1L<<40), 0xffffffffffffffff ^ LONG2CHARS( 1L<<41), 0xffffffffffffffff ^ LONG2CHARS( 1L<<42), 0xffffffffffffffff ^ LONG2CHARS( 1L<<43), 0xffffffffffffffff ^ LONG2CHARS( 1L<<44), 0xffffffffffffffff ^ LONG2CHARS( 1L<<45), 0xffffffffffffffff ^ LONG2CHARS( 1L<<46), 0xffffffffffffffff ^ LONG2CHARS( 1L<<47), 0xffffffffffffffff ^ LONG2CHARS( 1L<<48), 0xffffffffffffffff ^ LONG2CHARS( 1L<<49), 0xffffffffffffffff ^ LONG2CHARS( 1L<<50), 0xffffffffffffffff ^ LONG2CHARS( 1L<<51), 0xffffffffffffffff ^ LONG2CHARS( 1L<<52), 0xffffffffffffffff ^ LONG2CHARS( 1L<<53), 0xffffffffffffffff ^ LONG2CHARS( 1L<<54), 0xffffffffffffffff ^ LONG2CHARS( 1L<<55), 0xffffffffffffffff ^ LONG2CHARS( 1L<<56), 0xffffffffffffffff ^ LONG2CHARS( 1L<<57), 0xffffffffffffffff ^ LONG2CHARS( 1L<<58), 0xffffffffffffffff ^ LONG2CHARS( 1L<<59), 0xffffffffffffffff ^ LONG2CHARS( 1L<<60), 0xffffffffffffffff ^ LONG2CHARS( 1L<<61), 0xffffffffffffffff ^ LONG2CHARS( 1L<<62), 0xffffffffffffffff ^ LONG2CHARS( _1_<<63), #endif /* PPW */ }; #endif /* BITMAP_BIT_ORDER */ #undef _1_ /* * Merge raster ops for full src + dest + plane mask * * More clever usage of boolean arithmetic to reduce the * cost of complex raster ops. This is for bitblt and * reduces all 16 raster ops + planemask to a single * expression: * * dst = dst & (src & ca1 ^ cx1) ^ (src & ca2 ^ cx2) * * The array below contains the values for c?? for each * raster op. Those values are further modified by * planemasks on multi-plane displays as follows: * * ca1 &= pm; * cx1 |= ~pm; * ca2 &= pm; * cx2 &= pm; */ #include "mergerop.h" #define O 0 #define I ~((unsigned long)0) mergeRopRec mergeRopBits[16] = { O,O,O,O, /* clear 0x0 0 */ I,O,O,O, /* and 0x1 src AND dst */ I,O,I,O, /* andReverse 0x2 src AND NOT dst */ O,O,I,O, /* copy 0x3 src */ I,I,O,O, /* andInverted 0x4 NOT src AND dst */ O,I,O,O, /* noop 0x5 dst */ O,I,I,O, /* xor 0x6 src XOR dst */ I,I,I,O, /* or 0x7 src OR dst */ I,I,I,I, /* nor 0x8 NOT src AND NOT dst */ O,I,I,I, /* equiv 0x9 NOT src XOR dst */ O,I,O,I, /* invert 0xa NOT dst */ I,I,O,I, /* orReverse 0xb src OR NOT dst */ O,O,I,I, /* copyInverted 0xc NOT src */ I,O,I,I, /* orInverted 0xd NOT src OR dst */ I,O,O,I, /* nand 0xe NOT src OR NOT dst */ O,O,O,I, /* set 0xf 1 */ }; #undef O #undef I vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbfillsp.c0100664000076400007640000007555407120677563021621 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbfillsp.c,v 5.13 94/04/17 20:28:21 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "gcstruct.h" #include "window.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "mfb.h" #include "maskbits.h" #include "mergerop.h" #include "servermd.h" #include "mi.h" #include "mispans.h" /* scanline filling for monochrome frame buffer written by drewry, oct 1986 these routines all clip. they assume that anything that has called them has already translated the points (i.e. pGC->miTranslate is non-zero, which is howit gets set in mfbCreateGC().) the number of new scnalines created by clipping == MaxRectsPerBand * nSpans. FillSolid is overloaded to be used for OpaqueStipple as well, if fgPixel == bgPixel. FillTiled is overloaded to be used for OpaqueStipple, if fgPixel != bgPixel. based on the fill style, it uses {RotatedPixmap, gc.alu} or {RotatedPixmap, PrivGC.ropOpStip} */ void mfbBlackSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl;/* pointer to current longword in bitmap */ register int nlmiddle; register PixelType startmask; register PixelType endmask; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); if (*pwidth) { if ( ((ppt->x & PIM) + *pwidth) < PPW) { /* all bits inside same longword */ maskpartialbits(ppt->x, *pwidth, startmask); *addrl &= ~startmask; } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ &= ~startmask; Duff (nlmiddle, *addrl++ = 0x0); if (endmask) *addrl &= ~endmask; } } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void mfbWhiteSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl;/* pointer to current longword in bitmap */ register int nlmiddle; register PixelType startmask; register PixelType endmask; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); if (*pwidth) { if ( ((ppt->x & PIM) + *pwidth) < PPW) { /* all bits inside same longword */ maskpartialbits(ppt->x, *pwidth, startmask); *addrl |= startmask; } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ |= startmask; Duff (nlmiddle, *addrl++ = ~0); if (endmask) *addrl |= endmask; } } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void mfbInvertSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl;/* pointer to current longword in bitmap */ register int nlmiddle; register PixelType startmask; register PixelType endmask; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); if (*pwidth) { if ( ((ppt->x & PIM) + *pwidth) < PPW) { /* all bits inside same longword */ maskpartialbits(ppt->x, *pwidth, startmask); *addrl ^= startmask; } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ ^= startmask; Duff (nlmiddle, *addrl++ ^= ~0); if (endmask) *addrl ^= endmask; } } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void mfbWhiteStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl;/* pointer to current longword in bitmap */ register PixelType src; register int nlmiddle; register PixelType startmask; register PixelType endmask; PixmapPtr pStipple; PixelType *psrc; int tileHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap; tileHeight = pStipple->drawable.height; psrc = (PixelType *)(pStipple->devPrivate.ptr); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight]; /* all bits inside same longword */ if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl |= (src & startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ |= (src & startmask); Duff (nlmiddle, *addrl++ |= src); if (endmask) *addrl |= (src & endmask); } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void mfbBlackStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl; /* pointer to current longword in bitmap */ register PixelType src; register int nlmiddle; register PixelType startmask; register PixelType endmask; PixmapPtr pStipple; PixelType *psrc; int tileHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap; tileHeight = pStipple->drawable.height; psrc = (PixelType *)(pStipple->devPrivate.ptr); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight]; /* all bits inside same longword */ if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl &= ~(src & startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ &= ~(src & startmask); Duff (nlmiddle, *addrl++ &= ~src); if (endmask) *addrl &= ~(src & endmask); } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } void mfbInvertStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl; /* pointer to current longword in bitmap */ register PixelType src; register int nlmiddle; register PixelType startmask; register PixelType endmask; PixmapPtr pStipple; PixelType *psrc; int tileHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); pStipple = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap; tileHeight = pStipple->drawable.height; psrc = (PixelType *)(pStipple->devPrivate.ptr); while (n--) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight]; /* all bits inside same longword */ if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl ^= (src & startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) *addrl++ ^= (src & startmask); Duff(nlmiddle, *addrl++ ^= src); if (endmask) *addrl ^= (src & endmask); } pwidth++; ppt++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } /* this works with tiles of width == PPW */ #define FILLSPANPPW(ROP) \ while (n--) \ { \ if (*pwidth) \ { \ addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); \ src = psrc[ppt->y % tileHeight]; \ if ( ((ppt->x & PIM) + *pwidth) < PPW) \ { \ maskpartialbits(ppt->x, *pwidth, startmask); \ *addrl = (*addrl & ~startmask) | \ (ROP(src, *addrl) & startmask); \ } \ else \ { \ maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); \ if (startmask) \ { \ *addrl = (*addrl & ~startmask) | \ (ROP(src, *addrl) & startmask); \ addrl++; \ } \ while (nlmiddle--) \ { \ *addrl = ROP(src, *addrl); \ addrl++; \ } \ if (endmask) \ *addrl = (*addrl & ~endmask) | \ (ROP(src, *addrl) & endmask); \ } \ } \ pwidth++; \ ppt++; \ } void mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *addrl; /* pointer to current longword in bitmap */ register PixelType src; register int nlmiddle; register PixelType startmask; register PixelType endmask; PixmapPtr pTile; PixelType *psrc; int tileHeight; int rop; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; unsigned long flip; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); pTile = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pRotatedPixmap; tileHeight = pTile->drawable.height; psrc = (PixelType *)(pTile->devPrivate.ptr); if (pGC->fillStyle == FillTiled) rop = pGC->alu; else rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; flip = 0; switch(rop) { case GXcopyInverted: /* for opaque stipples */ flip = ~0; case GXcopy: { #define DoMaskCopyRop(src,dst,mask) ((dst) & ~(mask) | (src) & (mask)) while (n--) { if (*pwidth) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight] ^ flip; if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl = DoMaskCopyRop (src, *addrl, startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) { *addrl = DoMaskCopyRop (src, *addrl, startmask); addrl++; } while (nlmiddle--) { *addrl = src; addrl++; } if (endmask) *addrl = DoMaskCopyRop (src, *addrl, endmask); } } pwidth++; ppt++; } } break; default: { register DeclareMergeRop (); InitializeMergeRop(rop,~0); while (n--) { if (*pwidth) { addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); src = psrc[ppt->y % tileHeight]; if ( ((ppt->x & PIM) + *pwidth) < PPW) { maskpartialbits(ppt->x, *pwidth, startmask); *addrl = DoMaskMergeRop (src, *addrl, startmask); } else { maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); if (startmask) { *addrl = DoMaskMergeRop (src, *addrl, startmask); addrl++; } while (nlmiddle--) { *addrl = DoMergeRop (src, *addrl); addrl++; } if (endmask) *addrl = DoMaskMergeRop (src, *addrl, endmask); } } pwidth++; ppt++; } } break; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } /* Fill spans with tiles that aren't PPW bits wide */ void mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { int iline; /* first line of tile to use */ /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *pdst;/* pointer to current word in bitmap */ register PixelType *psrc;/* pointer to current word in tile */ register int nlMiddle; register int rop, nstart; PixelType startmask; PixmapPtr pTile; /* pointer to tile we want to fill with */ int w, width, x, xSrc, ySrc, srcStartOver, nend; int tlwidth, rem, tileWidth, tileHeight, endinc; PixelType endmask, *psrcT; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); if (pGC->fillStyle == FillTiled) { pTile = pGC->tile.pixmap; tlwidth = pTile->devKind / PGSZB; rop = pGC->alu; } else { pTile = pGC->stipple; tlwidth = pTile->devKind / PGSZB; rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; } xSrc = pDrawable->x; ySrc = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; /* this replaces rotating the tile. Instead we just adjust the offset * at which we start grabbing bits from the tile. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and rem always stay within the tile bounds. */ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; while (n--) { iline = (ppt->y - ySrc) % tileHeight; pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); x = ppt->x; if (*pwidth) { width = *pwidth; while(width > 0) { psrc = psrcT; w = min(tileWidth, width); if((rem = (x - xSrc) % tileWidth) != 0) { /* if we're in the middle of the tile, get as many bits as will finish the span, or as many as will get to the left edge of the tile, or a longword worth, starting at the appropriate offset in the tile. */ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); endinc = rem / BITMAP_SCANLINE_PAD; getandputrop((psrc+endinc), (rem&PIM), (x & PIM), w, pdst, rop); if((x & PIM) + w >= PPW) pdst++; } else if(((x & PIM) + w) < PPW) { /* doing < PPW bits is easy, and worth special-casing */ putbitsrop(*psrc, x & PIM, w, pdst, rop); } else { /* start at the left edge of the tile, and put down as much as we can */ maskbits(x, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - (x & PIM); else nstart = 0; if (endmask) nend = (x + w) & PIM; else nend = 0; srcStartOver = nstart > PLST; if(startmask) { putbitsrop(*psrc, (x & PIM), nstart, pdst, rop); pdst++; if(srcStartOver) psrc++; } while(nlMiddle--) { getandputrop0(psrc, nstart, PPW, pdst, rop); pdst++; psrc++; } if(endmask) { getandputrop0(psrc, nstart, nend, pdst, rop); } } x += w; width -= w; } } ppt++; pwidth++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } /* Fill spans with stipples that aren't PPW bits wide */ void mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GC *pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { /* next three parameters are post-clip */ int n; /* number of spans to fill */ register DDXPointPtr ppt; /* pointer to list of start points */ register int *pwidth; /* pointer to list of n widths */ int iline; /* first line of tile to use */ PixelType *addrlBase; /* pointer to start of bitmap */ int nlwidth; /* width in longwords of bitmap */ register PixelType *pdst; /* pointer to current word in bitmap */ register PixelType *psrc; /* pointer to current word in tile */ register int nlMiddle; register int rop, nstart; PixelType startmask; PixmapPtr pTile; /* pointer to tile we want to fill with */ int w, width, x, xSrc, ySrc, srcStartOver, nend; PixelType endmask, *psrcT; int tlwidth, rem, tileWidth, endinc; int tileHeight; int *pwidthFree; /* copies of the pointers to free */ DDXPointPtr pptFree; if (!(pGC->planemask & 1)) return; n = nInit * miFindMaxBand(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip); pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int)); pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec)); if(!pptFree || !pwidthFree) { if (pptFree) DEALLOCATE_LOCAL(pptFree); if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree); return; } pwidth = pwidthFree; ppt = pptFree; n = miClipSpans(((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted); pTile = pGC->stipple; rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; tlwidth = pTile->devKind / PGSZB; xSrc = pDrawable->x; ySrc = pDrawable->y; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; /* this replaces rotating the stipple. Instead, we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, * so that iline and rem always stay within the tile bounds. */ xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; while (n--) { iline = (ppt->y - ySrc) % tileHeight; pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); x = ppt->x; if (*pwidth) { width = *pwidth; while(width > 0) { psrc = psrcT; w = min(tileWidth, width); if((rem = (x - xSrc) % tileWidth) != 0) { /* if we're in the middle of the tile, get as many bits as will finish the span, or as many as will get to the left edge of the tile, or a longword worth, starting at the appropriate offset in the tile. */ w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); endinc = rem / BITMAP_SCANLINE_PAD; getandputrrop((psrc + endinc), (rem & PIM), (x & PIM), w, pdst, rop) if((x & PIM) + w >= PPW) pdst++; } else if(((x & PIM) + w) < PPW) { /* doing < PPW bits is easy, and worth special-casing */ putbitsrrop(*psrc, x & PIM, w, pdst, rop); } else { /* start at the left edge of the tile, and put down as much as we can */ maskbits(x, w, startmask, endmask, nlMiddle); if (startmask) nstart = PPW - (x & PIM); else nstart = 0; if (endmask) nend = (x + w) & PIM; else nend = 0; srcStartOver = nstart > PLST; if(startmask) { putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop); pdst++; if(srcStartOver) psrc++; } while(nlMiddle--) { getandputrrop0(psrc, nstart, PPW, pdst, rop); pdst++; psrc++; } if(endmask) { getandputrrop0(psrc, nstart, nend, pdst, rop); } } x += w; width -= w; } } ppt++; pwidth++; } DEALLOCATE_LOCAL(pptFree); DEALLOCATE_LOCAL(pwidthFree); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbgc.c0100664000076400007640000006003007120677563020700 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbgc.c,v 5.35 94/04/17 20:28:23 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "dixfontstr.h" #include "fontstruct.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "region.h" #include "mistruct.h" #include "migc.h" #include "maskbits.h" static GCFuncs mfbFuncs = { mfbValidateGC, miChangeGC, miCopyGC, miDestroyGC, miChangeClip, miDestroyClip, miCopyClip }; static GCOps whiteTECopyOps = { mfbWhiteSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyWhite, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbTEGlyphBltWhite, mfbPolyGlyphBltWhite, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps blackTECopyOps = { mfbBlackSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyBlack, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbTEGlyphBltBlack, mfbPolyGlyphBltBlack, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps whiteTEInvertOps = { mfbInvertSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, miZeroPolyArc, mfbFillPolyInvert, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbTEGlyphBltWhite, mfbPolyGlyphBltInvert, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps blackTEInvertOps = { mfbInvertSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, miZeroPolyArc, mfbFillPolyInvert, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbTEGlyphBltBlack, mfbPolyGlyphBltInvert, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps whiteCopyOps = { mfbWhiteSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyWhite, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbImageGlyphBltWhite, mfbPolyGlyphBltWhite, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps blackCopyOps = { mfbBlackSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyBlack, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbImageGlyphBltBlack, mfbPolyGlyphBltBlack, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps whiteInvertOps = { mfbInvertSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, miZeroPolyArc, mfbFillPolyInvert, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbImageGlyphBltWhite, mfbPolyGlyphBltInvert, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps blackInvertOps = { mfbInvertSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, miZeroPolyArc, mfbFillPolyInvert, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, mfbImageGlyphBltBlack, mfbPolyGlyphBltInvert, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps whiteWhiteCopyOps = { mfbWhiteSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyWhite, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, miImageGlyphBlt, mfbPolyGlyphBltWhite, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps blackBlackCopyOps = { mfbBlackSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, mfbZeroPolyArcSS, mfbFillPolyBlack, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, miImageGlyphBlt, mfbPolyGlyphBltBlack, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; static GCOps fgEqBgInvertOps = { mfbInvertSolidFS, mfbSetSpans, mfbPutImage, mfbCopyArea, mfbCopyPlane, mfbPolyPoint, mfbLineSS, mfbSegmentSS, miPolyRectangle, miZeroPolyArc, mfbFillPolyInvert, mfbPolyFillRect, mfbPolyFillArcSolid, miPolyText8, miPolyText16, miImageText8, miImageText16, miImageGlyphBlt, mfbPolyGlyphBltInvert, mfbSolidPP #ifdef NEED_LINEHELPER ,NULL #endif }; struct commonOps { int fg, bg; int rrop; int terminalFont; GCOps *ops; void (*fillArea)(); }; static struct commonOps mfbCommonOps[] = { { 1, 0, RROP_WHITE, 1, &whiteTECopyOps, mfbSolidWhiteArea }, { 0, 1, RROP_BLACK, 1, &blackTECopyOps, mfbSolidBlackArea }, { 1, 0, RROP_INVERT, 1, &whiteTEInvertOps, mfbSolidInvertArea }, { 0, 1, RROP_INVERT, 1, &blackTEInvertOps, mfbSolidInvertArea }, { 1, 0, RROP_WHITE, 0, &whiteCopyOps, mfbSolidWhiteArea }, { 0, 1, RROP_BLACK, 0, &blackCopyOps, mfbSolidBlackArea }, { 1, 0, RROP_INVERT, 0, &whiteInvertOps, mfbSolidInvertArea }, { 0, 1, RROP_INVERT, 0, &blackInvertOps, mfbSolidInvertArea }, { 1, 1, RROP_WHITE, 0, &whiteWhiteCopyOps, mfbSolidWhiteArea }, { 0, 0, RROP_BLACK, 0, &blackBlackCopyOps, mfbSolidBlackArea }, { 1, 1, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea }, { 0, 0, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea }, }; #define numberCommonOps (sizeof (mfbCommonOps) / sizeof (mfbCommonOps[0])) static GCOps * matchCommon (pGC) GCPtr pGC; { int i; struct commonOps *cop; mfbPrivGC *priv; if (pGC->lineWidth != 0) return 0; if (pGC->lineStyle != LineSolid) return 0; if (pGC->fillStyle != FillSolid) return 0; if (!pGC->font || FONTMAXBOUNDS(pGC->font,rightSideBearing) - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0) return 0; priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; for (i = 0; i < numberCommonOps; i++) { cop = &mfbCommonOps[i]; if ((pGC->fgPixel & 1) != cop->fg) continue; if ((pGC->bgPixel & 1) != cop->bg) continue; if (priv->rop != cop->rrop) continue; if (cop->terminalFont && !TERMINALFONT(pGC->font)) continue; priv->FillArea = cop->fillArea; return cop->ops; } return 0; } Bool mfbCreateGC(pGC) register GCPtr pGC; { mfbPrivGC *pPriv; pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; /* some of the output primitives aren't really necessary, since they will be filled in ValidateGC because of dix/CreateGC() setting all the change bits. Others are necessary because although they depend on being a monochrome frame buffer, they don't change */ pGC->ops = &whiteCopyOps; pGC->funcs = &mfbFuncs; /* mfb wants to translate before scan convesion */ pGC->miTranslate = 1; pPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr); pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel); pPriv->fExpose = TRUE; pPriv->pRotatedPixmap = NullPixmap; pPriv->freeCompClip = FALSE; pPriv->FillArea = mfbSolidInvertArea; return TRUE; } /* Clipping conventions if the drawable is a window CT_REGION ==> pCompositeClip really is the composite CT_other ==> pCompositeClip is the window clip region if the drawable is a pixmap CT_REGION ==> pCompositeClip is the translated client region clipped to the pixmap boundary CT_other ==> pCompositeClip is the pixmap bounding box */ /*ARGSUSED*/ void mfbValidateGC(pGC, changes, pDrawable) register GCPtr pGC; unsigned long changes; DrawablePtr pDrawable; { register mfbPrivGCPtr devPriv; int mask; /* stateChanges */ int index; /* used for stepping through bitfields */ int xrot, yrot; /* rotations for tile and stipple pattern */ int rrop; /* reduced rasterop */ /* flags for changing the proc vector and updating things in devPriv */ int new_rotate, new_rrop, new_line, new_text, new_fill; DDXPointRec oldOrg; /* origin of thing GC was last used with */ oldOrg = pGC->lastWinOrg; pGC->lastWinOrg.x = pDrawable->x; pGC->lastWinOrg.y = pDrawable->y; /* we need to re-rotate the tile if the previous window/pixmap origin (oldOrg) differs from the new window/pixmap origin (pGC->lastWinOrg) */ new_rotate = (oldOrg.x != pGC->lastWinOrg.x) || (oldOrg.y != pGC->lastWinOrg.y); devPriv = ((mfbPrivGCPtr) (pGC->devPrivates[mfbGCPrivateIndex].ptr)); /* if the client clip is different or moved OR the subwindowMode has changed OR the window's clip has changed since the last validation we need to recompute the composite clip */ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) ) { miComputeCompositeClip(pGC, pDrawable); } new_rrop = FALSE; new_line = FALSE; new_text = FALSE; new_fill = FALSE; mask = changes; while (mask) { index = lowbit (mask); mask &= ~index; /* this switch acculmulates a list of which procedures might have to change due to changes in the GC. in some cases (e.g. changing one 16 bit tile for another) we might not really need a change, but the code is being paranoid. this sort of batching wins if, for example, the alu and the font have been changed, or any other pair of items that both change the same thing. */ switch (index) { case GCFunction: case GCForeground: new_rrop = TRUE; break; case GCPlaneMask: break; case GCBackground: new_rrop = TRUE; /* for opaque stipples */ break; case GCLineStyle: case GCLineWidth: case GCJoinStyle: new_line = TRUE; break; case GCCapStyle: break; case GCFillStyle: new_fill = TRUE; break; case GCFillRule: break; case GCTile: if(pGC->tileIsPixel) break; new_rotate = TRUE; new_fill = TRUE; break; case GCStipple: if(pGC->stipple == (PixmapPtr)NULL) break; new_rotate = TRUE; new_fill = TRUE; break; case GCTileStipXOrigin: new_rotate = TRUE; break; case GCTileStipYOrigin: new_rotate = TRUE; break; case GCFont: new_text = TRUE; break; case GCSubwindowMode: break; case GCGraphicsExposures: break; case GCClipXOrigin: break; case GCClipYOrigin: break; case GCClipMask: break; case GCDashOffset: break; case GCDashList: break; case GCArcMode: break; default: break; } } /* deal with the changes we've collected . new_rrop must be done first because subsequent things depend on it. */ if(new_rotate || new_fill) { Bool new_pix = FALSE; /* figure out how much to rotate */ xrot = pGC->patOrg.x; yrot = pGC->patOrg.y; xrot += pDrawable->x; yrot += pDrawable->y; switch (pGC->fillStyle) { case FillTiled: /* copy current tile and stipple */ if (!pGC->tileIsPixel && (pGC->tile.pixmap->drawable.width <= PPW) && !(pGC->tile.pixmap->drawable.width & (pGC->tile.pixmap->drawable.width - 1))) { mfbCopyRotatePixmap(pGC->tile.pixmap, &devPriv->pRotatedPixmap, xrot, yrot); new_pix = TRUE; } break; case FillStippled: case FillOpaqueStippled: if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) && !(pGC->stipple->drawable.width & (pGC->stipple->drawable.width - 1))) { mfbCopyRotatePixmap(pGC->stipple, &devPriv->pRotatedPixmap, xrot, yrot); new_pix = TRUE; } } /* destroy any previously rotated tile or stipple */ if (!new_pix && devPriv->pRotatedPixmap) { (*pDrawable->pScreen->DestroyPixmap)(devPriv->pRotatedPixmap); devPriv->pRotatedPixmap = (PixmapPtr)NULL; } } /* * duck out here when the GC is unchanged */ if (!changes) return; if (new_rrop || new_fill) { rrop = mfbReduceRop(pGC->alu, pGC->fgPixel); devPriv->rop = rrop; new_fill = TRUE; /* FillArea raster op is GC's for tile filling, and the reduced rop for solid and stipple */ if (pGC->fillStyle == FillTiled) devPriv->ropFillArea = pGC->alu; else devPriv->ropFillArea = rrop; /* opaque stipples: fg bg ropOpStip fill style 1 0 alu tile 0 1 inverseAlu tile 1 1 rrop(fg, alu) solid 0 0 rrop(fg, alu) solid Note that rrop(fg, alu) == mfbPrivGC.rop, so we don't really need to compute it. */ if (pGC->fillStyle == FillOpaqueStippled) { if ((pGC->fgPixel & 1) != (pGC->bgPixel & 1)) { if (pGC->fgPixel & 1) devPriv->ropOpStip = pGC->alu; else devPriv->ropOpStip = InverseAlu[pGC->alu]; } else devPriv->ropOpStip = rrop; devPriv->ropFillArea = devPriv->ropOpStip; } } else rrop = devPriv->rop; if (new_line || new_fill || new_text) { GCOps *newops; if (newops = matchCommon (pGC)) { if (pGC->ops->devPrivate.val) miDestroyGCOps (pGC->ops); pGC->ops = newops; new_line = new_fill = new_text = 0; } else { if (!pGC->ops->devPrivate.val) { pGC->ops = miCreateGCOps (pGC->ops); pGC->ops->devPrivate.val = 1; } } } if (new_line || new_fill) { if (pGC->lineWidth == 0) { if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid) && ((rrop == RROP_WHITE) || (rrop == RROP_BLACK))) pGC->ops->PolyArc = mfbZeroPolyArcSS; else pGC->ops->PolyArc = miZeroPolyArc; } else pGC->ops->PolyArc = miPolyArc; if (pGC->lineStyle == LineSolid) { if(pGC->lineWidth == 0) { if (pGC->fillStyle == FillSolid) { pGC->ops->PolySegment = mfbSegmentSS; pGC->ops->Polylines = mfbLineSS; } else { pGC->ops->PolySegment = miPolySegment; pGC->ops->Polylines = miZeroLine; } } else { pGC->ops->PolySegment = miPolySegment; pGC->ops->Polylines = miWideLine; } } else { if(pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) { pGC->ops->Polylines = mfbLineSD; pGC->ops->PolySegment = mfbSegmentSD; } else { pGC->ops->Polylines = miWideDash; pGC->ops->PolySegment = miPolySegment; } } } if (new_text || new_fill) { if ((pGC->font) && (FONTMAXBOUNDS(pGC->font,rightSideBearing) - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0)) { pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; pGC->ops->ImageGlyphBlt = miImageGlyphBlt; } else { /* special case ImageGlyphBlt for terminal emulator fonts */ if ((pGC->font) && TERMINALFONT(pGC->font) && ((pGC->fgPixel & 1) != (pGC->bgPixel & 1))) { /* pcc bug makes this not compile... pGC->ops->ImageGlyphBlt = (pGC->fgPixel & 1) ? mfbTEGlyphBltWhite : mfbTEGlyphBltBlack; */ if (pGC->fgPixel & 1) pGC->ops->ImageGlyphBlt = mfbTEGlyphBltWhite; else pGC->ops->ImageGlyphBlt = mfbTEGlyphBltBlack; } else { if (pGC->fgPixel & 1) pGC->ops->ImageGlyphBlt = mfbImageGlyphBltWhite; else pGC->ops->ImageGlyphBlt = mfbImageGlyphBltBlack; } /* now do PolyGlyphBlt */ if (pGC->fillStyle == FillSolid || (pGC->fillStyle == FillOpaqueStippled && (pGC->fgPixel & 1) == (pGC->bgPixel & 1) ) ) { if (rrop == RROP_WHITE) pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltWhite; else if (rrop == RROP_BLACK) pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltBlack; else if (rrop == RROP_INVERT) pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltInvert; else pGC->ops->PolyGlyphBlt = (void (*)())NoopDDA; } else { pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; } } } if (new_fill) { /* install a suitable fillspans and pushpixels */ pGC->ops->PushPixels = mfbPushPixels; pGC->ops->FillPolygon = miFillPolygon; if ((pGC->fillStyle == FillSolid) || ((pGC->fillStyle == FillOpaqueStippled) && ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)))) { pGC->ops->PushPixels = mfbSolidPP; switch(devPriv->rop) { case RROP_WHITE: pGC->ops->FillSpans = mfbWhiteSolidFS; pGC->ops->FillPolygon = mfbFillPolyWhite; break; case RROP_BLACK: pGC->ops->FillSpans = mfbBlackSolidFS; pGC->ops->FillPolygon = mfbFillPolyBlack; break; case RROP_INVERT: pGC->ops->FillSpans = mfbInvertSolidFS; pGC->ops->FillPolygon = mfbFillPolyInvert; break; case RROP_NOP: pGC->ops->FillSpans = (void (*)())NoopDDA; pGC->ops->FillPolygon = (void (*)())NoopDDA; break; } } /* beyond this point, opaqueStippled ==> fg != bg */ else if (((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillOpaqueStippled)) && !devPriv->pRotatedPixmap) { pGC->ops->FillSpans = mfbUnnaturalTileFS; } else if ((pGC->fillStyle == FillStippled) && !devPriv->pRotatedPixmap) { pGC->ops->FillSpans = mfbUnnaturalStippleFS; } else if (pGC->fillStyle == FillStippled) { switch(devPriv->rop) { case RROP_WHITE: pGC->ops->FillSpans = mfbWhiteStippleFS; break; case RROP_BLACK: pGC->ops->FillSpans = mfbBlackStippleFS; break; case RROP_INVERT: pGC->ops->FillSpans = mfbInvertStippleFS; break; case RROP_NOP: pGC->ops->FillSpans = (void (*)())NoopDDA; break; } } else /* overload tiles to do parti-colored opaque stipples */ { pGC->ops->FillSpans = mfbTileFS; } if (pGC->fillStyle == FillSolid) pGC->ops->PolyFillArc = mfbPolyFillArcSolid; else pGC->ops->PolyFillArc = miPolyFillArc; /* the rectangle code doesn't deal with opaque stipples that are two colors -- we can fool it for fg==bg, though */ if ((((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillStippled)) && !devPriv->pRotatedPixmap) || ((pGC->fillStyle == FillOpaqueStippled) && ((pGC->fgPixel & 1) != (pGC->bgPixel & 1))) ) { pGC->ops->PolyFillRect = miPolyFillRect; } else /* deal with solids and natural stipples and tiles */ { pGC->ops->PolyFillRect = mfbPolyFillRect; if ((pGC->fillStyle == FillSolid) || ((pGC->fillStyle == FillOpaqueStippled) && ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)))) { switch(devPriv->rop) { case RROP_WHITE: devPriv->FillArea = mfbSolidWhiteArea; break; case RROP_BLACK: devPriv->FillArea = mfbSolidBlackArea; break; case RROP_INVERT: devPriv->FillArea = mfbSolidInvertArea; break; case RROP_NOP: devPriv->FillArea = (void (*)())NoopDDA; break; } } else if (pGC->fillStyle == FillStippled) { switch(devPriv->rop) { case RROP_WHITE: devPriv->FillArea = mfbStippleWhiteArea; break; case RROP_BLACK: devPriv->FillArea = mfbStippleBlackArea; break; case RROP_INVERT: devPriv->FillArea = mfbStippleInvertArea; break; case RROP_NOP: devPriv->FillArea = (void (*)())NoopDDA; break; } } else /* deal with tiles */ { switch (pGC->alu) { case GXcopy: devPriv->FillArea = mfbTileAreaPPWCopy; break; default: devPriv->FillArea = mfbTileAreaPPWGeneral; break; } } } /* end of natural rectangles */ } /* end of new_fill */ } /* table to map alu(src, dst) to alu(~src, dst) */ int InverseAlu[16] = { GXclear, GXandInverted, GXnor, GXcopyInverted, GXand, GXnoop, GXequiv, GXorInverted, GXandReverse, GXxor, GXinvert, GXnand, GXcopy, GXor, GXorReverse, GXset }; int mfbReduceRop(alu, src) register int alu; register Pixel src; { int rop; if ((src & 1) == 0) /* src is black */ { switch(alu) { case GXclear: rop = RROP_BLACK; break; case GXand: rop = RROP_BLACK; break; case GXandReverse: rop = RROP_BLACK; break; case GXcopy: rop = RROP_BLACK; break; case GXandInverted: rop = RROP_NOP; break; case GXnoop: rop = RROP_NOP; break; case GXxor: rop = RROP_NOP; break; case GXor: rop = RROP_NOP; break; case GXnor: rop = RROP_INVERT; break; case GXequiv: rop = RROP_INVERT; break; case GXinvert: rop = RROP_INVERT; break; case GXorReverse: rop = RROP_INVERT; break; case GXcopyInverted: rop = RROP_WHITE; break; case GXorInverted: rop = RROP_WHITE; break; case GXnand: rop = RROP_WHITE; break; case GXset: rop = RROP_WHITE; break; } } else /* src is white */ { switch(alu) { case GXclear: rop = RROP_BLACK; break; case GXand: rop = RROP_NOP; break; case GXandReverse: rop = RROP_INVERT; break; case GXcopy: rop = RROP_WHITE; break; case GXandInverted: rop = RROP_BLACK; break; case GXnoop: rop = RROP_NOP; break; case GXxor: rop = RROP_INVERT; break; case GXor: rop = RROP_WHITE; break; case GXnor: rop = RROP_BLACK; break; case GXequiv: rop = RROP_NOP; break; case GXinvert: rop = RROP_INVERT; break; case GXorReverse: rop = RROP_WHITE; break; case GXcopyInverted: rop = RROP_BLACK; break; case GXorInverted: rop = RROP_NOP; break; case GXnand: rop = RROP_INVERT; break; case GXset: rop = RROP_WHITE; break; } } return rop; } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbmisc.c0100664000076400007640000000655507120677563021256 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbmisc.c,v 5.4 94/04/17 20:28:27 dpw Exp $ */ #include "X.h" #include "misc.h" #include "cursor.h" #include "scrnintstr.h" #include "mfb.h" /*ARGSUSED*/ void mfbQueryBestSize(class, pwidth, pheight, pScreen) int class; unsigned short *pwidth; unsigned short *pheight; ScreenPtr pScreen; { unsigned width, test; switch(class) { case CursorShape: if (*pwidth > pScreen->width) *pwidth = pScreen->width; if (*pheight > pScreen->height) *pheight = pScreen->height; break; case TileShape: case StippleShape: width = *pwidth; if (!width) break; /* Return the closes power of two not less than what they gave me */ test = 0x80000000; /* Find the highest 1 bit in the width given */ while(!(test & width)) test >>= 1; /* If their number is greater than that, bump up to the next * power of two */ if((test - 1) & width) test <<= 1; *pwidth = test; /* We don't care what height they use */ break; } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/maskbits.h0100664000076400007640000005276007120677563021457 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: maskbits.h,v 1.33 94/04/17 20:28:13 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.3 1996/12/09 11:56:33 dawes Exp $ */ #include "X.h" #include "Xmd.h" #include "servermd.h" /* the following notes use the following conventions: SCREEN LEFT SCREEN RIGHT in this file and maskbits.c, left and right refer to screen coordinates, NOT bit numbering in registers. starttab[n] bits[0,n-1] = 0 bits[n,PLST] = 1 endtab[n] = bits[0,n-1] = 1 bits[n,PLST] = 0 startpartial[], endpartial[] these are used as accelerators for doing putbits and masking out bits that are all contained between longword boudaries. the extra 256 bytes of data seems a small price to pay -- code is smaller, and narrow things (e.g. window borders) go faster. the names may seem misleading; they are derived not from which end of the word the bits are turned on, but at which end of a scanline the table tends to be used. look at the tables and macros to understand boundary conditions. (careful readers will note that starttab[n] = ~endtab[n] for n != 0) ----------------------------------------------------------------------- these two macros depend on the screen's bit ordering. in both of them x is a screen position. they are used to combine bits collected from multiple longwords into a single destination longword, and to unpack a single source longword into multiple destinations. SCRLEFT(dst, x) takes dst[x, PPW] and moves them to dst[0, PPW-x] the contents of the rest of dst are 0. this is a right shift on LSBFirst (forward-thinking) machines like the VAX, and left shift on MSBFirst (backwards) machines like the 680x0 and pc/rt. SCRRIGHT(dst, x) takes dst[0,x] and moves them to dst[PPW-x, PPW] the contents of the rest of dst are 0. this is a left shift on LSBFirst, right shift on MSBFirst. the remaining macros are cpu-independent; all bit order dependencies are built into the tables and the two macros above. maskbits(x, w, startmask, endmask, nlw) for a span of width w starting at position x, returns a mask for ragged bits at start, mask for ragged bits at end, and the number of whole longwords between the ends. maskpartialbits(x, w, mask) works like maskbits(), except all the bits are in the same longword (i.e. (x&PIM + w) <= PPW) maskPPWbits(x, w, startmask, endmask, nlw) as maskbits, but does not calculate nlw. it is used by mfbGlyphBlt to put down glyphs <= PPW bits wide. ------------------------------------------------------------------- NOTE any pointers passed to the following 4 macros are guranteed to be PPW-bit aligned. The only non-PPW-bit-aligned references ever made are to font glyphs, and those are made with getleftbits() and getshiftedleftbits (qq.v.) For 64-bit server, it is assumed that we will never have font padding of more than 4 bytes. The code uses int's to access the fonts intead of longs. getbits(psrc, x, w, dst) starting at position x in psrc (x < PPW), collect w bits and put them in the screen left portion of dst. psrc is a longword pointer. this may span longword boundaries. it special-cases fetching all w bits from one longword. +--------+--------+ +--------+ | | m |n| | ==> | m |n| | +--------+--------+ +--------+ x x+w 0 w psrc psrc+1 dst m = PPW - x n = w - m implementation: get m bits, move to screen-left of dst, zeroing rest of dst; get n bits from next word, move screen-right by m, zeroing lower m bits of word. OR the two things together. putbits(src, x, w, pdst) starting at position x in pdst, put down the screen-leftmost w bits of src. pdst is a longword pointer. this may span longword boundaries. it special-cases putting all w bits into the same longword. +--------+ +--------+--------+ | m |n| | ==> | | m |n| | +--------+ +--------+--------+ 0 w x x+w dst pdst pdst+1 m = PPW - x n = w - m implementation: get m bits, shift screen-right by x, zero screen-leftmost x bits; zero rightmost m bits of *pdst and OR in stuff from before the semicolon. shift src screen-left by m, zero bits n-PPW; zero leftmost n bits of *(pdst+1) and OR in the stuff from before the semicolon. putbitsrop(src, x, w, pdst, ROP) like putbits but calls DoRop with the rasterop ROP (see mfb.h for DoRop) putbitsrrop(src, x, w, pdst, ROP) like putbits but calls DoRRop with the reduced rasterop ROP (see mfb.h for DoRRop) ----------------------------------------------------------------------- The two macros below are used only for getting bits from glyphs in fonts, and glyphs in fonts are gotten only with the following two mcros. You should tune these macros toyour font format and cpu byte ordering. NOTE getleftbits(psrc, w, dst) get the leftmost w (w<=32) bits from *psrc and put them in dst. this is used by the mfbGlyphBlt code for glyphs <=PPW bits wide. psrc is declared (unsigned char *) psrc is NOT guaranteed to be PPW-bit aligned. on many machines this will cause problems, so there are several versions of this macro. this macro is called ONLY for getting bits from font glyphs, and depends on the server-natural font padding. for blazing text performance, you want this macro to touch memory as infrequently as possible (e.g. fetch longwords) and as efficiently as possible (e.g. don't fetch misaligned longwords) getshiftedleftbits(psrc, offset, w, dst) used by the font code; like getleftbits, but shifts the bits SCRLEFT by offset. this is implemented portably, calling getleftbits() and SCRLEFT(). psrc is declared (unsigned char *). */ /* to match CFB and allow algorithm sharing ... * name mfb32 mfb64 explanation * ---- ------ ----- ----------- * PGSZ 32 64 pixel group size (in bits; same as PPW for mfb) * PGSZB 4 8 pixel group size (in bytes) * PPW 32 64 pixels per word (pixels per pixel group) * PLST 31 63 index of last pixel in a word (should be PPW-1) * PIM 0x1f 0x3f pixel index mask (index within a pixel group) * PWSH 5 6 pixel-to-word shift (should be log2(PPW)) * * The MFB_ versions are here so that cfb can include maskbits.h to get * the bitmap constants without conflicting with its own P* constants. */ /* warning: PixelType definition duplicated in mfb.h */ #ifndef PixelType #define PixelType unsigned long #endif /* PixelType */ #ifdef LONG64 #define MFB_PGSZB 8 #else #define MFB_PGSZB 4 #endif /* LONG64 */ #define MFB_PPW (MFB_PGSZB<<3) /* assuming 8 bits per byte */ #define MFB_PGSZ MFB_PPW #define MFB_PLST (MFB_PPW-1) #define MFB_PIM MFB_PLST /* set PWSH = log2(PPW) using brute force */ #if MFB_PPW == 32 #define MFB_PWSH 5 #else #if MFB_PPW == 64 #define MFB_PWSH 6 #endif /* MFB_PPW == 64 */ #endif /* MFB_PPW == 32 */ extern PixelType starttab[]; extern PixelType endtab[]; extern PixelType partmasks[MFB_PPW][MFB_PPW]; extern PixelType rmask[]; extern PixelType mask[]; #ifndef MFB_CONSTS_ONLY #define PGSZB MFB_PGSZB #define PPW MFB_PPW #define PGSZ MFB_PGSZ #define PLST MFB_PLST #define PIM MFB_PIM #define PWSH MFB_PWSH #define BitLeft(b,s) SCRLEFT(b,s) #define BitRight(b,s) SCRRIGHT(b,s) #if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER) #define LONG2CHARS(x) ((unsigned long)(x)) #else /* * the unsigned case below is for compilers like * the Danbury C and i386cc */ #if PPW == 32 #define LONG2CHARS( x ) ( ( ( ( x ) & (unsigned long)0x000000FF ) << 0x18 ) \ | ( ( ( x ) & (unsigned long)0x0000FF00 ) << 0x08 ) \ | ( ( ( x ) & (unsigned long)0x00FF0000 ) >> 0x08 ) \ | ( ( ( x ) & (unsigned long)0xFF000000 ) >> 0x18 ) ) #else /* PPW == 64 */ #if defined( __alpha__) #define LONG2CHARS( x ) \ ( ( ( ( x ) & 0x000000FFUL) << 0x38 ) \ | ( ( ( x ) & 0x0000FF00UL) << 0x28 ) \ | ( ( ( x ) & 0x00FF0000UL) << 0x18 ) \ | ( ( ( x ) & 0xFF000000UL) << 0x08 ) \ | ( ( ( x ) & 0x000000FF00000000UL) >> 0x08 ) \ | ( ( ( x ) & 0x0000FF0000000000UL) >> 0x18 ) \ | ( ( ( x ) & 0x00FF000000000000UL) >> 0x28 ) \ | ( ( ( x ) & 0xFF00000000000000UL) >> 0x38 ) ) #else /* __alpha__ */ #define LONG2CHARS( x ) ( ( ( ( x ) & 0x000000FF000000FFUL) << 0x18 ) \ | ( ( ( x ) & 0x0000FF000000FF00UL) << 0x08 ) \ | ( ( ( x ) & 0x00FF000000FF0000UL) >> 0x08 ) \ | ( ( ( x ) & 0xFF000000FF000000UL) >> 0x18 ) ) #endif /* __alpha__ */ #endif /* PPW */ #endif /* BITMAP_BIT_ORDER */ #ifdef STRICT_ANSI_SHIFT #define SHL(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) << (y))) #define SHR(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) >> (y))) #else #define SHL(x,y) LONG2CHARS(LONG2CHARS(x) << (y)) #define SHR(x,y) LONG2CHARS(LONG2CHARS(x) >> (y)) #endif #if (BITMAP_BIT_ORDER == MSBFirst) /* pc/rt, 680x0 */ #define SCRLEFT(lw, n) SHL((PixelType)(lw),(n)) #define SCRRIGHT(lw, n) SHR((PixelType)(lw),(n)) #else /* vax, intel */ #define SCRLEFT(lw, n) SHR((PixelType)(lw),(n)) #define SCRRIGHT(lw, n) SHL((PixelType)(lw),(n)) #endif #define DoRRop(alu, src, dst) \ (((alu) == RROP_BLACK) ? ((dst) & ~(src)) : \ ((alu) == RROP_WHITE) ? ((dst) | (src)) : \ ((alu) == RROP_INVERT) ? ((dst) ^ (src)) : \ (dst)) #if PPW == 32 /* A generalized form of a x4 Duff's Device */ #define Duff(counter, block) { \ while (counter >= 4) {\ { block; } \ { block; } \ { block; } \ { block; } \ counter -= 4; \ } \ switch (counter & 3) { \ case 3: { block; } \ case 2: { block; } \ case 1: { block; } \ case 0: \ counter = 0; \ } \ } #else /* PPW == 64 */ /* A generalized form of a x8 Duff's Device */ #define Duff(counter, block) { \ while (counter >= 8) {\ { block; } \ { block; } \ { block; } \ { block; } \ { block; } \ { block; } \ { block; } \ { block; } \ counter -= 8; \ } \ switch (counter & 7) { \ case 7: { block; } \ case 6: { block; } \ case 5: { block; } \ case 4: { block; } \ case 3: { block; } \ case 2: { block; } \ case 1: { block; } \ case 0: \ counter = 0; \ } \ } #endif /* PPW */ #define maskbits(x, w, startmask, endmask, nlw) \ startmask = starttab[(x) & PIM]; \ endmask = endtab[((x)+(w)) & PIM]; \ if (startmask) \ nlw = (((w) - (PPW - ((x) & PIM))) >> PWSH); \ else \ nlw = (w) >> PWSH; #define maskpartialbits(x, w, mask) \ mask = partmasks[(x) & PIM][(w) & PIM]; #define maskPPWbits(x, w, startmask, endmask) \ startmask = starttab[(x) & PIM]; \ endmask = endtab[((x)+(w)) & PIM]; #ifdef __GNUC__ /* XXX don't want for Alpha? */ #ifdef vax #define FASTGETBITS(psrc,x,w,dst) \ __asm ("extzv %1,%2,%3,%0" \ : "=g" (dst) \ : "g" (x), "g" (w), "m" (*(char *)(psrc))) #define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst) #define FASTPUTBITS(src, x, w, pdst) \ __asm ("insv %3,%1,%2,%0" \ : "=m" (*(char *)(pdst)) \ : "g" (x), "g" (w), "g" (src)) #define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst) #endif /* vax */ #ifdef mc68020 #define FASTGETBITS(psrc, x, w, dst) \ __asm ("bfextu %3{%1:%2},%0" \ : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) #define getbits(psrc,x,w,dst) \ { \ FASTGETBITS(psrc, x, w, dst);\ dst = SHL(dst,(32-(w))); \ } #define FASTPUTBITS(src, x, w, pdst) \ __asm ("bfins %3,%0{%1:%2}" \ : "=o" (*(char *)(pdst)) \ : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst))) #define putbits(src, x, w, pdst) FASTPUTBITS(SHR((src),32-(w)), x, w, pdst) #endif /* mc68020 */ #endif /* __GNUC__ */ /* The following flag is used to override a bugfix for sun 3/60+CG4 machines, */ /* We don't need to be careful about this unless we're dealing with sun3's * We will default its usage for those who do not know anything, but will * override its effect if the machine doesn't look like a sun3 */ #if !defined(mc68020) || !defined(sun) #define NO_3_60_CG4 #endif /* This is gross. We want to #define u_putbits as something which can be used * in the case of the 3/60+CG4, but if we use /bin/cc or are on another * machine type, we want nothing to do with u_putbits. What a hastle. Here * I used slo_putbits as something which either u_putbits or putbits could be * defined as. * * putbits gets it iff it is not already defined with FASTPUTBITS above. * u_putbits gets it if we have FASTPUTBITS (putbits) from above and have not * overridden the NO_3_60_CG4 flag. */ #define slo_putbits(src, x, w, pdst) \ { \ register int n = (x)+(w)-PPW; \ \ if (n <= 0) \ { \ register PixelType tmpmask; \ maskpartialbits((x), (w), tmpmask); \ *(pdst) = (*(pdst) & ~tmpmask) | \ (SCRRIGHT(src, x) & tmpmask); \ } \ else \ { \ *(pdst) = (*(pdst) & endtab[x]) | (SCRRIGHT((src), x)); \ (pdst)[1] = ((pdst)[1] & starttab[n]) | \ (SCRLEFT(src, PPW-(x)) & endtab[n]); \ } \ } #if defined(putbits) && !defined(NO_3_60_CG4) #define u_putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst) #else #define u_putbits(src, x, w, pdst) putbits(src, x, w, pdst) #endif #if !defined(putbits) #define putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst) #endif /* Now if we have not gotten any really good bitfield macros, try some * moderately fast macros. Alas, I don't know how to do asm instructions * without gcc. */ #ifndef getbits #define getbits(psrc, x, w, dst) \ { \ dst = SCRLEFT(*(psrc), (x)); \ if ( ((x) + (w)) > PPW) \ dst |= (SCRRIGHT(*((psrc)+1), PPW-(x))); \ } #endif /* We have to special-case putbitsrop because of 3/60+CG4 combos */ #define u_putbitsrop(src, x, w, pdst, rop) \ {\ register PixelType t1, t2; \ register int n = (x)+(w)-PPW; \ \ t1 = SCRRIGHT((src), (x)); \ DoRop(t2, rop, t1, *(pdst)); \ \ if (n <= 0) \ { \ register PixelType tmpmask; \ \ maskpartialbits((x), (w), tmpmask); \ *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ } \ else \ { \ int m = PPW-(x); \ *(pdst) = (*(pdst) & endtab[x]) | (t2 & starttab[x]); \ t1 = SCRLEFT((src), m); \ DoRop(t2, rop, t1, (pdst)[1]); \ (pdst)[1] = ((pdst)[1] & starttab[n]) | (t2 & endtab[n]); \ } \ } /* If our getbits and putbits are FAST enough, * do this brute force, it's faster */ #if defined(FASTPUTBITS) && defined(FASTGETBITS) && defined(NO_3_60_CG4) #if (BITMAP_BIT_ORDER == MSBFirst) #define putbitsrop(src, x, w, pdst, rop) \ { \ register PixelType _tmp, _tmp2; \ FASTGETBITS(pdst, x, w, _tmp); \ _tmp2 = SCRRIGHT(src, PPW-(w)); \ DoRop(_tmp, rop, _tmp2, _tmp) \ FASTPUTBITS(_tmp, x, w, pdst); \ } #define putbitsrrop(src, x, w, pdst, rop) \ { \ register PixelType _tmp, _tmp2; \ \ FASTGETBITS(pdst, x, w, _tmp); \ _tmp2 = SCRRIGHT(src, PPW-(w)); \ _tmp= DoRRop(rop, _tmp2, _tmp); \ FASTPUTBITS(_tmp, x, w, pdst); \ } #undef u_putbitsrop #else #define putbitsrop(src, x, w, pdst, rop) \ { \ register PixelType _tmp; \ FASTGETBITS(pdst, x, w, _tmp); \ DoRop(_tmp, rop, src, _tmp) \ FASTPUTBITS(_tmp, x, w, pdst); \ } #define putbitsrrop(src, x, w, pdst, rop) \ { \ register PixelType _tmp; \ \ FASTGETBITS(pdst, x, w, _tmp); \ _tmp= DoRRop(rop, src, _tmp); \ FASTPUTBITS(_tmp, x, w, pdst); \ } #undef u_putbitsrop #endif #endif #ifndef putbitsrop #define putbitsrop(src, x, w, pdst, rop) u_putbitsrop(src, x, w, pdst, rop) #endif #ifndef putbitsrrop #define putbitsrrop(src, x, w, pdst, rop) \ {\ register PixelType t1, t2; \ register int n = (x)+(w)-PPW; \ \ t1 = SCRRIGHT((src), (x)); \ t2 = DoRRop(rop, t1, *(pdst)); \ \ if (n <= 0) \ { \ register PixelType tmpmask; \ \ maskpartialbits((x), (w), tmpmask); \ *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ } \ else \ { \ int m = PPW-(x); \ *(pdst) = (*(pdst) & endtab[x]) | (t2 & starttab[x]); \ t1 = SCRLEFT((src), m); \ t2 = DoRRop(rop, t1, (pdst)[1]); \ (pdst)[1] = ((pdst)[1] & starttab[n]) | (t2 & endtab[n]); \ } \ } #endif #if GETLEFTBITS_ALIGNMENT == 1 #define getleftbits(psrc, w, dst) dst = *((CARD32 *) psrc) #endif /* GETLEFTBITS_ALIGNMENT == 1 */ #if GETLEFTBITS_ALIGNMENT == 2 #define getleftbits(psrc, w, dst) \ { \ if ( ((int)(psrc)) & 0x01 ) \ getbits( ((CARD32 *)(((char *)(psrc))-1)), 8, (w), (dst) ); \ else \ getbits(psrc, 0, w, dst); \ } #endif /* GETLEFTBITS_ALIGNMENT == 2 */ #if GETLEFTBITS_ALIGNMENT == 4 #define getleftbits(psrc, w, dst) \ { \ int off, off_b; \ off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \ getbits( \ (CARD32 *)( ((char *)(psrc)) - off), \ (off_b), (w), (dst) \ ); \ } #endif /* GETLEFTBITS_ALIGNMENT == 4 */ #define getshiftedleftbits(psrc, offset, w, dst) \ getleftbits((psrc), (w), (dst)); \ dst = SCRLEFT((dst), (offset)); /* FASTGETBITS and FASTPUTBITS are not necessarily correct implementations of * getbits and putbits, but they work if used together. * * On a MSBFirst machine, a cpu bitfield extract instruction (like bfextu) * could normally assign its result to a long word register in the screen * right position. This saves canceling register shifts by not fighting the * natural cpu byte order. * * Unfortunately, these fail on a 3/60+CG4 and cannot be used unmodified. Sigh. */ #if defined(FASTGETBITS) && defined(FASTPUTBITS) #ifdef NO_3_60_CG4 #define u_FASTPUT(aa, bb, cc, dd) FASTPUTBITS(aa, bb, cc, dd) #else #define u_FASTPUT(aa, bb, cc, dd) u_putbits(SCRLEFT(aa, PPW-(cc)), bb, cc, dd) #endif #define getandputbits(psrc, srcbit, dstbit, width, pdst) \ { \ register PixelType _tmpbits; \ FASTGETBITS(psrc, srcbit, width, _tmpbits); \ u_FASTPUT(_tmpbits, dstbit, width, pdst); \ } #define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ { \ register PixelType _tmpsrc, _tmpdst; \ FASTGETBITS(pdst, dstbit, width, _tmpdst); \ FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \ u_FASTPUT(_tmpdst, dstbit, width, pdst); \ } #define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \ { \ register PixelType _tmpsrc, _tmpdst; \ FASTGETBITS(pdst, dstbit, width, _tmpdst); \ FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ _tmpdst = DoRRop(rop, _tmpsrc, _tmpdst); \ u_FASTPUT(_tmpdst, dstbit, width, pdst); \ } #define getandputbits0(psrc, srcbit, width, pdst) \ getandputbits(psrc, srcbit, 0, width, pdst) #define getandputrop0(psrc, srcbit, width, pdst, rop) \ getandputrop(psrc, srcbit, 0, width, pdst, rop) #define getandputrrop0(psrc, srcbit, width, pdst, rop) \ getandputrrop(psrc, srcbit, 0, width, pdst, rop) #else /* Slow poke */ /* pairs of getbits/putbits happen frequently. Some of the code can * be shared or avoided in a few specific instances. It gets us a * small advantage, so we do it. The getandput...0 macros are the only ones * which speed things here. The others are here for compatibility w/the above * FAST ones */ #define getandputbits(psrc, srcbit, dstbit, width, pdst) \ { \ register PixelType _tmpbits; \ getbits(psrc, srcbit, width, _tmpbits); \ putbits(_tmpbits, dstbit, width, pdst); \ } #define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ { \ register PixelType _tmpbits; \ getbits(psrc, srcbit, width, _tmpbits) \ putbitsrop(_tmpbits, dstbit, width, pdst, rop) \ } #define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \ { \ register PixelType _tmpbits; \ getbits(psrc, srcbit, width, _tmpbits) \ putbitsrrop(_tmpbits, dstbit, width, pdst, rop) \ } #define getandputbits0(psrc, sbindex, width, pdst) \ { /* unroll the whole damn thing to see how it * behaves */ \ register int _flag = PPW - (sbindex); \ register PixelType _src; \ \ _src = SCRLEFT (*(psrc), (sbindex)); \ if ((width) > _flag) \ _src |= SCRRIGHT (*((psrc) + 1), _flag); \ \ *(pdst) = (*(pdst) & starttab[(width)]) | (_src & endtab[(width)]); \ } #define getandputrop0(psrc, sbindex, width, pdst, rop) \ { \ register int _flag = PPW - (sbindex); \ register PixelType _src; \ \ _src = SCRLEFT (*(psrc), (sbindex)); \ if ((width) > _flag) \ _src |= SCRRIGHT (*((psrc) + 1), _flag); \ DoRop(_src, rop, _src, *(pdst)); \ \ *(pdst) = (*(pdst) & starttab[(width)]) | (_src & endtab[(width)]); \ } #define getandputrrop0(psrc, sbindex, width, pdst, rop) \ { \ int _flag = PPW - (sbindex); \ register PixelType _src; \ \ _src = SCRLEFT (*(psrc), (sbindex)); \ if ((width) > _flag) \ _src |= SCRRIGHT (*((psrc) + 1), _flag); \ _src = DoRRop(rop, _src, *(pdst)); \ \ *(pdst) = (*(pdst) & starttab[(width)]) | (_src & endtab[(width)]); \ } #endif /* FASTGETBITS && FASTPUTBITS */ #endif /* MFB_CONSTS_ONLY */ vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbtile.c0100664000076400007640000001427407120677563021255 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbtile.c,v 5.8 94/04/17 20:28:36 dpw Exp $ */ #include "X.h" #include "windowstr.h" #include "regionstr.h" #include "pixmapstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" #include "mergerop.h" /* the boxes are already translated. NOTE: iy = ++iy < tileHeight ? iy : 0 is equivalent to iy%= tileheight, and saves a division. */ /* tile area with a PPW bit wide pixmap */ void MROP_NAME(mfbTileAreaPPW)(pDraw, nbox, pbox, alu, ptile) DrawablePtr pDraw; int nbox; BoxPtr pbox; int alu; PixmapPtr ptile; { register PixelType *psrc; /* pointer to bits in tile, if needed */ int tileHeight; /* height of the tile */ register PixelType srcpix; int nlwidth; /* width in longwords of the drawable */ int w; /* width of current box */ MROP_DECLARE_REG () register int h; /* height of current box */ register int nlw; /* loop version of nlwMiddle */ register PixelType *p; /* pointer to bits we're writing */ PixelType startmask; PixelType endmask; /* masks for reggedy bits at either end of line */ int nlwMiddle; /* number of longwords between sides of boxes */ int nlwExtra; /* to get from right of box to left of next span */ register int iy; /* index of current scanline in tile */ PixelType *pbits; /* pointer to start of drawable */ mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); MROP_INITIALIZE(alu,~0) tileHeight = ptile->drawable.height; psrc = (PixelType *)(ptile->devPrivate.ptr); while (nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; iy = pbox->y1 % tileHeight; p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); if ( ((pbox->x1 & PIM) + w) < PPW) { maskpartialbits(pbox->x1, w, startmask); nlwExtra = nlwidth; while (h--) { srcpix = psrc[iy]; iy++; if (iy == tileHeight) iy = 0; *p = MROP_MASK(srcpix,*p,startmask); mfbScanlineInc(p, nlwExtra); } } else { maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); nlwExtra = nlwidth - nlwMiddle; if (startmask && endmask) { nlwExtra -= 1; while (h--) { srcpix = psrc[iy]; iy++; if (iy == tileHeight) iy = 0; nlw = nlwMiddle; *p = MROP_MASK (srcpix,*p,startmask); p++; while (nlw--) { *p = MROP_SOLID(srcpix,*p); p++; } *p = MROP_MASK(srcpix,*p,endmask); mfbScanlineInc(p, nlwExtra); } } else if (startmask && !endmask) { nlwExtra -= 1; while (h--) { srcpix = psrc[iy]; iy++; if (iy == tileHeight) iy = 0; nlw = nlwMiddle; *p = MROP_MASK(srcpix,*p,startmask); p++; while (nlw--) { *p = MROP_SOLID(srcpix,*p); p++; } mfbScanlineInc(p, nlwExtra); } } else if (!startmask && endmask) { while (h--) { srcpix = psrc[iy]; iy++; if (iy == tileHeight) iy = 0; nlw = nlwMiddle; while (nlw--) { *p = MROP_SOLID(srcpix,*p); p++; } *p = MROP_MASK(srcpix,*p,endmask); mfbScanlineInc(p, nlwExtra); } } else /* no ragged bits at either end */ { while (h--) { srcpix = psrc[iy]; iy++; if (iy == tileHeight) iy = 0; nlw = nlwMiddle; while (nlw--) { *p = MROP_SOLID (srcpix,*p); p++; } mfbScanlineInc(p, nlwExtra); } } } pbox++; } } #if (MROP) == 0 void mfbTileAreaPPW (pDraw, nbox, pbox, alu, ptile) DrawablePtr pDraw; int nbox; BoxPtr pbox; int alu; PixmapPtr ptile; { void (*f)(), mfbTileAreaPPWCopy(), mfbTileAreaPPWGeneral(); if (alu == GXcopy) f = mfbTileAreaPPWCopy; else f = mfbTileAreaPPWGeneral; (*f) (pDraw, nbox, pbox, alu, ptile); } #endif vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbscrclse.c0100664000076400007640000000512607120677563021752 0ustar constconst/* $XConsortium: mfbscrclse.c,v 1.8 94/04/17 20:28:33 rws Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #include "scrnintstr.h" /*ARGSUSED*/ Bool mfbCloseScreen(index, pScreen) register ScreenPtr pScreen; { xfree(pScreen->devPrivate); return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbply1rct.c0100664000076400007640000001423207120677563021710 0ustar constconst/* * $XConsortium: mfbply1rct.c /main/10 1996/08/23 10:35:13 dpw $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "regionstr.h" #include "scrnintstr.h" #include "mistruct.h" #include "mfb.h" #include "maskbits.h" #if defined(mips) || defined(sparc) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) #endif #if IMAGE_BYTE_ORDER == MSBFirst #define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) #define coordToInt(x,y) (((x) << 16) | (y)) #define intToX(i) (GetHighWord(i)) #define intToY(i) ((int) ((short) i)) #else #define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) #define coordToInt(x,y) (((y) << 16) | (x)) #define intToX(i) ((int) ((short) (i))) #define intToY(i) (GetHighWord(i)) #endif void MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn) DrawablePtr pDrawable; GCPtr pGC; int count; DDXPointPtr ptsIn; { mfbPrivGCPtr devPriv; int nlwidth; PixelType *addrl, *addr; int maxy; int origin; register int vertex1, vertex2; int c; BoxPtr extents; int clip; int y; int *vertex1p, *vertex2p; int *endp; int x1, x2; int dx1, dx2; int dy1, dy2; int e1, e2; int step1, step2; int sign1, sign2; int h; int l, r; PixelType mask, bits = ~((PixelType)0); int nmiddle; devPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr); if (mode == CoordModePrevious || shape != Convex || REGION_NUM_RECTS(devPriv->pCompositeClip) != 1) { miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); return; } origin = *((int *) &pDrawable->x); vertex2 = origin - ((origin & 0x8000) << 1); extents = &devPriv->pCompositeClip->extents; vertex1 = *((int *) &extents->x1) - vertex2; vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001; clip = 0; y = 32767; maxy = 0; vertex2p = (int *) ptsIn; endp = vertex2p + count; while (count--) { c = *vertex2p; clip |= (c - vertex1) | (vertex2 - c); c = intToY(c); if (c < y) { y = c; vertex1p = vertex2p; } vertex2p++; if (c > maxy) maxy = c; } if (y == maxy) return; if (clip & 0x80008000) { miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn); return; } mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); addrl = mfbScanlineDelta(addrl, y + pDrawable->y, nlwidth); origin = intToX(origin); vertex2p = vertex1p; vertex2 = vertex1 = *vertex2p++; if (vertex2p == endp) vertex2p = (int *) ptsIn; #define Setup(c,x,vertex,dx,dy,e,sign,step) {\ x = intToX(vertex); \ if (dy = intToY(c) - y) { \ dx = intToX(c) - x; \ step = 0; \ if (dx >= 0) \ { \ e = 0; \ sign = 1; \ if (dx >= dy) {\ step = dx / dy; \ dx = dx % dy; \ } \ } \ else \ { \ e = 1 - dy; \ sign = -1; \ dx = -dx; \ if (dx >= dy) { \ step = - (dx / dy); \ dx = dx % dy; \ } \ } \ } \ x += origin; \ vertex = c; \ } #define Step(x,dx,dy,e,sign,step) {\ x += step; \ if ((e += dx) > 0) \ { \ x += sign; \ e -= dy; \ } \ } for (;;) { if (y == intToY(vertex1)) { do { if (vertex1p == (int *) ptsIn) vertex1p = endp; c = *--vertex1p; Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1) } while (y >= intToY(vertex1)); h = dy1; } else { Step(x1,dx1,dy1,e1,sign1,step1) h = intToY(vertex1) - y; } if (y == intToY(vertex2)) { do { c = *vertex2p++; if (vertex2p == endp) vertex2p = (int *) ptsIn; Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) } while (y >= intToY(vertex2)); if (dy2 < h) h = dy2; } else { Step(x2,dx2,dy2,e2,sign2,step2) if ((c = (intToY(vertex2) - y)) < h) h = c; } /* fill spans for this segment */ y += h; for (;;) { l = x1; r = x2; nmiddle = x2 - x1; if (nmiddle < 0) { nmiddle = -nmiddle; l = x2; r = x1; } c = l & PIM; l -= c; l = l >> PWSH; addr = addrl + l; if (c + nmiddle < PPW) { mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle); *addr OPEQ mask; } else { if (c) { mask = SCRRIGHT(bits, c); *addr OPEQ mask; nmiddle += c - PPW; addr++; } nmiddle >>= PWSH; Duff (nmiddle, *addr++ EQWHOLEWORD) if (mask = ~SCRRIGHT(bits, r & PIM)) *addr OPEQ mask; } if (!--h) break; mfbScanlineInc(addrl, nlwidth); Step(x1,dx1,dy1,e1,sign1,step1) Step(x2,dx2,dy2,e2,sign2,step2) } if (y == maxy) break; mfbScanlineInc(addrl, nlwidth); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbpixmap.c0100664000076400007640000002031107120677563021603 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbpixmap.c,v 5.13 94/04/17 20:28:28 dpw Exp $ */ /* pixmap management written by drewry, september 1986 on a monchrome device, a pixmap is a bitmap. */ #include "Xmd.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "maskbits.h" #include "mfb.h" #include "mi.h" #include "servermd.h" PixmapPtr mfbCreatePixmap (pScreen, width, height, depth) ScreenPtr pScreen; int width; int height; int depth; { PixmapPtr pPixmap; int datasize; int paddedWidth; if (depth != 1) return NullPixmap; paddedWidth = BitmapBytePad(width); datasize = height * paddedWidth; pPixmap = AllocatePixmap(pScreen, datasize); if (!pPixmap) return NullPixmap; pPixmap->drawable.type = DRAWABLE_PIXMAP; pPixmap->drawable.class = 0; pPixmap->drawable.pScreen = pScreen; pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = depth; pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = paddedWidth; pPixmap->refcnt = 1; #ifdef PIXPRIV pPixmap->devPrivate.ptr = datasize ? (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL; #else pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1); #endif return pPixmap; } Bool mfbDestroyPixmap(pPixmap) PixmapPtr pPixmap; { if(--pPixmap->refcnt) return TRUE; xfree(pPixmap); return TRUE; } PixmapPtr mfbCopyPixmap(pSrc) register PixmapPtr pSrc; { register PixmapPtr pDst; int size; ScreenPtr pScreen; size = pSrc->drawable.height * pSrc->devKind; pScreen = pSrc->drawable.pScreen; pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width, pSrc->drawable.height, pSrc->drawable.depth); if (!pDst) return NullPixmap; memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size); return pDst; } /* replicates a pattern to be a full 32 bits wide. relies on the fact that each scnaline is longword padded. doesn't do anything if pixmap is not a factor of 32 wide. changes width field of pixmap if successful, so that the fast XRotatePixmap code gets used if we rotate the pixmap later. calculate number of times to repeat for each scanline of pattern zero out area to be filled with replicate left shift and or in original as many times as needed */ void mfbPadPixmap(pPixmap) PixmapPtr pPixmap; { register int width = pPixmap->drawable.width; register int h; register PixelType mask; register PixelType *p; register PixelType bits; /* real pattern bits */ register int i; int rep; /* repeat count for pattern */ if (width >= PPW) return; rep = PPW/width; if (rep*width != PPW) return; mask = endtab[width]; p = (PixelType *)(pPixmap->devPrivate.ptr); for (h=0; h < pPixmap->drawable.height; h++) { *p &= mask; bits = *p; for(i=1; idrawable.width = PPW; } /* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that * words are PPW bits wide, and that the least significant bit appears on the * left. */ void mfbXRotatePixmap(pPix, rw) PixmapPtr pPix; register int rw; { register PixelType *pw, *pwFinal; register PixelType t; if (pPix == NullPixmap) return; pw = (PixelType *)pPix->devPrivate.ptr; rw %= (int)pPix->drawable.width; if (rw < 0) rw += (int)pPix->drawable.width; if(pPix->drawable.width == PPW) { pwFinal = pw + pPix->drawable.height; while(pw < pwFinal) { t = *pw; *pw++ = SCRRIGHT(t, rw) | (SCRLEFT(t, (PPW-rw)) & endtab[rw]); } } else { /* We no longer do this. Validate doesn't try to rotate odd-size * tiles or stipples. mfbUnnaturalFS works directly off * the unrotate tile/stipple in the GC */ ErrorF("X internal error: trying to rotate odd-sized pixmap.\n"); } } /* Rotates pixmap pPix by h lines. Assumes that h is always less than pPix->height works on any width. */ void mfbYRotatePixmap(pPix, rh) register PixmapPtr pPix; int rh; { int nbyDown; /* bytes to move down to row 0; also offset of row rh */ int nbyUp; /* bytes to move up to line rh; also offset of first line moved down to 0 */ char *pbase; char *ptmp; int height; if (pPix == NullPixmap) return; height = (int) pPix->drawable.height; rh %= height; if (rh < 0) rh += height; pbase = (char *)pPix->devPrivate.ptr; nbyDown = rh * pPix->devKind; nbyUp = (pPix->devKind * height) - nbyDown; if(!(ptmp = (char *)ALLOCATE_LOCAL(nbyUp))) return; memmove(ptmp, pbase, nbyUp); /* save the low rows */ memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */ DEALLOCATE_LOCAL(ptmp); } void mfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot) register PixmapPtr psrcPix, *ppdstPix; int xrot, yrot; { register PixmapPtr pdstPix; if ((pdstPix = *ppdstPix) && (pdstPix->devKind == psrcPix->devKind) && (pdstPix->drawable.height == psrcPix->drawable.height)) { memmove((char *)pdstPix->devPrivate.ptr, (char *)psrcPix->devPrivate.ptr, psrcPix->drawable.height * psrcPix->devKind); pdstPix->drawable.width = psrcPix->drawable.width; pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; } else { if (pdstPix) /* FIX XBUG 6168 */ (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix); *ppdstPix = pdstPix = mfbCopyPixmap(psrcPix); if (!pdstPix) return; } mfbPadPixmap(pdstPix); if (xrot) mfbXRotatePixmap(pdstPix, xrot); if (yrot) mfbYRotatePixmap(pdstPix, yrot); } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbhrzvert.c0100664000076400007640000001224107120677563022014 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbhrzvert.c,v 1.15 94/04/17 20:28:24 dpw Exp $ */ #include "X.h" #include "gc.h" #include "window.h" #include "pixmap.h" #include "region.h" #include "mfb.h" #include "maskbits.h" /* horizontal solid line abs(len) > 1 */ mfbHorzS(rop, addrl, nlwidth, x1, y1, len) int rop; /* a reduced rasterop */ register PixelType *addrl; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int x1; /* initial point */ int y1; int len; /* length of line */ { register PixelType startmask; register PixelType endmask; register int nlmiddle; /* force the line to go left to right but don't draw the last point */ if (len < 0) { x1 += len; x1 += 1; len = -len; } addrl = mfbScanline(addrl, x1, y1, nlwidth); /* all bits inside same longword */ if ( ((x1 & PIM) + len) < PPW) { maskpartialbits(x1, len, startmask); if (rop == RROP_BLACK) { *addrl &= ~startmask; } else if (rop == RROP_WHITE) { *addrl |= startmask; } else if (rop == RROP_INVERT) { *addrl ^= startmask; } } else { maskbits(x1, len, startmask, endmask, nlmiddle); if (rop == RROP_BLACK) { if (startmask) *addrl++ &= ~startmask; Duff (nlmiddle, *addrl++ = 0x0); if (endmask) *addrl &= ~endmask; } else if (rop == RROP_WHITE) { if (startmask) *addrl++ |= startmask; Duff (nlmiddle, *addrl++ = ~0); if (endmask) *addrl |= endmask; } else if (rop == RROP_INVERT) { if (startmask) *addrl++ ^= startmask; Duff (nlmiddle, *addrl++ ^= ~0); if (endmask) *addrl ^= endmask; } } } /* vertical solid line this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates better code. sigh. we know that len will never be 0 or 1, so it's OK to use it. */ mfbVertS(rop, addrl, nlwidth, x1, y1, len) int rop; /* a reduced rasterop */ register PixelType *addrl; /* pointer to base of bitmap */ register int nlwidth; /* width in longwords of bitmap */ int x1, y1; /* initial point */ register int len; /* length of line */ { register PixelType bitmask; addrl = mfbScanline(addrl, x1, y1, nlwidth); if (len < 0) { nlwidth = -nlwidth; len = -len; } if (rop == RROP_BLACK) { bitmask = rmask[x1 & PIM]; Duff(len, *addrl &= bitmask; mfbScanlineInc(addrl, nlwidth) ); } else if (rop == RROP_WHITE) { bitmask = mask[x1 & PIM]; Duff(len, *addrl |= bitmask; mfbScanlineInc(addrl, nlwidth) ); } else if (rop == RROP_INVERT) { bitmask = mask[x1 & PIM]; Duff(len, *addrl ^= bitmask; mfbScanlineInc(addrl, nlwidth) ); } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbpolypnt.c0100664000076400007640000001104207120677563022013 0ustar constconst/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mfbpolypnt.c,v 5.6 94/04/17 20:28:30 dpw Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" #include "miscstruct.h" #include "regionstr.h" #include "scrnintstr.h" #include "mfb.h" #include "maskbits.h" void mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) register DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { register BoxPtr pbox; register int nbox; register PixelType *addrl; int nlwidth; int nptTmp; register xPoint *ppt; register int x; register int y; register int rop; mfbPrivGC *pGCPriv; if (!(pGC->planemask & 1)) return; pGCPriv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; rop = pGCPriv->rop; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); if ((mode == CoordModePrevious) && (npt > 1)) { for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++) { ppt->x += (ppt-1)->x; ppt->y += (ppt-1)->y; } } nbox = REGION_NUM_RECTS(pGCPriv->pCompositeClip); pbox = REGION_RECTS(pGCPriv->pCompositeClip); for (; --nbox >= 0; pbox++) { if (rop == RROP_BLACK) { for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) { x = ppt->x + pDrawable->x; y = ppt->y + pDrawable->y; if ((x >= pbox->x1) && (x < pbox->x2) && (y >= pbox->y1) && (y < pbox->y2)) *mfbScanline(addrl, x, y, nlwidth) &= rmask[x & PIM]; } } else if (rop == RROP_WHITE) { for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) { x = ppt->x + pDrawable->x; y = ppt->y + pDrawable->y; if ((x >= pbox->x1) && (x < pbox->x2) && (y >= pbox->y1) && (y < pbox->y2)) *mfbScanline(addrl, x, y, nlwidth) |= mask[x & PIM]; } } else if (rop == RROP_INVERT) { for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) { x = ppt->x + pDrawable->x; y = ppt->y + pDrawable->y; if ((x >= pbox->x1) && (x < pbox->x2) && (y >= pbox->y1) && (y < pbox->y2)) *mfbScanline(addrl, x, y, nlwidth) ^= mask[x & PIM]; } } } } vnc_unixsrc/Xvnc/programs/Xserver/mfb/mfbfont.c0100664000076400007640000000524507120677563021264 0ustar constconst/* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* $XConsortium: mfbfont.c,v 1.18 94/04/17 20:28:22 keith Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "mfb.h" #include "fontstruct.h" #include "dixfontstr.h" #include "scrnintstr.h" /*ARGSUSED*/ Bool mfbRealizeFont( pscr, pFont) ScreenPtr pscr; FontPtr pFont; { return (TRUE); } /*ARGSUSED*/ Bool mfbUnrealizeFont( pscr, pFont) ScreenPtr pscr; FontPtr pFont; { return (TRUE); } vnc_unixsrc/Xvnc/programs/Xserver/mi/0040775000076400007640000000000010616336473017317 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/mi/midispcur.c0100664000076400007640000004121407120677563021465 0ustar constconst/* * midispcur.c * * machine independent cursor display routines */ /* $XConsortium: midispcur.c,v 5.14 94/04/17 20:27:28 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define NEED_EVENTS # include "X.h" # include "misc.h" # include "input.h" # include "cursorstr.h" # include "windowstr.h" # include "regionstr.h" # include "dixstruct.h" # include "scrnintstr.h" # include "servermd.h" # include "mipointer.h" # include "misprite.h" # include "gcstruct.h" extern WindowPtr *WindowTable; /* per-screen private data */ static int miDCScreenIndex; static unsigned long miDCGeneration = 0; static Bool miDCCloseScreen(); typedef struct { GCPtr pSourceGC, pMaskGC; GCPtr pSaveGC, pRestoreGC; GCPtr pMoveGC; GCPtr pPixSourceGC, pPixMaskGC; CloseScreenProcPtr CloseScreen; PixmapPtr pSave, pTemp; } miDCScreenRec, *miDCScreenPtr; /* per-cursor per-screen private data */ typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ } miDCCursorRec, *miDCCursorPtr; /* * sprite/cursor method table */ static Bool miDCRealizeCursor(), miDCUnrealizeCursor(); static Bool miDCPutUpCursor(), miDCSaveUnderCursor(); static Bool miDCRestoreUnderCursor(), miDCMoveCursor(); static Bool miDCChangeSave(); static miSpriteCursorFuncRec miDCFuncs = { miDCRealizeCursor, miDCUnrealizeCursor, miDCPutUpCursor, miDCSaveUnderCursor, miDCRestoreUnderCursor, miDCMoveCursor, miDCChangeSave, }; Bool miDCInitialize (pScreen, screenFuncs) ScreenPtr pScreen; miPointerScreenFuncPtr screenFuncs; { miDCScreenPtr pScreenPriv; if (miDCGeneration != serverGeneration) { miDCScreenIndex = AllocateScreenPrivateIndex (); if (miDCScreenIndex < 0) return FALSE; miDCGeneration = serverGeneration; } pScreenPriv = (miDCScreenPtr) xalloc (sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; /* * initialize the entire private structure to zeros */ pScreenPriv->pSourceGC = pScreenPriv->pMaskGC = pScreenPriv->pSaveGC = pScreenPriv->pRestoreGC = pScreenPriv->pMoveGC = pScreenPriv->pPixSourceGC = pScreenPriv->pPixMaskGC = NULL; pScreenPriv->pSave = pScreenPriv->pTemp = NULL; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; pScreen->devPrivates[miDCScreenIndex].ptr = (pointer) pScreenPriv; if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs)) { xfree ((pointer) pScreenPriv); return FALSE; } return TRUE; } #define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0) #define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE) static Bool miDCCloseScreen (index, pScreen) ScreenPtr pScreen; { miDCScreenPtr pScreenPriv; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; tossGC (pScreenPriv->pSourceGC); tossGC (pScreenPriv->pMaskGC); tossGC (pScreenPriv->pSaveGC); tossGC (pScreenPriv->pRestoreGC); tossGC (pScreenPriv->pMoveGC); tossGC (pScreenPriv->pPixSourceGC); tossGC (pScreenPriv->pPixMaskGC); tossPix (pScreenPriv->pSave); tossPix (pScreenPriv->pTemp); xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (index, pScreen); } static Bool miDCRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { if (pCursor->bits->refcnt <= 1) pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; return TRUE; } static miDCCursorPtr miDCRealize (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miDCCursorPtr pPriv; GCPtr pGC; XID gcvals[3]; pPriv = (miDCCursorPtr) xalloc (sizeof (miDCCursorRec)); if (!pPriv) return (miDCCursorPtr)NULL; pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); if (!pPriv->sourceBits) { xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); if (!pPriv->maskBits) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC (1, pScreen); if (!pGC) { (void) miDCUnrealizeCursor (pScreen, pCursor); return (miDCCursorPtr)NULL; } ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); gcvals[0] = GXand; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals[0] = GXcopy; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); gcvals[0] = GXandInverted; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); FreeScratchGC (pGC); return pPriv; } static Bool miDCUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miDCCursorPtr pPriv; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (pPriv && (pCursor->bits->refcnt <= 1)) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); (*pScreen->DestroyPixmap) (pPriv->maskBits); xfree ((pointer) pPriv); pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; } return TRUE; } static void miDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask) DrawablePtr pDrawable; GCPtr sourceGC, maskGC; int x, y; unsigned w, h; miDCCursorPtr pPriv; unsigned long source, mask; { XID gcvals[1]; if (sourceGC->fgPixel != source) { gcvals[0] = source; DoChangeGC (sourceGC, GCForeground, gcvals, 0); } if (sourceGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, sourceGC); (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcvals[0] = mask; DoChangeGC (maskGC, GCForeground, gcvals, 0); } if (maskGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, maskGC); (*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y); } #define EnsureGC(gc,win) (gc || miDCMakeGC(&gc, win)) static GCPtr miDCMakeGC(ppGC, pWin) GCPtr *ppGC; WindowPtr pWin; { GCPtr pGC; int status; XID gcvals[2]; gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, GCSubwindowMode|GCGraphicsExposures, gcvals, &status); if (pGC) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); *ppGC = pGC; return pGC; } static Bool miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) ScreenPtr pScreen; CursorPtr pCursor; int x, y; unsigned long source, mask; { miDCScreenPtr pScreenPriv; miDCCursorPtr pPriv; WindowPtr pWin; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pWin = WindowTable[pScreen->myNum]; if (!EnsureGC(pScreenPriv->pSourceGC, pWin)) return FALSE; if (!EnsureGC(pScreenPriv->pMaskGC, pWin)) { FreeGC (pScreenPriv->pSourceGC, (GContext) 0); pScreenPriv->pSourceGC = 0; return FALSE; } miDCPutBits ((DrawablePtr)pWin, pPriv, pScreenPriv->pSourceGC, pScreenPriv->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); return TRUE; } static Bool miDCSaveUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) (*pScreen->DestroyPixmap) (pSave); pScreenPriv->pSave = pSave = (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth); if (!pSave) return FALSE; } if (!EnsureGC(pScreenPriv->pSaveGC, pWin)) return FALSE; pGC = pScreenPriv->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pSave, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, h, 0, 0); return TRUE; } static Bool miDCRestoreUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } static Bool miDCChangeSave (pScreen, x, y, w, h, dx, dy) ScreenPtr pScreen; int x, y, w, h, dx, dy; { miDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; int sourcex, sourcey, destx, desty, copyw, copyh; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; /* * restore the bits which are about to get trashed */ if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); /* * copy the old bits to the screen. */ if (dy > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, h - dy, w, dy, x + dx, y + h); } else if (dy < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, -dy, x + dx, y + dy); } if (dy >= 0) { desty = y + dy; sourcey = 0; copyh = h - dy; } else { desty = y; sourcey = - dy; copyh = h + dy; } if (dx > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, w - dx, sourcey, dx, copyh, x + w, desty); } else if (dx < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, sourcey, -dx, copyh, x + dx, desty); } if (!EnsureGC(pScreenPriv->pSaveGC, pWin)) return FALSE; pGC = pScreenPriv->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pSave, pGC); /* * move the bits that are still valid within the pixmap */ if (dx >= 0) { sourcex = 0; destx = dx; copyw = w - dx; } else { destx = 0; sourcex = - dx; copyw = w + dx; } if (dy >= 0) { sourcey = 0; desty = dy; copyh = h - dy; } else { desty = 0; sourcey = -dy; copyh = h + dy; } (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pSave, pGC, sourcex, sourcey, copyw, copyh, destx, desty); /* * copy the new bits from the screen into the remaining areas of the * pixmap */ if (dy > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, dy, 0, 0); } else if (dy < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y + h + dy, w, -dy, 0, h + dy); } if (dy >= 0) { desty = dy; sourcey = y + dy; copyh = h - dy; } else { desty = 0; sourcey = y; copyh = h + dy; } if (dx > 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, sourcey, dx, copyh, 0, desty); } else if (dx < 0) { (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x + w + dx, sourcey, -dx, copyh, w + dx, desty); } return TRUE; } static Bool miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) ScreenPtr pScreen; CursorPtr pCursor; int x, y, w, h, dx, dy; unsigned long source, mask; { miDCCursorPtr pPriv; miDCScreenPtr pScreenPriv; int status; WindowPtr pWin; GCPtr pGC; XID gcval = FALSE; PixmapPtr pTemp; pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pWin = WindowTable[pScreen->myNum]; pTemp = pScreenPriv->pTemp; if (!pTemp || pTemp->drawable.width != pScreenPriv->pSave->drawable.width || pTemp->drawable.height != pScreenPriv->pSave->drawable.height) { if (pTemp) (*pScreen->DestroyPixmap) (pTemp); pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap) (pScreen, w, h, pScreenPriv->pSave->drawable.depth); if (!pTemp) return FALSE; } if (!pScreenPriv->pMoveGC) { pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pMoveGC) return FALSE; } /* * copy the saved area to a temporary pixmap */ pGC = pScreenPriv->pMoveGC; if (pGC->serialNumber != pTemp->drawable.serialNumber) ValidateGC ((DrawablePtr) pTemp, pGC); (*pGC->ops->CopyArea)((DrawablePtr)pScreenPriv->pSave, (DrawablePtr)pTemp, pGC, 0, 0, w, h, 0, 0); /* * draw the cursor in the temporary pixmap */ if (!pScreenPriv->pPixSourceGC) { pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pPixSourceGC) return FALSE; } if (!pScreenPriv->pPixMaskGC) { pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, GCGraphicsExposures, &gcval, &status); if (!pScreenPriv->pPixMaskGC) return FALSE; } miDCPutBits ((DrawablePtr)pTemp, pPriv, pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC, dx, dy, pCursor->bits->width, pCursor->bits->height, source, mask); /* * copy the temporary pixmap onto the screen */ if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pTemp, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/mi/misprite.h0100664000076400007640000000537707120677563021341 0ustar constconst/* * misprite.h * * software-sprite/sprite drawing interface spec * * mi versions of these routines exist. */ /* $XConsortium: misprite.h,v 5.5 94/04/17 20:27:55 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ typedef struct { Bool (*RealizeCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); Bool (*UnrealizeCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); Bool (*PutUpCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, unsigned long /*source*/, unsigned long /*mask*/ #endif ); Bool (*SaveUnderCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); Bool (*RestoreUnderCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); Bool (*MoveCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*dx*/, int /*dy*/, unsigned long /*source*/, unsigned long /*mask*/ #endif ); Bool (*ChangeSave)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*dx*/, int /*dy*/ #endif ); } miSpriteCursorFuncRec, *miSpriteCursorFuncPtr; extern Bool miSpriteInitialize( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miSpriteCursorFuncPtr /*cursorFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mifillarc.c0100664000076400007640000004273107120677563021435 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Bob Scheifler, MIT X Consortium ********************************************************/ /* $XConsortium: mifillarc.c,v 5.18 95/01/10 20:59:49 kaleb Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.2 1995/01/28 16:15:52 dawes Exp $ */ #include #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) sin((double)d*(M_PI/11520.0)) #define Dcos(d) cos((double)d*(M_PI/11520.0)) void miFillArcSetup(arc, info) register xArc *arc; register miFillArcRec *info; { info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; if (arc->width == arc->height) { /* (2x - 2xorg)^2 = d^2 - (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = 8; info->xm = 8; info->yk = info->y << 3; if (!info->dx) { info->xk = 0; info->e = -1; } else { info->y++; info->yk += 4; info->xk = -4; info->e = - (info->y << 3); } } else { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->ym = (arc->width * arc->width) << 3; info->xm = (arc->height * arc->height) << 3; info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym >> 1; if (!info->dx) { info->xk = 0; info->e = - (info->xm >> 3); } else { info->y++; info->yk += info->ym; info->xk = -(info->xm >> 1); info->e = info->xk - info->yk; } } } void miFillArcDSetup(arc, info) register xArc *arc; register miFillArcDRec *info; { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ info->y = arc->height >> 1; info->dy = arc->height & 1; info->yorg = arc->y + info->y; info->dx = arc->width & 1; info->xorg = arc->x + (arc->width >> 1) + info->dx; info->dx = 1 - info->dx; info->ym = ((double)arc->width) * (arc->width * 8); info->xm = ((double)arc->height) * (arc->height * 8); info->yk = info->y * info->ym; if (!info->dy) info->yk -= info->ym / 2.0; if (!info->dx) { info->xk = 0; info->e = - (info->xm / 8.0); } else { info->y++; info->yk += info->ym; info->xk = -info->xm / 2.0; info->e = info->xk - info->yk; } } static void miGetArcEdge(arc, edge, k, top, left) register xArc *arc; register miSliceEdgePtr edge; int k; Bool top, left; { register int xady, y; y = arc->height >> 1; if (!(arc->width & 1)) y++; if (!top) { y = -y; if (arc->height & 1) y--; } xady = k + y * edge->dx; if (xady <= 0) edge->x = - ((-xady) / edge->dy + 1); else edge->x = (xady - 1) / edge->dy; edge->e = xady - edge->x * edge->dy; if ((top && (edge->dx < 0)) || (!top && (edge->dx > 0))) edge->e = edge->dy - edge->e + 1; if (left) edge->x++; edge->x += arc->x + (arc->width >> 1); if (edge->dx > 0) { edge->deltax = 1; edge->stepx = edge->dx / edge->dy; edge->dx = edge->dx % edge->dy; } else { edge->deltax = -1; edge->stepx = - ((-edge->dx) / edge->dy); edge->dx = (-edge->dx) % edge->dy; } if (!top) { edge->deltax = -edge->deltax; edge->stepx = -edge->stepx; } } void miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp) int angle; int width; int height; int *dxp; int *dyp; double *d_dxp; double *d_dyp; { int dx, dy; double d_dx, d_dy, scale; Bool negative_dx, negative_dy; switch (angle) { case 0: *dxp = -1; *dyp = 0; if (d_dxp) { *d_dxp = width / 2.0; *d_dyp = 0; } break; case QUADRANT: *dxp = 0; *dyp = 1; if (d_dxp) { *d_dxp = 0; *d_dyp = - height / 2.0; } break; case HALFCIRCLE: *dxp = 1; *dyp = 0; if (d_dxp) { *d_dxp = - width / 2.0; *d_dyp = 0; } break; case QUADRANT3: *dxp = 0; *dyp = -1; if (d_dxp) { *d_dxp = 0; *d_dyp = height / 2.0; } break; default: d_dx = Dcos(angle) * width; d_dy = Dsin(angle) * height; if (d_dxp) { *d_dxp = d_dx / 2.0; *d_dyp = - d_dy / 2.0; } negative_dx = FALSE; if (d_dx < 0.0) { d_dx = -d_dx; negative_dx = TRUE; } negative_dy = FALSE; if (d_dy < 0.0) { d_dy = -d_dy; negative_dy = TRUE; } scale = d_dx; if (d_dy > d_dx) scale = d_dy; dx = floor ((d_dx * 32768) / scale + 0.5); if (negative_dx) dx = -dx; *dxp = dx; dy = floor ((d_dy * 32768) / scale + 0.5); if (negative_dy) dy = -dy; *dyp = dy; break; } } static void miGetPieEdge(arc, angle, edge, top, left) register xArc *arc; register int angle; register miSliceEdgePtr edge; Bool top, left; { register int k, signdx, signdy; int dx, dy; miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0); if (dy == 0) { edge->x = left ? -65536 : 65536; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dx == 0) { edge->x = arc->x + (arc->width >> 1); if (left && (arc->width & 1)) edge->x++; else if (!left && !(arc->width & 1)) edge->x--; edge->stepx = 0; edge->e = 0; edge->dx = -1; return; } if (dy < 0) { dx = -dx; dy = -dy; } k = (arc->height & 1) ? dx : 0; if (arc->width & 1) k += dy; edge->dx = dx << 1; edge->dy = dy << 1; miGetArcEdge(arc, edge, k, top, left); } void miFillArcSliceSetup(arc, slice, pGC) register xArc *arc; register miArcSliceRec *slice; GCPtr pGC; { register int angle1, angle2; angle1 = arc->angle1; if (arc->angle2 < 0) { angle2 = angle1; angle1 += arc->angle2; } else angle2 = angle1 + arc->angle2; while (angle1 < 0) angle1 += FULLCIRCLE; while (angle1 >= FULLCIRCLE) angle1 -= FULLCIRCLE; while (angle2 < 0) angle2 += FULLCIRCLE; while (angle2 >= FULLCIRCLE) angle2 -= FULLCIRCLE; slice->min_top_y = 0; slice->max_top_y = arc->height >> 1; slice->min_bot_y = 1 - (arc->height & 1); slice->max_bot_y = slice->max_top_y - 1; slice->flip_top = FALSE; slice->flip_bot = FALSE; if (pGC->arcMode == ArcPieSlice) { slice->edge1_top = (angle1 < HALFCIRCLE); slice->edge2_top = (angle2 <= HALFCIRCLE); if ((angle2 == 0) || (angle1 == HALFCIRCLE)) { if (angle2 ? slice->edge2_top : slice->edge1_top) slice->min_top_y = slice->min_bot_y; else slice->min_top_y = arc->height; slice->min_bot_y = 0; } else if ((angle1 == 0) || (angle2 == HALFCIRCLE)) { slice->min_top_y = slice->min_bot_y; if (angle1 ? slice->edge1_top : slice->edge2_top) slice->min_bot_y = arc->height; else slice->min_bot_y = 0; } else if (slice->edge1_top == slice->edge2_top) { if (angle2 < angle1) { slice->flip_top = slice->edge1_top; slice->flip_bot = !slice->edge1_top; } else if (slice->edge1_top) { slice->min_top_y = 1; slice->min_bot_y = arc->height; } else { slice->min_bot_y = 0; slice->min_top_y = arc->height; } } miGetPieEdge(arc, angle1, &slice->edge1, slice->edge1_top, !slice->edge1_top); miGetPieEdge(arc, angle2, &slice->edge2, slice->edge2_top, slice->edge2_top); } else { double w2, h2, x1, y1, x2, y2, dx, dy, scale; int signdx, signdy, y, k; Bool isInt1 = TRUE, isInt2 = TRUE; w2 = (double)arc->width / 2.0; h2 = (double)arc->height / 2.0; if ((angle1 == 0) || (angle1 == HALFCIRCLE)) { x1 = angle1 ? -w2 : w2; y1 = 0.0; } else if ((angle1 == QUADRANT) || (angle1 == QUADRANT3)) { x1 = 0.0; y1 = (angle1 == QUADRANT) ? h2 : -h2; } else { isInt1 = FALSE; x1 = Dcos(angle1) * w2; y1 = Dsin(angle1) * h2; } if ((angle2 == 0) || (angle2 == HALFCIRCLE)) { x2 = angle2 ? -w2 : w2; y2 = 0.0; } else if ((angle2 == QUADRANT) || (angle2 == QUADRANT3)) { x2 = 0.0; y2 = (angle2 == QUADRANT) ? h2 : -h2; } else { isInt2 = FALSE; x2 = Dcos(angle2) * w2; y2 = Dsin(angle2) * h2; } dx = x2 - x1; dy = y2 - y1; if (arc->height & 1) { y1 -= 0.5; y2 -= 0.5; } if (arc->width & 1) { x1 += 0.5; x2 += 0.5; } if (dy < 0.0) { dy = -dy; signdy = -1; } else signdy = 1; if (dx < 0.0) { dx = -dx; signdx = -1; } else signdx = 1; if (isInt1 && isInt2) { slice->edge1.dx = dx * 2; slice->edge1.dy = dy * 2; } else { scale = (dx > dy) ? dx : dy; slice->edge1.dx = floor((dx * 32768) / scale + .5); slice->edge1.dy = floor((dy * 32768) / scale + .5); } if (!slice->edge1.dy) { if (signdx < 0) { y = floor(y1 + 1.0); if (y >= 0) { slice->min_top_y = y; slice->min_bot_y = arc->height; } else { slice->max_bot_y = -y - (arc->height & 1); } } else { y = floor(y1); if (y >= 0) slice->max_top_y = y; else { slice->min_top_y = arc->height; slice->min_bot_y = -y - (arc->height & 1); } } slice->edge1_top = TRUE; slice->edge1.x = 65536; slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2 = slice->edge1; slice->edge2_top = FALSE; } else if (!slice->edge1.dx) { if (signdy < 0) x1 -= 1.0; slice->edge1.x = ceil(x1); slice->edge1_top = signdy < 0; slice->edge1.x += arc->x + (arc->width >> 1); slice->edge1.stepx = 0; slice->edge1.e = 0; slice->edge1.dx = -1; slice->edge2_top = !slice->edge1_top; slice->edge2 = slice->edge1; } else { if (signdx < 0) slice->edge1.dx = -slice->edge1.dx; if (signdy < 0) slice->edge1.dx = -slice->edge1.dx; k = ceil(((x1 + x2) * slice->edge1.dy - (y1 + y2) * slice->edge1.dx) / 2.0); slice->edge2.dx = slice->edge1.dx; slice->edge2.dy = slice->edge1.dy; slice->edge1_top = signdy < 0; slice->edge2_top = !slice->edge1_top; miGetArcEdge(arc, &slice->edge1, k, slice->edge1_top, !slice->edge1_top); miGetArcEdge(arc, &slice->edge2, k, slice->edge2_top, slice->edge2_top); } } } #define ADDSPANS() \ pts->x = xorg - x; \ pts->y = yorg - y; \ *wids = slw; \ pts++; \ wids++; \ if (miFillArcLower(slw)) \ { \ pts->x = xorg - x; \ pts->y = yorg + y + dy; \ pts++; \ *wids++ = slw; \ } static void miFillEllipseI(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { register int x, y, e; int yk, xk, ym, xm, dx, dy, xorg, yorg; int slw; miFillArcRec info; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); if (!points) return; widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); if (!widths) { DEALLOCATE_LOCAL(points); return; } miFillArcSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); DEALLOCATE_LOCAL(widths); DEALLOCATE_LOCAL(points); } static void miFillEllipseD(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { register int x, y; int xorg, yorg, dx, dy, slw; double e, yk, xk, ym, xm; miFillArcDRec info; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height); if (!points) return; widths = (int *)ALLOCATE_LOCAL(sizeof(int) * arc->height); if (!widths) { DEALLOCATE_LOCAL(points); return; } miFillArcDSetup(arc, &info); MIFILLARCSETUP(); if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); ADDSPANS(); } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); DEALLOCATE_LOCAL(widths); DEALLOCATE_LOCAL(points); } #define ADDSPAN(l,r) \ if (r >= l) \ { \ pts->x = l; \ pts->y = ya; \ pts++; \ *wids++ = r - l + 1; \ } #define ADDSLICESPANS(flip) \ if (!flip) \ { \ ADDSPAN(xl, xr); \ } \ else \ { \ xc = xorg - x; \ ADDSPAN(xc, xr); \ xc += slw - 1; \ ADDSPAN(xl, xc); \ } static void miFillArcSliceI(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; register int x, y, e; miFillArcRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miFillArcSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); if (!points) return; widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); if (!widths) { DEALLOCATE_LOCAL(points); return; } if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); DEALLOCATE_LOCAL(widths); DEALLOCATE_LOCAL(points); } static void miFillArcSliceD(pDraw, pGC, arc) DrawablePtr pDraw; GCPtr pGC; xArc *arc; { register int x, y; int dx, dy, xorg, yorg, slw; double e, yk, xk, ym, xm; miFillArcDRec info; miArcSliceRec slice; int ya, xl, xr, xc; DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miFillArcDSetup(arc, &info); miFillArcSliceSetup(arc, &slice, pGC); MIFILLARCSETUP(); slw = arc->height; if (slice.flip_top || slice.flip_bot) slw += (arc->height >> 1) + 1; points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * slw); if (!points) return; widths = (int *)ALLOCATE_LOCAL(sizeof(int) * slw); if (!widths) { DEALLOCATE_LOCAL(points); return; } if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; slice.edge1.x += pDraw->x; slice.edge2.x += pDraw->x; } pts = points; wids = widths; while (y > 0) { MIFILLARCSTEP(slw); MIARCSLICESTEP(slice.edge1); MIARCSLICESTEP(slice.edge2); if (miFillSliceUpper(slice)) { ya = yorg - y; MIARCSLICEUPPER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_top); } if (miFillSliceLower(slice)) { ya = yorg + y + dy; MIARCSLICELOWER(xl, xr, slice, slw); ADDSLICESPANS(slice.flip_bot); } } (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); DEALLOCATE_LOCAL(widths); DEALLOCATE_LOCAL(points); } /* MIPOLYFILLARC -- The public entry for the PolyFillArc request. * Since we don't have to worry about overlapping segments, we can just * fill each arc as it comes. */ void miPolyFillArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register int i; register xArc *arc; for(i = narcs, arc = parcs; --i >= 0; arc++) { if (miFillArcEmpty(arc)) continue;; if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE)) { if (miCanFillArc(arc)) miFillEllipseI(pDraw, pGC, arc); else miFillEllipseD(pDraw, pGC, arc); } else { if (miCanFillArc(arc)) miFillArcSliceI(pDraw, pGC, arc); else miFillArcSliceD(pDraw, pGC, arc); } } } vnc_unixsrc/Xvnc/programs/Xserver/mi/Imakefile0100664000076400007640000000500607120677563021132 0ustar constconstXCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.11.2.1 1997/05/03 09:50:45 dawes Exp $ XCOMM $XConsortium: Imakefile /main/44 1996/12/02 10:22:16 lehors $ #include #if ! HasCbrt CBRT_SRC = cbrt.c CBRT_OBJ = cbrt.o #endif SRCS = $(CBRT_SRC) mivaltree.c mipolyseg.c mipolyrect.c \ mipoly.c mipolycon.c mipolygen.c mipolyutil.c \ mifillrct.c miwideline.c mispans.c \ miarc.c mizerarc.c mifillarc.c \ miwindow.c micursor.c miregion.c \ mipolytext.c mibitblt.c mipolypnt.c mipushpxl.c \ miexpose.c miglblt.c mizerline.c mifpolycon.c \ midash.c mibstore.c miinitext.c mieq.c \ mipointer.c misprite.c midispcur.c miscrinit.c miclipn.c migc.c OBJS = $(CBRT_OBJ) mivaltree.o mipolyseg.o mipolyrect.o \ mipoly.o mipolycon.o mipolygen.o mipolyutil.o \ mifillrct.o miwideline.o mispans.o \ miarc.o mizerarc.o mifillarc.o \ miwindow.o micursor.o miregion.o \ mipolytext.o mibitblt.o mipolypnt.o mipushpxl.o \ miexpose.o miglblt.o mizerline.o mifpolycon.o \ midash.o mibstore.o miinitext.o mieq.o \ mipointer.o misprite.o midispcur.o miscrinit.o miclipn.o migc.o #ifdef XFree86Version /* * Make sure XINPUT, XF86VidTune, etc aren't defined for the miinitext.o * used by Xnest, Xvfb */ EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC #else EXT_DEFINES = ExtensionDefines #endif #if PexDynamicModule PEX_MODULE_DEFINES = -DPEX_MODULE #endif #if XieDynamicModule XIE_MODULE_DEFINES = -DXIE_MODULE #endif EXT_MODULES_DEFINES = $(PEX_MODULE_DEFINES) $(XIE_MODULE_DEFINES) INCLUDES = -I. -I../include -I../../../include/fonts \ -I$(XINCLUDESRC) -I$(FONTINCSRC) LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryObjectRule() NormalLibraryTarget(mi,$(OBJS)) LintLibraryTarget(mi,$(SRCS)) NormalLintTarget($(SRCS)) #ifndef Win32Architecture NormalLibraryTarget(cbrt,cbrt.o) #endif SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) -UGLXEXT) SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES)) InstallLinkKitLibrary(mi,$(LINKKITDIR)/lib) InstallLinkKitLibrary(cbrt,$(LINKKITDIR)/lib) InstallLinkKitNonExecFile(mi.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mibstore.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(miline.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mipointer.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(misprite.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mispritest.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(mistruct.h,$(LINKKITDIR)/include) InstallLinkKitNonExecFile(miinitext.c,$(LINKKITDIR)) DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/mi/midash.c0100664000076400007640000001706707120677563020744 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: midash.c,v 5.5 94/04/17 20:27:27 dpw Exp $ */ #include "miscstruct.h" #include "mistruct.h" #include "mifpoly.h" static miDashPtr CheckDashStorage(); /* return a list of DashRec. there will be an extra entry at the end holding the last point of the polyline. this means that the code that actually draws dashes can get a pair of points for every dash. only the point in the last dash record is useful; the other fields are not used. nseg is the number of segments, not the number of points. example: dash1.start dash2.start dash3.start last-point defines a list of segments (dash1.pt, dash2.pt) (dash2.pt, dash3.pt) (dash3.pt, last-point) and nseg == 3. NOTE: EVEN_DASH == ~ODD_DASH NOTE ALSO: miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash. */ miDashPtr miDashLine(npt, ppt, nDash, pDash, offset, pnseg) int npt; DDXPointPtr ppt; unsigned int nDash; unsigned char *pDash; unsigned int offset; int *pnseg; { DDXPointRec pt1, pt2; int lenCur; /* npt used from this dash */ int lenMax; /* npt in this dash */ int iDash = 0; /* index of current dash */ int which; /* EVEN_DASH or ODD_DASH */ miDashPtr pseg; /* list of dash segments */ miDashPtr psegBase; /* start of list */ int nseg = 0; /* number of dashes so far */ int nsegMax = 0; /* num segs we can fit in this list */ int x, y, len; int adx, ady, signdx, signdy; int du, dv, e1, e2, e, base_e = 0; lenCur = offset; which = EVEN_DASH; while(lenCur >= pDash[iDash]) { lenCur -= pDash[iDash]; iDash++; if (iDash >= nDash) iDash = 0; which = ~which; } lenMax = pDash[iDash]; psegBase = (miDashPtr)NULL; pt2 = ppt[0]; /* just in case there is only one point */ while(--npt) { if (PtEqual(ppt[0], ppt[1])) { ppt++; continue; /* no duplicated points in polyline */ } pt1 = *ppt++; pt2 = *ppt; adx = pt2.x - pt1.x; ady = pt2.y - pt1.y; signdx = sign(adx); signdy = sign(ady); adx = abs(adx); ady = abs(ady); if (adx > ady) { du = adx; dv = ady; len = adx; } else { du = ady; dv = adx; len = ady; } e1 = dv * 2; e2 = e1 - 2*du; e = e1 - du; x = pt1.x; y = pt1.y; nseg++; pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt = pt1; pseg->e1 = e1; pseg->e2 = e2; base_e = pseg->e = e; pseg->which = which; pseg->newLine = 1; while (len--) { if (adx > ady) { /* X_AXIS */ if (((signdx > 0) && (e < 0)) || ((signdx <=0) && (e <=0)) ) { e += e1; } else { y += signdy; e += e2; } x += signdx; } else { /* Y_AXIS */ if (((signdx > 0) && (e < 0)) || ((signdx <=0) && (e <=0)) ) { e +=e1; } else { x += signdx; e += e2; } y += signdy; } lenCur++; if (lenCur >= lenMax && (len || npt <= 1)) { nseg++; pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt.x = x; pseg->pt.y = y; pseg->e1 = e1; pseg->e2 = e2; pseg->e = e; which = ~which; pseg->which = which; pseg->newLine = 0; /* move on to next dash */ iDash++; if (iDash >= nDash) iDash = 0; lenMax = pDash[iDash]; lenCur = 0; } } /* while len-- */ } /* while --npt */ if (lenCur == 0 && nseg != 0) { nseg--; which = ~which; } *pnseg = nseg; pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax); if (!pseg) return (miDashPtr)NULL; pseg->pt = pt2; pseg->e = base_e; pseg->which = which; pseg->newLine = 0; return psegBase; } #define NSEGDELTA 16 /* returns a pointer to the pseg[nseg-1], growing the storage as necessary. this interface seems unnecessarily cumbersome. */ static miDashPtr CheckDashStorage(ppseg, nseg, pnsegMax) miDashPtr *ppseg; /* base pointer */ int nseg; /* number of segment we want to write to */ int *pnsegMax; /* size (in segments) of list so far */ { if (nseg > *pnsegMax) { miDashPtr newppseg; *pnsegMax += NSEGDELTA; newppseg = (miDashPtr)xrealloc(*ppseg, (*pnsegMax)*sizeof(miDashRec)); if (!newppseg) { xfree(*ppseg); return (miDashPtr)NULL; } *ppseg = newppseg; } return(*ppseg+(nseg-1)); } void miStepDash (dist, pDashIndex, pDash, numInDashList, pDashOffset) int dist; /* distance to step */ int *pDashIndex; /* current dash */ unsigned char *pDash; /* dash list */ int numInDashList; /* total length of dash list */ int *pDashOffset; /* offset into current dash */ { int dashIndex, dashOffset; int totallen; int i; dashIndex = *pDashIndex; dashOffset = *pDashOffset; if (dist < pDash[dashIndex] - dashOffset) { *pDashOffset = dashOffset + dist; return; } dist -= pDash[dashIndex] - dashOffset; if (++dashIndex == numInDashList) dashIndex = 0; totallen = 0; for (i = 0; i < numInDashList; i++) totallen += pDash[i]; if (totallen <= dist) dist = dist % totallen; while (dist >= pDash[dashIndex]) { dist -= pDash[dashIndex]; if (++dashIndex == numInDashList) dashIndex = 0; } *pDashIndex = dashIndex; *pDashOffset = dist; } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipointer.c0100664000076400007640000003146407120677563021502 0ustar constconst/* * mipointer.c */ /* $XConsortium: mipointer.c,v 5.24 94/04/17 20:27:39 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.1 1996/03/10 12:12:44 dawes Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # define NEED_EVENTS # include "X.h" # include "Xmd.h" # include "Xproto.h" # include "misc.h" # include "windowstr.h" # include "pixmapstr.h" # include "mi.h" # include "scrnintstr.h" # include "mipointrst.h" # include "cursorstr.h" # include "dixstruct.h" static int miPointerScreenIndex; static unsigned long miPointerGeneration = 0; #define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) #define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s) /* * until more than one pointer device exists. */ static miPointerRec miPointer; static Bool miPointerRealizeCursor (), miPointerUnrealizeCursor (); static Bool miPointerDisplayCursor (); static void miPointerConstrainCursor (), miPointerPointerNonInterestBox(); static void miPointerCursorLimits (); static Bool miPointerSetCursorPosition (); static Bool miPointerCloseScreen(); static void miPointerMove (); Bool miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) ScreenPtr pScreen; miPointerSpriteFuncPtr spriteFuncs; miPointerScreenFuncPtr screenFuncs; Bool waitForUpdate; { miPointerScreenPtr pScreenPriv; if (miPointerGeneration != serverGeneration) { miPointerScreenIndex = AllocateScreenPrivateIndex(); if (miPointerScreenIndex < 0) return FALSE; miPointerGeneration = serverGeneration; } pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->spriteFuncs = spriteFuncs; pScreenPriv->screenFuncs = screenFuncs; /* * check for uninitialized methods */ if (!screenFuncs->EnqueueEvent) screenFuncs->EnqueueEvent = mieqEnqueue; if (!screenFuncs->NewEventScreen) screenFuncs->NewEventScreen = mieqSwitchScreen; pScreenPriv->waitForUpdate = waitForUpdate; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv; /* * set up screen cursor method table */ pScreen->ConstrainCursor = miPointerConstrainCursor; pScreen->CursorLimits = miPointerCursorLimits; pScreen->DisplayCursor = miPointerDisplayCursor; pScreen->RealizeCursor = miPointerRealizeCursor; pScreen->UnrealizeCursor = miPointerUnrealizeCursor; pScreen->SetCursorPosition = miPointerSetCursorPosition; pScreen->RecolorCursor = miRecolorCursor; pScreen->PointerNonInterestBox = miPointerPointerNonInterestBox; /* * set up the pointer object */ miPointer.pScreen = NULL; miPointer.pSpriteScreen = NULL; miPointer.pCursor = NULL; miPointer.pSpriteCursor = NULL; miPointer.limits.x1 = 0; miPointer.limits.x2 = 32767; miPointer.limits.y1 = 0; miPointer.limits.y2 = 32767; miPointer.confined = FALSE; miPointer.x = 0; miPointer.y = 0; miPointer.history_start = miPointer.history_end = 0; return TRUE; } static Bool miPointerCloseScreen (index, pScreen) int index; ScreenPtr pScreen; { SetupScreen(pScreen); if (pScreen == miPointer.pScreen) miPointer.pScreen = 0; if (pScreen == miPointer.pSpriteScreen) miPointer.pSpriteScreen = 0; pScreen->CloseScreen = pScreenPriv->CloseScreen; xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (index, pScreen); } /* * DIX/DDX interface routines */ static Bool miPointerRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->RealizeCursor) (pScreen, pCursor); } static Bool miPointerUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { SetupScreen(pScreen); return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pScreen, pCursor); } static Bool miPointerDisplayCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { SetupScreen(pScreen); miPointer.pCursor = pCursor; miPointer.pScreen = pScreen; miPointerUpdate (); return TRUE; } static void miPointerConstrainCursor (pScreen, pBox) ScreenPtr pScreen; BoxPtr pBox; { miPointer.limits = *pBox; miPointer.confined = PointerConfinedToScreen(); } /*ARGSUSED*/ static void miPointerPointerNonInterestBox (pScreen, pBox) ScreenPtr pScreen; BoxPtr pBox; { /* until DIX uses this, this will remain a stub */ } /*ARGSUSED*/ static void miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox) ScreenPtr pScreen; CursorPtr pCursor; BoxPtr pHotBox; BoxPtr pTopLeftBox; { *pTopLeftBox = *pHotBox; } static Bool GenerateEvent; static Bool miPointerSetCursorPosition(pScreen, x, y, generateEvent) ScreenPtr pScreen; int x, y; Bool generateEvent; { SetupScreen (pScreen); GenerateEvent = generateEvent; /* device dependent - must pend signal and call miPointerWarpCursor */ (*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y); if (!generateEvent) miPointerUpdate(); return TRUE; } /* Once signals are ignored, the WarpCursor function can call this */ void miPointerWarpCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { SetupScreen (pScreen); if (miPointer.pScreen != pScreen) (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, TRUE); if (GenerateEvent) { miPointerMove (pScreen, x, y, GetTimeInMillis()); } else { /* everything from miPointerMove except the event and history */ if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) { miPointer.devx = x; miPointer.devy = y; (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } miPointer.x = x; miPointer.y = y; miPointer.pScreen = pScreen; } } /* * Pointer/CursorDisplay interface routines */ int miPointerGetMotionBufferSize () { return MOTION_SIZE; } int miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen) DeviceIntPtr pPtr; xTimecoord *coords; unsigned long start, stop; ScreenPtr pScreen; { int i; int count = 0; miHistoryPtr h; for (i = miPointer.history_start; i != miPointer.history_end;) { h = &miPointer.history[i]; if (h->event.time >= stop) break; if (h->event.time >= start) { *coords++ = h->event; count++; } if (++i == MOTION_SIZE) i = 0; } return count; } /* * miPointerUpdate * * Syncronize the sprite with the cursor - called from ProcessInputEvents */ void miPointerUpdate () { ScreenPtr pScreen; miPointerScreenPtr pScreenPriv; int x, y, devx, devy; pScreen = miPointer.pScreen; x = miPointer.x; y = miPointer.y; devx = miPointer.devx; devy = miPointer.devy; if (!pScreen) return; pScreenPriv = GetScreenPrivate (pScreen); /* * if the cursor has switched screens, disable the sprite * on the old screen */ if (pScreen != miPointer.pSpriteScreen) { if (miPointer.pSpriteScreen) { miPointerScreenPtr pOldPriv; pOldPriv = GetScreenPrivate (miPointer.pSpriteScreen); if (miPointer.pCursor) { (*pOldPriv->spriteFuncs->SetCursor) (miPointer.pSpriteScreen, NullCursor, 0, 0); } (*pOldPriv->screenFuncs->CrossScreen) (miPointer.pSpriteScreen, FALSE); } (*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE); (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, miPointer.pCursor, x, y); miPointer.devx = x; miPointer.devy = y; miPointer.pSpriteCursor = miPointer.pCursor; miPointer.pSpriteScreen = pScreen; } /* * if the cursor has changed, display the new one */ else if (miPointer.pCursor != miPointer.pSpriteCursor) { (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, miPointer.pCursor, x, y); miPointer.devx = x; miPointer.devy = y; miPointer.pSpriteCursor = miPointer.pCursor; } else if (x != devx || y != devy) { miPointer.devx = x; miPointer.devy = y; (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } } /* * miPointerDeltaCursor. The pointer has moved dx,dy from it's previous * position. */ void miPointerDeltaCursor (dx, dy, time) int dx, dy; unsigned long time; { miPointerAbsoluteCursor (miPointer.x + dx, miPointer.y + dy, time); } /* * miPointerAbsoluteCursor. The pointer has moved to x,y */ void miPointerAbsoluteCursor (x, y, time) int x, y; unsigned long time; { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; ScreenPtr newScreen; pScreen = miPointer.pScreen; if (!pScreen) return; /* called before ready */ if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height) { pScreenPriv = GetScreenPrivate (pScreen); if (!miPointer.confined) { newScreen = pScreen; (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y); if (newScreen != pScreen) { pScreen = newScreen; (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE); pScreenPriv = GetScreenPrivate (pScreen); /* Smash the confine to the new screen */ miPointer.limits.x2 = pScreen->width; miPointer.limits.y2 = pScreen->height; } } } /* * constrain the hot-spot to the current * limits */ if (x < miPointer.limits.x1) x = miPointer.limits.x1; if (x >= miPointer.limits.x2) x = miPointer.limits.x2 - 1; if (y < miPointer.limits.y1) y = miPointer.limits.y1; if (y >= miPointer.limits.y2) y = miPointer.limits.y2 - 1; if (miPointer.x == x && miPointer.y == y && miPointer.pScreen == pScreen) return; miPointerMove (pScreen, x, y, time); } void miPointerPosition (x, y) int *x, *y; { *x = miPointer.x; *y = miPointer.y; } /* * miPointerMove. The pointer has moved to x,y on current screen */ static void miPointerMove (pScreen, x, y, time) ScreenPtr pScreen; int x, y; unsigned long time; { SetupScreen(pScreen); xEvent xE; miHistoryPtr history; int prev, end, start; if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen) { miPointer.devx = x; miPointer.devy = y; (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y); } miPointer.x = x; miPointer.y = y; miPointer.pScreen = pScreen; xE.u.u.type = MotionNotify; xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootY = y; xE.u.keyButtonPointer.time = time; (*pScreenPriv->screenFuncs->EnqueueEvent) (&xE); end = miPointer.history_end; start = miPointer.history_start; prev = end - 1; if (end == 0) prev = MOTION_SIZE - 1; history = &miPointer.history[prev]; if (end == start || history->event.time != time) { history = &miPointer.history[end]; if (++end == MOTION_SIZE) end = 0; if (end == start) { start = end + 1; if (start == MOTION_SIZE) start = 0; miPointer.history_start = start; } miPointer.history_end = end; } history->event.x = x; history->event.y = y; history->event.time = time; history->pScreen = pScreen; } void _miRegisterPointerDevice (pScreen, pDevice) ScreenPtr pScreen; DeviceIntPtr pDevice; { miPointer.pPointer = (DevicePtr)pDevice; } /* obsolete: for binary compatibility */ #ifdef miRegisterPointerDevice #undef miRegisterPointerDevice void miRegisterPointerDevice (pScreen, pDevice) ScreenPtr pScreen; DevicePtr pDevice; { miPointer.pPointer = pDevice; } #endif /* miRegisterPointerDevice */ vnc_unixsrc/Xvnc/programs/Xserver/mi/mibitblt.c0100664000076400007640000006143507120677563021303 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mibitblt.c /main/55 1996/08/01 19:25:20 dpw $ */ /* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.1 1996/12/23 07:09:43 dawes Exp $ */ /* Author: Todd Newman (aided and abetted by Mr. Drewry) */ #include "X.h" #include "Xprotostr.h" #include "misc.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "scrnintstr.h" #include "mi.h" #include "regionstr.h" #include "Xmd.h" #include "servermd.h" /* MICOPYAREA -- public entry for the CopyArea request * For each rectangle in the source region * get the pixels with GetSpans * set them in the destination with SetSpans * We let SetSpans worry about clipping to the destination. */ RegionPtr miCopyArea(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GCPtr pGC; int xIn, yIn; int widthSrc, heightSrc; int xOut, yOut; { DDXPointPtr ppt, pptFirst; unsigned int *pwidthFirst, *pwidth, *pbits; BoxRec srcBox, *prect; /* may be a new region, or just a copy */ RegionPtr prgnSrcClip; /* non-0 if we've created a src clip */ RegionPtr prgnExposed; int realSrcClip = 0; int srcx, srcy, dstx, dsty, i, j, y, width, height, xMin, xMax, yMin, yMax; unsigned int *ordering; int numRects; BoxPtr boxes; srcx = xIn + pSrcDrawable->x; srcy = yIn + pSrcDrawable->y; /* If the destination isn't realized, this is easy */ if (pDstDrawable->type == DRAWABLE_WINDOW && !((WindowPtr)pDstDrawable)->realized) return (RegionPtr)NULL; /* clip the source */ if (pSrcDrawable->type == DRAWABLE_PIXMAP) { BoxRec box; box.x1 = pSrcDrawable->x; box.y1 = pSrcDrawable->y; box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; prgnSrcClip = REGION_CREATE(pGC->pScreen, &box, 1); realSrcClip = 1; } else { if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren ((WindowPtr) pSrcDrawable); realSrcClip = 1; } else prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; } /* If the src drawable is a window, we need to translate the srcBox so * that we can compare it with the window's clip region later on. */ srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx + widthSrc; srcBox.y2 = srcy + heightSrc; dstx = xOut; dsty = yOut; if (pGC->miTranslate) { dstx += pDstDrawable->x; dsty += pDstDrawable->y; } pptFirst = ppt = (DDXPointPtr) ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec)); pwidthFirst = pwidth = (unsigned int *) ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int)); numRects = REGION_NUM_RECTS(prgnSrcClip); boxes = REGION_RECTS(prgnSrcClip); ordering = (unsigned int *) ALLOCATE_LOCAL(numRects * sizeof(unsigned int)); if(!pptFirst || !pwidthFirst || !ordering) { if (ordering) DEALLOCATE_LOCAL(ordering); if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); if (pptFirst) DEALLOCATE_LOCAL(pptFirst); return (RegionPtr)NULL; } /* If not the same drawable then order of move doesn't matter. Following assumes that boxes are sorted from top to bottom and left to right. */ if ((pSrcDrawable != pDstDrawable) && ((pGC->subWindowMode != IncludeInferiors) || (pSrcDrawable->type == DRAWABLE_PIXMAP) || (pDstDrawable->type == DRAWABLE_PIXMAP))) for (i=0; i < numRects; i++) ordering[i] = i; else { /* within same drawable, must sequence moves carefully! */ if (dsty <= srcBox.y1) { /* Scroll up or stationary vertical. Vertical order OK */ if (dstx <= srcBox.x1) /* Scroll left or stationary horizontal. Horizontal order OK as well */ for (i=0; i < numRects; i++) ordering[i] = i; else { /* scroll right. must reverse horizontal banding of rects. */ for (i=0, j=1, xMax=0; i < numRects; j=i+1, xMax=i) { /* find extent of current horizontal band */ y=boxes[i].y1; /* band has this y coordinate */ while ((j < numRects) && (boxes[j].y1 == y)) j++; /* reverse the horizontal band in the output ordering */ for (j-- ; j >= xMax; j--, i++) ordering[i] = j; } } } else { /* Scroll down. Must reverse vertical banding. */ if (dstx < srcBox.x1) { /* Scroll left. Horizontal order OK. */ for (i=numRects-1, j=i-1, yMin=i, yMax=0; i >= 0; j=i-1, yMin=i) { /* find extent of current horizontal band */ y=boxes[i].y1; /* band has this y coordinate */ while ((j >= 0) && (boxes[j].y1 == y)) j--; /* reverse the horizontal band in the output ordering */ for (j++ ; j <= yMin; j++, i--, yMax++) ordering[yMax] = j; } } else /* Scroll right or horizontal stationary. Reverse horizontal order as well (if stationary, horizontal order can be swapped without penalty and this is faster to compute). */ for (i=0, j=numRects-1; i < numRects; i++, j--) ordering[i] = j; } } for(i = 0; i < numRects; i++) { prect = &boxes[ordering[i]]; xMin = max(prect->x1, srcBox.x1); xMax = min(prect->x2, srcBox.x2); yMin = max(prect->y1, srcBox.y1); yMax = min(prect->y2, srcBox.y2); /* is there anything visible here? */ if(xMax <= xMin || yMax <= yMin) continue; ppt = pptFirst; pwidth = pwidthFirst; y = yMin; height = yMax - yMin; width = xMax - xMin; for(j = 0; j < height; j++) { /* We must untranslate before calling GetSpans */ ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } pbits = (unsigned int *)xalloc(height * PixmapBytePad(width, pSrcDrawable->depth)); if (pbits) { (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst, (int *)pwidthFirst, height, (char *)pbits); ppt = pptFirst; pwidth = pwidthFirst; xMin -= (srcx - dstx); y = yMin - (srcy - dsty); for(j = 0; j < height; j++) { ppt->x = xMin; ppt++->y = y++; *pwidth++ = width; } (*pGC->ops->SetSpans)(pDstDrawable, pGC, (char *)pbits, pptFirst, (int *)pwidthFirst, height, TRUE); xfree(pbits); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut, (unsigned long)0); if(realSrcClip) REGION_DESTROY(pGC->pScreen, prgnSrcClip); DEALLOCATE_LOCAL(ordering); DEALLOCATE_LOCAL(pwidthFirst); DEALLOCATE_LOCAL(pptFirst); return prgnExposed; } /* MIGETPLANE -- gets a bitmap representing one plane of pDraw * A helper used for CopyPlane and XY format GetImage * No clever strategy here, we grab a scanline at a time, pull out the * bits and then stuff them in a 1 bit deep map. */ static unsigned long * miGetPlane(pDraw, planeNum, sx, sy, w, h, result) DrawablePtr pDraw; int planeNum; /* number of the bitPlane */ int sx, sy, w, h; unsigned long *result; { int i, j, k, width, bitsPerPixel, widthInBytes; DDXPointRec pt; unsigned long pixel; unsigned long bit; unsigned char *pCharsOut; #if BITMAP_SCANLINE_UNIT == 8 #define OUT_TYPE unsigned char #endif #if BITMAP_SCANLINE_UNIT == 16 #define OUT_TYPE CARD16 #endif #if BITMAP_SCANLINE_UNIT == 32 #define OUT_TYPE CARD32 #endif #if BITMAP_SCANLINE_UNIT == 64 #define OUT_TYPE CARD64 #endif OUT_TYPE *pOut; int delta; sx += pDraw->x; sy += pDraw->y; widthInBytes = BitmapBytePad(w); if(!result) result = (unsigned long *)xalloc(h * widthInBytes); if (!result) return (unsigned long *)NULL; bitsPerPixel = pDraw->bitsPerPixel; bzero((char *)result, h * widthInBytes); pOut = (OUT_TYPE *) result; if(bitsPerPixel == 1) { pCharsOut = (unsigned char *) result; width = w; } else { delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) - (w / BITMAP_SCANLINE_UNIT); width = 1; #if IMAGE_BYTE_ORDER == MSBFirst planeNum += (32 - bitsPerPixel); #endif } pt.y = sy; for (i = h; --i >= 0; pt.y++) { pt.x = sx; if(bitsPerPixel == 1) { (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1, (char *)pCharsOut); pCharsOut += widthInBytes; } else { k = 0; for(j = w; --j >= 0; pt.x++) { /* Fetch the next pixel */ (*pDraw->pScreen->GetSpans)(pDraw, width, &pt, &width, 1, (char *)&pixel); /* * Now get the bit and insert into a bitmap in XY format. */ bit = (pixel >> planeNum) & 1; /* XXX assuming bit order == byte order */ #if BITMAP_BIT_ORDER == LSBFirst bit <<= k; #else bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k); #endif *pOut |= (OUT_TYPE) bit; k++; if (k == BITMAP_SCANLINE_UNIT) { pOut++; k = 0; } } pOut += delta; } } return(result); } /* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw. * Drawing through the clip mask we SetSpans() the bits into a * bitmap and stipple those bits onto the destination drawable by doing a * PolyFillRect over the whole drawable, * then we invert the bitmap by copying it onto itself with an alu of * GXinvert, invert the foreground/background colors of the gc, and draw * the background bits. * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ void miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) DrawablePtr pDraw; GCPtr pGC; RegionPtr prgnSrc; unsigned long *pbits; int srcx, w, h, dstx, dsty; { int oldfill, i; unsigned long oldfg; int *pwidth, *pwidthFirst; ChangeGCVal gcv[6]; PixmapPtr pStipple, pPixmap; DDXPointRec oldOrg; GCPtr pGCT; DDXPointPtr ppt, pptFirst; xRectangle rect; RegionPtr prgnSrcClip; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w + srcx, h, 1); if (!pPixmap) return; /* Put the image into a 1 bit deep pixmap */ pGCT = GetScratchGC(1, pDraw->pScreen); if (!pGCT) { (*pDraw->pScreen->DestroyPixmap)(pPixmap); return; } /* First set the whole pixmap to 0 */ gcv[0].val = 0; dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT); ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); if (pptFirst) DEALLOCATE_LOCAL(pptFirst); FreeScratchGC(pGCT); return; } /* we need a temporary region because ChangeClip must be assumed to destroy what it's sent. note that this means we don't have to free prgnSrcClip ourselves. */ prgnSrcClip = REGION_CREATE(pGCT->pScreen, NULL, 0); REGION_COPY(pGCT->pScreen, prgnSrcClip, prgnSrc); REGION_TRANSLATE(pGCT->pScreen, prgnSrcClip, srcx, 0); (*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0); ValidateGC((DrawablePtr)pPixmap, pGCT); /* Since we know pDraw is always a pixmap, we never need to think * about translation here */ for(i = 0; i < h; i++) { ppt->x = 0; ppt++->y = i; *pwidth++ = w + srcx; } (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits, pptFirst, pwidthFirst, h, TRUE); DEALLOCATE_LOCAL(pwidthFirst); DEALLOCATE_LOCAL(pptFirst); /* Save current values from the client GC */ oldfill = pGC->fillStyle; pStipple = pGC->stipple; if(pStipple) pStipple->refcnt++; oldOrg = pGC->patOrg; /* Set a new stipple in the drawable */ gcv[0].val = FillStippled; gcv[1].ptr = pPixmap; gcv[2].val = dstx - srcx; gcv[3].val = dsty; dixChangeGC(NullClient, pGC, GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, NULL, gcv); ValidateGC(pDraw, pGC); /* Fill the drawable with the stipple. This will draw the * foreground color whereever 1 bits are set, leaving everything * with 0 bits untouched. Note that the part outside the clip * region is all 0s. */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); /* Invert the tiling pixmap. This sets 0s for 1s and 1s for 0s, only * within the clipping region, the part outside is still all 0s */ gcv[0].val = GXinvert; dixChangeGC(NullClient, pGCT, GCFunction, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); (*pGCT->ops->CopyArea)((DrawablePtr)pPixmap, (DrawablePtr)pPixmap, pGCT, 0, 0, w + srcx, h, 0, 0); /* Swap foreground and background colors on the GC for the drawable. * Now when we fill the drawable, we will fill in the "Background" * values */ oldfg = pGC->fgPixel; gcv[0].val = pGC->bgPixel; gcv[1].val = oldfg; gcv[2].ptr = pPixmap; dixChangeGC(NullClient, pGC, GCForeground | GCBackground | GCStipple, NULL, gcv); ValidateGC(pDraw, pGC); /* PolyFillRect might have bashed the rectangle */ rect.x = dstx; rect.y = dsty; rect.width = w; rect.height = h; (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); /* Now put things back */ if(pStipple) pStipple->refcnt--; gcv[0].val = oldfg; gcv[1].val = pGC->fgPixel; gcv[2].val = oldfill; gcv[3].ptr = pStipple; gcv[4].val = oldOrg.x; gcv[5].val = oldOrg.y; dixChangeGC(NullClient, pGC, GCForeground | GCBackground | GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin, NULL, gcv); ValidateGC(pDraw, pGC); /* put what we hope is a smaller clip region back in the scratch gc */ (*pGCT->funcs->ChangeClip)(pGCT, CT_NONE, NULL, 0); FreeScratchGC(pGCT); (*pDraw->pScreen->DestroyPixmap)(pPixmap); } /* MICOPYPLANE -- public entry for the CopyPlane request. * strategy: * First build up a bitmap out of the bits requested * build a source clip * Use the bitmap we've built up as a Stipple for the destination */ RegionPtr miCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) DrawablePtr pSrcDrawable; DrawablePtr pDstDrawable; GCPtr pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long bitPlane; { unsigned long *ptile; BoxRec box; RegionPtr prgnSrc, prgnExposed; /* incorporate the source clip */ box.x1 = srcx + pSrcDrawable->x; box.y1 = srcy + pSrcDrawable->y; box.x2 = box.x1 + width; box.y2 = box.y1 + height; /* clip to visible drawable */ if (box.x1 < pSrcDrawable->x) box.x1 = pSrcDrawable->x; if (box.y1 < pSrcDrawable->y) box.y1 = pSrcDrawable->y; if (box.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; if (box.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1); if (pSrcDrawable->type != DRAWABLE_PIXMAP) { /* clip to visible drawable */ if (pGC->subWindowMode == IncludeInferiors) { RegionPtr clipList = NotClippedByChildren ((WindowPtr) pSrcDrawable); REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc, clipList); REGION_DESTROY(pGC->pScreen, clipList); } else REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc, &((WindowPtr)pSrcDrawable)->clipList); } box = *REGION_EXTENTS(pGC->pScreen, prgnSrc); REGION_TRANSLATE(pGC->pScreen, prgnSrc, -box.x1, -box.y1); if ((box.x2 > box.x1) && (box.y2 > box.y1)) { /* minimize the size of the data extracted */ /* note that we convert the plane mask bitPlane into a plane number */ box.x1 -= pSrcDrawable->x; box.x2 -= pSrcDrawable->x; box.y1 -= pSrcDrawable->y; box.y2 -= pSrcDrawable->y; ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1, (unsigned long *) NULL); if (ptile) { miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0, box.x2 - box.x1, box.y2 - box.y1, dstx + box.x1 - srcx, dsty + box.y1 - srcy); xfree(ptile); } } prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); REGION_DESTROY(pGC->pScreen, prgnSrc); return prgnExposed; } /* MIGETIMAGE -- public entry for the GetImage Request * We're getting the image into a memory buffer. While we have to use GetSpans * to read a line from the device (since we don't know what that looks like), * we can just write into the destination buffer * * two different strategies are used, depending on whether we're getting the * image in Z format or XY format * Z format: * Line at a time, GetSpans a line into the destination buffer, then if the * planemask is not all ones, we do a SetSpans into a temporary buffer (to get * bits turned off) and then another GetSpans to get stuff back (because * pixmaps are opaque, and we are passed in the memory to write into). This is * pretty ugly and slow but works. Life is hard. * XY format: * get the single plane specified in planemask */ void miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst) DrawablePtr pDraw; int sx, sy, w, h; unsigned int format; unsigned long planeMask; char * pDst; { unsigned char depth; int i, linelength, width, srcx, srcy; DDXPointRec pt; XID gcv[2]; PixmapPtr pPixmap = (PixmapPtr)NULL; GCPtr pGC; depth = pDraw->depth; if(format == ZPixmap) { if ( (((1<pScreen); if (!pGC) return; pPixmap = (*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, w, 1, depth); if (!pPixmap) { FreeScratchGC(pGC); return; } /* * Clear the pixmap before doing anything else */ ValidateGC((DrawablePtr)pPixmap, pGC); pt.x = pt.y = 0; (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &pt, &width, TRUE); /* alu is already GXCopy */ gcv[0] = (XID)planeMask; DoChangeGC(pGC, GCPlaneMask, gcv, 0); ValidateGC((DrawablePtr)pPixmap, pGC); } linelength = PixmapBytePad(w, depth); srcx = sx + pDraw->x; srcy = sy + pDraw->y; for(i = 0; i < h; i++) { pt.x = srcx; pt.y = srcy + i; width = w; (*pDraw->pScreen->GetSpans)(pDraw, w, &pt, &width, 1, pDst); if (pPixmap) { pt.x = 0; pt.y = 0; width = w; (*pGC->ops->SetSpans)((DrawablePtr)pPixmap, pGC, pDst, &pt, &width, 1, TRUE); (*pDraw->pScreen->GetSpans)((DrawablePtr)pPixmap, w, &pt, &width, 1, pDst); } pDst += linelength; } if (pPixmap) { (*pGC->pScreen->DestroyPixmap)(pPixmap); FreeScratchGC(pGC); } } else { (void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h, (unsigned long *)pDst); } } /* MIPUTIMAGE -- public entry for the PutImage request * Here we benefit from knowing the format of the bits pointed to by pImage, * even if we don't know how pDraw represents them. * Three different strategies are used depending on the format * XYBitmap Format: * we just use the Opaque Stipple helper function to cover the destination * Note that this covers all the planes of the drawable with the * foreground color (masked with the GC planemask) where there are 1 bits * and the background color (masked with the GC planemask) where there are * 0 bits * XYPixmap format: * what we're called with is a series of XYBitmaps, but we only want * each XYPixmap to update 1 plane, instead of updating all of them. * we set the foreground color to be all 1s and the background to all 0s * then for each plane, we set the plane mask to only effect that one * plane and recursive call ourself with the format set to XYBitmap * (This clever idea courtesy of RGD.) * ZPixmap format: * This part is simple, just call SetSpans */ void miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) DrawablePtr pDraw; GCPtr pGC; int depth, x, y, w, h, leftPad; int format; char *pImage; { DDXPointPtr pptFirst, ppt; int *pwidthFirst, *pwidth; RegionPtr prgnSrc; BoxRec box; unsigned long oldFg, oldBg; XID gcv[3]; unsigned long oldPlanemask; unsigned long i; long bytesPer; if (!w || !h) return; switch(format) { case XYBitmap: box.x1 = 0; box.y1 = 0; box.x2 = w; box.y2 = h; prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1); miOpqStipDrawable(pDraw, pGC, prgnSrc, (unsigned long *) pImage, leftPad, w, h, x, y); REGION_DESTROY(pGC->pScreen, prgnSrc); break; case XYPixmap: depth = pGC->depth; oldPlanemask = pGC->planemask; oldFg = pGC->fgPixel; oldBg = pGC->bgPixel; gcv[0] = (XID)~0; gcv[1] = (XID)0; DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0); bytesPer = (long)h * BitmapBytePad(w + leftPad); for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer) { if (i & oldPlanemask) { gcv[0] = (XID)i; DoChangeGC(pGC, GCPlaneMask, gcv, 0); ValidateGC(pDraw, pGC); (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad, XYBitmap, (char *)pImage); } } gcv[0] = (XID)oldPlanemask; gcv[1] = (XID)oldFg; gcv[2] = (XID)oldBg; DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0); break; case ZPixmap: ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); if (pptFirst) DEALLOCATE_LOCAL(pptFirst); return; } if (pGC->miTranslate) { x += pDraw->x; y += pDraw->y; } for(i = 0; i < h; i++) { ppt->x = x; ppt->y = y + i; ppt++; *pwidth++ = w; } (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst, pwidthFirst, h, TRUE); DEALLOCATE_LOCAL(pwidthFirst); DEALLOCATE_LOCAL(pptFirst); break; } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mifillarc.h0100664000076400007640000001247207120677563021441 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mifillarc.h,v 5.9 95/01/11 16:19:24 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.2 1995/01/28 16:15:53 dawes Exp $ */ #define FULLCIRCLE (360 * 64) typedef struct _miFillArc { int xorg, yorg; int y; int dx, dy; int e; int ym, yk, xm, xk; } miFillArcRec; /* could use 64-bit integers */ typedef struct _miFillArcD { int xorg, yorg; int y; int dx, dy; double e; double ym, yk, xm, xk; } miFillArcDRec; #define miFillArcEmpty(arc) (!(arc)->angle2 || \ !(arc)->width || !(arc)->height || \ (((arc)->width == 1) && ((arc)->height & 1))) #define miCanFillArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIFILLARCSETUP() \ x = 0; \ y = info.y; \ e = info.e; \ xk = info.xk; \ xm = info.xm; \ yk = info.yk; \ ym = info.ym; \ dx = info.dx; \ dy = info.dy; \ xorg = info.xorg; \ yorg = info.yorg #define MIFILLARCSTEP(slw) \ e += yk; \ while (e >= 0) \ { \ x++; \ xk -= xm; \ e += xk; \ } \ y--; \ yk -= ym; \ slw = (x << 1) + dx; \ if ((e == xk) && (slw > 1)) \ slw-- #define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw) #define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw) #define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk))) typedef struct _miSliceEdge { int x; int stepx; int deltax; int e; int dy; int dx; } miSliceEdgeRec, *miSliceEdgePtr; typedef struct _miArcSlice { miSliceEdgeRec edge1, edge2; int min_top_y, max_top_y; int min_bot_y, max_bot_y; Bool edge1_top, edge2_top; Bool flip_top, flip_bot; } miArcSliceRec; #define MIARCSLICESTEP(edge) \ edge.x -= edge.stepx; \ edge.e -= edge.dx; \ if (edge.e <= 0) \ { \ edge.x -= edge.deltax; \ edge.e += edge.dy; \ } #define miFillSliceUpper(slice) \ ((y >= slice.min_top_y) && (y <= slice.max_top_y)) #define miFillSliceLower(slice) \ ((y >= slice.min_bot_y) && (y <= slice.max_bot_y)) #define MIARCSLICEUPPER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (slice.edge1_top && (slice.edge1.x < xr)) \ xr = slice.edge1.x; \ if (slice.edge2_top && (slice.edge2.x > xl)) \ xl = slice.edge2.x; #define MIARCSLICELOWER(xl,xr,slice,slw) \ xl = xorg - x; \ xr = xl + slw - 1; \ if (!slice.edge1_top && (slice.edge1.x > xl)) \ xl = slice.edge1.x; \ if (!slice.edge2_top && (slice.edge2.x < xr)) \ xr = slice.edge2.x; #define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \ x = 0; \ y = slw >> 1; \ yk = y << 3; \ xm = 8; \ ym = 8; \ if (dy) \ { \ xk = 0; \ if (slw & 1) \ e = -1; \ else \ e = -(y << 2) - 2; \ } \ else \ { \ y++; \ yk += 4; \ xk = -4; \ if (slw & 1) \ e = -(y << 2) - 3; \ else \ e = - (y << 3); \ } #define MIFILLINARCSTEP(slw) \ ine += inyk; \ while (ine >= 0) \ { \ inx++; \ inxk -= inxm; \ ine += inxk; \ } \ iny--; \ inyk -= inym; \ slw = (inx << 1) + dx; \ if ((ine == inxk) && (slw > 1)) \ slw-- #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) extern int miFreeArcCache( #if NeedFunctionPrototypes pointer /*data*/, XID /*id*/ #endif ); extern struct finalSpan *realAllocSpan( #if NeedFunctionPrototypes void #endif ); extern void miFillArcSetup( #if NeedFunctionPrototypes xArc * /*arc*/, miFillArcRec * /*info*/ #endif ); extern void miFillArcDSetup( #if NeedFunctionPrototypes xArc * /*arc*/, miFillArcDRec * /*info*/ #endif ); extern void miEllipseAngleToSlope( #if NeedFunctionPrototypes int /*angle*/, int /*width*/, int /*height*/, int * /*dxp*/, int * /*dyp*/, double * /*d_dxp*/, double * /*d_dyp*/ #endif ); extern void miFillArcSliceSetup( #if NeedFunctionPrototypes xArc * /*arc*/, miArcSliceRec * /*slice*/, GCPtr /*pGC*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolyutil.c0100664000076400007640000002477007120677563021705 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolyutil.c,v 1.16 94/04/17 20:27:46 dpw Exp $ */ #include "miscstruct.h" #include "gc.h" #include "miscanfill.h" #include "mipoly.h" #define MAXINT 0x7fffffff #define MININT -MAXINT /* * fillUtils.c * * Written by Brian Kelleher; Oct. 1985 * * This module contains all of the utility functions * needed to scan convert a polygon. * */ /* * InsertEdgeInET * * Insert the given edge into the edge table. * First we must find the correct bucket in the * Edge table, then find the right slot in the * bucket. Finally, we can insert it. * */ Bool miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock) EdgeTable *ET; EdgeTableEntry *ETE; int scanline; ScanLineListBlock **SLLBlock; int *iSLLBlock; { register EdgeTableEntry *start, *prev; register ScanLineList *pSLL, *pPrevSLL; ScanLineListBlock *tmpSLLBlock; /* * find the right bucket to put the edge into */ pPrevSLL = &ET->scanlines; pSLL = pPrevSLL->next; while (pSLL && (pSLL->scanline < scanline)) { pPrevSLL = pSLL; pSLL = pSLL->next; } /* * reassign pSLL (pointer to ScanLineList) if necessary */ if ((!pSLL) || (pSLL->scanline > scanline)) { if (*iSLLBlock > SLLSPERBLOCK-1) { tmpSLLBlock = (ScanLineListBlock *)xalloc(sizeof(ScanLineListBlock)); if (!tmpSLLBlock) return FALSE; (*SLLBlock)->next = tmpSLLBlock; tmpSLLBlock->next = (ScanLineListBlock *)NULL; *SLLBlock = tmpSLLBlock; *iSLLBlock = 0; } pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); pSLL->next = pPrevSLL->next; pSLL->edgelist = (EdgeTableEntry *)NULL; pPrevSLL->next = pSLL; } pSLL->scanline = scanline; /* * now insert the edge in the right bucket */ prev = (EdgeTableEntry *)NULL; start = pSLL->edgelist; while (start && (start->bres.minor < ETE->bres.minor)) { prev = start; start = start->next; } ETE->next = start; if (prev) prev->next = ETE; else pSLL->edgelist = ETE; return TRUE; } /* * CreateEdgeTable * * This routine creates the edge table for * scan converting polygons. * The Edge Table (ET) looks like: * * EdgeTable * -------- * | ymax | ScanLineLists * |scanline|-->------------>-------------->... * -------- |scanline| |scanline| * |edgelist| |edgelist| * --------- --------- * | | * | | * V V * list of ETEs list of ETEs * * where ETE is an EdgeTableEntry data structure, * and there is one ScanLineList per scanline at * which an edge is initially entered. * */ Bool miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock) register int count; register DDXPointPtr pts; EdgeTable *ET; EdgeTableEntry *AET; register EdgeTableEntry *pETEs; ScanLineListBlock *pSLLBlock; { register DDXPointPtr top, bottom; register DDXPointPtr PrevPt, CurrPt; int iSLLBlock = 0; int dy; if (count < 2) return TRUE; /* * initialize the Active Edge Table */ AET->next = (EdgeTableEntry *)NULL; AET->back = (EdgeTableEntry *)NULL; AET->nextWETE = (EdgeTableEntry *)NULL; AET->bres.minor = MININT; /* * initialize the Edge Table. */ ET->scanlines.next = (ScanLineList *)NULL; ET->ymax = MININT; ET->ymin = MAXINT; pSLLBlock->next = (ScanLineListBlock *)NULL; PrevPt = &pts[count-1]; /* * for each vertex in the array of points. * In this loop we are dealing with two vertices at * a time -- these make up one edge of the polygon. */ while (count--) { CurrPt = pts++; /* * find out which point is above and which is below. */ if (PrevPt->y > CurrPt->y) { bottom = PrevPt, top = CurrPt; pETEs->ClockWise = 0; } else { bottom = CurrPt, top = PrevPt; pETEs->ClockWise = 1; } /* * don't add horizontal edges to the Edge table. */ if (bottom->y != top->y) { pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ /* * initialize integer edge algorithm */ dy = bottom->y - top->y; BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) { miFreeStorage(pSLLBlock->next); return FALSE; } ET->ymax = max(ET->ymax, PrevPt->y); ET->ymin = min(ET->ymin, PrevPt->y); pETEs++; } PrevPt = CurrPt; } return TRUE; } /* * loadAET * * This routine moves EdgeTableEntries from the * EdgeTable into the Active Edge Table, * leaving them sorted by smaller x coordinate. * */ void miloadAET(AET, ETEs) register EdgeTableEntry *AET, *ETEs; { register EdgeTableEntry *pPrevAET; register EdgeTableEntry *tmp; pPrevAET = AET; AET = AET->next; while (ETEs) { while (AET && (AET->bres.minor < ETEs->bres.minor)) { pPrevAET = AET; AET = AET->next; } tmp = ETEs->next; ETEs->next = AET; if (AET) AET->back = ETEs; ETEs->back = pPrevAET; pPrevAET->next = ETEs; pPrevAET = ETEs; ETEs = tmp; } } /* * computeWAET * * This routine links the AET by the * nextWETE (winding EdgeTableEntry) link for * use by the winding number rule. The final * Active Edge Table (AET) might look something * like: * * AET * ---------- --------- --------- * |ymax | |ymax | |ymax | * | ... | |... | |... | * |next |->|next |->|next |->... * |nextWETE| |nextWETE| |nextWETE| * --------- --------- ^-------- * | | | * V-------------------> V---> ... * */ void micomputeWAET(AET) register EdgeTableEntry *AET; { register EdgeTableEntry *pWETE; register int inside = 1; register int isInside = 0; AET->nextWETE = (EdgeTableEntry *)NULL; pWETE = AET; AET = AET->next; while (AET) { if (AET->ClockWise) isInside++; else isInside--; if ((!inside && !isInside) || ( inside && isInside)) { pWETE->nextWETE = AET; pWETE = AET; inside = !inside; } AET = AET->next; } pWETE->nextWETE = (EdgeTableEntry *)NULL; } /* * InsertionSort * * Just a simple insertion sort using * pointers and back pointers to sort the Active * Edge Table. * */ int miInsertionSort(AET) register EdgeTableEntry *AET; { register EdgeTableEntry *pETEchase; register EdgeTableEntry *pETEinsert; register EdgeTableEntry *pETEchaseBackTMP; register int changed = 0; AET = AET->next; while (AET) { pETEinsert = AET; pETEchase = AET; while (pETEchase->back->bres.minor > AET->bres.minor) pETEchase = pETEchase->back; AET = AET->next; if (pETEchase != pETEinsert) { pETEchaseBackTMP = pETEchase->back; pETEinsert->back->next = AET; if (AET) AET->back = pETEinsert->back; pETEinsert->next = pETEchase; pETEchase->back->next = pETEinsert; pETEchase->back = pETEinsert; pETEinsert->back = pETEchaseBackTMP; changed = 1; } } return(changed); } /* * Clean up our act. */ void miFreeStorage(pSLLBlock) register ScanLineListBlock *pSLLBlock; { register ScanLineListBlock *tmpSLLBlock; while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; xfree(pSLLBlock); pSLLBlock = tmpSLLBlock; } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mispritest.h0100664000076400007640000000675007120677563021704 0ustar constconst/* * mispritest.h * * mi sprite structures */ /* $XConsortium: mispritest.h,v 5.14 94/04/17 20:27:55 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # include "misprite.h" /* * per screen information */ typedef struct { CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; CreateGCProcPtr CreateGC; ScreenBlockHandlerProcPtr BlockHandler; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; SaveDoomedAreasProcPtr SaveDoomedAreas; RestoreAreasProcPtr RestoreAreas; CursorPtr pCursor; int x; int y; BoxRec saved; Bool isUp; Bool shouldBeUp; WindowPtr pCacheWin; Bool isInCacheWin; Bool checkPixels; xColorItem colors[2]; ColormapPtr pInstalledMap; ColormapPtr pColormap; VisualPtr pVisual; miSpriteCursorFuncPtr funcs; } miSpriteScreenRec, *miSpriteScreenPtr; #define SOURCE_COLOR 0 #define MASK_COLOR 1 typedef struct { GCFuncs *wrapFuncs; GCOps *wrapOps; } miSpriteGCRec, *miSpriteGCPtr; /* * Overlap BoxPtr and Box elements */ #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \ (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \ ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2)) /* * Overlap BoxPtr, origins, and rectangle */ #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \ BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h)) /* * Overlap BoxPtr, origins and RectPtr */ #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \ ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \ (int)((pRect)->width), (int)((pRect)->height)) /* * Overlap BoxPtr and horizontal span */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) #define LINE_SORT(x1,y1,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \ BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2)) vnc_unixsrc/Xvnc/programs/Xserver/mi/mipoly.c0100664000076400007640000000756707120677563021014 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipoly.c,v 5.1 94/04/17 20:27:41 keith Exp $ */ /* * mipoly.c * * Written by Brian Kelleher; June 1986 * * Draw polygons. This routine translates the point by the * origin if pGC->miTranslate is non-zero, and calls * to the appropriate routine to actually scan convert the * polygon. */ #include "X.h" #include "windowstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "miscstruct.h" void miFillPolygon(dst, pgc, shape, mode, count, pPts) DrawablePtr dst; register GCPtr pgc; int shape, mode; register int count; DDXPointPtr pPts; { int i; register int xorg, yorg; register DDXPointPtr ppt; if (count == 0) return; ppt = pPts; if (pgc->miTranslate) { xorg = dst->x; yorg = dst->y; if (mode == CoordModeOrigin) { for (i = 0; ix += xorg; ppt++->y += yorg; } } else { ppt->x += xorg; ppt++->y += yorg; for (i = 1; ix += (ppt-1)->x; ppt->y += (ppt-1)->y; ppt++; } } } else { if (mode == CoordModePrevious) { ppt++; for (i = 1; ix += (ppt-1)->x; ppt->y += (ppt-1)->y; ppt++; } } } if (shape == Convex) miFillConvexPoly(dst, pgc, count, pPts); else miFillGeneralPoly(dst, pgc, count, pPts); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miregion.c0100664000076400007640000017726107120677563021313 0ustar constconst/*********************************************************** Copyright (c) 1987, 1988, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miregion.c,v 1.60 94/04/17 20:27:49 dpw Exp $ */ #include #include "miscstruct.h" #include "regionstr.h" #include "Xprotostr.h" #include "gc.h" #if defined (__GNUC__) && !defined (NO_INLINES) #define INLINE __inline #else #define INLINE #endif /* * hack until callers of these functions can deal with out-of-memory */ extern Bool Must_have_memory; #ifdef DEBUG #define assert(expr) {if (!(expr)) \ FatalError("Assertion failed file %s, line %d: expr\n", \ __FILE__, __LINE__); } #else #define assert(expr) #endif #define good(reg) assert(miValidRegion(reg)) /* * The functions in this file implement the Region abstraction used extensively * throughout the X11 sample server. A Region is simply a set of disjoint * (non-overlapping) rectangles, plus an "extent" rectangle which is the * smallest single rectangle that contains all the non-overlapping rectangles. * * A Region is implemented as a "y-x-banded" array of rectangles. This array * imposes two degrees of order. First, all rectangles are sorted by top side * y coordinate first (y1), and then by left side x coordinate (x1). * * Furthermore, the rectangles are grouped into "bands". Each rectangle in a * band has the same top y coordinate (y1), and each has the same bottom y * coordinate (y2). Thus all rectangles in a band differ only in their left * and right side (x1 and x2). Bands are implicit in the array of rectangles: * there is no separate list of band start pointers. * * The y-x band representation does not minimize rectangles. In particular, * if a rectangle vertically crosses a band (the rectangle has scanlines in * the y1 to y2 area spanned by the band), then the rectangle may be broken * down into two or more smaller rectangles stacked one atop the other. * * ----------- ----------- * | | | | band 0 * | | -------- ----------- -------- * | | | | in y-x banded | | | | band 1 * | | | | form is | | | | * ----------- | | ----------- -------- * | | | | band 2 * -------- -------- * * An added constraint on the rectangles is that they must cover as much * horizontal area as possible: no two rectangles within a band are allowed * to touch. * * Whenever possible, bands will be merged together to cover a greater vertical * distance (and thus reduce the number of rectangles). Two bands can be merged * only if the bottom of one touches the top of the other and they have * rectangles in the same places (of the same width, of course). * * Adam de Boor wrote most of the original region code. Joel McCormack * substantially modified or rewrote most of the core arithmetic routines, * and added miRegionValidate in order to support several speed improvements * to miValidateTree. Bob Scheifler changed the representation to be more * compact when empty or a single rectangle, and did a bunch of gratuitous * reformatting. */ /* true iff two Boxes overlap */ #define EXTENTCHECK(r1,r2) \ (!( ((r1)->x2 <= (r2)->x1) || \ ((r1)->x1 >= (r2)->x2) || \ ((r1)->y2 <= (r2)->y1) || \ ((r1)->y1 >= (r2)->y2) ) ) /* true iff (x,y) is in Box */ #define INBOX(r,x,y) \ ( ((r)->x2 > x) && \ ((r)->x1 <= x) && \ ((r)->y2 > y) && \ ((r)->y1 <= y) ) /* true iff Box r1 contains Box r2 */ #define SUBSUMES(r1,r2) \ ( ((r1)->x1 <= (r2)->x1) && \ ((r1)->x2 >= (r2)->x2) && \ ((r1)->y1 <= (r2)->y1) && \ ((r1)->y2 >= (r2)->y2) ) #define xallocData(n) (RegDataPtr)xalloc(REGION_SZOF(n)) #define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data) #define RECTALLOC(pReg,n) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ miRectAlloc(pReg, n) #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \ { \ pNextRect->x1 = nx1; \ pNextRect->y1 = ny1; \ pNextRect->x2 = nx2; \ pNextRect->y2 = ny2; \ pNextRect++; \ } #define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \ { \ if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\ { \ miRectAlloc(pReg, 1); \ pNextRect = REGION_TOP(pReg); \ } \ ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \ pReg->data->numRects++; \ assert(pReg->data->numRects<=pReg->data->size); \ } #define DOWNSIZE(reg,numRects) \ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ { \ RegDataPtr NewData; \ NewData = (RegDataPtr)xrealloc((reg)->data, REGION_SZOF(numRects)); \ if (NewData) \ { \ NewData->size = (numRects); \ (reg)->data = NewData; \ } \ } BoxRec miEmptyBox = {0, 0, 0, 0}; RegDataRec miEmptyData = {0, 0}; #ifdef DEBUG int miPrintRegion(rgn) RegionPtr rgn; { int num, size; register int i; BoxPtr rects; num = REGION_NUM_RECTS(rgn); size = REGION_SIZE(rgn); rects = REGION_RECTS(rgn); ErrorF("num: %d size: %d\n", num, size); ErrorF("extents: %d %d %d %d\n", rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2); for (i = 0; i < num; i++) ErrorF("%d %d %d %d \n", rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2); ErrorF("\n"); return(num); } Bool miRegionsEqual(reg1, reg2) RegionPtr reg1; RegionPtr reg2; { int i; BoxPtr rects1, rects2; if (reg1->extents.x1 != reg2->extents.x1) return FALSE; if (reg1->extents.x2 != reg2->extents.x2) return FALSE; if (reg1->extents.y1 != reg2->extents.y1) return FALSE; if (reg1->extents.y2 != reg2->extents.y2) return FALSE; if (REGION_NUM_RECTS(reg1) != REGION_NUM_RECTS(reg2)) return FALSE; rects1 = REGION_RECTS(reg1); rects2 = REGION_RECTS(reg2); for (i = 0; i != REGION_NUM_RECTS(reg1); i++) { if (rects1[i].x1 != rects2[i].x1) return FALSE; if (rects1[i].x2 != rects2[i].x2) return FALSE; if (rects1[i].y1 != rects2[i].y1) return FALSE; if (rects1[i].y2 != rects2[i].y2) return FALSE; } return TRUE; } Bool miValidRegion(reg) RegionPtr reg; { register int i, numRects; if ((reg->extents.x1 > reg->extents.x2) || (reg->extents.y1 > reg->extents.y2)) return FALSE; numRects = REGION_NUM_RECTS(reg); if (!numRects) return ((reg->extents.x1 == reg->extents.x2) && (reg->extents.y1 == reg->extents.y2) && (reg->data->size || (reg->data == &miEmptyData))); else if (numRects == 1) return (!reg->data); else { register BoxPtr pboxP, pboxN; BoxRec box; pboxP = REGION_RECTS(reg); box = *pboxP; box.y2 = pboxP[numRects-1].y2; pboxN = pboxP + 1; for (i = numRects; --i > 0; pboxP++, pboxN++) { if ((pboxN->x1 >= pboxN->x2) || (pboxN->y1 >= pboxN->y2)) return FALSE; if (pboxN->x1 < box.x1) box.x1 = pboxN->x1; if (pboxN->x2 > box.x2) box.x2 = pboxN->x2; if ((pboxN->y1 < pboxP->y1) || ((pboxN->y1 == pboxP->y1) && ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2)))) return FALSE; } return ((box.x1 == reg->extents.x1) && (box.x2 == reg->extents.x2) && (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2)); } } #endif /* DEBUG */ /***************************************************************** * RegionCreate(rect, size) * This routine does a simple malloc to make a structure of * REGION of "size" number of rectangles. *****************************************************************/ RegionPtr miRegionCreate(rect, size) BoxPtr rect; int size; { register RegionPtr pReg; Must_have_memory = TRUE; /* XXX */ pReg = (RegionPtr)xalloc(sizeof(RegionRec)); Must_have_memory = FALSE; /* XXX */ if (rect) { pReg->extents = *rect; pReg->data = (RegDataPtr)NULL; } else { pReg->extents = miEmptyBox; if ((size > 1) && (pReg->data = xallocData(size))) { pReg->data->size = size; pReg->data->numRects = 0; } else pReg->data = &miEmptyData; } return(pReg); } /***************************************************************** * RegionInit(pReg, rect, size) * Outer region rect is statically allocated. *****************************************************************/ void miRegionInit(pReg, rect, size) RegionPtr pReg; BoxPtr rect; int size; { if (rect) { pReg->extents = *rect; pReg->data = (RegDataPtr)NULL; } else { pReg->extents = miEmptyBox; if ((size > 1) && (pReg->data = xallocData(size))) { pReg->data->size = size; pReg->data->numRects = 0; } else pReg->data = &miEmptyData; } } void miRegionDestroy(pReg) RegionPtr pReg; { good(pReg); xfreeData(pReg); xfree(pReg); } void miRegionUninit(pReg) RegionPtr pReg; { good(pReg); xfreeData(pReg); } Bool miRectAlloc(pRgn, n) register RegionPtr pRgn; int n; { Must_have_memory = TRUE; /* XXX */ if (!pRgn->data) { n++; pRgn->data = xallocData(n); pRgn->data->numRects = 1; *REGION_BOXPTR(pRgn) = pRgn->extents; } else if (!pRgn->data->size) { pRgn->data = xallocData(n); pRgn->data->numRects = 0; } else { if (n == 1) { n = pRgn->data->numRects; if (n > 500) /* XXX pick numbers out of a hat */ n = 250; } n += pRgn->data->numRects; pRgn->data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n)); } Must_have_memory = FALSE; /* XXX */ pRgn->data->size = n; return TRUE; } Bool miRegionCopy(dst, src) register RegionPtr dst; register RegionPtr src; { good(dst); good(src); if (dst == src) return TRUE; dst->extents = src->extents; if (!src->data || !src->data->size) { xfreeData(dst); dst->data = src->data; return TRUE; } if (!dst->data || (dst->data->size < src->data->numRects)) { xfreeData(dst); Must_have_memory = TRUE; /* XXX */ dst->data = xallocData(src->data->numRects); Must_have_memory = FALSE; /* XXX */ dst->data->size = src->data->numRects; } dst->data->numRects = src->data->numRects; memmove((char *)REGION_BOXPTR(dst),(char *)REGION_BOXPTR(src), dst->data->numRects * sizeof(BoxRec)); return TRUE; } /*====================================================================== * Generic Region Operator *====================================================================*/ /*- *----------------------------------------------------------------------- * miCoalesce -- * Attempt to merge the boxes in the current band with those in the * previous one. We are guaranteed that the current band extends to * the end of the rects array. Used only by miRegionOp. * * Results: * The new index for the previous band. * * Side Effects: * If coalescing takes place: * - rectangles in the previous band will have their y2 fields * altered. * - pReg->data->numRects will be decreased. * *----------------------------------------------------------------------- */ INLINE static int miCoalesce (pReg, prevStart, curStart) register RegionPtr pReg; /* Region to coalesce */ int prevStart; /* Index of start of previous band */ int curStart; /* Index of start of current band */ { register BoxPtr pPrevBox; /* Current box in previous band */ register BoxPtr pCurBox; /* Current box in current band */ register int numRects; /* Number rectangles in both bands */ register int y2; /* Bottom of current band */ /* * Figure out how many rectangles are in the band. */ numRects = curStart - prevStart; assert(numRects == pReg->data->numRects - curStart); if (!numRects) return curStart; /* * The bands may only be coalesced if the bottom of the previous * matches the top scanline of the current. */ pPrevBox = REGION_BOX(pReg, prevStart); pCurBox = REGION_BOX(pReg, curStart); if (pPrevBox->y2 != pCurBox->y1) return curStart; /* * Make sure the bands have boxes in the same places. This * assumes that boxes have been added in such a way that they * cover the most area possible. I.e. two boxes in a band must * have some horizontal space between them. */ y2 = pCurBox->y2; do { if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { return (curStart); } pPrevBox++; pCurBox++; numRects--; } while (numRects); /* * The bands may be merged, so set the bottom y of each box * in the previous band to the bottom y of the current band. */ numRects = curStart - prevStart; pReg->data->numRects -= numRects; do { pPrevBox--; pPrevBox->y2 = y2; numRects--; } while (numRects); return prevStart; } /* Quicky macro to avoid trivial reject procedure calls to miCoalesce */ #define Coalesce(newReg, prevBand, curBand) \ if (curBand - prevBand == newReg->data->numRects - curBand) { \ prevBand = miCoalesce(newReg, prevBand, curBand); \ } else { \ prevBand = curBand; \ } /*- *----------------------------------------------------------------------- * miAppendNonO -- * Handle a non-overlapping band for the union and subtract operations. * Just adds the (top/bottom-clipped) rectangles into the region. * Doesn't have to check for subsumption or anything. * * Results: * None. * * Side Effects: * pReg->data->numRects is incremented and the rectangles overwritten * with the rectangles we're passed. * *----------------------------------------------------------------------- */ INLINE static Bool miAppendNonO (pReg, r, rEnd, y1, y2) register RegionPtr pReg; register BoxPtr r; BoxPtr rEnd; register int y1; register int y2; { register BoxPtr pNextRect; register int newRects; newRects = rEnd - r; assert(y1 < y2); assert(newRects != 0); /* Make sure we have enough space for all rectangles to be added */ RECTALLOC(pReg, newRects); pNextRect = REGION_TOP(pReg); pReg->data->numRects += newRects; do { assert(r->x1 < r->x2); ADDRECT(pNextRect, r->x1, y1, r->x2, y2); r++; } while (r != rEnd); return TRUE; } #define FindBand(r, rBandEnd, rEnd, ry1) \ { \ ry1 = r->y1; \ rBandEnd = r+1; \ while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \ rBandEnd++; \ } \ } #define AppendRegions(newReg, r, rEnd) \ { \ int newRects; \ if (newRects = rEnd - r) { \ RECTALLOC(newReg, newRects); \ memmove((char *)REGION_TOP(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ newReg->data->numRects += newRects; \ } \ } /*- *----------------------------------------------------------------------- * miRegionOp -- * Apply an operation to two regions. Called by miUnion, miInverse, * miSubtract, miIntersect.... Both regions MUST have at least one * rectangle, and cannot be the same object. * * Results: * TRUE if successful. * * Side Effects: * The new region is overwritten. * pOverlap set to TRUE if overlapFunc ever returns TRUE. * * Notes: * The idea behind this function is to view the two regions as sets. * Together they cover a rectangle of area that this function divides * into horizontal bands where points are covered only by one region * or by both. For the first case, the nonOverlapFunc is called with * each the band and the band's upper and lower extents. For the * second, the overlapFunc is called to process the entire band. It * is responsible for clipping the rectangles in the band, though * this function provides the boundaries. * At the end of each band, the new region is coalesced, if possible, * to reduce the number of rectangles in the region. * *----------------------------------------------------------------------- */ static Bool miRegionOp(newReg, reg1, reg2, overlapFunc, appendNon1, appendNon2, pOverlap) RegionPtr newReg; /* Place to store result */ RegionPtr reg1; /* First region in operation */ RegionPtr reg2; /* 2d region in operation */ Bool (*overlapFunc)(); /* Function to call for over- * lapping bands */ Bool appendNon1; /* Append non-overlapping bands */ /* in region 1 ? */ Bool appendNon2; /* Append non-overlapping bands */ /* in region 2 ? */ Bool *pOverlap; { register BoxPtr r1; /* Pointer into first region */ register BoxPtr r2; /* Pointer into 2d region */ BoxPtr r1End; /* End of 1st region */ BoxPtr r2End; /* End of 2d region */ short ybot; /* Bottom of intersection */ short ytop; /* Top of intersection */ RegDataPtr oldData; /* Old data for newReg */ int prevBand; /* Index of start of * previous band in newReg */ int curBand; /* Index of start of current * band in newReg */ register BoxPtr r1BandEnd; /* End of current band in r1 */ register BoxPtr r2BandEnd; /* End of current band in r2 */ short top; /* Top of non-overlapping band */ short bot; /* Bottom of non-overlapping band*/ register int r1y1; /* Temps for r1->y1 and r2->y1 */ register int r2y1; int newSize; int numRects; /* * Initialization: * set r1, r2, r1End and r2End appropriately, save the rectangles * of the destination region until the end in case it's one of * the two source regions, then mark the "new" region empty, allocating * another array of rectangles for it to use. */ r1 = REGION_RECTS(reg1); newSize = REGION_NUM_RECTS(reg1); r1End = r1 + newSize; numRects = REGION_NUM_RECTS(reg2); r2 = REGION_RECTS(reg2); r2End = r2 + numRects; assert(r1 != r1End); assert(r2 != r2End); oldData = (RegDataPtr)NULL; if (((newReg == reg1) && (newSize > 1)) || ((newReg == reg2) && (numRects > 1))) { oldData = newReg->data; newReg->data = &miEmptyData; } /* guess at new size */ if (numRects > newSize) newSize = numRects; newSize <<= 1; if (!newReg->data) newReg->data = &miEmptyData; else if (newReg->data->size) newReg->data->numRects = 0; if (newSize > newReg->data->size) miRectAlloc(newReg, newSize); /* * Initialize ybot. * In the upcoming loop, ybot and ytop serve different functions depending * on whether the band being handled is an overlapping or non-overlapping * band. * In the case of a non-overlapping band (only one of the regions * has points in the band), ybot is the bottom of the most recent * intersection and thus clips the top of the rectangles in that band. * ytop is the top of the next intersection between the two regions and * serves to clip the bottom of the rectangles in the current band. * For an overlapping band (where the two regions intersect), ytop clips * the top of the rectangles of both regions and ybot clips the bottoms. */ ybot = min(r1->y1, r2->y1); /* * prevBand serves to mark the start of the previous band so rectangles * can be coalesced into larger rectangles. qv. miCoalesce, above. * In the beginning, there is no previous band, so prevBand == curBand * (curBand is set later on, of course, but the first band will always * start at index 0). prevBand and curBand must be indices because of * the possible expansion, and resultant moving, of the new region's * array of rectangles. */ prevBand = 0; do { /* * This algorithm proceeds one source-band (as opposed to a * destination band, which is determined by where the two regions * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the * rectangle after the last one in the current band for their * respective regions. */ assert(r1 != r1End); assert(r2 != r2End); FindBand(r1, r1BandEnd, r1End, r1y1); FindBand(r2, r2BandEnd, r2End, r2y1); /* * First handle the band that doesn't intersect, if any. * * Note that attention is restricted to one band in the * non-intersecting region at once, so if a region has n * bands between the current position and the next place it overlaps * the other, this entire loop will be passed through n times. */ if (r1y1 < r2y1) { if (appendNon1) { top = max(r1y1, ybot); bot = min(r1->y2, r2y1); if (top != bot) { curBand = newReg->data->numRects; miAppendNonO(newReg, r1, r1BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r2y1; } else if (r2y1 < r1y1) { if (appendNon2) { top = max(r2y1, ybot); bot = min(r2->y2, r1y1); if (top != bot) { curBand = newReg->data->numRects; miAppendNonO(newReg, r2, r2BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } ytop = r1y1; } else { ytop = r1y1; } /* * Now see if we've hit an intersecting band. The two bands only * intersect if ybot > ytop */ ybot = min(r1->y2, r2->y2); if (ybot > ytop) { curBand = newReg->data->numRects; (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot, pOverlap); Coalesce(newReg, prevBand, curBand); } /* * If we've finished with a band (y2 == ybot) we skip forward * in the region to the next band. */ if (r1->y2 == ybot) r1 = r1BandEnd; if (r2->y2 == ybot) r2 = r2BandEnd; } while (r1 != r1End && r2 != r2End); /* * Deal with whichever region (if any) still has rectangles left. * * We only need to worry about banding and coalescing for the very first * band left. After that, we can just group all remaining boxes, * regardless of how many bands, into one final append to the list. */ if ((r1 != r1End) && appendNon1) { /* Do first nonOverlap1Func call, which may be able to coalesce */ FindBand(r1, r1BandEnd, r1End, r1y1); curBand = newReg->data->numRects; miAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2); Coalesce(newReg, prevBand, curBand); /* Just append the rest of the boxes */ AppendRegions(newReg, r1BandEnd, r1End); } else if ((r2 != r2End) && appendNon2) { /* Do first nonOverlap2Func call, which may be able to coalesce */ FindBand(r2, r2BandEnd, r2End, r2y1); curBand = newReg->data->numRects; miAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2); Coalesce(newReg, prevBand, curBand); /* Append rest of boxes */ AppendRegions(newReg, r2BandEnd, r2End); } if (oldData) xfree(oldData); if (!(numRects = newReg->data->numRects)) { xfreeData(newReg); newReg->data = &miEmptyData; } else if (numRects == 1) { newReg->extents = *REGION_BOXPTR(newReg); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } else { DOWNSIZE(newReg, numRects); } return TRUE; } /*- *----------------------------------------------------------------------- * miSetExtents -- * Reset the extents of a region to what they should be. Called by * miSubtract and miIntersect as they can't figure it out along the * way or do so easily, as miUnion can. * * Results: * None. * * Side Effects: * The region's 'extents' structure is overwritten. * *----------------------------------------------------------------------- */ void miSetExtents (pReg) register RegionPtr pReg; { register BoxPtr pBox, pBoxEnd; if (!pReg->data) return; if (!pReg->data->size) { pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; return; } pBox = REGION_BOXPTR(pReg); pBoxEnd = REGION_END(pReg); /* * Since pBox is the first rectangle in the region, it must have the * smallest y1 and since pBoxEnd is the last rectangle in the region, * it must have the largest y2, because of banding. Initialize x1 and * x2 from pBox and pBoxEnd, resp., as good things to initialize them * to... */ pReg->extents.x1 = pBox->x1; pReg->extents.y1 = pBox->y1; pReg->extents.x2 = pBoxEnd->x2; pReg->extents.y2 = pBoxEnd->y2; assert(pReg->extents.y1 < pReg->extents.y2); while (pBox <= pBoxEnd) { if (pBox->x1 < pReg->extents.x1) pReg->extents.x1 = pBox->x1; if (pBox->x2 > pReg->extents.x2) pReg->extents.x2 = pBox->x2; pBox++; }; assert(pReg->extents.x1 < pReg->extents.x2); } /*====================================================================== * Region Intersection *====================================================================*/ /*- *----------------------------------------------------------------------- * miIntersectO -- * Handle an overlapping band for miIntersect. * * Results: * TRUE if successful. * * Side Effects: * Rectangles may be added to the region. * *----------------------------------------------------------------------- */ /*ARGSUSED*/ static Bool miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) register RegionPtr pReg; register BoxPtr r1; BoxPtr r1End; register BoxPtr r2; BoxPtr r2End; short y1; short y2; Bool *pOverlap; { register int x1; register int x2; register BoxPtr pNextRect; pNextRect = REGION_TOP(pReg); assert(y1 < y2); assert(r1 != r1End && r2 != r2End); do { x1 = max(r1->x1, r2->x1); x2 = min(r1->x2, r2->x2); /* * If there's any overlap between the two rectangles, add that * overlap to the new region. */ if (x1 < x2) NEWRECT(pReg, pNextRect, x1, y1, x2, y2); /* * Advance the pointer(s) with the leftmost right side, since the next * rectangle on that list may still overlap the other region's * current rectangle. */ if (r1->x2 == x2) { r1++; } if (r2->x2 == x2) { r2++; } } while ((r1 != r1End) && (r2 != r2End)); return TRUE; } Bool miIntersect(newReg, reg1, reg2) register RegionPtr newReg; /* destination Region */ register RegionPtr reg1; register RegionPtr reg2; /* source regions */ { good(reg1); good(reg2); good(newReg); /* check for trivial reject */ if (REGION_NIL(reg1) || REGION_NIL(reg2) || !EXTENTCHECK(®1->extents, ®2->extents)) { /* Covers about 20% of all cases */ xfreeData(newReg); newReg->extents.x2 = newReg->extents.x1; newReg->extents.y2 = newReg->extents.y1; newReg->data = &miEmptyData; } else if (!reg1->data && !reg2->data) { /* Covers about 80% of cases that aren't trivially rejected */ newReg->extents.x1 = max(reg1->extents.x1, reg2->extents.x1); newReg->extents.y1 = max(reg1->extents.y1, reg2->extents.y1); newReg->extents.x2 = min(reg1->extents.x2, reg2->extents.x2); newReg->extents.y2 = min(reg1->extents.y2, reg2->extents.y2); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } else if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) { return miRegionCopy(newReg, reg1); } else if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) { return miRegionCopy(newReg, reg2); } else if (reg1 == reg2) { return miRegionCopy(newReg, reg1); } else { /* General purpose intersection */ Bool overlap; /* result ignored */ if (!miRegionOp(newReg, reg1, reg2, miIntersectO, FALSE, FALSE, &overlap)) return FALSE; miSetExtents(newReg); } good(newReg); return(TRUE); } #define MERGERECT(r) \ { \ if (r->x1 <= x2) { \ /* Merge with current rectangle */ \ if (r->x1 < x2) *pOverlap = TRUE; \ if (x2 < r->x2) x2 = r->x2; \ } else { \ /* Add current rectangle, start new one */ \ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \ x1 = r->x1; \ x2 = r->x2; \ } \ r++; \ } /*====================================================================== * Region Union *====================================================================*/ /*- *----------------------------------------------------------------------- * miUnionO -- * Handle an overlapping band for the union operation. Picks the * left-most rectangle each time and merges it into the region. * * Results: * TRUE if successful. * * Side Effects: * pReg is overwritten. * pOverlap is set to TRUE if any boxes overlap. * *----------------------------------------------------------------------- */ static Bool miUnionO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) register RegionPtr pReg; register BoxPtr r1; BoxPtr r1End; register BoxPtr r2; BoxPtr r2End; short y1; short y2; Bool *pOverlap; { register BoxPtr pNextRect; register int x1; /* left and right side of current union */ register int x2; assert (y1 < y2); assert(r1 != r1End && r2 != r2End); pNextRect = REGION_TOP(pReg); /* Start off current rectangle */ if (r1->x1 < r2->x1) { x1 = r1->x1; x2 = r1->x2; r1++; } else { x1 = r2->x1; x2 = r2->x2; r2++; } while (r1 != r1End && r2 != r2End) { if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2); } /* Finish off whoever (if any) is left */ if (r1 != r1End) { do { MERGERECT(r1); } while (r1 != r1End); } else if (r2 != r2End) { do { MERGERECT(r2); } while (r2 != r2End); } /* Add current rectangle */ NEWRECT(pReg, pNextRect, x1, y1, x2, y2); return TRUE; } Bool miUnion(newReg, reg1, reg2) RegionPtr newReg; /* destination Region */ register RegionPtr reg1; register RegionPtr reg2; /* source regions */ { Bool overlap; /* result ignored */ /* Return TRUE if some overlap between reg1, reg2 */ good(reg1); good(reg2); good(newReg); /* checks all the simple cases */ /* * Region 1 and 2 are the same */ if (reg1 == reg2) { return miRegionCopy(newReg, reg1); } /* * Region 1 is empty */ if (REGION_NIL(reg1)) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return TRUE; } /* * Region 2 is empty */ if (REGION_NIL(reg2)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return TRUE; } /* * Region 1 completely subsumes region 2 */ if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) { if (newReg != reg1) return miRegionCopy(newReg, reg1); return TRUE; } /* * Region 2 completely subsumes region 1 */ if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) { if (newReg != reg2) return miRegionCopy(newReg, reg2); return TRUE; } if (!miRegionOp(newReg, reg1, reg2, miUnionO, TRUE, TRUE, &overlap)) return FALSE; newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1); newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2); newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2); good(newReg); return TRUE; } /*====================================================================== * Batch Rectangle Union *====================================================================*/ /*- *----------------------------------------------------------------------- * miRegionAppend -- * * "Append" the rgn rectangles onto the end of dstrgn, maintaining * knowledge of YX-banding when it's easy. Otherwise, dstrgn just * becomes a non-y-x-banded random collection of rectangles, and not * yet a true region. After a sequence of appends, the caller must * call miRegionValidate to ensure that a valid region is constructed. * * Results: * TRUE if successful. * * Side Effects: * dstrgn is modified if rgn has rectangles. * */ Bool miRegionAppend(dstrgn, rgn) register RegionPtr dstrgn; register RegionPtr rgn; { int numRects, dnumRects, size; BoxPtr new, old; Bool prepend; if (!rgn->data && (dstrgn->data == &miEmptyData)) { dstrgn->extents = rgn->extents; dstrgn->data = (RegDataPtr)NULL; return TRUE; } numRects = REGION_NUM_RECTS(rgn); if (!numRects) return TRUE; prepend = FALSE; size = numRects; dnumRects = REGION_NUM_RECTS(dstrgn); if (!dnumRects && (size < 200)) size = 200; /* XXX pick numbers out of a hat */ RECTALLOC(dstrgn, size); old = REGION_RECTS(rgn); if (!dnumRects) dstrgn->extents = rgn->extents; else if (dstrgn->extents.x2 > dstrgn->extents.x1) { register BoxPtr first, last; first = old; last = REGION_BOXPTR(dstrgn) + (dnumRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y2 = rgn->extents.y2; } else { first = REGION_BOXPTR(dstrgn); last = old + (numRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) { prepend = TRUE; if (rgn->extents.x1 < dstrgn->extents.x1) dstrgn->extents.x1 = rgn->extents.x1; if (rgn->extents.x2 > dstrgn->extents.x2) dstrgn->extents.x2 = rgn->extents.x2; dstrgn->extents.y1 = rgn->extents.y1; } else dstrgn->extents.x2 = dstrgn->extents.x1; } } if (prepend) { new = REGION_BOX(dstrgn, numRects); if (dnumRects == 1) *new = *REGION_BOXPTR(dstrgn); else memmove((char *)new,(char *)REGION_BOXPTR(dstrgn), dnumRects * sizeof(BoxRec)); new = REGION_BOXPTR(dstrgn); } else new = REGION_BOXPTR(dstrgn) + dnumRects; if (numRects == 1) *new = *old; else memmove((char *)new, (char *)old, numRects * sizeof(BoxRec)); dstrgn->data->numRects += numRects; return TRUE; } #define ExchangeRects(a, b) \ { \ BoxRec t; \ t = rects[a]; \ rects[a] = rects[b]; \ rects[b] = t; \ } static void QuickSortRects(rects, numRects) register BoxRec rects[]; register int numRects; { register int y1; register int x1; register int i, j; register BoxPtr r; /* Always called with numRects > 1 */ do { if (numRects == 2) { if (rects[0].y1 > rects[1].y1 || (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1)) ExchangeRects(0, 1); return; } /* Choose partition element, stick in location 0 */ ExchangeRects(0, numRects >> 1); y1 = rects[0].y1; x1 = rects[0].x1; /* Partition array */ i = 0; j = numRects; do { r = &(rects[i]); do { r++; i++; } while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); r = &(rects[j]); do { r--; j--; } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1)); if (i < j) ExchangeRects(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeRects(0, j); /* Recurse */ if (numRects-j-1 > 1) QuickSortRects(&rects[j+1], numRects-j-1); numRects = j; } while (numRects > 1); } /*- *----------------------------------------------------------------------- * miRegionValidate -- * * Take a ``region'' which is a non-y-x-banded random collection of * rectangles, and compute a nice region which is the union of all the * rectangles. * * Results: * TRUE if successful. * * Side Effects: * The passed-in ``region'' may be modified. * pOverlap set to TRUE if any retangles overlapped, else FALSE; * * Strategy: * Step 1. Sort the rectangles into ascending order with primary key y1 * and secondary key x1. * * Step 2. Split the rectangles into the minimum number of proper y-x * banded regions. This may require horizontally merging * rectangles, and vertically coalescing bands. With any luck, * this step in an identity tranformation (ala the Box widget), * or a coalescing into 1 box (ala Menus). * * Step 3. Merge the separate regions down to a single region by calling * miUnion. Maximize the work each miUnion call does by using * a binary merge. * *----------------------------------------------------------------------- */ Bool miRegionValidate(badreg, pOverlap) RegionPtr badreg; Bool *pOverlap; { /* Descriptor for regions under construction in Step 2. */ typedef struct { RegionRec reg; int prevBand; int curBand; } RegionInfo; int numRects; /* Original numRects for badreg */ RegionInfo *ri; /* Array of current regions */ int numRI; /* Number of entries used in ri */ int sizeRI; /* Number of entries available in ri */ int i; /* Index into rects */ register int j; /* Index into ri */ register RegionInfo *rit; /* &ri[j] */ register RegionPtr reg; /* ri[j].reg */ register BoxPtr box; /* Current box in rects */ register BoxPtr riBox; /* Last box in ri[j].reg */ register RegionPtr hreg; /* ri[j_half].reg */ *pOverlap = FALSE; if (!badreg->data) { good(badreg); return TRUE; } numRects = badreg->data->numRects; if (!numRects) { good(badreg); return TRUE; } if (badreg->extents.x1 < badreg->extents.x2) { if ((numRects) == 1) { xfreeData(badreg); badreg->data = (RegDataPtr) NULL; } else { DOWNSIZE(badreg, numRects); } good(badreg); return TRUE; } /* Step 1: Sort the rects array into ascending (y1, x1) order */ QuickSortRects(REGION_BOXPTR(badreg), numRects); /* Step 2: Scatter the sorted array into the minimum number of regions */ /* Set up the first region to be the first rectangle in badreg */ /* Note that step 2 code will never overflow the ri[0].reg rects array */ Must_have_memory = TRUE; /* XXX */ ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo)); Must_have_memory = FALSE; /* XXX */ sizeRI = 4; numRI = 1; ri[0].prevBand = 0; ri[0].curBand = 0; ri[0].reg = *badreg; box = REGION_BOXPTR(&ri[0].reg); ri[0].reg.extents = *box; ri[0].reg.data->numRects = 1; /* Now scatter rectangles into the minimum set of valid regions. If the next rectangle to be added to a region would force an existing rectangle in the region to be split up in order to maintain y-x banding, just forget it. Try the next region. If it doesn't fit cleanly into any region, make a new one. */ for (i = numRects; --i > 0;) { box++; /* Look for a region to append box to */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = REGION_END(reg); if (box->y1 == riBox->y1 && box->y2 == riBox->y2) { /* box is in same band as riBox. Merge or append it */ if (box->x1 <= riBox->x2) { /* Merge it with riBox */ if (box->x1 < riBox->x2) *pOverlap = TRUE; if (box->x2 > riBox->x2) riBox->x2 = box->x2; } else { RECTALLOC(reg, 1); *REGION_TOP(reg) = *box; reg->data->numRects++; } goto NextRect; /* So sue me */ } else if (box->y1 >= riBox->y2) { /* Put box into new band */ if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1; Coalesce(reg, rit->prevBand, rit->curBand); rit->curBand = reg->data->numRects; RECTALLOC(reg, 1); *REGION_TOP(reg) = *box; reg->data->numRects++; goto NextRect; } /* Well, this region was inappropriate. Try the next one. */ } /* for j */ /* Uh-oh. No regions were appropriate. Create a new one. */ if (sizeRI == numRI) { /* Oops, allocate space for new region information */ sizeRI <<= 1; Must_have_memory = TRUE; /* XXX */ ri = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo)); Must_have_memory = FALSE; /* XXX */ rit = &ri[numRI]; } numRI++; rit->prevBand = 0; rit->curBand = 0; rit->reg.extents = *box; rit->reg.data = (RegDataPtr)NULL; miRectAlloc(&rit->reg, (i+numRI) / numRI); /* MUST force allocation */ NextRect: ; } /* for i */ /* Make a final pass over each region in order to Coalesce and set extents.x2 and extents.y2 */ for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; riBox = REGION_END(reg); reg->extents.y2 = riBox->y2; if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; Coalesce(reg, rit->prevBand, rit->curBand); if (reg->data->numRects == 1) /* keep unions happy below */ { xfreeData(reg); reg->data = (RegDataPtr)NULL; } } /* Step 3: Union all regions into a single region */ while (numRI > 1) { int half = numRI/2; for (j = numRI & 1; j < (half + (numRI & 1)); j++) { reg = &ri[j].reg; hreg = &ri[j+half].reg; miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap); if (hreg->extents.x1 < reg->extents.x1) reg->extents.x1 = hreg->extents.x1; if (hreg->extents.y1 < reg->extents.y1) reg->extents.y1 = hreg->extents.y1; if (hreg->extents.x2 > reg->extents.x2) reg->extents.x2 = hreg->extents.x2; if (hreg->extents.y2 > reg->extents.y2) reg->extents.y2 = hreg->extents.y2; xfreeData(hreg); } numRI -= half; } *badreg = ri[0].reg; xfree(ri); good(badreg); return TRUE; } RegionPtr miRectsToRegion(nrects, prect, ctype) int nrects; register xRectangle *prect; int ctype; { register RegionPtr pRgn; register RegDataPtr pData; register BoxPtr pBox; register int i; int x1, y1, x2, y2; pRgn = miRegionCreate(NullBox, 0); if (!nrects) return pRgn; if (nrects == 1) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pRgn->extents.x1 = x1; pRgn->extents.y1 = y1; pRgn->extents.x2 = x2; pRgn->extents.y2 = y2; pRgn->data = (RegDataPtr)NULL; } return pRgn; } Must_have_memory = TRUE; /* XXX */ pData = xallocData(nrects); pBox = (BoxPtr) (pData + 1); Must_have_memory = FALSE; /* XXX */ for (i = nrects; --i >= 0; prect++) { x1 = prect->x; y1 = prect->y; if ((x2 = x1 + (int) prect->width) > MAXSHORT) x2 = MAXSHORT; if ((y2 = y1 + (int) prect->height) > MAXSHORT) y2 = MAXSHORT; if (x1 != x2 && y1 != y2) { pBox->x1 = x1; pBox->y1 = y1; pBox->x2 = x2; pBox->y2 = y2; pBox++; } } if (pBox != (BoxPtr) (pData + 1)) { pData->size = nrects; pData->numRects = pBox - (BoxPtr) (pData + 1); pRgn->data = pData; if (ctype != CT_YXBANDED) { Bool overlap; /* result ignored */ pRgn->extents.x1 = pRgn->extents.x2 = 0; miRegionValidate(pRgn, &overlap); } else miSetExtents(pRgn); good(pRgn); } else { xfree (pData); } return pRgn; } /*====================================================================== * Region Subtraction *====================================================================*/ /*- *----------------------------------------------------------------------- * miSubtractO -- * Overlapping band subtraction. x1 is the left-most point not yet * checked. * * Results: * TRUE if successful. * * Side Effects: * pReg may have rectangles added to it. * *----------------------------------------------------------------------- */ /*ARGSUSED*/ static Bool miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2, pOverlap) register RegionPtr pReg; register BoxPtr r1; BoxPtr r1End; register BoxPtr r2; BoxPtr r2End; register int y1; int y2; Bool *pOverlap; { register BoxPtr pNextRect; register int x1; x1 = r1->x1; assert(y1x2 <= x1) { /* * Subtrahend entirely to left of minuend: go to next subtrahend. */ r2++; } else if (r2->x1 <= x1) { /* * Subtrahend preceeds minuend: nuke left edge of minuend. */ x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend completely covered: advance to next minuend and * reset left fence to edge of new minuend. */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend now used up since it doesn't extend beyond * minuend */ r2++; } } else if (r2->x1 < r1->x2) { /* * Left part of subtrahend covers part of minuend: add uncovered * part of minuend to region and skip to next subtrahend. */ assert(x1x1); NEWRECT(pReg, pNextRect, x1, y1, r2->x1, y2); x1 = r2->x2; if (x1 >= r1->x2) { /* * Minuend used up: advance to new... */ r1++; if (r1 != r1End) x1 = r1->x1; } else { /* * Subtrahend used up */ r2++; } } else { /* * Minuend used up: add any remaining piece before advancing. */ if (r1->x2 > x1) NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2); r1++; if (r1 != r1End) x1 = r1->x1; } } while ((r1 != r1End) && (r2 != r2End)); /* * Add remaining minuend rectangles to region. */ while (r1 != r1End) { assert(x1x2); NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2); r1++; if (r1 != r1End) x1 = r1->x1; } return TRUE; } /*- *----------------------------------------------------------------------- * miSubtract -- * Subtract regS from regM and leave the result in regD. * S stands for subtrahend, M for minuend and D for difference. * * Results: * TRUE if successful. * * Side Effects: * regD is overwritten. * *----------------------------------------------------------------------- */ Bool miSubtract(regD, regM, regS) register RegionPtr regD; register RegionPtr regM; register RegionPtr regS; { Bool overlap; /* result ignored */ good(regM); good(regS); good(regD); /* check for trivial rejects */ if (REGION_NIL(regM) || REGION_NIL(regS) || !EXTENTCHECK(®M->extents, ®S->extents)) { return miRegionCopy(regD, regM); } else if (regM == regS) { xfreeData(regD); regD->extents.x2 = regD->extents.x1; regD->extents.y2 = regD->extents.y1; regD->data = &miEmptyData; return TRUE; } /* Add those rectangles in region 1 that aren't in region 2, do yucky substraction for overlaps, and just throw away rectangles in region 2 that aren't in region 1 */ if (!miRegionOp(regD, regM, regS, miSubtractO, TRUE, FALSE, &overlap)) return FALSE; /* * Can't alter RegD's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being unaltered. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents(regD); good(regD); return TRUE; } /*====================================================================== * Region Inversion *====================================================================*/ /*- *----------------------------------------------------------------------- * miInverse -- * Take a region and a box and return a region that is everything * in the box but not in the region. The careful reader will note * that this is the same as subtracting the region from the box... * * Results: * TRUE. * * Side Effects: * newReg is overwritten. * *----------------------------------------------------------------------- */ Bool miInverse(newReg, reg1, invRect) RegionPtr newReg; /* Destination region */ RegionPtr reg1; /* Region to invert */ BoxPtr invRect; /* Bounding box for inversion */ { RegionRec invReg; /* Quick and dirty region made from the * bounding box */ Bool overlap; /* result ignored */ good(reg1); good(newReg); /* check for trivial rejects */ if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, ®1->extents)) { newReg->extents = *invRect; xfreeData(newReg); newReg->data = (RegDataPtr)NULL; return TRUE; } /* Add those rectangles in region 1 that aren't in region 2, do yucky substraction for overlaps, and just throw away rectangles in region 2 that aren't in region 1 */ invReg.extents = *invRect; invReg.data = (RegDataPtr)NULL; if (!miRegionOp(newReg, &invReg, reg1, miSubtractO, TRUE, FALSE, &overlap)) return FALSE; /* * Can't alter newReg's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends * on the extents of those regions being unaltered. Besides, this * way there's no checking against rectangles that will be nuked * due to coalescing, so we have to examine fewer rectangles. */ miSetExtents(newReg); good(newReg); return TRUE; } /* * RectIn(region, rect) * This routine takes a pointer to a region and a pointer to a box * and determines if the box is outside/inside/partly inside the region. * * The idea is to travel through the list of rectangles trying to cover the * passed box with them. Anytime a piece of the rectangle isn't covered * by a band of rectangles, partOut is set TRUE. Any time a rectangle in * the region covers part of the box, partIn is set TRUE. The process ends * when either the box has been completely covered (we reached a band that * doesn't overlap the box, partIn is TRUE and partOut is false), the * box has been partially covered (partIn == partOut == TRUE -- because of * the banding, the first time this is true we know the box is only * partially in the region) or is outside the region (we reached a band * that doesn't overlap the box at all and partIn is false) */ int miRectIn(region, prect) register RegionPtr region; register BoxPtr prect; { register int x; register int y; register BoxPtr pbox; register BoxPtr pboxEnd; int partIn, partOut; int numRects; good(region); numRects = REGION_NUM_RECTS(region); /* useful optimization */ if (!numRects || !EXTENTCHECK(®ion->extents, prect)) return(rgnOUT); if (numRects == 1) { /* We know that it must be rgnIN or rgnPART */ if (SUBSUMES(®ion->extents, prect)) return(rgnIN); else return(rgnPART); } partOut = FALSE; partIn = FALSE; /* (x,y) starts at upper left of rect, moving to the right and down */ x = prect->x1; y = prect->y1; /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */ for (pbox = REGION_BOXPTR(region), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { if (pbox->y2 <= y) continue; /* getting up to speed or skipping remainder of band */ if (pbox->y1 > y) { partOut = TRUE; /* missed part of rectangle above */ if (partIn || (pbox->y1 >= prect->y2)) break; y = pbox->y1; /* x guaranteed to be == prect->x1 */ } if (pbox->x2 <= x) continue; /* not far enough over yet */ if (pbox->x1 > x) { partOut = TRUE; /* missed part of rectangle to left */ if (partIn) break; } if (pbox->x1 < prect->x2) { partIn = TRUE; /* definitely overlap */ if (partOut) break; } if (pbox->x2 >= prect->x2) { y = pbox->y2; /* finished with this band */ if (y >= prect->y2) break; x = prect->x1; /* reset x out to left again */ } else { /* * Because boxes in a band are maximal width, if the first box * to overlap the rectangle doesn't completely cover it in that * band, the rectangle must be partially out, since some of it * will be uncovered in that band. partIn will have been set true * by now... */ partOut = TRUE; break; } } return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT); } /* TranslateRegion(pReg, x, y) translates in place */ void miTranslateRegion(pReg, x, y) register RegionPtr pReg; register int x; register int y; { int x1, x2, y1, y2; register int nbox; register BoxPtr pbox; good(pReg); pReg->extents.x1 = x1 = pReg->extents.x1 + x; pReg->extents.y1 = y1 = pReg->extents.y1 + y; pReg->extents.x2 = x2 = pReg->extents.x2 + x; pReg->extents.y2 = y2 = pReg->extents.y2 + y; if (((x1 - MINSHORT)|(y1 - MINSHORT)|(MAXSHORT - x2)|(MAXSHORT - y2)) >= 0) { if (pReg->data && (nbox = pReg->data->numRects)) { for (pbox = REGION_BOXPTR(pReg); nbox--; pbox++) { pbox->x1 += x; pbox->y1 += y; pbox->x2 += x; pbox->y2 += y; } } return; } if (((x2 - MINSHORT)|(y2 - MINSHORT)|(MAXSHORT - x1)|(MAXSHORT - y1)) <= 0) { pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; xfreeData(pReg); pReg->data = &miEmptyData; return; } if (x1 < MINSHORT) pReg->extents.x1 = MINSHORT; else if (x2 > MAXSHORT) pReg->extents.x2 = MAXSHORT; if (y1 < MINSHORT) pReg->extents.y1 = MINSHORT; else if (y2 > MAXSHORT) pReg->extents.y2 = MAXSHORT; if (pReg->data && (nbox = pReg->data->numRects)) { register BoxPtr pboxout; for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++) { pboxout->x1 = x1 = pbox->x1 + x; pboxout->y1 = y1 = pbox->y1 + y; pboxout->x2 = x2 = pbox->x2 + x; pboxout->y2 = y2 = pbox->y2 + y; if (((x2 - MINSHORT)|(y2 - MINSHORT)| (MAXSHORT - x1)|(MAXSHORT - y1)) <= 0) { pReg->data->numRects--; continue; } if (x1 < MINSHORT) pboxout->x1 = MINSHORT; else if (x2 > MAXSHORT) pboxout->x2 = MAXSHORT; if (y1 < MINSHORT) pboxout->y1 = MINSHORT; else if (y2 > MAXSHORT) pboxout->y2 = MAXSHORT; pboxout++; } if (pboxout != pbox) { if (pReg->data->numRects == 1) { pReg->extents = *REGION_BOXPTR(pReg); xfreeData(pReg); pReg->data = (RegDataPtr)NULL; } else miSetExtents(pReg); } } } void miRegionReset(pReg, pBox) RegionPtr pReg; BoxPtr pBox; { good(pReg); assert(pBox->x1<=pBox->x2); assert(pBox->y1<=pBox->y2); pReg->extents = *pBox; xfreeData(pReg); pReg->data = (RegDataPtr)NULL; } Bool miPointInRegion(pReg, x, y, box) register RegionPtr pReg; register int x, y; BoxPtr box; /* "return" value */ { register BoxPtr pbox, pboxEnd; int numRects; good(pReg); numRects = REGION_NUM_RECTS(pReg); if (!numRects || !INBOX(&pReg->extents, x, y)) return(FALSE); if (numRects == 1) { *box = pReg->extents; return(TRUE); } for (pbox = REGION_BOXPTR(pReg), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { if (y >= pbox->y2) continue; /* not there yet */ if ((y < pbox->y1) || (x < pbox->x1)) break; /* missed it */ if (x >= pbox->x2) continue; /* not there yet */ *box = *pbox; return(TRUE); } return(FALSE); } Bool miRegionNotEmpty(pReg) RegionPtr pReg; { good(pReg); return(!REGION_NIL(pReg)); } void miRegionEmpty(pReg) RegionPtr pReg; { good(pReg); xfreeData(pReg); pReg->extents.x2 = pReg->extents.x1; pReg->extents.y2 = pReg->extents.y1; pReg->data = &miEmptyData; } BoxPtr miRegionExtents(pReg) RegionPtr pReg; { good(pReg); return(&pReg->extents); } #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ register int tw; \ \ tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } /* ||| I should apply the merge sort code to rectangle sorting above, and see if mapping time can be improved. But right now I've been at work 12 hours, so forget it. */ static void QuickSortSpans(spans, widths, numSpans) register DDXPointRec spans[]; register int widths[]; register int numSpans; { register int y; register int i, j, m; register DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by y, doesn't bother to sort by x */ do { if (numSpans < 9) { /* Do insertion sort */ register int yprev; yprev = spans[0].y; i = 1; do { /* while i != numSpans */ y = spans[i].y; if (yprev > y) { /* spans[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; y >= spans[j].y; j++) {} tpt = spans[i]; tw = widths[i]; for (k = i; k != j; k--) { spans[k] = spans[k-1]; widths[k] = widths[k-1]; } spans[j] = tpt; widths[j] = tw; y = spans[i].y; } /* if out of order */ yprev = y; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); y = spans[0].y; /* Partition array */ i = 0; j = numSpans; do { r = &(spans[i]); do { r++; i++; } while (i != numSpans && r->y < y); r = &(spans[j]); do { r--; j--; } while (y < r->y); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans-j-1 > 1) QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); numSpans = j; } while (numSpans > 1); } #define NextBand() \ { \ clipy1 = pboxBandStart->y1; \ clipy2 = pboxBandStart->y2; \ pboxBandEnd = pboxBandStart + 1; \ while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ pboxBandEnd++; \ } \ for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ } /* Clip a list of scanlines to a region. The caller has allocated the space. FSorted is non-zero if the scanline origins are in ascending order. returns the number of new, clipped scanlines. */ int miClipSpans(prgnDst, ppt, pwidth, nspans, pptNew, pwidthNew, fSorted) RegionPtr prgnDst; register DDXPointPtr ppt; register int *pwidth; int nspans; register DDXPointPtr pptNew; int *pwidthNew; int fSorted; { register DDXPointPtr pptLast; int *pwidthNewStart; /* the vengeance of Xerox! */ register int y, x1, x2; register int numRects; good(prgnDst); pptLast = ppt + nspans; pwidthNewStart = pwidthNew; if (!prgnDst->data) { /* Do special fast code with clip boundaries in registers(?) */ /* It doesn't pay much to make use of fSorted in this case, so we lump everything together. */ register int clipx1, clipx2, clipy1, clipy2; clipx1 = prgnDst->extents.x1; clipy1 = prgnDst->extents.y1; clipx2 = prgnDst->extents.x2; clipy2 = prgnDst->extents.y2; for (; ppt != pptLast; ppt++, pwidth++) { y = ppt->y; x1 = ppt->x; if (clipy1 <= y && y < clipy2) { x2 = x1 + *pwidth; if (x1 < clipx1) x1 = clipx1; if (x2 > clipx2) x2 = clipx2; if (x1 < x2) { /* part of span in clip rectangle */ pptNew->x = x1; pptNew->y = y; *pwidthNew = x2 - x1; pptNew++; pwidthNew++; } } } /* end for */ } else if (numRects = prgnDst->data->numRects) { /* Have to clip against many boxes */ BoxPtr pboxBandStart, pboxBandEnd; register BoxPtr pbox; register BoxPtr pboxLast; register int clipy1, clipy2; /* In this case, taking advantage of sorted spans gains more than the sorting costs. */ if ((! fSorted) && (nspans > 1)) QuickSortSpans(ppt, pwidth, nspans); pboxBandStart = REGION_BOXPTR(prgnDst); pboxLast = pboxBandStart + numRects; NextBand(); for (; ppt != pptLast; ) { y = ppt->y; if (y < clipy2) { /* span is in the current band */ pbox = pboxBandStart; x1 = ppt->x; x2 = x1 + *pwidth; do { /* For each box in band */ register int newx1, newx2; newx1 = x1; newx2 = x2; if (newx1 < pbox->x1) newx1 = pbox->x1; if (newx2 > pbox->x2) newx2 = pbox->x2; if (newx1 < newx2) { /* Part of span in clip rectangle */ pptNew->x = newx1; pptNew->y = y; *pwidthNew = newx2 - newx1; pptNew++; pwidthNew++; } pbox++; } while (pbox != pboxBandEnd); ppt++; pwidth++; } else { /* Move to next band, adjust ppt as needed */ pboxBandStart = pboxBandEnd; if (pboxBandStart == pboxLast) break; /* We're completely done */ NextBand(); } } } return (pwidthNew - pwidthNewStart); } /* find the band in a region with the most rectangles */ int miFindMaxBand(prgn) RegionPtr prgn; { register int nbox; register BoxPtr pbox; register int nThisBand; register int nMaxBand = 0; short yThisBand; good(prgn); nbox = REGION_NUM_RECTS(prgn); pbox = REGION_RECTS(prgn); while(nbox > 0) { yThisBand = pbox->y1; nThisBand = 0; while((nbox > 0) && (pbox->y1 == yThisBand)) { nbox--; pbox++; nThisBand++; } if (nThisBand > nMaxBand) nMaxBand = nThisBand; } return (nMaxBand); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miinitext.c0100664000076400007640000001566407120677563021512 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miinitext.c /main/41 1996/09/28 17:15:08 rws $ */ /* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.17.2.3 1997/05/22 14:00:46 dawes Exp $ */ #include "misc.h" #include "extension.h" #ifdef NOPEXEXT /* sleaze for Solaris cpp building XsunMono */ #undef PEXEXT #endif extern Bool noTestExtensions; #ifdef XKB extern Bool noXkbExtension; #endif #if NeedFunctionPrototypes #define INITARGS void #else #define INITARGS /*nothing*/ #endif typedef void (*InitExtension)(INITARGS); /* FIXME: this whole block of externs should be from the appropriate headers */ #ifdef BEZIER extern void BezierExtensionInit(INITARGS); #endif #ifdef XTESTEXT1 extern void XTestExtension1Init(INITARGS); #endif #ifdef SHAPE extern void ShapeExtensionInit(INITARGS); #endif #ifdef MITSHM extern void ShmExtensionInit(INITARGS); #endif #ifdef PEXEXT #ifndef PEX_MODULE extern void PexExtensionInit(INITARGS); #endif InitExtension PexExtensionInitPtr = NULL; #endif #ifdef MULTIBUFFER extern void MultibufferExtensionInit(INITARGS); #endif #ifdef XINPUT extern void XInputExtensionInit(INITARGS); #endif #ifdef XTEST extern void XTestExtensionInit(INITARGS); #endif #ifdef BIGREQS extern void BigReqExtensionInit(INITARGS); #endif #ifdef MITMISC extern void MITMiscExtensionInit(INITARGS); #endif #ifdef XIDLE extern void XIdleExtensionInit(INITARGS); #endif #ifdef XTRAP extern void DEC_XTRAPInit(INITARGS); #endif #ifdef SCREENSAVER extern void ScreenSaverExtensionInit (INITARGS); #endif #ifdef XV extern void XvExtensionInit(INITARGS); #endif #ifdef XIE #ifndef XIE_MODULE extern void XieInit(INITARGS); #endif InitExtension XieInitPtr = NULL; #endif #ifdef XSYNC extern void SyncExtensionInit(INITARGS); #endif #ifdef XKB extern void XkbExtensionInit(INITARGS); #endif #ifdef XCMISC extern void XCMiscExtensionInit(INITARGS); #endif #ifdef XRECORD extern void RecordExtensionInit(INITARGS); #endif #ifdef LBX extern void LbxExtensionInit(INITARGS); #endif #ifdef DBE extern void DbeExtensionInit(INITARGS); #endif #ifdef XAPPGROUP extern void XagExtensionInit(INITARGS); #endif #ifdef XCSECURITY extern void SecurityExtensionInit(INITARGS); #endif #ifdef XPRINT extern void XpExtensionInit(INITARGS); #endif #ifdef XF86VIDMODE extern void XFree86VidModeExtensionInit(INITARGS); #endif #ifdef XF86MISC extern void XFree86MiscExtensionInit(INITARGS); #endif #ifdef XFreeXDGA extern void XFree86DGAExtensionInit(INITARGS); #endif #ifdef DPMSExtension extern void DPMSExtensionInit(INITARGS); #endif #ifdef GLXEXT #ifndef GLX_MODULE extern void GlxExtensionInit(INITARGS); #else InitExtension GlxExtensionInitPtr = NULL; #endif #endif /*ARGSUSED*/ void InitExtensions(argc, argv) int argc; char *argv[]; { #ifdef BEZIER BezierExtensionInit(); #endif #ifdef XTESTEXT1 if (!noTestExtensions) XTestExtension1Init(); #endif #ifdef SHAPE ShapeExtensionInit(); #endif #ifdef MITSHM ShmExtensionInit(); #endif #ifdef PEXEXT #ifndef PEX_MODULE PexExtensionInit(); #else if (PexExtensionInitPtr != NULL) { (*PexExtensionInitPtr)(); } #endif #endif #ifdef MULTIBUFFER MultibufferExtensionInit(); #endif #ifdef XINPUT XInputExtensionInit(); #endif #ifdef XTEST if (!noTestExtensions) XTestExtensionInit(); #endif #ifdef BIGREQS BigReqExtensionInit(); #endif #ifdef MITMISC MITMiscExtensionInit(); #endif #ifdef XIDLE XIdleExtensionInit(); #endif #ifdef XTRAP if (!noTestExtensions) DEC_XTRAPInit(); #endif #ifdef SCREENSAVER ScreenSaverExtensionInit (); #endif #ifdef XV XvExtensionInit(); #endif #ifdef XIE #ifndef XIE_MODULE XieInit(); #else if (XieInitPtr != NULL) { (*XieInitPtr)(); } #endif #endif #ifdef XSYNC SyncExtensionInit(); #endif #ifdef XKB if (!noXkbExtension) XkbExtensionInit(); #endif #ifdef XCMISC XCMiscExtensionInit(); #endif #ifdef XRECORD if (!noTestExtensions) RecordExtensionInit(); #endif #ifdef LBX LbxExtensionInit(); #endif #ifdef DBE DbeExtensionInit(); #endif #ifdef XAPPGROUP XagExtensionInit(); #endif #ifdef XCSECURITY SecurityExtensionInit(); #endif #ifdef XPRINT XpExtensionInit(); #endif #if defined(XF86VIDMODE) && !defined(PRINT_ONLY_SERVER) XFree86VidModeExtensionInit(); #endif #if defined(XF86MISC) && !defined(PRINT_ONLY_SERVER) XFree86MiscExtensionInit(); #endif #if defined(XFreeXDGA) && !defined(PRINT_ONLY_SERVER) XFree86DGAExtensionInit(); #endif #if defined(DPMSExtension) && !defined(PRINT_ONLY_SERVER) DPMSExtensionInit(); #endif #ifdef GLXEXT #ifndef GLX_MODULE GlxExtensionInit(); #else if (GlxExtensionInitPtr != NULL) { (*GlxExtensionInitPtr)(); } #endif #endif } vnc_unixsrc/Xvnc/programs/Xserver/mi/mi.h0100664000076400007640000003424507120677563020106 0ustar constconst/* $XConsortium: mi.h,v 1.17 94/04/17 20:27:10 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.1 1997/01/14 22:22:51 dawes Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MI_H #define MI_H #include "X11/X.h" #include "region.h" #include "validate.h" #include "window.h" #include "gc.h" #include "font.h" #include "input.h" #include "cursor.h" typedef struct _miDash *miDashPtr; #define EVEN_DASH 0 #define ODD_DASH ~0 /* miarc.c */ extern void miPolyArc( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* mibitblt.c */ extern RegionPtr miCopyArea( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*xIn*/, int /*yIn*/, int /*widthSrc*/, int /*heightSrc*/, int /*xOut*/, int /*yOut*/ #endif ); extern void miOpqStipDrawable( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, RegionPtr /*prgnSrc*/, unsigned long * /*pbits*/, int /*srcx*/, int /*w*/, int /*h*/, int /*dstx*/, int /*dsty*/ #endif ); extern RegionPtr miCopyPlane( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*bitPlane*/ #endif ); extern void miGetImage( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, int /*sx*/, int /*sy*/, int /*w*/, int /*h*/, unsigned int /*format*/, unsigned long /*planeMask*/, char * /*pdstLine*/ #endif ); extern void miPutImage( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*depth*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*leftPad*/, int /*format*/, char * /*pImage*/ #endif ); /* miclipn.c */ extern void miClipNotify( #if NeedFunctionPrototypes void (* /*func*/)( #if NeedNestedPrototypes WindowPtr /* pWin */, int /* dx */, int /* dy */ #endif ) #endif ); /* micursor.c */ extern void miRecolorCursor( #if NeedFunctionPrototypes ScreenPtr /*pScr*/, CursorPtr /*pCurs*/, Bool /*displayed*/ #endif ); /* midash.c */ extern miDashPtr miDashLine( #if NeedFunctionPrototypes int /*npt*/, DDXPointPtr /*ppt*/, unsigned int /*nDash*/, unsigned char * /*pDash*/, unsigned int /*offset*/, int * /*pnseg*/ #endif ); extern void miStepDash( #if NeedFunctionPrototypes int /*dist*/, int * /*pDashIndex*/, unsigned char * /*pDash*/, int /*numInDashList*/, int * /*pDashOffset*/ #endif ); /* mieq.c */ #ifndef INPUT_H typedef struct _DeviceRec *DevicePtr; #endif extern Bool mieqInit( #if NeedFunctionPrototypes DevicePtr /*pKbd*/, DevicePtr /*pPtr*/ #endif ); extern void mieqEnqueue( #if NeedFunctionPrototypes xEventPtr /*e*/ #endif ); extern void mieqSwitchScreen( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, Bool /*fromDIX*/ #endif ); extern int mieqProcessInputEvents( #if NeedFunctionPrototypes void #endif ); /* miexpose.c */ extern RegionPtr miHandleExposures( #if NeedFunctionPrototypes DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, GCPtr /*pGC*/, int /*srcx*/, int /*srcy*/, int /*width*/, int /*height*/, int /*dstx*/, int /*dsty*/, unsigned long /*plane*/ #endif ); extern void miSendGraphicsExpose( #if NeedFunctionPrototypes ClientPtr /*client*/, RegionPtr /*pRgn*/, XID /*drawable*/, int /*major*/, int /*minor*/ #endif ); extern void miSendExposures( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*pRgn*/, int /*dx*/, int /*dy*/ #endif ); extern void miWindowExposures( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*prgn*/, RegionPtr /*other_exposed*/ #endif ); extern void miPaintWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, RegionPtr /*prgn*/, int /*what*/ #endif ); extern int miClearDrawable( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/ #endif ); /* mifillrct.c */ extern void miPolyFillRect( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*nrectFill*/, xRectangle * /*prectInit*/ #endif ); /* miglblt.c */ extern void miPolyGlyphBlt( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); extern void miImageGlyphBlt( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, unsigned int /*nglyph*/, CharInfoPtr * /*ppci*/, pointer /*pglyphBase*/ #endif ); /* mipoly.c */ extern void miFillPolygon( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*shape*/, int /*mode*/, int /*count*/, DDXPointPtr /*pPts*/ #endif ); /* mipolycon.c */ extern Bool miFillConvexPoly( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* mipolygen.c */ extern Bool miFillGeneralPoly( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, DDXPointPtr /*ptsIn*/ #endif ); /* mipolypnt.c */ extern void miPolyPoint( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, xPoint * /*pptInit*/ #endif ); /* mipolyrect.c */ extern void miPolyRectangle( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nrects*/, xRectangle * /*pRects*/ #endif ); /* mipolyseg.c */ extern void miPolySegment( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*nseg*/, xSegment * /*pSegs*/ #endif ); /* mipolytext.c */ extern int miPolyText( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ #endif ); extern int miPolyText8( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ #endif ); extern int miPolyText16( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ #endif ); extern int miImageText( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/, FontEncoding /*fontEncoding*/ #endif ); extern void miImageText8( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, char * /*chars*/ #endif ); extern void miImageText16( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*x*/, int /*y*/, int /*count*/, unsigned short * /*chars*/ #endif ); /* mipushpxl.c */ extern void miPushPixels( #if NeedFunctionPrototypes GCPtr /*pGC*/, PixmapPtr /*pBitMap*/, DrawablePtr /*pDrawable*/, int /*dx*/, int /*dy*/, int /*xOrg*/, int /*yOrg*/ #endif ); /* miregion.c */ /* see also region.h */ extern Bool miRectAlloc( #if NeedFunctionPrototypes RegionPtr /*pRgn*/, int /*n*/ #endif ); extern void miSetExtents( #if NeedFunctionPrototypes RegionPtr /*pReg*/ #endif ); extern int miFindMaxBand( #if NeedFunctionPrototypes RegionPtr /*prgn*/ #endif ); #ifdef DEBUG extern Bool miValidRegion( #if NeedFunctionPrototypes RegionPtr /*prgn*/ #endif ); #endif /* miscrinit.c */ extern Bool miModifyPixmapHeader( #if NeedFunctionPrototypes PixmapPtr /*pPixmap*/, int /*width*/, int /*height*/, int /*depth*/, int /*bitsPerPixel*/, int /*devKind*/, pointer /*pPixData*/ #endif ); extern Bool miCloseScreen( #if NeedFunctionPrototypes int /*index*/, ScreenPtr /*pScreen*/ #endif ); extern Bool miCreateScreenResources( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern Bool miScreenDevPrivateInit( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*width*/, pointer /*pbits*/ #endif ); #ifndef _XTYPEDEF_MIBSFUNCPTR typedef struct _miBSFuncRec *miBSFuncPtr; #define _XTYPEDEF_MIBSFUNCPTR #endif extern Bool miScreenInit( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, pointer /*pbits*/, int /*xsize*/, int /*ysize*/, int /*dpix*/, int /*dpiy*/, int /*width*/, int /*rootDepth*/, int /*numDepths*/, DepthPtr /*depths*/, VisualID /*rootVisual*/, int /*numVisuals*/, VisualPtr /*visuals*/, miBSFuncPtr /*bsfuncs*/ #endif ); extern int miAllocateGCPrivateIndex( #if NeedFunctionPrototypes void #endif ); /* mivaltree.c */ extern int miShapedWindowIn( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, RegionPtr /*universe*/, RegionPtr /*bounding*/, BoxPtr /*rect*/, int /*x*/, int /*y*/ #endif ); extern int miValidateTree( #if NeedFunctionPrototypes WindowPtr /*pParent*/, WindowPtr /*pChild*/, VTKind /*kind*/ #endif ); extern void miWideLine( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ #endif ); extern void miWideDash( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, int /*mode*/, int /*npt*/, DDXPointPtr /*pPts*/ #endif ); extern void miMiter( #if NeedFunctionPrototypes void #endif ); extern void miNotMiter( #if NeedFunctionPrototypes void #endif ); /* miwindow.c */ extern void miClearToBackground( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/, Bool /*generateExposures*/ #endif ); extern Bool miChangeSaveUnder( #if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*first*/ #endif ); extern void miPostChangeSaveUnder( #if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pFirst*/ #endif ); extern void miMarkWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern Bool miMarkOverlappedWindows( #if NeedFunctionPrototypes WindowPtr /*pWin*/, WindowPtr /*pFirst*/, WindowPtr * /*ppLayerWin*/ #endif ); extern void miHandleValidateExposures( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void miMoveWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, WindowPtr /*pNextSib*/, VTKind /*kind*/ #endif ); extern void miSlideAndSizeWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/, int /*x*/, int /*y*/, unsigned int /*w*/, unsigned int /*h*/, WindowPtr /*pSib*/ #endif ); extern WindowPtr miGetLayerWindow( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void miSetShape( #if NeedFunctionPrototypes WindowPtr /*pWin*/ #endif ); extern void miChangeBorderWidth( #if NeedFunctionPrototypes WindowPtr /*pWin*/, unsigned int /*width*/ #endif ); extern void miMarkUnrealizedWindow( #if NeedFunctionPrototypes WindowPtr /*pChild*/, WindowPtr /*pWin*/, Bool /*fromConfigure*/ #endif ); extern void miZeroPolyArc( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); /* mizerline.c */ extern void miZeroLine( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ #endif ); extern void miZeroDashLine( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*mode*/, int /*nptInit*/, DDXPointRec * /*pptInit*/ #endif ); extern void miPolyFillArc( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, int /*narcs*/, xArc * /*parcs*/ #endif ); #endif /* MI_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/mipointer.h0100664000076400007640000001146607120677563021507 0ustar constconst/* * mipointer.h * */ /* $XConsortium: mipointer.h,v 5.7 94/04/17 20:27:40 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.2 1996/03/10 12:12:45 dawes Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef MIPOINTER_H #define MIPOINTER_H typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */ #endif ); Bool (*UnrealizeCursor)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */ #endif ); void (*SetCursor)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, CursorPtr /* pCurs */, int /* x */, int /* y */ #endif ); void (*MoveCursor)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* x */, int /* y */ #endif ); } miPointerSpriteFuncRec, *miPointerSpriteFuncPtr; typedef struct _miPointerScreenFuncRec { Bool (*CursorOffScreen)( #if NeedFunctionPrototypes ScreenPtr* /* ppScr */, int* /* px */, int* /* py */ #endif ); void (*CrossScreen)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* entering */ #endif ); void (*WarpCursor)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, int /* x */, int /* y */ #endif ); void (*EnqueueEvent)( #if NeedFunctionPrototypes xEventPtr /* event */ #endif ); void (*NewEventScreen)( #if NeedFunctionPrototypes ScreenPtr /* pScr */, Bool /* fromDIX */ #endif ); } miPointerScreenFuncRec, *miPointerScreenFuncPtr; extern Bool miDCInitialize( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miPointerScreenFuncPtr /*screenFuncs*/ #endif ); extern Bool miPointerInitialize( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miPointerSpriteFuncPtr /*spriteFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/, Bool /*waitForUpdate*/ #endif ); extern void miPointerWarpCursor( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/ #endif ); extern int miPointerGetMotionBufferSize( #if NeedFunctionPrototypes void #endif ); extern int miPointerGetMotionEvents( #if NeedFunctionPrototypes DeviceIntPtr /*pPtr*/, xTimecoord * /*coords*/, unsigned long /*start*/, unsigned long /*stop*/, ScreenPtr /*pScreen*/ #endif ); extern void miPointerUpdate( #if NeedFunctionPrototypes void #endif ); extern void miPointerDeltaCursor( #if NeedFunctionPrototypes int /*dx*/, int /*dy*/, unsigned long /*time*/ #endif ); extern void miPointerAbsoluteCursor( #if NeedFunctionPrototypes int /*x*/, int /*y*/, unsigned long /*time*/ #endif ); extern void miPointerPosition( #if NeedFunctionPrototypes int * /*x*/, int * /*y*/ #endif ); #undef miRegisterPointerDevice extern void miRegisterPointerDevice( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, DevicePtr /*pDevice*/ #endif ); #define miRegisterPointerDevice(pScreen,pDevice) \ _miRegisterPointerDevice(pScreen,pDevice) extern void _miRegisterPointerDevice( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, DeviceIntPtr /*pDevice*/ #endif ); #endif /* MIPOINTER_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/mizerarc.c0100664000076400007640000004721507120677563021311 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Author: Bob Scheifler, MIT X Consortium ********************************************************/ /* $XConsortium: mizerarc.c,v 5.36 94/04/17 20:28:04 dpw Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" * by M. L. V. Pitteway * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 */ #include #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmapstr.h" #include "mi.h" #include "mizerarc.h" #define FULLCIRCLE (360 * 64) #define OCTANT (45 * 64) #define QUADRANT (90 * 64) #define HALFCIRCLE (180 * 64) #define QUADRANT3 (270 * 64) #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define Dsin(d) ((d) == 0 ? 0.0 : ((d) == QUADRANT ? 1.0 : \ ((d) == HALFCIRCLE ? 0.0 : \ ((d) == QUADRANT3 ? -1.0 : sin((double)d*(M_PI/11520.0)))))) #define Dcos(d) ((d) == 0 ? 1.0 : ((d) == QUADRANT ? 0.0 : \ ((d) == HALFCIRCLE ? -1.0 : \ ((d) == QUADRANT3 ? 0.0 : cos((double)d*(M_PI/11520.0)))))) #define EPSILON45 64 typedef struct { int skipStart; int haveStart; DDXPointRec startPt; int haveLast; int skipLast; DDXPointRec endPt; int dashIndex; int dashOffset; int dashIndexInit; int dashOffsetInit; } DashInfo; static miZeroArcPtRec oob = {65536, 65536, 0}; /* * (x - l)^2 / (W/2)^2 + (y + H/2)^2 / (H/2)^2 = 1 * * where l is either 0 or .5 * * alpha = 4(W^2) * beta = 4(H^2) * gamma = 0 * u = 2(W^2)H * v = 4(H^2)l * k = -4(H^2)(l^2) * */ Bool miZeroArcSetup(arc, info, ok360) register xArc *arc; register miZeroArcRec *info; Bool ok360; { int l; int angle1, angle2; int startseg, endseg; int startAngle, endAngle; int i, overlap; miZeroArcPtRec start, end; l = arc->width & 1; if (arc->width == arc->height) { info->alpha = 4; info->beta = 4; info->k1 = -8; info->k3 = -16; info->b = 12; info->a = (arc->width << 2) - 12; info->d = 17 - (arc->width << 1); if (l) { info->b -= 4; info->a += 4; info->d -= 7; } } else if (!arc->width || !arc->height) { info->alpha = 0; info->beta = 0; info->k1 = 0; info->k3 = 0; info->a = -(int)arc->height; info->b = 0; info->d = -1; } else { /* initial conditions */ info->alpha = (arc->width * arc->width) << 2; info->beta = (arc->height * arc->height) << 2; info->k1 = info->beta << 1; info->k3 = info->k1 + (info->alpha << 1); info->b = l ? 0 : -info->beta; info->a = info->alpha * arc->height; info->d = info->b - (info->a >> 1) - (info->alpha >> 2); if (l) info->d -= info->beta >> 2; info->a -= info->b; /* take first step, d < 0 always */ info->b -= info->k1; info->a += info->k1; info->d += info->b; /* octant change, b < 0 always */ info->k1 = -info->k1; info->k3 = -info->k3; info->b = -info->b; info->d = info->b - info->a - info->d; info->a = info->a - (info->b << 1); } info->dx = 1; info->dy = 0; info->w = (arc->width + 1) >> 1; info->h = arc->height >> 1; info->xorg = arc->x + (arc->width >> 1); info->yorg = arc->y; info->xorgo = info->xorg + l; info->yorgo = info->yorg + arc->height; if (!arc->width) { if (!arc->height) { info->x = 0; info->y = 0; info->initialMask = 0; info->startAngle = 0; info->endAngle = 0; info->start = oob; info->end = oob; return FALSE; } info->x = 0; info->y = 1; } else { info->x = 1; info->y = 0; } angle1 = arc->angle1; angle2 = arc->angle2; if ((angle1 == 0) && (angle2 >= FULLCIRCLE)) { startAngle = 0; endAngle = 0; } else { if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; if (angle2 < 0) { startAngle = angle1 + angle2; endAngle = angle1; } else { startAngle = angle1; endAngle = angle1 + angle2; } if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle >= FULLCIRCLE) endAngle = endAngle % FULLCIRCLE; } info->startAngle = startAngle; info->endAngle = endAngle; if (ok360 && (startAngle == endAngle) && arc->angle2 && arc->width && arc->height) { info->initialMask = 0xf; info->start = oob; info->end = oob; return TRUE; } startseg = startAngle / OCTANT; if (!arc->height || (((startseg + 1) & 2) && arc->width)) { start.x = Dcos(startAngle) * ((arc->width + 1) / 2.0); if (start.x < 0) start.x = -start.x; start.y = -1; } else { start.y = Dsin(startAngle) * (arc->height / 2.0); if (start.y < 0) start.y = -start.y; start.y = info->h - start.y; start.x = 65536; } endseg = endAngle / OCTANT; if (!arc->height || (((endseg + 1) & 2) && arc->width)) { end.x = Dcos(endAngle) * ((arc->width + 1) / 2.0); if (end.x < 0) end.x = -end.x; end.y = -1; } else { end.y = Dsin(endAngle) * (arc->height / 2.0); if (end.y < 0) end.y = -end.y; end.y = info->h - end.y; end.x = 65536; } info->firstx = start.x; info->firsty = start.y; info->initialMask = 0; overlap = arc->angle2 && (endAngle <= startAngle); for (i = 0; i < 4; i++) { if (overlap ? ((i * QUADRANT <= endAngle) || ((i + 1) * QUADRANT > startAngle)) : ((i * QUADRANT <= endAngle) && ((i + 1) * QUADRANT > startAngle))) info->initialMask |= (1 << i); } start.mask = info->initialMask; end.mask = info->initialMask; startseg >>= 1; endseg >>= 1; overlap = overlap && (endseg == startseg); if (start.x != end.x || start.y != end.y || !overlap) { if (startseg & 1) { if (!overlap) info->initialMask &= ~(1 << startseg); if (start.x > end.x || start.y > end.y) end.mask &= ~(1 << startseg); } else { start.mask &= ~(1 << startseg); if (((start.x < end.x || start.y < end.y) || (start.x == end.x && start.y == end.y && (endseg & 1))) && !overlap) end.mask &= ~(1 << startseg); } if (endseg & 1) { end.mask &= ~(1 << endseg); if (((start.x > end.x || start.y > end.y) || (start.x == end.x && start.y == end.y && !(startseg & 1))) && !overlap) start.mask &= ~(1 << endseg); } else { if (!overlap) info->initialMask &= ~(1 << endseg); if (start.x < end.x || start.y < end.y) start.mask &= ~(1 << endseg); } } /* take care of case when start and stop are both near 45 */ /* handle here rather than adding extra code to pixelization loops */ if (startAngle && ((start.y < 0 && end.y >= 0) || (start.y >= 0 && end.y < 0))) { i = (startAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { i = (endAngle + OCTANT) % OCTANT; if (i < EPSILON45 || i > OCTANT - EPSILON45) { if (start.y < 0) { i = Dsin(startAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == end.y) start.mask = end.mask; } else { i = Dsin(endAngle) * (arc->height / 2.0); if (i < 0) i = -i; if (info->h - i == start.y) end.mask = start.mask; } } } } if (startseg & 1) { info->start = start; info->end = oob; } else { info->end = start; info->start = oob; } if (endseg & 1) { info->altend = end; if (info->altend.x < info->end.x || info->altend.y < info->end.y) { miZeroArcPtRec tmp; tmp = info->altend; info->altend = info->end; info->end = tmp; } info->altstart = oob; } else { info->altstart = end; if (info->altstart.x < info->start.x || info->altstart.y < info->start.y) { miZeroArcPtRec tmp; tmp = info->altstart; info->altstart = info->start; info->start = tmp; } info->altend = oob; } if (!info->start.x || !info->start.y) { info->initialMask = info->start.mask; info->start = info->altstart; } if (!arc->width && (arc->height == 1)) { /* kludge! */ info->initialMask |= info->end.mask; info->initialMask |= info->initialMask << 1; info->end.x = 0; info->end.mask = 0; } return FALSE; } #define Pixelate(xval,yval) \ { \ pts->x = xval; \ pts->y = yval; \ pts++; \ } #define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval); DDXPointPtr miZeroArcPts(arc, pts) xArc *arc; register DDXPointPtr pts; { miZeroArcRec info; register int x, y, a, b, d, mask; register int k1, k3, dx, dy; Bool do360; do360 = miZeroArcSetup(arc, &info, TRUE); MIARCSETUP(); mask = info.initialMask; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } if (do360 && (arc->width == arc->height) && !(arc->width & 1)) { int yorgh = info.yorg + info.h; int xorghp = info.xorg + info.h; int xorghn = info.xorg - info.h; while (1) { Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorg - x, info.yorg + y); Pixelate(info.xorg - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); if (a < 0) break; Pixelate(xorghp - y, yorgh - x); Pixelate(xorghn + y, yorgh - x); Pixelate(xorghn + y, yorgh + x); Pixelate(xorghp - y, yorgh + x); MIARCCIRCLESTEP(;); } if (x > 1 && pts[-1].x == pts[-5].x && pts[-1].y == pts[-5].y) pts -= 4; x = info.w; y = info.h; } else if (do360) { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); Pixelate(info.xorg + x, info.yorg + y); Pixelate(info.xorgo - x, info.yorg + y); Pixelate(info.xorgo - x, info.yorgo - y); Pixelate(info.xorg + x, info.yorgo - y); MIARCSTEP(;,;); } } else { while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(;,;); } } if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } return pts; } #undef DoPix #define DoPix(idx,xval,yval) \ if (mask & (1 << idx)) \ { \ arcPts[idx]->x = xval; \ arcPts[idx]->y = yval; \ arcPts[idx]++; \ } static void miZeroArcDashPts(pGC, arc, dinfo, points, maxPts, evenPts, oddPts) GCPtr pGC; xArc *arc; DashInfo *dinfo; int maxPts; register DDXPointPtr points, *evenPts, *oddPts; { miZeroArcRec info; register int x, y, a, b, d, mask; register int k1, k3, dx, dy; int dashRemaining; DDXPointPtr arcPts[4]; DDXPointPtr startPts[5], endPts[5]; int deltas[5]; DDXPointPtr startPt, pt, lastPt, pts; int i, j, delta, ptsdelta, seg, startseg; for (i = 0; i < 4; i++) arcPts[i] = points + (i * maxPts); (void)miZeroArcSetup(arc, &info, FALSE); MIARCSETUP(); mask = info.initialMask; startseg = info.startAngle / QUADRANT; startPt = arcPts[startseg]; if (!(arc->width & 1)) { DoPix(1, info.xorgo, info.yorg); DoPix(3, info.xorgo, info.yorgo); } if (!info.end.x || !info.end.y) { mask = info.end.mask; info.end = info.altend; } while (y < info.h || x < info.w) { MIARCOCTANTSHIFT(;); if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) { mask = info.start.mask; info.start = info.altstart; } DoPix(0, info.xorg + x, info.yorg + y); DoPix(1, info.xorgo - x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); DoPix(3, info.xorg + x, info.yorgo - y); if ((x == info.end.x) || (y == info.end.y)) { mask = info.end.mask; info.end = info.altend; } MIARCSTEP(;,;); } if ((x == info.firstx) || (y == info.firsty)) startPt = arcPts[startseg]; if ((x == info.start.x) || (y == info.start.y)) mask = info.start.mask; DoPix(0, info.xorg + x, info.yorg + y); DoPix(2, info.xorgo - x, info.yorgo - y); if (arc->height & 1) { DoPix(1, info.xorgo - x, info.yorg + y); DoPix(3, info.xorg + x, info.yorgo - y); } for (i = 0; i < 4; i++) { seg = (startseg + i) & 3; pt = points + (seg * maxPts); if (seg & 1) { startPts[i] = pt; endPts[i] = arcPts[seg]; deltas[i] = 1; } else { startPts[i] = arcPts[seg] - 1; endPts[i] = pt - 1; deltas[i] = -1; } } startPts[4] = startPts[0]; endPts[4] = startPt; startPts[0] = startPt; if (startseg & 1) { if (startPts[4] != endPts[4]) endPts[4]--; deltas[4] = 1; } else { if (startPts[0] > startPts[4]) startPts[0]--; if (startPts[4] < endPts[4]) endPts[4]--; deltas[4] = -1; } if (arc->angle2 < 0) { DDXPointPtr tmps, tmpe; int tmpd; tmpd = deltas[0]; tmps = startPts[0] - tmpd; tmpe = endPts[0] - tmpd; startPts[0] = endPts[4] - deltas[4]; endPts[0] = startPts[4] - deltas[4]; deltas[0] = -deltas[4]; startPts[4] = tmpe; endPts[4] = tmps; deltas[4] = -tmpd; tmpd = deltas[1]; tmps = startPts[1] - tmpd; tmpe = endPts[1] - tmpd; startPts[1] = endPts[3] - deltas[3]; endPts[1] = startPts[3] - deltas[3]; deltas[1] = -deltas[3]; startPts[3] = tmpe; endPts[3] = tmps; deltas[3] = -tmpd; tmps = startPts[2] - deltas[2]; startPts[2] = endPts[2] - deltas[2]; endPts[2] = tmps; deltas[2] = -deltas[2]; } for (i = 0; i < 5 && startPts[i] == endPts[i]; i++) ; if (i == 5) return; pt = startPts[i]; for (j = 4; startPts[j] == endPts[j]; j--) ; lastPt = endPts[j] - deltas[j]; if (dinfo->haveLast && (pt->x == dinfo->endPt.x) && (pt->y == dinfo->endPt.y)) { startPts[i] += deltas[i]; } else { dinfo->dashIndex = dinfo->dashIndexInit; dinfo->dashOffset = dinfo->dashOffsetInit; } if (!dinfo->skipStart && (info.startAngle != info.endAngle)) { dinfo->startPt = *pt; dinfo->haveStart = TRUE; } else if (!dinfo->skipLast && dinfo->haveStart && (lastPt->x == dinfo->startPt.x) && (lastPt->y == dinfo->startPt.y) && (lastPt != startPts[i])) endPts[j] = lastPt; if (info.startAngle != info.endAngle) { dinfo->haveLast = TRUE; dinfo->endPt = *lastPt; } dashRemaining = pGC->dash[dinfo->dashIndex] - dinfo->dashOffset; for (i = 0; i < 5; i++) { pt = startPts[i]; lastPt = endPts[i]; delta = deltas[i]; while (pt != lastPt) { if (dinfo->dashIndex & 1) { pts = *oddPts; ptsdelta = -1; } else { pts = *evenPts; ptsdelta = 1; } while ((pt != lastPt) && --dashRemaining >= 0) { *pts = *pt; pts += ptsdelta; pt += delta; } if (dinfo->dashIndex & 1) *oddPts = pts; else *evenPts = pts; if (dashRemaining <= 0) { if (++(dinfo->dashIndex) == pGC->numInDashList) dinfo->dashIndex = 0; dashRemaining = pGC->dash[dinfo->dashIndex]; } } } dinfo->dashOffset = pGC->dash[dinfo->dashIndex] - dashRemaining; } void miZeroPolyArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { int maxPts = 0; register int n, maxw; register xArc *arc; register int i; DDXPointPtr points, pts, oddPts; register DDXPointPtr pt; int numPts; Bool dospans; int *widths; XID fgPixel = pGC->fgPixel; DashInfo dinfo; for (arc = parcs, i = narcs; --i >= 0; arc++) { if (!miCanZeroArc(arc)) miPolyArc(pDraw, pGC, 1, arc); else { if (arc->width > arc->height) n = arc->width + (arc->height >> 1); else n = arc->height + (arc->width >> 1); if (n > maxPts) maxPts = n; } } if (!maxPts) return; numPts = maxPts << 2; dospans = (pGC->lineStyle != LineSolid) || (pGC->fillStyle != FillSolid); if (dospans) { widths = (int *)ALLOCATE_LOCAL(sizeof(int) * numPts); if (!widths) return; maxw = 0; } if (pGC->lineStyle != LineSolid) { numPts <<= 1; dinfo.haveStart = FALSE; dinfo.skipStart = FALSE; dinfo.haveLast = FALSE; dinfo.dashIndexInit = 0; dinfo.dashOffsetInit = 0; miStepDash((int)pGC->dashOffset, &dinfo.dashIndexInit, (unsigned char *) pGC->dash, (int)pGC->numInDashList, &dinfo.dashOffsetInit); } points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * numPts); if (!points) { if (dospans) { DEALLOCATE_LOCAL(widths); } return; } for (arc = parcs, i = narcs; --i >= 0; arc++) { if (miCanZeroArc(arc)) { if (pGC->lineStyle == LineSolid) pts = miZeroArcPts(arc, points); else { pts = points; oddPts = &points[(numPts >> 1) - 1]; dinfo.skipLast = i; miZeroArcDashPts(pGC, arc, &dinfo, oddPts + 1, maxPts, &pts, &oddPts); dinfo.skipStart = TRUE; } n = pts - points; if (!dospans) (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, points); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = points; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, FALSE); } if (pGC->lineStyle != LineDoubleDash) continue; if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { DoChangeGC(pGC, GCForeground, (XID *)&pGC->bgPixel, 0); ValidateGC(pDraw, pGC); } pts = &points[numPts >> 1]; oddPts++; n = pts - oddPts; if (!dospans) (*pGC->ops->PolyPoint)(pDraw, pGC, CoordModeOrigin, n, oddPts); else { if (n > maxw) { while (maxw < n) widths[maxw++] = 1; } if (pGC->miTranslate) { for (pt = oddPts; pt != pts; pt++) { pt->x += pDraw->x; pt->y += pDraw->y; } } (*pGC->ops->FillSpans)(pDraw, pGC, n, oddPts, widths, FALSE); } if ((pGC->fillStyle == FillSolid) || (pGC->fillStyle == FillStippled)) { DoChangeGC(pGC, GCForeground, &fgPixel, 0); ValidateGC(pDraw, pGC); } } } DEALLOCATE_LOCAL(points); if (dospans) { DEALLOCATE_LOCAL(widths); } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipointrst.h0100664000076400007640000000466507120677563021714 0ustar constconst/* * mipointrst.h * */ /* $XConsortium: mipointrst.h,v 5.7 94/04/17 20:27:41 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # include # include #define MOTION_SIZE 256 typedef struct { xTimecoord event; ScreenPtr pScreen; } miHistoryRec, *miHistoryPtr; typedef struct { ScreenPtr pScreen; /* current screen */ ScreenPtr pSpriteScreen;/* screen containing current sprite */ CursorPtr pCursor; /* current cursor */ CursorPtr pSpriteCursor;/* cursor on screen */ BoxRec limits; /* current constraints */ Bool confined; /* pointer can't change screens */ int x, y; /* hot spot location */ int devx, devy; /* sprite position */ DevicePtr pPointer; /* pointer device structure */ miHistoryRec history[MOTION_SIZE]; int history_start, history_end; } miPointerRec, *miPointerPtr; typedef struct { miPointerSpriteFuncPtr spriteFuncs; /* sprite-specific methods */ miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */ CloseScreenProcPtr CloseScreen; Bool waitForUpdate; /* don't move cursor in SIGIO */ } miPointerScreenRec, *miPointerScreenPtr; vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolytext.c0100664000076400007640000001401707120677563021705 0ustar constconst/******************************************************************* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ************************************************************************/ /* $XConsortium: mipolytext.c,v 5.4 94/04/17 20:27:45 keith Exp $ */ /* * mipolytext.c - text routines * * Author: haynes * Digital Equipment Corporation * Western Software Laboratory * Date: Thu Feb 5 1987 */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "misc.h" #include "gcstruct.h" #include "fontstruct.h" #include "dixfontstr.h" int miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; FontEncoding fontEncoding; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, fontEncoding, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miPolyText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, Linear8Bit, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miPolyText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { unsigned long n, i; int w; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n != 0) (*pGC->ops->PolyGlyphBlt)( pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); return x+w; } int miImageText(pDraw, pGC, x, y, count, chars, fontEncoding) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; FontEncoding fontEncoding; { unsigned long n, i; FontPtr font = pGC->font; int w; CharInfoPtr charinfo[255]; GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, fontEncoding, &n, charinfo); w = 0; for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); return x+w; } void miImageText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; char *chars; { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, Linear8Bit, &n, charinfo); if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } void miImageText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; GCPtr pGC; int x, y; int count; unsigned short *chars; { unsigned long n; FontPtr font = pGC->font; CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, &n, charinfo); if (n !=0 ) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipoly.h0100664000076400007640000001660607120677563021013 0ustar constconst/* $XConsortium: mipoly.h,v 1.5 94/04/17 20:27:42 dpw Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* * fill.h * * Created by Brian Kelleher; Oct 1985 * * Include file for filled polygon routines. * * These are the data structures needed to scan * convert regions. Two different scan conversion * methods are available -- the even-odd method, and * the winding number method. * The even-odd rule states that a point is inside * the polygon if a ray drawn from that point in any * direction will pass through an odd number of * path segments. * By the winding number rule, a point is decided * to be inside the polygon if a ray drawn from that * point in any direction passes through a different * number of clockwise and counter-clockwise path * segments. * * These data structures are adapted somewhat from * the algorithm in (Foley/Van Dam) for scan converting * polygons. * The basic algorithm is to start at the top (smallest y) * of the polygon, stepping down to the bottom of * the polygon by incrementing the y coordinate. We * keep a list of edges which the current scanline crosses, * sorted by x. This list is called the Active Edge Table (AET) * As we change the y-coordinate, we update each entry in * in the active edge table to reflect the edges new xcoord. * This list must be sorted at each scanline in case * two edges intersect. * We also keep a data structure known as the Edge Table (ET), * which keeps track of all the edges which the current * scanline has not yet reached. The ET is basically a * list of ScanLineList structures containing a list of * edges which are entered at a given scanline. There is one * ScanLineList per scanline at which an edge is entered. * When we enter a new edge, we move it from the ET to the AET. * * From the AET, we can implement the even-odd rule as in * (Foley/Van Dam). * The winding number rule is a little trickier. We also * keep the EdgeTableEntries in the AET linked by the * nextWETE (winding EdgeTableEntry) link. This allows * the edges to be linked just as before for updating * purposes, but only uses the edges linked by the nextWETE * link as edges representing spans of the polygon to * drawn (as with the even-odd rule). */ /* * for the winding number rule */ #define CLOCKWISE 1 #define COUNTERCLOCKWISE -1 typedef struct _EdgeTableEntry { int ymax; /* ycoord at which we exit this edge. */ BRESINFO bres; /* Bresenham info to run the edge */ struct _EdgeTableEntry *next; /* next in the list */ struct _EdgeTableEntry *back; /* for insertion sort */ struct _EdgeTableEntry *nextWETE; /* for winding num rule */ int ClockWise; /* flag for winding number rule */ } EdgeTableEntry; typedef struct _ScanLineList{ int scanline; /* the scanline represented */ EdgeTableEntry *edgelist; /* header node */ struct _ScanLineList *next; /* next in the list */ } ScanLineList; typedef struct { int ymax; /* ymax for the polygon */ int ymin; /* ymin for the polygon */ ScanLineList scanlines; /* header node */ } EdgeTable; /* * Here is a struct to help with storage allocation * so we can allocate a big chunk at a time, and then take * pieces from this heap when we need to. */ #define SLLSPERBLOCK 25 typedef struct _ScanLineListBlock { ScanLineList SLLs[SLLSPERBLOCK]; struct _ScanLineListBlock *next; } ScanLineListBlock; /* * number of points to buffer before sending them off * to scanlines() : Must be an even number */ #define NUMPTSTOBUFFER 200 /* * * a few macros for the inner loops of the fill code where * performance considerations don't allow a procedure call. * * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The winding number rule is in effect, so we must notify * the caller when the edge has been removed so he * can reorder the Winding Active Edge Table. */ #define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ fixWAET = 1; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* * Evaluate the given edge at the given scanline. * If the edge has expired, then we leave it and fix up * the active edge table; otherwise, we increment the * x value to be ready for the next scanline. * The even-odd rule is in effect. */ #define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ if (pAET->ymax == y) { /* leaving this edge */ \ pPrevAET->next = pAET->next; \ pAET = pPrevAET->next; \ if (pAET) \ pAET->back = pPrevAET; \ } \ else { \ BRESINCRPGONSTRUCT(pAET->bres); \ pPrevAET = pAET; \ pAET = pAET->next; \ } \ } /* mipolyutil.c */ extern Bool miInsertEdgeInET( #if NeedFunctionPrototypes EdgeTable * /*ET*/, EdgeTableEntry * /*ETE*/, int /*scanline*/, ScanLineListBlock ** /*SLLBlock*/, int * /*iSLLBlock*/ #endif ); extern Bool miCreateETandAET( #if NeedFunctionPrototypes int /*count*/, DDXPointPtr /*pts*/, EdgeTable * /*ET*/, EdgeTableEntry * /*AET*/, EdgeTableEntry * /*pETEs*/, ScanLineListBlock * /*pSLLBlock*/ #endif ); extern void miloadAET( #if NeedFunctionPrototypes EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs*/ #endif ); extern void micomputeWAET( #if NeedFunctionPrototypes EdgeTableEntry * /*AET*/ #endif ); extern int miInsertionSort( #if NeedFunctionPrototypes EdgeTableEntry * /*AET*/ #endif ); extern void miFreeStorage( #if NeedFunctionPrototypes ScanLineListBlock * /*pSLLBlock*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mifpolycon.c0100664000076400007640000002063407120677563021650 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mifpolycon.c,v 5.4 94/04/17 20:27:36 rws Exp $ */ #include #include "X.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" #include "mifpoly.h" static int GetFPolyYBounds(); #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif /* * Written by Todd Newman; April. 1987. * * Fill a convex polygon. If the given polygon * is not convex, then the result is undefined. * The algorithm is to order the edges from smallest * y to largest by partitioning the array into a left * edge list and a right edge list. The algorithm used * to traverse each edge is digital differencing analyzer * line algorithm with y as the major axis. There's some funny linear * interpolation involved because of the subpixel postioning. */ void miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ SppPointPtr ptsIn; /* the points */ int xTrans, yTrans; /* Translate each point by this */ double xFtrans, yFtrans; /* translate before conversion by this amount. This provides a mechanism to match rounding errors with any shape that must meet the polygon exactly. */ { double xl, xr, /* x vals of left and right edges */ ml, /* left edge slope */ mr, /* right edge slope */ dy, /* delta y */ i; /* loop counter */ int y, /* current scanline */ j, imin, /* index of vertex with smallest y */ ymin, /* y-extents of polygon */ ymax, *width, *FirstWidth, /* output buffer */ *Marked; /* set if this vertex has been used */ register int left, right, /* indices to first endpoints */ nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ if (pgc->miTranslate) { xTrans += dst->x; yTrans += dst->y; } imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax); y = ymax - ymin + 1; if ((count < 3) || (y <= 0)) return; ptsOut = FirstPoint = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * y); width = FirstWidth = (int *) ALLOCATE_LOCAL(sizeof(int) * y); Marked = (int *) ALLOCATE_LOCAL(sizeof(int) * count); if(!ptsOut || !width || !Marked) { if (Marked) DEALLOCATE_LOCAL(Marked); if (width) DEALLOCATE_LOCAL(width); if (ptsOut) DEALLOCATE_LOCAL(ptsOut); return; } for(j = 0; j < count; j++) Marked[j] = 0; nextleft = nextright = imin; Marked[imin] = -1; y = ICEIL(ptsIn[nextleft].y + yFtrans); /* * loop through all edges of the polygon */ do { /* add a left edge if we need to */ if ((y > (ptsIn[nextleft].y + yFtrans) || ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) && Marked[nextleft] != 1) { Marked[nextleft]++; left = nextleft++; /* find the next edge, considering the end conditions */ if (nextleft >= count) nextleft = 0; /* now compute the starting point and slope */ dy = ptsIn[nextleft].y - ptsIn[left].y; if (dy != 0.0) { ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy; dy = y - (ptsIn[left].y + yFtrans); xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0); } } /* add a right edge if we need to */ if ((y > ptsIn[nextright].y + yFtrans) || ISEQUAL(y, ptsIn[nextright].y + yFtrans) && Marked[nextright] != 1) { Marked[nextright]++; right = nextright--; /* find the next edge, considering the end conditions */ if (nextright < 0) nextright = count - 1; /* now compute the starting point and slope */ dy = ptsIn[nextright].y - ptsIn[right].y; if (dy != 0.0) { mr = (ptsIn[nextright].x - ptsIn[right].x) / dy; dy = y - (ptsIn[right].y + yFtrans); xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0); } } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y; if (i < EPSILON) { if(Marked[nextleft] && Marked[nextright]) { /* Arrgh, we're trapped! (no more points) * Out, we've got to get out of here before this decadence saps * our will completely! */ break; } continue; } else { j = (int) i; if(!j) j++; } while (j > 0) { int cxl, cxr; ptsOut->y = (y) + yTrans; cxl = ICEIL(xl); cxr = ICEIL(xr); /* reverse the edges if necessary */ if (xl < xr) { *(width++) = cxr - cxl; (ptsOut++)->x = cxl + xTrans; } else { *(width++) = cxl - cxr; (ptsOut++)->x = cxr + xTrans; } y++; /* increment down the edges */ xl += ml; xr += mr; j--; } } while (y <= ymax); /* Finally, fill the spans we've collected */ (*pgc->ops->FillSpans)(dst, pgc, ptsOut-FirstPoint, FirstPoint, FirstWidth, 1); DEALLOCATE_LOCAL(Marked); DEALLOCATE_LOCAL(FirstWidth); DEALLOCATE_LOCAL(FirstPoint); } /* Find the index of the point with the smallest y.also return the * smallest and largest y */ static int GetFPolyYBounds(pts, n, yFtrans, by, ty) register SppPointPtr pts; int n; double yFtrans; int *by, *ty; { register SppPointPtr ptMin; double ymin, ymax; SppPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if(pts->y > ymax) ymax = pts->y; pts++; } *by = ICEIL(ymin + yFtrans); *ty = ICEIL(ymax + yFtrans - 1); return(ptMin-ptsStart); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mizerarc.h0100664000076400007640000000620107120677563021304 0ustar constconst/************************************************************ Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. ********************************************************/ /* $XConsortium: mizerarc.h,v 5.13 94/04/17 20:28:04 dpw Exp $ */ typedef struct { int x; int y; int mask; } miZeroArcPtRec; typedef struct { int x, y, k1, k3, a, b, d, dx, dy; int alpha, beta; int xorg, yorg; int xorgo, yorgo; int w, h; int initialMask; miZeroArcPtRec start, altstart, end, altend; int firstx, firsty; int startAngle, endAngle; } miZeroArcRec; #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \ (((arc)->width <= 800) && ((arc)->height <= 800))) #define MIARCSETUP() \ x = info.x; \ y = info.y; \ k1 = info.k1; \ k3 = info.k3; \ a = info.a; \ b = info.b; \ d = info.d; \ dx = info.dx; \ dy = info.dy #define MIARCOCTANTSHIFT(clause) \ if (a < 0) \ { \ if (y == info.h) \ { \ d = -1; \ a = b = k1 = 0; \ } \ else \ { \ dx = (k1 << 1) - k3; \ k1 = dx - k1; \ k3 = -k3; \ b = b + a - (k1 >> 1); \ d = b + ((-a) >> 1) - d + (k3 >> 3); \ if (dx < 0) \ a = -((-dx) >> 1) - a; \ else \ a = (dx >> 1) - a; \ dx = 0; \ dy = 1; \ clause \ } \ } #define MIARCSTEP(move1,move2) \ b -= k1; \ if (d < 0) \ { \ x += dx; \ y += dy; \ a += k1; \ d += b; \ move1 \ } \ else \ { \ x++; \ y++; \ a += k3; \ d -= a; \ move2 \ } #define MIARCCIRCLESTEP(clause) \ b -= k1; \ x++; \ if (d < 0) \ { \ a += k1; \ d += b; \ } \ else \ { \ y++; \ a += k3; \ d -= a; \ clause \ } /* mizerarc.c */ extern Bool miZeroArcSetup( #if NeedFunctionPrototypes xArc * /*arc*/, miZeroArcRec * /*info*/, Bool /*ok360*/ #endif ); extern DDXPointPtr miZeroArcPts( #if NeedFunctionPrototypes xArc * /*arc*/, DDXPointPtr /*pts*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mivalidate.h0100664000076400007640000000357107120677563021616 0ustar constconst/* $XConsortium: mivalidate.h,v 1.3 94/04/17 20:27:57 dpw Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef MIVALIDATE_H #define MIVALIDATE_H #include "miscstruct.h" #include "regionstr.h" typedef union _Validate { struct BeforeValidate { DDXPointRec oldAbsCorner; /* old window position */ RegionPtr borderVisible; /* visible region of border, */ /* non-null when size changes */ Bool resized; /* unclipped winSize has changed - */ /* don't call SaveDoomedAreas */ } before; struct AfterValidate { RegionRec exposed; /* exposed regions, absolute pos */ RegionRec borderExposed; } after; } ValidateRec; #endif /* MIVALIDATE_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/mibstore.c0100664000076400007640000031136607120677563021322 0ustar constconst/* $XConsortium: mibstore.c,v 5.63 94/10/21 20:25:08 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by the Regents of the University of California All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name X Consortium not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The University of California makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. ******************************************************************/ #define NEED_EVENTS #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "extnsionst.h" #include "windowstr.h" #include "pixmapstr.h" #include "fontstruct.h" #include "dixfontstr.h" #include "dixstruct.h" /* For requestingClient */ #include "mi.h" #include "mibstorest.h" /* * When the server fails to allocate a backing store pixmap, if you want * it to dynamically retry to allocate backing store on every subsequent * graphics op, you can enable BSEAGER; otherwise, backing store will be * disabled on the window until it is unmapped and then remapped. */ /* #define BSEAGER */ /*- * NOTES ON USAGE: * * The functions in this file implement a machine-independent backing-store * scheme. To use it, the output library must do the following: * - Provide a SaveAreas function that takes a destination pixmap, a * region of the areas to save (in the pixmap's coordinate system) * and the screen origin of the region. It should copy the areas from * the screen into the pixmap. * - Provide a RestoreAreas function that takes a source pixmap, a region * of the areas to restore (in the screen's coordinate system) and the * origin of the pixmap on the screen. It should copy the areas from * the pixmap into the screen. * - Provide a SetClipmaskRgn function that takes a gc and a region * and merges the region into any CT_PIXMAP client clip that * is specified in the GC. This routine is only needed if * miValidateBackingStore will see CT_PIXMAP clip lists; not * true for any of the sample servers (which convert the PIXMAP * clip lists into CT_REGION clip lists; an expensive but simple * to code option). * - The function placed in a window's ClearToBackground vector must call * pScreen->ClearBackingStore with the window, followed by * the window-relative x and y coordinates, followed by the width and * height of the area to be cleared, followed by the generateExposures * flag. This has been taken care of in miClearToBackground. * - Whatever determines GraphicsExpose events for the CopyArea and * CopyPlane requests should call pWin->backStorage->ExposeCopy * with the source and destination drawables, the GC used, a source- * window-relative region of exposed areas, the source and destination * coordinates and the bitplane copied, if CopyPlane, or 0, if * CopyArea. * * JUSTIFICATION * This is a cross between saving everything and just saving the * obscued areas (as in Pike's layers.) This method has the advantage * of only doing each output operation once per pixel, visible or * invisible, and avoids having to do all the crufty storage * management of keeping several separate rectangles. Since the * ddx layer ouput primitives are required to draw through clipping * rectangles anyway, sending multiple drawing requests for each of * several rectangles isn't necessary. (Of course, it could be argued * that the ddx routines should just take one rectangle each and * get called multiple times, but that would make taking advantage of * smart hardware harder, and probably be slower as well.) */ #define SETUP_BACKING_TERSE(pGC) \ miBSGCPtr pGCPrivate = (miBSGCPtr)(pGC)->devPrivates[miBSGCIndex].ptr; \ GCFuncs *oldFuncs = pGC->funcs; #define SETUP_BACKING(pDrawable,pGC) \ miBSWindowPtr pBackingStore = \ (miBSWindowPtr)((WindowPtr)(pDrawable))->backStorage; \ DrawablePtr pBackingDrawable = (DrawablePtr) \ pBackingStore->pBackingPixmap; \ SETUP_BACKING_TERSE(pGC) \ GCPtr pBackingGC = pGCPrivate->pBackingGC; #define PROLOGUE(pGC) { \ pGC->ops = pGCPrivate->wrapOps;\ pGC->funcs = pGCPrivate->wrapFuncs; \ } #define EPILOGUE(pGC) { \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->ops = &miBSGCOps; \ (pGC)->funcs = oldFuncs; \ } static void miCreateBSPixmap(); static void miDestroyBSPixmap(); static void miTileVirtualBS(); static void miBSAllocate(), miBSFree(); static Bool miBSCreateGCPrivate (); static void miBSClearBackingRegion (); #define MoreCopy0 ; #define MoreCopy2 *dstCopy++ = *srcCopy++; *dstCopy++ = *srcCopy++; #define MoreCopy4 MoreCopy2 MoreCopy2 #define copyData(src,dst,n,morecopy) \ { \ register short *srcCopy = (short *)(src); \ register short *dstCopy = (short *)(dst); \ register int i; \ register int bsx = pBackingStore->x; \ register int bsy = pBackingStore->y; \ for (i = n; --i >= 0; ) \ { \ *dstCopy++ = *srcCopy++ - bsx; \ *dstCopy++ = *srcCopy++ - bsy; \ morecopy \ } \ } #define copyPoints(src,dst,n,mode) \ if (mode == CoordModeOrigin) \ { \ copyData(src,dst,n,MoreCopy0); \ } \ else \ { \ memmove((char *)(dst), (char *)(src), (n) << 2); \ *((short *)(dst)) -= pBackingStore->x; \ *((short *)(dst) + 1) -= pBackingStore->y; \ } /* * wrappers for screen funcs */ static int miBSScreenIndex; static unsigned long miBSGeneration = 0; static Bool miBSCloseScreen(); static void miBSGetImage(); static void miBSGetSpans(); static Bool miBSChangeWindowAttributes(); static Bool miBSCreateGC(); static Bool miBSDestroyWindow(); /* * backing store screen functions */ static void miBSSaveDoomedAreas(); static RegionPtr miBSRestoreAreas(); static void miBSExposeCopy(); static RegionPtr miBSTranslateBackingStore(), miBSClearBackingStore(); static void miBSDrawGuarantee(); /* * wrapper vectors for GC funcs and ops */ static int miBSGCIndex; static void miBSValidateGC (), miBSCopyGC (), miBSDestroyGC(); static void miBSChangeGC(); static void miBSChangeClip(), miBSDestroyClip(), miBSCopyClip(); static GCFuncs miBSGCFuncs = { miBSValidateGC, miBSChangeGC, miBSCopyGC, miBSDestroyGC, miBSChangeClip, miBSDestroyClip, miBSCopyClip, }; static void miBSFillSpans(), miBSSetSpans(), miBSPutImage(); static RegionPtr miBSCopyArea(), miBSCopyPlane(); static void miBSPolyPoint(), miBSPolylines(), miBSPolySegment(); static void miBSPolyRectangle(),miBSPolyArc(), miBSFillPolygon(); static void miBSPolyFillRect(), miBSPolyFillArc(); static int miBSPolyText8(), miBSPolyText16(); static void miBSImageText8(), miBSImageText16(); static void miBSImageGlyphBlt(),miBSPolyGlyphBlt(); static void miBSPushPixels(); #ifdef NEED_LINEHELPER static void miBSLineHelper(); #endif static GCOps miBSGCOps = { miBSFillSpans, miBSSetSpans, miBSPutImage, miBSCopyArea, miBSCopyPlane, miBSPolyPoint, miBSPolylines, miBSPolySegment, miBSPolyRectangle, miBSPolyArc, miBSFillPolygon, miBSPolyFillRect, miBSPolyFillArc, miBSPolyText8, miBSPolyText16, miBSImageText8, miBSImageText16, miBSImageGlyphBlt, miBSPolyGlyphBlt, miBSPushPixels #ifdef NEED_LINEHELPER , miBSLineHelper #endif }; #define FUNC_PROLOGUE(pGC, pPriv) \ ((pGC)->funcs = pPriv->wrapFuncs),\ ((pGC)->ops = pPriv->wrapOps) #define FUNC_EPILOGUE(pGC, pPriv) \ ((pGC)->funcs = &miBSGCFuncs),\ ((pGC)->ops = &miBSGCOps) /* * every GC in the server is initially wrapped with these * "cheap" functions. This allocates no memory and is used * to discover GCs used with windows which have backing * store enabled */ static void miBSCheapValidateGC(), miBSCheapCopyGC(), miBSCheapDestroyGC(); static void miBSCheapChangeGC (); static void miBSCheapChangeClip(), miBSCheapDestroyClip(); static void miBSCheapCopyClip(); static GCFuncs miBSCheapGCFuncs = { miBSCheapValidateGC, miBSCheapChangeGC, miBSCheapCopyGC, miBSCheapDestroyGC, miBSCheapChangeClip, miBSCheapDestroyClip, miBSCheapCopyClip, }; #define CHEAP_FUNC_PROLOGUE(pGC) \ ((pGC)->funcs = (GCFuncs *) (pGC)->devPrivates[miBSGCIndex].ptr) #define CHEAP_FUNC_EPILOGUE(pGC) \ ((pGC)->funcs = &miBSCheapGCFuncs) /* * called from device screen initialization proc. Gets a GCPrivateIndex * and wraps appropriate per-screen functions */ void miInitializeBackingStore (pScreen, funcs) ScreenPtr pScreen; miBSFuncPtr funcs; { miBSScreenPtr pScreenPriv; if (miBSGeneration != serverGeneration) { miBSScreenIndex = AllocateScreenPrivateIndex (); if (miBSScreenIndex < 0) return; miBSGCIndex = AllocateGCPrivateIndex (); miBSGeneration = serverGeneration; } if (!AllocateGCPrivate(pScreen, miBSGCIndex, 0)) return; pScreenPriv = (miBSScreenPtr) xalloc (sizeof (miBSScreenRec)); if (!pScreenPriv) return; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->GetImage = pScreen->GetImage; pScreenPriv->GetSpans = pScreen->GetSpans; pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; pScreenPriv->CreateGC = pScreen->CreateGC; pScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreenPriv->funcs = funcs; pScreen->CloseScreen = miBSCloseScreen; pScreen->GetImage = miBSGetImage; pScreen->GetSpans = miBSGetSpans; pScreen->ChangeWindowAttributes = miBSChangeWindowAttributes; pScreen->CreateGC = miBSCreateGC; pScreen->DestroyWindow = miBSDestroyWindow; pScreen->SaveDoomedAreas = miBSSaveDoomedAreas; pScreen->RestoreAreas = miBSRestoreAreas; pScreen->ExposeCopy = miBSExposeCopy; pScreen->TranslateBackingStore = miBSTranslateBackingStore; pScreen->ClearBackingStore = miBSClearBackingStore; pScreen->DrawGuarantee = miBSDrawGuarantee; pScreen->devPrivates[miBSScreenIndex].ptr = (pointer) pScreenPriv; } /* * Screen function wrappers */ #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((miBSScreenPtr) \ (pScreen)->devPrivates[miBSScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool miBSCloseScreen (i, pScreen) int i; ScreenPtr pScreen; { miBSScreenPtr pScreenPriv; pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; pScreen->CreateGC = pScreenPriv->CreateGC; xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (i, pScreen); } static void miBSFillVirtualBits(); static void miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planemask; char *pdstLine; { ScreenPtr pScreen = pDrawable->pScreen; BoxRec bounds; unsigned char depth; SCREEN_PROLOGUE (pScreen, GetImage); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->visibility != VisibilityUnobscured) { PixmapPtr pPixmap; miBSWindowPtr pWindowPriv; GCPtr pGC; WindowPtr pWin, pSrcWin; int xoff, yoff; RegionRec Remaining; RegionRec Border; RegionRec Inside; BoxPtr pBox; int n; pWin = (WindowPtr) pDrawable; pPixmap = 0; depth = pDrawable->depth; bounds.x1 = sx + pDrawable->x; bounds.y1 = sy + pDrawable->y; bounds.x2 = bounds.x1 + w; bounds.y2 = bounds.y1 + h; REGION_INIT(pScreen, &Remaining, &bounds, 0); for (;;) { bounds.x1 = sx + pDrawable->x - pWin->drawable.x; bounds.y1 = sy + pDrawable->y - pWin->drawable.y; bounds.x2 = bounds.x1 + w; bounds.y2 = bounds.y1 + h; if (pWin->viewable && pWin->backStorage && pWin->drawable.depth == depth && (RECT_IN_REGION(pScreen, &(pWindowPriv = (miBSWindowPtr) pWin->backStorage)->SavedRegion, &bounds) != rgnOUT || RECT_IN_REGION(pScreen, &Remaining, REGION_EXTENTS(pScreen, &pWin->borderSize)) != rgnOUT)) { if (!pPixmap) { XID subWindowMode = IncludeInferiors; int x, y; pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, depth); if (!pPixmap) goto punt; pGC = GetScratchGC (depth, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); goto punt; } ChangeGC (pGC, GCSubwindowMode, &subWindowMode); ValidateGC ((DrawablePtr)pPixmap, pGC); REGION_INIT(pScreen, &Border, NullBox, 0); REGION_INIT(pScreen, &Inside, NullBox, 0); pSrcWin = (WindowPtr) pDrawable; x = sx; y = sy; if (pSrcWin->parent) { x += pSrcWin->origin.x; y += pSrcWin->origin.y; pSrcWin = pSrcWin->parent; } (*pGC->ops->CopyArea) ((DrawablePtr)pSrcWin, (DrawablePtr)pPixmap, pGC, x, y, w, h, 0, 0); REGION_SUBTRACT(pScreen, &Remaining, &Remaining, &((WindowPtr) pDrawable)->borderClip); } REGION_INTERSECT(pScreen, &Inside, &Remaining, &pWin->winSize); REGION_TRANSLATE(pScreen, &Inside, -pWin->drawable.x, -pWin->drawable.y); REGION_INTERSECT(pScreen, &Inside, &Inside, &pWindowPriv->SavedRegion); /* offset of sub-window in GetImage pixmap */ xoff = pWin->drawable.x - pDrawable->x - sx; yoff = pWin->drawable.y - pDrawable->y - sy; if (REGION_NUM_RECTS(&Inside) > 0) { switch (pWindowPriv->status) { case StatusContents: pBox = REGION_RECTS(&Inside); for (n = REGION_NUM_RECTS(&Inside); --n >= 0;) { (*pGC->ops->CopyArea) ( (DrawablePtr)pWindowPriv->pBackingPixmap, (DrawablePtr)pPixmap, pGC, pBox->x1 - pWindowPriv->x, pBox->y1 - pWindowPriv->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + xoff, pBox->y1 + yoff); ++pBox; } break; case StatusVirtual: case StatusVDirty: if (pWindowPriv->backgroundState == BackgroundPixmap || pWindowPriv->backgroundState == BackgroundPixel) miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Inside, xoff, yoff, (int) pWindowPriv->backgroundState, pWindowPriv->background, ~0L); break; } } REGION_SUBTRACT(pScreen, &Border, &pWin->borderSize, &pWin->winSize); REGION_INTERSECT(pScreen, &Border, &Border, &Remaining); if (REGION_NUM_RECTS(&Border) > 0) { REGION_TRANSLATE(pScreen, &Border, -pWin->drawable.x, -pWin->drawable.y); miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Border, xoff, yoff, pWin->borderIsPixel ? (int)BackgroundPixel : (int)BackgroundPixmap, pWin->border, ~0L); } } if (pWin->viewable && pWin->firstChild) pWin = pWin->firstChild; else { while (!pWin->nextSib && pWin != (WindowPtr) pDrawable) pWin = pWin->parent; if (pWin == (WindowPtr) pDrawable) break; pWin = pWin->nextSib; } } REGION_UNINIT(pScreen, &Remaining); if (pPixmap) { REGION_UNINIT(pScreen, &Border); REGION_UNINIT(pScreen, &Inside); (*pScreen->GetImage) ((DrawablePtr) pPixmap, 0, 0, w, h, format, planemask, pdstLine); (*pScreen->DestroyPixmap) (pPixmap); FreeScratchGC (pGC); } else { goto punt; } } else { punt: ; (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); } SCREEN_EPILOGUE (pScreen, GetImage, miBSGetImage); } static void miBSGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) DrawablePtr pDrawable; int wMax; DDXPointPtr ppt; int *pwidth; int nspans; char *pdstStart; { ScreenPtr pScreen = pDrawable->pScreen; BoxRec bounds; int i; WindowPtr pWin; int dx, dy; SCREEN_PROLOGUE (pScreen, GetSpans); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->backStorage) { PixmapPtr pPixmap; miBSWindowPtr pWindowPriv; GCPtr pGC; pWin = (WindowPtr) pDrawable; pWindowPriv = (miBSWindowPtr) pWin->backStorage; pPixmap = pWindowPriv->pBackingPixmap; bounds.x1 = ppt->x; bounds.y1 = ppt->y; bounds.x2 = bounds.x1 + *pwidth; bounds.y2 = ppt->y; for (i = 0; i < nspans; i++) { if (ppt[i].x < bounds.x1) bounds.x1 = ppt[i].x; if (ppt[i].x + pwidth[i] > bounds.x2) bounds.x2 = ppt[i].x + pwidth[i]; if (ppt[i].y < bounds.y1) bounds.y1 = ppt[i].y; else if (ppt[i].y > bounds.y2) bounds.y2 = ppt[i].y; } switch (RECT_IN_REGION(pScreen, &pWindowPriv->SavedRegion, &bounds)) { case rgnPART: if (!pPixmap) { miCreateBSPixmap (pWin, NullBox); if (!(pPixmap = pWindowPriv->pBackingPixmap)) break; } pWindowPriv->status = StatusNoPixmap; pGC = GetScratchGC(pPixmap->drawable.depth, pPixmap->drawable.pScreen); if (pGC) { ValidateGC ((DrawablePtr) pPixmap, pGC); (*pGC->ops->CopyArea) (pDrawable, (DrawablePtr) pPixmap, pGC, bounds.x1, bounds.y1, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1, bounds.x1 + pPixmap->drawable.x - pWin->drawable.x - pWindowPriv->x, bounds.y1 + pPixmap->drawable.y - pWin->drawable.y - pWindowPriv->y); FreeScratchGC(pGC); } pWindowPriv->status = StatusContents; /* fall through */ case rgnIN: if (!pPixmap) { miCreateBSPixmap (pWin, NullBox); if (!(pPixmap = pWindowPriv->pBackingPixmap)) break; } dx = pPixmap->drawable.x - pWin->drawable.x - pWindowPriv->x; dy = pPixmap->drawable.y - pWin->drawable.y - pWindowPriv->y; for (i = 0; i < nspans; i++) { ppt[i].x += dx; ppt[i].y += dy; } (*pScreen->GetSpans) ((DrawablePtr) pPixmap, wMax, ppt, pwidth, nspans, pdstStart); break; case rgnOUT: (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); break; } } else { (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); } SCREEN_EPILOGUE (pScreen, GetSpans, miBSGetSpans); } static Bool miBSChangeWindowAttributes (pWin, mask) WindowPtr pWin; unsigned long mask; { ScreenPtr pScreen; Bool ret; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes); ret = (*pScreen->ChangeWindowAttributes) (pWin, mask); if (ret && (mask & CWBackingStore)) { if (pWin->backingStore != NotUseful || pWin->DIXsaveUnder) miBSAllocate (pWin); else miBSFree (pWin); } SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, miBSChangeWindowAttributes); return ret; } /* * GC Create wrapper. Set up the cheap GC func wrappers to track * GC validation on BackingStore windows */ static Bool miBSCreateGC (pGC) GCPtr pGC; { ScreenPtr pScreen = pGC->pScreen; Bool ret; SCREEN_PROLOGUE (pScreen, CreateGC); if ( (ret = (*pScreen->CreateGC) (pGC)) ) { pGC->devPrivates[miBSGCIndex].ptr = (pointer) pGC->funcs; pGC->funcs = &miBSCheapGCFuncs; } SCREEN_EPILOGUE (pScreen, CreateGC, miBSCreateGC); return ret; } static Bool miBSDestroyWindow (pWin) WindowPtr pWin; { ScreenPtr pScreen = pWin->drawable.pScreen; Bool ret; SCREEN_PROLOGUE (pScreen, DestroyWindow); ret = (*pScreen->DestroyWindow) (pWin); miBSFree (pWin); SCREEN_EPILOGUE (pScreen, DestroyWindow, miBSDestroyWindow); return ret; } /* * cheap GC func wrappers. Simply track validation on windows * with backing store to enable the real func/op wrappers */ static void miBSCheapValidateGC (pGC, stateChanges, pDrawable) GCPtr pGC; unsigned long stateChanges; DrawablePtr pDrawable; { CHEAP_FUNC_PROLOGUE (pGC); if (pDrawable->type != DRAWABLE_PIXMAP && ((WindowPtr) pDrawable)->backStorage != NULL && miBSCreateGCPrivate (pGC)) { (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); } else { (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); /* rewrap funcs as Validate may have changed them */ pGC->devPrivates[miBSGCIndex].ptr = (pointer) pGC->funcs; CHEAP_FUNC_EPILOGUE (pGC); } } static void miBSCheapChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); CHEAP_FUNC_EPILOGUE (pGC); } static void miBSCheapCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { CHEAP_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); CHEAP_FUNC_EPILOGUE (pGCDst); } static void miBSCheapDestroyGC (pGC) GCPtr pGC; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC) (pGC); /* leave it unwrapped */ } static void miBSCheapChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { CHEAP_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); CHEAP_FUNC_EPILOGUE (pGC); } static void miBSCheapCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { CHEAP_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); CHEAP_FUNC_EPILOGUE (pgcDst); } static void miBSCheapDestroyClip(pGC) GCPtr pGC; { CHEAP_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); CHEAP_FUNC_EPILOGUE (pGC); } /* * create the full func/op wrappers for a GC */ static Bool miBSCreateGCPrivate (pGC) GCPtr pGC; { miBSGCRec *pPriv; pPriv = (miBSGCRec *) xalloc (sizeof (miBSGCRec)); if (!pPriv) return FALSE; pPriv->pBackingGC = NULL; pPriv->guarantee = GuaranteeNothing; pPriv->serialNumber = 0; pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; pPriv->wrapOps = pGC->ops; pPriv->wrapFuncs = pGC->funcs; pGC->funcs = &miBSGCFuncs; pGC->ops = &miBSGCOps; pGC->devPrivates[miBSGCIndex].ptr = (pointer) pPriv; return TRUE; } static void miBSDestroyGCPrivate (pGC) GCPtr pGC; { miBSGCRec *pPriv; pPriv = (miBSGCRec *) pGC->devPrivates[miBSGCIndex].ptr; if (pPriv) { pGC->devPrivates[miBSGCIndex].ptr = (pointer) pPriv->wrapFuncs; pGC->funcs = &miBSCheapGCFuncs; pGC->ops = pPriv->wrapOps; if (pPriv->pBackingGC) FreeGC (pPriv->pBackingGC, (GContext) 0); xfree ((pointer) pPriv); } } /* * GC ops -- wrap each GC operation with our own function */ /*- *----------------------------------------------------------------------- * miBSFillSpans -- * Perform a FillSpans, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { DDXPointPtr pptCopy, pptReset; int *pwidthCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(nInit*sizeof(DDXPointRec)); pwidthCopy=(int *)ALLOCATE_LOCAL(nInit*sizeof(int)); if (pptCopy && pwidthCopy) { copyData(pptInit, pptCopy, nInit, MoreCopy0); memmove((char *)pwidthCopy,(char *)pwidthInit,nInit*sizeof(int)); (* pGC->ops->FillSpans)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); if (pGC->miTranslate) { int dx, dy; int nReset; pptReset = pptCopy; dx = pDrawable->x - pBackingDrawable->x; dy = pDrawable->y - pBackingDrawable->y; nReset = nInit; while (nReset--) { pptReset->x -= dx; pptReset->y -= dy; ++pptReset; } } (* pBackingGC->ops->FillSpans)(pBackingDrawable, pBackingGC, nInit, pptCopy, pwidthCopy, fSorted); } if (pwidthCopy) DEALLOCATE_LOCAL(pwidthCopy); if (pptCopy) DEALLOCATE_LOCAL(pptCopy); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSSetSpans -- * Perform a SetSpans, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { DDXPointPtr pptCopy, pptReset; int *pwidthCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(nspans*sizeof(DDXPointRec)); pwidthCopy=(int *)ALLOCATE_LOCAL(nspans*sizeof(int)); if (pptCopy && pwidthCopy) { copyData(ppt, pptCopy, nspans, MoreCopy0); memmove((char *)pwidthCopy,(char *)pwidth,nspans*sizeof(int)); (* pGC->ops->SetSpans)(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); if (pGC->miTranslate) { int dx, dy; int nReset; pptReset = pptCopy; dx = pDrawable->x - pBackingDrawable->x; dy = pDrawable->y - pBackingDrawable->y; nReset = nspans; while (nReset--) { pptReset->x -= dx; pptReset->y -= dy; ++pptReset; } } (* pBackingGC->ops->SetSpans)(pBackingDrawable, pBackingGC, psrc, pptCopy, pwidthCopy, nspans, fSorted); } if (pwidthCopy) DEALLOCATE_LOCAL(pwidthCopy); if (pptCopy) DEALLOCATE_LOCAL(pptCopy); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPutImage -- * Perform a PutImage, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int leftPad; int format; char *pBits; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); (*pBackingGC->ops->PutImage)(pBackingDrawable, pBackingGC, depth, x - pBackingStore->x, y - pBackingStore->y, w, h, leftPad, format, pBits); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSDoCopy -- * Perform a CopyArea or CopyPlane within a window that has backing * store enabled. * * Results: * TRUE if the copy was performed or FALSE if a regular one should * be done. * * Side Effects: * Things are copied (no s***!) * * Notes: * The idea here is to form two regions that cover the source box. * One contains the exposed rectangles while the other contains * the obscured ones. An array of pairs is then * formed where the indicates the area to be copied and the * indicates from where it is to be copied (exposed regions * come from the screen while obscured ones come from the backing * pixmap). The array 'sequence' is then filled with the indices of * the pairs in the order in which they should be copied to prevent * things from getting screwed up. A call is also made through the * backingGC to take care of any copying into the backing pixmap. * *----------------------------------------------------------------------- */ static Bool miBSDoCopy(pWin, pGC, srcx, srcy, w, h, dstx, dsty, plane, copyProc, ppRgn) WindowPtr pWin; /* Window being scrolled */ GCPtr pGC; /* GC we're called through */ int srcx; /* X of source rectangle */ int srcy; /* Y of source rectangle */ int w; /* Width of source rectangle */ int h; /* Height of source rectangle */ int dstx; /* X of destination rectangle */ int dsty; /* Y of destination rectangle */ unsigned long plane; /* Plane to copy (0 for CopyArea) */ RegionPtr (*copyProc)(); /* Procedure to call to perform the copy */ RegionPtr *ppRgn; /* resultant Graphics Expose region */ { RegionPtr pRgnExp; /* Exposed region */ RegionPtr pRgnObs; /* Obscured region */ BoxRec box; /* Source box (screen coord) */ struct BoxDraw { BoxPtr pBox; /* Source box */ enum { win, pix } source; /* Place from which to copy */ } *boxes; /* Array of box/drawable pairs covering * source box. */ int *sequence; /* Sequence of boxes to move */ register int i, j, k, l, y; register BoxPtr pBox; int dx, dy, nrects; Bool graphicsExposures; RegionPtr (*pixCopyProc)(); int numRectsExp, numRectsObs; BoxPtr pBoxExp, pBoxObs; SETUP_BACKING (pWin, pGC); /* * Create a region of exposed boxes in pRgnExp. */ box.x1 = srcx + pWin->drawable.x; box.x2 = box.x1 + w; box.y1 = srcy + pWin->drawable.y; box.y2 = box.y1 + h; pRgnExp = REGION_CREATE(pGC->pScreen, &box, 1); REGION_INTERSECT(pGC->pScreen, pRgnExp, pRgnExp, &pWin->clipList); pRgnObs = REGION_CREATE(pGC->pScreen, NULL, 1); REGION_INVERSE( pGC->pScreen, pRgnObs, pRgnExp, &box); /* * Translate regions into window coordinates for proper calls * to the copyProc, then make sure none of the obscured region sticks * into invalid areas of the backing pixmap. */ REGION_TRANSLATE(pGC->pScreen, pRgnExp, -pWin->drawable.x, -pWin->drawable.y); REGION_TRANSLATE(pGC->pScreen, pRgnObs, -pWin->drawable.x, -pWin->drawable.y); REGION_INTERSECT(pGC->pScreen, pRgnObs, pRgnObs, &pBackingStore->SavedRegion); /* * If the obscured region is empty, there's no point being fancy. */ if (!REGION_NOTEMPTY(pGC->pScreen, pRgnObs)) { REGION_DESTROY(pGC->pScreen, pRgnExp); REGION_DESTROY(pGC->pScreen, pRgnObs); return (FALSE); } numRectsExp = REGION_NUM_RECTS(pRgnExp); pBoxExp = REGION_RECTS(pRgnExp); pBoxObs = REGION_RECTS(pRgnObs); numRectsObs = REGION_NUM_RECTS(pRgnObs); nrects = numRectsExp + numRectsObs; boxes = (struct BoxDraw *)ALLOCATE_LOCAL(nrects * sizeof(struct BoxDraw)); sequence = (int *) ALLOCATE_LOCAL(nrects * sizeof(int)); *ppRgn = NULL; if (!boxes || !sequence) { if (sequence) DEALLOCATE_LOCAL(sequence); if (boxes) DEALLOCATE_LOCAL(boxes); REGION_DESTROY(pGC->pScreen, pRgnExp); REGION_DESTROY(pGC->pScreen, pRgnObs); return(TRUE); } /* * Order the boxes in the two regions so we know from which drawable * to copy which box, storing the result in the boxes array */ for (i = 0, j = 0, k = 0; (i < numRectsExp) && (j < numRectsObs); k++) { if (pBoxExp[i].y1 < pBoxObs[j].y1) { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; } else if ((pBoxObs[j].y1 < pBoxExp[i].y1) || (pBoxObs[j].x1 < pBoxExp[i].x1)) { boxes[k].pBox = &pBoxObs[j]; boxes[k].source = pix; j++; } else { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; } } /* * Catch any leftover boxes from either region (note that only * one can have leftover boxes...) */ if (i != numRectsExp) { do { boxes[k].pBox = &pBoxExp[i]; boxes[k].source = win; i++; k++; } while (i < numRectsExp); } else { do { boxes[k].pBox = &pBoxObs[j]; boxes[k].source = pix; j++; k++; } while (j < numRectsObs); } if (dsty <= srcy) { /* * Scroll up or vertically stationary, so vertical order is ok. */ if (dstx <= srcx) { /* * Scroll left or horizontally stationary, so horizontal order * is ok as well. */ for (i = 0; i < nrects; i++) { sequence[i] = i; } } else { /* * Scroll right. Need to reverse the rectangles within each * band. */ for (i = 0, j = 1, k = 0; i < nrects; j = i + 1, k = i) { y = boxes[i].pBox->y1; while ((j < nrects) && (boxes[j].pBox->y1 == y)) { j++; } for (j--; j >= k; j--, i++) { sequence[i] = j; } } } } else { /* * Scroll down. Must reverse vertical banding, at least. */ if (dstx < srcx) { /* * Scroll left. Horizontal order is ok. */ for (i = nrects - 1, j = i - 1, k = i, l = 0; i >= 0; j = i - 1, k = i) { /* * Find extent of current horizontal band, then reverse * the order of the whole band. */ y = boxes[i].pBox->y1; while ((j >= 0) && (boxes[j].pBox->y1 == y)) { j--; } for (j++; j <= k; j++, i--, l++) { sequence[l] = j; } } } else { /* * Scroll right or horizontal stationary. * Reverse horizontal order as well (if stationary, horizontal * order can be swapped without penalty and this is faster * to compute). */ for (i = 0, j = nrects - 1; i < nrects; i++, j--) { sequence[i] = j; } } } /* * XXX: To avoid getting multiple NoExpose events from this operation, * we turn OFF graphicsExposures in the gc and deal with any uncopied * areas later, if there's something not in backing-store. */ graphicsExposures = pGC->graphicsExposures; pGC->graphicsExposures = FALSE; dx = dstx - srcx; dy = dsty - srcy; /* * Figure out which copy procedure to use from the backing GC. Note we * must do this because some implementations (sun's, e.g.) have * pBackingGC a fake GC with the real one below it, thus the devPriv for * pBackingGC won't be what the output library expects. */ if (plane != 0) { pixCopyProc = pBackingGC->ops->CopyPlane; } else { pixCopyProc = pBackingGC->ops->CopyArea; } for (i = 0; i < nrects; i++) { pBox = boxes[sequence[i]].pBox; /* * If we're copying from the pixmap, we need to place its contents * onto the screen before scrolling the pixmap itself. If we're copying * from the window, we need to copy its contents into the pixmap before * we scroll the window itself. */ if (boxes[sequence[i]].source == pix) { (void) (* copyProc) (pBackingDrawable, pWin, pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); (void) (* pixCopyProc) (pBackingDrawable, pBackingDrawable, pBackingGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx - pBackingStore->x, pBox->y1 + dy - pBackingStore->y, plane); } else { (void) (* pixCopyProc) (pWin, pBackingDrawable, pBackingGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx - pBackingStore->x, pBox->y1 + dy - pBackingStore->y, plane); (void) (* copyProc) (pWin, pWin, pGC, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } } DEALLOCATE_LOCAL(sequence); DEALLOCATE_LOCAL(boxes); pGC->graphicsExposures = graphicsExposures; /* * Form union of rgnExp and rgnObs and see if covers entire area * to be copied. Store the resultant region for miBSCopyArea * to return to dispatch which will send the appropriate expose * events. */ REGION_UNION(pGC->pScreen, pRgnExp, pRgnExp, pRgnObs); box.x1 = srcx; box.x2 = srcx + w; box.y1 = srcy; box.y2 = srcy + h; if (RECT_IN_REGION(pGC->pScreen, pRgnExp, &box) == rgnIN) { REGION_EMPTY(pGC->pScreen, pRgnExp); } else { REGION_INVERSE( pGC->pScreen, pRgnExp, pRgnExp, &box); REGION_TRANSLATE( pGC->pScreen, pRgnExp, dx + pWin->drawable.x, dy + pWin->drawable.y); REGION_INTERSECT( pGC->pScreen, pRgnObs, pRgnExp, &pWin->clipList); (*pWin->drawable.pScreen->PaintWindowBackground) (pWin, pRgnObs, PW_BACKGROUND); REGION_TRANSLATE( pGC->pScreen, pRgnExp, -pWin->drawable.x, -pWin->drawable.y); miBSClearBackingRegion (pWin, pRgnExp); } if (graphicsExposures) *ppRgn = pRgnExp; else REGION_DESTROY(pGC->pScreen, pRgnExp); REGION_DESTROY(pGC->pScreen, pRgnObs); return (TRUE); } /*- *----------------------------------------------------------------------- * miBSCopyArea -- * Perform a CopyArea from the source to the destination, extracting * from the source's backing-store and storing into the destination's * backing-store without messing anything up. If the source and * destination are different, there's not too much to worry about: * we can just issue several calls to the regular CopyArea function. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static RegionPtr miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { BoxPtr pExtents; long dx, dy; int bsrcx, bsrcy, bw, bh, bdstx, bdsty; RegionPtr pixExposed = 0, winExposed = 0; SETUP_BACKING(pDst, pGC); PROLOGUE(pGC); if ((pSrc != pDst) || (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, (unsigned long) 0, pGC->ops->CopyArea, &winExposed))) { /* * always copy to the backing store first, miBSDoCopy * returns FALSE if the *source* region is disjoint * from the backing store saved region. So, copying * *to* the backing store is always safe */ if (pGC->clientClipType != CT_PIXMAP) { /* * adjust srcx, srcy, w, h, dstx, dsty to be clipped to * the backing store. An unnecessary optimisation, * but a useful one when GetSpans is slow. */ pExtents = REGION_EXTENTS(pDst->pScreen, (RegionPtr)pBackingGC->clientClip); bsrcx = srcx; bsrcy = srcy; bw = w; bh = h; bdstx = dstx; bdsty = dsty; dx = pExtents->x1 - bdstx; if (dx > 0) { bsrcx += dx; bdstx += dx; bw -= dx; } dy = pExtents->y1 - bdsty; if (dy > 0) { bsrcy += dy; bdsty += dy; bh -= dy; } dx = (bdstx + bw) - pExtents->x2; if (dx > 0) bw -= dx; dy = (bdsty + bh) - pExtents->y2; if (dy > 0) bh -= dy; if (bw > 0 && bh > 0) pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, pBackingDrawable, pBackingGC, bsrcx, bsrcy, bw, bh, bdstx - pBackingStore->x, bdsty - pBackingStore->y); } else pixExposed = (* pBackingGC->ops->CopyArea) (pSrc, pBackingDrawable, pBackingGC, srcx, srcy, w, h, dstx - pBackingStore->x, dsty - pBackingStore->y); winExposed = (* pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); } /* * compute the composite graphics exposure region */ if (winExposed) { if (pixExposed){ REGION_UNION(pDst->pScreen, winExposed, winExposed, pixExposed); REGION_DESTROY(pDst->pScreen, pixExposed); } } else winExposed = pixExposed; EPILOGUE (pGC); return winExposed; } /*- *----------------------------------------------------------------------- * miBSCopyPlane -- * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static RegionPtr miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GC *pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane; { BoxPtr pExtents; long dx, dy; int bsrcx, bsrcy, bw, bh, bdstx, bdsty; RegionPtr winExposed = 0, pixExposed = 0; SETUP_BACKING(pDst, pGC); PROLOGUE(pGC); if ((pSrc != pDst) || (!miBSDoCopy((WindowPtr)pSrc, pGC, srcx, srcy, w, h, dstx, dsty, plane, pGC->ops->CopyPlane, &winExposed))) { /* * always copy to the backing store first, miBSDoCopy * returns FALSE if the *source* region is disjoint * from the backing store saved region. So, copying * *to* the backing store is always safe */ if (pGC->clientClipType != CT_PIXMAP) { /* * adjust srcx, srcy, w, h, dstx, dsty to be clipped to * the backing store. An unnecessary optimisation, * but a useful one when GetSpans is slow. */ pExtents = REGION_EXTENTS(pDst->pScreen, (RegionPtr)pBackingGC->clientClip); bsrcx = srcx; bsrcy = srcy; bw = w; bh = h; bdstx = dstx; bdsty = dsty; dx = pExtents->x1 - bdstx; if (dx > 0) { bsrcx += dx; bdstx += dx; bw -= dx; } dy = pExtents->y1 - bdsty; if (dy > 0) { bsrcy += dy; bdsty += dy; bh -= dy; } dx = (bdstx + bw) - pExtents->x2; if (dx > 0) bw -= dx; dy = (bdsty + bh) - pExtents->y2; if (dy > 0) bh -= dy; if (bw > 0 && bh > 0) pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, pBackingDrawable, pBackingGC, bsrcx, bsrcy, bw, bh, bdstx - pBackingStore->x, bdsty - pBackingStore->y, plane); } else pixExposed = (* pBackingGC->ops->CopyPlane) (pSrc, pBackingDrawable, pBackingGC, srcx, srcy, w, h, dstx - pBackingStore->x, dsty - pBackingStore->y, plane); winExposed = (* pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); } /* * compute the composite graphics exposure region */ if (winExposed) { if (pixExposed) { REGION_UNION(pDst->pScreen, winExposed, winExposed, pixExposed); REGION_DESTROY(pDst->pScreen, pixExposed); } } else winExposed = pixExposed; EPILOGUE (pGC); return winExposed; } /*- *----------------------------------------------------------------------- * miBSPolyPoint -- * Perform a PolyPoint, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { xPoint *pptCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (xPoint *)ALLOCATE_LOCAL(npt*sizeof(xPoint)); if (pptCopy) { copyPoints(pptInit, pptCopy, npt, mode); (* pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->ops->PolyPoint) (pBackingDrawable, pBackingGC, mode, npt, pptCopy); DEALLOCATE_LOCAL(pptCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyLines -- * Perform a Polylines, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { DDXPointPtr pptCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pptCopy = (DDXPointPtr)ALLOCATE_LOCAL(npt*sizeof(DDXPointRec)); if (pptCopy) { copyPoints(pptInit, pptCopy, npt, mode); (* pGC->ops->Polylines)(pDrawable, pGC, mode, npt, pptInit); (* pBackingGC->ops->Polylines)(pBackingDrawable, pBackingGC, mode, npt, pptCopy); DEALLOCATE_LOCAL(pptCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolySegment -- * Perform a PolySegment, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolySegment(pDrawable, pGC, nseg, pSegs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegs; { xSegment *pSegsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pSegsCopy = (xSegment *)ALLOCATE_LOCAL(nseg*sizeof(xSegment)); if (pSegsCopy) { copyData(pSegs, pSegsCopy, nseg << 1, MoreCopy0); (* pGC->ops->PolySegment)(pDrawable, pGC, nseg, pSegs); (* pBackingGC->ops->PolySegment)(pBackingDrawable, pBackingGC, nseg, pSegsCopy); DEALLOCATE_LOCAL(pSegsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyRectangle -- * Perform a PolyRectangle, routing output to backing-store as needed. * * Results: * None * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyRectangle(pDrawable, pGC, nrects, pRects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *pRects; { xRectangle *pRectsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pRectsCopy =(xRectangle *)ALLOCATE_LOCAL(nrects*sizeof(xRectangle)); if (pRectsCopy) { copyData(pRects, pRectsCopy, nrects, MoreCopy2); (* pGC->ops->PolyRectangle)(pDrawable, pGC, nrects, pRects); (* pBackingGC->ops->PolyRectangle)(pBackingDrawable, pBackingGC, nrects, pRectsCopy); DEALLOCATE_LOCAL(pRectsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyArc -- * Perform a PolyArc, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { xArc *pArcsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pArcsCopy = (xArc *)ALLOCATE_LOCAL(narcs*sizeof(xArc)); if (pArcsCopy) { copyData(parcs, pArcsCopy, narcs, MoreCopy4); (* pGC->ops->PolyArc)(pDrawable, pGC, narcs, parcs); (* pBackingGC->ops->PolyArc)(pBackingDrawable, pBackingGC, narcs, pArcsCopy); DEALLOCATE_LOCAL(pArcsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSFillPolygon -- * Perform a FillPolygon, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts) DrawablePtr pDrawable; register GCPtr pGC; int shape, mode; register int count; DDXPointPtr pPts; { DDXPointPtr pPtsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pPtsCopy = (DDXPointPtr)ALLOCATE_LOCAL(count*sizeof(DDXPointRec)); if (pPtsCopy) { copyPoints(pPts, pPtsCopy, count, mode); (* pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, count, pPts); (* pBackingGC->ops->FillPolygon)(pBackingDrawable, pBackingGC, shape, mode, count, pPtsCopy); DEALLOCATE_LOCAL(pPtsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyFillRect -- * Perform a PolyFillRect, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { xRectangle *pRectCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pRectCopy = (xRectangle *)ALLOCATE_LOCAL(nrectFill*sizeof(xRectangle)); if (pRectCopy) { copyData(prectInit, pRectCopy, nrectFill, MoreCopy2); (* pGC->ops->PolyFillRect)(pDrawable, pGC, nrectFill, prectInit); (* pBackingGC->ops->PolyFillRect)(pBackingDrawable, pBackingGC, nrectFill, pRectCopy); DEALLOCATE_LOCAL(pRectCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyFillArc -- * Perform a PolyFillArc, routing output to backing-store as needed. * * Results: * None. * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyFillArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { xArc *pArcsCopy; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); pArcsCopy = (xArc *)ALLOCATE_LOCAL(narcs*sizeof(xArc)); if (pArcsCopy) { copyData(parcs, pArcsCopy, narcs, MoreCopy4); (* pGC->ops->PolyFillArc)(pDrawable, pGC, narcs, parcs); (* pBackingGC->ops->PolyFillArc)(pBackingDrawable, pBackingGC, narcs, pArcsCopy); DEALLOCATE_LOCAL(pArcsCopy); } EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyText8 -- * Perform a PolyText8, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static int miBSPolyText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { int result; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); result = (* pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->PolyText8)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); return result; } /*- *----------------------------------------------------------------------- * miBSPolyText16 -- * Perform a PolyText16, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static int miBSPolyText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { int result; SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); result = (* pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->PolyText16)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); return result; } /*- *----------------------------------------------------------------------- * miBSImageText8 -- * Perform a ImageText8, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText8)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSImageText16 -- * Perform a ImageText16, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); (* pBackingGC->ops->ImageText16)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, count, chars); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSImageGlyphBlt -- * Perform a ImageGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->ImageGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPolyGlyphBlt -- * Perform a PolyGlyphBlt, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { SETUP_BACKING (pDrawable, pGC); PROLOGUE(pGC); (* pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (* pBackingGC->ops->PolyGlyphBlt)(pBackingDrawable, pBackingGC, x - pBackingStore->x, y - pBackingStore->y, nglyph, ppci, pglyphBase); EPILOGUE (pGC); } /*- *----------------------------------------------------------------------- * miBSPushPixels -- * Perform a PushPixels, routing output to backing-store as needed. * * Results: * * Side Effects: * *----------------------------------------------------------------------- */ static void miBSPushPixels(pGC, pBitMap, pDst, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDst; int w, h, x, y; { SETUP_BACKING (pDst, pGC); PROLOGUE(pGC); (* pGC->ops->PushPixels)(pGC, pBitMap, pDst, w, h, x, y); if (pGC->miTranslate) { x -= pDst->x; y -= pDst->y; } (* pBackingGC->ops->PushPixels)(pBackingGC, pBitMap, pBackingDrawable, w, h, x - pBackingStore->x, y - pBackingStore->y); EPILOGUE (pGC); } #ifdef NEED_LINEHELPER /*- *----------------------------------------------------------------------- * miBSLineHelper -- * * Results: should never be called * * Side Effects: server dies * *----------------------------------------------------------------------- */ static void miBSLineHelper() { FatalError("miBSLineHelper called\n"); } #endif /*- *----------------------------------------------------------------------- * miBSClearBackingStore -- * Clear the given area of the backing pixmap with the background of * the window, whatever it is. If generateExposures is TRUE, generate * exposure events for the area. Note that if the area has any * part outside the saved portions of the window, we do not allow the * count in the expose events to be 0, since there will be more * expose events to come. * * Results: * None. * * Side Effects: * Areas of pixmap are cleared and Expose events are generated. * *----------------------------------------------------------------------- */ static RegionPtr miBSClearBackingStore(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x; int y; int w; int h; Bool generateExposures; { RegionPtr pRgn; int i; miBSWindowPtr pBackingStore; ScreenPtr pScreen; GCPtr pGC; int ts_x_origin, ts_y_origin; pointer gcvalues[4]; unsigned long gcmask; xRectangle *rects; BoxPtr pBox; BoxRec box; PixUnion background; char backgroundState; int numRects; pBackingStore = (miBSWindowPtr)pWin->backStorage; pScreen = pWin->drawable.pScreen; if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return NullRegion; if (w == 0) w = (int) pWin->drawable.width - x; if (h == 0) h = (int) pWin->drawable.height - y; box.x1 = x; box.y1 = y; box.x2 = x + w; box.y2 = y + h; pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); if (!pRgn) return NullRegion; REGION_INTERSECT( pScreen, pRgn, pRgn, &pBackingStore->SavedRegion); if (REGION_NOTEMPTY( pScreen, pRgn)) { /* * if clearing entire window, simply make new virtual * tile. For the root window, we also destroy the pixmap * to save a pile of memory */ if (x == 0 && y == 0 && w == pWin->drawable.width && h == pWin->drawable.height) { if (!pWin->parent) miDestroyBSPixmap (pWin); if (pBackingStore->status != StatusContents) miTileVirtualBS (pWin); } ts_x_origin = ts_y_origin = 0; backgroundState = pWin->backgroundState; background = pWin->background; if (backgroundState == ParentRelative) { WindowPtr pParent; pParent = pWin; while (pParent->backgroundState == ParentRelative) { ts_x_origin -= pParent->origin.x; ts_y_origin -= pParent->origin.y; pParent = pParent->parent; } backgroundState = pParent->backgroundState; background = pParent->background; } if ((backgroundState != None) && ((pBackingStore->status == StatusContents) || !SameBackground (pBackingStore->backgroundState, pBackingStore->background, backgroundState, background))) { if (!pBackingStore->pBackingPixmap) miCreateBSPixmap(pWin, NullBox); pGC = GetScratchGC(pWin->drawable.depth, pScreen); if (pGC && pBackingStore->pBackingPixmap) { /* * First take care of any ParentRelative stuff by altering the * tile/stipple origin to match the coordinates of the upper-left * corner of the first ancestor without a ParentRelative background. * This coordinate is, of course, negative. */ if (backgroundState == BackgroundPixel) { gcvalues[0] = (pointer) background.pixel; gcvalues[1] = (pointer)FillSolid; gcmask = GCForeground|GCFillStyle; } else { gcvalues[0] = (pointer)FillTiled; gcvalues[1] = (pointer) background.pixmap; gcmask = GCFillStyle|GCTile; } gcvalues[2] = (pointer)(ts_x_origin - pBackingStore->x); gcvalues[3] = (pointer)(ts_y_origin - pBackingStore->y); gcmask |= GCTileStipXOrigin|GCTileStipYOrigin; DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE); ValidateGC((DrawablePtr)pBackingStore->pBackingPixmap, pGC); /* * Figure out the array of rectangles to fill and fill them with * PolyFillRect in the proper mode, as set in the GC above. */ numRects = REGION_NUM_RECTS(pRgn); rects = (xRectangle *)ALLOCATE_LOCAL(numRects*sizeof(xRectangle)); if (rects) { for (i = 0, pBox = REGION_RECTS(pRgn); i < numRects; i++, pBox++) { rects[i].x = pBox->x1 - pBackingStore->x; rects[i].y = pBox->y1 - pBackingStore->y; rects[i].width = pBox->x2 - pBox->x1; rects[i].height = pBox->y2 - pBox->y1; } (* pGC->ops->PolyFillRect) ( (DrawablePtr)pBackingStore->pBackingPixmap, pGC, numRects, rects); DEALLOCATE_LOCAL(rects); } FreeScratchGC(pGC); } } if (!generateExposures) { REGION_DESTROY(pScreen, pRgn); pRgn = NULL; } else { /* * result must be screen relative, but is currently * drawable relative. */ REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y); } } else { REGION_DESTROY( pScreen, pRgn); pRgn = NULL; } return pRgn; } static void miBSClearBackingRegion (pWin, pRgn) WindowPtr pWin; RegionPtr pRgn; { BoxPtr pBox; int i; i = REGION_NUM_RECTS(pRgn); pBox = REGION_RECTS(pRgn); while (i--) { (void) miBSClearBackingStore(pWin, pBox->x1, pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, FALSE); pBox++; } } /* * fill a region of the destination with virtual bits * * pRgn is to be translated by (x,y) */ static void miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask) DrawablePtr pDrawable; GCPtr pGC; RegionPtr pRgn; int x, y; int state; PixUnion pixunion; unsigned long planeMask; { int i; BITS32 gcmask; pointer gcval[5]; xRectangle *pRect; BoxPtr pBox; WindowPtr pWin; int numRects; if (state == None) return; numRects = REGION_NUM_RECTS(pRgn); pRect = (xRectangle *)ALLOCATE_LOCAL(numRects * sizeof(xRectangle)); if (!pRect) return; pWin = 0; if (pDrawable->type != DRAWABLE_PIXMAP) { pWin = (WindowPtr) pDrawable; if (!pWin->backStorage) pWin = 0; } i = 0; gcmask = 0; gcval[i++] = (pointer)planeMask; gcmask |= GCPlaneMask; if (state == BackgroundPixel) { if (pGC->fgPixel != pixunion.pixel) { gcval[i++] = (pointer)pixunion.pixel; gcmask |= GCForeground; } if (pGC->fillStyle != FillSolid) { gcval[i++] = (pointer)FillSolid; gcmask |= GCFillStyle; } } else { if (pGC->fillStyle != FillTiled) { gcval[i++] = (pointer)FillTiled; gcmask |= GCFillStyle; } if (pGC->tileIsPixel || pGC->tile.pixmap != pixunion.pixmap) { gcval[i++] = (pointer)pixunion.pixmap; gcmask |= GCTile; } if (pGC->patOrg.x != x) { gcval[i++] = (pointer)x; gcmask |= GCTileStipXOrigin; } if (pGC->patOrg.y != y) { gcval[i++] = (pointer)y; gcmask |= GCTileStipYOrigin; } } if (gcmask) DoChangeGC (pGC, gcmask, (XID *)gcval, 1); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); if (pDrawable->serialNumber != pGC->serialNumber) ValidateGC (pDrawable, pGC); pBox = REGION_RECTS(pRgn); for (i = numRects; --i >= 0; pBox++, pRect++) { pRect->x = pBox->x1 + x; pRect->y = pBox->y1 + y; pRect->width = pBox->x2 - pBox->x1; pRect->height = pBox->y2 - pBox->y1; } pRect -= numRects; (*pGC->ops->PolyFillRect) (pDrawable, pGC, numRects, pRect); if (pWin) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); DEALLOCATE_LOCAL (pRect); } /*- *----------------------------------------------------------------------- * miBSAllocate -- * Create and install backing store info for a window * *----------------------------------------------------------------------- */ static void miBSAllocate(pWin) WindowPtr pWin; { register miBSWindowPtr pBackingStore; register ScreenPtr pScreen; if (pWin->drawable.pScreen->backingStoreSupport == NotUseful) return; pScreen = pWin->drawable.pScreen; if (!(pBackingStore = (miBSWindowPtr)pWin->backStorage)) { pBackingStore = (miBSWindowPtr)xalloc(sizeof(miBSWindowRec)); if (!pBackingStore) return; pBackingStore->pBackingPixmap = NullPixmap; pBackingStore->x = 0; pBackingStore->y = 0; REGION_INIT( pScreen, &pBackingStore->SavedRegion, NullBox, 1); pBackingStore->viewable = (char)pWin->viewable; pBackingStore->status = StatusNoPixmap; pBackingStore->backgroundState = None; pWin->backStorage = (pointer) pBackingStore; } /* * Now want to initialize the backing pixmap and SavedRegion if * necessary. The initialization consists of finding all the * currently-obscured regions, by taking the inverse of the window's * clip list, storing the result in SavedRegion, and exposing those * areas of the window. */ if (pBackingStore->status == StatusNoPixmap && ((pWin->backingStore == WhenMapped && pWin->viewable) || (pWin->backingStore == Always))) { BoxRec box; RegionPtr pSavedRegion; pSavedRegion = &pBackingStore->SavedRegion; box.x1 = pWin->drawable.x; box.x2 = box.x1 + (int) pWin->drawable.width; box.y1 = pWin->drawable.y; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; REGION_INVERSE( pScreen, pSavedRegion, &pWin->clipList, &box); REGION_TRANSLATE( pScreen, pSavedRegion, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin)) REGION_INTERSECT(pScreen, pSavedRegion, pSavedRegion, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_INTERSECT(pScreen, pSavedRegion, pSavedRegion, wClipShape (pWin)); #endif /* if window is already on-screen, assume it has been drawn to */ if (pWin->viewable) pBackingStore->status = StatusVDirty; miTileVirtualBS (pWin); /* * deliver all the newly available regions * as exposure events to the window */ miSendExposures(pWin, pSavedRegion, 0, 0); } else if (!pWin->viewable) { /* * Turn off backing store when we're not supposed to * be saving anything */ if (pBackingStore->status != StatusNoPixmap) { REGION_EMPTY( pScreen, &pBackingStore->SavedRegion); miDestroyBSPixmap (pWin); } } } /*- *----------------------------------------------------------------------- * miBSFree -- * Destroy and free all the stuff associated with the backing-store * for the given window. * * Results: * None. * * Side Effects: * The backing pixmap and all the regions and GC's are destroyed. * *----------------------------------------------------------------------- */ static void miBSFree(pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; register ScreenPtr pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr)pWin->backStorage; if (pBackingStore) { miDestroyBSPixmap (pWin); REGION_UNINIT( pScreen, &pBackingStore->SavedRegion); xfree(pBackingStore); pWin->backStorage = NULL; } } /*- *----------------------------------------------------------------------- * miResizeBackingStore -- * Alter the size of the backing pixmap as necessary when the * SavedRegion changes size. The contents of the old pixmap are * copied/shifted into the new/same pixmap. * * Results: * The new Pixmap is created as necessary. * * Side Effects: * The old pixmap is destroyed. * *----------------------------------------------------------------------- */ static void miResizeBackingStore(pWin, dx, dy, saveBits) WindowPtr pWin; int dx, dy; /* bits are moving this far */ Bool saveBits; /* bits are useful */ { miBSWindowPtr pBackingStore; PixmapPtr pBackingPixmap; ScreenPtr pScreen; GC *pGC; BoxPtr extents; PixmapPtr pNewPixmap; int nx, ny; int nw, nh; pBackingStore = (miBSWindowPtr)(pWin->backStorage); pBackingPixmap = pBackingStore->pBackingPixmap; if (!pBackingPixmap) return; pScreen = pWin->drawable.pScreen; extents = REGION_EXTENTS(pScreen, &pBackingStore->SavedRegion); pNewPixmap = pBackingPixmap; nw = extents->x2 - extents->x1; nh = extents->y2 - extents->y1; /* the policy here could be more sophisticated */ if (nw != pBackingPixmap->drawable.width || nh != pBackingPixmap->drawable.height) { if (!saveBits) { pNewPixmap = NullPixmap; pBackingStore->status = StatusNoPixmap; } else { pNewPixmap = (PixmapPtr)(*pScreen->CreatePixmap) (pScreen, nw, nh, pWin->drawable.depth); if (!pNewPixmap) { #ifdef BSEAGER pBackingStore->status = StatusNoPixmap; #else pBackingStore->status = StatusBadAlloc; #endif } } } if (!pNewPixmap) { pBackingStore->x = 0; pBackingStore->y = 0; } else { nx = pBackingStore->x - extents->x1 + dx; ny = pBackingStore->y - extents->y1 + dy; pBackingStore->x = extents->x1; pBackingStore->y = extents->y1; if (saveBits && (pNewPixmap != pBackingPixmap || nx != 0 || ny != 0)) { pGC = GetScratchGC(pNewPixmap->drawable.depth, pScreen); if (pGC) { ValidateGC((DrawablePtr)pNewPixmap, pGC); /* if we implement a policy where the pixmap can be larger than * the region extents, we might want to optimize this copyarea * by only copying the old extents, rather than the entire * pixmap */ (*pGC->ops->CopyArea)((DrawablePtr)pBackingPixmap, (DrawablePtr)pNewPixmap, pGC, 0, 0, pBackingPixmap->drawable.width, pBackingPixmap->drawable.height, nx, ny); FreeScratchGC(pGC); } } } /* SavedRegion is used in the backingGC clip; force an update */ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pNewPixmap != pBackingPixmap) { (* pScreen->DestroyPixmap)(pBackingPixmap); pBackingStore->pBackingPixmap = pNewPixmap; } } /*- *----------------------------------------------------------------------- * miBSSaveDoomedAreas -- * Saved the areas of the given window that are about to be * obscured. If the window has moved, pObscured is expected to * be at the new screen location and (dx,dy) is expected to be the offset * to the window's previous location. * * Results: * None. * * Side Effects: * The region is copied from the screen into pBackingPixmap and * SavedRegion is updated. * *----------------------------------------------------------------------- */ static void miBSSaveDoomedAreas(pWin, pObscured, dx, dy) register WindowPtr pWin; RegionPtr pObscured; int dx, dy; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; int x, y; pBackingStore = (miBSWindowPtr)pWin->backStorage; pScreen = pWin->drawable.pScreen; /* * If the window isn't realized, it's being unmapped, thus we don't * want to save anything if backingStore isn't Always. */ if (!pWin->realized) { pBackingStore->viewable = (char)pWin->viewable; if (pWin->backingStore != Always) { REGION_EMPTY( pScreen, &pBackingStore->SavedRegion); miDestroyBSPixmap (pWin); return; } if (pBackingStore->status == StatusBadAlloc) pBackingStore->status = StatusNoPixmap; } /* Don't even pretend to save anything for a virtual background None */ if ((pBackingStore->status == StatusVirtual) && (pBackingStore->backgroundState == None)) return; if (REGION_NOTEMPTY(pScreen, pObscured)) { BoxRec oldExtents; x = pWin->drawable.x; y = pWin->drawable.y; REGION_TRANSLATE(pScreen, pObscured, -x, -y); oldExtents = *REGION_EXTENTS(pScreen, &pBackingStore->SavedRegion); REGION_UNION( pScreen, &pBackingStore->SavedRegion, &pBackingStore->SavedRegion, pObscured); /* * only save the bits if we've actually * started using backing store */ if (pBackingStore->status != StatusVirtual) { miBSScreenPtr pScreenPriv; pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr; if (!pBackingStore->pBackingPixmap) miCreateBSPixmap (pWin, &oldExtents); else miResizeBackingStore(pWin, 0, 0, TRUE); if (pBackingStore->pBackingPixmap) { if (pBackingStore->x | pBackingStore->y) { REGION_TRANSLATE( pScreen, pObscured, -pBackingStore->x, -pBackingStore->y); x += pBackingStore->x; y += pBackingStore->y; } (* pScreenPriv->funcs->SaveAreas) (pBackingStore->pBackingPixmap, pObscured, x - dx, y - dy, pWin); } } REGION_TRANSLATE(pScreen, pObscured, x, y); } } /*- *----------------------------------------------------------------------- * miBSRestoreAreas -- * Restore areas from backing-store that are no longer obscured. * expects prgnExposed to contain a screen-relative area. * * Results: * The region to generate exposure events on (which may be * different from the region to paint). * * Side Effects: * Areas are copied from pBackingPixmap to the screen. prgnExposed * is altered to contain the region that could not be restored from * backing-store. * * Notes: * This is called before sending any exposure events to the client, * and so might be called if the window has grown. Changing the backing * pixmap doesn't require revalidating the backingGC because the * client's next output request will result in a call to ValidateGC, * since the window clip region has changed, which will in turn call * miValidateBackingStore. *----------------------------------------------------------------------- */ static RegionPtr miBSRestoreAreas(pWin, prgnExposed) register WindowPtr pWin; RegionPtr prgnExposed; { PixmapPtr pBackingPixmap; miBSWindowPtr pBackingStore; RegionPtr prgnSaved; RegionPtr prgnRestored; register ScreenPtr pScreen; RegionPtr exposures = prgnExposed; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr)pWin->backStorage; pBackingPixmap = pBackingStore->pBackingPixmap; prgnSaved = &pBackingStore->SavedRegion; if (pBackingStore->status == StatusContents) { REGION_TRANSLATE(pScreen, prgnSaved, pWin->drawable.x, pWin->drawable.y); prgnRestored = REGION_CREATE( pScreen, (BoxPtr)NULL, 1); REGION_INTERSECT( pScreen, prgnRestored, prgnExposed, prgnSaved); /* * Since prgnExposed is no longer obscured, we no longer * will have a valid copy of it in backing-store, but there is a valid * copy of it on screen, so subtract the area we just restored from * from the area to be exposed. */ if (REGION_NOTEMPTY( pScreen, prgnRestored)) { miBSScreenPtr pScreenPriv; REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed); REGION_SUBTRACT( pScreen, prgnExposed, prgnExposed, prgnRestored); /* * Do the actual restoration */ pScreenPriv = (miBSScreenPtr) pScreen->devPrivates[miBSScreenIndex].ptr; (* pScreenPriv->funcs->RestoreAreas) (pBackingPixmap, prgnRestored, pWin->drawable.x + pBackingStore->x, pWin->drawable.y + pBackingStore->y, pWin); /* * if the saved region is completely empty, dispose of the * backing pixmap, otherwise, retranslate the saved * region to window relative */ if (REGION_NOTEMPTY(pScreen, prgnSaved)) { REGION_TRANSLATE(pScreen, prgnSaved, -pWin->drawable.x, -pWin->drawable.y); miResizeBackingStore(pWin, 0, 0, TRUE); } else miDestroyBSPixmap (pWin); } else REGION_TRANSLATE(pScreen, prgnSaved, -pWin->drawable.x, -pWin->drawable.y); REGION_DESTROY( pScreen, prgnRestored); } else if ((pBackingStore->status == StatusVirtual) || (pBackingStore->status == StatusVDirty)) { REGION_TRANSLATE(pScreen, prgnSaved, pWin->drawable.x, pWin->drawable.y); exposures = REGION_CREATE( pScreen, NullBox, 1); if (SameBackground (pBackingStore->backgroundState, pBackingStore->background, pWin->backgroundState, pWin->background)) { REGION_SUBTRACT( pScreen, exposures, prgnExposed, prgnSaved); } else { miTileVirtualBS(pWin); /* we need to expose all we have (virtually) retiled */ REGION_UNION( pScreen, exposures, prgnExposed, prgnSaved); } REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed); REGION_TRANSLATE(pScreen, prgnSaved, -pWin->drawable.x, -pWin->drawable.y); } else if (pWin->viewable && !pBackingStore->viewable && pWin->backingStore != Always) { /* * The window was just mapped and nothing has been saved in * backing-store from the last time it was mapped. We want to capture * any output to regions that are already obscured but there are no * bits to snag off the screen, so we initialize things just as we did * in miBSAllocate, above. */ BoxRec box; prgnSaved = &pBackingStore->SavedRegion; box.x1 = pWin->drawable.x; box.x2 = box.x1 + (int) pWin->drawable.width; box.y1 = pWin->drawable.y; box.y2 = box.y1 + (int) pWin->drawable.height; REGION_INVERSE( pScreen, prgnSaved, &pWin->clipList, &box); REGION_TRANSLATE( pScreen, prgnSaved, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin)) REGION_INTERSECT(pScreen, prgnSaved, prgnSaved, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_INTERSECT(pScreen, prgnSaved, prgnSaved, wClipShape (pWin)); #endif miTileVirtualBS(pWin); exposures = REGION_CREATE( pScreen, &box, 1); } pBackingStore->viewable = (char)pWin->viewable; return exposures; } /*- *----------------------------------------------------------------------- * miBSTranslateBackingStore -- * Shift the backing-store in the given direction. Called when bit * gravity is shifting things around. * * Results: * An occluded region of the window which should be sent exposure events. * This region should be in absolute coordinates (i.e. include * new window position). * * Side Effects: * If the window changed size as well as position, the backing pixmap * is resized. The contents of the backing pixmap are shifted * * Warning: * Bob and I have rewritten this routine quite a few times, each * time it gets a few more cases correct, and introducing some * interesting bugs. Naturally, I think the code is correct this * time. * * Let me try to explain what this routine is for: * * It's called from SlideAndSizeWindow whenever a window * with backing store is resized. There are two separate * possibilities: * * a) The window has ForgetGravity * * In this case, windx, windy will be 0 and oldClip will * be NULL. This indicates that all of the window contents * currently saved offscreen should be discarded, and the * entire window exposed. TranslateBackingStore, then, should * prepare a completely new backing store region based on the * new window clipList and return that region for exposure. * * b) The window has some other gravity * * In this case, windx, windy will be set to the distance * that the bits should move within the window. oldClip * will be set to the old visible portion of the window. * TranslateBackingStore, then, should adjust the backing * store to accommodate the portion of the existing backing * store bits which coorespond to backing store bits which * will still be occluded in the new configuration. oldx,oldy * are set to the old position of the window on the screen. * * Furthermore, in this case any contents of the screen which * are about to become occluded should be fetched from the screen * and placed in backing store. This is to avoid the eventual * occlusion by the win gravity shifting the child window bits around * on top of this window, and potentially losing information * * It's also called from SetShape, but I think (he says not * really knowing for sure) that this code will even work * in that case. *----------------------------------------------------------------------- */ static RegionPtr miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy) WindowPtr pWin; int windx; /* bit translation distance in window */ int windy; RegionPtr oldClip; /* Region being copied */ int oldx; /* old window position */ int oldy; { register miBSWindowPtr pBackingStore; register RegionPtr pSavedRegion; register RegionPtr newSaved, doomed; register ScreenPtr pScreen; BoxRec extents; int scrdx; /* bit translation distance on screen */ int scrdy; int dx; /* distance window moved on screen */ int dy; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr)(pWin->backStorage); if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return NullRegion; /* * Compute the new saved region */ newSaved = REGION_CREATE( pScreen, NullBox, 1); extents.x1 = pWin->drawable.x; extents.x2 = pWin->drawable.x + (int) pWin->drawable.width; extents.y1 = pWin->drawable.y; extents.y2 = pWin->drawable.y + (int) pWin->drawable.height; REGION_INVERSE( pScreen, newSaved, &pWin->clipList, &extents); REGION_TRANSLATE( pScreen, newSaved, -pWin->drawable.x, -pWin->drawable.y); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { if (wBoundingShape (pWin)) REGION_INTERSECT( pScreen, newSaved, newSaved, wBoundingShape (pWin)); if (wClipShape (pWin)) REGION_INTERSECT( pScreen, newSaved, newSaved, wClipShape (pWin)); } #endif pSavedRegion = &pBackingStore->SavedRegion; /* now find any visible areas we can save from the screen */ /* and then translate newSaved to old local coordinates */ if (oldClip) { /* bit gravity makes things virtually too hard, punt */ if (((windx != 0) || (windy != 0)) && (pBackingStore->status != StatusContents)) miCreateBSPixmap(pWin, NullBox); /* * The window is moving this far on the screen */ dx = pWin->drawable.x - oldx; dy = pWin->drawable.y - oldy; /* * The bits will be moving on the screen by the * amount the window is moving + the amount the * bits are moving within the window */ scrdx = windx + dx; scrdy = windy + dy; /* * intersect at old bit position to discover the * bits on the screen which can be put into the * new backing store */ REGION_TRANSLATE( pScreen, oldClip, windx - oldx, windy - oldy); doomed = REGION_CREATE( pScreen, NullBox, 1); REGION_INTERSECT( pScreen, doomed, oldClip, newSaved); REGION_TRANSLATE( pScreen, oldClip, oldx - windx, oldy - windy); /* * Translate the old saved region to the position in the * window where it will appear to be */ REGION_TRANSLATE( pScreen, pSavedRegion, windx, windy); /* * Add the old saved region to the new saved region, so * that calls to RestoreAreas will be able to fetch those * bits back */ REGION_UNION( pScreen, newSaved, newSaved, pSavedRegion); /* * Swap the new saved region into the window */ { RegionRec tmp; tmp = *pSavedRegion; *pSavedRegion = *newSaved; *newSaved = tmp; } miResizeBackingStore (pWin, windx, windy, TRUE); /* * Compute the newly enabled region * of backing store. This region will be * set to background in the backing pixmap and * sent as exposure events to the client. */ REGION_SUBTRACT( pScreen, newSaved, pSavedRegion, newSaved); /* * Fetch bits which will be obscured from * the screen */ if (REGION_NOTEMPTY( pScreen, doomed)) { /* * Don't clear regions which have bits on the * screen */ REGION_SUBTRACT( pScreen, newSaved, newSaved, doomed); /* * Make the region to SaveDoomedAreas absolute, instead * of window relative. */ REGION_TRANSLATE( pScreen, doomed, pWin->drawable.x, pWin->drawable.y); (* pScreen->SaveDoomedAreas) (pWin, doomed, scrdx, scrdy); } REGION_DESTROY(pScreen, doomed); /* * and clear whatever there is that's new */ if (REGION_NOTEMPTY( pScreen, newSaved)) { miBSClearBackingRegion (pWin, newSaved); /* * Make the exposed region absolute */ REGION_TRANSLATE(pScreen, newSaved, pWin->drawable.x, pWin->drawable.y); } else { REGION_DESTROY(pScreen, newSaved); newSaved = NullRegion; } } else { /* * ForgetGravity: just reset backing store and * expose the whole mess */ REGION_COPY( pScreen, pSavedRegion, newSaved); REGION_TRANSLATE( pScreen, newSaved, pWin->drawable.x, pWin->drawable.y); miResizeBackingStore (pWin, 0, 0, FALSE); (void) miBSClearBackingStore (pWin, 0, 0, 0, 0, FALSE); } return newSaved; } /* * Inform the backing store layer that you are about to validate * a gc with a window, and that subsequent output to the window * is (or is not) guaranteed to be already clipped to the visible * regions of the window. */ static void miBSDrawGuarantee (pWin, pGC, guarantee) WindowPtr pWin; GCPtr pGC; int guarantee; { miBSGCPtr pPriv; if (pWin->backStorage) { pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; if (!pPriv) (void) miBSCreateGCPrivate (pGC); pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; if (pPriv) { /* * XXX KLUDGE ALERT * * when the GC is Cheap pPriv will point * at some device's gc func structure. guarantee * will point at the ChangeGC entry of that struct * and will never match a valid guarantee value. */ switch (pPriv->guarantee) { case GuaranteeNothing: case GuaranteeVisBack: pPriv->guarantee = guarantee; break; } } } } #define noBackingCopy (GCGraphicsExposures|GCClipXOrigin|GCClipYOrigin| \ GCClipMask|GCSubwindowMode| \ GCTileStipXOrigin|GCTileStipYOrigin) /*- *----------------------------------------------------------------------- * miBSValidateGC -- * Wrapper around output-library's ValidateGC routine * * Results: * None. * * Side Effects: * * Notes: * The idea here is to perform several functions: * - All the output calls must be intercepted and routed to * backing-store as necessary. * - pGC in the window's devBackingStore must be set up with the * clip list appropriate for writing to pBackingPixmap (i.e. * the inverse of the window's clipList intersected with the * clientClip of the GC). Since the destination for this GC is * a pixmap, it is sufficient to set the clip list as its * clientClip. *----------------------------------------------------------------------- */ static void miBSValidateGC (pGC, stateChanges, pDrawable) GCPtr pGC; unsigned long stateChanges; DrawablePtr pDrawable; { GCPtr pBackingGC; miBSWindowPtr pWindowPriv; miBSGCPtr pPriv; WindowPtr pWin; int lift_functions; RegionPtr backingCompositeClip = NULL; if (pDrawable->type != DRAWABLE_PIXMAP) { pWin = (WindowPtr) pDrawable; pWindowPriv = (miBSWindowPtr) pWin->backStorage; lift_functions = (pWindowPriv == (miBSWindowPtr) NULL); } else { pWin = (WindowPtr) NULL; lift_functions = TRUE; } pPriv = (miBSGCPtr)pGC->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (*pGC->funcs->ValidateGC) (pGC, stateChanges, pDrawable); /* * rewrap funcs and ops as Validate may have changed them */ pPriv->wrapFuncs = pGC->funcs; pPriv->wrapOps = pGC->ops; if (!lift_functions && ((pPriv->guarantee == GuaranteeVisBack) || (pWindowPriv->status == StatusNoPixmap) || (pWindowPriv->status == StatusBadAlloc))) lift_functions = TRUE; /* * check to see if a new backingCompositeClip region must * be generated */ if (!lift_functions && ((pDrawable->serialNumber != pPriv->serialNumber) || (stateChanges&(GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)))) { if (REGION_NOTEMPTY(pGC->pScreen, &pWindowPriv->SavedRegion)) { backingCompositeClip = REGION_CREATE(pGC->pScreen, NULL, 1); if ((pGC->clientClipType == CT_NONE) || (pGC->clientClipType == CT_PIXMAP)) { REGION_COPY(pGC->pScreen, backingCompositeClip, &pWindowPriv->SavedRegion); } else { /* * Make a new copy of the client clip, translated to * its proper origin. */ REGION_COPY(pGC->pScreen, backingCompositeClip, pGC->clientClip); REGION_TRANSLATE(pGC->pScreen, backingCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); REGION_INTERSECT(pGC->pScreen, backingCompositeClip, backingCompositeClip, &pWindowPriv->SavedRegion); } if (pGC->subWindowMode == IncludeInferiors) { RegionPtr translatedClip; /* XXX * any output in IncludeInferiors mode will not * be redirected to Inferiors backing store. This * can be fixed only at great cost to the shadow routines. */ translatedClip = NotClippedByChildren (pWin); REGION_TRANSLATE(pGC->pScreen, translatedClip, -pDrawable->x, -pDrawable->y); REGION_SUBTRACT(pGC->pScreen, backingCompositeClip, backingCompositeClip, translatedClip); REGION_DESTROY(pGC->pScreen, translatedClip); } if (!REGION_NOTEMPTY(pGC->pScreen, backingCompositeClip)) lift_functions = TRUE; } else { lift_functions = TRUE; } /* Reset the status when drawing to an unoccluded window so that * future SaveAreas will actually copy bits from the screen. Note that * output to root window in IncludeInferiors mode will not cause this * to change. This causes all transient graphics by the window * manager to the root window to not enable backing store. */ if (lift_functions && (pWindowPriv->status == StatusVirtual) && (pWin->parent || pGC->subWindowMode != IncludeInferiors)) pWindowPriv->status = StatusVDirty; } /* * if no backing store has been allocated, and it's needed, * create it now. */ if (!lift_functions && !pWindowPriv->pBackingPixmap) { miCreateBSPixmap (pWin, NullBox); if (!pWindowPriv->pBackingPixmap) lift_functions = TRUE; } /* * create the backing GC if needed, lift functions * if the creation fails */ if (!lift_functions && !pPriv->pBackingGC) { int status; XID noexpose = xFalse; /* We never want ops with the backingGC to generate GraphicsExpose */ pBackingGC = CreateGC ((DrawablePtr)pWindowPriv->pBackingPixmap, GCGraphicsExposures, &noexpose, &status); if (status != Success) lift_functions = TRUE; else pPriv->pBackingGC = pBackingGC; } pBackingGC = pPriv->pBackingGC; pPriv->stateChanges |= stateChanges; if (lift_functions) { if (backingCompositeClip) REGION_DESTROY( pGC->pScreen, backingCompositeClip); /* unwrap the GC again */ miBSDestroyGCPrivate (pGC); return; } /* * the rest of this function gets the pBackingGC * into shape for possible draws */ pPriv->stateChanges &= ~noBackingCopy; if (pPriv->stateChanges) CopyGC(pGC, pBackingGC, pPriv->stateChanges); if ((pGC->patOrg.x - pWindowPriv->x) != pBackingGC->patOrg.x || (pGC->patOrg.y - pWindowPriv->y) != pBackingGC->patOrg.y) { XID vals[2]; vals[0] = pGC->patOrg.x - pWindowPriv->x; vals[1] = pGC->patOrg.y - pWindowPriv->y; DoChangeGC(pBackingGC, GCTileStipXOrigin|GCTileStipYOrigin, vals, 0); } pPriv->stateChanges = 0; if (backingCompositeClip) { XID vals[2]; if (pGC->clientClipType == CT_PIXMAP) { miBSScreenPtr pScreenPriv; (*pBackingGC->funcs->CopyClip)(pBackingGC, pGC); REGION_TRANSLATE(pGC->pScreen, backingCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); vals[0] = pGC->clipOrg.x - pWindowPriv->x; vals[1] = pGC->clipOrg.y - pWindowPriv->y; DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); pScreenPriv = (miBSScreenPtr) pGC->pScreen->devPrivates[miBSScreenIndex].ptr; (* pScreenPriv->funcs->SetClipmaskRgn) (pBackingGC, backingCompositeClip); REGION_DESTROY( pGC->pScreen, backingCompositeClip); } else { vals[0] = -pWindowPriv->x; vals[1] = -pWindowPriv->y; DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0); (*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION, backingCompositeClip, 0); } pPriv->serialNumber = pDrawable->serialNumber; } if (pWindowPriv->pBackingPixmap->drawable.serialNumber != pBackingGC->serialNumber) { ValidateGC((DrawablePtr)pWindowPriv->pBackingPixmap, pBackingGC); } if (pBackingGC->clientClip == 0) ErrorF ("backing store clip list nil"); FUNC_EPILOGUE (pGC, pPriv); } static void miBSChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (*pGC->funcs->ChangeGC) (pGC, mask); FUNC_EPILOGUE (pGC, pPriv); } static void miBSCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { miBSGCPtr pPriv = (miBSGCPtr) (pGCDst)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGCDst, pPriv); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); FUNC_EPILOGUE (pGCDst, pPriv); } static void miBSDestroyGC (pGC) GCPtr pGC; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); if (pPriv->pBackingGC) FreeGC(pPriv->pBackingGC, (GContext)0); (*pGC->funcs->DestroyGC) (pGC); FUNC_EPILOGUE (pGC, pPriv); xfree(pPriv); } static void miBSChangeClip(pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (* pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects); FUNC_EPILOGUE (pGC, pPriv); } static void miBSCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { miBSGCPtr pPriv = (miBSGCPtr) (pgcDst)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pgcDst, pPriv); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); FUNC_EPILOGUE (pgcDst, pPriv); } static void miBSDestroyClip(pGC) GCPtr pGC; { miBSGCPtr pPriv = (miBSGCPtr) (pGC)->devPrivates[miBSGCIndex].ptr; FUNC_PROLOGUE (pGC, pPriv); (* pGC->funcs->DestroyClip)(pGC); FUNC_EPILOGUE (pGC, pPriv); } static void miDestroyBSPixmap (pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->pBackingPixmap) (* pScreen->DestroyPixmap)(pBackingStore->pBackingPixmap); pBackingStore->pBackingPixmap = NullPixmap; pBackingStore->x = 0; pBackingStore->y = 0; if (pBackingStore->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap)(pBackingStore->background.pixmap); pBackingStore->backgroundState = None; pBackingStore->status = StatusNoPixmap; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; } static void miTileVirtualBS (pWin) WindowPtr pWin; { miBSWindowPtr pBackingStore; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->backgroundState == BackgroundPixmap) (* pWin->drawable.pScreen->DestroyPixmap) (pBackingStore->background.pixmap); pBackingStore->backgroundState = pWin->backgroundState; pBackingStore->background = pWin->background; if (pBackingStore->backgroundState == BackgroundPixmap) pBackingStore->background.pixmap->refcnt++; if (pBackingStore->status != StatusVDirty) pBackingStore->status = StatusVirtual; /* * punt parent relative tiles and do it now */ if (pBackingStore->backgroundState == ParentRelative) miCreateBSPixmap (pWin, NullBox); } #ifdef DEBUG static int BSAllocationsFailed = 0; #define FAILEDSIZE 32 static struct { int w, h; } failedRecord[FAILEDSIZE]; static int failedIndex; #endif static void miCreateBSPixmap (pWin, pExtents) WindowPtr pWin; BoxPtr pExtents; { miBSWindowPtr pBackingStore; ScreenPtr pScreen; PixUnion background; char backgroundState; BoxPtr extents; Bool backSet; pScreen = pWin->drawable.pScreen; pBackingStore = (miBSWindowPtr) pWin->backStorage; if (pBackingStore->status == StatusBadAlloc) return; backSet = ((pBackingStore->status == StatusVirtual) || (pBackingStore->status == StatusVDirty)); extents = REGION_EXTENTS( pScreen, &pBackingStore->SavedRegion); if (!pBackingStore->pBackingPixmap) { /* the policy here could be more sophisticated */ pBackingStore->x = extents->x1; pBackingStore->y = extents->y1; pBackingStore->pBackingPixmap = (PixmapPtr)(* pScreen->CreatePixmap) (pScreen, extents->x2 - extents->x1, extents->y2 - extents->y1, pWin->drawable.depth); } if (!pBackingStore->pBackingPixmap) { #ifdef DEBUG BSAllocationsFailed++; /* * record failed allocations */ failedRecord[failedIndex].w = pWin->drawable.width; failedRecord[failedIndex].h = pWin->drawable.height; failedIndex++; if (failedIndex == FAILEDSIZE) failedIndex = 0; #endif #ifdef BSEAGER pBackingStore->status = StatusNoPixmap; #else pBackingStore->status = StatusBadAlloc; #endif return; } pBackingStore->status = StatusContents; if (backSet) { backgroundState = pWin->backgroundState; background = pWin->background; pWin->backgroundState = pBackingStore->backgroundState; pWin->background = pBackingStore->background; if (pWin->backgroundState == BackgroundPixmap) pWin->background.pixmap->refcnt++; } if (!pExtents) pExtents = extents; if (pExtents->y1 != pExtents->y2) { RegionPtr exposed; exposed = miBSClearBackingStore(pWin, pExtents->x1, pExtents->y1, pExtents->x2 - pExtents->x1, pExtents->y2 - pExtents->y1, !backSet); if (exposed) { miSendExposures(pWin, exposed, pWin->drawable.x, pWin->drawable.y); REGION_DESTROY( pScreen, exposed); } } if (backSet) { if (pWin->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap) (pWin->background.pixmap); pWin->backgroundState = backgroundState; pWin->background = background; if (pBackingStore->backgroundState == BackgroundPixmap) (* pScreen->DestroyPixmap) (pBackingStore->background.pixmap); pBackingStore->backgroundState = None; } } /*- *----------------------------------------------------------------------- * miBSExposeCopy -- * Handle the restoration of areas exposed by graphics operations. * * Results: * None. * * Side Effects: * prgnExposed has the areas exposed from backing-store removed * from it. * *----------------------------------------------------------------------- */ static void miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane) WindowPtr pSrc; DrawablePtr pDst; GCPtr pGC; RegionPtr prgnExposed; int srcx, srcy; int dstx, dsty; unsigned long plane; { RegionRec tempRgn; miBSWindowPtr pBackingStore; RegionPtr (*copyProc)(); GCPtr pScratchGC; register BoxPtr pBox; register int i; register int dx, dy; BITS32 gcMask; if (!REGION_NOTEMPTY(pGC->pScreen, prgnExposed)) return; pBackingStore = (miBSWindowPtr)pSrc->backStorage; if ((pBackingStore->status == StatusNoPixmap) || (pBackingStore->status == StatusBadAlloc)) return; REGION_INIT( pGC->pScreen, &tempRgn, NullBox, 0); REGION_INTERSECT( pGC->pScreen, &tempRgn, prgnExposed, &pBackingStore->SavedRegion); REGION_SUBTRACT( pGC->pScreen, prgnExposed, prgnExposed, &tempRgn); if (plane != 0) { copyProc = pGC->ops->CopyPlane; } else { copyProc = pGC->ops->CopyArea; } dx = dstx - srcx; dy = dsty - srcy; switch (pBackingStore->status) { case StatusVirtual: case StatusVDirty: pScratchGC = GetScratchGC (pDst->depth, pDst->pScreen); if (pScratchGC) { gcMask = 0; if (pGC->alu != pScratchGC->alu) gcMask = GCFunction; if (pGC->planemask != pScratchGC->planemask) gcMask |= GCPlaneMask; if (gcMask) CopyGC (pGC, pScratchGC, gcMask); miBSFillVirtualBits (pDst, pScratchGC, &tempRgn, dx, dy, (int) pBackingStore->backgroundState, pBackingStore->background, ~0L); FreeScratchGC (pScratchGC); } break; case StatusContents: for (i = REGION_NUM_RECTS(&tempRgn), pBox = REGION_RECTS(&tempRgn); --i >= 0; pBox++) { (* copyProc) (pBackingStore->pBackingPixmap, pDst, pGC, pBox->x1 - pBackingStore->x, pBox->y1 - pBackingStore->y, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, pBox->x1 + dx, pBox->y1 + dy, plane); } break; } REGION_UNINIT( pGC->pScreen, &tempRgn); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miscanfill.h0100664000076400007640000001165707120677563021624 0ustar constconst/* $XConsortium: miscanfill.h,v 1.5 94/04/17 20:27:50 dpw Exp $ */ /* Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef SCANFILLINCLUDED #define SCANFILLINCLUDED /* * scanfill.h * * Written by Brian Kelleher; Jan 1985 * * This file contains a few macros to help track * the edge of a filled object. The object is assumed * to be filled in scanline order, and thus the * algorithm used is an extension of Bresenham's line * drawing algorithm which assumes that y is always the * major axis. * Since these pieces of code are the same for any filled shape, * it is more convenient to gather the library in one * place, but since these pieces of code are also in * the inner loops of output primitives, procedure call * overhead is out of the question. * See the author for a derivation if needed. */ /* * In scan converting polygons, we want to choose those pixels * which are inside the polygon. Thus, we add .5 to the starting * x coordinate for both left and right edges. Now we choose the * first pixel which is inside the pgon for the left edge and the * first pixel which is outside the pgon for the right edge. * Draw the left pixel, but not the right. * * How to add .5 to the starting x coordinate: * If the edge is moving to the right, then subtract dy from the * error term from the general form of the algorithm. * If the edge is moving to the left, then add dy to the error term. * * The reason for the difference between edges moving to the left * and edges moving to the right is simple: If an edge is moving * to the right, then we want the algorithm to flip immediately. * If it is moving to the left, then we don't want it to flip until * we traverse an entire pixel. */ #define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ int dx; /* local storage */ \ \ /* \ * if the edge is horizontal, then it is ignored \ * and assumed not to be processed. Otherwise, do this stuff. \ */ \ if ((dy) != 0) { \ xStart = (x1); \ dx = (x2) - xStart; \ if (dx < 0) { \ m = dx / (dy); \ m1 = m - 1; \ incr1 = -2 * dx + 2 * (dy) * m1; \ incr2 = -2 * dx + 2 * (dy) * m; \ d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ } else { \ m = dx / (dy); \ m1 = m + 1; \ incr1 = 2 * dx - 2 * (dy) * m1; \ incr2 = 2 * dx - 2 * (dy) * m; \ d = -2 * m * (dy) + 2 * dx; \ } \ } \ } #define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ if (m1 > 0) { \ if (d > 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } else {\ if (d >= 0) { \ minval += m1; \ d += incr1; \ } \ else { \ minval += m; \ d += incr2; \ } \ } \ } /* * This structure contains all of the information needed * to run the bresenham algorithm. * The variables may be hardcoded into the declarations * instead of using this structure to make use of * register declarations. */ typedef struct { int minor; /* minor axis */ int d; /* decision variable */ int m, m1; /* slope and slope+1 */ int incr1, incr2; /* error increments */ } BRESINFO; #define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ BRESINITPGON(dmaj, min1, min2, bres.minor, bres.d, \ bres.m, bres.m1, bres.incr1, bres.incr2) #define BRESINCRPGONSTRUCT(bres) \ BRESINCRPGON(bres.d, bres.minor, bres.m, bres.m1, bres.incr1, bres.incr2) #endif vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolyrect.c0100664000076400007640000001260407120677563021656 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolyrect.c,v 5.8 94/04/17 20:27:44 keith Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmap.h" void miPolyRectangle(pDraw, pGC, nrects, pRects) DrawablePtr pDraw; GCPtr pGC; int nrects; xRectangle *pRects; { int i; xRectangle *pR = pRects; DDXPointRec rect[5]; int bound_tmp; #define MINBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp < -32768) \ bound_tmp = -32768; \ dst = bound_tmp; #define MAXBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 32767) \ bound_tmp = 32767; \ dst = bound_tmp; #define MAXUBOUND(dst,eqn) bound_tmp = eqn; \ if (bound_tmp > 65535) \ bound_tmp = 65535; \ dst = bound_tmp; if (pGC->lineStyle == LineSolid && pGC->joinStyle == JoinMiter && pGC->lineWidth != 0) { xRectangle *tmp, *t; int ntmp; int offset1, offset2, offset3; int x, y, width, height; ntmp = (nrects << 2); offset2 = pGC->lineWidth; offset1 = offset2 >> 1; offset3 = offset2 - offset1; tmp = (xRectangle *) ALLOCATE_LOCAL(ntmp * sizeof (xRectangle)); if (!tmp) return; t = tmp; for (i = 0; i < nrects; i++) { x = pR->x; y = pR->y; width = pR->width; height = pR->height; pR++; if (width == 0 && height == 0) { rect[0].x = x; rect[0].y = y; rect[1].x = x; rect[1].y = y; (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 2, rect); } else if (height < offset2 || width < offset1) { if (height == 0) { t->x = x; t->width = width; } else { MINBOUND (t->x, x - offset1) MAXUBOUND (t->width, width + offset2) } if (width == 0) { t->y = y; t->height = height; } else { MINBOUND (t->y, y - offset1) MAXUBOUND (t->height, height + offset2) } t++; } else { MINBOUND(t->x, x - offset1) MINBOUND(t->y, y - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + offset3); t->width = offset2; t->height = height - offset2; t++; MAXBOUND(t->x, x + width - offset1); MAXBOUND(t->y, y + offset3) t->width = offset2; t->height = height - offset2; t++; MINBOUND(t->x, x - offset1) MAXBOUND(t->y, y + height - offset1) MAXUBOUND(t->width, width + offset2) t->height = offset2; t++; } } (*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp); DEALLOCATE_LOCAL ((pointer) tmp); } else { for (i=0; ix; rect[0].y = pR->y; MAXBOUND(rect[1].x, pR->x + (int) pR->width) rect[1].y = rect[0].y; rect[2].x = rect[1].x; MAXBOUND(rect[2].y, pR->y + (int) pR->height); rect[3].x = rect[0].x; rect[3].y = rect[2].y; rect[4].x = rect[0].x; rect[4].y = rect[0].y; (*pGC->ops->Polylines)(pDraw, pGC, CoordModeOrigin, 5, rect); pR++; } } } vnc_unixsrc/Xvnc/programs/Xserver/mi/miexpose.c0100664000076400007640000005625707463513423021326 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miexpose.c /main/43 1996/08/01 19:25:26 dpw $ */ /* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.1 1996/12/23 07:09:44 dawes Exp $ */ #include "X.h" #define NEED_EVENTS #include "Xproto.h" #include "Xprotostr.h" #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "input.h" #include "dixstruct.h" #include "mi.h" #include "Xmd.h" extern WindowPtr *WindowTable; /* machine-independent graphics exposure code. any device that uses the region package can call this. */ #ifndef RECTLIMIT #define RECTLIMIT 25 /* pick a number, any number > 8 */ #endif /* miHandleExposures generate a region for exposures for areas that were copied from obscured or non-existent areas to non-obscured areas of the destination. Paint the background for the region, if the destination is a window. NOTE: this should generally be called, even if graphicsExposures is false, because this is where bits get recovered from backing store. NOTE: added argument 'plane' is used to indicate how exposures from backing store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea should be used, else a CopyPlane of the indicated plane will be used. The exposing is done by the backing store's GraphicsExpose function, of course. */ RegionPtr miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane) register DrawablePtr pSrcDrawable; register DrawablePtr pDstDrawable; GCPtr pGC; int srcx, srcy; int width, height; int dstx, dsty; unsigned long plane; { register ScreenPtr pscr = pGC->pScreen; RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ RegionRec rgnDstRec; BoxRec srcBox; /* unclipped source */ RegionRec rgnExposed; /* exposed region, calculated source- relative, made dst relative to intersect with visible parts of dest and send events to client, and then screen relative to paint the window background */ WindowPtr pSrcWin; BoxRec expBox; Bool extents; /* avoid work if we can */ if (!pGC->graphicsExposures && (pDstDrawable->type == DRAWABLE_PIXMAP) && ((pSrcDrawable->type == DRAWABLE_PIXMAP) || (((WindowPtr)pSrcDrawable)->backStorage == NULL))) return NULL; srcBox.x1 = srcx; srcBox.y1 = srcy; srcBox.x2 = srcx+width; srcBox.y2 = srcy+height; if (pSrcDrawable->type != DRAWABLE_PIXMAP) { BoxRec TsrcBox; TsrcBox.x1 = srcx + pSrcDrawable->x; TsrcBox.y1 = srcy + pSrcDrawable->y; TsrcBox.x2 = TsrcBox.x1 + width; TsrcBox.y2 = TsrcBox.y1 + height; pSrcWin = (WindowPtr) pSrcDrawable; if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren (pSrcWin); if ((RECT_IN_REGION(pscr, prgnSrcClip, &TsrcBox)) == rgnIN) { REGION_DESTROY(pscr, prgnSrcClip); return NULL; } } else { if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN) return NULL; prgnSrcClip = &rgnSrcRec; REGION_INIT(pscr, prgnSrcClip, NullBox, 0); REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList); } REGION_TRANSLATE(pscr, prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y); } else { BoxRec box; if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && (srcBox.x2 <= pSrcDrawable->width) && (srcBox.y2 <= pSrcDrawable->height)) return NULL; box.x1 = 0; box.y1 = 0; box.x2 = pSrcDrawable->width; box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; REGION_INIT(pscr, prgnSrcClip, &box, 1); pSrcWin = (WindowPtr)NULL; } if (pDstDrawable == pSrcDrawable) { prgnDstClip = prgnSrcClip; } else if (pDstDrawable->type != DRAWABLE_PIXMAP) { if (pGC->subWindowMode == IncludeInferiors) { prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable); } else { prgnDstClip = &rgnDstRec; REGION_INIT(pscr, prgnDstClip, NullBox, 0); REGION_COPY(pscr, prgnDstClip, &((WindowPtr)pDstDrawable)->clipList); } REGION_TRANSLATE(pscr, prgnDstClip, -pDstDrawable->x, -pDstDrawable->y); } else { BoxRec box; box.x1 = 0; box.y1 = 0; box.x2 = pDstDrawable->width; box.y2 = pDstDrawable->height; prgnDstClip = &rgnDstRec; REGION_INIT(pscr, prgnDstClip, &box, 1); } /* drawable-relative source region */ REGION_INIT(pscr, &rgnExposed, &srcBox, 1); /* now get the hidden parts of the source box*/ REGION_SUBTRACT(pscr, &rgnExposed, &rgnExposed, prgnSrcClip); if (pSrcWin && pSrcWin->backStorage) { /* * Copy any areas from the source backing store. Modifies * rgnExposed. */ (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, pDstDrawable, pGC, &rgnExposed, srcx, srcy, dstx, dsty, plane); } /* move them over the destination */ REGION_TRANSLATE(pscr, &rgnExposed, dstx-srcx, dsty-srcy); /* intersect with visible areas of dest */ REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, prgnDstClip); /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-) * for windows. */ extents = pGC->graphicsExposures && (REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) && (pDstDrawable->type != DRAWABLE_PIXMAP); #ifdef SHAPE if (pSrcWin) { RegionPtr region; if (!(region = wClipShape (pSrcWin))) region = wBoundingShape (pSrcWin); /* * If you try to CopyArea the extents of a shaped window, compacting the * exposed region will undo all our work! */ if (extents && pSrcWin && region && (RECT_IN_REGION(pscr, region, &srcBox) != rgnIN)) extents = FALSE; } #endif if (extents) { WindowPtr pWin = (WindowPtr)pDstDrawable; expBox = *REGION_EXTENTS(pscr, &rgnExposed); REGION_RESET(pscr, &rgnExposed, &expBox); /* need to clear out new areas of backing store */ if (pWin->backStorage) (void) (* pWin->drawable.pScreen->ClearBackingStore)( pWin, expBox.x1, expBox.y1, expBox.x2 - expBox.x1, expBox.y2 - expBox.y1, FALSE); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr)pDstDrawable)->backgroundState != None)) { WindowPtr pWin = (WindowPtr)pDstDrawable; /* make the exposed area screen-relative */ REGION_TRANSLATE(pscr, &rgnExposed, pDstDrawable->x, pDstDrawable->y); if (extents) { /* PaintWindowBackground doesn't clip, so we have to */ REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList); } (*pWin->drawable.pScreen->PaintWindowBackground)( (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { REGION_RESET(pscr, &rgnExposed, &expBox); } else REGION_TRANSLATE(pscr, &rgnExposed, -pDstDrawable->x, -pDstDrawable->y); } if (prgnDstClip == &rgnDstRec) { REGION_UNINIT(pscr, prgnDstClip); } else if (prgnDstClip != prgnSrcClip) { REGION_DESTROY(pscr, prgnDstClip); } if (prgnSrcClip == &rgnSrcRec) { REGION_UNINIT(pscr, prgnSrcClip); } else { REGION_DESTROY(pscr, prgnSrcClip); } if (pGC->graphicsExposures) { /* don't look */ RegionPtr exposed = REGION_CREATE(pscr, NullBox, 0); *exposed = rgnExposed; return exposed; } else { REGION_UNINIT(pscr, &rgnExposed); return NULL; } } /* send GraphicsExpose events, or a NoExpose event, based on the region */ void miSendGraphicsExpose (client, pRgn, drawable, major, minor) ClientPtr client; RegionPtr pRgn; XID drawable; int major; int minor; { if (pRgn && !REGION_NIL(pRgn)) { xEvent *pEvent; register xEvent *pe; register BoxPtr pBox; register int i; int numRects; numRects = REGION_NUM_RECTS(pRgn); pBox = REGION_RECTS(pRgn); if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) return; pe = pEvent; for (i=1; i<=numRects; i++, pe++, pBox++) { pe->u.u.type = GraphicsExpose; pe->u.graphicsExposure.drawable = drawable; pe->u.graphicsExposure.x = pBox->x1; pe->u.graphicsExposure.y = pBox->y1; pe->u.graphicsExposure.width = pBox->x2 - pBox->x1; pe->u.graphicsExposure.height = pBox->y2 - pBox->y1; pe->u.graphicsExposure.count = numRects - i; pe->u.graphicsExposure.majorEvent = major; pe->u.graphicsExposure.minorEvent = minor; } TryClientEvents(client, pEvent, numRects, (Mask)0, NoEventMask, NullGrab); DEALLOCATE_LOCAL(pEvent); } else { xEvent event; event.u.u.type = NoExpose; event.u.noExposure.drawable = drawable; event.u.noExposure.majorEvent = major; event.u.noExposure.minorEvent = minor; TryClientEvents(client, &event, 1, (Mask)0, NoEventMask, NullGrab); } } void miSendExposures(pWin, pRgn, dx, dy) WindowPtr pWin; RegionPtr pRgn; register int dx, dy; { register BoxPtr pBox; int numRects; register xEvent *pEvent, *pe; register int i; pBox = REGION_RECTS(pRgn); numRects = REGION_NUM_RECTS(pRgn); if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)))) return; for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pWin->drawable.id; pe->u.expose.x = pBox->x1 - dx; pe->u.expose.y = pBox->y1 - dy; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = i; } DeliverEvents(pWin, pEvent, numRects, NullWindow); DEALLOCATE_LOCAL(pEvent); } void miWindowExposures(pWin, prgn, other_exposed) WindowPtr pWin; register RegionPtr prgn, other_exposed; { RegionPtr exposures = prgn; if (pWin->backStorage && prgn) /* * in some cases, backing store will cause a different * region to be exposed than needs to be repainted * (like when a window is mapped). RestoreAreas is * allowed to return a region other than prgn, * in which case this routine will free the resultant * region. If exposures is null, then no events will * be sent to the client; if prgn is empty * no areas will be repainted. */ exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); if ((prgn && !REGION_NIL(prgn)) || (exposures && !REGION_NIL(exposures)) || other_exposed) { RegionRec expRec; int clientInterested; /* * Restore from backing-store FIRST. */ clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; if (other_exposed) { if (exposures) { REGION_UNION(pWin->drawable.pScreen, other_exposed, exposures, other_exposed); if (exposures != prgn) REGION_DESTROY(pWin->drawable.pScreen, exposures); } exposures = other_exposed; } if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-). */ BoxRec box; box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures); if (exposures == prgn) { exposures = &expRec; REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1); REGION_RESET( pWin->drawable.pScreen, prgn, &box); } else { REGION_RESET( pWin->drawable.pScreen, exposures, &box); REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures); } /* PaintWindowBackground doesn't clip, so we have to */ REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList); /* need to clear out new areas of backing store, too */ if (pWin->backStorage) (void) (* pWin->drawable.pScreen->ClearBackingStore)( pWin, box.x1 - pWin->drawable.x, box.y1 - pWin->drawable.y, box.x2 - box.x1, box.y2 - box.y1, FALSE); } if (prgn && !REGION_NIL(prgn)) (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); if (clientInterested && exposures && !REGION_NIL(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) { REGION_UNINIT( pWin->drawable.pScreen, exposures); } else if (exposures && exposures != prgn && exposures != other_exposed) REGION_DESTROY( pWin->drawable.pScreen, exposures); if (prgn) REGION_EMPTY( pWin->drawable.pScreen, prgn); } else if (exposures && exposures != prgn) REGION_DESTROY( pWin->drawable.pScreen, exposures); } /* this code is highly unlikely. it is not haile selassie. there is some hair here. we can't just use the window's clip region as it is, because if we are painting the border, the border is not in the client area and so we will be excluded when we validate the GC, and if we are painting a parent-relative background, the area we want to paint is in some other window. since we trust the code calling us to tell us to paint only areas that are really ours, we will temporarily give the window a clipList the size of the whole screen and an origin at (0,0). this more or less assumes that ddX code will do translation based on the window's absolute position, and that ValidateGC will look at clipList, and that no other fields from the window will be used. it's not possible to just draw in the root because it may be a different depth. to get the tile to align correctly we set the GC's tile origin to be the (x,y) of the window's upper left corner, after which we get the right bits when drawing into the root. because the clip_mask is being set to None, we may call DoChangeGC with fPointer set true, thus we no longer need to install the background or border tile in the resource table. */ static RESTYPE ResType = 0; static int numGCs = 0; static GCPtr screenContext[MAXSCREENS]; /*ARGSUSED*/ static int tossGC (value, id) pointer value; XID id; { GCPtr pGC = (GCPtr)value; screenContext[pGC->pScreen->myNum] = (GCPtr)NULL; FreeGC (pGC, id); numGCs--; if (!numGCs) ResType = 0; return 0; } void miPaintWindow(pWin, prgn, what) register WindowPtr pWin; RegionPtr prgn; int what; { int status; Bool usingScratchGC = FALSE; WindowPtr pRoot; #define FUNCTION 0 #define FOREGROUND 1 #define TILE 2 #define FILLSTYLE 3 #define ABSX 4 #define ABSY 5 #define CLIPMASK 6 #define SUBWINDOW 7 #define COUNT_BITS 8 ChangeGCVal gcval[7]; ChangeGCVal newValues [COUNT_BITS]; BITS32 gcmask, index, mask; RegionRec prgnWin; DDXPointRec oldCorner; BoxRec box; WindowPtr pBgWin; GCPtr pGC; register int i; register BoxPtr pbox; register ScreenPtr pScreen = pWin->drawable.pScreen; register xRectangle *prect; int numRects; gcmask = 0; if (what == PW_BACKGROUND) { switch (pWin->backgroundState) { case None: return; case ParentRelative: (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what); return; case BackgroundPixel: newValues[FOREGROUND].val = pWin->background.pixel; newValues[FILLSTYLE].val = FillSolid; gcmask |= GCForeground | GCFillStyle; break; case BackgroundPixmap: newValues[TILE].ptr = (pointer)pWin->background.pixmap; newValues[FILLSTYLE].val = FillTiled; gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; break; } } else { if (pWin->borderIsPixel) { newValues[FOREGROUND].val = pWin->border.pixel; newValues[FILLSTYLE].val = FillSolid; gcmask |= GCForeground | GCFillStyle; } else { newValues[TILE].ptr = (pointer)pWin->border.pixmap; newValues[FILLSTYLE].val = FillTiled; gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; } } prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * sizeof(xRectangle)); if (!prect) return; newValues[FUNCTION].val = GXcopy; gcmask |= GCFunction | GCClipMask; i = pScreen->myNum; pRoot = WindowTable[i]; pBgWin = pWin; if (what == PW_BORDER) { while (pBgWin->backgroundState == ParentRelative) pBgWin = pBgWin->parent; } if ((pWin->drawable.depth != pRoot->drawable.depth) || (pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel)) { usingScratchGC = TRUE; pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); if (!pGC) { DEALLOCATE_LOCAL(prect); return; } /* * mash the clip list so we can paint the border by * mangling the window in place, pretending it * spans the entire screen */ if (what == PW_BORDER) { prgnWin = pWin->clipList; oldCorner.x = pWin->drawable.x; oldCorner.y = pWin->drawable.y; pWin->drawable.x = pWin->drawable.y = 0; box.x1 = 0; box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; REGION_INIT(pScreen, &pWin->clipList, &box, 1); pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; newValues[ABSX].val = pBgWin->drawable.x; newValues[ABSY].val = pBgWin->drawable.y; } else { newValues[ABSX].val = 0; newValues[ABSY].val = 0; } } else { /* * draw the background to the root window */ if (screenContext[i] == (GCPtr)NULL) { if (!ResType && !(ResType = CreateNewResourceType(tossGC))) return; screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, (XID *)NULL, &status); if (!screenContext[i]) return; numGCs++; if (!AddResource(FakeClientID(0), ResType, (pointer)screenContext[i])) return; } pGC = screenContext[i]; newValues[SUBWINDOW].val = IncludeInferiors; newValues[ABSX].val = pBgWin->drawable.x; newValues[ABSY].val = pBgWin->drawable.y; gcmask |= GCSubwindowMode; pWin = pRoot; } if (pWin->backStorage) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); mask = gcmask; gcmask = 0; i = 0; while (mask) { index = lowbit (mask); mask &= ~index; switch (index) { case GCFunction: if (pGC->alu != newValues[FUNCTION].val) { gcmask |= index; gcval[i++].val = newValues[FUNCTION].val; } break; case GCTileStipXOrigin: if ( pGC->patOrg.x != newValues[ABSX].val) { gcmask |= index; gcval[i++].val = newValues[ABSX].val; } break; case GCTileStipYOrigin: if ( pGC->patOrg.y != newValues[ABSY].val) { gcmask |= index; gcval[i++].val = newValues[ABSY].val; } break; case GCClipMask: if ( pGC->clientClipType != CT_NONE) { gcmask |= index; gcval[i++].val = CT_NONE; } break; case GCSubwindowMode: if ( pGC->subWindowMode != newValues[SUBWINDOW].val) { gcmask |= index; gcval[i++].val = newValues[SUBWINDOW].val; } break; case GCTile: if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) { gcmask |= index; gcval[i++].ptr = newValues[TILE].ptr; } break; case GCFillStyle: if ( pGC->fillStyle != newValues[FILLSTYLE].val) { gcmask |= index; gcval[i++].val = newValues[FILLSTYLE].val; } break; case GCForeground: if ( pGC->fgPixel != newValues[FOREGROUND].val) { gcmask |= index; gcval[i++].val = newValues[FOREGROUND].val; } break; } } if (gcmask) dixChangeGC(NullClient, pGC, gcmask, NULL, gcval); if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC((DrawablePtr)pWin, pGC); numRects = REGION_NUM_RECTS(prgn); pbox = REGION_RECTS(prgn); for (i= numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1 - pWin->drawable.x; prect->y = pbox->y1 - pWin->drawable.y; prect->width = pbox->x2 - pbox->x1; prect->height = pbox->y2 - pbox->y1; } prect -= numRects; (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); DEALLOCATE_LOCAL(prect); if (pWin->backStorage) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); if (usingScratchGC) { if (what == PW_BORDER) { REGION_UNINIT(pScreen, &pWin->clipList); pWin->clipList = prgnWin; pWin->drawable.x = oldCorner.x; pWin->drawable.y = oldCorner.y; pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; } FreeScratchGC(pGC); } } /* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC. Useful when we have a scratch drawable and need to initialize * it. */ miClearDrawable(pDraw, pGC) DrawablePtr pDraw; GCPtr pGC; { XID fg = pGC->fgPixel; XID bg = pGC->bgPixel; xRectangle rect; rect.x = 0; rect.y = 0; rect.width = pDraw->width; rect.height = pDraw->height; DoChangeGC(pGC, GCForeground, &bg, 0); ValidateGC(pDraw, pGC); (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); DoChangeGC(pGC, GCForeground, &fg, 0); ValidateGC(pDraw, pGC); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mibstore.h0100664000076400007640000000337007120677563021320 0ustar constconst/*- * mibstore.h -- * Header file for users of the MI backing-store scheme. * * Copyright (c) 1987 by the Regents of the University of California * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without * fee is hereby granted, provided that the above copyright * notice appear in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. * * "$XConsortium: mibstore.h,v 5.2 93/10/12 11:41:12 dpw Exp $ SPRITE (Berkeley)" */ /* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.2 1997/01/08 20:52:06 dawes Exp $ */ #ifndef _MIBSTORE_H #define _MIBSTORE_H typedef struct _miBSFuncRec { void (*SaveAreas)( #if NeedNestedPrototypes PixmapPtr /*pBackingPixmap*/, RegionPtr /*pObscured*/, int /*x*/, int /*y*/, WindowPtr /*pWin*/ #endif ); void (*RestoreAreas)( #if NeedNestedPrototypes PixmapPtr /*pBackingPixmap*/, RegionPtr /*pExposed*/, int /*x*/, int /*y*/, WindowPtr /*pWin*/ #endif ); void (*SetClipmaskRgn)( #if NeedNestedPrototypes GCPtr /*pBackingGC*/, RegionPtr /*pbackingCompositeClip*/ #endif ); PixmapPtr (*GetImagePixmap)( /* unused */ #if NeedNestedPrototypes void #endif ); PixmapPtr (*GetSpansPixmap)( /* unused */ #if NeedNestedPrototypes void #endif ); } miBSFuncRec; #ifndef _XTYPEDEF_MIBSFUNCPTR typedef struct _miBSFuncRec *miBSFuncPtr; #define _XTYPEDEF_MIBSFUNCPTR #endif extern void miInitializeBackingStore( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, miBSFuncPtr /*funcs*/ #endif ); #endif /* _MIBSTORE_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/cbrt.c0100664000076400007640000000312607120677563020420 0ustar constconst/* $XConsortium: cbrt.c,v 1.2 94/04/17 20:27:10 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.0 1994/04/29 14:11:16 dawes Exp $ */ /* Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* simple cbrt, in case your math library doesn't have a good one */ double pow(); double cbrt(x) double x; { if (x > 0.0) return pow(x, 1.0/3.0); else return -pow(-x, 1.0/3.0); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miglblt.c0100664000076400007640000001744507120677563021131 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miglblt.c,v 5.9 94/04/17 20:27:37 dpw Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" #include "misc.h" #include "fontstruct.h" #include "dixfontstr.h" #include "gcstruct.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmap.h" #include "servermd.h" /* machine-independent glyph blt. assumes that glyph bits in snf are written in bytes, have same bit order as the server's bitmap format, and are byte padded. this corresponds to the snf distributed with the sample server. get a scratch GC. in the scratch GC set alu = GXcopy, fg = 1, bg = 0 allocate a bitmap big enough to hold the largest glyph in the font validate the scratch gc with the bitmap for each glyph carefully put the bits of the glyph in a buffer, padded to the server pixmap scanline padding rules fake a call to PutImage from the buffer into the bitmap use the bitmap in a call to PushPixels */ void miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ unsigned char *pglyphBase; /* start of array of glyphs */ { int width, height; PixmapPtr pPixmap; int nbyLine; /* bytes per line of padded pixmap */ FontPtr pfont; GCPtr pGCtmp; register int i; register int j; unsigned char *pbits; /* buffer for PutImage */ register unsigned char *pb; /* temp pointer into buffer */ register CharInfoPtr pci; /* currect char info */ register unsigned char *pglyph; /* pointer bits in glyph */ int gWidth, gHeight; /* width and height of glyph */ register int nbyGlyphWidth; /* bytes per scanline of glyph */ int nbyPadGlyph; /* server padded line of glyph */ XID gcvals[3]; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pfont = pGC->font; width = FONTMAXBOUNDS(pfont,rightSideBearing) - FONTMINBOUNDS(pfont,leftSideBearing); height = FONTMAXBOUNDS(pfont,ascent) + FONTMAXBOUNDS(pfont,descent); pPixmap = (*pDrawable->pScreen->CreatePixmap)(pDrawable->pScreen, width, height, 1); if (!pPixmap) return; pGCtmp = GetScratchGC(1, pDrawable->pScreen); if (!pGCtmp) { (*pDrawable->pScreen->DestroyPixmap)(pPixmap); return; } gcvals[0] = GXcopy; gcvals[1] = 1; gcvals[2] = 0; DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); nbyLine = BitmapBytePad(width); pbits = (unsigned char *)ALLOCATE_LOCAL(height*nbyLine); if (!pbits) { (*pDrawable->pScreen->DestroyPixmap)(pPixmap); FreeScratchGC(pGCtmp); return; } while(nglyph--) { pci = *ppci++; pglyph = FONTGLYPHBITS(pglyphBase, pci); gWidth = GLYPHWIDTHPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci); if (gWidth && gHeight) { nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci); nbyPadGlyph = BitmapBytePad(gWidth); if (nbyGlyphWidth == nbyPadGlyph #if GLYPHPADBYTES != 4 && (((int) pglyph) & 3) == 0 #endif ) { pb = pglyph; } else { for (i=0, pb = pbits; iserialNumber) != (pPixmap->drawable.serialNumber)) ValidateGC((DrawablePtr)pPixmap, pGCtmp); (*pGCtmp->ops->PutImage)((DrawablePtr)pPixmap, pGCtmp, pPixmap->drawable.depth, 0, 0, gWidth, gHeight, 0, XYBitmap, (char *)pb); if ((pGC->serialNumber) != (pDrawable->serialNumber)) ValidateGC(pDrawable, pGC); (*pGC->ops->PushPixels)(pGC, pPixmap, pDrawable, gWidth, gHeight, x + pci->metrics.leftSideBearing, y - pci->metrics.ascent); } x += pci->metrics.characterWidth; } (*pDrawable->pScreen->DestroyPixmap)(pPixmap); DEALLOCATE_LOCAL(pbits); FreeScratchGC(pGCtmp); } void miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GC *pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ unsigned char *pglyphBase; /* start of array of glyphs */ { ExtentInfoRec info; /* used by QueryGlyphExtents() */ XID gcvals[3]; int oldAlu, oldFS; unsigned long oldFG; xRectangle backrect; QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); if (info.overallWidth >= 0) { backrect.x = x; backrect.width = info.overallWidth; } else { backrect.x = x + info.overallWidth; backrect.width = -info.overallWidth; } backrect.y = y - FONTASCENT(pGC->font); backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); oldAlu = pGC->alu; oldFG = pGC->fgPixel; oldFS = pGC->fillStyle; /* fill in the background */ gcvals[0] = GXcopy; gcvals[1] = pGC->bgPixel; gcvals[2] = FillSolid; DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &backrect); /* put down the glyphs */ gcvals[0] = oldFG; DoChangeGC(pGC, GCForeground, gcvals, 0); ValidateGC(pDrawable, pGC); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, (char *)pglyphBase); /* put all the toys away when done playing */ gcvals[0] = oldAlu; gcvals[1] = oldFG; gcvals[2] = oldFS; DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miclipn.c0100664000076400007640000000444207120677563021123 0ustar constconst/* $XConsortium: miclipn.c,v 5.1 94/04/17 20:27:26 rws Exp $ */ /* Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #include "windowstr.h" #include "scrnintstr.h" static void (*clipNotify)() = 0; static void (*ClipNotifies[MAXSCREENS])(); static void miClipNotifyWrapper(pWin, dx, dy) WindowPtr pWin; int dx, dy; { if (clipNotify) (*clipNotify)(pWin, dx, dy); if (ClipNotifies[pWin->drawable.pScreen->myNum]) (*ClipNotifies[pWin->drawable.pScreen->myNum])(pWin, dx, dy); } /* * miClipNotify -- * Hook to let DDX request notification when the clipList of * a window is recomputed on any screen. For R4 compatibility; * better if you wrap the ClipNotify screen proc yourself. */ static unsigned long clipGeneration = 0; void miClipNotify (func) void (*func)(); { int i; clipNotify = func; if (clipGeneration != serverGeneration) { clipGeneration = serverGeneration; for (i = 0; i < screenInfo.numScreens; i++) { ClipNotifies[i] = screenInfo.screens[i]->ClipNotify; screenInfo.screens[i]->ClipNotify = miClipNotifyWrapper; } } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolypnt.c0100664000076400007640000000744107120677563021525 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolypnt.c,v 5.2 94/04/17 20:27:44 dpw Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" void miPolyPoint(pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { int xorg; int yorg; int nptTmp; XID fsOld, fsNew; int *pwidthInit, *pwidth; int i; register xPoint *ppt; /* make pointlist origin relative */ if (mode == CoordModePrevious) { ppt = pptInit; nptTmp = npt; nptTmp--; while(nptTmp--) { ppt++; ppt->x += (ppt-1)->x; ppt->y += (ppt-1)->y; } } if(pGC->miTranslate) { ppt = pptInit; nptTmp = npt; xorg = pDrawable->x; yorg = pDrawable->y; while(nptTmp--) { ppt->x += xorg; ppt++->y += yorg; } } fsOld = pGC->fillStyle; fsNew = FillSolid; if(pGC->fillStyle != FillSolid) { DoChangeGC(pGC, GCFillStyle, &fsNew, 0); ValidateGC(pDrawable, pGC); } if(!(pwidthInit = (int *)ALLOCATE_LOCAL(npt * sizeof(int)))) return; pwidth = pwidthInit; for(i = 0; i < npt; i++) *pwidth++ = 1; (*pGC->ops->FillSpans)(pDrawable, pGC, npt, pptInit, pwidthInit, FALSE); if(fsOld != FillSolid) { DoChangeGC(pGC, GCFillStyle, &fsOld, 0); ValidateGC(pDrawable, pGC); } DEALLOCATE_LOCAL(pwidthInit); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miwindow.c0100664000076400007640000007500207120677563021325 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miwindow.c,v 5.16 94/04/17 20:28:03 dpw Exp $ */ #include "X.h" #include "miscstruct.h" #include "region.h" #include "mi.h" #include "windowstr.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "mivalidate.h" void miClearToBackground(pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x,y; int w,h; Bool generateExposures; { BoxRec box; RegionRec reg; RegionPtr pBSReg = NullRegion; ScreenPtr pScreen; BoxPtr extents; int x1, y1, x2, y2; /* compute everything using ints to avoid overflow */ x1 = pWin->drawable.x + x; y1 = pWin->drawable.y + y; if (w) x2 = x1 + (int) w; else x2 = x1 + (int) pWin->drawable.width - (int) x; if (h) y2 = y1 + h; else y2 = y1 + (int) pWin->drawable.height - (int) y; extents = &pWin->clipList.extents; /* clip the resulting rectangle to the window clipList extents. This * makes sure that the result will fit in a box, given that the * screen is < 32768 on a side. */ if (x1 < extents->x1) x1 = extents->x1; if (x2 > extents->x2) x2 = extents->x2; if (y1 < extents->y1) y1 = extents->y1; if (y2 > extents->y2) y2 = extents->y2; if (x2 <= x1 || y2 <= y1) { x2 = x1 = 0; y2 = y1 = 0; } box.x1 = x1; box.x2 = x2; box.y1 = y1; box.y2 = y2; pScreen = pWin->drawable.pScreen; REGION_INIT(pScreen, ®, &box, 1); if (pWin->backStorage) { /* * If the window has backing-store on, call through the * ClearToBackground vector to handle the special semantics * (i.e. things backing store is to be cleared out and * an Expose event is to be generated for those areas in backing * store if generateExposures is TRUE). */ pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, generateExposures); } REGION_INTERSECT(pScreen, ®, ®, &pWin->clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); REGION_UNINIT(pScreen, ®); if (pBSReg) REGION_DESTROY(pScreen, pBSReg); } /* * For SaveUnders using backing-store. The idea is that when a window is mapped * with saveUnder set TRUE, any windows it obscures will have its backing * store turned on setting the DIXsaveUnder bit, * The backing-store code must be written to allow for this */ /*- *----------------------------------------------------------------------- * miCheckSubSaveUnder -- * Check all the inferiors of a window for coverage by saveUnder * windows. Called from ChangeSaveUnder and CheckSaveUnder. * This code is very inefficient. * * Results: * TRUE if any windows need to have backing-store removed. * * Side Effects: * Windows may have backing-store turned on or off. * *----------------------------------------------------------------------- */ static Bool miCheckSubSaveUnder(pParent, pFirst, pRegion) register WindowPtr pParent; /* Parent to check */ WindowPtr pFirst; /* first reconfigured window */ RegionPtr pRegion; /* Initial area obscured by saveUnder */ { register WindowPtr pChild; /* Current child */ register ScreenPtr pScreen; /* Screen to use */ RegionRec SubRegion; /* Area of children obscured */ Bool res = FALSE; /* result */ Bool subInited=FALSE;/* SubRegion initialized */ pScreen = pParent->drawable.pScreen; if ( (pChild = pParent->firstChild) ) { /* * build region above first changed window */ for (; pChild != pFirst; pChild = pChild->nextSib) if (pChild->viewable && pChild->saveUnder) REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize); /* * check region below and including first changed window */ for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * don't save under nephew/niece windows; * use a separate region */ if (pChild->firstChild) { if (!subInited) { REGION_INIT(pScreen, &SubRegion, NullBox, 0); subInited = TRUE; } REGION_COPY(pScreen, &SubRegion, pRegion); res |= miCheckSubSaveUnder(pChild, pChild->firstChild, &SubRegion); } else { res |= miCheckSubSaveUnder(pChild, pChild->firstChild, pRegion); } if (pChild->saveUnder) REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize); } } if (subInited) REGION_UNINIT(pScreen, &SubRegion); } /* * Check the state of this window. DIX save unders are * enabled for viewable windows with some client expressing * exposure interest and which intersect the save under region */ if (pParent->viewable && ((pParent->eventMask | wOtherEventMasks(pParent)) & ExposureMask) && REGION_NOTEMPTY(pScreen, &pParent->borderSize) && RECT_IN_REGION(pScreen, pRegion, REGION_EXTENTS(pScreen, &pParent->borderSize)) != rgnOUT) { if (!pParent->DIXsaveUnder) { pParent->DIXsaveUnder = TRUE; (*pScreen->ChangeWindowAttributes) (pParent, CWBackingStore); } } else { if (pParent->DIXsaveUnder) { res = TRUE; pParent->DIXsaveUnder = FALSE; } } return res; } /*- *----------------------------------------------------------------------- * miChangeSaveUnder -- * Change the save-under state of a tree of windows. Called when * a window with saveUnder TRUE is mapped/unmapped/reconfigured. * * Results: * TRUE if any windows need to have backing-store removed (which * means that PostChangeSaveUnder needs to be called later to * finish the job). * * Side Effects: * Windows may have backing-store turned on or off. * *----------------------------------------------------------------------- */ Bool miChangeSaveUnder(pWin, first) register WindowPtr pWin; WindowPtr first; /* First window to check. * Used when pWin was restacked */ { RegionRec rgn; /* Area obscured by saveUnder windows */ register ScreenPtr pScreen; Bool res; if (!deltaSaveUndersViewable && !numSaveUndersViewable) return FALSE; numSaveUndersViewable += deltaSaveUndersViewable; deltaSaveUndersViewable = 0; pScreen = pWin->drawable.pScreen; REGION_INIT(pScreen, &rgn, NullBox, 1); res = miCheckSubSaveUnder (pWin->parent, pWin->saveUnder ? first : pWin->nextSib, &rgn); REGION_UNINIT(pScreen, &rgn); return res; } /*- *----------------------------------------------------------------------- * miPostChangeSaveUnder -- * Actually turn backing-store off for those windows that no longer * need to have it on. * * Results: * None. * * Side Effects: * Backing-store and SAVE_UNDER_CHANGE_BIT are turned off for those * windows affected. * *----------------------------------------------------------------------- */ void miPostChangeSaveUnder(pWin, pFirst) WindowPtr pWin; WindowPtr pFirst; { register WindowPtr pParent, pChild; ChangeWindowAttributesProcPtr ChangeWindowAttributes; if (!(pParent = pWin->parent)) return; ChangeWindowAttributes = pParent->drawable.pScreen->ChangeWindowAttributes; if (!pParent->DIXsaveUnder && (pParent->backingStore == NotUseful) && pParent->backStorage) (*ChangeWindowAttributes)(pParent, CWBackingStore); if (!(pChild = pFirst)) return; while (1) { if (!pChild->DIXsaveUnder && (pChild->backingStore == NotUseful) && pChild->backStorage) (*ChangeWindowAttributes)(pChild, CWBackingStore); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } while (!pChild->nextSib) { pChild = pChild->parent; if (pChild == pParent) return; } pChild = pChild->nextSib; } } void miMarkWindow(pWin) register WindowPtr pWin; { register ValidatePtr val; if (pWin->valdata) return; val = (ValidatePtr)xnfalloc(sizeof(ValidateRec)); val->before.oldAbsCorner.x = pWin->drawable.x; val->before.oldAbsCorner.y = pWin->drawable.y; val->before.borderVisible = NullRegion; val->before.resized = FALSE; pWin->valdata = val; } Bool miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) WindowPtr pWin; WindowPtr pFirst; WindowPtr *ppLayerWin; { register BoxPtr box; register WindowPtr pChild, pLast; Bool anyMarked = FALSE; void (* MarkWindow)() = pWin->drawable.pScreen->MarkWindow; ScreenPtr pScreen = pWin->drawable.pScreen; /* single layered systems are easy */ if (ppLayerWin) *ppLayerWin = pWin; if (pWin == pFirst) { /* Blindly mark pWin and all of its inferiors. This is a slight * overkill if there are mapped windows that outside pWin's border, * but it's better than wasting time on RectIn checks. */ pChild = pWin; while (1) { if (pChild->viewable) { (* MarkWindow)(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } anyMarked = TRUE; pFirst = pFirst->nextSib; } if ( (pChild = pFirst) ) { box = REGION_EXTENTS(pChild->drawable.pScreen, &pWin->borderSize); pLast = pChild->parent->lastChild; while (1) { if (pChild->viewable && RECT_IN_REGION(pScreen, &pChild->borderSize, box)) { (* MarkWindow)(pChild); anyMarked = TRUE; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pLast)) pChild = pChild->parent; if (pChild == pLast) break; pChild = pChild->nextSib; } } if (anyMarked) (* MarkWindow)(pWin->parent); return anyMarked; } /***** * miHandleValidateExposures(pWin) * starting at pWin, draw background in any windows that have exposure * regions, translate the regions, restore any backing store, * and then send any regions still exposed to the client *****/ void miHandleValidateExposures(pWin) WindowPtr pWin; { register WindowPtr pChild; register ValidatePtr val; ScreenPtr pScreen = pWin->drawable.pScreen; void (* WindowExposures)(); pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; while (1) { if ( (val = pChild->valdata) ) { if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed)) (*pChild->drawable.pScreen->PaintWindowBorder)(pChild, &val->after.borderExposed, PW_BORDER); REGION_UNINIT(pScreen, &val->after.borderExposed); (*WindowExposures)(pChild, &val->after.exposed, NullRegion); REGION_UNINIT(pScreen, &val->after.exposed); xfree(val); pChild->valdata = (ValidatePtr)NULL; if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pWin)) pChild = pChild->parent; if (pChild == pWin) break; pChild = pChild->nextSib; } } void miMoveWindow(pWin, x, y, pNextSib, kind) register WindowPtr pWin; int x,y; WindowPtr pNextSib; VTKind kind; { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); short bw; RegionPtr oldRegion; DDXPointRec oldpt; Bool anyMarked; register ScreenPtr pScreen; WindowPtr windowToValidate; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return ; pScreen = pWin->drawable.pScreen; bw = wBorderWidth (pWin); oldpt.x = pWin->drawable.x; oldpt.y = pWin->drawable.y; if (WasViewable) { oldRegion = REGION_CREATE(pScreen, NullBox, 1); REGION_COPY(pScreen, oldRegion, &pWin->borderClip); anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); } pWin->origin.x = x + (int)bw; pWin->origin.y = y + (int)bw; x = pWin->drawable.x = pParent->drawable.x + x + (int)bw; y = pWin->drawable.y = pParent->drawable.y + y + (int)bw; SetWinSize (pWin); SetBorderSize (pWin); (*pScreen->PositionWindow)(pWin, x, y); windowToValidate = MoveWindowInStack(pWin, pNextSib); ResizeChildrenWinSize(pWin, x - oldpt.x, y - oldpt.y, 0, 0); if (WasViewable) { if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, (WindowPtr *)NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, windowToValidate); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, kind); (* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, oldRegion); REGION_DESTROY(pScreen, oldRegion); /* XXX need to retile border if ParentRelative origin */ (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, windowToValidate); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, kind); } if (pWin->realized) WindowsRestructured (); } /* * pValid is a region of the screen which has been * successfully copied -- recomputed exposed regions for affected windows */ static int miRecomputeExposures (pWin, value) register WindowPtr pWin; pointer value; /* must conform to VisitWindowProcPtr */ { register ScreenPtr pScreen; RegionPtr pValid = (RegionPtr)value; if (pWin->valdata) { pScreen = pWin->drawable.pScreen; /* * compute exposed regions of this window */ REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed, &pWin->clipList, pValid); /* * compute exposed regions of the border */ REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed, &pWin->borderClip, &pWin->winSize); REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed, &pWin->valdata->after.borderExposed, pValid); return WT_WALKCHILDREN; } return WT_NOMATCH; } void miSlideAndSizeWindow(pWin, x, y, w, h, pSib) register WindowPtr pWin; int x,y; unsigned int w, h; WindowPtr pSib; { WindowPtr pParent; Bool WasViewable = (Bool)(pWin->viewable); unsigned short width = pWin->drawable.width, height = pWin->drawable.height; short oldx = pWin->drawable.x, oldy = pWin->drawable.y; int bw = wBorderWidth (pWin); short dw, dh; DDXPointRec oldpt; RegionPtr oldRegion; Bool anyMarked; register ScreenPtr pScreen; WindowPtr pFirstChange; register WindowPtr pChild; RegionPtr gravitate[StaticGravity + 1]; register unsigned g; int nx, ny; /* destination x,y */ int newx, newy; /* new inner window position */ RegionPtr pRegion; RegionPtr destClip; /* portions of destination already written */ RegionPtr oldWinClip; /* old clip list for window */ RegionPtr borderVisible = NullRegion; /* visible area of the border */ RegionPtr bsExposed = NullRegion; /* backing store exposures */ Bool shrunk = FALSE; /* shrunk in an inner dimension */ Bool moved = FALSE; /* window position changed */ #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; /* if this is a root window, can't be resized */ if (!(pParent = pWin->parent)) return ; pScreen = pWin->drawable.pScreen; newx = pParent->drawable.x + x + bw; newy = pParent->drawable.y + y + bw; if (WasViewable) { anyMarked = FALSE; /* * save the visible region of the window */ oldRegion = REGION_CREATE(pScreen, NullBox, 1); REGION_COPY(pScreen, oldRegion, &pWin->winSize); /* * categorize child windows into regions to be moved */ for (g = 0; g <= StaticGravity; g++) gravitate[g] = (RegionPtr) NULL; for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { g = pChild->winGravity; if (g != UnmapGravity) { if (!gravitate[g]) gravitate[g] = REGION_CREATE(pScreen, NullBox, 1); REGION_UNION(pScreen, gravitate[g], gravitate[g], &pChild->borderClip); } else { UnmapWindow(pChild, TRUE); anyMarked = TRUE; } } anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); oldWinClip = NULL; if (pWin->bitGravity != ForgetGravity) { oldWinClip = REGION_CREATE(pScreen, NullBox, 1); REGION_COPY(pScreen, oldWinClip, &pWin->clipList); } /* * if the window is changing size, borderExposed * can't be computed correctly without some help. */ if (pWin->drawable.height > h || pWin->drawable.width > w) shrunk = TRUE; if (newx != oldx || newy != oldy) moved = TRUE; if ((pWin->drawable.height != h || pWin->drawable.width != w) && HasBorder (pWin)) { borderVisible = REGION_CREATE(pScreen, NullBox, 1); /* for tiled borders, we punt and draw the whole thing */ if (pWin->borderIsPixel || !moved) { if (shrunk || moved) REGION_SUBTRACT(pScreen, borderVisible, &pWin->borderClip, &pWin->winSize); else REGION_COPY(pScreen, borderVisible, &pWin->borderClip); } } } pWin->origin.x = x + bw; pWin->origin.y = y + bw; pWin->drawable.height = h; pWin->drawable.width = w; x = pWin->drawable.x = newx; y = pWin->drawable.y = newy; SetWinSize (pWin); SetBorderSize (pWin); dw = (int)w - (int)width; dh = (int)h - (int)height; ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh); /* let the hardware adjust background and border pixmaps, if any */ (*pScreen->PositionWindow)(pWin, x, y); pFirstChange = MoveWindowInStack(pWin, pSib); if (WasViewable) { pRegion = REGION_CREATE(pScreen, NullBox, 1); if (pWin->backStorage) REGION_COPY(pScreen, pRegion, &pWin->clipList); if (pLayerWin == pWin) anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, (WindowPtr *)NULL); else anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin, (WindowPtr *)NULL); if (pWin->valdata) { pWin->valdata->before.resized = TRUE; pWin->valdata->before.borderVisible = borderVisible; } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, VTOther); /* * the entire window is trashed unless bitGravity * recovers portions of it */ REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList); } GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny); if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pRegion = &pWin->clipList; /* a convenient empty region */ if (pWin->bitGravity == ForgetGravity) bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, NullRegion, oldx, oldy); else { bsExposed = (*pScreen->TranslateBackingStore) (pWin, nx - x, ny - y, pRegion, oldx, oldy); } } if (WasViewable) { /* avoid the border */ if (HasBorder (pWin)) { int offx, offy, dx, dy; /* kruft to avoid double translates for each gravity */ offx = 0; offy = 0; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; /* align winSize to gravitate[g]. * winSize is in new coordinates, * gravitate[g] is still in old coordinates */ GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); dx = (oldx - nx) - offx; dy = (oldy - ny) - offy; if (dx || dy) { REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy); offx += dx; offy += dy; } REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], &pWin->winSize); } /* get winSize back where it belongs */ if (offx || offy) REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy); } /* * add screen bits to the appropriate bucket */ if (oldWinClip) { /* * clip to new clipList */ REGION_COPY(pScreen, pRegion, oldWinClip); REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy); REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList); /* * don't step on any gravity bits which will be copied after this * region. Note -- this assumes that the regions will be copied * in gravity order. */ for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) { if (gravitate[g]) REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip, gravitate[g]); } REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny); g = pWin->bitGravity; if (!gravitate[g]) gravitate[g] = oldWinClip; else { REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip); REGION_DESTROY(pScreen, oldWinClip); } } /* * move the bits on the screen */ destClip = NULL; for (g = 0; g <= StaticGravity; g++) { if (!gravitate[g]) continue; GravityTranslate (x, y, oldx, oldy, dw, dh, g, &nx, &ny); oldpt.x = oldx + (x - nx); oldpt.y = oldy + (y - ny); /* Note that gravitate[g] is *translated* by CopyWindow */ /* only copy the remaining useful bits */ REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], oldRegion); /* clip to not overwrite already copied areas */ if (destClip) { REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y); REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip); REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y); } /* and move those bits */ if (oldpt.x != x || oldpt.y != y) (*pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, gravitate[g]); /* remove any overwritten bits from the remaining useful bits */ REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]); /* * recompute exposed regions of child windows */ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->winGravity != g) continue; REGION_INTERSECT(pScreen, pRegion, &pChild->borderClip, gravitate[g]); TraverseTree (pChild, miRecomputeExposures, (pointer)pRegion); } /* * remove the successfully copied regions of the * window from its exposed region */ if (g == pWin->bitGravity) REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed, &pWin->valdata->after.exposed, gravitate[g]); if (!destClip) destClip = gravitate[g]; else { REGION_UNION(pScreen, destClip, destClip, gravitate[g]); REGION_DESTROY(pScreen, gravitate[g]); } } REGION_DESTROY(pScreen, oldRegion); REGION_DESTROY(pScreen, pRegion); if (destClip) REGION_DESTROY(pScreen, destClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) REGION_EMPTY(pScreen, valExposed); REGION_DESTROY(pScreen, bsExposed); } if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) { (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange); } #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, VTOther); } else if (bsExposed) { (*pScreen->WindowExposures) (pWin, NullRegion, bsExposed); REGION_DESTROY(pScreen, bsExposed); } if (pWin->realized) WindowsRestructured (); } WindowPtr miGetLayerWindow(pWin) WindowPtr pWin; { return pWin->firstChild; } #ifdef SHAPE /****** * * miSetShape * The border/window shape has changed. Recompute winSize/borderSize * and send appropriate exposure events */ void miSetShape(pWin) register WindowPtr pWin; { Bool WasViewable = (Bool)(pWin->viewable); register ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked; WindowPtr pParent = pWin->parent; RegionPtr pOldClip, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; if (WasViewable) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); if (pWin->valdata) { if (HasBorder (pWin)) { RegionPtr borderVisible; borderVisible = REGION_CREATE(pScreen, NullBox, 1); REGION_SUBTRACT(pScreen, borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } pWin->valdata->before.resized = TRUE; } } SetWinSize (pWin); SetBorderSize (pWin); ResizeChildrenWinSize(pWin, 0, 0, 0, 0); if (WasViewable) { if (pWin->backStorage) { pOldClip = REGION_CREATE(pScreen, NullBox, 1); REGION_COPY(pScreen, pOldClip, &pWin->clipList); } anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin, (WindowPtr *)NULL); #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->backStorage && ((pWin->backingStore == Always) || WasViewable)) { if (!WasViewable) pOldClip = &pWin->clipList; /* a convenient empty region */ bsExposed = (*pScreen->TranslateBackingStore) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); if (WasViewable) REGION_DESTROY(pScreen, pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; if (pWin->valdata) valExposed = &pWin->valdata->after.exposed; (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); if (valExposed) REGION_EMPTY(pScreen, valExposed); REGION_DESTROY(pScreen, bsExposed); } } if (WasViewable) { if (anyMarked) (*pScreen->HandleExposures)(pLayerWin->parent); #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther); } if (pWin->realized) WindowsRestructured (); CheckCursorConfinement(pWin); } #endif /* Keeps the same inside(!) origin */ void miChangeBorderWidth(pWin, width) register WindowPtr pWin; unsigned int width; { WindowPtr pParent; int oldwidth; Bool anyMarked; register ScreenPtr pScreen; Bool WasViewable = (Bool)(pWin->viewable); Bool HadBorder; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif WindowPtr pLayerWin; oldwidth = wBorderWidth (pWin); if (oldwidth == width) return; HadBorder = HasBorder(pWin); pScreen = pWin->drawable.pScreen; pParent = pWin->parent; if (WasViewable && width < oldwidth) anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); pWin->borderWidth = width; SetBorderSize (pWin); if (WasViewable) { if (width > oldwidth) { anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin); /* * save the old border visible region to correctly compute * borderExposed. */ if (pWin->valdata && HadBorder) { RegionPtr borderVisible; borderVisible = REGION_CREATE(pScreen, NULL, 1); REGION_SUBTRACT(pScreen, borderVisible, &pWin->borderClip, &pWin->winSize); pWin->valdata->before.borderVisible = borderVisible; } } #ifdef DO_SAVE_UNDERS if (DO_SAVE_UNDERS(pWin)) { dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib); } #endif /* DO_SAVE_UNDERS */ if (anyMarked) { (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther); (*pScreen->HandleExposures)(pLayerWin->parent); } #ifdef DO_SAVE_UNDERS if (dosave) (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib); #endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTOther); } if (pWin->realized) WindowsRestructured (); } void miMarkUnrealizedWindow(pChild, pWin, fromConfigure) WindowPtr pChild; WindowPtr pWin; Bool fromConfigure; { if ((pChild != pWin) || fromConfigure) { REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList); if (pChild->drawable.pScreen->ClipNotify) (* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0); REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip); } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mizerline.c0100664000076400007640000006566107120677563021500 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mizerline.c,v 5.9 94/08/02 15:01:29 dpw Exp $ */ #include "X.h" #include "misc.h" #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "mi.h" #include "miline.h" /* The bresenham error equation used in the mi/mfb/cfb line routines is: e = error dx = difference in raw X coordinates dy = difference in raw Y coordinates M = # of steps in X direction N = # of steps in Y direction B = 0 to prefer diagonal steps in a given octant, 1 to prefer axial steps in a given octant For X major lines: e = 2Mdy - 2Ndx - dx - B -2dx <= e < 0 For Y major lines: e = 2Ndx - 2Mdy - dy - B -2dy <= e < 0 At the start of the line, we have taken 0 X steps and 0 Y steps, so M = 0 and N = 0: X major e = 2Mdy - 2Ndx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = -dy - B At the end of the line, we have taken dx X steps and dy Y steps, so M = dx and N = dy: X major e = 2Mdy - 2Ndx - dx - B = 2dxdy - 2dydx - dx - B = -dx - B Y major e = 2Ndx - 2Mdy - dy - B = 2dydx - 2dxdy - dy - B = -dy - B Thus, the error term is the same at the start and end of the line. Let us consider clipping an X coordinate. There are 4 cases which represent the two independent cases of clipping the start vs. the end of the line and an X major vs. a Y major line. In any of these cases, we know the number of X steps (M) and we wish to find the number of Y steps (N). Thus, we will solve our error term equation. If we are clipping the start of the line, we will find the smallest N that satisfies our error term inequality. If we are clipping the end of the line, we will find the largest number of Y steps that satisfies the inequality. In that case, since we are representing the Y steps as (dy - N), we will actually want to solve for the smallest N in that equation. Case 1: X major, starting X coordinate moved by M steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Ndx <= 2Mdy - dx - B + 2dx 2Ndx > 2Mdy - dx - B 2Ndx <= 2Mdy + dx - B N > (2Mdy - dx - B) / 2dx N <= (2Mdy + dx - B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the > inequality to find the smallest: N = floor((2Mdy - dx - B) / 2dx) + 1 = floor((2Mdy - dx - B + 2dx) / 2dx) = floor((2Mdy + dx - B) / 2dx) Case 1b: X major, ending X coordinate moved to M steps Same derivations as Case 1, but we want the largest N that satisfies the equations, so we use the <= inequality: N = floor((2Mdy + dx - B) / 2dx) Case 2: X major, ending X coordinate moved by M steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Ndx >= 2Mdy + dx + B - 2dx 2Ndx < 2Mdy + dx + B 2Ndx >= 2Mdy - dx + B N < (2Mdy + dx + B) / 2dx N >= (2Mdy - dx + B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dx + B) / 2dx) = floor((2Mdy - dx + B + 2dx - 1) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 2b: X major, starting X coordinate moved to M steps from end Same derivations as Case 2, but we want the smallest number of Y steps, so we want the highest N, so we use the < inequality: N = ceiling((2Mdy + dx + B) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dx + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dx + B - 1) / 2dx) Case 3: Y major, starting X coordinate moved by M steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Ndx >= 2Mdy + dy + B - 2dy 2Ndx < 2Mdy + dy + B 2Ndx >= 2Mdy - dy + B N < (2Mdy + dy + B) / 2dx N >= (2Mdy - dy + B) / 2dx Since we are trying to find the smallest N that satisfies these equations, we should use the >= inequality to find the smallest: N = ceiling((2Mdy - dy + B) / 2dx) = floor((2Mdy - dy + B + 2dx - 1) / 2dx) = floor((2Mdy - dy + B - 1) / 2dx) + 1 Case 3b: Y major, ending X coordinate moved to M steps Same derivations as Case 3, but we want the largest N that satisfies the equations, so we use the < inequality: N = ceiling((2Mdy + dy + B) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1) / 2dx) - 1 = floor((2Mdy + dy + B + 2dx - 1 - 2dx) / 2dx) = floor((2Mdy + dy + B - 1) / 2dx) Case 4: Y major, ending X coordinate moved by M steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Ndx <= 2Mdy - dy - B + 2dy 2Ndx > 2Mdy - dy - B 2Ndx <= 2Mdy + dy - B N > (2Mdy - dy - B) / 2dx N <= (2Mdy + dy - B) / 2dx Since we are trying to find the highest number of Y steps that satisfies these equations, we need to find the smallest N, so we should use the > inequality to find the smallest: N = floor((2Mdy - dy - B) / 2dx) + 1 Case 4b: Y major, starting X coordinate moved to M steps from end Same analysis as Case 4, but we want the smallest number of Y steps which means the largest N, so we use the <= inequality: N = floor((2Mdy + dy - B) / 2dx) Now let's try the Y coordinates, we have the same 4 cases. Case 5: X major, starting Y coordinate moved by N steps -2dx <= 2Mdy - 2Ndx - dx - B < 0 2Mdy >= 2Ndx + dx + B - 2dx 2Mdy < 2Ndx + dx + B 2Mdy >= 2Ndx - dx + B M < (2Ndx + dx + B) / 2dy M >= (2Ndx - dx + B) / 2dy Since we are trying to find the smallest M, we use the >= inequality: M = ceiling((2Ndx - dx + B) / 2dy) = floor((2Ndx - dx + B + 2dy - 1) / 2dy) = floor((2Ndx - dx + B - 1) / 2dy) + 1 Case 5b: X major, ending Y coordinate moved to N steps Same derivations as Case 5, but we want the largest M that satisfies the equations, so we use the < inequality: M = ceiling((2Ndx + dx + B) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dx + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dx + B - 1) / 2dy) Case 6: X major, ending Y coordinate moved by N steps -2dx <= 2(dx - M)dy - 2(dy - N)dx - dx - B < 0 -2dx <= 2dxdy - 2Mdy - 2dxdy + 2Ndx - dx - B < 0 -2dx <= 2Ndx - 2Mdy - dx - B < 0 2Mdy <= 2Ndx - dx - B + 2dx 2Mdy > 2Ndx - dx - B 2Mdy <= 2Ndx + dx - B M > (2Ndx - dx - B) / 2dy M <= (2Ndx + dx - B) / 2dy Largest # of X steps means smallest M, so use the > inequality: M = floor((2Ndx - dx - B) / 2dy) + 1 Case 6b: X major, starting Y coordinate moved to N steps from end Same derivations as Case 6, but we want the smallest # of X steps which means the largest M, so use the <= inequality: M = floor((2Ndx + dx - B) / 2dy) Case 7: Y major, starting Y coordinate moved by N steps -2dy <= 2Ndx - 2Mdy - dy - B < 0 2Mdy <= 2Ndx - dy - B + 2dy 2Mdy > 2Ndx - dy - B 2Mdy <= 2Ndx + dy - B M > (2Ndx - dy - B) / 2dy M <= (2Ndx + dy - B) / 2dy To find the smallest M, use the > inequality: M = floor((2Ndx - dy - B) / 2dy) + 1 = floor((2Ndx - dy - B + 2dy) / 2dy) = floor((2Ndx + dy - B) / 2dy) Case 7b: Y major, ending Y coordinate moved to N steps Same derivations as Case 7, but we want the largest M that satisfies the equations, so use the <= inequality: M = floor((2Ndx + dy - B) / 2dy) Case 8: Y major, ending Y coordinate moved by N steps -2dy <= 2(dy - N)dx - 2(dx - M)dy - dy - B < 0 -2dy <= 2dxdy - 2Ndx - 2dxdy + 2Mdy - dy - B < 0 -2dy <= 2Mdy - 2Ndx - dy - B < 0 2Mdy >= 2Ndx + dy + B - 2dy 2Mdy < 2Ndx + dy + B 2Mdy >= 2Ndx - dy + B M < (2Ndx + dy + B) / 2dy M >= (2Ndx - dy + B) / 2dy To find the highest X steps, find the smallest M, use the >= inequality: M = ceiling((2Ndx - dy + B) / 2dy) = floor((2Ndx - dy + B + 2dy - 1) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) Case 8b: Y major, starting Y coordinate moved to N steps from the end Same derivations as Case 8, but we want to find the smallest # of X steps which means the largest M, so we use the < inequality: M = ceiling((2Ndx + dy + B) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1) / 2dy) - 1 = floor((2Ndx + dy + B + 2dy - 1 - 2dy) / 2dy) = floor((2Ndx + dy + B - 1) / 2dy) So, our equations are: 1: X major move x1 to x1+M floor((2Mdy + dx - B) / 2dx) 1b: X major move x2 to x1+M floor((2Mdy + dx - B) / 2dx) 2: X major move x2 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 2b: X major move x1 to x2-M floor((2Mdy + dx + B - 1) / 2dx) 3: Y major move x1 to x1+M floor((2Mdy - dy + B - 1) / 2dx) + 1 3b: Y major move x2 to x1+M floor((2Mdy + dy + B - 1) / 2dx) 4: Y major move x2 to x2-M floor((2Mdy - dy - B) / 2dx) + 1 4b: Y major move x1 to x2-M floor((2Mdy + dy - B) / 2dx) 5: X major move y1 to y1+N floor((2Ndx - dx + B - 1) / 2dy) + 1 5b: X major move y2 to y1+N floor((2Ndx + dx + B - 1) / 2dy) 6: X major move y2 to y2-N floor((2Ndx - dx - B) / 2dy) + 1 6b: X major move y1 to y2-N floor((2Ndx + dx - B) / 2dy) 7: Y major move y1 to y1+N floor((2Ndx + dy - B) / 2dy) 7b: Y major move y2 to y1+N floor((2Ndx + dy - B) / 2dy) 8: Y major move y2 to y2-N floor((2Ndx + dy + B - 1) / 2dy) 8b: Y major move y1 to y2-N floor((2Ndx + dy + B - 1) / 2dy) We have the following constraints on all of the above terms: 0 < M,N <= 2^15 2^15 can be imposed by miZeroClipLine 0 <= dx/dy <= 2^16 - 1 0 <= B <= 1 The floor in all of the above equations can be accomplished with a simple C divide operation provided that both numerator and denominator are positive. Since dx,dy >= 0 and since moving an X coordinate implies that dx != 0 and moving a Y coordinate implies dy != 0, we know that the denominators are all > 0. For all lines, (-B) and (B-1) are both either 0 or -1, depending on the bias. Thus, we have to show that the 2MNdxy +/- dxy terms are all >= 1 or > 0 to prove that the numerators are positive (or zero). For X Major lines we know that dx > 0 and since 2Mdy is >= 0 due to the constraints, the first four equations all have numerators >= 0. For the second four equations, M > 0, so 2Mdy >= 2dy so (2Mdy - dy) >= dy So (2Mdy - dy) > 0, since they are Y major lines. Also, (2Mdy + dy) >= 3dy or (2Mdy + dy) > 0. So all of their numerators are >= 0. For the third set of four equations, N > 0, so 2Ndx >= 2dx so (2Ndx - dx) >= dx > 0. Similarly (2Ndx + dx) >= 3dx > 0. So all numerators >= 0. For the fourth set of equations, dy > 0 and 2Ndx >= 0, so all numerators are > 0. To consider overflow, consider the case of 2 * M,N * dx,dy + dx,dy. This is bounded <= 2 * 2^15 * (2^16 - 1) + (2^16 - 1) <= 2^16 * (2^16 - 1) + (2^16 - 1) <= 2^32 - 2^16 + 2^16 - 1 <= 2^32 - 1 Since the (-B) and (B-1) terms are all 0 or -1, the maximum value of the numerator is therefore (2^32 - 1), which does not overflow an unsigned 32 bit variable. */ #define MIOUTCODES(outcode, x, y, xmin, ymin, xmax, ymax) \ {\ if (x < xmin) outcode |= OUT_LEFT;\ if (x > xmax) outcode |= OUT_RIGHT;\ if (y < ymin) outcode |= OUT_ABOVE;\ if (y > ymax) outcode |= OUT_BELOW;\ } /* Bit codes for the terms of the 16 clipping equations defined below. */ #define T_2NDX (1 << 0) #define T_2MDY (0) /* implicit term */ #define T_DXNOTY (1 << 1) #define T_DYNOTX (0) /* implicit term */ #define T_SUBDXORY (1 << 2) #define T_ADDDX (T_DXNOTY) /* composite term */ #define T_SUBDX (T_DXNOTY | T_SUBDXORY) /* composite term */ #define T_ADDDY (T_DYNOTX) /* composite term */ #define T_SUBDY (T_DYNOTX | T_SUBDXORY) /* composite term */ #define T_BIASSUBONE (1 << 3) #define T_SUBBIAS (0) /* implicit term */ #define T_DIV2DX (1 << 4) #define T_DIV2DY (0) /* implicit term */ #define T_ADDONE (1 << 5) /* Bit masks defining the 16 equations used in miZeroClipLine. */ #define EQN1 (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN1B (T_2MDY | T_ADDDX | T_SUBBIAS | T_DIV2DX) #define EQN2 (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN2B (T_2MDY | T_ADDDX | T_BIASSUBONE | T_DIV2DX) #define EQN3 (T_2MDY | T_SUBDY | T_BIASSUBONE | T_DIV2DX | T_ADDONE) #define EQN3B (T_2MDY | T_ADDDY | T_BIASSUBONE | T_DIV2DX) #define EQN4 (T_2MDY | T_SUBDY | T_SUBBIAS | T_DIV2DX | T_ADDONE) #define EQN4B (T_2MDY | T_ADDDY | T_SUBBIAS | T_DIV2DX) #define EQN5 (T_2NDX | T_SUBDX | T_BIASSUBONE | T_DIV2DY | T_ADDONE) #define EQN5B (T_2NDX | T_ADDDX | T_BIASSUBONE | T_DIV2DY) #define EQN6 (T_2NDX | T_SUBDX | T_SUBBIAS | T_DIV2DY | T_ADDONE) #define EQN6B (T_2NDX | T_ADDDX | T_SUBBIAS | T_DIV2DY) #define EQN7 (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN7B (T_2NDX | T_ADDDY | T_SUBBIAS | T_DIV2DY) #define EQN8 (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) #define EQN8B (T_2NDX | T_ADDDY | T_BIASSUBONE | T_DIV2DY) /* miZeroClipLine * * returns: 1 for partially clipped line * -1 for completely clipped line * */ int miZeroClipLine(xmin, ymin, xmax, ymax, new_x1, new_y1, new_x2, new_y2, adx, ady, pt1_clipped, pt2_clipped, octant, bias, oc1, oc2) int xmin, ymin, xmax, ymax; int *new_x1, *new_y1, *new_x2, *new_y2; int *pt1_clipped, *pt2_clipped; unsigned int adx, ady; int octant; unsigned int bias; int oc1, oc2; { int swapped = 0; int clipDone = 0; CARD32 utmp; int clip1, clip2; int x1, y1, x2, y2; int x1_orig, y1_orig, x2_orig, y2_orig; int xmajor; int negslope, anchorval; unsigned int eqn; x1 = x1_orig = *new_x1; y1 = y1_orig = *new_y1; x2 = x2_orig = *new_x2; y2 = y2_orig = *new_y2; clip1 = 0; clip2 = 0; xmajor = IsXMajorOctant(octant); bias = ((bias >> octant) & 1); while (1) { if ((oc1 & oc2) != 0) /* trivial reject */ { clipDone = -1; clip1 = oc1; clip2 = oc2; break; } else if ((oc1 | oc2) == 0) /* trivial accept */ { clipDone = 1; if (swapped) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT(clip1, clip2); } break; } else /* have to clip */ { /* only clip one point at a time */ if (oc1 == 0) { SWAPINT_PAIR(x1, y1, x2, y2); SWAPINT_PAIR(x1_orig, y1_orig, x2_orig, y2_orig); SWAPINT(oc1, oc2); SWAPINT(clip1, clip2); swapped = !swapped; } clip1 |= oc1; if (oc1 & OUT_LEFT) { negslope = IsYDecreasingOctant(octant); utmp = xmin - x1_orig; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else /* clip based on far endpt */ { utmp = x2_orig - xmin; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmin; } else if (oc1 & OUT_ABOVE) { negslope = IsXDecreasingOctant(octant); utmp = ymin - y1_orig; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else /* clip based on far endpt */ { utmp = y2_orig - ymin; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymin; } else if (oc1 & OUT_RIGHT) { negslope = IsYDecreasingOctant(octant); utmp = x1_orig - xmax; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN2 : EQN1; else eqn = (swapped) ? EQN4 : EQN3; anchorval = y1_orig; } else /* clip based on far endpt */ { /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * to the right of a clip rectangle. */ utmp = xmax - x2_orig; if (xmajor) eqn = (swapped) ? EQN1B : EQN2B; else eqn = (swapped) ? EQN3B : EQN4B; anchorval = y2_orig; negslope = !negslope; } x1 = xmax; } else if (oc1 & OUT_BELOW) { negslope = IsXDecreasingOctant(octant); utmp = y1_orig - ymax; if (utmp <= 32767) /* clip based on near endpt */ { if (xmajor) eqn = (swapped) ? EQN6 : EQN5; else eqn = (swapped) ? EQN8 : EQN7; anchorval = x1_orig; } else /* clip based on far endpt */ { /* * Technically since the equations can handle * utmp == 32768, this overflow code isn't * needed since X11 protocol can't generate * a line which goes more than 32768 pixels * below the bottom of a clip rectangle. */ utmp = ymax - y2_orig; if (xmajor) eqn = (swapped) ? EQN5B : EQN6B; else eqn = (swapped) ? EQN7B : EQN8B; anchorval = x2_orig; negslope = !negslope; } y1 = ymax; } if (swapped) negslope = !negslope; utmp <<= 1; /* utmp = 2N or 2M */ if (eqn & T_2NDX) utmp = (utmp * adx); else /* (eqn & T_2MDY) */ utmp = (utmp * ady); if (eqn & T_DXNOTY) if (eqn & T_SUBDXORY) utmp -= adx; else utmp += adx; else /* (eqn & T_DYNOTX) */ if (eqn & T_SUBDXORY) utmp -= ady; else utmp += ady; if (eqn & T_BIASSUBONE) utmp += bias - 1; else /* (eqn & T_SUBBIAS) */ utmp -= bias; if (eqn & T_DIV2DX) utmp /= (adx << 1); else /* (eqn & T_DIV2DY) */ utmp /= (ady << 1); if (eqn & T_ADDONE) utmp++; if (negslope) utmp = -utmp; if (eqn & T_2NDX) /* We are calculating X steps */ x1 = anchorval + utmp; else /* else, Y steps */ y1 = anchorval + utmp; oc1 = 0; MIOUTCODES(oc1, x1, y1, xmin, ymin, xmax, ymax); } } *new_x1 = x1; *new_y1 = y1; *new_x2 = x2; *new_y2 = y2; *pt1_clipped = clip1; *pt2_clipped = clip2; return clipDone; } /* Draw lineSolid, fillStyle-independent zero width lines. * * Must keep X and Y coordinates in "ints" at least until after they're * translated and clipped to accomodate CoordModePrevious lines with very * large coordinates. * * Draws the same pixels regardless of sign(dx) or sign(dy). * * Ken Whaley * */ /* largest positive value that can fit into a component of a point. * Assumes that the point structure is {type x, y;} where type is * a signed type. */ #define MAX_COORDINATE ((1 << (((sizeof(DDXPointRec) >> 1) << 3) - 1)) - 1) #define MI_OUTPUT_POINT(xx, yy)\ {\ if ( !new_span && yy == current_y)\ {\ if (xx < spans->x)\ spans->x = xx;\ ++*widths;\ }\ else\ {\ ++Nspans;\ ++spans;\ ++widths;\ spans->x = xx;\ spans->y = yy;\ *widths = 1;\ current_y = yy;\ new_span = FALSE;\ }\ } void miZeroLine(pDraw, pGC, mode, npt, pptInit) DrawablePtr pDraw; GCPtr pGC; int mode; /* Origin or Previous */ int npt; /* number of points */ DDXPointPtr pptInit; { int Nspans, current_y; DDXPointPtr ppt; DDXPointPtr pspanInit, spans; int *pwidthInit, *widths, list_len; int xleft, ytop, xright, ybottom; int new_x1, new_y1, new_x2, new_y2; int x, y, x1, y1, x2, y2, xstart, ystart; int oc1, oc2; int result; int pt1_clipped, pt2_clipped = 0; Bool new_span; int signdx, signdy; int clipdx, clipdy; int width, height; int adx, ady; int octant; unsigned int bias = miGetZeroLineBias(pDraw->pScreen); int e, e1, e2, e3; /* Bresenham error terms */ int length; /* length of lines == # of pixels on major axis */ xleft = pDraw->x; ytop = pDraw->y; xright = pDraw->x + pDraw->width - 1; ybottom = pDraw->y + pDraw->height - 1; if (!pGC->miTranslate) { /* do everything in drawable-relative coordinates */ xleft = 0; ytop = 0; xright -= pDraw->x; ybottom -= pDraw->y; } /* it doesn't matter whether we're in drawable or screen coordinates, * FillSpans simply cannot take starting coordinates outside of the * range of a DDXPointRec component. */ if (xright > MAX_COORDINATE) xright = MAX_COORDINATE; if (ybottom > MAX_COORDINATE) ybottom = MAX_COORDINATE; /* since we're clipping to the drawable's boundaries & coordinate * space boundaries, we're guaranteed that the larger of width/height * is the longest span we'll need to output */ width = xright - xleft + 1; height = ybottom - ytop + 1; list_len = (height >= width) ? height : width; pspanInit = (DDXPointPtr)ALLOCATE_LOCAL(list_len * sizeof(DDXPointRec)); pwidthInit = (int *)ALLOCATE_LOCAL(list_len * sizeof(int)); if (!pspanInit || !pwidthInit) return; Nspans = 0; new_span = TRUE; spans = pspanInit - 1; widths = pwidthInit - 1; ppt = pptInit; xstart = ppt->x; ystart = ppt->y; if (pGC->miTranslate) { xstart += pDraw->x; ystart += pDraw->y; } /* x2, y2, oc2 copied to x1, y1, oc1 at top of loop to simplify * iteration logic */ x2 = xstart; y2 = ystart; oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); while (--npt > 0) { if (Nspans > 0) (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); Nspans = 0; new_span = TRUE; spans = pspanInit - 1; widths = pwidthInit - 1; x1 = x2; y1 = y2; oc1 = oc2; ++ppt; x2 = ppt->x; y2 = ppt->y; if (pGC->miTranslate && (mode != CoordModePrevious)) { x2 += pDraw->x; y2 += pDraw->y; } else if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } oc2 = 0; MIOUTCODES(oc2, x2, y2, xleft, ytop, xright, ybottom); CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); if (adx > ady) { e1 = ady << 1; e2 = e1 - (adx << 1); e = e1 - adx; length = adx; /* don't draw endpoint in main loop */ FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_x2 - new_x1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdy * e2) + ((clipdx - clipdy) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { y += signdy; e += e3; } x += signdx; } } else /* Y major line */ { e1 = adx << 1; e2 = e1 - (ady << 1); e = e1 - ady; length = ady; /* don't draw endpoint in main loop */ SetYMajorOctant(octant); FIXUP_ERROR(e, octant, bias); new_x1 = x1; new_y1 = y1; new_x2 = x2; new_y2 = y2; pt1_clipped = 0; pt2_clipped = 0; if ((oc1 | oc2) != 0) { result = miZeroClipLine(xleft, ytop, xright, ybottom, &new_x1, &new_y1, &new_x2, &new_y2, adx, ady, &pt1_clipped, &pt2_clipped, octant, bias, oc1, oc2); if (result == -1) continue; length = abs(new_y2 - new_y1); /* if we've clipped the endpoint, always draw the full length * of the segment, because then the capstyle doesn't matter */ if (pt2_clipped) length++; if (pt1_clipped) { /* must calculate new error terms */ clipdx = abs(new_x1 - x1); clipdy = abs(new_y1 - y1); e += (clipdx * e2) + ((clipdy - clipdx) * e1); } } /* draw the segment */ x = new_x1; y = new_y1; e3 = e2 - e1; e = e - e1; while (length--) { MI_OUTPUT_POINT(x, y); e += e1; if (e >= 0) { x += signdx; e += e3; } y += signdy; } } } /* only do the capnotlast check on the last segment * and only if the endpoint wasn't clipped. And then, if the last * point is the same as the first point, do not draw it, unless the * line is degenerate */ if ( (! pt2_clipped) && (pGC->capStyle != CapNotLast) && (((xstart != x2) || (ystart != y2)) || (ppt == pptInit + 1))) { MI_OUTPUT_POINT(x, y); } if (Nspans > 0) (*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit, pwidthInit, FALSE); DEALLOCATE_LOCAL(pwidthInit); DEALLOCATE_LOCAL(pspanInit); } void miZeroDashLine(dst, pgc, mode, nptInit, pptInit) DrawablePtr dst; GCPtr pgc; int mode; int nptInit; /* number of points in polyline */ DDXPointRec *pptInit; /* points in the polyline */ { /* XXX kludge until real zero-width dash code is written */ pgc->lineWidth = 1; miWideDash (dst, pgc, mode, nptInit, pptInit); pgc->lineWidth = 0; } vnc_unixsrc/Xvnc/programs/Xserver/mi/mibstorest.h0100664000076400007640000000673007120677563021672 0ustar constconst/* * mibstorest.h * * internal structure definitions for mi backing store */ /* $XConsortium: mibstorest.h,v 5.10 94/04/17 20:27:25 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "mibstore.h" #include "regionstr.h" /* * One of these structures is allocated per GC used with a backing-store * drawable. */ typedef struct { GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures * set FALSE and the clientClip set to * clip output to the valid regions of the * backing pixmap. */ int guarantee; /* GuaranteeNothing, etc. */ unsigned long serialNumber; /* clientClip computed time */ unsigned long stateChanges; /* changes in parent gc since last copy */ GCOps *wrapOps; /* wrapped ops */ GCFuncs *wrapFuncs; /* wrapped funcs */ } miBSGCRec, *miBSGCPtr; /* * one of these structures is allocated per Window with backing store */ typedef struct { PixmapPtr pBackingPixmap; /* Pixmap for saved areas */ short x; /* origin of pixmap relative to window */ short y; RegionRec SavedRegion; /* Valid area in pBackingPixmap */ char viewable; /* Tracks pWin->viewable so SavedRegion may * be initialized correctly when the window * is first mapped */ char status; /* StatusNoPixmap, etc. */ char backgroundState; /* background type */ PixUnion background; /* background pattern */ } miBSWindowRec, *miBSWindowPtr; #define StatusNoPixmap 1 /* pixmap has not been created */ #define StatusVirtual 2 /* pixmap is virtual, tiled with background */ #define StatusVDirty 3 /* pixmap is virtual, visiblt has contents */ #define StatusBadAlloc 4 /* pixmap create failed, do not try again */ #define StatusContents 5 /* pixmap is created, has valid contents */ typedef struct { /* * screen func wrappers */ CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; ChangeWindowAttributesProcPtr ChangeWindowAttributes; CreateGCProcPtr CreateGC; DestroyWindowProcPtr DestroyWindow; /* * pointer to vector of device-specific backing store functions */ miBSFuncPtr funcs; } miBSScreenRec, *miBSScreenPtr; vnc_unixsrc/Xvnc/programs/Xserver/mi/miscrinit.c0100664000076400007640000002406007120677563021467 0ustar constconst/* $XConsortium: miscrinit.c /main/13 1996/08/12 21:51:16 dpw $ */ /* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.2 1996/12/23 07:09:46 dawes Exp $ */ /* Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "X.h" #include "servermd.h" #include "misc.h" #include "mi.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "mibstore.h" #include "dix.h" #include "miline.h" /* We use this structure to propogate some information from miScreenInit to * miCreateScreenResources. miScreenInit allocates the structure, fills it * in, and puts it into pScreen->devPrivate. miCreateScreenResources * extracts the info and frees the structure. We could've accomplished the * same thing by adding fields to the screen structure, but they would have * ended up being redundant, and would have exposed this mi implementation * detail to the whole server. */ typedef struct { pointer pbits; /* pointer to framebuffer */ int width; /* delta to add to a framebuffer addr to move one row down */ } miScreenInitParmsRec, *miScreenInitParmsPtr; /* this plugs into pScreen->ModifyPixmapHeader */ Bool miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData) PixmapPtr pPixmap; int width; int height; int depth; int bitsPerPixel; int devKind; pointer pPixData; { if (!pPixmap) return FALSE; pPixmap->drawable.depth = depth; pPixmap->drawable.bitsPerPixel = bitsPerPixel; pPixmap->drawable.id = 0; pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->drawable.x = 0; pPixmap->drawable.y = 0; pPixmap->drawable.width = width; pPixmap->drawable.height = height; pPixmap->devKind = devKind; pPixmap->refcnt = 1; pPixmap->devPrivate.ptr = pPixData; return TRUE; } /*ARGSUSED*/ Bool miCloseScreen (index, pScreen) int index; ScreenPtr pScreen; { return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate)); } /* With the introduction of pixmap privates, the "screen pixmap" can no * longer be created in miScreenInit, since all the modules that could * possibly ask for pixmap private space have not been initialized at * that time. pScreen->CreateScreenResources is called after all * possible private-requesting modules have been inited; we create the * screen pixmap here. */ Bool miCreateScreenResources(pScreen) ScreenPtr pScreen; { miScreenInitParmsPtr pScrInitParms; pointer value; pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; /* if width is non-zero, pScreen->devPrivate will be a pixmap * else it will just take the value pbits */ if (pScrInitParms->width) { PixmapPtr pPixmap; /* create a pixmap with no data, then redirect it to point to * the screen */ pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth); if (!pPixmap) return FALSE; if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width, pScreen->height, pScreen->rootDepth, pScreen->rootDepth, PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), pScrInitParms->pbits)) return FALSE; value = (pointer)pPixmap; } else { value = pScrInitParms->pbits; } xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */ pScreen->devPrivate = value; /* pPixmap or pbits */ return TRUE; } Bool miScreenDevPrivateInit(pScreen, width, pbits) register ScreenPtr pScreen; int width; pointer pbits; { miScreenInitParmsPtr pScrInitParms; /* Stash pbits and width in a short-lived miScreenInitParmsRec attached * to the screen, until CreateScreenResources can put them in the * screen pixmap. */ pScrInitParms = (miScreenInitParmsPtr)xalloc(sizeof(miScreenInitParmsRec)); if (!pScrInitParms) return FALSE; pScrInitParms->pbits = pbits; pScrInitParms->width = width; pScreen->devPrivate = (pointer)pScrInitParms; return TRUE; } /* * If you pass in bsfuncs, then you must preinitialize the missing * screen procs before calling miScreenInit, so that the backing store * code can correctly wrap them. */ Bool miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, rootDepth, numDepths, depths, rootVisual, numVisuals, visuals, bsfuncs) register ScreenPtr pScreen; pointer pbits; /* pointer to screen bits */ int xsize, ysize; /* in pixels */ int dpix, dpiy; /* dots per inch */ int width; /* pixel width of frame buffer */ int rootDepth; /* depth of root window */ int numDepths; /* number of depths supported */ DepthRec *depths; /* supported depths */ VisualID rootVisual; /* root visual */ int numVisuals; /* number of visuals supported */ VisualRec *visuals; /* supported visuals */ miBSFuncPtr bsfuncs; /* backing store functions */ { pScreen->width = xsize; pScreen->height = ysize; pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); pScreen->numDepths = numDepths; pScreen->rootDepth = rootDepth; pScreen->allowedDepths = depths; pScreen->rootVisual = rootVisual; /* defColormap */ pScreen->minInstalledCmaps = 1; pScreen->maxInstalledCmaps = 1; pScreen->backingStoreSupport = Always; pScreen->saveUnderSupport = NotUseful; /* whitePixel, blackPixel */ pScreen->ModifyPixmapHeader = miModifyPixmapHeader; pScreen->CreateScreenResources = miCreateScreenResources; pScreen->numVisuals = numVisuals; pScreen->visuals = visuals; if (width) { #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif pScreen->CloseScreen = miCloseScreen; } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ pScreen->PointerNonInterestBox = (void (*)()) 0; pScreen->SourceValidate = (void (*)()) 0; /* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */ /* RealizeWindow, UnrealizeWindow */ pScreen->ValidateTree = miValidateTree; pScreen->PostValidateTree = (void (*)()) 0; pScreen->WindowExposures = miWindowExposures; /* PaintWindowBackground, PaintWindowBorder, CopyWindow */ pScreen->ClearToBackground = miClearToBackground; pScreen->ClipNotify = (void (*)()) 0; /* CreatePixmap, DestroyPixmap */ /* RealizeFont, UnrealizeFont */ /* CreateGC */ /* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */ /* ListInstalledColormaps, StoreColors, ResolveColor */ pScreen->RegionCreate = miRegionCreate; pScreen->RegionInit = miRegionInit; pScreen->RegionCopy = miRegionCopy; pScreen->RegionDestroy = miRegionDestroy; pScreen->RegionUninit = miRegionUninit; pScreen->Intersect = miIntersect; pScreen->Union = miUnion; pScreen->Subtract = miSubtract; pScreen->Inverse = miInverse; pScreen->RegionReset = miRegionReset; pScreen->TranslateRegion = miTranslateRegion; pScreen->RectIn = miRectIn; pScreen->PointInRegion = miPointInRegion; pScreen->RegionNotEmpty = miRegionNotEmpty; pScreen->RegionEmpty = miRegionEmpty; pScreen->RegionExtents = miRegionExtents; pScreen->RegionAppend = miRegionAppend; pScreen->RegionValidate = miRegionValidate; /* BitmapToRegion */ pScreen->RectsToRegion = miRectsToRegion; pScreen->SendGraphicsExpose = miSendGraphicsExpose; pScreen->BlockHandler = (void (*)())NoopDDA; pScreen->WakeupHandler = (void (*)())NoopDDA; pScreen->blockData = (pointer)0; pScreen->wakeupData = (pointer)0; if (bsfuncs) miInitializeBackingStore (pScreen, bsfuncs); pScreen->MarkWindow = miMarkWindow; pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; pScreen->ChangeSaveUnder = miChangeSaveUnder; pScreen->PostChangeSaveUnder = miPostChangeSaveUnder; pScreen->MoveWindow = miMoveWindow; pScreen->ResizeWindow = miSlideAndSizeWindow; pScreen->GetLayerWindow = miGetLayerWindow; pScreen->HandleExposures = miHandleValidateExposures; pScreen->ReparentWindow = (void (*)())0; pScreen->ChangeBorderWidth = miChangeBorderWidth; #ifdef SHAPE pScreen->SetShape = miSetShape; #endif pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); return miScreenDevPrivateInit(pScreen, width, pbits); } int miAllocateGCPrivateIndex() { static int privateIndex = -1; static unsigned long miGeneration = 0; if (miGeneration != serverGeneration) { privateIndex = AllocateGCPrivateIndex(); miGeneration = serverGeneration; } return privateIndex; } int miZeroLineScreenIndex; int miZeroLineGeneration; void miSetZeroLineBias(pScreen, bias) ScreenPtr pScreen; unsigned int bias; { if (miZeroLineGeneration != serverGeneration) { miZeroLineScreenIndex = AllocateScreenPrivateIndex(); miZeroLineGeneration = serverGeneration; } if (miZeroLineScreenIndex >= 0) pScreen->devPrivates[miZeroLineScreenIndex].uval = bias; } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolygen.c0100664000076400007640000001735007120677563021475 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolygen.c,v 5.2 94/04/17 20:27:43 dpw Exp $ */ #include "X.h" #include "gcstruct.h" #include "miscanfill.h" #include "mipoly.h" #include "pixmap.h" /* * * Written by Brian Kelleher; Oct. 1985 * * Routine to fill a polygon. Two fill rules are * supported: frWINDING and frEVENODD. * * See fillpoly.h for a complete description of the algorithm. */ Bool miFillGeneralPoly(dst, pgc, count, ptsIn) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ DDXPointPtr ptsIn; /* the points */ { register EdgeTableEntry *pAET; /* the Active Edge Table */ register int y; /* the current scanline */ register int nPts = 0; /* number of pts in buffer */ register EdgeTableEntry *pWETE; /* Winding Edge Table */ register ScanLineList *pSLL; /* Current ScanLineList */ register DDXPointPtr ptsOut; /* ptr to output buffers */ int *width; DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */ int FirstWidth[NUMPTSTOBUFFER]; EdgeTableEntry *pPrevAET; /* previous AET entry */ EdgeTable ET; /* Edge Table header node */ EdgeTableEntry AET; /* Active ET header node */ EdgeTableEntry *pETEs; /* Edge Table Entries buff */ ScanLineListBlock SLLBlock; /* header for ScanLineList */ int fixWAET = 0; if (count < 3) return(TRUE); if(!(pETEs = (EdgeTableEntry *) ALLOCATE_LOCAL(sizeof(EdgeTableEntry) * count))) return(FALSE); ptsOut = FirstPoint; width = FirstWidth; if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) { DEALLOCATE_LOCAL(pETEs); return(FALSE); } pSLL = ET.scanlines.next; if (pgc->fillRule == EvenOddRule) { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; /* * for each active edge */ while (pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->next->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer when its full */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } EVALUATEEDGEEVENODD(pAET, pPrevAET, y) EVALUATEEDGEEVENODD(pAET, pPrevAET, y); } miInsertionSort(&AET); } } else /* default to WindingNumber */ { /* * for each scanline */ for (y = ET.ymin; y < ET.ymax; y++) { /* * Add a new edge to the active edge table when we * get to the next edge. */ if (pSLL && y == pSLL->scanline) { miloadAET(&AET, pSLL->edgelist); micomputeWAET(&AET); pSLL = pSLL->next; } pPrevAET = &AET; pAET = AET.next; pWETE = pAET; /* * for each active edge */ while (pAET) { /* * if the next edge in the active edge table is * also the next edge in the winding active edge * table. */ if (pWETE == pAET) { ptsOut->x = pAET->bres.minor; ptsOut++->y = y; *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor; nPts++; /* * send out the buffer */ if (nPts == NUMPTSTOBUFFER) { (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); ptsOut = FirstPoint; width = FirstWidth; nPts = 0; } pWETE = pWETE->nextWETE; while (pWETE != pAET) EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); pWETE = pWETE->nextWETE; } EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); } /* * reevaluate the Winding active edge table if we * just had to resort it or if we just exited an edge. */ if (miInsertionSort(&AET) || fixWAET) { micomputeWAET(&AET); fixWAET = 0; } } } /* * Get any spans that we missed by buffering */ (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1); DEALLOCATE_LOCAL(pETEs); miFreeStorage(SLLBlock.next); return(TRUE); } vnc_unixsrc/Xvnc/programs/Xserver/mi/micursor.c0100664000076400007640000000600107120677563021324 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: micursor.c,v 1.10 94/04/17 20:27:26 rws Exp $ */ #include "scrnintstr.h" #include "cursor.h" #include "misc.h" extern Bool Must_have_memory; void miRecolorCursor( pScr, pCurs, displayed) ScreenPtr pScr; CursorPtr pCurs; Bool displayed; { /* * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ (* pScr->UnrealizeCursor)( pScr, pCurs); Must_have_memory = TRUE; /* XXX */ (* pScr->RealizeCursor)( pScr, pCurs); Must_have_memory = FALSE; /* XXX */ if ( displayed) (* pScr->DisplayCursor)( pScr, pCurs); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolyseg.c0100664000076400007640000000621707120677563021502 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolyseg.c,v 5.1 94/04/17 20:27:45 keith Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" #include "gcstruct.h" #include "pixmap.h" /***************************************************************** * miPolySegment * * For each segment, draws a line between (x1, y1) and (x2, y2). The * lines are drawn in the order listed. * * Walks the segments, compressing them into format for PolyLines. * *****************************************************************/ void miPolySegment(pDraw, pGC, nseg, pSegs) DrawablePtr pDraw; GCPtr pGC; int nseg; xSegment *pSegs; { int i; for (i=0; iops->Polylines)(pDraw, pGC, CoordModeOrigin, 2,(DDXPointPtr)pSegs); pSegs++; } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipolycon.c0100664000076400007640000001777607120677563021517 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipolycon.c,v 5.1 94/04/17 20:27:43 keith Exp $ */ #include "gcstruct.h" #include "pixmap.h" #include "miscanfill.h" static int getPolyYBounds(); /* * convexpoly.c * * Written by Brian Kelleher; Dec. 1985. * * Fill a convex polygon. If the given polygon * is not convex, then the result is undefined. * The algorithm is to order the edges from smallest * y to largest by partitioning the array into a left * edge list and a right edge list. The algorithm used * to traverse each edge is an extension of Bresenham's * line algorithm with y as the major axis. * For a derivation of the algorithm, see the author of * this code. */ Bool miFillConvexPoly(dst, pgc, count, ptsIn) DrawablePtr dst; GCPtr pgc; int count; /* number of points */ DDXPointPtr ptsIn; /* the points */ { register int xl, xr; /* x vals of left and right edges */ register int dl, dr; /* decision variables */ register int ml, m1l; /* left edge slope and slope+1 */ int mr, m1r; /* right edge slope and slope+1 */ int incr1l, incr2l; /* left edge error increments */ int incr1r, incr2r; /* right edge error increments */ int dy; /* delta y */ int y; /* current scanline */ int left, right; /* indices to first endpoints */ int i; /* loop counter */ int nextleft, nextright; /* indices to second endpoints */ DDXPointPtr ptsOut, FirstPoint; /* output buffer */ int *width, *FirstWidth; /* output buffer */ int imin; /* index of smallest vertex (in y) */ int ymin; /* y-extents of polygon */ int ymax; /* * find leftx, bottomy, rightx, topy, and the index * of bottomy. Also translate the points. */ imin = getPolyYBounds(ptsIn, count, &ymin, &ymax); dy = ymax - ymin + 1; if ((count < 3) || (dy < 0)) return(TRUE); ptsOut = FirstPoint = (DDXPointPtr )ALLOCATE_LOCAL(sizeof(DDXPointRec)*dy); width = FirstWidth = (int *)ALLOCATE_LOCAL(sizeof(int) * dy); if(!FirstPoint || !FirstWidth) { if (FirstWidth) DEALLOCATE_LOCAL(FirstWidth); if (FirstPoint) DEALLOCATE_LOCAL(FirstPoint); return(FALSE); } nextleft = nextright = imin; y = ptsIn[nextleft].y; /* * loop through all edges of the polygon */ do { /* * add a left edge if we need to */ if (ptsIn[nextleft].y == y) { left = nextleft; /* * find the next edge, considering the end * conditions of the array. */ nextleft++; if (nextleft >= count) nextleft = 0; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextleft].y-ptsIn[left].y, ptsIn[left].x,ptsIn[nextleft].x, xl, dl, ml, m1l, incr1l, incr2l); } /* * add a right edge if we need to */ if (ptsIn[nextright].y == y) { right = nextright; /* * find the next edge, considering the end * conditions of the array. */ nextright--; if (nextright < 0) nextright = count-1; /* * now compute all of the random information * needed to run the iterative algorithm. */ BRESINITPGON(ptsIn[nextright].y-ptsIn[right].y, ptsIn[right].x,ptsIn[nextright].x, xr, dr, mr, m1r, incr1r, incr2r); } /* * generate scans to fill while we still have * a right edge as well as a left edge. */ i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y; /* in case we're called with non-convex polygon */ if(i < 0) { DEALLOCATE_LOCAL(FirstWidth); DEALLOCATE_LOCAL(FirstPoint); return(TRUE); } while (i-- > 0) { ptsOut->y = y; /* * reverse the edges if necessary */ if (xl < xr) { *(width++) = xr - xl; (ptsOut++)->x = xl; } else { *(width++) = xl - xr; (ptsOut++)->x = xr; } y++; /* increment down the edges */ BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l); BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r); } } while (y != ymax); /* * Finally, fill the spans */ (*pgc->ops->FillSpans)(dst, pgc, ptsOut-FirstPoint,FirstPoint,FirstWidth, 1); DEALLOCATE_LOCAL(FirstWidth); DEALLOCATE_LOCAL(FirstPoint); return(TRUE); } /* * Find the index of the point with the smallest y. */ static int getPolyYBounds(pts, n, by, ty) DDXPointPtr pts; int n; int *by, *ty; { register DDXPointPtr ptMin; int ymin, ymax; DDXPointPtr ptsStart = pts; ptMin = pts; ymin = ymax = (pts++)->y; while (--n > 0) { if (pts->y < ymin) { ptMin = pts; ymin = pts->y; } if(pts->y > ymax) ymax = pts->y; pts++; } *by = ymin; *ty = ymax; return(ptMin-ptsStart); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mispans.c0100664000076400007640000003527407120677563021151 0ustar constconst/*********************************************************** Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mispans.c,v 5.5 94/04/17 20:27:52 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.0 1995/07/07 15:45:49 dawes Exp $ */ #include "misc.h" #include "pixmapstr.h" #include "gcstruct.h" #include "mispans.h" /* These routines maintain lists of Spans, in order to implement the ``touch-each-pixel-once'' rules of wide lines and arcs. Written by Joel McCormack, Summer 1989. */ void miInitSpanGroup(spanGroup) SpanGroup *spanGroup; { spanGroup->size = 0; spanGroup->count = 0; spanGroup->group = NULL; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } /* InitSpanGroup */ #define YMIN(spans) (spans->points[0].y) #define YMAX(spans) (spans->points[spans->count-1].y) void miSubtractSpans (spanGroup, sub) SpanGroup *spanGroup; Spans *sub; { int i, subCount, spansCount; int ymin, ymax, xmin, xmax; Spans *spans; DDXPointPtr subPt, spansPt; int *subWid, *spansWid; int extra; ymin = YMIN(sub); ymax = YMAX(sub); spans = spanGroup->group; for (i = spanGroup->count; i; i--, spans++) { if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) { subCount = sub->count; subPt = sub->points; subWid = sub->widths; spansCount = spans->count; spansPt = spans->points; spansWid = spans->widths; extra = 0; for (;;) { while (spansCount && spansPt->y < subPt->y) { spansPt++; spansWid++; spansCount--; } if (!spansCount) break; while (subCount && subPt->y < spansPt->y) { subPt++; subWid++; subCount--; } if (!subCount) break; if (subPt->y == spansPt->y) { xmin = subPt->x; xmax = xmin + *subWid; if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) { ; } else if (xmin <= spansPt->x) { if (xmax >= spansPt->x + *spansWid) { memmove (spansPt, spansPt + 1, sizeof *spansPt * (spansCount - 1)); memmove (spansWid, spansWid + 1, sizeof *spansWid * (spansCount - 1)); spansPt--; spansWid--; spans->count--; extra++; } else { *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } else { if (xmax >= spansPt->x + *spansWid) { *spansWid = xmin - spansPt->x; } else { if (!extra) { DDXPointPtr newPt; int *newwid; #define EXTRA 8 newPt = (DDXPointPtr) xrealloc (spans->points, (spans->count + EXTRA) * sizeof (DDXPointRec)); if (!newPt) break; spansPt = newPt + (spansPt - spans->points); spans->points = newPt; newwid = (int *) xrealloc (spans->widths, (spans->count + EXTRA) * sizeof (int)); if (!newwid) break; spansWid = newwid + (spansWid - spans->widths); spans->widths = newwid; extra = EXTRA; } memmove (spansPt + 1, spansPt, sizeof *spansPt * (spansCount)); memmove (spansWid + 1, spansWid, sizeof *spansWid * (spansCount)); spans->count++; extra--; *spansWid = xmin - spansPt->x; spansWid++; spansPt++; *spansWid = *spansWid - (xmax - spansPt->x); spansPt->x = xmax; } } } spansPt++; spansWid++; spansCount--; } } } } void miAppendSpans(spanGroup, otherGroup, spans) SpanGroup *spanGroup; SpanGroup *otherGroup; Spans *spans; { register int ymin, ymax; register int spansCount; spansCount = spans->count; if (spansCount > 0) { if (spanGroup->size == spanGroup->count) { spanGroup->size = (spanGroup->size + 8) * 2; spanGroup->group = (Spans *) xrealloc(spanGroup->group, sizeof(Spans) * spanGroup->size); } spanGroup->group[spanGroup->count] = *spans; (spanGroup->count)++; ymin = spans->points[0].y; if (ymin < spanGroup->ymin) spanGroup->ymin = ymin; ymax = spans->points[spansCount - 1].y; if (ymax > spanGroup->ymax) spanGroup->ymax = ymax; if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) { miSubtractSpans (otherGroup, spans); } } else { xfree (spans->points); xfree (spans->widths); } } /* AppendSpans */ void miFreeSpanGroup(spanGroup) SpanGroup *spanGroup; { if (spanGroup->group != NULL) xfree(spanGroup->group); } static void QuickSortSpansX(points, widths, numSpans) register DDXPointRec points[]; register int widths[]; register int numSpans; { register int x; register int i, j, m; register DDXPointPtr r; /* Always called with numSpans > 1 */ /* Sorts only by x, as all y should be the same */ #define ExchangeSpans(a, b) \ { \ DDXPointRec tpt; \ register int tw; \ \ tpt = points[a]; points[a] = points[b]; points[b] = tpt; \ tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ } do { if (numSpans < 9) { /* Do insertion sort */ register int xprev; xprev = points[0].x; i = 1; do { /* while i != numSpans */ x = points[i].x; if (xprev > x) { /* points[i] is out of order. Move into proper location. */ DDXPointRec tpt; int tw, k; for (j = 0; x >= points[j].x; j++) {} tpt = points[i]; tw = widths[i]; for (k = i; k != j; k--) { points[k] = points[k-1]; widths[k] = widths[k-1]; } points[j] = tpt; widths[j] = tw; x = points[i].x; } /* if out of order */ xprev = x; i++; } while (i != numSpans); return; } /* Choose partition element, stick in location 0 */ m = numSpans / 2; if (points[m].x > points[0].x) ExchangeSpans(m, 0); if (points[m].x > points[numSpans-1].x) ExchangeSpans(m, numSpans-1); if (points[m].x > points[0].x) ExchangeSpans(m, 0); x = points[0].x; /* Partition array */ i = 0; j = numSpans; do { r = &(points[i]); do { r++; i++; } while (i != numSpans && r->x < x); r = &(points[j]); do { r--; j--; } while (x < r->x); if (i < j) ExchangeSpans(i, j); } while (i < j); /* Move partition element back to middle */ ExchangeSpans(0, j); /* Recurse */ if (numSpans-j-1 > 1) QuickSortSpansX(&points[j+1], &widths[j+1], numSpans-j-1); numSpans = j; } while (numSpans > 1); } /* QuickSortSpans */ static int UniquifySpansX(spans, newPoints, newWidths) Spans *spans; register DDXPointRec *newPoints; register int *newWidths; { register int newx1, newx2, oldpt, i, y; register DDXPointRec *oldPoints; register int *oldWidths; int *startNewWidths; /* Always called with numSpans > 1 */ /* Uniquify the spans, and stash them into newPoints and newWidths. Return the number of unique spans. */ startNewWidths = newWidths; oldPoints = spans->points; oldWidths = spans->widths; y = oldPoints->y; newx1 = oldPoints->x; newx2 = newx1 + *oldWidths; for (i = spans->count-1; i != 0; i--) { oldPoints++; oldWidths++; oldpt = oldPoints->x; if (oldpt > newx2) { /* Write current span, start a new one */ newPoints->x = newx1; newPoints->y = y; *newWidths = newx2 - newx1; newPoints++; newWidths++; newx1 = oldpt; newx2 = oldpt + *oldWidths; } else { /* extend current span, if old extends beyond new */ oldpt = oldpt + *oldWidths; if (oldpt > newx2) newx2 = oldpt; } } /* for */ /* Write final span */ newPoints->x = newx1; *newWidths = newx2 - newx1; newPoints->y = y; return (newWidths - startNewWidths) + 1; } /* UniquifySpansX */ void miDisposeSpanGroup (spanGroup) SpanGroup *spanGroup; { int i; Spans *spans; for (i = 0; i < spanGroup->count; i++) { spans = spanGroup->group + i; xfree (spans->points); xfree (spans->widths); } } void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) DrawablePtr pDraw; GCPtr pGC; SpanGroup *spanGroup; { register int i; register Spans *spans; register Spans *yspans; register int *ysizes; register int ymin, ylength; /* Outgoing spans for one big call to FillSpans */ register DDXPointPtr points; register int *widths; register int count; if (spanGroup->count == 0) return; if (spanGroup->count == 1) { /* Already should be sorted, unique */ spans = spanGroup->group; (*pGC->ops->FillSpans) (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); xfree(spans->points); xfree(spans->widths); } else { /* Yuck. Gross. Radix sort into y buckets, then sort x and uniquify */ /* This seems to be the fastest thing to do. I've tried sorting on both x and y at the same time rather than creating into all those y buckets, but it was somewhat slower. */ ymin = spanGroup->ymin; ylength = spanGroup->ymax - ymin + 1; /* Allocate Spans for y buckets */ yspans = (Spans *) xalloc(ylength * sizeof(Spans)); ysizes = (int *) xalloc(ylength * sizeof (int)); if (!yspans || !ysizes) { if (yspans) xfree (yspans); if (ysizes) xfree (ysizes); miDisposeSpanGroup (spanGroup); return; } for (i = 0; i != ylength; i++) { ysizes[i] = 0; yspans[i].count = 0; yspans[i].points = NULL; yspans[i].widths = NULL; } /* Go through every single span and put it into the correct bucket */ count = 0; for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { int index; int j; for (j = 0, points = spans->points, widths = spans->widths; j != spans->count; j++, points++, widths++) { index = points->y - ymin; if (index >= 0 && index < ylength) { Spans *newspans = &(yspans[index]); if (newspans->count == ysizes[index]) { DDXPointPtr newpoints; int *newwidths; ysizes[index] = (ysizes[index] + 8) * 2; newpoints = (DDXPointPtr) xrealloc( newspans->points, ysizes[index] * sizeof(DDXPointRec)); newwidths = (int *) xrealloc( newspans->widths, ysizes[index] * sizeof(int)); if (!newpoints || !newwidths) { int i; for (i = 0; i < ylength; i++) { xfree (yspans[i].points); xfree (yspans[i].widths); } xfree (yspans); xfree (ysizes); miDisposeSpanGroup (spanGroup); return; } newspans->points = newpoints; newspans->widths = newwidths; } newspans->points[newspans->count] = *points; newspans->widths[newspans->count] = *widths; (newspans->count)++; } /* if y value of span in range */ } /* for j through spans */ count += spans->count; xfree(spans->points); spans->points = NULL; xfree(spans->widths); spans->widths = NULL; } /* for i thorough Spans */ /* Now sort by x and uniquify each bucket into the final array */ points = (DDXPointPtr) xalloc(count * sizeof(DDXPointRec)); widths = (int *) xalloc(count * sizeof(int)); if (!points || !widths) { int i; for (i = 0; i < ylength; i++) { xfree (yspans[i].points); xfree (yspans[i].widths); } xfree (yspans); xfree (ysizes); if (points) xfree (points); if (widths) xfree (widths); return; } count = 0; for (i = 0; i != ylength; i++) { int ycount = yspans[i].count; if (ycount > 0) { if (ycount > 1) { QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount); count += UniquifySpansX (&(yspans[i]), &(points[count]), &(widths[count])); } else { points[count] = yspans[i].points[0]; widths[count] = yspans[i].widths[0]; count++; } xfree(yspans[i].points); xfree(yspans[i].widths); } } (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE); xfree(points); xfree(widths); xfree(yspans); xfree(ysizes); /* use (DE)ALLOCATE_LOCAL for these? */ } spanGroup->count = 0; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } void miFillSpanGroup(pDraw, pGC, spanGroup) DrawablePtr pDraw; GCPtr pGC; SpanGroup *spanGroup; { register int i; register Spans *spans; for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { (*pGC->ops->FillSpans) (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); xfree(spans->points); xfree(spans->widths); } spanGroup->count = 0; spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } /* FillSpanGroup */ vnc_unixsrc/Xvnc/programs/Xserver/mi/migc.c0100664000076400007640000002025707120677563020411 0ustar constconst/* $XConsortium: migc.c,v 1.4 94/04/17 20:27:36 dpw Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" #include "windowstr.h" #include "migc.h" /* This structure has to line up with the mfb and cfb gc private structures so * that when it is superimposed on them, the three fields that migc.c needs to * see will be accessed correctly. I know this is not beautiful, but it seemed * better than all the code duplication in cfb and mfb. */ typedef struct { unsigned char pad1; unsigned char pad2; unsigned char pad3; unsigned pad4:1; unsigned freeCompClip:1; PixmapPtr pRotatedPixmap; RegionPtr pCompositeClip; } miPrivGC; static int miGCPrivateIndex; void miRegisterGCPrivateIndex(gcindex) int gcindex; { miGCPrivateIndex = gcindex; } /* ARGSUSED */ void miChangeGC(pGC, mask) GCPtr pGC; unsigned long mask; { return; } void miDestroyGC(pGC) GCPtr pGC; { miPrivGC *pPriv; pPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr); if (pPriv->pRotatedPixmap) (*pGC->pScreen->DestroyPixmap) (pPriv->pRotatedPixmap); if (pPriv->freeCompClip) REGION_DESTROY(pGC->pScreen, pPriv->pCompositeClip); miDestroyGCOps(pGC->ops); } /* * create a private op array for a gc */ GCOpsPtr miCreateGCOps(prototype) GCOpsPtr prototype; { GCOpsPtr ret; extern Bool Must_have_memory; /* XXX */ Must_have_memory = TRUE; ret = (GCOpsPtr) xalloc(sizeof(GCOps)); /* XXX */ Must_have_memory = FALSE; if (!ret) return 0; *ret = *prototype; ret->devPrivate.val = 1; return ret; } void miDestroyGCOps(ops) GCOpsPtr ops; { if (ops->devPrivate.val) xfree(ops); } void miDestroyClip(pGC) GCPtr pGC; { if (pGC->clientClipType == CT_NONE) return; else if (pGC->clientClipType == CT_PIXMAP) { (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip)); } else { /* * we know we'll never have a list of rectangles, since ChangeClip * immediately turns them into a region */ REGION_DESTROY(pGC->pScreen, pGC->clientClip); } pGC->clientClip = NULL; pGC->clientClipType = CT_NONE; } void miChangeClip(pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { (*pGC->funcs->DestroyClip) (pGC); if (type == CT_PIXMAP) { /* convert the pixmap to a region */ pGC->clientClip = (pointer) BITMAP_TO_REGION(pGC->pScreen, (PixmapPtr) pvalue); (*pGC->pScreen->DestroyPixmap) (pvalue); } else if (type == CT_REGION) { /* stuff the region in the GC */ pGC->clientClip = pvalue; } else if (type != CT_NONE) { pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects, (xRectangle *) pvalue, type); xfree(pvalue); } pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE; pGC->stateChanges |= GCClipMask; } void miCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { RegionPtr prgnNew; switch (pgcSrc->clientClipType) { case CT_PIXMAP: ((PixmapPtr) pgcSrc->clientClip)->refcnt++; /* Fall through !! */ case CT_NONE: (*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType, pgcSrc->clientClip, 0); break; case CT_REGION: prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1); REGION_COPY(pgcDst->pScreen, prgnNew, (RegionPtr) (pgcSrc->clientClip)); (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0); break; } } /* ARGSUSED */ void miCopyGC(pGCSrc, changes, pGCDst) GCPtr pGCSrc; unsigned long changes; GCPtr pGCDst; { return; } void miComputeCompositeClip(pGC, pDrawable) GCPtr pGC; DrawablePtr pDrawable; { ScreenPtr pScreen = pGC->pScreen; miPrivGC *devPriv = (miPrivGC *) (pGC->devPrivates[miGCPrivateIndex].ptr); if (pDrawable->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pregWin; Bool freeTmpClip, freeCompClip; if (pGC->subWindowMode == IncludeInferiors) { pregWin = NotClippedByChildren(pWin); freeTmpClip = TRUE; } else { pregWin = &pWin->clipList; freeTmpClip = FALSE; } freeCompClip = devPriv->freeCompClip; /* * if there is no client clip, we can get by with just keeping the * pointer we got, and remembering whether or not should destroy (or * maybe re-use) it later. this way, we avoid unnecessary copying of * regions. (this wins especially if many clients clip by children * and have no client clip.) */ if (pGC->clientClipType == CT_NONE) { if (freeCompClip) REGION_DESTROY(pScreen, devPriv->pCompositeClip); devPriv->pCompositeClip = pregWin; devPriv->freeCompClip = freeTmpClip; } else { /* * we need one 'real' region to put into the composite clip. if * pregWin the current composite clip are real, we can get rid of * one. if pregWin is real and the current composite clip isn't, * use pregWin for the composite clip. if the current composite * clip is real and pregWin isn't, use the current composite * clip. if neither is real, create a new region. */ REGION_TRANSLATE(pScreen, pGC->clientClip, pDrawable->x + pGC->clipOrg.x, pDrawable->y + pGC->clipOrg.y); if (freeCompClip) { REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip, pregWin, pGC->clientClip); if (freeTmpClip) REGION_DESTROY(pScreen, pregWin); } else if (freeTmpClip) { REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip); devPriv->pCompositeClip = pregWin; } else { devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); REGION_INTERSECT(pScreen, devPriv->pCompositeClip, pregWin, pGC->clientClip); } devPriv->freeCompClip = TRUE; REGION_TRANSLATE(pScreen, pGC->clientClip, -(pDrawable->x + pGC->clipOrg.x), -(pDrawable->y + pGC->clipOrg.y)); } } /* end of composite clip for a window */ else { BoxRec pixbounds; /* XXX should we translate by drawable.x/y here ? */ pixbounds.x1 = 0; pixbounds.y1 = 0; pixbounds.x2 = pDrawable->width; pixbounds.y2 = pDrawable->height; if (devPriv->freeCompClip) { REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds); } else { devPriv->freeCompClip = TRUE; devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); } if (pGC->clientClipType == CT_REGION) { REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, -pGC->clipOrg.x, -pGC->clipOrg.y); REGION_INTERSECT(pScreen, devPriv->pCompositeClip, devPriv->pCompositeClip, pGC->clientClip); REGION_TRANSLATE(pScreen, devPriv->pCompositeClip, pGC->clipOrg.x, pGC->clipOrg.y); } } /* end of composite clip for pixmap */ } /* end miComputeCompositeClip */ vnc_unixsrc/Xvnc/programs/Xserver/mi/mispans.h0100664000076400007640000001065307120677563021150 0ustar constconst/*********************************************************** Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mispans.h,v 5.3 94/04/17 20:27:52 dpw Exp $ */ typedef struct { int count; /* number of spans */ DDXPointPtr points; /* pointer to list of start points */ int *widths; /* pointer to list of widths */ } Spans; typedef struct { int size; /* Total number of *Spans allocated */ int count; /* Number of *Spans actually in group */ Spans *group; /* List of Spans */ int ymin, ymax; /* Min, max y values encountered */ } SpanGroup; /* Initialize SpanGroup. MUST BE DONE before use. */ extern void miInitSpanGroup( #if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ #endif ); /* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */ extern void miAppendSpans( #if NeedFunctionPrototypes SpanGroup * /*spanGroup*/, SpanGroup * /*otherGroup*/, Spans * /*spans*/ #endif ); /* Paint a span group, possibly with some overlap */ extern void miFillSpanGroup( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ #endif ); /* Paint a span group, insuring that each pixel is painted at most once */ extern void miFillUniqueSpanGroup( #if NeedFunctionPrototypes DrawablePtr /*pDraw*/, GCPtr /*pGC*/, SpanGroup * /*spanGroup*/ #endif ); /* Free up data in a span group. MUST BE DONE or you'll suffer memory leaks */ extern void miFreeSpanGroup( #if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ #endif ); extern void miSubtractSpans( #if NeedFunctionPrototypes SpanGroup * /*spanGroup*/, Spans * /*sub*/ #endif ); extern void miDisposeSpanGroup( #if NeedFunctionPrototypes SpanGroup * /*spanGroup*/ #endif ); extern int miClipSpans( #if NeedFunctionPrototypes RegionPtr /*prgnDst*/, DDXPointPtr /*ppt*/, int * /*pwidth*/, int /*nspans*/, DDXPointPtr /*pptNew*/, int * /*pwidthNew*/, int /*fSorted*/ #endif ); /* Rops which must use span groups */ #define miSpansCarefulRop(rop) (((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2) #define miSpansEasyRop(rop) (!miSpansCarefulRop(rop)) vnc_unixsrc/Xvnc/programs/Xserver/mi/mistruct.h0100664000076400007640000000552207120677563021347 0ustar constconst/* $XConsortium: mistruct.h,v 1.3 94/04/17 20:27:56 jim Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #ifndef MISTRUCT_H #define MISTRUCT_H #include "mi.h" #include "miscstruct.h" /* information about dashes */ typedef struct _miDash { DDXPointRec pt; int e1, e2; /* keep these, so we don't have to do it again */ int e; /* bresenham error term for this point on line */ int which; int newLine;/* 0 if part of same original line as previous dash */ } miDashRec; #endif /* MISTRUCT_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/miline.h0100664000076400007640000001174107120677563020752 0ustar constconst/* $XConsortium: miline.h /main/6 1996/08/12 21:51:09 dpw $ */ /* Copyright (c) 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #ifndef MILINE_H /* * Public definitions used for configuring basic pixelization aspects * of the sample implementation line-drawing routines provided in * {mfb,mi,cfb*} at run-time. */ #define XDECREASING 4 #define YDECREASING 2 #define YMAJOR 1 #define OCTANT1 (1 << (YDECREASING)) #define OCTANT2 (1 << (YDECREASING|YMAJOR)) #define OCTANT3 (1 << (XDECREASING|YDECREASING|YMAJOR)) #define OCTANT4 (1 << (XDECREASING|YDECREASING)) #define OCTANT5 (1 << (XDECREASING)) #define OCTANT6 (1 << (XDECREASING|YMAJOR)) #define OCTANT7 (1 << (YMAJOR)) #define OCTANT8 (1 << (0)) #define XMAJOROCTANTS (OCTANT1 | OCTANT4 | OCTANT5 | OCTANT8) #define DEFAULTZEROLINEBIAS (OCTANT2 | OCTANT3 | OCTANT4 | OCTANT5) /* * Devices can configure the rendering of routines in mi, mfb, and cfb* * by specifying a thin line bias to be applied to a particular screen * using the following function. The bias parameter is an OR'ing of * the appropriate OCTANT constants defined above to indicate which * octants to bias a line to prefer an axial step when the Bresenham * error term is exactly zero. The octants are mapped as follows: * * \ | / * \ 3 | 2 / * \ | / * 4 \ | / 1 * \|/ * ----------- * /|\ * 5 / | \ 8 * / | \ * / 6 | 7 \ * / | \ * * For more information, see "Ambiguities in Incremental Line Rastering," * Jack E. Bresenham, IEEE CG&A, May 1987. */ extern void miSetZeroLineBias( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, unsigned int /* bias */ #endif ); /* * Private definitions needed for drawing thin (zero width) lines * Used by the mi, mfb, and all cfb* components. */ #define X_AXIS 0 #define Y_AXIS 1 #define OUT_LEFT 0x08 #define OUT_RIGHT 0x04 #define OUT_ABOVE 0x02 #define OUT_BELOW 0x01 #define OUTCODES(_result, _x, _y, _pbox) \ if ( (_x) < (_pbox)->x1) (_result) |= OUT_LEFT; \ else if ( (_x) >= (_pbox)->x2) (_result) |= OUT_RIGHT; \ if ( (_y) < (_pbox)->y1) (_result) |= OUT_ABOVE; \ else if ( (_y) >= (_pbox)->y2) (_result) |= OUT_BELOW; #define SWAPINT(i, j) \ { register int _t = i; i = j; j = _t; } #define SWAPPT(i, j) \ { DDXPointRec _t; _t = i; i = j; j = _t; } #define SWAPINT_PAIR(x1, y1, x2, y2)\ { int t = x1; x1 = x2; x2 = t;\ t = y1; y1 = y2; y2 = t;\ } #define miGetZeroLineBias(_pScreen) \ ((miZeroLineScreenIndex < 0) ? \ 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval)) #define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ (_octant) = 0; \ (_sx) = (_SX); \ if (((_adx) = (_x2) - (_x1)) < 0) { \ (_adx) = -(_adx); \ (_sx = -(_sx)); \ (_octant) |= XDECREASING; \ } \ (_sy) = (_SY); \ if (((_ady) = (_y2) - (_y1)) < 0) { \ (_ady) = -(_ady); \ (_sy = -(_sy)); \ (_octant) |= YDECREASING; \ } #define SetYMajorOctant(_octant) ((_octant) |= YMAJOR) #define FIXUP_ERROR(_e, _octant, _bias) \ (_e) -= (((_bias) >> (_octant)) & 1) #define IsXMajorOctant(_octant) (!((_octant) & YMAJOR)) #define IsYMajorOctant(_octant) ((_octant) & YMAJOR) #define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) #define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) extern int miZeroLineScreenIndex; extern int miZeroClipLine( #if NeedFunctionPrototypes int /*xmin*/, int /*ymin*/, int /*xmax*/, int /*ymax*/, int * /*new_x1*/, int * /*new_y1*/, int * /*new_x2*/, int * /*new_y2*/, unsigned int /*adx*/, unsigned int /*ady*/, int * /*pt1_clipped*/, int * /*pt2_clipped*/, int /*octant*/, unsigned int /*bias*/, int /*oc1*/, int /*oc2*/ #endif ); #endif /* MILINE_H */ vnc_unixsrc/Xvnc/programs/Xserver/mi/migc.h0100664000076400007640000000456107120677563020416 0ustar constconst/* $XConsortium: migc.h,v 1.3 94/04/17 20:27:37 dpw Exp $ */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ extern void miRegisterGCPrivateIndex( #if NeedFunctionPrototypes int /*gcindex*/ #endif ); extern void miChangeGC( #if NeedFunctionPrototypes GCPtr /*pGC*/, unsigned long /*mask*/ #endif ); extern void miDestroyGC( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); extern GCOpsPtr miCreateGCOps( #if NeedFunctionPrototypes GCOpsPtr /*prototype*/ #endif ); extern void miDestroyGCOps( #if NeedFunctionPrototypes GCOpsPtr /*ops*/ #endif ); extern void miDestroyClip( #if NeedFunctionPrototypes GCPtr /*pGC*/ #endif ); extern void miChangeClip( #if NeedFunctionPrototypes GCPtr /*pGC*/, int /*type*/, pointer /*pvalue*/, int /*nrects*/ #endif ); extern void miCopyClip( #if NeedFunctionPrototypes GCPtr /*pgcDst*/, GCPtr /*pgcSrc*/ #endif ); extern void miCopyGC( #if NeedFunctionPrototypes GCPtr /*pGCSrc*/, unsigned long /*changes*/, GCPtr /*pGCDst*/ #endif ); extern void miComputeCompositeClip( #if NeedFunctionPrototypes GCPtr /*pGC*/, DrawablePtr /*pDrawable*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mifpoly.h0100664000076400007640000001001607120677563021146 0ustar constconst/* $XConsortium: mifpoly.h,v 1.9 94/04/17 20:27:35 dpw Exp $ */ /*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ #define EPSILON 0.000001 #define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON) #define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON) #define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \ (b) - (a) <= 0.5) #define ROUNDTOINT(x) ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5))) #define ISZERO(x) (Fabs((x)) <= EPSILON) #define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y)) #define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y)) #define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y)) #define NotEnd 0 #define FirstEnd 1 #define SecondEnd 2 #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */ #define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */ #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else #ifdef __GNUC__ static __inline int ICEIL(x) double x; { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; } #else #define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1) #define ICEILTEMPDECL static int _cTmp; #endif #endif /* Point with sub-pixel positioning. In this case we use doubles, but * see mifpolycon.c for other suggestions */ typedef struct _SppPoint { double x, y; } SppPointRec, *SppPointPtr; typedef struct _SppArc { double x, y, width, height; double angle1, angle2; } SppArcRec, *SppArcPtr; /* mifpolycon.c */ extern void miFillSppPoly( #if NeedFunctionPrototypes DrawablePtr /*dst*/, GCPtr /*pgc*/, int /*count*/, SppPointPtr /*ptsIn*/, int /*xTrans*/, int /*yTrans*/, double /*xFtrans*/, double /*yFtrans*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/mifillrct.c0100664000076400007640000001074507120677563021460 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mifillrct.c,v 5.1 94/04/17 20:27:34 keith Exp $ */ #include "X.h" #include "Xprotostr.h" #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" #include "misc.h" /* mi rectangles written by newman, with debts to all and sundry */ /* MIPOLYFILLRECT -- public entry for PolyFillRect request * very straight forward: translate rectangles if necessary * then call FillSpans to fill each rectangle. We let FillSpans worry about * clipping to the destination */ void miPolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { int i; register int height; register int width; register xRectangle *prect; int xorg; register int yorg; int maxheight; DDXPointPtr pptFirst; register DDXPointPtr ppt; int *pwFirst; register int *pw; if (pGC->miTranslate) { xorg = pDrawable->x; yorg = pDrawable->y; prect = prectInit; maxheight = 0; for (i = 0; ix += xorg; prect->y += yorg; maxheight = max(maxheight, prect->height); } } else { prect = prectInit; maxheight = 0; for (i = 0; iheight); } pptFirst = (DDXPointPtr) ALLOCATE_LOCAL(maxheight * sizeof(DDXPointRec)); pwFirst = (int *) ALLOCATE_LOCAL(maxheight * sizeof(int)); if(!pptFirst || !pwFirst) { if (pwFirst) DEALLOCATE_LOCAL(pwFirst); if (pptFirst) DEALLOCATE_LOCAL(pptFirst); return; } prect = prectInit; while(nrectFill--) { ppt = pptFirst; pw = pwFirst; height = prect->height; width = prect->width; xorg = prect->x; yorg = prect->y; while(height--) { *pw++ = width; ppt->x = xorg; ppt->y = yorg; ppt++; yorg++; } (* pGC->ops->FillSpans)(pDrawable, pGC, prect->height, pptFirst, pwFirst, 1); prect++; } DEALLOCATE_LOCAL(pwFirst); DEALLOCATE_LOCAL(pptFirst); } vnc_unixsrc/Xvnc/programs/Xserver/mi/miwideline.c0100664000076400007640000014055007120677563021617 0ustar constconst/* $XConsortium: miwideline.c /main/58 1996/08/12 21:51:21 dpw $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.1.1.3.2.2 1998/02/01 22:08:22 robin Exp $ */ /* Author: Keith Packard, MIT X Consortium */ /* * Mostly integer wideline code. Uses a technique similar to * bresenham zero-width lines, except walks an X edge */ #include #ifdef _XOPEN_SOURCE #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ #include #undef _XOPEN_SOURCE #endif #include "X.h" #include "windowstr.h" #include "gcstruct.h" #include "miscstruct.h" #include "miwideline.h" #include "mi.h" #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif static void miLineArc(); /* * spans-based polygon filler */ void miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, left, right, left_count, right_count) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; int y; /* start y coordinate */ int overall_height; /* height of entire segment */ PolyEdgePtr left, right; int left_count, right_count; { register int left_x, left_e; int left_stepx; int left_signdx; int left_dy, left_dx; register int right_x, right_e; int right_stepx; int right_signdx; int right_dy, right_dx; int height; int left_height, right_height; register DDXPointPtr ppt; DDXPointPtr pptInit; register int *pwidth; int *pwidthInit; XID oldPixel; int xorg; Spans spanRec; left_height = 0; right_height = 0; if (!spanData) { pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt)); if (!pptInit) return; pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth)); if (!pwidthInit) { DEALLOCATE_LOCAL (pptInit); return; } ppt = pptInit; pwidth = pwidthInit; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, (XID *)&pixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.points = (DDXPointPtr) xalloc (overall_height * sizeof (*ppt)); if (!spanRec.points) return; spanRec.widths = (int *) xalloc (overall_height * sizeof (int)); if (!spanRec.widths) { xfree (spanRec.points); return; } ppt = spanRec.points; pwidth = spanRec.widths; } xorg = 0; if (pGC->miTranslate) { y += pDrawable->y; xorg = pDrawable->x; } while ((left_count || left_height) && (right_count || right_height)) { MIPOLYRELOADLEFT MIPOLYRELOADRIGHT height = left_height; if (height > right_height) height = right_height; left_height -= height; right_height -= height; while (--height >= 0) { if (right_x >= left_x) { ppt->y = y; ppt->x = left_x + xorg; ppt++; *pwidth++ = right_x - left_x + 1; } y++; MIPOLYSTEPLEFT MIPOLYSTEPRIGHT } } if (!spanData) { (*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE); DEALLOCATE_LOCAL (pwidthInit); DEALLOCATE_LOCAL (pptInit); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.count = ppt - spanRec.points; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } static void miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, w, h) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; int x, y, w, h; { register DDXPointPtr ppt; register int *pwidth; XID oldPixel; Spans spanRec; xRectangle rect; if (!spanData) { rect.x = x; rect.y = y; rect.width = w; rect.height = h; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, (XID *)&pixel, FALSE); ValidateGC (pDrawable, pGC); } (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } else { spanRec.points = (DDXPointPtr) xalloc (h * sizeof (*ppt)); if (!spanRec.points) return; spanRec.widths = (int *) xalloc (h * sizeof (int)); if (!spanRec.widths) { xfree (spanRec.points); return; } ppt = spanRec.points; pwidth = spanRec.widths; if (pGC->miTranslate) { y += pDrawable->y; x += pDrawable->x; } while (h--) { ppt->x = x; ppt->y = y; ppt++; *pwidth++ = w; y++; } spanRec.count = ppt - spanRec.points; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } int miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge) double x0, y0; double k; /* x0 * dy - y0 * dx */ register int dx, dy; int xi, yi; int left; register PolyEdgePtr edge; { int x, y, e; int xady; if (dy < 0) { dy = -dy; dx = -dx; k = -k; } #ifdef NOTDEF { double realk, kerror; realk = x0 * dy - y0 * dx; kerror = Fabs (realk - k); if (kerror > .1) printf ("realk: %g k: %g\n", realk, k); } #endif y = ICEIL (y0); xady = ICEIL (k) + y * dx; if (xady <= 0) x = - (-xady / dy) - 1; else x = (xady - 1) / dy; e = xady - x * dy; if (dx >= 0) { edge->signdx = 1; edge->stepx = dx / dy; edge->dx = dx % dy; } else { edge->signdx = -1; edge->stepx = - (-dx / dy); edge->dx = -dx % dy; e = dy - e + 1; } edge->dy = dy; edge->x = x + left + xi; edge->e = e - dy; /* bias to compare against 0 instead of dy */ return y + yi; } #define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr))) int miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h) register PolyVertexPtr vertices; register PolySlopePtr slopes; int count; int xi, yi; PolyEdgePtr left, right; int *pnleft, *pnright; int *h; { int top, bottom; double miny, maxy; register int i; int j; int clockwise; int slopeoff; register int s; register int nright, nleft; int y, lasty, bottomy, topy; /* find the top of the polygon */ maxy = miny = vertices[0].y; bottom = top = 0; for (i = 1; i < count; i++) { if (vertices[i].y < miny) { top = i; miny = vertices[i].y; } if (vertices[i].y >= maxy) { bottom = i; maxy = vertices[i].y; } } clockwise = 1; slopeoff = 0; i = top; j = StepAround (top, -1, count); if (slopes[j].dy * slopes[i].dx > slopes[i].dy * slopes[j].dx) { clockwise = -1; slopeoff = -1; } bottomy = ICEIL (maxy) + yi; nright = 0; s = StepAround (top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge (vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 0, &right[nright]); if (nright != 0) right[nright-1].height = y - lasty; else topy = y; nright++; lasty = y; } i = StepAround (i, clockwise, count); s = StepAround (s, clockwise, count); } if (nright != 0) right[nright-1].height = bottomy - lasty; if (slopeoff == 0) slopeoff = -1; else slopeoff = 0; nleft = 0; s = StepAround (top, slopeoff, count); i = top; while (i != bottom) { if (slopes[s].dy != 0) { y = miPolyBuildEdge (vertices[i].x, vertices[i].y, slopes[s].k, slopes[s].dx, slopes[s].dy, xi, yi, 1, &left[nleft]); if (nleft != 0) left[nleft-1].height = y - lasty; nleft++; lasty = y; } i = StepAround (i, -clockwise, count); s = StepAround (s, -clockwise, count); } if (nleft != 0) left[nleft-1].height = bottomy - lasty; *pnleft = nleft; *pnright = nright; *h = bottomy - topy; return topy; } static void miLineOnePoint (pDrawable, pGC, pixel, spanData, x, y) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; int x, y; { DDXPointRec pt; int wid; unsigned long oldPixel; MILINESETPIXEL (pDrawable, pGC, pixel, oldPixel); if (pGC->fillStyle == FillSolid) { pt.x = x; pt.y = y; (*pGC->ops->PolyPoint) (pDrawable, pGC, CoordModeOrigin, 1, &pt); } else { wid = 1; if (pGC->miTranslate) { x += pDrawable->x; y += pDrawable->y; } pt.x = x; pt.y = y; (*pGC->ops->FillSpans) (pDrawable, pGC, 1, &pt, &wid, TRUE); } MILINERESETPIXEL (pDrawable, pGC, pixel, oldPixel); } static void miLineJoin (pDrawable, pGC, pixel, spanData, pLeft, pRight) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; register LineFacePtr pLeft, pRight; { double mx, my; double denom; PolyVertexRec vertices[4]; PolySlopeRec slopes[4]; int edgecount; PolyEdgeRec left[4], right[4]; int nleft, nright; int y, height; int swapslopes; int joinStyle = pGC->joinStyle; int lw = pGC->lineWidth; if (lw == 1 && !spanData) { /* Lines going in the same direction have no join */ if (pLeft->dx >= 0 == pRight->dx <= 0) return; if (joinStyle != JoinRound) { denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom == 0) return; /* no join to draw */ } if (joinStyle != JoinMiter) { miLineOnePoint (pDrawable, pGC, pixel, spanData, pLeft->x, pLeft->y); return; } } else { if (joinStyle == JoinRound) { miLineArc(pDrawable, pGC, pixel, spanData, pLeft, pRight, (double)0.0, (double)0.0, TRUE); return; } denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom == 0.0) return; /* no join to draw */ } swapslopes = 0; if (denom > 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; pLeft->dx = -pLeft->dx; pLeft->dy = -pLeft->dy; } else { swapslopes = 1; pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; pRight->dx = -pRight->dx; pRight->dy = -pRight->dy; } vertices[0].x = pRight->xa; vertices[0].y = pRight->ya; slopes[0].dx = -pRight->dy; slopes[0].dy = pRight->dx; slopes[0].k = 0; vertices[1].x = 0; vertices[1].y = 0; slopes[1].dx = pLeft->dy; slopes[1].dy = -pLeft->dx; slopes[1].k = 0; vertices[2].x = pLeft->xa; vertices[2].y = pLeft->ya; if (joinStyle == JoinMiter) { my = (pLeft->dy * (pRight->xa * pRight->dy - pRight->ya * pRight->dx) - pRight->dy * (pLeft->xa * pLeft->dy - pLeft->ya * pLeft->dx )) / denom; if (pLeft->dy != 0) { mx = pLeft->xa + (my - pLeft->ya) * (double) pLeft->dx / (double) pLeft->dy; } else { mx = pRight->xa + (my - pRight->ya) * (double) pRight->dx / (double) pRight->dy; } /* check miter limit */ if ((mx * mx + my * my) * 4 > SQSECANT * lw * lw) joinStyle = JoinBevel; } if (joinStyle == JoinMiter) { slopes[2].dx = pLeft->dx; slopes[2].dy = pLeft->dy; slopes[2].k = pLeft->k; if (swapslopes) { slopes[2].dx = -slopes[2].dx; slopes[2].dy = -slopes[2].dy; slopes[2].k = -slopes[2].k; } vertices[3].x = mx; vertices[3].y = my; slopes[3].dx = pRight->dx; slopes[3].dy = pRight->dy; slopes[3].k = pRight->k; if (swapslopes) { slopes[3].dx = -slopes[3].dx; slopes[3].dy = -slopes[3].dy; slopes[3].k = -slopes[3].k; } edgecount = 4; } else { double scale, dx, dy, adx, ady; adx = dx = pRight->xa - pLeft->xa; ady = dy = pRight->ya - pLeft->ya; if (adx < 0) adx = -adx; if (ady < 0) ady = -ady; scale = ady; if (adx > ady) scale = adx; slopes[2].dx = (dx * 65536) / scale; slopes[2].dy = (dy * 65536) / scale; slopes[2].k = ((pLeft->xa + pRight->xa) * slopes[2].dy - (pLeft->ya + pRight->ya) * slopes[2].dx) / 2.0; edgecount = 3; } y = miPolyBuildPoly (vertices, slopes, edgecount, pLeft->x, pLeft->y, left, right, &nleft, &nright, &height); miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, height, left, right, nleft, nright); } static int miLineArcI (pDraw, pGC, xorg, yorg, points, widths) DrawablePtr pDraw; GCPtr pGC; int xorg, yorg; DDXPointPtr points; int *widths; { register DDXPointPtr tpts, bpts; register int *twids, *bwids; register int x, y, e, ex, slw; tpts = points; twids = widths; if (pGC->miTranslate) { xorg += pDraw->x; yorg += pDraw->y; } slw = pGC->lineWidth; if (slw == 1) { tpts->x = xorg; tpts->y = yorg; *twids = 1; return 1; } bpts = tpts + slw; bwids = twids + slw; y = (slw >> 1) + 1; if (slw & 1) e = - ((y << 2) + 3); else e = - (y << 3); ex = -4; x = 0; while (y) { e += (y << 3) - 4; while (e >= 0) { x++; e += (ex = -((x << 3) + 4)); } y--; slw = (x << 1) + 1; if ((e == ex) && (slw > 1)) slw--; tpts->x = xorg - x; tpts->y = yorg - y; tpts++; *twids++ = slw; if ((y != 0) && ((slw > 1) || (e != ex))) { bpts--; bpts->x = xorg - x; bpts->y = yorg + y; *--bwids = slw; } } return (pGC->lineWidth); } #define CLIPSTEPEDGE(edgey,edge,edgeleft) \ if (ybase == edgey) \ { \ if (edgeleft) \ { \ if (edge->x > xcl) \ xcl = edge->x; \ } \ else \ { \ if (edge->x < xcr) \ xcr = edge->x; \ } \ edgey++; \ edge->x += edge->stepx; \ edge->e += edge->dx; \ if (edge->e > 0) \ { \ edge->x += edge->signdx; \ edge->e -= edge->dy; \ } \ } static int miLineArcD (pDraw, pGC, xorg, yorg, points, widths, edge1, edgey1, edgeleft1, edge2, edgey2, edgeleft2) DrawablePtr pDraw; GCPtr pGC; double xorg, yorg; DDXPointPtr points; int *widths; PolyEdgePtr edge1, edge2; int edgey1, edgey2; Bool edgeleft1, edgeleft2; { register DDXPointPtr pts; register int *wids; double radius, x0, y0, el, er, yk, xlk, xrk, k; int xbase, ybase, y, boty, xl, xr, xcl, xcr; int ymin, ymax; Bool edge1IsMin, edge2IsMin; int ymin1, ymin2; pts = points; wids = widths; xbase = floor(xorg); x0 = xorg - xbase; ybase = ICEIL (yorg); y0 = yorg - ybase; if (pGC->miTranslate) { xbase += pDraw->x; ybase += pDraw->y; edge1->x += pDraw->x; edge2->x += pDraw->x; edgey1 += pDraw->y; edgey2 += pDraw->y; } xlk = x0 + x0 + 1.0; xrk = x0 + x0 - 1.0; yk = y0 + y0 - 1.0; radius = ((double)pGC->lineWidth) / 2.0; y = floor(radius - y0 + 1.0); ybase -= y; ymin = ybase; ymax = 65536; edge1IsMin = FALSE; ymin1 = edgey1; if (edge1->dy >= 0) { if (!edge1->dy) { if (edgeleft1) edge1IsMin = TRUE; else ymax = edgey1; edgey1 = 65536; } else { if ((edge1->signdx < 0) == edgeleft1) edge1IsMin = TRUE; } } edge2IsMin = FALSE; ymin2 = edgey2; if (edge2->dy >= 0) { if (!edge2->dy) { if (edgeleft2) edge2IsMin = TRUE; else ymax = edgey2; edgey2 = 65536; } else { if ((edge2->signdx < 0) == edgeleft2) edge2IsMin = TRUE; } } if (edge1IsMin) { ymin = ymin1; if (edge2IsMin && ymin1 > ymin2) ymin = ymin2; } else if (edge2IsMin) ymin = ymin2; el = radius * radius - ((y + y0) * (y + y0)) - (x0 * x0); er = el + xrk; xl = 1; xr = 0; if (x0 < 0.5) { xl = 0; el -= xlk; } boty = (y0 < -0.5) ? 1 : 0; if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er += k; while (er > 0.0) { xr++; er += xrk - (xr << 1); } el += k; while (el >= 0.0) { xl--; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } er = xrk - (xr << 1) - er; el = (xl << 1) - xlk - el; boty = floor(-y0 - radius + 1.0); if (ybase + y - boty > ymax) boty = ymax - ybase - y; while (y > boty) { k = (y << 1) + yk; er -= k; while ((er >= 0.0) && (xr >= 0)) { xr--; er += xrk - (xr << 1); } el -= k; while ((el > 0.0) && (xl <= 0)) { xl++; el += (xl << 1) - xlk; } y--; ybase++; if (ybase < ymin) continue; xcl = xl + xbase; xcr = xr + xbase; CLIPSTEPEDGE(edgey1, edge1, edgeleft1); CLIPSTEPEDGE(edgey2, edge2, edgeleft2); if (xcr >= xcl) { pts->x = xcl; pts->y = ybase; pts++; *wids++ = xcr - xcl + 1; } } return (pts - points); } int miRoundJoinFace (face, edge, leftEdge) register LineFacePtr face; register PolyEdgePtr edge; Bool *leftEdge; { int y; int dx, dy; double xa, ya; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; left = 1; if (ya > 0) { ya = 0.0; xa = 0.0; } if (dy < 0 || dy == 0 && dx > 0) { dx = -dx; dy = -dy; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL (face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge (xa, ya, 0.0, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } void miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2) register LineFacePtr pLeft, pRight; PolyEdgePtr edge1, edge2; int *y1, *y2; Bool *left1, *left2; { double denom; denom = - pLeft->dx * (double)pRight->dy + pRight->dx * (double)pLeft->dy; if (denom >= 0) { pLeft->xa = -pLeft->xa; pLeft->ya = -pLeft->ya; } else { pRight->xa = -pRight->xa; pRight->ya = -pRight->ya; } *y1 = miRoundJoinFace (pLeft, edge1, left1); *y2 = miRoundJoinFace (pRight, edge2, left2); } int miRoundCapClip (face, isInt, edge, leftEdge) register LineFacePtr face; Bool isInt; register PolyEdgePtr edge; Bool *leftEdge; { int y; register int dx, dy; double xa, ya, k; Bool left; dx = -face->dy; dy = face->dx; xa = face->xa; ya = face->ya; k = 0.0; if (!isInt) k = face->k; left = 1; if (dy < 0 || dy == 0 && dx > 0) { dx = -dx; dy = -dy; xa = -xa; ya = -ya; left = !left; } if (dx == 0 && dy == 0) dy = 1; if (dy == 0) { y = ICEIL (face->ya) + face->y; edge->x = -32767; edge->stepx = 0; edge->signdx = 0; edge->e = -1; edge->dy = 0; edge->dx = 0; edge->height = 0; } else { y = miPolyBuildEdge (xa, ya, k, dx, dy, face->x, face->y, !left, edge); edge->height = 32767; } *leftEdge = !left; return y; } static void miLineArc (pDraw, pGC, pixel, spanData, leftFace, rightFace, xorg, yorg, isInt) DrawablePtr pDraw; register GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; register LineFacePtr leftFace, rightFace; double xorg, yorg; Bool isInt; { DDXPointPtr points; int *widths; int xorgi, yorgi; XID oldPixel; Spans spanRec; int n; PolyEdgeRec edge1, edge2; int edgey1, edgey2; Bool edgeleft1, edgeleft2; if (isInt) { xorgi = leftFace ? leftFace->x : rightFace->x; yorgi = leftFace ? leftFace->y : rightFace->y; } edgey1 = 65536; edgey2 = 65536; edge1.x = 0; /* not used, keep memory checkers happy */ edge1.dy = -1; edge2.x = 0; /* not used, keep memory checkers happy */ edge2.dy = -1; edgeleft1 = FALSE; edgeleft2 = FALSE; if ((pGC->lineStyle != LineSolid || pGC->lineWidth > 2) && (pGC->capStyle == CapRound && pGC->joinStyle != JoinRound || pGC->joinStyle == JoinRound && pGC->capStyle == CapButt)) { if (isInt) { xorg = (double) xorgi; yorg = (double) yorgi; } if (leftFace && rightFace) { miRoundJoinClip (leftFace, rightFace, &edge1, &edge2, &edgey1, &edgey2, &edgeleft1, &edgeleft2); } else if (leftFace) { edgey1 = miRoundCapClip (leftFace, isInt, &edge1, &edgeleft1); } else if (rightFace) { edgey2 = miRoundCapClip (rightFace, isInt, &edge2, &edgeleft2); } isInt = FALSE; } if (!spanData) { points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth); if (!points) return; widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth); if (!widths) { DEALLOCATE_LOCAL(points); return; } oldPixel = pGC->fgPixel; if (pixel != oldPixel) { DoChangeGC(pGC, GCForeground, (XID *)&pixel, FALSE); ValidateGC (pDraw, pGC); } } else { points = (DDXPointPtr) xalloc (pGC->lineWidth * sizeof (DDXPointRec)); if (!points) return; widths = (int *) xalloc (pGC->lineWidth * sizeof (int)); if (!widths) { xfree (points); return; } spanRec.points = points; spanRec.widths = widths; } if (isInt) n = miLineArcI(pDraw, pGC, xorgi, yorgi, points, widths); else n = miLineArcD(pDraw, pGC, xorg, yorg, points, widths, &edge1, edgey1, edgeleft1, &edge2, edgey2, edgeleft2); if (!spanData) { (*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE); DEALLOCATE_LOCAL(widths); DEALLOCATE_LOCAL(points); if (pixel != oldPixel) { DoChangeGC(pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDraw, pGC); } } else { spanRec.count = n; AppendSpanGroup (pGC, pixel, &spanRec, spanData) } } void miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt) DrawablePtr pDrawable; register GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; register LineFacePtr face; Bool isLeft; double xorg, yorg; Bool isInt; { int xorgi, yorgi; int lw; PolyEdgeRec lefts[2], rights[2]; int lefty, righty, topy, bottomy; PolyEdgePtr left, right; PolyEdgePtr top, bottom; double xa,ya; double k; double xap, yap; int dx, dy; double projectXoff, projectYoff; double maxy; int finaly; if (isInt) { xorgi = face->x; yorgi = face->y; } lw = pGC->lineWidth; dx = face->dx; dy = face->dy; k = face->k; if (dy == 0) { lefts[0].height = lw; lefts[0].x = xorgi; if (isLeft) lefts[0].x -= (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -lw; lefts[0].dx = 0; lefts[0].dy = lw; rights[0].height = lw; rights[0].x = xorgi; if (!isLeft) rights[0].x += (lw + 1 >> 1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -lw; rights[0].dx = 0; rights[0].dy = lw; miFillPolyHelper (pDrawable, pGC, pixel, spanData, yorgi - (lw >> 1), lw, lefts, rights, 1, 1); } else if (dx == 0) { topy = yorgi; bottomy = yorgi + dy; if (isLeft) topy -= (lw >> 1); else bottomy += (lw >> 1); lefts[0].height = bottomy - topy; lefts[0].x = xorgi - (lw >> 1); lefts[0].stepx = 0; lefts[0].signdx = 1; lefts[0].e = -dy; lefts[0].dx = dx; lefts[0].dy = dy; rights[0].height = bottomy - topy; rights[0].x = lefts[0].x + (lw-1); rights[0].stepx = 0; rights[0].signdx = 1; rights[0].e = -dy; rights[0].dx = dx; rights[0].dy = dy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottomy - topy, lefts, rights, 1, 1); } else { xa = face->xa; ya = face->ya; projectXoff = -ya; projectYoff = xa; if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } if (isLeft) { righty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, yorgi, dx > 0, top); bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, yorgi, dx < 0, bottom); maxy = -ya; } else { righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, xorgi, yorgi, 0, right); xa = -xa; ya = -ya; k = -k; lefty = miPolyBuildEdge (xa, ya, k, dx, dy, xorgi, yorgi, 1, left); if (dx > 0) { ya = -ya; xa = -xa; } xap = xa - projectXoff; yap = ya - projectYoff; topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, xorgi, xorgi, dx > 0, top); bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, xorgi, xorgi, dx < 0, bottom); maxy = -ya + projectYoff; } finaly = ICEIL(maxy) + yorgi; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } static void miWideSegment (pDrawable, pGC, pixel, spanData, x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace) DrawablePtr pDrawable; GCPtr pGC; unsigned long pixel; SpanDataPtr spanData; register int x1, y1, x2, y2; Bool projectLeft, projectRight; register LineFacePtr leftFace, rightFace; { double l, L, r; double xa, ya; double projectXoff, projectYoff; double k; double maxy; int x, y; int dx, dy; int finaly; PolyEdgePtr left, right; PolyEdgePtr top, bottom; int lefty, righty, topy, bottomy; int signdx; PolyEdgeRec lefts[2], rights[2]; LineFacePtr tface; int lw = pGC->lineWidth; /* draw top-to-bottom always */ if (y2 < y1 || y2 == y1 && x2 < x1) { x = x1; x1 = x2; x2 = x; y = y1; y1 = y2; y2 = y; x = projectLeft; projectLeft = projectRight; projectRight = x; tface = leftFace; leftFace = rightFace; rightFace = tface; } dy = y2 - y1; signdx = 1; dx = x2 - x1; if (dx < 0) signdx = -1; leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; if (dy == 0) { rightFace->xa = 0; rightFace->ya = (double) lw / 2.0; rightFace->k = -(double) (lw * dx) / 2.0; leftFace->xa = 0; leftFace->ya = -rightFace->ya; leftFace->k = rightFace->k; x = x1; if (projectLeft) x -= (lw >> 1); y = y1 - (lw >> 1); dx = x2 - x; if (projectRight) dx += (lw + 1 >> 1); dy = lw; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else if (dx == 0) { leftFace->xa = (double) lw / 2.0; leftFace->ya = 0; leftFace->k = (double) (lw * dy) / 2.0; rightFace->xa = -leftFace->xa; rightFace->ya = 0; rightFace->k = leftFace->k; y = y1; if (projectLeft) y -= lw >> 1; x = x1 - (lw >> 1); dy = y2 - y; if (projectRight) dy += (lw + 1 >> 1); dx = lw; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x, y, dx, dy); } else { l = ((double) lw) / 2.0; L = hypot ((double) dx, (double) dy); if (dx < 0) { right = &rights[1]; left = &lefts[0]; top = &rights[0]; bottom = &lefts[1]; } else { right = &rights[0]; left = &lefts[1]; top = &lefts[0]; bottom = &rights[1]; } r = l / L; /* coord of upper bound at integral y */ ya = -r * dx; xa = r * dy; if (projectLeft | projectRight) { projectXoff = -ya; projectYoff = xa; } /* xa * dy - ya * dx */ k = l * L; leftFace->xa = xa; leftFace->ya = ya; leftFace->k = k; rightFace->xa = -xa; rightFace->ya = -ya; rightFace->k = k; if (projectLeft) righty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 0, right); else righty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 0, right); /* coord of lower bound at integral y */ ya = -ya; xa = -xa; /* xa * dy - ya * dx */ k = - k; if (projectLeft) lefty = miPolyBuildEdge (xa - projectXoff, ya - projectYoff, k, dx, dy, x1, y1, 1, left); else lefty = miPolyBuildEdge (xa, ya, k, dx, dy, x1, y1, 1, left); /* coord of top face at integral y */ if (signdx > 0) { ya = -ya; xa = -xa; } if (projectLeft) { double xap = xa - projectXoff; double yap = ya - projectYoff; topy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x1, y1, dx > 0, top); } else topy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x1, y1, dx > 0, top); /* coord of bottom face at integral y */ if (projectRight) { double xap = xa + projectXoff; double yap = ya + projectYoff; bottomy = miPolyBuildEdge (xap, yap, xap * dx + yap * dy, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya + projectYoff; } else { bottomy = miPolyBuildEdge (xa, ya, 0.0, -dy, dx, x2, y2, dx < 0, bottom); maxy = -ya; } finaly = ICEIL (maxy) + y2; if (dx < 0) { left->height = bottomy - lefty; right->height = finaly - righty; top->height = righty - topy; } else { right->height = bottomy - righty; left->height = finaly - lefty; top->height = lefty - topy; } bottom->height = finaly - bottomy; miFillPolyHelper (pDrawable, pGC, pixel, spanData, topy, bottom->height + bottomy - topy, lefts, rights, 2, 2); } } SpanDataPtr miSetupSpanData (pGC, spanData, npt) register GCPtr pGC; SpanDataPtr spanData; int npt; { if (npt < 3 && pGC->capStyle != CapRound || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; if (pGC->lineStyle == LineDoubleDash) miInitSpanGroup (&spanData->bgGroup); miInitSpanGroup (&spanData->fgGroup); return spanData; } void miCleanupSpanData (pDrawable, pGC, spanData) DrawablePtr pDrawable; GCPtr pGC; SpanDataPtr spanData; { if (pGC->lineStyle == LineDoubleDash) { XID oldPixel, pixel; pixel = pGC->bgPixel; oldPixel = pGC->fgPixel; if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &pixel, FALSE); ValidateGC (pDrawable, pGC); } miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup); miFreeSpanGroup (&spanData->bgGroup); if (pixel != oldPixel) { DoChangeGC (pGC, GCForeground, &oldPixel, FALSE); ValidateGC (pDrawable, pGC); } } miFillUniqueSpanGroup (pDrawable, pGC, &spanData->fgGroup); miFreeSpanGroup (&spanData->fgGroup); } void miWideLine (pDrawable, pGC, mode, npt, pPts) DrawablePtr pDrawable; register GCPtr pGC; int mode; register int npt; register DDXPointPtr pPts; { int x1, y1, x2, y2; SpanDataRec spanDataRec; SpanDataPtr spanData; unsigned long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; register int first; Bool somethingDrawn = FALSE; Bool selfJoin; spanData = miSetupSpanData (pGC, &spanDataRec, npt); pixel = pGC->fgPixel; x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (npt > 1) { if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y) { selfJoin = TRUE; } } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && !selfJoin) projectRight = TRUE; miWideSegment (pDrawable, pGC, pixel, spanData, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); if (first) { if (selfJoin) firstFace = leftFace; else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint (pDrawable, pGC, pixel, spanData, x1, y1); else miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } } else { miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } prevRightFace = rightFace; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (selfJoin) miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); else if (pGC->capStyle == CapRound) { if (pGC->lineWidth == 1 && !spanData) miLineOnePoint (pDrawable, pGC, pixel, spanData, x2, y2); else miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } } /* handle crock where all points are coincedent */ if (!somethingDrawn) { projectLeft = pGC->capStyle == CapProjecting; miWideSegment (pDrawable, pGC, pixel, spanData, x2, y2, x2, y2, projectLeft, projectLeft, &leftFace, &rightFace); if (pGC->capStyle == CapRound) { miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); rightFace.dx = -1; /* sleezy hack to make it work */ miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } if (spanData) miCleanupSpanData (pDrawable, pGC, spanData); } #define V_TOP 0 #define V_RIGHT 1 #define V_BOTTOM 2 #define V_LEFT 3 static void miWideDashSegment (pDrawable, pGC, spanData, pDashOffset, pDashIndex, x1, y1, x2, y2, projectLeft, projectRight, leftFace, rightFace) DrawablePtr pDrawable; register GCPtr pGC; int *pDashOffset, *pDashIndex; SpanDataPtr spanData; int x1, y1, x2, y2; Bool projectLeft, projectRight; LineFacePtr leftFace, rightFace; { int dashIndex, dashRemain; unsigned char *pDash; double L, l; double k; PolyVertexRec vertices[4]; PolyVertexRec saveRight, saveBottom; PolySlopeRec slopes[4]; PolyEdgeRec left[2], right[2]; LineFaceRec lcapFace, rcapFace; int nleft, nright; int h; int y; int dy, dx; unsigned long pixel; double LRemain; double r; double rdx, rdy; double dashDx, dashDy; double saveK; Bool first = TRUE; double lcenterx, lcentery, rcenterx, rcentery; unsigned long fgPixel, bgPixel; dx = x2 - x1; dy = y2 - y1; dashIndex = *pDashIndex; pDash = pGC->dash; dashRemain = pDash[dashIndex] - *pDashOffset; fgPixel = pGC->fgPixel; bgPixel = pGC->bgPixel; if (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled) { bgPixel = fgPixel; } l = ((double) pGC->lineWidth) / 2.0; if (dx == 0) { L = dy; rdx = 0; rdy = l; if (dy < 0) { L = -dy; rdy = -l; } } else if (dy == 0) { L = dx; rdx = l; rdy = 0; if (dx < 0) { L = -dx; rdx = -l; } } else { L = hypot ((double) dx, (double) dy); r = l / L; rdx = r * dx; rdy = r * dy; } k = l * L; LRemain = L; /* All position comments are relative to a line with dx and dy > 0, * but the code does not depend on this */ /* top */ slopes[V_TOP].dx = dx; slopes[V_TOP].dy = dy; slopes[V_TOP].k = k; /* right */ slopes[V_RIGHT].dx = -dy; slopes[V_RIGHT].dy = dx; slopes[V_RIGHT].k = 0; /* bottom */ slopes[V_BOTTOM].dx = -dx; slopes[V_BOTTOM].dy = -dy; slopes[V_BOTTOM].k = k; /* left */ slopes[V_LEFT].dx = dy; slopes[V_LEFT].dy = -dx; slopes[V_LEFT].k = 0; /* preload the start coordinates */ vertices[V_RIGHT].x = vertices[V_TOP].x = rdy; vertices[V_RIGHT].y = vertices[V_TOP].y = -rdx; vertices[V_BOTTOM].x = vertices[V_LEFT].x = -rdy; vertices[V_BOTTOM].y = vertices[V_LEFT].y = rdx; if (projectLeft) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = rdx * dx + rdy * dy; } lcenterx = x1; lcentery = y1; if (pGC->capStyle == CapRound) { lcapFace.dx = dx; lcapFace.dy = dy; lcapFace.x = x1; lcapFace.y = y1; rcapFace.dx = -dx; rcapFace.dy = -dy; rcapFace.x = x1; rcapFace.y = y1; } while (LRemain > dashRemain) { dashDx = (dashRemain * dx) / L; dashDy = (dashRemain * dy) / L; rcenterx = lcenterx + dashDx; rcentery = lcentery + dashDy; vertices[V_RIGHT].x += dashDx; vertices[V_RIGHT].y += dashDy; vertices[V_BOTTOM].x += dashDx; vertices[V_BOTTOM].y += dashDy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * dx + vertices[V_RIGHT].y * dy; if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { if (pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { saveRight = vertices[V_RIGHT]; saveBottom = vertices[V_BOTTOM]; saveK = slopes[V_RIGHT].k; if (!first) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } y = miPolyBuildPoly (vertices, slopes, 4, x1, y1, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? bgPixel : fgPixel; miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (pGC->lineStyle == LineOnOffDash) { switch (pGC->capStyle) { case CapProjecting: vertices[V_BOTTOM] = saveBottom; vertices[V_RIGHT] = saveRight; slopes[V_RIGHT].k = saveK; break; case CapRound: if (!first) { if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc (pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, lcenterx, lcentery, FALSE); } if (dx < 0) { rcapFace.xa = vertices[V_BOTTOM].x; rcapFace.ya = vertices[V_BOTTOM].y; rcapFace.k = slopes[V_RIGHT].k; } else { rcapFace.xa = -vertices[V_RIGHT].x; rcapFace.ya = -vertices[V_RIGHT].y; rcapFace.k = -slopes[V_RIGHT].k; } miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rcapFace, rcenterx, rcentery, FALSE); break; } } } LRemain -= dashRemain; ++dashIndex; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; lcenterx = rcenterx; lcentery = rcentery; vertices[V_TOP] = vertices[V_RIGHT]; vertices[V_LEFT] = vertices[V_BOTTOM]; slopes[V_LEFT].k = -slopes[V_RIGHT].k; first = FALSE; } if (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1)) { vertices[V_TOP].x -= dx; vertices[V_TOP].y -= dy; vertices[V_LEFT].x -= dx; vertices[V_LEFT].y -= dy; vertices[V_RIGHT].x = rdy; vertices[V_RIGHT].y = -rdx; vertices[V_BOTTOM].x = -rdy; vertices[V_BOTTOM].y = rdx; if (projectRight) { vertices[V_RIGHT].x += rdx; vertices[V_RIGHT].y += rdy; vertices[V_BOTTOM].x += rdx; vertices[V_BOTTOM].y += rdy; slopes[V_RIGHT].k = vertices[V_RIGHT].x * slopes[V_RIGHT].dy - vertices[V_RIGHT].y * slopes[V_RIGHT].dx; } else slopes[V_RIGHT].k = 0; if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapProjecting) { vertices[V_TOP].x -= rdx; vertices[V_TOP].y -= rdy; vertices[V_LEFT].x -= rdx; vertices[V_LEFT].y -= rdy; slopes[V_LEFT].k = vertices[V_LEFT].x * slopes[V_LEFT].dy - vertices[V_LEFT].y * slopes[V_LEFT].dx; } else slopes[V_LEFT].k += dx * dx + dy * dy; y = miPolyBuildPoly (vertices, slopes, 4, x2, y2, left, right, &nleft, &nright, &h); pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, h, left, right, nleft, nright); if (!first && pGC->lineStyle == LineOnOffDash && pGC->capStyle == CapRound) { lcapFace.x = x2; lcapFace.y = y2; if (dx < 0) { lcapFace.xa = -vertices[V_LEFT].x; lcapFace.ya = -vertices[V_LEFT].y; lcapFace.k = slopes[V_LEFT].k; } else { lcapFace.xa = vertices[V_TOP].x; lcapFace.ya = vertices[V_TOP].y; lcapFace.k = -slopes[V_LEFT].k; } miLineArc (pDrawable, pGC, pixel, spanData, &lcapFace, (LineFacePtr) NULL, rcenterx, rcentery, FALSE); } } dashRemain = ((double) dashRemain) - LRemain; if (dashRemain == 0) { dashIndex++; if (dashIndex == pGC->numInDashList) dashIndex = 0; dashRemain = pDash[dashIndex]; } leftFace->x = x1; leftFace->y = y1; leftFace->dx = dx; leftFace->dy = dy; leftFace->xa = rdy; leftFace->ya = -rdx; leftFace->k = k; rightFace->x = x2; rightFace->y = y2; rightFace->dx = -dx; rightFace->dy = -dy; rightFace->xa = -rdy; rightFace->ya = rdx; rightFace->k = k; *pDashIndex = dashIndex; *pDashOffset = pDash[dashIndex] - dashRemain; } void miWideDash (pDrawable, pGC, mode, npt, pPts) DrawablePtr pDrawable; register GCPtr pGC; int mode; register int npt; register DDXPointPtr pPts; { int x1, y1, x2, y2; unsigned long pixel; Bool projectLeft, projectRight; LineFaceRec leftFace, rightFace, prevRightFace; LineFaceRec firstFace; int first; int dashIndex, dashOffset; register int prevDashIndex; SpanDataRec spanDataRec; SpanDataPtr spanData; Bool somethingDrawn = FALSE; Bool selfJoin; Bool endIsFg, startIsFg, firstIsFg = FALSE, prevIsFg; /* XXX backward compatibility */ if (pGC->lineWidth == 0) { miZeroDashLine (pDrawable, pGC, mode, npt, pPts); return; } if (pGC->lineStyle == LineDoubleDash && (pGC->fillStyle == FillOpaqueStippled || pGC->fillStyle == FillTiled)) { miWideLine (pDrawable, pGC, mode, npt, pPts); return; } if (npt == 0) return; spanData = miSetupSpanData (pGC, &spanDataRec, npt); x2 = pPts->x; y2 = pPts->y; first = TRUE; selfJoin = FALSE; if (mode == CoordModePrevious) { int nptTmp; DDXPointPtr pPtsTmp; x1 = x2; y1 = y2; nptTmp = npt; pPtsTmp = pPts + 1; while (--nptTmp) { x1 += pPtsTmp->x; y1 += pPtsTmp->y; ++pPtsTmp; } if (x2 == x1 && y2 == y1) selfJoin = TRUE; } else if (x2 == pPts[npt-1].x && y2 == pPts[npt-1].y) { selfJoin = TRUE; } projectLeft = pGC->capStyle == CapProjecting && !selfJoin; projectRight = FALSE; dashIndex = 0; dashOffset = 0; miStepDash ((int)pGC->dashOffset, &dashIndex, pGC->dash, (int)pGC->numInDashList, &dashOffset); while (--npt) { x1 = x2; y1 = y2; ++pPts; x2 = pPts->x; y2 = pPts->y; if (mode == CoordModePrevious) { x2 += x1; y2 += y1; } if (x1 != x2 || y1 != y2) { somethingDrawn = TRUE; if (npt == 1 && pGC->capStyle == CapProjecting && (!selfJoin || !firstIsFg)) projectRight = TRUE; prevDashIndex = dashIndex; miWideDashSegment (pDrawable, pGC, spanData, &dashOffset, &dashIndex, x1, y1, x2, y2, projectLeft, projectRight, &leftFace, &rightFace); startIsFg = !(prevDashIndex & 1); endIsFg = (dashIndex & 1) ^ (dashOffset != 0); if (pGC->lineStyle == LineDoubleDash || startIsFg) { pixel = startIsFg ? pGC->fgPixel : pGC->bgPixel; if (first || (pGC->lineStyle == LineOnOffDash && !prevIsFg)) { if (first && selfJoin) { firstFace = leftFace; firstIsFg = startIsFg; } else if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, &leftFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } else { miLineJoin (pDrawable, pGC, pixel, spanData, &leftFace, &prevRightFace); } } prevRightFace = rightFace; prevIsFg = endIsFg; first = FALSE; projectLeft = FALSE; } if (npt == 1 && somethingDrawn) { if (pGC->lineStyle == LineDoubleDash || endIsFg) { pixel = endIsFg ? pGC->fgPixel : pGC->bgPixel; if (selfJoin && (pGC->lineStyle == LineDoubleDash || firstIsFg)) { miLineJoin (pDrawable, pGC, pixel, spanData, &firstFace, &rightFace); } else { if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, &rightFace, (double)0.0, (double)0.0, TRUE); } } else { /* glue a cap to the start of the line if * we're OnOffDash and ended on odd dash */ if (selfJoin && firstIsFg) { pixel = pGC->fgPixel; if (pGC->capStyle == CapProjecting) miLineProjectingCap (pDrawable, pGC, pixel, spanData, &firstFace, TRUE, (double)0.0, (double)0.0, TRUE); else if (pGC->capStyle == CapRound) miLineArc (pDrawable, pGC, pixel, spanData, &firstFace, (LineFacePtr) NULL, (double)0.0, (double)0.0, TRUE); } } } } /* handle crock where all points are coincident */ if (!somethingDrawn && (pGC->lineStyle == LineDoubleDash || !(dashIndex & 1))) { /* not the same as endIsFg computation above */ pixel = (dashIndex & 1) ? pGC->bgPixel : pGC->fgPixel; switch (pGC->capStyle) { case CapRound: miLineArc (pDrawable, pGC, pixel, spanData, (LineFacePtr) NULL, (LineFacePtr) NULL, (double)x2, (double)y2, FALSE); break; case CapProjecting: x1 = pGC->lineWidth; miFillRectPolyHelper (pDrawable, pGC, pixel, spanData, x2 - (x1 >> 1), y2 - (x1 >> 1), x1, x1); break; } } if (spanData) miCleanupSpanData (pDrawable, pGC, spanData); } /* these are stubs to allow old ddx ValidateGCs to work without change */ void miMiter() { } void miNotMiter() { } vnc_unixsrc/Xvnc/programs/Xserver/mi/mivaltree.c0100664000076400007640000005214407120677563021462 0ustar constconst/* $XConsortium: mivaltree.c,v 5.33 94/04/17 20:27:58 dpw Exp $ */ /* * mivaltree.c -- * Functions for recalculating window clip lists. Main function * is miValidateTree. * Copyright (c) 1987, 1988, 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Copyright 1987, 1988, 1989 by * Digital Equipment Corporation, Maynard, Massachusetts, * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and that * both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Digital not be * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. * * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * ******************************************************************/ /* * Aug '86: Susan Angebranndt -- original code * July '87: Adam de Boor -- substantially modified and commented * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible. * In particular, much improved code for window mapping and * circulating. * Bob Scheifler -- avoid miComputeClips for unmapped windows, * valdata changes */ #include "X.h" #include "scrnintstr.h" #include "validate.h" #include "windowstr.h" #include "mi.h" #include "regionstr.h" #include "mivalidate.h" #ifdef SHAPE /* * Compute the visibility of a shaped window */ miShapedWindowIn (pScreen, universe, bounding, rect, x, y) ScreenPtr pScreen; RegionPtr universe, bounding; BoxPtr rect; register int x, y; { BoxRec box; register BoxPtr boundBox; int nbox; Bool someIn, someOut; register int t, x1, y1, x2, y2; nbox = REGION_NUM_RECTS (bounding); boundBox = REGION_RECTS (bounding); someIn = someOut = FALSE; x1 = rect->x1; y1 = rect->y1; x2 = rect->x2; y2 = rect->y2; while (nbox--) { if ((t = boundBox->x1 + x) < x1) t = x1; box.x1 = t; if ((t = boundBox->y1 + y) < y1) t = y1; box.y1 = t; if ((t = boundBox->x2 + x) > x2) t = x2; box.x2 = t; if ((t = boundBox->y2 + y) > y2) t = y2; box.y2 = t; if (box.x1 > box.x2) box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; switch (RECT_IN_REGION(pScreen, universe, &box)) { case rgnIN: if (someOut) return rgnPART; someIn = TRUE; break; case rgnOUT: if (someIn) return rgnPART; someOut = TRUE; break; default: return rgnPART; } boundBox++; } if (someIn) return rgnIN; return rgnOUT; } #endif #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ HasBorder(w) && \ (w)->backgroundState == ParentRelative) /*- *----------------------------------------------------------------------- * miComputeClips -- * Recompute the clipList, borderClip, exposed and borderExposed * regions for pParent and its children. Only viewable windows are * taken into account. * * Results: * None. * * Side Effects: * clipList, borderClip, exposed and borderExposed are altered. * A VisibilityNotify event may be generated on the parent window. * *----------------------------------------------------------------------- */ static void miComputeClips (pParent, pScreen, universe, kind, exposed) register WindowPtr pParent; register ScreenPtr pScreen; register RegionPtr universe; VTKind kind; RegionPtr exposed; /* for intermediate calculations */ { int dx, dy; RegionRec childUniverse; register WindowPtr pChild; int oldVis, newVis; BoxRec borderSize; RegionRec childUnion; Bool overlap; RegionPtr borderVisible; Bool resized; /* * Figure out the new visibility of this window. * The extent of the universe should be the same as the extent of * the borderSize region. If the window is unobscured, this rectangle * will be completely inside the universe (the universe will cover it * completely). If the window is completely obscured, none of the * universe will cover the rectangle. */ borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); if (dx > 32767) dx = 32767; borderSize.x2 = dx; dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); if (dy > 32767) dy = 32767; borderSize.y2 = dy; oldVis = pParent->visibility; switch (RECT_IN_REGION( pScreen, universe, &borderSize)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnPART: newVis = VisibilityPartiallyObscured; #ifdef SHAPE { RegionPtr pBounding; if ((pBounding = wBoundingShape (pParent))) { switch (miShapedWindowIn (pScreen, universe, pBounding, &borderSize, pParent->drawable.x, pParent->drawable.y)) { case rgnIN: newVis = VisibilityUnobscured; break; case rgnOUT: newVis = VisibilityFullyObscured; break; } } } #endif break; default: newVis = VisibilityFullyObscured; break; } pParent->visibility = newVis; if (oldVis != newVis && ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) SendVisibilityNotify(pParent); dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; /* * avoid computations when dealing with simple operations */ switch (kind) { case VTMap: case VTStack: case VTUnmap: break; case VTMove: if ((oldVis == newVis) && ((oldVis == VisibilityFullyObscured) || (oldVis == VisibilityUnobscured))) { pChild = pParent; while (1) { if (pChild->viewable) { if (pChild->visibility != VisibilityFullyObscured) { REGION_TRANSLATE( pScreen, &pChild->borderClip, dx, dy); REGION_TRANSLATE( pScreen, &pChild->clipList, dx, dy); pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pChild, dx, dy); } if (pChild->valdata) { REGION_INIT(pScreen, &pChild->valdata->after.borderExposed, NullBox, 0); if (HasParentRelativeBorder(pChild)) { REGION_SUBTRACT(pScreen, &pChild->valdata->after.borderExposed, &pChild->borderClip, &pChild->winSize); } REGION_INIT( pScreen, &pChild->valdata->after.exposed, NullBox, 0); } if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } return; } /* fall through */ default: /* * To calculate exposures correctly, we have to translate the old * borderClip and clipList regions to the window's new location so there * is a correspondence between pieces of the new and old clipping regions. */ if (dx || dy) { /* * We translate the old clipList because that will be exposed or copied * if gravity is right. */ REGION_TRANSLATE( pScreen, &pParent->borderClip, dx, dy); REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy); } break; } borderVisible = pParent->valdata->before.borderVisible; resized = pParent->valdata->before.resized; REGION_INIT( pScreen, &pParent->valdata->after.borderExposed, NullBox, 0); REGION_INIT( pScreen, &pParent->valdata->after.exposed, NullBox, 0); /* * Since the borderClip must not be clipped by the children, we do * the border exposure first... * * 'universe' is the window's borderClip. To figure the exposures, remove * the area that used to be exposed from the new. * This leaves a region of pieces that weren't exposed before. */ if (HasBorder (pParent)) { if (borderVisible) { /* * when the border changes shape, the old visible portions * of the border will be saved by DIX in borderVisible -- * use that region and destroy it */ REGION_SUBTRACT( pScreen, exposed, universe, borderVisible); REGION_DESTROY( pScreen, borderVisible); } else { REGION_SUBTRACT( pScreen, exposed, universe, &pParent->borderClip); } if (HasParentRelativeBorder(pParent) && (dx || dy)) REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, universe, &pParent->winSize); else REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, exposed, &pParent->winSize); REGION_COPY( pScreen, &pParent->borderClip, universe); /* * To get the right clipList for the parent, and to make doubly sure * that no child overlaps the parent's border, we remove the parent's * border from the universe before proceeding. */ REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize); } else REGION_COPY( pScreen, &pParent->borderClip, universe); if ((pChild = pParent->firstChild) && pParent->mapped) { REGION_INIT(pScreen, &childUniverse, NullBox, 0); REGION_INIT(pScreen, &childUnion, NullBox, 0); if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { for (; pChild; pChild = pChild->nextSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } else { for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) { if (pChild->viewable) REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); } } REGION_VALIDATE( pScreen, &childUnion, &overlap); for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->viewable) { /* * If the child is viewable, we want to remove its extents * from the current universe, but we only re-clip it if * it's been marked. */ if (pChild->valdata) { /* * Figure out the new universe from the child's * perspective and recurse. */ REGION_INTERSECT( pScreen, &childUniverse, universe, &pChild->borderSize); miComputeClips (pChild, pScreen, &childUniverse, kind, exposed); } /* * Once the child has been processed, we remove its extents * from the current universe, thus denying its space to any * other sibling. */ if (overlap) REGION_SUBTRACT( pScreen, universe, universe, &pChild->borderSize); } } if (!overlap) REGION_SUBTRACT( pScreen, universe, universe, &childUnion); REGION_UNINIT( pScreen, &childUnion); REGION_UNINIT( pScreen, &childUniverse); } /* if any children */ /* * 'universe' now contains the new clipList for the parent window. * * To figure the exposure of the window we subtract the old clip from the * new, just as for the border. */ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) { REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe); } else if (newVis != VisibilityFullyObscured && newVis != VisibilityNotViewable) { REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, universe, &pParent->clipList); } /* * One last thing: backing storage. We have to try to save what parts of * the window are about to be obscured. We can just subtract the universe * from the old clipList and get the areas that were in the old but aren't * in the new and, hence, are about to be obscured. */ if (pParent->backStorage && !resized) { REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe); (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); } /* HACK ALERT - copying contents of regions, instead of regions */ { RegionRec tmp; tmp = pParent->clipList; pParent->clipList = *universe; *universe = tmp; } #ifdef NOTDEF REGION_COPY( pScreen, &pParent->clipList, universe); #endif pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pParent, dx, dy); } static void miTreeObscured(pParent) register WindowPtr pParent; { register WindowPtr pChild; register int oldVis; pChild = pParent; while (1) { if (pChild->viewable) { oldVis = pChild->visibility; if (oldVis != (pChild->visibility = VisibilityFullyObscured) && ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) SendVisibilityNotify(pChild); if (pChild->firstChild) { pChild = pChild->firstChild; continue; } } while (!pChild->nextSib && (pChild != pParent)) pChild = pChild->parent; if (pChild == pParent) break; pChild = pChild->nextSib; } } /*- *----------------------------------------------------------------------- * miValidateTree -- * Recomputes the clip list for pParent and all its inferiors. * * Results: * Always returns 1. * * Side Effects: * The clipList, borderClip, exposed, and borderExposed regions for * each marked window are altered. * * Notes: * This routine assumes that all affected windows have been marked * (valdata created) and their winSize and borderSize regions * adjusted to correspond to their new positions. The borderClip and * clipList regions should not have been touched. * * The top-most level is treated differently from all lower levels * because pParent is unchanged. For the top level, we merge the * regions taken up by the marked children back into the clipList * for pParent, thus forming a region from which the marked children * can claim their areas. For lower levels, where the old clipList * and borderClip are invalid, we can't do this and have to do the * extra operations done in miComputeClips, but this is much faster * e.g. when only one child has moved... * *----------------------------------------------------------------------- */ /*ARGSUSED*/ int miValidateTree (pParent, pChild, kind) WindowPtr pParent; /* Parent to validate */ WindowPtr pChild; /* First child of pParent that was * affected */ VTKind kind; /* What kind of configuration caused call */ { RegionRec totalClip; /* Total clipping region available to * the marked children. pParent's clipList * merged with the borderClips of all * the marked children. */ RegionRec childClip; /* The new borderClip for the current * child */ RegionRec childUnion; /* the space covered by borderSize for * all marked children */ RegionRec exposed; /* For intermediate calculations */ register ScreenPtr pScreen; register WindowPtr pWin; Bool overlap; int viewvals; Bool forward; pScreen = pParent->drawable.pScreen; if (pChild == NullWindow) pChild = pParent->firstChild; REGION_INIT(pScreen, &childClip, NullBox, 0); REGION_INIT(pScreen, &exposed, NullBox, 0); /* * compute the area of the parent window occupied * by the marked children + the parent itself. This * is the area which can be divied up among the marked * children in their new configuration. */ REGION_INIT(pScreen, &totalClip, NullBox, 0); viewvals = 0; if ((pChild->drawable.y < pParent->lastChild->drawable.y) || ((pChild->drawable.y == pParent->lastChild->drawable.y) && (pChild->drawable.x < pParent->lastChild->drawable.x))) { forward = TRUE; for (pWin = pChild; pWin; pWin = pWin->nextSib) { if (pWin->valdata) { REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); if (pWin->viewable) viewvals++; } } } else { forward = FALSE; pWin = pParent->lastChild; while (1) { if (pWin->valdata) { REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); if (pWin->viewable) viewvals++; } if (pWin == pChild) break; pWin = pWin->prevSib; } } REGION_VALIDATE( pScreen, &totalClip, &overlap); /* * Now go through the children of the root and figure their new * borderClips from the totalClip, passing that off to miComputeClips * to handle recursively. Once that's done, we remove the child * from the totalClip to clip any siblings below it. */ overlap = TRUE; if (kind != VTStack) { REGION_UNION( pScreen, &totalClip, &totalClip, &pParent->clipList); if (viewvals > 1) { /* * precompute childUnion to discover whether any of them * overlap. This seems redundant, but performance studies * have demonstrated that the cost of this loop is * lower than the cost of multiple Subtracts in the * loop below. */ REGION_INIT(pScreen, &childUnion, NullBox, 0); if (forward) { for (pWin = pChild; pWin; pWin = pWin->nextSib) if (pWin->valdata && pWin->viewable) REGION_APPEND( pScreen, &childUnion, &pWin->borderSize); } else { pWin = pParent->lastChild; while (1) { if (pWin->valdata && pWin->viewable) REGION_APPEND( pScreen, &childUnion, &pWin->borderSize); if (pWin == pChild) break; pWin = pWin->prevSib; } } REGION_VALIDATE(pScreen, &childUnion, &overlap); if (overlap) REGION_UNINIT(pScreen, &childUnion); } } for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) { if (pWin->viewable) { if (pWin->valdata) { REGION_INTERSECT( pScreen, &childClip, &totalClip, &pWin->borderSize); miComputeClips (pWin, pScreen, &childClip, kind, &exposed); if (overlap) { REGION_SUBTRACT( pScreen, &totalClip, &totalClip, &pWin->borderSize); } } else if (pWin->visibility == VisibilityNotViewable) { miTreeObscured(pWin); } } else { if (pWin->valdata) { REGION_EMPTY( pScreen, &pWin->clipList); if (pScreen->ClipNotify) (* pScreen->ClipNotify) (pWin, 0, 0); REGION_EMPTY( pScreen, &pWin->borderClip); pWin->valdata = (ValidatePtr)NULL; } } } REGION_UNINIT( pScreen, &childClip); if (!overlap) { REGION_SUBTRACT(pScreen, &totalClip, &totalClip, &childUnion); REGION_UNINIT(pScreen, &childUnion); } REGION_INIT( pScreen, &pParent->valdata->after.exposed, NullBox, 0); REGION_INIT( pScreen, &pParent->valdata->after.borderExposed, NullBox, 0); /* * each case below is responsible for updating the * clipList and serial number for the parent window */ switch (kind) { case VTStack: break; default: /* * totalClip contains the new clipList for the parent. Figure out * exposures and obscures as per miComputeClips and reset the parent's * clipList. */ REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, &totalClip, &pParent->clipList); /* fall through */ case VTMap: if (pParent->backStorage) { REGION_SUBTRACT( pScreen, &exposed, &pParent->clipList, &totalClip); (* pScreen->SaveDoomedAreas)(pParent, &exposed, 0, 0); } REGION_COPY( pScreen, &pParent->clipList, &totalClip); pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; break; } REGION_UNINIT( pScreen, &totalClip); REGION_UNINIT( pScreen, &exposed); if (pScreen->ClipNotify) (*pScreen->ClipNotify) (pParent, 0, 0); return (1); } vnc_unixsrc/Xvnc/programs/Xserver/mi/mipushpxl.c0100664000076400007640000001356407120677563021526 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: mipushpxl.c,v 5.5 94/04/17 20:27:47 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.1 1996/12/09 12:02:49 dawes Exp $ */ #include "X.h" #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "miscstruct.h" #include "../mfb/maskbits.h" #define NPT 128 /* miPushPixels -- squeegees the fill style of pGC through pBitMap * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit * is set in the bitmap, the fill style is put onto the drawable using * the GC's logical function. The drawable is not changed where the bitmap * has a zero bit or outside the area covered by the stencil. WARNING: this code works if the 1-bit deep pixmap format returned by GetSpans is the same as the format defined by the mfb code (i.e. 32-bit padding per scanline, scanline unit = 32 bits; later, this might mean bitsizeof(int) padding and sacnline unit == bitsizeof(int).) */ void miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int dx, dy, xOrg, yOrg; { int h, dxDivPPW, ibEnd; unsigned long *pwLineStart; register unsigned long *pw, *pwEnd; register unsigned long msk; register int ib, w; register int ipt; /* index into above arrays */ Bool fInBox; DDXPointRec pt[NPT], ptThisLine; int width[NPT]; pwLineStart = (unsigned long *)xalloc(BitmapBytePad(dx)); if (!pwLineStart) return; ipt = 0; dxDivPPW = dx/PPW; for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0; h < dy; h++, ptThisLine.y++) { (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx, &ptThisLine, &dx, 1, (char *)pwLineStart); pw = pwLineStart; /* Process all words which are fully in the pixmap */ fInBox = FALSE; pwEnd = pwLineStart + dxDivPPW; while(pw < pwEnd) { w = *pw; msk = endtab[1]; for(ib = 0; ib < PPW; ib++) { if(w & msk) { if(!fInBox) { pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; /* start new box */ fInBox = TRUE; } } else { if(fInBox) { width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } /* end box */ fInBox = FALSE; } } msk = SCRRIGHT(msk, 1); } pw++; } ibEnd = dx & PIM; if(ibEnd) { /* Process final partial word on line */ w = *pw; msk = endtab[1]; for(ib = 0; ib < ibEnd; ib++) { if(w & msk) { if(!fInBox) { /* start new box */ pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; pt[ipt].y = h + yOrg; fInBox = TRUE; } } else { if(fInBox) { /* end box */ width[ipt] = ((pw - pwLineStart) << PWSH) + ib + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } fInBox = FALSE; } } msk = SCRRIGHT(msk, 1); } } /* If scanline ended with last bit set, end the box */ if(fInBox) { width[ipt] = dx + xOrg - pt[ipt].x; if (++ipt >= NPT) { (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); ipt = 0; } } } xfree(pwLineStart); /* Flush any remaining spans */ if (ipt) { (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); } } vnc_unixsrc/Xvnc/programs/Xserver/mi/miarc.c0100664000076400007640000024776707624731532020602 0ustar constconst/*********************************************************** Copyright (c) 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* $XConsortium: miarc.c /main/90 1996/08/01 19:25:10 dpw $ */ /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ /* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.4.2.1 1997/07/13 14:45:05 dawes Exp $ */ #ifdef _XOPEN_SOURCE #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */ #include #undef _XOPEN_SOURCE #endif #include "X.h" #include "Xprotostr.h" #include "misc.h" #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "windowstr.h" #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" #include "Xfuncproto.h" static double miDsin(), miDcos(), miDasin(), miDatan2(); double cbrt( #if NeedFunctionPrototypes double #endif ); #ifdef ICEILTEMPDECL ICEILTEMPDECL #endif /* * some interesting sematic interpretation of the protocol: * * Self intersecting arcs (i.e. those spanning 360 degrees) * never join with other arcs, and are drawn without caps * (unless on/off dashed, in which case each dash segment * is capped, except when the last segment meets the * first segment, when no caps are drawn) * * double dash arcs are drawn in two parts, first the * odd dashes (drawn in background) then the even dashes * (drawn in foreground). This means that overlapping * sections of foreground/background are drawn twice, * first in background then in foreground. The double-draw * occurs even when the function uses the destination values * (e.g. xor mode). This is the same way the wide-line * code works and should be "fixed". * */ #undef max #undef min #if defined (__GNUC__) && defined (__STDC__) && !defined (__STRICT_ANSI__) #define USE_INLINE #endif #ifdef USE_INLINE __inline static const int max (const int x, const int y) { return x>y? x:y; } __inline static const int min (const int x, const int y) { return xy? x:y; } static int min (x, y) { return xlineWidth; int a0, a1, startAngle, endAngle; miArcFacePtr temp; if (!l) l = 1; if (tarc.width == 0 || tarc.height == 0) { drawZeroArc (pDraw, pGC, &tarc, l, left, right); return; } if (pGC->miTranslate) { tarc.x += pDraw->x; tarc.y += pDraw->y; } a0 = tarc.angle1; a1 = tarc.angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; if (a1 < 0) { startAngle = a0 + a1; endAngle = a0; temp = right; right = left; left = temp; } else { startAngle = a0; endAngle = a0 + a1; } /* * bounds check the two angles */ if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; if (endAngle < 0) endAngle = FULLCIRCLE - (-endAngle) % FULLCIRCLE; if (endAngle > FULLCIRCLE) endAngle = (endAngle-1) % FULLCIRCLE + 1; if ((startAngle == endAngle) && a1) { startAngle = 0; endAngle = FULLCIRCLE; } drawArc (&tarc, l, startAngle, endAngle, right, left); } /* Three equations combine to describe the boundaries of the arc x^2/w^2 + y^2/h^2 = 1 ellipse itself (X-x)^2 + (Y-y)^2 = r^2 circle at (x, y) on the ellipse (Y-y) = (X-x)*w^2*y/(h^2*x) normal at (x, y) on the ellipse These lead to a quartic relating Y and y y^4 - (2Y)y^3 + (Y^2 + (h^4 - w^2*r^2)/(w^2 - h^2))y^2 - (2Y*h^4/(w^2 - h^2))y + (Y^2*h^4)/(w^2 - h^2) = 0 The reducible cubic obtained from this quartic is z^3 - (3N)z^2 - 2V = 0 where N = (Y^2 + (h^4 - w^2*r^2/(w^2 - h^2)))/6 V = w^2*r^2*Y^2*h^4/(4 *(w^2 - h^2)^2) Let t = z - N p = -N^2 q = -N^3 - V Then we get t^3 + 3pt + 2q = 0 The discriminant of this cubic is D = q^2 + p^3 When D > 0, a real root is obtained as z = N + cbrt(-q+sqrt(D)) + cbrt(-q-sqrt(D)) When D < 0, a real root is obtained as z = N - 2m*cos(acos(-q/m^3)/3) where m = sqrt(|p|) * sign(q) Given a real root Z of the cubic, the roots of the quartic are the roots of the two quadratics y^2 + ((b+A)/2)y + (Z + (bZ - d)/A) = 0 where A = +/- sqrt(8Z + b^2 - 4c) b, c, d are the cubic, quadratic, and linear coefficients of the quartic Some experimentation is then required to determine which solutions correspond to the inner and outer boundaries. */ typedef struct { short lx, lw, rx, rw; } miArcSpan; typedef struct { miArcSpan *spans; int count1, count2, k; char top, bot, hole; } miArcSpanData; typedef struct { unsigned long lrustamp; unsigned short lw; unsigned short width, height; miArcSpanData *spdata; } arcCacheRec; #define CACHESIZE 25 static arcCacheRec arcCache[CACHESIZE]; static unsigned long lrustamp; static arcCacheRec *lastCacheHit = &arcCache[0]; static RESTYPE cacheType; /* * External so it can be called when low on memory. * Call with a zero ID in that case. */ /*ARGSUSED*/ int miFreeArcCache (data, id) pointer data; XID id; { int k; arcCacheRec *cent; if (id) cacheType = 0; for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++) { if (cent->spdata) { cent->lrustamp = 0; cent->lw = 0; xfree(cent->spdata); cent->spdata = NULL; } } lrustamp = 0; return Success; } static void miComputeCircleSpans(lw, parc, spdata) int lw; xArc *parc; miArcSpanData *spdata; { register miArcSpan *span; int doinner; register int x, y, e; int xk, yk, xm, ym, dx, dy; register int slw, inslw; int inx, iny, ine; int inxk, inyk, inxm, inym; doinner = -lw; slw = parc->width - doinner; y = parc->height >> 1; dy = parc->height & 1; dx = 1 - dy; MIWIDEARCSETUP(x, y, dy, slw, e, xk, xm, yk, ym); inslw = parc->width + doinner; if (inslw > 0) { spdata->hole = spdata->top; MIWIDEARCSETUP(inx, iny, dy, inslw, ine, inxk, inxm, inyk, inym); } else { spdata->hole = FALSE; doinner = -y; } spdata->count1 = -doinner - spdata->top; spdata->count2 = y + doinner; span = spdata->spans; while (y) { MIFILLARCSTEP(slw); span->lx = dy - x; if (++doinner <= 0) { span->lw = slw; span->rx = 0; span->rw = span->lx + slw; } else { MIFILLINARCSTEP(inslw); span->lw = x - inx; span->rx = dy - inx + inslw; span->rw = inx - x + slw - inslw; } span++; } if (spdata->bot) { if (spdata->count2) spdata->count2--; else { if (lw > (int)parc->height) span[-1].rx = span[-1].rw = -((lw - (int)parc->height) >> 1); else span[-1].rw = 0; spdata->count1--; } } } static void miComputeEllipseSpans(lw, parc, spdata) int lw; xArc *parc; miArcSpanData *spdata; { register miArcSpan *span; double w, h, r, xorg; double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, inx, outx, hepp, hepm; int flip, solution; w = (double)parc->width / 2.0; h = (double)parc->height / 2.0; r = lw / 2.0; rs = r * r; Hs = h * h; WH = w * w - Hs; Nk = w * r; Vk = (Nk * Hs) / (WH + WH); Hf = Hs * Hs; Nk = (Hf - Nk * Nk) / WH; Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; K = h + ((lw - 1) >> 1); span = spdata->spans; if (parc->width & 1) xorg = .5; else xorg = 0.0; if (spdata->top) { span->lx = 0; span->lw = 1; span++; } spdata->count1 = 0; spdata->count2 = 0; spdata->hole = (spdata->top && (int)parc->height * lw <= (int)(parc->width * parc->width) && lw < (int)parc->height); for (; K > 0.0; K -= 1.0) { N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ( (b < 0.0) == (t < 0.0) ) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ( (Z < 0.0) == (Vr < 0.0) ) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; inx = 0.0; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 2) inx = x - t; else outx = x + t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) inx = x - sqrt(rs - (t * t)); else inx = x; } y = (b - d) / 2; if (y >= 0.0) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; if (flip == 1) inx = x - t; else outx = x + t; } } span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { spdata->count1++; span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { spdata->count2++; span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } span++; } if (spdata->bot) { outx = w + r; if (r >= h && r <= w) inx = 0.0; else if (Nk < 0.0 && -Nk < Hs) { inx = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); if (inx > w - r) inx = w - r; } else inx = w - r; span->lx = ICEIL(xorg - outx); if (inx <= 0.0) { span->lw = ICEIL(xorg + outx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = -ICEIL(xorg - inx); } else { span->lw = ICEIL(xorg - inx) - span->lx; span->rx = ICEIL(xorg + inx); span->rw = ICEIL(xorg + outx) - span->rx; } } if (spdata->hole) { span = &spdata->spans[spdata->count1]; span->lw = -span->lx; span->rx = 1; span->rw = span->lw; spdata->count1--; spdata->count2++; } } static double tailX(K, def, bounds, acc) double K; struct arc_def *def; struct arc_bound *bounds; struct accelerators *acc; { double w, h, r; double Hs, Hf, WH, Vk, Nk, Fk, Vr, N, Nc, Z, rs; double A, T, b, d, x, y, t, hepp, hepm; int flip, solution; double xs[2]; double *xp; w = def->w; h = def->h; r = def->l; rs = r * r; Hs = acc->h2; WH = -acc->h2mw2; Nk = def->w * r; Vk = (Nk * Hs) / (WH + WH); Hf = acc->h4; Nk = (Hf - Nk * Nk) / WH; if (K == 0.0) { if (Nk < 0.0 && -Nk < Hs) { xs[0] = w * sqrt(1 + Nk / Hs) - sqrt(rs + Nk); xs[1] = w - r; if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; return xs[0]; } return w - r; } Fk = Hf / WH; hepp = h + EPSILON; hepm = h - EPSILON; N = (K * K + Nk) / 6.0; Nc = N * N * N; Vr = Vk * K; xp = xs; xs[0] = 0.0; t = Nc + Vr * Vr; d = Nc + t; if (d < 0.0) { d = Nc; b = N; if ( (b < 0.0) == (t < 0.0) ) { b = -b; d = -d; } Z = N - 2.0 * b * cos(acos(-t / d) / 3.0); if ( (Z < 0.0) == (Vr < 0.0) ) flip = 2; else flip = 1; } else { d = Vr * sqrt(d); Z = N + cbrt(t + d) + cbrt(t - d); flip = 0; } A = sqrt((Z + Z) - Nk); T = (Fk - Z) * K / A; solution = FALSE; b = -A + K; d = b * b - 4 * (Z + T); if (d >= 0 && flip == 2) { d = sqrt(d); y = (b + d) / 2; if ((y >= 0.0) && (y < hepp)) { solution = TRUE; if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } b = A + K; d = b * b - 4 * (Z - T); /* Because of the large magnitudes involved, we lose enough precision * that sometimes we end up with a negative value near the axis, when * it should be positive. This is a workaround. */ if (d < 0 && !solution) d = 0.0; if (d >= 0) { d = sqrt(d); y = (b + d) / 2; if (y < hepp) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) *xp++ = x - sqrt(rs - (t * t)); else *xp++ = x; } y = (b - d) / 2; if (y >= 0.0 && flip == 1) { if (y > hepm) y = h; t = y / h; x = w * sqrt(1 - (t * t)); t = K - y; if (rs - (t * t) >= 0) t = sqrt(rs - (t * t)); else t = 0; *xp++ = x - t; } } if (xp > &xs[1]) { if (acc->left.valid && boundedLe(K, bounds->left) && !boundedLe(K, bounds->outer) && xs[0] >= 0.0 && xs[1] >= 0.0) return xs[1]; if (acc->right.valid && boundedLe(K, bounds->right) && !boundedLe(K, bounds->inner) && xs[0] <= 0.0 && xs[1] <= 0.0) return xs[1]; } return xs[0]; } static miArcSpanData * miComputeWideEllipse(lw, parc, mustFree) int lw; register xArc *parc; Bool *mustFree; { register miArcSpanData *spdata; register arcCacheRec *cent, *lruent; register int k; arcCacheRec fakeent; if (!lw) lw = 1; if (parc->height <= 1500) { *mustFree = FALSE; cent = lastCacheHit; if (cent->lw == lw && cent->width == parc->width && cent->height == parc->height) { cent->lrustamp = ++lrustamp; return cent->spdata; } lruent = &arcCache[0]; for (k = CACHESIZE, cent = lruent; --k >= 0; cent++) { if (cent->lw == lw && cent->width == parc->width && cent->height == parc->height) { cent->lrustamp = ++lrustamp; lastCacheHit = cent; return cent->spdata; } if (cent->lrustamp < lruent->lrustamp) lruent = cent; } if (!cacheType) { cacheType = CreateNewResourceType(miFreeArcCache); (void) AddResource(FakeClientID(0), cacheType, NULL); } } else { lruent = &fakeent; lruent->spdata = NULL; *mustFree = TRUE; } k = (parc->height >> 1) + ((lw - 1) >> 1); spdata = lruent->spdata; if (!spdata || spdata->k != k) { if (spdata) xfree(spdata); spdata = (miArcSpanData *)xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2)); lruent->spdata = spdata; if (!spdata) { lruent->lrustamp = 0; lruent->lw = 0; return spdata; } spdata->spans = (miArcSpan *)(spdata + 1); spdata->k = k; } spdata->top = !(lw & 1) && !(parc->width & 1); spdata->bot = !(parc->height & 1); lruent->lrustamp = ++lrustamp; lruent->lw = lw; lruent->width = parc->width; lruent->height = parc->height; if (lruent != &fakeent) lastCacheHit = lruent; if (parc->width == parc->height) miComputeCircleSpans(lw, parc, spdata); else miComputeEllipseSpans(lw, parc, spdata); return spdata; } static void miFillWideEllipse(pDraw, pGC, parc) DrawablePtr pDraw; GCPtr pGC; xArc *parc; { DDXPointPtr points; register DDXPointPtr pts; int *widths; register int *wids; miArcSpanData *spdata; Bool mustFree; register miArcSpan *span; register int xorg, yorgu, yorgl; register int n; yorgu = parc->height + pGC->lineWidth; n = (sizeof(int) * 2) * yorgu; widths = (int *)ALLOCATE_LOCAL(n + (sizeof(DDXPointRec) * 2) * yorgu); if (!widths) return; points = (DDXPointPtr)((char *)widths + n); spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree); if (!spdata) { DEALLOCATE_LOCAL(widths); return; } pts = points; wids = widths; span = spdata->spans; xorg = parc->x + (parc->width >> 1); yorgu = parc->y + (parc->height >> 1); yorgl = yorgu + (parc->height & 1); if (pGC->miTranslate) { xorg += pDraw->x; yorgu += pDraw->y; yorgl += pDraw->y; } yorgu -= spdata->k; yorgl += spdata->k; if (spdata->top) { pts->x = xorg; pts->y = yorgu - 1; pts++; *wids++ = 1; span++; } for (n = spdata->count1; --n >= 0; ) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = pts[0].x; pts[1].y = yorgl; wids[1] = wids[0]; yorgu++; yorgl--; pts += 2; wids += 2; span++; } if (spdata->hole) { pts[0].x = xorg; pts[0].y = yorgl; wids[0] = 1; pts++; wids++; } for (n = spdata->count2; --n >= 0; ) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts[2].x = pts[0].x; pts[2].y = yorgl; wids[2] = wids[0]; pts[3].x = pts[1].x; pts[3].y = pts[2].y; wids[3] = wids[1]; yorgu++; yorgl--; pts += 4; wids += 4; span++; } if (spdata->bot) { if (span->rw <= 0) { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts++; wids++; } else { pts[0].x = xorg + span->lx; pts[0].y = yorgu; wids[0] = span->lw; pts[1].x = xorg + span->rx; pts[1].y = pts[0].y; wids[1] = span->rw; pts += 2; wids += 2; } } if (mustFree) xfree(spdata); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); DEALLOCATE_LOCAL(widths); } /* * miPolyArc strategy: * * If arc is zero width and solid, we don't have to worry about the rasterop * or join styles. For wide solid circles, we use a fast integer algorithm. * For wide solid ellipses, we use special case floating point code. * Otherwise, we set up pDrawTo and pGCTo according to the rasterop, then * draw using pGCTo and pDrawTo. If the raster-op was "tricky," that is, * if it involves the destination, then we use PushPixels to move the bits * from the scratch drawable to pDraw. (See the wide line code for a * fuller explanation of this.) */ void miPolyArc(pDraw, pGC, narcs, parcs) DrawablePtr pDraw; GCPtr pGC; int narcs; xArc *parcs; { register int i; xArc *parc; int xMin, xMax, yMin, yMax; int pixmapWidth, pixmapHeight; int xOrg, yOrg; int width; Bool fTricky; DrawablePtr pDrawTo; CARD32 fg, bg; GCPtr pGCTo; miPolyArcPtr polyArcs; int cap[2], join[2]; int iphase; int halfWidth; width = pGC->lineWidth; if(width == 0 && pGC->lineStyle == LineSolid) { for(i = narcs, parc = parcs; --i >= 0; parc++) miArcSegment( pDraw, pGC, *parc, (miArcFacePtr) 0, (miArcFacePtr) 0 ); fillSpans (pDraw, pGC); } else { if ((pGC->lineStyle == LineSolid) && narcs) { while (parcs->width && parcs->height && (parcs->angle2 >= FULLCIRCLE || parcs->angle2 <= -FULLCIRCLE)) { miFillWideEllipse(pDraw, pGC, parcs); if (!--narcs) return; parcs++; } } /* Set up pDrawTo and pGCTo based on the rasterop */ switch(pGC->alu) { case GXclear: /* 0 */ case GXcopy: /* src */ case GXcopyInverted: /* NOT src */ case GXset: /* 1 */ fTricky = FALSE; pDrawTo = pDraw; pGCTo = pGC; break; default: fTricky = TRUE; /* find bounding box around arcs */ xMin = yMin = MAXSHORT; xMax = yMax = MINSHORT; for(i = narcs, parc = parcs; --i >= 0; parc++) { xMin = min (xMin, parc->x); yMin = min (yMin, parc->y); xMax = max (xMax, (parc->x + (int) parc->width)); yMax = max (yMax, (parc->y + (int) parc->height)); } /* expand box to deal with line widths */ halfWidth = (width + 1)/2; xMin -= halfWidth; yMin -= halfWidth; xMax += halfWidth; yMax += halfWidth; /* compute pixmap size; limit it to size of drawable */ xOrg = max(xMin, 0); yOrg = max(yMin, 0); pixmapWidth = min(xMax, pDraw->width) - xOrg; pixmapHeight = min(yMax, pDraw->height) - yOrg; /* if nothing left, return */ if ( (pixmapWidth <= 0) || (pixmapHeight <= 0) ) return; for(i = narcs, parc = parcs; --i >= 0; parc++) { parc->x -= xOrg; parc->y -= yOrg; } if (pGC->miTranslate) { xOrg += pDraw->x; yOrg += pDraw->y; } /* set up scratch GC */ pGCTo = GetScratchGC(1, pDraw->pScreen); if (!pGCTo) return; gcvals[GCValsFunction] = GXcopy; gcvals[GCValsForeground] = 1; gcvals[GCValsBackground] = 0; gcvals[GCValsLineWidth] = pGC->lineWidth; gcvals[GCValsCapStyle] = pGC->capStyle; gcvals[GCValsJoinStyle] = pGC->joinStyle; dixChangeGC(NullClient, pGCTo, GCValsMask, gcvals, NULL); /* allocate a 1 bit deep pixmap of the appropriate size, and * validate it */ pDrawTo = (DrawablePtr)(*pDraw->pScreen->CreatePixmap) (pDraw->pScreen, pixmapWidth, pixmapHeight, 1); if (!pDrawTo) { FreeScratchGC(pGCTo); return; } ValidateGC(pDrawTo, pGCTo); miClearDrawable(pDrawTo, pGCTo); } fg = pGC->fgPixel; bg = pGC->bgPixel; if ((pGC->fillStyle == FillTiled) || (pGC->fillStyle == FillOpaqueStippled)) bg = fg; /* the protocol sez these don't cause color changes */ polyArcs = miComputeArcs (parcs, narcs, pGC); if (!polyArcs) { if (fTricky) { (*pDraw->pScreen->DestroyPixmap) ((PixmapPtr)pDrawTo); FreeScratchGC (pGCTo); } return; } cap[0] = cap[1] = 0; join[0] = join[1] = 0; for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); iphase >= 0; iphase--) { if (iphase == 1) { dixChangeGC (NullClient, pGC, GCForeground, &bg, NULL); ValidateGC (pDraw, pGC); } else if (pGC->lineStyle == LineDoubleDash) { dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL); ValidateGC (pDraw, pGC); } for (i = 0; i < polyArcs[iphase].narcs; i++) { miArcDataPtr arcData; arcData = &polyArcs[iphase].arcs[i]; miArcSegment(pDrawTo, pGCTo, arcData->arc, &arcData->bounds[RIGHT_END], &arcData->bounds[LEFT_END]); if (polyArcs[iphase].arcs[i].render) { fillSpans (pDrawTo, pGCTo); /* * don't cap self-joining arcs */ if (polyArcs[iphase].arcs[i].selfJoin && cap[iphase] < polyArcs[iphase].arcs[i].cap) cap[iphase]++; while (cap[iphase] < polyArcs[iphase].arcs[i].cap) { int arcIndex, end; miArcDataPtr arcData0; arcIndex = polyArcs[iphase].caps[cap[iphase]].arcIndex; end = polyArcs[iphase].caps[cap[iphase]].end; arcData0 = &polyArcs[iphase].arcs[arcIndex]; miArcCap (pDrawTo, pGCTo, &arcData0->bounds[end], end, arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0); ++cap[iphase]; } while (join[iphase] < polyArcs[iphase].arcs[i].join) { int arcIndex0, arcIndex1, end0, end1; int phase0, phase1; miArcDataPtr arcData0, arcData1; miArcJoinPtr joinp; joinp = &polyArcs[iphase].joins[join[iphase]]; arcIndex0 = joinp->arcIndex0; end0 = joinp->end0; arcIndex1 = joinp->arcIndex1; end1 = joinp->end1; phase0 = joinp->phase0; phase1 = joinp->phase1; arcData0 = &polyArcs[phase0].arcs[arcIndex0]; arcData1 = &polyArcs[phase1].arcs[arcIndex1]; miArcJoin (pDrawTo, pGCTo, &arcData0->bounds[end0], &arcData1->bounds[end1], arcData0->arc.x, arcData0->arc.y, (double) arcData0->arc.width / 2.0, (double) arcData0->arc.height / 2.0, arcData1->arc.x, arcData1->arc.y, (double) arcData1->arc.width / 2.0, (double) arcData1->arc.height / 2.0); ++join[iphase]; } if (fTricky) { if (pGC->serialNumber != pDraw->serialNumber) ValidateGC (pDraw, pGC); (*pGC->ops->PushPixels) (pGC, (PixmapPtr)pDrawTo, pDraw, pixmapWidth, pixmapHeight, xOrg, yOrg); miClearDrawable ((DrawablePtr) pDrawTo, pGCTo); } } } } miFreeArcs(polyArcs, pGC); if(fTricky) { (*pGCTo->pScreen->DestroyPixmap)((PixmapPtr)pDrawTo); FreeScratchGC(pGCTo); } } } static double angleBetween (center, point1, point2) SppPointRec center, point1, point2; { double a1, a2, a; /* * reflect from X coordinates back to ellipse * coordinates -- y increasing upwards */ a1 = miDatan2 (- (point1.y - center.y), point1.x - center.x); a2 = miDatan2 (- (point2.y - center.y), point2.x - center.x); a = a2 - a1; if (a <= -180.0) a += 360.0; else if (a > 180.0) a -= 360.0; return a; } static void translateBounds (b, x, y, fx, fy) miArcFacePtr b; int x, y; double fx, fy; { fx += x; fy += y; b->clock.x -= fx; b->clock.y -= fy; b->center.x -= fx; b->center.y -= fy; b->counterClock.x -= fx; b->counterClock.y -= fy; } static void miArcJoin (pDraw, pGC, pLeft, pRight, xOrgLeft, yOrgLeft, xFtransLeft, yFtransLeft, xOrgRight, yOrgRight, xFtransRight, yFtransRight) DrawablePtr pDraw; GCPtr pGC; miArcFacePtr pRight, pLeft; int xOrgRight, yOrgRight; double xFtransRight, yFtransRight; int xOrgLeft, yOrgLeft; double xFtransLeft, yFtransLeft; { SppPointRec center, corner, otherCorner; SppPointRec poly[5], e; SppPointPtr pArcPts; int cpt; SppArcRec arc; miArcFaceRec Right, Left; int polyLen; int xOrg, yOrg; double xFtrans, yFtrans; double a; double ae, ac2, ec2, bc2, de; double width; xOrg = (xOrgRight + xOrgLeft) / 2; yOrg = (yOrgRight + yOrgLeft) / 2; xFtrans = (xFtransLeft + xFtransRight) / 2; yFtrans = (yFtransLeft + yFtransRight) / 2; Right = *pRight; translateBounds (&Right, xOrg - xOrgRight, yOrg - yOrgRight, xFtrans - xFtransRight, yFtrans - yFtransRight); Left = *pLeft; translateBounds (&Left, xOrg - xOrgLeft, yOrg - yOrgLeft, xFtrans - xFtransLeft, yFtrans - yFtransLeft); pRight = &Right; pLeft = &Left; if (pRight->clock.x == pLeft->counterClock.x && pRight->clock.y == pLeft->counterClock.y) return; center = pRight->center; if (0 <= (a = angleBetween (center, pRight->clock, pLeft->counterClock)) && a <= 180.0) { corner = pRight->clock; otherCorner = pLeft->counterClock; } else { a = angleBetween (center, pLeft->clock, pRight->counterClock); corner = pLeft->clock; otherCorner = pRight->counterClock; } switch (pGC->joinStyle) { case JoinRound: width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1); arc.x = center.x - width/2; arc.y = center.y - width/2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x); arc.angle2 = a; pArcPts = (SppPointPtr) xalloc (3 * sizeof (SppPointRec)); if (!pArcPts) return; pArcPts[0].x = otherCorner.x; pArcPts[0].y = otherCorner.y; pArcPts[1].x = center.x; pArcPts[1].y = center.y; pArcPts[2].x = corner.x; pArcPts[2].y = corner.y; if( (cpt = miGetArcPts(&arc, 3, &pArcPts)) ) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans); } xfree(pArcPts); return; case JoinMiter: /* * don't miter arcs with less than 11 degrees between them */ if (a < 169.0) { poly[0] = corner; poly[1] = center; poly[2] = otherCorner; bc2 = (corner.x - otherCorner.x) * (corner.x - otherCorner.x) + (corner.y - otherCorner.y) * (corner.y - otherCorner.y); ec2 = bc2 / 4; ac2 = (corner.x - center.x) * (corner.x - center.x) + (corner.y - center.y) * (corner.y - center.y); ae = sqrt (ac2 - ec2); de = ec2 / ae; e.x = (corner.x + otherCorner.x) / 2; e.y = (corner.y + otherCorner.y) / 2; poly[3].x = e.x + de * (e.x - center.x) / ae; poly[3].y = e.y + de * (e.y - center.y) / ae; poly[4] = corner; polyLen = 5; break; } case JoinBevel: poly[0] = corner; poly[1] = center; poly[2] = otherCorner; poly[3] = corner; polyLen = 4; break; } miFillSppPoly (pDraw, pGC, polyLen, poly, xOrg, yOrg, xFtrans, yFtrans); } /*ARGSUSED*/ static void miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans) DrawablePtr pDraw; GCPtr pGC; miArcFacePtr pFace; int end; int xOrg, yOrg; double xFtrans, yFtrans; { SppPointRec corner, otherCorner, center, endPoint, poly[5]; corner = pFace->clock; otherCorner = pFace->counterClock; center = pFace->center; switch (pGC->capStyle) { case CapProjecting: poly[0].x = otherCorner.x; poly[0].y = otherCorner.y; poly[1].x = corner.x; poly[1].y = corner.y; poly[2].x = corner.x - (center.y - corner.y); poly[2].y = corner.y + (center.x - corner.x); poly[3].x = otherCorner.x - (otherCorner.y - center.y); poly[3].y = otherCorner.y + (otherCorner.x - center.x); poly[4].x = otherCorner.x; poly[4].y = otherCorner.y; miFillSppPoly (pDraw, pGC, 5, poly, xOrg, yOrg, xFtrans, yFtrans); break; case CapRound: /* * miRoundCap just needs these to be unequal. */ endPoint = center; endPoint.x = endPoint.x + 100; miRoundCap (pDraw, pGC, center, endPoint, corner, otherCorner, 0, -xOrg, -yOrg, xFtrans, yFtrans); break; } } /* MIROUNDCAP -- a private helper function * Put Rounded cap on end. pCenter is the center of this end of the line * pEnd is the center of the other end of the line. pCorner is one of the * two corners at this end of the line. * NOTE: pOtherCorner must be counter-clockwise from pCorner. */ /*ARGSUSED*/ static void miRoundCap(pDraw, pGC, pCenter, pEnd, pCorner, pOtherCorner, fLineEnd, xOrg, yOrg, xFtrans, yFtrans) DrawablePtr pDraw; GCPtr pGC; SppPointRec pCenter, pEnd; SppPointRec pCorner, pOtherCorner; int fLineEnd, xOrg, yOrg; double xFtrans, yFtrans; { int cpt; double width; double miDatan2 (); SppArcRec arc; SppPointPtr pArcPts; width = (pGC->lineWidth ? (double)pGC->lineWidth : (double)1); arc.x = pCenter.x - width/2; arc.y = pCenter.y - width/2; arc.width = width; arc.height = width; arc.angle1 = -miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x); if(PTISEQUAL(pCenter, pEnd)) arc.angle2 = - 180.0; else { arc.angle2 = -miDatan2 (pOtherCorner.y - pCenter.y, pOtherCorner.x - pCenter.x) - arc.angle1; if (arc.angle2 < 0) arc.angle2 += 360.0; } pArcPts = (SppPointPtr) NULL; if( (cpt = miGetArcPts(&arc, 0, &pArcPts)) ) { /* by drawing with miFillSppPoly and setting the endpoints of the arc * to be the corners, we assure that the cap will meet up with the * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans); } xfree(pArcPts); } /* * To avoid inaccuracy at the cardinal points, use trig functions * which are exact for those angles */ #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #ifndef M_PI_2 #define M_PI_2 1.57079632679489661923 #endif # define Dsin(d) ((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0))) # define Dcos(d) ((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0))) # define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) static double miDcos (a) double a; { int i; if (floor (a/90) == a/90) { i = (int) (a/90.0); switch (mod (i, 4)) { case 0: return 1; case 1: return 0; case 2: return -1; case 3: return 0; } } return cos (a * M_PI / 180.0); } static double miDsin (a) double a; { int i; if (floor (a/90) == a/90) { i = (int) (a/90.0); switch (mod (i, 4)) { case 0: return 0; case 1: return 1; case 2: return 0; case 3: return -1; } } return sin (a * M_PI / 180.0); } static double miDasin (v) double v; { if (v == 0) return 0.0; if (v == 1.0) return 90.0; if (v == -1.0) return -90.0; return asin(v) * (180.0 / M_PI); } static double miDatan2 (dy, dx) double dy, dx; { if (dy == 0) { if (dx >= 0) return 0.0; return 180.0; } else if (dx == 0) { if (dy > 0) return 90.0; return -90.0; } else if (Fabs (dy) == Fabs (dx)) { if (dy > 0) { if (dx > 0) return 45.0; return 135.0; } else { if (dx > 0) return 315.0; return 225.0; } } else { return atan2 (dy, dx) * (180.0 / M_PI); } } /* MIGETARCPTS -- Converts an arc into a set of line segments -- a helper * routine for filled arc and line (round cap) code. * Returns the number of points in the arc. Note that it takes a pointer * to a pointer to where it should put the points and an index (cpt). * This procedure allocates the space necessary to fit the arc points. * Sometimes it's convenient for those points to be at the end of an existing * array. (For example, if we want to leave a spare point to make sectors * instead of segments.) So we pass in the xalloc()ed chunk that contains the * array and an index saying where we should start stashing the points. * If there isn't an array already, we just pass in a null pointer and * count on xrealloc() to handle the null pointer correctly. */ static int miGetArcPts(parc, cpt, ppPts) SppArcPtr parc; /* points to an arc */ int cpt; /* number of points already in arc list */ SppPointPtr *ppPts; /* pointer to pointer to arc-list -- modified */ { double st, /* Start Theta, start angle */ et, /* End Theta, offset from start theta */ dt, /* Delta Theta, angle to sweep ellipse */ cdt, /* Cos Delta Theta, actually 2 cos(dt) */ x0, y0, /* the recurrence formula needs two points to start */ x1, y1, x2, y2, /* this will be the new point generated */ xc, yc; /* the center point */ int count, i; SppPointPtr poly; DDXPointRec last; /* last point on integer boundaries */ /* The spec says that positive angles indicate counterclockwise motion. * Given our coordinate system (with 0,0 in the upper left corner), * the screen appears flipped in Y. The easiest fix is to negate the * angles given */ st = - parc->angle1; et = - parc->angle2; /* Try to get a delta theta that is within 1/2 pixel. Then adjust it * so that it divides evenly into the total. * I'm just using cdt 'cause I'm lazy. */ cdt = parc->width; if (parc->height > cdt) cdt = parc->height; cdt /= 2.0; if(cdt <= 0) return 0; if (cdt < 1.0) cdt = 1.0; dt = miDasin ( 1.0 / cdt ); /* minimum step necessary */ count = et/dt; count = abs(count) + 1; dt = et/count; count++; cdt = 2 * miDcos(dt); if (!(poly = (SppPointPtr) xrealloc((pointer)*ppPts, (cpt + count) * sizeof(SppPointRec)))) return(0); *ppPts = poly; xc = parc->width/2.0; /* store half width and half height */ yc = parc->height/2.0; x0 = xc * miDcos(st); y0 = yc * miDsin(st); x1 = xc * miDcos(st + dt); y1 = yc * miDsin(st + dt); xc += parc->x; /* by adding initial point, these become */ yc += parc->y; /* the center point */ poly[cpt].x = (xc + x0); poly[cpt].y = (yc + y0); last.x = ROUNDTOINT( poly[cpt + 1].x = (xc + x1) ); last.y = ROUNDTOINT( poly[cpt + 1].y = (yc + y1) ); for(i = 2; i < count; i++) { x2 = cdt * x1 - x0; y2 = cdt * y1 - y0; poly[cpt + i].x = (xc + x2); poly[cpt + i].y = (yc + y2); x0 = x1; y0 = y1; x1 = x2; y1 = y2; } /* adjust the last point */ if (abs(parc->angle2) >= 360.0) poly[cpt +i -1] = poly[0]; else { poly[cpt +i -1].x = (miDcos(st + et) * parc->width/2.0 + xc); poly[cpt +i -1].y = (miDsin(st + et) * parc->height/2.0 + yc); } return(count); } struct arcData { double x0, y0, x1, y1; int selfJoin; }; # define ADD_REALLOC_STEP 20 static void addCap (capsp, ncapsp, sizep, end, arcIndex) miArcCapPtr *capsp; int *ncapsp, *sizep; int end, arcIndex; { int newsize; miArcCapPtr cap; if (*ncapsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; cap = (miArcCapPtr) xrealloc (*capsp, newsize * sizeof (**capsp)); if (!cap) return; *sizep = newsize; *capsp = cap; } cap = &(*capsp)[*ncapsp]; cap->end = end; cap->arcIndex = arcIndex; ++*ncapsp; } static void addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1) miArcJoinPtr *joinsp; int *njoinsp, *sizep; int end0, index0, phase0, end1, index1, phase1; { int newsize; miArcJoinPtr join; if (*njoinsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; join = (miArcJoinPtr) xrealloc (*joinsp, newsize * sizeof (**joinsp)); if (!join) return; *sizep = newsize; *joinsp = join; } join = &(*joinsp)[*njoinsp]; join->end0 = end0; join->arcIndex0 = index0; join->phase0 = phase0; join->end1 = end1; join->arcIndex1 = index1; join->phase1 = phase1; ++*njoinsp; } static miArcDataPtr addArc (arcsp, narcsp, sizep, xarc) miArcDataPtr *arcsp; int *narcsp, *sizep; xArc *xarc; { int newsize; miArcDataPtr arc; if (*narcsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; arc = (miArcDataPtr) xrealloc (*arcsp, newsize * sizeof (**arcsp)); if (!arc) return (miArcDataPtr)NULL; *sizep = newsize; *arcsp = arc; } arc = &(*arcsp)[*narcsp]; arc->arc = *xarc; ++*narcsp; return arc; } static void miFreeArcs(arcs, pGC) miPolyArcPtr arcs; GCPtr pGC; { int iphase; for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); iphase >= 0; iphase--) { if (arcs[iphase].narcs > 0) xfree(arcs[iphase].arcs); if (arcs[iphase].njoins > 0) xfree(arcs[iphase].joins); if (arcs[iphase].ncaps > 0) xfree(arcs[iphase].caps); } xfree(arcs); } /* * map angles to radial distance. This only deals with the first quadrant */ /* * a polygonal approximation to the arc for computing arc lengths */ # define DASH_MAP_SIZE 91 # define dashIndexToAngle(di) ((((double) (di)) * 90.0) / ((double) DASH_MAP_SIZE - 1)) # define xAngleToDashIndex(xa) ((((long) (xa)) * (DASH_MAP_SIZE - 1)) / (90 * 64)) # define dashIndexToXAngle(di) ((((long) (di)) * (90 * 64)) / (DASH_MAP_SIZE - 1)) # define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1))) typedef struct { double map[DASH_MAP_SIZE]; } dashMap; static void computeDashMap (arcp, map) xArc *arcp; dashMap *map; { int di; double a, x, y, prevx, prevy, dist; for (di = 0; di < DASH_MAP_SIZE; di++) { a = dashIndexToAngle (di); x = ((double) arcp->width / 2.0) * miDcos (a); y = ((double) arcp->height / 2.0) * miDsin (a); if (di == 0) { map->map[di] = 0.0; } else { dist = hypot (x - prevx, y - prevy); map->map[di] = map->map[di - 1] + dist; } prevx = x; prevy = y; } } typedef enum {HORIZONTAL, VERTICAL, OTHER} arcTypes; /* this routine is a bit gory */ static miPolyArcPtr miComputeArcs (parcs, narcs, pGC) xArc *parcs; int narcs; GCPtr pGC; { int isDashed, isDoubleDash; int dashOffset; miPolyArcPtr arcs; int start, i, j, k, nexti, nextk; int joinSize[2]; int capSize[2]; int arcSize[2]; int angle2; double a0, a1; struct arcData *data; miArcDataPtr arc; xArc xarc; int iphase, prevphase, joinphase; int arcsJoin; int selfJoin; int iDash, dashRemaining; int iDashStart, dashRemainingStart, iphaseStart; int startAngle, spanAngle, endAngle, backwards; int prevDashAngle, dashAngle; dashMap map; isDashed = !(pGC->lineStyle == LineSolid); isDoubleDash = (pGC->lineStyle == LineDoubleDash); dashOffset = pGC->dashOffset; data = (struct arcData *) ALLOCATE_LOCAL (narcs * sizeof (struct arcData)); if (!data) return (miPolyArcPtr)NULL; arcs = (miPolyArcPtr) xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1)); if (!arcs) { DEALLOCATE_LOCAL(data); return (miPolyArcPtr)NULL; } for (i = 0; i < narcs; i++) { a0 = todeg (parcs[i].angle1); angle2 = parcs[i].angle2; if (angle2 > FULLCIRCLE) angle2 = FULLCIRCLE; else if (angle2 < -FULLCIRCLE) angle2 = -FULLCIRCLE; data[i].selfJoin = angle2 == FULLCIRCLE || angle2 == -FULLCIRCLE; a1 = todeg (parcs[i].angle1 + angle2); data[i].x0 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a0)); data[i].y0 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a0)); data[i].x1 = parcs[i].x + (double) parcs[i].width / 2 * (1 + miDcos (a1)); data[i].y1 = parcs[i].y + (double) parcs[i].height / 2 * (1 - miDsin (a1)); } for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) { arcs[iphase].njoins = 0; arcs[iphase].joins = 0; joinSize[iphase] = 0; arcs[iphase].ncaps = 0; arcs[iphase].caps = 0; capSize[iphase] = 0; arcs[iphase].narcs = 0; arcs[iphase].arcs = 0; arcSize[iphase] = 0; } iphase = 0; if (isDashed) { iDash = 0; dashRemaining = pGC->dash[0]; while (dashOffset > 0) { if (dashOffset >= dashRemaining) { dashOffset -= dashRemaining; iphase = iphase ? 0 : 1; iDash++; if (iDash == pGC->numInDashList) iDash = 0; dashRemaining = pGC->dash[iDash]; } else { dashRemaining -= dashOffset; dashOffset = 0; } } iDashStart = iDash; dashRemainingStart = dashRemaining; } iphaseStart = iphase; for (i = narcs - 1; i >= 0; i--) { j = i + 1; if (j == narcs) j = 0; if (data[i].selfJoin || i == j || (UNEQUAL (data[i].x1, data[j].x0) || UNEQUAL (data[i].y1, data[j].y0))) { if (iphase == 0 || isDoubleDash) addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, 0); break; } } start = i + 1; if (start == narcs) start = 0; i = start; for (;;) { j = i + 1; if (j == narcs) j = 0; nexti = i+1; if (nexti == narcs) nexti = 0; if (isDashed) { /* ** deal with dashed arcs. Use special rules for certain 0 area arcs. ** Presumably, the other 0 area arcs still aren't done right. */ arcTypes arcType = OTHER; CARD16 thisLength; if (parcs[i].height == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x2d00 && parcs[i].angle2 == 0x2d00) arcType = HORIZONTAL; else if (parcs[i].width == 0 && (parcs[i].angle1 % FULLCIRCLE) == 0x1680 && parcs[i].angle2 == 0x2d00) arcType = VERTICAL; if (arcType == OTHER) { /* * precompute an approximation map */ computeDashMap (&parcs[i], &map); /* * compute each individual dash segment using the path * length function */ startAngle = parcs[i].angle1; spanAngle = parcs[i].angle2; if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; else if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; if (startAngle < 0) startAngle = FULLCIRCLE - (-startAngle) % FULLCIRCLE; if (startAngle >= FULLCIRCLE) startAngle = startAngle % FULLCIRCLE; endAngle = startAngle + spanAngle; backwards = spanAngle < 0; } else { xarc = parcs[i]; if (arcType == VERTICAL) { xarc.angle1 = 0x1680; startAngle = parcs[i].y; endAngle = startAngle + parcs[i].height; } else { xarc.angle1 = 0x2d00; startAngle = parcs[i].x; endAngle = startAngle + parcs[i].width; } } dashAngle = startAngle; selfJoin = data[i].selfJoin && (iphase == 0 || isDoubleDash); /* * add dashed arcs to each bucket */ arc = 0; while (dashAngle != endAngle) { prevDashAngle = dashAngle; if (arcType == OTHER) { dashAngle = computeAngleFromPath (prevDashAngle, endAngle, &map, &dashRemaining, backwards); /* avoid troubles with huge arcs and small dashes */ if (dashAngle == prevDashAngle) { if (backwards) dashAngle--; else dashAngle++; } } else { thisLength = (dashAngle + dashRemaining <= endAngle) ? dashRemaining : endAngle - dashAngle; if (arcType == VERTICAL) { xarc.y = dashAngle; xarc.height = thisLength; } else { xarc.x = dashAngle; xarc.width = thisLength; } dashAngle += thisLength; dashRemaining -= thisLength; } if (iphase == 0 || isDoubleDash) { if (arcType == OTHER) { xarc = parcs[i]; spanAngle = prevDashAngle; if (spanAngle < 0) spanAngle = FULLCIRCLE - (-spanAngle) % FULLCIRCLE; if (spanAngle >= FULLCIRCLE) spanAngle = spanAngle % FULLCIRCLE; xarc.angle1 = spanAngle; spanAngle = dashAngle - prevDashAngle; if (backwards) { if (dashAngle > prevDashAngle) spanAngle = - FULLCIRCLE + spanAngle; } else { if (dashAngle < prevDashAngle) spanAngle = FULLCIRCLE + spanAngle; } if (spanAngle > FULLCIRCLE) spanAngle = FULLCIRCLE; if (spanAngle < -FULLCIRCLE) spanAngle = -FULLCIRCLE; xarc.angle2 = spanAngle; } arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &xarc); if (!arc) goto arcfail; /* * cap each end of an on/off dash */ if (!isDoubleDash) { if (prevDashAngle != startAngle) { addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, arc - arcs[iphase].arcs); } if (dashAngle != endAngle) { addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], LEFT_END, arc - arcs[iphase].arcs); } } arc->cap = arcs[iphase].ncaps; arc->join = arcs[iphase].njoins; arc->render = 0; arc->selfJoin = 0; if (dashAngle == endAngle) arc->selfJoin = selfJoin; } prevphase = iphase; if (dashRemaining <= 0) { ++iDash; if (iDash == pGC->numInDashList) iDash = 0; iphase = iphase ? 0:1; dashRemaining = pGC->dash[iDash]; } } /* * make sure a place exists for the position data when * drawing a zero-length arc */ if (startAngle == endAngle) { prevphase = iphase; if (!isDoubleDash && iphase == 1) prevphase = 0; arc = addArc (&arcs[prevphase].arcs, &arcs[prevphase].narcs, &arcSize[prevphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[prevphase].njoins; arc->cap = arcs[prevphase].ncaps; arc->selfJoin = data[i].selfJoin; } } else { arc = addArc (&arcs[iphase].arcs, &arcs[iphase].narcs, &arcSize[iphase], &parcs[i]); if (!arc) goto arcfail; arc->join = arcs[iphase].njoins; arc->cap = arcs[iphase].ncaps; arc->selfJoin = data[i].selfJoin; prevphase = iphase; } if (prevphase == 0 || isDoubleDash) k = arcs[prevphase].narcs - 1; if (iphase == 0 || isDoubleDash) nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; if (isDashed) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } } arcsJoin = narcs > 1 && i != j && ISEQUAL (data[i].x1, data[j].x0) && ISEQUAL (data[i].y1, data[j].y0) && !data[i].selfJoin && !data[j].selfJoin; if (arc) { if (arcsJoin) arc->render = 0; else arc->render = 1; } if (arcsJoin && (prevphase == 0 || isDoubleDash) && (iphase == 0 || isDoubleDash)) { joinphase = iphase; if (isDoubleDash) { if (nexti == start) joinphase = iphaseStart; /* * if the join is right at the dash, * draw the join in foreground * This is because the foreground * arcs are computed second, the results * of which are needed to draw the join */ if (joinphase != prevphase) joinphase = 0; } if (joinphase == 0 || isDoubleDash) { addJoin (&arcs[joinphase].joins, &arcs[joinphase].njoins, &joinSize[joinphase], LEFT_END, k, prevphase, RIGHT_END, nextk, iphase); arc->join = arcs[prevphase].njoins; } } else { /* * cap the left end of this arc * unless it joins itself */ if ((prevphase == 0 || isDoubleDash) && !arc->selfJoin) { addCap (&arcs[prevphase].caps, &arcs[prevphase].ncaps, &capSize[prevphase], LEFT_END, k); arc->cap = arcs[prevphase].ncaps; } if (isDashed && !arcsJoin) { iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } nextk = arcs[iphase].narcs; if (nexti == start) { nextk = 0; iDash = iDashStart; iphase = iphaseStart; dashRemaining = dashRemainingStart; } /* * cap the right end of the next arc. If the * next arc is actually the first arc, only * cap it if it joins with this arc. This * case will occur when the final dash segment * of an on/off dash is off. Of course, this * cap will be drawn at a strange time, but that * hardly matters... */ if ((iphase == 0 || isDoubleDash) && (nexti != start || (arcsJoin && isDashed))) addCap (&arcs[iphase].caps, &arcs[iphase].ncaps, &capSize[iphase], RIGHT_END, nextk); } i = nexti; if (i == start) break; } /* * make sure the last section is rendered */ for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) if (arcs[iphase].narcs > 0) { arcs[iphase].arcs[arcs[iphase].narcs-1].render = 1; arcs[iphase].arcs[arcs[iphase].narcs-1].join = arcs[iphase].njoins; arcs[iphase].arcs[arcs[iphase].narcs-1].cap = arcs[iphase].ncaps; } DEALLOCATE_LOCAL(data); return arcs; arcfail: miFreeArcs(arcs, pGC); DEALLOCATE_LOCAL(data); return (miPolyArcPtr)NULL; } static double angleToLength (angle, map) int angle; dashMap *map; { double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen; int di; int excess; Bool oddSide = FALSE; totallen = 0; if (angle >= 0) { while (angle >= 90 * 64) { angle -= 90 * 64; totallen += sidelen; oddSide = !oddSide; } } else { while (angle < 0) { angle += 90 * 64; totallen -= sidelen; oddSide = !oddSide; } } if (oddSide) angle = 90 * 64 - angle; di = xAngleToDashIndex (angle); excess = angle - dashIndexToXAngle (di); len = map->map[di]; /* * linearly interpolate between this point and the next */ if (excess > 0) { excesslen = (map->map[di + 1] - map->map[di]) * ((double) excess) / dashXAngleStep; len += excesslen; } if (oddSide) totallen += (sidelen - len); else totallen += len; return totallen; } /* * len is along the arc, but may be more than one rotation */ static int lengthToAngle (len, map) double len; dashMap *map; { double sidelen = map->map[DASH_MAP_SIZE - 1]; int angle, angleexcess; Bool oddSide = FALSE; int a0, a1, a; angle = 0; /* * step around the ellipse, subtracting sidelens and * adding 90 degrees. oddSide will tell if the * map should be interpolated in reverse */ if (len >= 0) { if (sidelen == 0) return 2 * FULLCIRCLE; /* infinity */ while (len >= sidelen) { angle += 90 * 64; len -= sidelen; oddSide = !oddSide; } } else { if (sidelen == 0) return -2 * FULLCIRCLE; /* infinity */ while (len < 0) { angle -= 90 * 64; len += sidelen; oddSide = !oddSide; } } if (oddSide) len = sidelen - len; a0 = 0; a1 = DASH_MAP_SIZE - 1; /* * binary search for the closest pre-computed length */ while (a1 - a0 > 1) { a = (a0 + a1) / 2; if (len > map->map[a]) a0 = a; else a1 = a; } angleexcess = dashIndexToXAngle (a0); /* * linearly interpolate to the next point */ angleexcess += (len - map->map[a0]) / (map->map[a0+1] - map->map[a0]) * dashXAngleStep; if (oddSide) angle += (90 * 64) - angleexcess; else angle += angleexcess; return angle; } /* * compute the angle of an ellipse which cooresponds to * the given path length. Note that the correct solution * to this problem is an eliptic integral, we'll punt and * approximate (it's only for dashes anyway). This * approximation uses a polygon. * * The remaining portion of len is stored in *lenp - * this will be negative if the arc extends beyond * len and positive if len extends beyond the arc. */ static int computeAngleFromPath (startAngle, endAngle, map, lenp, backwards) int startAngle, endAngle; /* normalized absolute angles in *64 degrees */ dashMap *map; int *lenp; int backwards; { int a0, a1, a; double len0; int len; a0 = startAngle; a1 = endAngle; len = *lenp; if (backwards) { /* * flip the problem around to always be * forwards */ a0 = FULLCIRCLE - a0; a1 = FULLCIRCLE - a1; } if (a1 < a0) a1 += FULLCIRCLE; len0 = angleToLength (a0, map); a = lengthToAngle (len0 + len, map); if (a > a1) { a = a1; len -= angleToLength (a1, map) - len0; } else len = 0; if (backwards) a = FULLCIRCLE - a; *lenp = len; return a; } /* * scan convert wide arcs. */ /* * draw zero width/height arcs */ static void drawZeroArc (pDraw, pGC, tarc, lw, left, right) DrawablePtr pDraw; GCPtr pGC; xArc *tarc; int lw; miArcFacePtr right, left; { double x0, y0, x1, y1, w, h, x, y; double xmax, ymax, xmin, ymin; int a0, a1; double a, startAngle, endAngle; double l, lx, ly; l = lw / 2.0; a0 = tarc->angle1; a1 = tarc->angle2; if (a1 > FULLCIRCLE) a1 = FULLCIRCLE; else if (a1 < -FULLCIRCLE) a1 = -FULLCIRCLE; w = (double)tarc->width / 2.0; h = (double)tarc->height / 2.0; /* * play in X coordinates right away */ startAngle = - ((double) a0 / 64.0); endAngle = - ((double) (a0 + a1) / 64.0); xmax = -w; xmin = w; ymax = -h; ymin = h; a = startAngle; for (;;) { x = w * miDcos(a); y = h * miDsin(a); if (a == startAngle) { x0 = x; y0 = y; } if (a == endAngle) { x1 = x; y1 = y; } if (x > xmax) xmax = x; if (x < xmin) xmin = x; if (y > ymax) ymax = y; if (y < ymin) ymin = y; if (a == endAngle) break; if (a1 < 0) /* clockwise */ { if (floor (a / 90.0) == floor (endAngle / 90.0)) a = endAngle; else a = 90 * (floor (a/90.0) + 1); } else { if (ceil (a / 90.0) == ceil (endAngle / 90.0)) a = endAngle; else a = 90 * (ceil (a/90.0) - 1); } } lx = ly = l; if ((x1 - x0) + (y1 - y0) < 0) lx = ly = -l; if (h) { ly = 0.0; lx = -lx; } else lx = 0.0; if (right) { right->center.x = x0; right->center.y = y0; right->clock.x = x0 - lx; right->clock.y = y0 - ly; right->counterClock.x = x0 + lx; right->counterClock.y = y0 + ly; } if (left) { left->center.x = x1; left->center.y = y1; left->clock.x = x1 + lx; left->clock.y = y1 + ly; left->counterClock.x = x1 - lx; left->counterClock.y = y1 - ly; } x0 = xmin; x1 = xmax; y0 = ymin; y1 = ymax; if (ymin != y1) { xmin = -l; xmax = l; } else { ymin = -l; ymax = l; } if (xmax != xmin && ymax != ymin) { int minx, maxx, miny, maxy; xRectangle rect; minx = ICEIL (xmin + w) + tarc->x; maxx = ICEIL (xmax + w) + tarc->x; miny = ICEIL (ymin + h) + tarc->y; maxy = ICEIL (ymax + h) + tarc->y; rect.x = minx; rect.y = miny; rect.width = maxx - minx; rect.height = maxy - miny; (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect); } } /* * this computes the ellipse y value associated with the * bottom of the tail. */ static void tailEllipseY (def, acc) struct arc_def *def; struct accelerators *acc; { double t; acc->tail_y = 0.0; if (def->w == def->h) return; t = def->l * def->w; if (def->w > def->h) { if (t < acc->h2) return; } else { if (t > acc->h2) return; } t = 2.0 * def->h * t; t = (CUBED_ROOT_4 * acc->h2 - cbrt(t * t)) / acc->h2mw2; if (t > 0.0) acc->tail_y = def->h / CUBED_ROOT_2 * sqrt(t); } /* * inverse functions -- compute edge coordinates * from the ellipse */ static double outerXfromXY (x, y, def, acc) double x, y; struct arc_def *def; struct accelerators *acc; { return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double outerYfromXY (x, y, def, acc) double x, y; struct arc_def *def; struct accelerators *acc; { return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerXfromXY (x, y, def, acc) double x, y; struct arc_def *def; struct accelerators *acc; { return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerYfromXY (x, y, def, acc) double x, y; struct arc_def *def; struct accelerators *acc; { return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static double innerYfromY (y, def, acc) double y; struct arc_def *def; struct accelerators *acc; { double x; x = (def->w / def->h) * sqrt (acc->h2 - y*y); return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4); } static void computeLine (x1, y1, x2, y2, line) double x1, y1, x2, y2; struct line *line; { if (y1 == y2) line->valid = 0; else { line->m = (x1 - x2) / (y1 - y2); line->b = x1 - y1 * line->m; line->valid = 1; } } /* * compute various accelerators for an ellipse. These * are simply values that are used repeatedly in * the computations */ static void computeAcc (tarc, lw, def, acc) xArc *tarc; int lw; struct arc_def *def; struct accelerators *acc; { def->w = ((double) tarc->width) / 2.0; def->h = ((double) tarc->height) / 2.0; def->l = ((double) lw) / 2.0; acc->h2 = def->h * def->h; acc->w2 = def->w * def->w; acc->h4 = acc->h2 * acc->h2; acc->w4 = acc->w2 * acc->w2; acc->h2l = acc->h2 * def->l; acc->w2l = acc->w2 * def->l; acc->h2mw2 = acc->h2 - acc->w2; acc->fromIntX = (tarc->width & 1) ? 0.5 : 0.0; acc->fromIntY = (tarc->height & 1) ? 0.5 : 0.0; acc->xorg = tarc->x + (tarc->width >> 1); acc->yorgu = tarc->y + (tarc->height >> 1); acc->yorgl = acc->yorgu + (tarc->height & 1); tailEllipseY (def, acc); } /* * compute y value bounds of various portions of the arc, * the outer edge, the ellipse and the inner edge. */ static void computeBound (def, bound, acc, right, left) struct arc_def *def; struct arc_bound *bound; struct accelerators *acc; miArcFacePtr right, left; { double t; double innerTaily; double tail_y; struct bound innerx, outerx; struct bound ellipsex; bound->ellipse.min = Dsin (def->a0) * def->h; bound->ellipse.max = Dsin (def->a1) * def->h; if (def->a0 == 45 && def->w == def->h) ellipsex.min = bound->ellipse.min; else ellipsex.min = Dcos (def->a0) * def->w; if (def->a1 == 45 && def->w == def->h) ellipsex.max = bound->ellipse.max; else ellipsex.max = Dcos (def->a1) * def->w; bound->outer.min = outerYfromXY (ellipsex.min, bound->ellipse.min, def, acc); bound->outer.max = outerYfromXY (ellipsex.max, bound->ellipse.max, def, acc); bound->inner.min = innerYfromXY (ellipsex.min, bound->ellipse.min, def, acc); bound->inner.max = innerYfromXY (ellipsex.max, bound->ellipse.max, def, acc); outerx.min = outerXfromXY (ellipsex.min, bound->ellipse.min, def, acc); outerx.max = outerXfromXY (ellipsex.max, bound->ellipse.max, def, acc); innerx.min = innerXfromXY (ellipsex.min, bound->ellipse.min, def, acc); innerx.max = innerXfromXY (ellipsex.max, bound->ellipse.max, def, acc); /* * save the line end points for the * cap code to use. Careful here, these are * in cartesean coordinates (y increasing upwards) * while the cap code uses inverted coordinates * (y increasing downwards) */ if (right) { right->counterClock.y = bound->outer.min; right->counterClock.x = outerx.min; right->center.y = bound->ellipse.min; right->center.x = ellipsex.min; right->clock.y = bound->inner.min; right->clock.x = innerx.min; } if (left) { left->clock.y = bound->outer.max; left->clock.x = outerx.max; left->center.y = bound->ellipse.max; left->center.x = ellipsex.max; left->counterClock.y = bound->inner.max; left->counterClock.x = innerx.max; } bound->left.min = bound->inner.max; bound->left.max = bound->outer.max; bound->right.min = bound->inner.min; bound->right.max = bound->outer.min; computeLine (innerx.min, bound->inner.min, outerx.min, bound->outer.min, &acc->right); computeLine (innerx.max, bound->inner.max, outerx.max, bound->outer.max, &acc->left); if (bound->inner.min > bound->inner.max) { t = bound->inner.min; bound->inner.min = bound->inner.max; bound->inner.max = t; } tail_y = acc->tail_y; if (tail_y > bound->ellipse.max) tail_y = bound->ellipse.max; else if (tail_y < bound->ellipse.min) tail_y = bound->ellipse.min; innerTaily = innerYfromY (tail_y, def, acc); if (bound->inner.min > innerTaily) bound->inner.min = innerTaily; if (bound->inner.max < innerTaily) bound->inner.max = innerTaily; bound->inneri.min = ICEIL(bound->inner.min - acc->fromIntY); bound->inneri.max = floor(bound->inner.max - acc->fromIntY); bound->outeri.min = ICEIL(bound->outer.min - acc->fromIntY); bound->outeri.max = floor(bound->outer.max - acc->fromIntY); } /* * this section computes the x value of the span at y * intersected with the specified face of the ellipse. * * this is the min/max X value over the set of normal * lines to the entire ellipse, the equation of the * normal lines is: * * ellipse_x h^2 h^2 * x = ------------ y + ellipse_x (1 - --- ) * ellipse_y w^2 w^2 * * compute the derivative with-respect-to ellipse_y and solve * for zero: * * (w^2 - h^2) ellipse_y^3 + h^4 y * 0 = - ---------------------------------- * h w ellipse_y^2 sqrt (h^2 - ellipse_y^2) * * ( h^4 y ) * ellipse_y = ( ---------- ) ^ (1/3) * ( (h^2 - w^2) ) * * The other two solutions to the equation are imaginary. * * This gives the position on the ellipse which generates * the normal with the largest/smallest x intersection point. * * Now compute the second derivative to check whether * the intersection is a minimum or maximum: * * h (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * - ------------------------------------------- * w y0^3 (sqrt (h^2 - y^2)) ^ 3 * * as we only care about the sign, * * - (y0^3 (w^2 - h^2) + h^2 y (3y0^2 - 2h^2)) * * or (to use accelerators), * * y0^3 (h^2 - w^2) - h^2 y (3y0^2 - 2h^2) * */ /* * computes the position on the ellipse whose normal line * intersects the given scan line maximally */ static double hookEllipseY (scan_y, bound, acc, left) double scan_y; struct arc_bound *bound; struct accelerators *acc; int left; { double ret; if (acc->h2mw2 == 0) { if ( (scan_y > 0 && !left) || (scan_y < 0 && left) ) return bound->ellipse.min; return bound->ellipse.max; } ret = (acc->h4 * scan_y) / (acc->h2mw2); if (ret >= 0) return cbrt (ret); else return -cbrt (-ret); } /* * computes the X value of the intersection of the * given scan line with the right side of the lower hook */ static double hookX (scan_y, def, bound, acc, left) double scan_y; struct arc_def *def; struct arc_bound *bound; struct accelerators *acc; int left; { double ellipse_y, x; double maxMin; if (def->w != def->h) { ellipse_y = hookEllipseY (scan_y, bound, acc, left); if (boundedLe (ellipse_y, bound->ellipse)) { /* * compute the value of the second * derivative */ maxMin = ellipse_y*ellipse_y*ellipse_y * acc->h2mw2 - acc->h2 * scan_y * (3 * ellipse_y*ellipse_y - 2*acc->h2); if ((left && maxMin > 0) || (!left && maxMin < 0)) { if (ellipse_y == 0) return def->w + left ? -def->l : def->l; x = (acc->h2 * scan_y - ellipse_y * acc->h2mw2) * sqrt (acc->h2 - ellipse_y * ellipse_y) / (def->h * def->w * ellipse_y); return x; } } } if (left) { if (acc->left.valid && boundedLe (scan_y, bound->left)) { x = intersectLine (scan_y, acc->left); } else { if (acc->right.valid) x = intersectLine (scan_y, acc->right); else x = def->w - def->l; } } else { if (acc->right.valid && boundedLe (scan_y, bound->right)) { x = intersectLine (scan_y, acc->right); } else { if (acc->left.valid) x = intersectLine (scan_y, acc->left); else x = def->w - def->l; } } return x; } /* * generate the set of spans with * the given y coordinate */ static void arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask) int y; int lx; int lw; int rx; int rw; struct arc_def *def; struct arc_bound *bounds; struct accelerators *acc; int mask; { int linx, loutx, rinx, routx; double x, altx; if (boundedLe (y, bounds->inneri)) { linx = -(lx + lw); rinx = rx; } else { /* * intersection with left face */ x = hookX (y + acc->fromIntY, def, bounds, acc, 1); if (acc->right.valid && boundedLe (y + acc->fromIntY, bounds->right)) { altx = intersectLine (y + acc->fromIntY, acc->right); if (altx < x) x = altx; } linx = -ICEIL(acc->fromIntX - x); rinx = ICEIL(acc->fromIntX + x); } if (boundedLe (y, bounds->outeri)) { loutx = -lx; routx = rx + rw; } else { /* * intersection with right face */ x = hookX (y + acc->fromIntY, def, bounds, acc, 0); if (acc->left.valid && boundedLe (y + acc->fromIntY, bounds->left)) { altx = x; x = intersectLine (y + acc->fromIntY, acc->left); if (x < altx) x = altx; } loutx = -ICEIL(acc->fromIntX - x); routx = ICEIL(acc->fromIntX + x); } if (routx > rinx) { if (mask & 1) newFinalSpan (acc->yorgu - y, acc->xorg + rinx, acc->xorg + routx); if (mask & 8) newFinalSpan (acc->yorgl + y, acc->xorg + rinx, acc->xorg + routx); } if (loutx > linx) { if (mask & 2) newFinalSpan (acc->yorgu - y, acc->xorg - loutx, acc->xorg - linx); if (mask & 4) newFinalSpan (acc->yorgl + y, acc->xorg - loutx, acc->xorg - linx); } } static void arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask) int lx; int lw; int rx; int rw; struct arc_def *def; struct arc_bound *bounds; struct accelerators *acc; int mask; { double x; if (boundedLe (0, bounds->inneri) && acc->left.valid && boundedLe (0, bounds->left) && acc->left.b > 0) { x = def->w - def->l; if (acc->left.b < x) x = acc->left.b; lw = ICEIL(acc->fromIntX - x) - lx; rw += rx; rx = ICEIL(acc->fromIntX + x); rw -= rx; } arcSpan (0, lx, lw, rx, rw, def, bounds, acc, mask); } static void tailSpan (y, lw, rw, def, bounds, acc, mask) int y; int lw; int rw; struct arc_def *def; struct arc_bound *bounds; struct accelerators *acc; int mask; { double yy, xalt, x, lx, rx; int n; if (boundedLe(y, bounds->outeri)) arcSpan (y, 0, lw, -rw, rw, def, bounds, acc, mask); else if (def->w != def->h) { yy = y + acc->fromIntY; x = tailX(yy, def, bounds, acc); if (yy == 0.0 && x == -rw - acc->fromIntX) return; if (acc->right.valid && boundedLe (yy, bounds->right)) { rx = x; lx = -x; xalt = intersectLine (yy, acc->right); if (xalt >= -rw - acc->fromIntX && xalt <= rx) rx = xalt; n = ICEIL(acc->fromIntX + lx); if (lw > n) { if (mask & 2) newFinalSpan (acc->yorgu - y, acc->xorg + n, acc->xorg + lw); if (mask & 4) newFinalSpan (acc->yorgl + y, acc->xorg + n, acc->xorg + lw); } n = ICEIL(acc->fromIntX + rx); if (n > -rw) { if (mask & 1) newFinalSpan (acc->yorgu - y, acc->xorg - rw, acc->xorg + n); if (mask & 8) newFinalSpan (acc->yorgl + y, acc->xorg - rw, acc->xorg + n); } } arcSpan (y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, bounds, acc, mask); } } /* * create whole arcs out of pieces. This code is * very bad. */ static struct finalSpan **finalSpans = NULL; static int finalMiny = 0, finalMaxy = -1; static int finalSize = 0; static int nspans = 0; /* total spans, not just y coords */ struct finalSpan { struct finalSpan *next; int min, max; /* x values */ }; static struct finalSpan *freeFinalSpans, *tmpFinalSpan; # define allocFinalSpan() (freeFinalSpans ?\ ((tmpFinalSpan = freeFinalSpans), \ (freeFinalSpans = freeFinalSpans->next), \ (tmpFinalSpan->next = 0), \ tmpFinalSpan) : \ realAllocSpan ()) # define SPAN_CHUNK_SIZE 128 struct finalSpanChunk { struct finalSpan data[SPAN_CHUNK_SIZE]; struct finalSpanChunk *next; }; static struct finalSpanChunk *chunks; struct finalSpan * realAllocSpan () { register struct finalSpanChunk *newChunk; register struct finalSpan *span; register int i; newChunk = (struct finalSpanChunk *) xalloc (sizeof (struct finalSpanChunk)); if (!newChunk) return (struct finalSpan *) NULL; newChunk->next = chunks; chunks = newChunk; freeFinalSpans = span = newChunk->data + 1; for (i = 1; i < SPAN_CHUNK_SIZE-1; i++) { span->next = span+1; span++; } span->next = 0; span = newChunk->data; span->next = 0; return span; } static void disposeFinalSpans () { struct finalSpanChunk *chunk, *next; for (chunk = chunks; chunk; chunk = next) { next = chunk->next; xfree (chunk); } chunks = 0; freeFinalSpans = 0; xfree(finalSpans); finalSpans = 0; } static void fillSpans (pDrawable, pGC) DrawablePtr pDrawable; GCPtr pGC; { register struct finalSpan *span; register DDXPointPtr xSpan; register int *xWidth; register int i; register struct finalSpan **f; register int spany; DDXPointPtr xSpans; int *xWidths; if (nspans == 0) return; xSpan = xSpans = (DDXPointPtr) ALLOCATE_LOCAL (nspans * sizeof (DDXPointRec)); xWidth = xWidths = (int *) ALLOCATE_LOCAL (nspans * sizeof (int)); if (xSpans && xWidths) { i = 0; f = finalSpans; for (spany = finalMiny; spany <= finalMaxy; spany++, f++) { for (span = *f; span; span=span->next) { if (span->max <= span->min) continue; xSpan->x = span->min; xSpan->y = spany; ++xSpan; *xWidth++ = span->max - span->min; ++i; } } (*pGC->ops->FillSpans) (pDrawable, pGC, i, xSpans, xWidths, TRUE); } disposeFinalSpans (); if (xSpans) DEALLOCATE_LOCAL (xSpans); if (xWidths) DEALLOCATE_LOCAL (xWidths); finalMiny = 0; finalMaxy = -1; finalSize = 0; nspans = 0; } # define SPAN_REALLOC 100 # define findSpan(y) ((finalMiny <= (y) && (y) <= finalMaxy) ? \ &finalSpans[(y) - finalMiny] : \ realFindSpan (y)) static struct finalSpan ** realFindSpan (y) int y; { struct finalSpan **newSpans; int newSize, newMiny, newMaxy; int change; int i; if (y < finalMiny || y > finalMaxy) { if (!finalSize) { finalMiny = y; finalMaxy = y - 1; } if (y < finalMiny) change = finalMiny - y; else change = y - finalMaxy; if (change >= SPAN_REALLOC) change += SPAN_REALLOC; else change = SPAN_REALLOC; newSize = finalSize + change; newSpans = (struct finalSpan **) xalloc (newSize * sizeof (struct finalSpan *)); if (!newSpans) return (struct finalSpan **)NULL; newMiny = finalMiny; newMaxy = finalMaxy; if (y < finalMiny) newMiny = finalMiny - change; else newMaxy = finalMaxy + change; if (finalSpans) { memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *), (char *) finalSpans, finalSize * sizeof (struct finalSpan *)); xfree (finalSpans); } if ((i = finalMiny - newMiny) > 0) bzero ((char *)newSpans, i * sizeof (struct finalSpan *)); if ((i = newMaxy - finalMaxy) > 0) bzero ((char *)(newSpans + newSize - i), i * sizeof (struct finalSpan *)); finalSpans = newSpans; finalMaxy = newMaxy; finalMiny = newMiny; finalSize = newSize; } return &finalSpans[y - finalMiny]; } static void newFinalSpan (y, xmin, xmax) int y; register int xmin, xmax; { register struct finalSpan *x; register struct finalSpan **f; struct finalSpan *oldx; struct finalSpan *prev; f = findSpan (y); if (!f) return; oldx = 0; for (;;) { prev = 0; for (x = *f; x; x=x->next) { if (x == oldx) { prev = x; continue; } if (x->min <= xmax && xmin <= x->max) { if (oldx) { oldx->min = min (x->min, xmin); oldx->max = max (x->max, xmax); if (prev) prev->next = x->next; else *f = x->next; --nspans; } else { x->min = min (x->min, xmin); x->max = max (x->max, xmax); oldx = x; } xmin = oldx->min; xmax = oldx->max; break; } prev = x; } if (!x) break; } if (!oldx) { x = allocFinalSpan (); if (x) { x->min = xmin; x->max = xmax; x->next = *f; *f = x; ++nspans; } } } static void mirrorSppPoint (quadrant, sppPoint) int quadrant; SppPointPtr sppPoint; { switch (quadrant) { case 0: break; case 1: sppPoint->x = -sppPoint->x; break; case 2: sppPoint->x = -sppPoint->x; sppPoint->y = -sppPoint->y; break; case 3: sppPoint->y = -sppPoint->y; break; } /* * and translate to X coordinate system */ sppPoint->y = -sppPoint->y; } /* * split an arc into pieces which are scan-converted * in the first-quadrant and mirrored into position. * This is necessary as the scan-conversion code can * only deal with arcs completely contained in the * first quadrant. */ static void drawArc (tarc, l, a0, a1, right, left) xArc *tarc; int l, a0, a1; miArcFacePtr right, left; /* save end line points */ { struct arc_def def; struct accelerators acc; int startq, endq, curq; int rightq, leftq, righta, lefta; miArcFacePtr passRight, passLeft; int q0, q1, mask; struct band { int a0, a1; int mask; } band[5], sweep[20]; int bandno, sweepno; int i, j; int flipRight = 0, flipLeft = 0; int copyEnd = 0; miArcSpanData *spdata; Bool mustFree; spdata = miComputeWideEllipse(l, tarc, &mustFree); if (!spdata) return; if (a1 < a0) a1 += 360 * 64; startq = a0 / (90 * 64); if (a0 == a1) endq = startq; else endq = (a1-1) / (90 * 64); bandno = 0; curq = startq; rightq = -1; for (;;) { switch (curq) { case 0: if (a0 > 90 * 64) q0 = 0; else q0 = a0; if (a1 < 360 * 64) q1 = min (a1, 90 * 64); else q1 = 90 * 64; if (curq == startq && a0 == q0 && rightq < 0) { righta = q0; rightq = curq; } if (curq == endq && a1 == q1) { lefta = q1; leftq = curq; } break; case 1: if (a1 < 90 * 64) q0 = 0; else q0 = 180 * 64 - min (a1, 180 * 64); if (a0 > 180 * 64) q1 = 90 * 64; else q1 = 180 * 64 - max (a0, 90 * 64); if (curq == startq && 180 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 180 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; case 2: if (a0 > 270 * 64) q0 = 0; else q0 = max (a0, 180 * 64) - 180 * 64; if (a1 < 180 * 64) q1 = 90 * 64; else q1 = min (a1, 270 * 64) - 180 * 64; if (curq == startq && a0 - 180*64 == q0) { righta = q0; rightq = curq; } if (curq == endq && a1 - 180 * 64 == q1) { lefta = q1; leftq = curq; } break; case 3: if (a1 < 270 * 64) q0 = 0; else q0 = 360 * 64 - min (a1, 360 * 64); q1 = 360 * 64 - max (a0, 270 * 64); if (curq == startq && 360 * 64 - a0 == q1) { righta = q1; rightq = curq; } if (curq == endq && 360 * 64 - a1 == q0) { lefta = q0; leftq = curq; } break; } band[bandno].a0 = q0; band[bandno].a1 = q1; band[bandno].mask = 1 << curq; bandno++; if (curq == endq) break; curq++; if (curq == 4) { a0 = 0; a1 -= 360 * 64; curq = 0; endq -= 4; } } sweepno = 0; for (;;) { q0 = 90 * 64; mask = 0; /* * find left-most point */ for (i = 0; i < bandno; i++) if (band[i].a0 <= q0) { q0 = band[i].a0; q1 = band[i].a1; mask = band[i].mask; } if (!mask) break; /* * locate next point of change */ for (i = 0; i < bandno; i++) if (!(mask & band[i].mask)) { if (band[i].a0 == q0) { if (band[i].a1 < q1) q1 = band[i].a1; mask |= band[i].mask; } else if (band[i].a0 < q1) q1 = band[i].a0; } /* * create a new sweep */ sweep[sweepno].a0 = q0; sweep[sweepno].a1 = q1; sweep[sweepno].mask = mask; sweepno++; /* * subtract the sweep from the affected bands */ for (i = 0; i < bandno; i++) if (band[i].a0 == q0) { band[i].a0 = q1; /* * check if this band is empty */ if (band[i].a0 == band[i].a1) band[i].a1 = band[i].a0 = 90 * 64 + 1; } } computeAcc (tarc, l, &def, &acc); for (j = 0; j < sweepno; j++) { mask = sweep[j].mask; passRight = passLeft = 0; if (mask & (1 << rightq)) { if (sweep[j].a0 == righta) passRight = right; else if (sweep[j].a1 == righta) { passLeft = right; flipRight = 1; } } if (mask & (1 << leftq)) { if (sweep[j].a1 == lefta) { if (passLeft) copyEnd = 1; passLeft = left; } else if (sweep[j].a0 == lefta) { if (passRight) copyEnd = 1; passRight = left; flipLeft = 1; } } drawQuadrant (&def, &acc, sweep[j].a0, sweep[j].a1, mask, passRight, passLeft, spdata); } /* * when copyEnd is set, both ends of the arc were computed * at the same time; drawQuadrant only takes one end though, * so the left end will be the only one holding the data. Copy * it from there. */ if (copyEnd) *right = *left; /* * mirror the coordinates generated for the * faces of the arc */ if (right) { mirrorSppPoint (rightq, &right->clock); mirrorSppPoint (rightq, &right->center); mirrorSppPoint (rightq, &right->counterClock); if (flipRight) { SppPointRec temp; temp = right->clock; right->clock = right->counterClock; right->counterClock = temp; } } if (left) { mirrorSppPoint (leftq, &left->counterClock); mirrorSppPoint (leftq, &left->center); mirrorSppPoint (leftq, &left->clock); if (flipLeft) { SppPointRec temp; temp = left->clock; left->clock = left->counterClock; left->counterClock = temp; } } if (mustFree) xfree(spdata); } static void drawQuadrant (def, acc, a0, a1, mask, right, left, spdata) struct arc_def *def; struct accelerators *acc; int a0, a1; int mask; miArcFacePtr right, left; miArcSpanData *spdata; { struct arc_bound bound; double yy, x, xalt; int y, miny, maxy; int n; miArcSpan *span; def->a0 = ((double) a0) / 64.0; def->a1 = ((double) a1) / 64.0; computeBound (def, &bound, acc, right, left); yy = bound.inner.min; if (bound.outer.min < yy) yy = bound.outer.min; miny = ICEIL(yy - acc->fromIntY); yy = bound.inner.max; if (bound.outer.max > yy) yy = bound.outer.max; maxy = floor(yy - acc->fromIntY); y = spdata->k; span = spdata->spans; if (spdata->top) { if (a1 == 90 * 64 && (mask & 1)) newFinalSpan (acc->yorgu - y - 1, acc->xorg, acc->xorg + 1); span++; } for (n = spdata->count1; --n >= 0; ) { if (y < miny) return; if (y <= maxy) { arcSpan (y, span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, mask); if (span->rw + span->rx) tailSpan (y, -span->rw, -span->rx, def, &bound, acc, mask); } y--; span++; } if (y < miny) return; if (spdata->hole) { if (y <= maxy) arcSpan (y, 0, 0, 0, 1, def, &bound, acc, mask & 0xc); } for (n = spdata->count2; --n >= 0; ) { if (y < miny) return; if (y <= maxy) arcSpan (y, span->lx, span->lw, span->rx, span->rw, def, &bound, acc, mask); y--; span++; } if (spdata->bot && miny <= y && y <= maxy) { n = mask; if (y == miny) n &= 0xc; if (span->rw <= 0) { arcSpan0 (span->lx, -span->lx, 0, span->lx + span->lw, def, &bound, acc, n); if (span->rw + span->rx) tailSpan (y, -span->rw, -span->rx, def, &bound, acc, n); } else arcSpan0 (span->lx, span->lw, span->rx, span->rw, def, &bound, acc, n); y--; } while (y >= miny) { yy = y + acc->fromIntY; if (def->w == def->h) { xalt = def->w - def->l; x = -sqrt(xalt * xalt - yy * yy); } else { x = tailX(yy, def, &bound, acc); if (acc->left.valid && boundedLe (yy, bound.left)) { xalt = intersectLine (yy, acc->left); if (xalt < x) x = xalt; } if (acc->right.valid && boundedLe (yy, bound.right)) { xalt = intersectLine (yy, acc->right); if (xalt < x) x = xalt; } } arcSpan (y, ICEIL(acc->fromIntX - x), 0, ICEIL(acc->fromIntX + x), 0, def, &bound, acc, mask); y--; } } vnc_unixsrc/Xvnc/programs/Xserver/mi/mieq.c0100664000076400007640000001265107120677563020424 0ustar constconst/* * $XConsortium: mieq.c,v 1.8 94/11/02 15:59:29 kaleb Exp $ * Copyright (c) 1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Author: Keith Packard, MIT X Consortium */ /* * mieq.c * * Machine independent event queue * */ # define NEED_EVENTS # include "X.h" # include "Xmd.h" # include "Xproto.h" # include "misc.h" # include "windowstr.h" # include "pixmapstr.h" # include "inputstr.h" # include "mi.h" # include "scrnintstr.h" #define QUEUE_SIZE 256 typedef struct _Event { xEvent event; ScreenPtr pScreen; } EventRec, *EventPtr; typedef struct _EventQueue { HWEventQueueType head, tail; /* long for SetInputCheck */ CARD32 lastEventTime; /* to avoid time running backwards */ Bool lastMotion; EventRec events[QUEUE_SIZE]; /* static allocation for signals */ DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; Bool mieqInit (pKbd, pPtr) DevicePtr pKbd, pPtr; { miEventQueue.head = miEventQueue.tail = 0; miEventQueue.lastEventTime = GetTimeInMillis (); miEventQueue.pKbd = pKbd; miEventQueue.pPtr = pPtr; miEventQueue.lastMotion = FALSE; miEventQueue.pEnqueueScreen = screenInfo.screens[0]; miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen; SetInputCheck (&miEventQueue.head, &miEventQueue.tail); return TRUE; } /* * Must be reentrant with ProcessInputEvents. Assumption: mieqEnqueue * will never be interrupted. If this is called from both signal * handlers and regular code, make sure the signal is suspended when * called from regular code. */ void mieqEnqueue (e) xEvent *e; { HWEventQueueType oldtail, newtail, prevtail; Bool isMotion; oldtail = miEventQueue.tail; isMotion = e->u.u.type == MotionNotify; if (isMotion && miEventQueue.lastMotion && oldtail != miEventQueue.head) { if (oldtail == 0) oldtail = QUEUE_SIZE; oldtail = oldtail - 1; } else { newtail = oldtail + 1; if (newtail == QUEUE_SIZE) newtail = 0; /* Toss events which come in late */ if (newtail == miEventQueue.head) return; miEventQueue.tail = newtail; } miEventQueue.lastMotion = isMotion; miEventQueue.events[oldtail].event = *e; /* * Make sure that event times don't go backwards - this * is "unnecessary", but very useful */ if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime && miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) { miEventQueue.events[oldtail].event.u.keyButtonPointer.time = miEventQueue.lastEventTime; } miEventQueue.events[oldtail].pScreen = miEventQueue.pEnqueueScreen; } void mieqSwitchScreen (pScreen, fromDIX) ScreenPtr pScreen; Bool fromDIX; { miEventQueue.pEnqueueScreen = pScreen; if (fromDIX) miEventQueue.pDequeueScreen = pScreen; } /* * Call this from ProcessInputEvents() */ mieqProcessInputEvents () { EventRec *e; int x, y; xEvent xe; while (miEventQueue.head != miEventQueue.tail) { extern int screenIsSaved; if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); e = &miEventQueue.events[miEventQueue.head]; /* * Assumption - screen switching can only occur on motion events */ if (e->pScreen != miEventQueue.pDequeueScreen) { miEventQueue.pDequeueScreen = e->pScreen; x = e->event.u.keyButtonPointer.rootX; y = e->event.u.keyButtonPointer.rootY; if (miEventQueue.head == QUEUE_SIZE - 1) miEventQueue.head = 0; else ++miEventQueue.head; NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); } else { xe = e->event; if (miEventQueue.head == QUEUE_SIZE - 1) miEventQueue.head = 0; else ++miEventQueue.head; switch (xe.u.u.type) { case KeyPress: case KeyRelease: (*miEventQueue.pKbd->processInputProc) (&xe, (DeviceIntPtr)miEventQueue.pKbd, 1); break; default: (*miEventQueue.pPtr->processInputProc) (&xe, (DeviceIntPtr)miEventQueue.pPtr, 1); break; } } } } vnc_unixsrc/Xvnc/programs/Xserver/mi/miwideline.h0100664000076400007640000001442307120677563021623 0ustar constconst/* $XConsortium: miwideline.h,v 1.11 94/04/17 20:28:02 dpw Exp $ */ /* Copyright (c) 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* Author: Keith Packard, MIT X Consortium */ #include "mispans.h" /* * interface data to span-merging polygon filler */ typedef struct _SpanData { SpanGroup fgGroup, bgGroup; } SpanDataRec, *SpanDataPtr; #define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \ SpanGroup *group, *othergroup = NULL; \ if (pixel == pGC->fgPixel) \ { \ group = &spanData->fgGroup; \ if (pGC->lineStyle == LineDoubleDash) \ othergroup = &spanData->bgGroup; \ } \ else \ { \ group = &spanData->bgGroup; \ othergroup = &spanData->fgGroup; \ } \ miAppendSpans (group, othergroup, spanPtr); \ } /* * Polygon edge description for integer wide-line routines */ typedef struct _PolyEdge { int height; /* number of scanlines to process */ int x; /* starting x coordinate */ int stepx; /* fixed integral dx */ int signdx; /* variable dx sign */ int e; /* initial error term */ int dy; int dx; } PolyEdgeRec, *PolyEdgePtr; #define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - miter limit constant */ /* * types for general polygon routines */ typedef struct _PolyVertex { double x, y; } PolyVertexRec, *PolyVertexPtr; typedef struct _PolySlope { int dx, dy; double k; /* x0 * dy - y0 * dx */ } PolySlopeRec, *PolySlopePtr; /* * Line face description for caps/joins */ typedef struct _LineFace { double xa, ya; int dx, dy; int x, y; double k; } LineFaceRec, *LineFacePtr; /* * macros for polygon fillers */ #define MIPOLYRELOADLEFT if (!left_height && left_count) { \ left_height = left->height; \ left_x = left->x; \ left_stepx = left->stepx; \ left_signdx = left->signdx; \ left_e = left->e; \ left_dy = left->dy; \ left_dx = left->dx; \ --left_count; \ ++left; \ } #define MIPOLYRELOADRIGHT if (!right_height && right_count) { \ right_height = right->height; \ right_x = right->x; \ right_stepx = right->stepx; \ right_signdx = right->signdx; \ right_e = right->e; \ right_dy = right->dy; \ right_dx = right->dx; \ --right_count; \ ++right; \ } #define MIPOLYSTEPLEFT left_x += left_stepx; \ left_e += left_dx; \ if (left_e > 0) \ { \ left_x += left_signdx; \ left_e -= left_dy; \ } #define MIPOLYSTEPRIGHT right_x += right_stepx; \ right_e += right_dx; \ if (right_e > 0) \ { \ right_x += right_signdx; \ right_e -= right_dy; \ } #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ oldPixel = pGC->fgPixel; \ if (pixel != oldPixel) { \ DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \ ValidateGC (pDrawable, pGC); \ } \ } #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \ if (pixel != oldPixel) { \ DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \ ValidateGC (pDrawable, pGC); \ } \ } #ifdef NOINLINEICEIL #define ICEIL(x) ((int)ceil(x)) #else #ifdef __GNUC__ static __inline int ICEIL(x) double x; { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; } #else #define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1) #define ICEILTEMPDECL static int _cTmp; #endif #endif extern void miFillPolyHelper( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, SpanDataPtr /*spanData*/, int /*y*/, int /*overall_height*/, PolyEdgePtr /*left*/, PolyEdgePtr /*right*/, int /*left_count*/, int /*right_count*/ #endif ); extern int miRoundJoinFace( #if NeedFunctionPrototypes LineFacePtr /*face*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ #endif ); extern void miRoundJoinClip( #if NeedFunctionPrototypes LineFacePtr /*pLeft*/, LineFacePtr /*pRight*/, PolyEdgePtr /*edge1*/, PolyEdgePtr /*edge2*/, int * /*y1*/, int * /*y2*/, Bool * /*left1*/, Bool * /*left2*/ #endif ); extern int miRoundCapClip( #if NeedFunctionPrototypes LineFacePtr /*face*/, Bool /*isInt*/, PolyEdgePtr /*edge*/, Bool * /*leftEdge*/ #endif ); extern void miLineProjectingCap( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, unsigned long /*pixel*/, SpanDataPtr /*spanData*/, LineFacePtr /*face*/, Bool /*isLeft*/, double /*xorg*/, double /*yorg*/, Bool /*isInt*/ #endif ); extern SpanDataPtr miSetupSpanData( #if NeedFunctionPrototypes GCPtr /*pGC*/, SpanDataPtr /*spanData*/, int /*npt*/ #endif ); extern void miCleanupSpanData( #if NeedFunctionPrototypes DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, SpanDataPtr /*spanData*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/mi/misprite.c0100664000076400007640000014760707120677563021337 0ustar constconst/* * misprite.c * * machine independent software sprite routines */ /* $XConsortium: misprite.c,v 5.47 94/04/17 20:27:53 dpw Exp $ */ /* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.0 1996/08/25 14:13:56 dawes Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # include "X.h" # include "Xproto.h" # include "misc.h" # include "pixmapstr.h" # include "input.h" # include "mi.h" # include "cursorstr.h" # include "font.h" # include "scrnintstr.h" # include "colormapst.h" # include "windowstr.h" # include "gcstruct.h" # include "mipointer.h" # include "mispritest.h" # include "dixfontstr.h" # include "fontstruct.h" /* * screen wrappers */ static int miSpriteScreenIndex; static unsigned long miSpriteGeneration = 0; static Bool miSpriteCloseScreen(); static void miSpriteGetImage(); static void miSpriteGetSpans(); static void miSpriteSourceValidate(); static Bool miSpriteCreateGC(); static void miSpriteBlockHandler(); static void miSpriteInstallColormap(); static void miSpriteStoreColors(); static void miSpritePaintWindowBackground(); static void miSpritePaintWindowBorder(); static void miSpriteCopyWindow(); static void miSpriteClearToBackground(); static void miSpriteSaveDoomedAreas(); static RegionPtr miSpriteRestoreAreas(); static void miSpriteComputeSaved(); #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((miSpriteScreenPtr) (pScreen)->devPrivates[miSpriteScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) /* * GC func wrappers */ static int miSpriteGCIndex; static void miSpriteValidateGC (), miSpriteCopyGC (); static void miSpriteDestroyGC(), miSpriteChangeGC(); static void miSpriteChangeClip(), miSpriteDestroyClip(); static void miSpriteCopyClip(); static GCFuncs miSpriteGCFuncs = { miSpriteValidateGC, miSpriteChangeGC, miSpriteCopyGC, miSpriteDestroyGC, miSpriteChangeClip, miSpriteDestroyClip, miSpriteCopyClip, }; #define GC_FUNC_PROLOGUE(pGC) \ miSpriteGCPtr pGCPriv = \ (miSpriteGCPtr) (pGC)->devPrivates[miSpriteGCIndex].ptr;\ (pGC)->funcs = pGCPriv->wrapFuncs; \ if (pGCPriv->wrapOps) \ (pGC)->ops = pGCPriv->wrapOps; #define GC_FUNC_EPILOGUE(pGC) \ pGCPriv->wrapFuncs = (pGC)->funcs; \ (pGC)->funcs = &miSpriteGCFuncs; \ if (pGCPriv->wrapOps) \ { \ pGCPriv->wrapOps = (pGC)->ops; \ (pGC)->ops = &miSpriteGCOps; \ } /* * GC op wrappers */ static void miSpriteFillSpans(), miSpriteSetSpans(); static void miSpritePutImage(); static RegionPtr miSpriteCopyArea(), miSpriteCopyPlane(); static void miSpritePolyPoint(), miSpritePolylines(); static void miSpritePolySegment(), miSpritePolyRectangle(); static void miSpritePolyArc(), miSpriteFillPolygon(); static void miSpritePolyFillRect(), miSpritePolyFillArc(); static int miSpritePolyText8(), miSpritePolyText16(); static void miSpriteImageText8(), miSpriteImageText16(); static void miSpriteImageGlyphBlt(), miSpritePolyGlyphBlt(); static void miSpritePushPixels(); #ifdef NEED_LINEHELPER static void miSpriteLineHelper(); #endif static GCOps miSpriteGCOps = { miSpriteFillSpans, miSpriteSetSpans, miSpritePutImage, miSpriteCopyArea, miSpriteCopyPlane, miSpritePolyPoint, miSpritePolylines, miSpritePolySegment, miSpritePolyRectangle, miSpritePolyArc, miSpriteFillPolygon, miSpritePolyFillRect, miSpritePolyFillArc, miSpritePolyText8, miSpritePolyText16, miSpriteImageText8, miSpriteImageText16, miSpriteImageGlyphBlt, miSpritePolyGlyphBlt, miSpritePushPixels #ifdef NEED_LINEHELPER , miSpriteLineHelper #endif }; /* * testing only -- remove cursor for every draw. Eventually, * each draw operation will perform a bounding box check against * the saved cursor area */ #define GC_SETUP_CHEAP(pDrawable) \ miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) \ (pDrawable)->pScreen->devPrivates[miSpriteScreenIndex].ptr; \ #define GC_SETUP(pDrawable, pGC) \ GC_SETUP_CHEAP(pDrawable) \ miSpriteGCPtr pGCPrivate = (miSpriteGCPtr) \ (pGC)->devPrivates[miSpriteGCIndex].ptr; \ GCFuncs *oldFuncs = pGC->funcs; #define GC_SETUP_AND_CHECK(pDrawable, pGC) \ GC_SETUP(pDrawable, pGC); \ if (GC_CHECK((WindowPtr)pDrawable)) \ miSpriteRemoveCursor (pDrawable->pScreen); #define GC_CHECK(pWin) \ (pScreenPriv->isUp && \ (pScreenPriv->pCacheWin == pWin ? \ pScreenPriv->isInCacheWin : ( \ (pScreenPriv->pCacheWin = (pWin)), \ (pScreenPriv->isInCacheWin = \ (pWin)->drawable.x < pScreenPriv->saved.x2 && \ pScreenPriv->saved.x1 < (pWin)->drawable.x + \ (int) (pWin)->drawable.width && \ (pWin)->drawable.y < pScreenPriv->saved.y2 && \ pScreenPriv->saved.y1 < (pWin)->drawable.y + \ (int) (pWin)->drawable.height &&\ RECT_IN_REGION((pWin)->drawable.pScreen, &(pWin)->borderClip, \ &pScreenPriv->saved) != rgnOUT)))) #define GC_OP_PROLOGUE(pGC) { \ (pGC)->funcs = pGCPrivate->wrapFuncs; \ (pGC)->ops = pGCPrivate->wrapOps; \ } #define GC_OP_EPILOGUE(pGC) { \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->funcs = oldFuncs; \ (pGC)->ops = &miSpriteGCOps; \ } /* * pointer-sprite method table */ static Bool miSpriteRealizeCursor (), miSpriteUnrealizeCursor (); static void miSpriteSetCursor (), miSpriteMoveCursor (); miPointerSpriteFuncRec miSpritePointerFuncs = { miSpriteRealizeCursor, miSpriteUnrealizeCursor, miSpriteSetCursor, miSpriteMoveCursor, }; /* * other misc functions */ static void miSpriteRemoveCursor (), miSpriteRestoreCursor(); /* * miSpriteInitialize -- called from device-dependent screen * initialization proc after all of the function pointers have * been stored in the screen structure. */ Bool miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) ScreenPtr pScreen; miSpriteCursorFuncPtr cursorFuncs; miPointerScreenFuncPtr screenFuncs; { miSpriteScreenPtr pPriv; VisualPtr pVisual; if (miSpriteGeneration != serverGeneration) { miSpriteScreenIndex = AllocateScreenPrivateIndex (); if (miSpriteScreenIndex < 0) return FALSE; miSpriteGeneration = serverGeneration; miSpriteGCIndex = AllocateGCPrivateIndex (); } if (!AllocateGCPrivate(pScreen, miSpriteGCIndex, sizeof(miSpriteGCRec))) return FALSE; pPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); if (!pPriv) return FALSE; if (!miPointerInitialize (pScreen, &miSpritePointerFuncs, screenFuncs,TRUE)) { xfree ((pointer) pPriv); return FALSE; } for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; pPriv->pVisual = pVisual; pPriv->CloseScreen = pScreen->CloseScreen; pPriv->GetImage = pScreen->GetImage; pPriv->GetSpans = pScreen->GetSpans; pPriv->SourceValidate = pScreen->SourceValidate; pPriv->CreateGC = pScreen->CreateGC; pPriv->BlockHandler = pScreen->BlockHandler; pPriv->InstallColormap = pScreen->InstallColormap; pPriv->StoreColors = pScreen->StoreColors; pPriv->PaintWindowBackground = pScreen->PaintWindowBackground; pPriv->PaintWindowBorder = pScreen->PaintWindowBorder; pPriv->CopyWindow = pScreen->CopyWindow; pPriv->ClearToBackground = pScreen->ClearToBackground; pPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas; pPriv->RestoreAreas = pScreen->RestoreAreas; pPriv->pCursor = NULL; pPriv->x = 0; pPriv->y = 0; pPriv->isUp = FALSE; pPriv->shouldBeUp = FALSE; pPriv->pCacheWin = NullWindow; pPriv->isInCacheWin = FALSE; pPriv->checkPixels = TRUE; pPriv->pInstalledMap = NULL; pPriv->pColormap = NULL; pPriv->funcs = cursorFuncs; pPriv->colors[SOURCE_COLOR].red = 0; pPriv->colors[SOURCE_COLOR].green = 0; pPriv->colors[SOURCE_COLOR].blue = 0; pPriv->colors[MASK_COLOR].red = 0; pPriv->colors[MASK_COLOR].green = 0; pPriv->colors[MASK_COLOR].blue = 0; pScreen->devPrivates[miSpriteScreenIndex].ptr = (pointer) pPriv; pScreen->CloseScreen = miSpriteCloseScreen; pScreen->GetImage = miSpriteGetImage; pScreen->GetSpans = miSpriteGetSpans; pScreen->SourceValidate = miSpriteSourceValidate; pScreen->CreateGC = miSpriteCreateGC; pScreen->BlockHandler = miSpriteBlockHandler; pScreen->InstallColormap = miSpriteInstallColormap; pScreen->StoreColors = miSpriteStoreColors; pScreen->PaintWindowBackground = miSpritePaintWindowBackground; pScreen->PaintWindowBorder = miSpritePaintWindowBorder; pScreen->CopyWindow = miSpriteCopyWindow; pScreen->ClearToBackground = miSpriteClearToBackground; pScreen->SaveDoomedAreas = miSpriteSaveDoomedAreas; pScreen->RestoreAreas = miSpriteRestoreAreas; return TRUE; } /* * Screen wrappers */ /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool miSpriteCloseScreen (i, pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->SourceValidate = pScreenPriv->SourceValidate; pScreen->CreateGC = pScreenPriv->CreateGC; pScreen->BlockHandler = pScreenPriv->BlockHandler; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground; pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder; pScreen->CopyWindow = pScreenPriv->CopyWindow; pScreen->ClearToBackground = pScreenPriv->ClearToBackground; pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas; pScreen->RestoreAreas = pScreenPriv->RestoreAreas; xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (i, pScreen); } static void miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planemask; char *pdstLine; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetImage); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h)) { miSpriteRemoveCursor (pScreen); } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); SCREEN_EPILOGUE (pScreen, GetImage, miSpriteGetImage); } static void miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) DrawablePtr pDrawable; int wMax; DDXPointPtr ppt; int *pwidth; int nspans; char *pdstStart; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetSpans); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp) { register DDXPointPtr pts; register int *widths; register int nPts; register int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y+yorg, pts->x+xorg,*widths)) { miSpriteRemoveCursor (pScreen); break; } } } (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); SCREEN_EPILOGUE (pScreen, GetSpans, miSpriteGetSpans); } static void miSpriteSourceValidate (pDrawable, x, y, width, height) DrawablePtr pDrawable; int x, y, width, height; { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, SourceValidate); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y, x, y, width, height)) { miSpriteRemoveCursor (pScreen); } if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height); SCREEN_EPILOGUE (pScreen, SourceValidate, miSpriteSourceValidate); } static Bool miSpriteCreateGC (pGC) GCPtr pGC; { ScreenPtr pScreen = pGC->pScreen; Bool ret; miSpriteGCPtr pPriv; SCREEN_PROLOGUE (pScreen, CreateGC); pPriv = (miSpriteGCPtr)pGC->devPrivates[miSpriteGCIndex].ptr; ret = (*pScreen->CreateGC) (pGC); pPriv->wrapOps = NULL; pPriv->wrapFuncs = pGC->funcs; pGC->funcs = &miSpriteGCFuncs; SCREEN_EPILOGUE (pScreen, CreateGC, miSpriteCreateGC); return ret; } static void miSpriteBlockHandler (i, blockData, pTimeout, pReadmask) int i; pointer blockData; OSTimePtr pTimeout; pointer pReadmask; { ScreenPtr pScreen = screenInfo.screens[i]; miSpriteScreenPtr pPriv; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, BlockHandler); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); SCREEN_EPILOGUE(pScreen, BlockHandler, miSpriteBlockHandler); if (!pPriv->isUp && pPriv->shouldBeUp) miSpriteRestoreCursor (pScreen); } static void miSpriteInstallColormap (pMap) ColormapPtr pMap; { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); SCREEN_EPILOGUE(pScreen, InstallColormap, miSpriteInstallColormap); pPriv->pInstalledMap = pMap; if (pPriv->pColormap != pMap) { pPriv->checkPixels = TRUE; if (pPriv->isUp) miSpriteRemoveCursor (pScreen); } } static void miSpriteStoreColors (pMap, ndef, pdef) ColormapPtr pMap; int ndef; xColorItem *pdef; { ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; int i; int updated; VisualPtr pVisual; pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); SCREEN_EPILOGUE(pScreen, StoreColors, miSpriteStoreColors); if (pPriv->pColormap == pMap) { updated = 0; pVisual = pMap->pVisual; if (pVisual->class == DirectColor) { /* Direct color - match on any of the subfields */ #define MaskMatch(a,b,mask) ((a) & (pVisual->mask) == (b) & (pVisual->mask)) #define UpdateDAC(plane,dac,mask) {\ if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\ pPriv->colors[plane].dac = pdef[i].dac; \ updated = 1; \ } \ } #define CheckDirect(plane) \ UpdateDAC(plane,red,redMask) \ UpdateDAC(plane,green,greenMask) \ UpdateDAC(plane,blue,blueMask) for (i = 0; i < ndef; i++) { CheckDirect (SOURCE_COLOR) CheckDirect (MASK_COLOR) } } else { /* PseudoColor/GrayScale - match on exact pixel */ for (i = 0; i < ndef; i++) { if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel) { pPriv->colors[SOURCE_COLOR] = pdef[i]; if (++updated == 2) break; } if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel) { pPriv->colors[MASK_COLOR] = pdef[i]; if (++updated == 2) break; } } } if (updated) { pPriv->checkPixels = TRUE; if (pPriv->isUp) miSpriteRemoveCursor (pScreen); } } } static void miSpriteFindColors (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; CursorPtr pCursor; xColorItem *sourceColor, *maskColor; pCursor = pScreenPriv->pCursor; sourceColor = &pScreenPriv->colors[SOURCE_COLOR]; maskColor = &pScreenPriv->colors[MASK_COLOR]; if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap || !(pCursor->foreRed == sourceColor->red && pCursor->foreGreen == sourceColor->green && pCursor->foreBlue == sourceColor->blue && pCursor->backRed == maskColor->red && pCursor->backGreen == maskColor->green && pCursor->backBlue == maskColor->blue)) { pScreenPriv->pColormap = pScreenPriv->pInstalledMap; sourceColor->red = pCursor->foreRed; sourceColor->green = pCursor->foreGreen; sourceColor->blue = pCursor->foreBlue; FakeAllocColor (pScreenPriv->pColormap, sourceColor); maskColor->red = pCursor->backRed; maskColor->green = pCursor->backGreen; maskColor->blue = pCursor->backBlue; FakeAllocColor (pScreenPriv->pColormap, maskColor); /* "free" the pixels right away, don't let this confuse you */ FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel); FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel); } pScreenPriv->checkPixels = FALSE; } /* * BackingStore wrappers */ static void miSpriteSaveDoomedAreas (pWin, pObscured, dx, dy) WindowPtr pWin; RegionPtr pObscured; int dx, dy; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; BoxRec cursorBox; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, SaveDoomedAreas); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { cursorBox = pScreenPriv->saved; if (dx || dy) { cursorBox.x1 += dx; cursorBox.y1 += dy; cursorBox.x2 += dx; cursorBox.y2 += dy; } if (RECT_IN_REGION( pScreen, pObscured, &cursorBox) != rgnOUT) miSpriteRemoveCursor (pScreen); } (*pScreen->SaveDoomedAreas) (pWin, pObscured, dx, dy); SCREEN_EPILOGUE (pScreen, SaveDoomedAreas, miSpriteSaveDoomedAreas); } static RegionPtr miSpriteRestoreAreas (pWin, prgnExposed) WindowPtr pWin; RegionPtr prgnExposed; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; RegionPtr result; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, RestoreAreas); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { if (RECT_IN_REGION( pScreen, prgnExposed, &pScreenPriv->saved) != rgnOUT) miSpriteRemoveCursor (pScreen); } result = (*pScreen->RestoreAreas) (pWin, prgnExposed); SCREEN_EPILOGUE (pScreen, RestoreAreas, miSpriteRestoreAreas); return result; } /* * Window wrappers */ static void miSpritePaintWindowBackground (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, PaintWindowBackground); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { /* * If the cursor is on the same screen as the window, check the * region to paint for the cursor and remove it as necessary */ if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT) miSpriteRemoveCursor (pScreen); } (*pScreen->PaintWindowBackground) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBackground, miSpritePaintWindowBackground); } static void miSpritePaintWindowBorder (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, PaintWindowBorder); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { /* * If the cursor is on the same screen as the window, check the * region to paint for the cursor and remove it as necessary */ if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT) miSpriteRemoveCursor (pScreen); } (*pScreen->PaintWindowBorder) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBorder, miSpritePaintWindowBorder); } static void miSpriteCopyWindow (pWin, ptOldOrg, pRegion) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr pRegion; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; BoxRec cursorBox; int dx, dy; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, CopyWindow); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pScreenPriv->isUp) { /* * check both the source and the destination areas. The given * region is source relative, so offset the cursor box by * the delta position */ cursorBox = pScreenPriv->saved; dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; cursorBox.x1 -= dx; cursorBox.x2 -= dx; cursorBox.y1 -= dy; cursorBox.y2 -= dy; if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT || RECT_IN_REGION( pScreen, pRegion, &cursorBox) != rgnOUT) miSpriteRemoveCursor (pScreen); } (*pScreen->CopyWindow) (pWin, ptOldOrg, pRegion); SCREEN_EPILOGUE (pScreen, CopyWindow, miSpriteCopyWindow); } static void miSpriteClearToBackground (pWin, x, y, w, h, generateExposures) WindowPtr pWin; short x,y; unsigned short w,h; Bool generateExposures; { ScreenPtr pScreen; miSpriteScreenPtr pScreenPriv; int realw, realh; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, ClearToBackground); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (GC_CHECK(pWin)) { if (!(realw = w)) realw = (int) pWin->drawable.width - x; if (!(realh = h)) realh = (int) pWin->drawable.height - y; if (ORG_OVERLAP(&pScreenPriv->saved, pWin->drawable.x, pWin->drawable.y, x, y, realw, realh)) { miSpriteRemoveCursor (pScreen); } } (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); SCREEN_EPILOGUE (pScreen, ClearToBackground, miSpriteClearToBackground); } /* * GC Func wrappers */ static void miSpriteValidateGC (pGC, changes, pDrawable) GCPtr pGC; Mask changes; DrawablePtr pDrawable; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); pGCPriv->wrapOps = NULL; if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr) pDrawable)->viewable) { WindowPtr pWin; RegionPtr pRegion; pWin = (WindowPtr) pDrawable; pRegion = &pWin->clipList; if (pGC->subWindowMode == IncludeInferiors) pRegion = &pWin->borderClip; if (REGION_NOTEMPTY(pDrawable->pScreen, pRegion)) pGCPriv->wrapOps = pGC->ops; } GC_FUNC_EPILOGUE (pGC); } static void miSpriteChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); GC_FUNC_EPILOGUE (pGC); } static void miSpriteCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { GC_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); GC_FUNC_EPILOGUE (pGCDst); } static void miSpriteDestroyGC (pGC) GCPtr pGC; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC) (pGC); GC_FUNC_EPILOGUE (pGC); } static void miSpriteChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); GC_FUNC_EPILOGUE (pGC); } static void miSpriteCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { GC_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); GC_FUNC_EPILOGUE (pgcDst); } static void miSpriteDestroyClip(pGC) GCPtr pGC; { GC_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); GC_FUNC_EPILOGUE (pGC); } /* * GC Op wrappers */ static void miSpriteFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = pptInit, widths = pwidthInit, nPts = nInit; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); GC_OP_EPILOGUE (pGC); } static void miSpriteSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { miSpriteRemoveCursor(pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); GC_OP_EPILOGUE (pGC); } static void miSpritePutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int format; char *pBits; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { if (ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, x,y,w,h)) { miSpriteRemoveCursor (pDrawable->pScreen); } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); GC_OP_EPILOGUE (pGC); } static RegionPtr miSpriteCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { RegionPtr rgn; GC_SETUP(pDst, pGC); /* check destination/source overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { miSpriteRemoveCursor (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); GC_OP_EPILOGUE (pGC); return rgn; } static RegionPtr miSpriteCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GCPtr pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane; { RegionPtr rgn; GC_SETUP(pDst, pGC); /* * check destination/source for overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { miSpriteRemoveCursor (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); GC_OP_EPILOGUE (pGC); return rgn; } static void miSpritePolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { xPoint t; int n; BoxRec cursor; register xPoint *pts; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor.x1 = pScreenPriv->saved.x1 - pDrawable->x; cursor.y1 = pScreenPriv->saved.y1 - pDrawable->y; cursor.x2 = pScreenPriv->saved.x2 - pDrawable->x; cursor.y2 = pScreenPriv->saved.y2 - pDrawable->y; if (mode == CoordModePrevious) { t.x = 0; t.y = 0; for (pts = pptInit, n = npt; n--; pts++) { t.x += pts->x; t.y += pts->y; if (cursor.x1 <= t.x && t.x <= cursor.x2 && cursor.y1 <= t.y && t.y <= cursor.y2) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } else { for (pts = pptInit, n = npt; n--; pts++) { if (cursor.x1 <= pts->x && pts->x <= cursor.x2 && cursor.y1 <= pts->y && pts->y <= cursor.y2) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC); } static void miSpritePolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { BoxPtr cursor; register DDXPointPtr pts; int n; int x, y, x1, y1, x2, y2; int lw; int extra; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; lw = pGC->lineWidth; x = pptInit->x + pDrawable->x; y = pptInit->y + pDrawable->y; if (npt == 1) { extra = lw >> 1; if (LINE_OVERLAP(cursor, x, y, x, y, extra)) miSpriteRemoveCursor (pDrawable->pScreen); } else { extra = lw >> 1; /* * mitered joins can project quite a way from * the line end; the 11 degree miter limit limits * this extension to 10.43 * lw / 2, rounded up * and converted to int yields 6 * lw */ if (pGC->joinStyle == JoinMiter) extra = 6 * lw; else if (pGC->capStyle == CapProjecting) extra = lw; for (pts = pptInit + 1, n = npt - 1; n--; pts++) { x1 = x; y1 = y; if (mode == CoordModeOrigin) { x2 = pDrawable->x + pts->x; y2 = pDrawable->y + pts->y; } else { x2 = x + pts->x; y2 = y + pts->y; } x = x2; y = y2; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC); } static void miSpritePolySegment(pDrawable, pGC, nseg, pSegs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegs; { int n; register xSegment *segs; BoxPtr cursor; int x1, y1, x2, y2; int extra; GC_SETUP(pDrawable, pGC); if (nseg && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; extra = pGC->lineWidth >> 1; if (pGC->capStyle == CapProjecting) extra = pGC->lineWidth; for (segs = pSegs, n = nseg; n--; segs++) { x1 = segs->x1 + pDrawable->x; y1 = segs->y1 + pDrawable->y; x2 = segs->x2 + pDrawable->x; y2 = segs->y2 + pDrawable->y; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolySegment) (pDrawable, pGC, nseg, pSegs); GC_OP_EPILOGUE (pGC); } static void miSpritePolyRectangle(pDrawable, pGC, nrects, pRects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *pRects; { register xRectangle *rects; BoxPtr cursor; int lw; int n; int x1, y1, x2, y2; GC_SETUP (pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { lw = pGC->lineWidth >> 1; cursor = &pScreenPriv->saved; for (rects = pRects, n = nrects; n--; rects++) { x1 = rects->x + pDrawable->x; y1 = rects->y + pDrawable->y; x2 = x1 + (int)rects->width; y2 = y1 + (int)rects->height; if (LINE_OVERLAP(cursor, x1, y1, x2, y1, lw) || LINE_OVERLAP(cursor, x2, y1, x2, y2, lw) || LINE_OVERLAP(cursor, x1, y2, x2, y2, lw) || LINE_OVERLAP(cursor, x1, y1, x1, y2, lw)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyRectangle) (pDrawable, pGC, nrects, pRects); GC_OP_EPILOGUE (pGC); } static void miSpritePolyArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; register GCPtr pGC; int narcs; xArc *parcs; { BoxPtr cursor; int lw; int n; register xArc *arcs; GC_SETUP (pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { lw = pGC->lineWidth >> 1; cursor = &pScreenPriv->saved; for (arcs = parcs, n = narcs; n--; arcs++) { if (ORG_OVERLAP (cursor, pDrawable->x, pDrawable->y, arcs->x - lw, arcs->y - lw, (int) arcs->width + pGC->lineWidth, (int) arcs->height + pGC->lineWidth)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, parcs); GC_OP_EPILOGUE (pGC); } static void miSpriteFillPolygon(pDrawable, pGC, shape, mode, count, pPts) register DrawablePtr pDrawable; register GCPtr pGC; int shape, mode; int count; DDXPointPtr pPts; { int x, y, minx, miny, maxx, maxy; register DDXPointPtr pts; int n; GC_SETUP (pDrawable, pGC); if (count && GC_CHECK((WindowPtr) pDrawable)) { x = pDrawable->x; y = pDrawable->y; pts = pPts; minx = maxx = pts->x; miny = maxy = pts->y; pts++; n = count - 1; if (mode == CoordModeOrigin) { for (; n--; pts++) { if (pts->x < minx) minx = pts->x; else if (pts->x > maxx) maxx = pts->x; if (pts->y < miny) miny = pts->y; else if (pts->y > maxy) maxy = pts->y; } minx += x; miny += y; maxx += x; maxy += y; } else { x += minx; y += miny; minx = maxx = x; miny = maxy = y; for (; n--; pts++) { x += pts->x; y += pts->y; if (x < minx) minx = x; else if (x > maxx) maxx = x; if (y < miny) miny = y; else if (y > maxy) maxy = y; } } if (BOX_OVERLAP(&pScreenPriv->saved,minx,miny,maxx,maxy)) miSpriteRemoveCursor (pDrawable->pScreen); } GC_OP_PROLOGUE (pGC); (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pPts); GC_OP_EPILOGUE (pGC); } static void miSpritePolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register int nRect; register xRectangle *pRect; register int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (nRect = nrectFill, pRect = prectInit; nRect--; pRect++) { if (ORGRECT_OVERLAP(&pScreenPriv->saved,xorg,yorg,pRect)){ miSpriteRemoveCursor(pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrectFill, prectInit); GC_OP_EPILOGUE (pGC); } static void miSpritePolyFillArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register int n; BoxPtr cursor; register xArc *arcs; cursor = &pScreenPriv->saved; for (arcs = parcs, n = narcs; n--; arcs++) { if (ORG_OVERLAP(cursor, pDrawable->x, pDrawable->y, arcs->x, arcs->y, (int) arcs->width, (int) arcs->height)) { miSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, parcs); GC_OP_EPILOGUE (pGC); } /* * general Poly/Image text function. Extract glyph information, * compute bounding box and remove cursor if it is overlapped. */ static Bool miSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox) DrawablePtr pDraw; FontPtr font; int x, y; unsigned int n; CharInfoPtr *charinfo; Bool imageblt; unsigned int w; BoxPtr cursorBox; { ExtentInfoRec extents; x += pDraw->x; y += pDraw->y; if (FONTMINBOUNDS(font,characterWidth) >= 0) { /* compute an approximate (but covering) bounding box */ if (!imageblt || (charinfo[0]->metrics.leftSideBearing < 0)) extents.overallLeft = charinfo[0]->metrics.leftSideBearing; else extents.overallLeft = 0; if (w) extents.overallRight = w - charinfo[n-1]->metrics.characterWidth; else extents.overallRight = FONTMAXBOUNDS(font,characterWidth) * (n - 1); if (imageblt && (charinfo[n-1]->metrics.characterWidth > charinfo[n-1]->metrics.rightSideBearing)) extents.overallRight += charinfo[n-1]->metrics.characterWidth; else extents.overallRight += charinfo[n-1]->metrics.rightSideBearing; if (imageblt && FONTASCENT(font) > FONTMAXBOUNDS(font,ascent)) extents.overallAscent = FONTASCENT(font); else extents.overallAscent = FONTMAXBOUNDS(font, ascent); if (imageblt && FONTDESCENT(font) > FONTMAXBOUNDS(font,descent)) extents.overallDescent = FONTDESCENT(font); else extents.overallDescent = FONTMAXBOUNDS(font,descent); if (!BOX_OVERLAP(cursorBox, x + extents.overallLeft, y - extents.overallAscent, x + extents.overallRight, y + extents.overallDescent)) return FALSE; else if (imageblt && w) return TRUE; /* if it does overlap, fall through and compute exactly, because * taking down the cursor is expensive enough to make this worth it */ } QueryGlyphExtents(font, charinfo, n, &extents); if (imageblt) { if (extents.overallWidth > extents.overallRight) extents.overallRight = extents.overallWidth; if (extents.overallWidth < extents.overallLeft) extents.overallLeft = extents.overallWidth; if (extents.overallLeft > 0) extents.overallLeft = 0; if (extents.fontAscent > extents.overallAscent) extents.overallAscent = extents.fontAscent; if (extents.fontDescent > extents.overallDescent) extents.overallDescent = extents.fontDescent; } return (BOX_OVERLAP(cursorBox, x + extents.overallLeft, y - extents.overallAscent, x + extents.overallRight, y + extents.overallDescent)); } /* * values for textType: */ #define TT_POLY8 0 #define TT_IMAGE8 1 #define TT_POLY16 2 #define TT_IMAGE16 3 static int miSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox) DrawablePtr pDraw; GCPtr pGC; int x, y; unsigned long count; char *chars; FontEncoding fontEncoding; Bool textType; BoxPtr cursorBox; { CharInfoPtr *charinfo; register CharInfoPtr *info; unsigned long i; unsigned int n; int w; void (*drawFunc)(); Bool imageblt; imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr)); if (!charinfo) return x; GetGlyphs(pGC->font, count, (unsigned char *)chars, fontEncoding, &i, charinfo); n = (unsigned int)i; w = 0; if (!imageblt) for (info = charinfo; i--; info++) w += (*info)->metrics.characterWidth; if (n != 0) { if (miSpriteTextOverlap(pDraw, pGC->font, x, y, n, charinfo, imageblt, w, cursorBox)) miSpriteRemoveCursor(pDraw->pScreen); #ifdef AVOID_GLYPHBLT /* * On displays like Apollos, which do not optimize the GlyphBlt functions because they * convert fonts to their internal form in RealizeFont and optimize text directly, we * want to invoke the text functions here, not the GlyphBlt functions. */ switch (textType) { case TT_POLY8: drawFunc = (void (*)())pGC->ops->PolyText8; break; case TT_IMAGE8: drawFunc = pGC->ops->ImageText8; break; case TT_POLY16: drawFunc = (void (*)())pGC->ops->PolyText16; break; case TT_IMAGE16: drawFunc = pGC->ops->ImageText16; break; } (*drawFunc) (pDraw, pGC, x, y, (int) count, chars); #else /* don't AVOID_GLYPHBLT */ /* * On the other hand, if the device does use GlyphBlt ultimately to do text, we * don't want to slow it down by invoking the text functions and having them call * GetGlyphs all over again, so we go directly to the GlyphBlt functions here. */ drawFunc = imageblt ? pGC->ops->ImageGlyphBlt : pGC->ops->PolyGlyphBlt; (*drawFunc) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); #endif /* AVOID_GLYPHBLT */ } DEALLOCATE_LOCAL(charinfo); return x + w; } static int miSpritePolyText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { int ret; GC_SETUP (pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) ret = miSpriteText (pDrawable, pGC, x, y, (unsigned long)count, chars, Linear8Bit, TT_POLY8, &pScreenPriv->saved); else ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); return ret; } static int miSpritePolyText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { int ret; GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) ret = miSpriteText (pDrawable, pGC, x, y, (unsigned long)count, (char *)chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_POLY16, &pScreenPriv->saved); else ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); return ret; } static void miSpriteImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) (void) miSpriteText (pDrawable, pGC, x, y, (unsigned long)count, chars, Linear8Bit, TT_IMAGE8, &pScreenPriv->saved); else (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); } static void miSpriteImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) (void) miSpriteText (pDrawable, pGC, x, y, (unsigned long)count, (char *)chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_IMAGE16, &pScreenPriv->saved); else (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); } static void miSpriteImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable) && miSpriteTextOverlap (pDrawable, pGC->font, x, y, nglyph, ppci, TRUE, 0, &pScreenPriv->saved)) { miSpriteRemoveCursor(pDrawable->pScreen); } (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); GC_OP_EPILOGUE (pGC); } static void miSpritePolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { GC_SETUP (pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable) && miSpriteTextOverlap (pDrawable, pGC->font, x, y, nglyph, ppci, FALSE, 0, &pScreenPriv->saved)) { miSpriteRemoveCursor(pDrawable->pScreen); } (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); GC_OP_EPILOGUE (pGC); } static void miSpritePushPixels(pGC, pBitMap, pDrawable, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int w, h, x, y; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable) && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y,x,y,w,h)) { miSpriteRemoveCursor (pDrawable->pScreen); } GC_OP_PROLOGUE (pGC); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); GC_OP_EPILOGUE (pGC); } #ifdef NEED_LINEHELPER /* * I don't expect this routine will ever be called, as the GC * will have been unwrapped for the line drawing */ static void miSpriteLineHelper() { FatalError("miSpriteLineHelper called\n"); } #endif /* * miPointer interface routines */ #define SPRITE_PAD 8 static Bool miSpriteRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; if (pCursor == pScreenPriv->pCursor) pScreenPriv->checkPixels = TRUE; return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor); } static Bool miSpriteUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); } static void miSpriteSetCursor (pScreen, pCursor, x, y) ScreenPtr pScreen; CursorPtr pCursor; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pScreenPriv->shouldBeUp = TRUE; if (pScreenPriv->x == x && pScreenPriv->y == y && pScreenPriv->pCursor == pCursor && !pScreenPriv->checkPixels) { return; } if (!pCursor) { pScreenPriv->shouldBeUp = FALSE; if (pScreenPriv->isUp) miSpriteRemoveCursor (pScreen); pScreenPriv->pCursor = 0; return; } pScreenPriv->x = x; pScreenPriv->y = y; pScreenPriv->pCacheWin = NullWindow; if (pScreenPriv->checkPixels || pScreenPriv->pCursor != pCursor) { pScreenPriv->pCursor = pCursor; miSpriteFindColors (pScreen); } if (pScreenPriv->isUp) { int sx, sy; /* * check to see if the old saved region * encloses the new sprite, in which case we use * the flicker-free MoveCursor primitive. */ sx = pScreenPriv->x - (int)pCursor->bits->xhot; sy = pScreenPriv->y - (int)pCursor->bits->yhot; if (sx + (int) pCursor->bits->width >= pScreenPriv->saved.x1 && sx < pScreenPriv->saved.x2 && sy + (int) pCursor->bits->height >= pScreenPriv->saved.y1 && sy < pScreenPriv->saved.y2 && (int) pCursor->bits->width + (2 * SPRITE_PAD) == pScreenPriv->saved.x2 - pScreenPriv->saved.x1 && (int) pCursor->bits->height + (2 * SPRITE_PAD) == pScreenPriv->saved.y2 - pScreenPriv->saved.y1 ) { pScreenPriv->isUp = FALSE; if (!(sx >= pScreenPriv->saved.x1 && sx + (int)pCursor->bits->width < pScreenPriv->saved.x2 && sy >= pScreenPriv->saved.y1 && sy + (int)pCursor->bits->height < pScreenPriv->saved.y2)) { int oldx1, oldy1, dx, dy; oldx1 = pScreenPriv->saved.x1; oldy1 = pScreenPriv->saved.y1; dx = oldx1 - (sx - SPRITE_PAD); dy = oldy1 - (sy - SPRITE_PAD); pScreenPriv->saved.x1 -= dx; pScreenPriv->saved.y1 -= dy; pScreenPriv->saved.x2 -= dx; pScreenPriv->saved.y2 -= dy; (void) (*pScreenPriv->funcs->ChangeSave) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1, dx, dy); } (void) (*pScreenPriv->funcs->MoveCursor) (pScreen, pCursor, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1, sx - pScreenPriv->saved.x1, sy - pScreenPriv->saved.y1, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel); pScreenPriv->isUp = TRUE; } else { miSpriteRemoveCursor (pScreen); } } if (!pScreenPriv->isUp && pScreenPriv->pCursor) miSpriteRestoreCursor (pScreen); } static void miSpriteMoveCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; miSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y); } /* * undraw/draw cursor */ static void miSpriteRemoveCursor (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pScreenPriv->isUp = FALSE; pScreenPriv->pCacheWin = NullWindow; if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { pScreenPriv->isUp = TRUE; } } /* * Called from the block handler, restores the cursor * before waiting for something to do. */ static void miSpriteRestoreCursor (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; int x, y; CursorPtr pCursor; miSpriteComputeSaved (pScreen); pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; if ((*pScreenPriv->funcs->SaveUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { if (pScreenPriv->checkPixels) miSpriteFindColors (pScreen); if ((*pScreenPriv->funcs->PutUpCursor) (pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) pScreenPriv->isUp = TRUE; } } /* * compute the desired area of the screen to save */ static void miSpriteComputeSaved (pScreen) ScreenPtr pScreen; { miSpriteScreenPtr pScreenPriv; int x, y, w, h; int wpad, hpad; CursorPtr pCursor; pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; w = pCursor->bits->width; h = pCursor->bits->height; wpad = SPRITE_PAD; hpad = SPRITE_PAD; pScreenPriv->saved.x1 = x - wpad; pScreenPriv->saved.y1 = y - hpad; pScreenPriv->saved.x2 = pScreenPriv->saved.x1 + w + wpad * 2; pScreenPriv->saved.y2 = pScreenPriv->saved.y1 + h + hpad * 2; } vnc_unixsrc/Xvnc/programs/Xserver/hw/0040775000076400007640000000000010616336474017331 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/0040775000076400007640000000000010616336474020117 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/rfbserver.c0100664000076400007640000012052110533024757022255 0ustar constconst/* * rfbserver.c - deal with server-side of the RFB protocol. */ /* * Copyright (C) 2000-2006 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Use ``#define CORBA'' to enable CORBA control interface */ #include #include #include #include #include #include #include #include #include "windowstr.h" #include "rfb.h" #include "input.h" #include "mipointer.h" #include "sprite.h" #ifdef CORBA #include #endif char updateBuf[UPDATE_BUF_SIZE]; int ublen; rfbClientPtr rfbClientHead = NULL; rfbClientPtr pointerClient = NULL; /* Mutex for pointer events */ Bool rfbAlwaysShared = FALSE; Bool rfbNeverShared = FALSE; Bool rfbDontDisconnect = FALSE; Bool rfbViewOnly = FALSE; /* run server in view only mode - Ehud Karni SW */ static rfbClientPtr rfbNewClient(int sock); static void rfbProcessClientProtocolVersion(rfbClientPtr cl); static void rfbProcessClientInitMessage(rfbClientPtr cl); static void rfbSendInteractionCaps(rfbClientPtr cl); static void rfbProcessClientNormalMessage(rfbClientPtr cl); static Bool rfbSendCopyRegion(rfbClientPtr cl, RegionPtr reg, int dx, int dy); static Bool rfbSendLastRectMarker(rfbClientPtr cl); /* * rfbNewClientConnection is called from sockets.c when a new connection * comes in. */ void rfbNewClientConnection(sock) int sock; { rfbClientPtr cl; cl = rfbNewClient(sock); #ifdef CORBA if (cl != NULL) newConnection(cl, (KEYBOARD_DEVICE|POINTER_DEVICE), 1, 1, 1); #endif } /* * rfbReverseConnection is called by the CORBA stuff to make an outward * connection to a "listening" RFB client. */ rfbClientPtr rfbReverseConnection(host, port) char *host; int port; { int sock; rfbClientPtr cl; if ((sock = rfbConnect(host, port)) < 0) return (rfbClientPtr)NULL; cl = rfbNewClient(sock); if (cl) { cl->reverseConnection = TRUE; } return cl; } /* * rfbNewClient is called when a new connection has been made by whatever * means. */ static rfbClientPtr rfbNewClient(sock) int sock; { rfbProtocolVersionMsg pv; rfbClientPtr cl; BoxRec box; struct sockaddr_in addr; int addrlen = sizeof(struct sockaddr_in); int i; if (rfbClientHead == NULL) { /* no other clients - make sure we don't think any keys are pressed */ KbdReleaseAllKeys(); } else { rfbLog(" (other clients"); for (cl = rfbClientHead; cl; cl = cl->next) { fprintf(stderr," %s",cl->host); } fprintf(stderr,")\n"); } cl = (rfbClientPtr)xalloc(sizeof(rfbClientRec)); cl->sock = sock; getpeername(sock, (struct sockaddr *)&addr, &addrlen); cl->host = strdup(inet_ntoa(addr.sin_addr)); cl->login = NULL; /* Dispatch client input to rfbProcessClientProtocolVersion(). */ cl->state = RFB_PROTOCOL_VERSION; cl->viewOnly = FALSE; cl->reverseConnection = FALSE; cl->readyForSetColourMapEntries = FALSE; cl->useCopyRect = FALSE; cl->preferredEncoding = rfbEncodingRaw; cl->correMaxWidth = 48; cl->correMaxHeight = 48; REGION_INIT(pScreen,&cl->copyRegion,NullBox,0); cl->copyDX = 0; cl->copyDY = 0; box.x1 = box.y1 = 0; box.x2 = rfbScreen.width; box.y2 = rfbScreen.height; REGION_INIT(pScreen,&cl->modifiedRegion,&box,0); REGION_INIT(pScreen,&cl->requestedRegion,NullBox,0); cl->deferredUpdateScheduled = FALSE; cl->deferredUpdateTimer = NULL; cl->format = rfbServerFormat; cl->translateFn = rfbTranslateNone; cl->translateLookupTable = NULL; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightQualityLevel = -1; for (i = 0; i < 4; i++) cl->zsActive[i] = FALSE; cl->enableCursorShapeUpdates = FALSE; cl->enableCursorPosUpdates = FALSE; cl->enableLastRectEncoding = FALSE; cl->next = rfbClientHead; rfbClientHead = cl; rfbResetStats(cl); cl->compStreamInited = FALSE; cl->compStream.total_in = 0; cl->compStream.total_out = 0; cl->compStream.zalloc = Z_NULL; cl->compStream.zfree = Z_NULL; cl->compStream.opaque = Z_NULL; cl->zlibCompressLevel = 5; sprintf(pv, rfbProtocolVersionFormat, 3, 8); if (WriteExact(sock, pv, sz_rfbProtocolVersionMsg) < 0) { rfbLogPerror("rfbNewClient: write"); rfbCloseSock(sock); return NULL; } return cl; } /* * rfbClientConnectionGone is called from sockets.c just after a connection * has gone away. */ void rfbClientConnectionGone(sock) int sock; { rfbClientPtr cl, prev; int i; for (prev = NULL, cl = rfbClientHead; cl; prev = cl, cl = cl->next) { if (sock == cl->sock) break; } if (!cl) { rfbLog("rfbClientConnectionGone: unknown socket %d\n",sock); return; } if (cl->login != NULL) { rfbLog("Client %s (%s) gone\n", cl->login, cl->host); free(cl->login); } else { rfbLog("Client %s gone\n", cl->host); } free(cl->host); /* Release the compression state structures if any. */ if ( cl->compStreamInited == TRUE ) { deflateEnd( &(cl->compStream) ); } for (i = 0; i < 4; i++) { if (cl->zsActive[i]) deflateEnd(&cl->zsStruct[i]); } if (pointerClient == cl) pointerClient = NULL; #ifdef CORBA destroyConnection(cl); #endif if (prev) prev->next = cl->next; else rfbClientHead = cl->next; REGION_UNINIT(pScreen,&cl->copyRegion); REGION_UNINIT(pScreen,&cl->modifiedRegion); TimerFree(cl->deferredUpdateTimer); rfbPrintStats(cl); if (cl->translateLookupTable) free(cl->translateLookupTable); xfree(cl); } /* * rfbProcessClientMessage is called when there is data to read from a client. */ void rfbProcessClientMessage(sock) int sock; { rfbClientPtr cl; for (cl = rfbClientHead; cl; cl = cl->next) { if (sock == cl->sock) break; } if (!cl) { rfbLog("rfbProcessClientMessage: unknown socket %d\n",sock); rfbCloseSock(sock); return; } #ifdef CORBA if (isClosePending(cl)) { rfbLog("Closing connection to client %s\n", cl->host); rfbCloseSock(sock); return; } #endif switch (cl->state) { case RFB_PROTOCOL_VERSION: rfbProcessClientProtocolVersion(cl); break; case RFB_SECURITY_TYPE: /* protocol versions 3.7 and above */ rfbProcessClientSecurityType(cl); break; case RFB_TUNNELING_TYPE: /* protocol versions 3.7t, 3.8t */ rfbProcessClientTunnelingType(cl); break; case RFB_AUTH_TYPE: /* protocol versions 3.7t, 3.8t */ rfbProcessClientAuthType(cl); break; case RFB_AUTHENTICATION: rfbVncAuthProcessResponse(cl); break; case RFB_INITIALISATION: rfbProcessClientInitMessage(cl); break; default: rfbProcessClientNormalMessage(cl); } } /* * rfbProcessClientProtocolVersion is called when the client sends its * protocol version. */ static void rfbProcessClientProtocolVersion(cl) rfbClientPtr cl; { rfbProtocolVersionMsg pv; int n, major, minor; Bool mismatch; if ((n = ReadExact(cl->sock, pv, sz_rfbProtocolVersionMsg)) <= 0) { if (n == 0) rfbLog("rfbProcessClientProtocolVersion: client gone\n"); else rfbLogPerror("rfbProcessClientProtocolVersion: read"); rfbCloseSock(cl->sock); return; } pv[sz_rfbProtocolVersionMsg] = 0; if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) { rfbLog("rfbProcessClientProtocolVersion: not a valid RFB client\n"); rfbCloseSock(cl->sock); return; } if (major != 3) { rfbLog("Unsupported protocol version %d.%d\n", major, minor); rfbCloseSock(cl->sock); return; } /* Always use one of the three standard versions of the RFB protocol. */ cl->protocol_minor_ver = minor; if (minor > 8) { /* buggy client */ cl->protocol_minor_ver = 8; } else if (minor > 3 && minor < 7) { /* non-standard client */ cl->protocol_minor_ver = 3; } else if (minor < 3) { /* ancient client */ cl->protocol_minor_ver = 3; } if (cl->protocol_minor_ver != minor) { rfbLog("Non-standard protocol version 3.%d, using 3.%d instead\n", minor, cl->protocol_minor_ver); } else { rfbLog("Using protocol version 3.%d\n", cl->protocol_minor_ver); } /* TightVNC protocol extensions are not enabled yet. */ cl->protocol_tightvnc = FALSE; rfbAuthNewClient(cl); } /* * rfbProcessClientInitMessage is called when the client sends its * initialisation message. */ static void rfbProcessClientInitMessage(cl) rfbClientPtr cl; { rfbClientInitMsg ci; char buf[256]; rfbServerInitMsg *si = (rfbServerInitMsg *)buf; struct passwd *user; int len, n; rfbClientPtr otherCl, nextCl; if ((n = ReadExact(cl->sock, (char *)&ci,sz_rfbClientInitMsg)) <= 0) { if (n == 0) rfbLog("rfbProcessClientInitMessage: client gone\n"); else rfbLogPerror("rfbProcessClientInitMessage: read"); rfbCloseSock(cl->sock); return; } si->framebufferWidth = Swap16IfLE(rfbScreen.width); si->framebufferHeight = Swap16IfLE(rfbScreen.height); si->format = rfbServerFormat; si->format.redMax = Swap16IfLE(si->format.redMax); si->format.greenMax = Swap16IfLE(si->format.greenMax); si->format.blueMax = Swap16IfLE(si->format.blueMax); user = getpwuid(getuid()); if (strlen(desktopName) > 128) /* sanity check on desktop name len */ desktopName[128] = 0; if (user) { sprintf(buf + sz_rfbServerInitMsg, "%s's %s desktop (%s:%s)", user->pw_name, desktopName, rfbThisHost, display); } else { sprintf(buf + sz_rfbServerInitMsg, "%s desktop (%s:%s)", desktopName, rfbThisHost, display); } len = strlen(buf + sz_rfbServerInitMsg); si->nameLength = Swap32IfLE(len); if (WriteExact(cl->sock, buf, sz_rfbServerInitMsg + len) < 0) { rfbLogPerror("rfbProcessClientInitMessage: write"); rfbCloseSock(cl->sock); return; } if (cl->protocol_tightvnc) rfbSendInteractionCaps(cl); /* protocol 3.7t */ /* Dispatch client input to rfbProcessClientNormalMessage(). */ cl->state = RFB_NORMAL; if (!cl->reverseConnection && (rfbNeverShared || (!rfbAlwaysShared && !ci.shared))) { if (rfbDontDisconnect) { for (otherCl = rfbClientHead; otherCl; otherCl = otherCl->next) { if ((otherCl != cl) && (otherCl->state == RFB_NORMAL)) { rfbLog("-dontdisconnect: Not shared & existing client\n"); rfbLog(" refusing new client %s\n", cl->host); rfbCloseSock(cl->sock); return; } } } else { for (otherCl = rfbClientHead; otherCl; otherCl = nextCl) { nextCl = otherCl->next; if ((otherCl != cl) && (otherCl->state == RFB_NORMAL)) { rfbLog("Not shared - closing connection to client %s\n", otherCl->host); rfbCloseSock(otherCl->sock); } } } } } /* * rfbSendInteractionCaps is called after sending the server * initialisation message, only if TightVNC protocol extensions were * enabled (protocol versions 3.7t, 3.8t). In this function, we send * the lists of supported protocol messages and encodings. */ /* Update these constants on changing capability lists below! */ #define N_SMSG_CAPS 0 #define N_CMSG_CAPS 0 #define N_ENC_CAPS 12 void rfbSendInteractionCaps(cl) rfbClientPtr cl; { rfbInteractionCapsMsg intr_caps; rfbCapabilityInfo enc_list[N_ENC_CAPS]; int i; /* Fill in the header structure sent prior to capability lists. */ intr_caps.nServerMessageTypes = Swap16IfLE(N_SMSG_CAPS); intr_caps.nClientMessageTypes = Swap16IfLE(N_CMSG_CAPS); intr_caps.nEncodingTypes = Swap16IfLE(N_ENC_CAPS); intr_caps.pad = 0; /* Supported server->client message types. */ /* For future file transfer support: i = 0; SetCapInfo(&smsg_list[i++], rfbFileListData, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileDownloadData, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileUploadCancel, rfbTightVncVendor); SetCapInfo(&smsg_list[i++], rfbFileDownloadFailed, rfbTightVncVendor); if (i != N_SMSG_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_SMSG_CAPS\n"); rfbCloseSock(cl->sock); return; } */ /* Supported client->server message types. */ /* For future file transfer support: i = 0; SetCapInfo(&cmsg_list[i++], rfbFileListRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileDownloadRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadRequest, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadData, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileDownloadCancel, rfbTightVncVendor); SetCapInfo(&cmsg_list[i++], rfbFileUploadFailed, rfbTightVncVendor); if (i != N_CMSG_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_CMSG_CAPS\n"); rfbCloseSock(cl->sock); return; } */ /* Encoding types. */ i = 0; SetCapInfo(&enc_list[i++], rfbEncodingCopyRect, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingRRE, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingCoRRE, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingHextile, rfbStandardVendor); SetCapInfo(&enc_list[i++], rfbEncodingZlib, rfbTridiaVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingTight, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingCompressLevel0, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingQualityLevel0, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingXCursor, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingRichCursor, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingPointerPos, rfbTightVncVendor); SetCapInfo(&enc_list[i++], rfbEncodingLastRect, rfbTightVncVendor); if (i != N_ENC_CAPS) { rfbLog("rfbSendInteractionCaps: assertion failed, i != N_ENC_CAPS\n"); rfbCloseSock(cl->sock); return; } /* Send header and capability lists */ if (WriteExact(cl->sock, (char *)&intr_caps, sz_rfbInteractionCapsMsg) < 0 || WriteExact(cl->sock, (char *)&enc_list[0], sz_rfbCapabilityInfo * N_ENC_CAPS) < 0) { rfbLogPerror("rfbSendInteractionCaps: write"); rfbCloseSock(cl->sock); return; } /* Dispatch client input to rfbProcessClientNormalMessage(). */ cl->state = RFB_NORMAL; } /* * rfbProcessClientNormalMessage is called when the client has sent a normal * protocol message. */ static void rfbProcessClientNormalMessage(cl) rfbClientPtr cl; { int n; rfbClientToServerMsg msg; char *str; if ((n = ReadExact(cl->sock, (char *)&msg, 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } switch (msg.type) { case rfbSetPixelFormat: if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbSetPixelFormatMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } cl->format.bitsPerPixel = msg.spf.format.bitsPerPixel; cl->format.depth = msg.spf.format.depth; cl->format.bigEndian = (msg.spf.format.bigEndian ? 1 : 0); cl->format.trueColour = (msg.spf.format.trueColour ? 1 : 0); cl->format.redMax = Swap16IfLE(msg.spf.format.redMax); cl->format.greenMax = Swap16IfLE(msg.spf.format.greenMax); cl->format.blueMax = Swap16IfLE(msg.spf.format.blueMax); cl->format.redShift = msg.spf.format.redShift; cl->format.greenShift = msg.spf.format.greenShift; cl->format.blueShift = msg.spf.format.blueShift; cl->readyForSetColourMapEntries = TRUE; rfbSetTranslateFunction(cl); return; case rfbFixColourMapEntries: if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbFixColourMapEntriesMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } rfbLog("rfbProcessClientNormalMessage: %s", "FixColourMapEntries unsupported\n"); rfbCloseSock(cl->sock); return; case rfbSetEncodings: { int i; CARD32 enc; if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbSetEncodingsMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } msg.se.nEncodings = Swap16IfLE(msg.se.nEncodings); cl->preferredEncoding = -1; cl->useCopyRect = FALSE; cl->enableCursorShapeUpdates = FALSE; cl->enableCursorPosUpdates = FALSE; cl->enableLastRectEncoding = FALSE; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightQualityLevel = -1; for (i = 0; i < msg.se.nEncodings; i++) { if ((n = ReadExact(cl->sock, (char *)&enc, 4)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } enc = Swap32IfLE(enc); switch (enc) { case rfbEncodingCopyRect: cl->useCopyRect = TRUE; break; case rfbEncodingRaw: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using raw encoding for client %s\n", cl->host); } break; case rfbEncodingRRE: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using rre encoding for client %s\n", cl->host); } break; case rfbEncodingCoRRE: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using CoRRE encoding for client %s\n", cl->host); } break; case rfbEncodingHextile: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using hextile encoding for client %s\n", cl->host); } break; case rfbEncodingZlib: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using zlib encoding for client %s\n", cl->host); } break; case rfbEncodingTight: if (cl->preferredEncoding == -1) { cl->preferredEncoding = enc; rfbLog("Using tight encoding for client %s\n", cl->host); } break; case rfbEncodingXCursor: rfbLog("Enabling X-style cursor updates for client %s\n", cl->host); cl->enableCursorShapeUpdates = TRUE; cl->useRichCursorEncoding = FALSE; cl->cursorWasChanged = TRUE; break; case rfbEncodingRichCursor: if (!cl->enableCursorShapeUpdates) { rfbLog("Enabling full-color cursor updates for client " "%s\n", cl->host); cl->enableCursorShapeUpdates = TRUE; cl->useRichCursorEncoding = TRUE; cl->cursorWasChanged = TRUE; } break; case rfbEncodingPointerPos: if (!cl->enableCursorPosUpdates) { rfbLog("Enabling cursor position updates for client %s\n", cl->host); cl->enableCursorPosUpdates = TRUE; cl->cursorWasMoved = TRUE; cl->cursorX = -1; cl->cursorY = -1; } break; case rfbEncodingLastRect: if (!cl->enableLastRectEncoding) { rfbLog("Enabling LastRect protocol extension for client " "%s\n", cl->host); cl->enableLastRectEncoding = TRUE; } break; default: if ( enc >= (CARD32)rfbEncodingCompressLevel0 && enc <= (CARD32)rfbEncodingCompressLevel9 ) { cl->zlibCompressLevel = enc & 0x0F; cl->tightCompressLevel = enc & 0x0F; rfbLog("Using compression level %d for client %s\n", cl->tightCompressLevel, cl->host); } else if ( enc >= (CARD32)rfbEncodingQualityLevel0 && enc <= (CARD32)rfbEncodingQualityLevel9 ) { cl->tightQualityLevel = enc & 0x0F; rfbLog("Using image quality level %d for client %s\n", cl->tightQualityLevel, cl->host); } else { rfbLog("rfbProcessClientNormalMessage: ignoring unknown " "encoding %d\n", (int)enc); } } } if (cl->preferredEncoding == -1) { cl->preferredEncoding = rfbEncodingRaw; } if (cl->enableCursorPosUpdates && !cl->enableCursorShapeUpdates) { rfbLog("Disabling cursor position updates for client %s\n", cl->host); cl->enableCursorPosUpdates = FALSE; } return; } case rfbFramebufferUpdateRequest: { RegionRec tmpRegion; BoxRec box; #ifdef CORBA addCapability(cl, DISPLAY_DEVICE); #endif if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbFramebufferUpdateRequestMsg-1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } box.x1 = Swap16IfLE(msg.fur.x); box.y1 = Swap16IfLE(msg.fur.y); box.x2 = box.x1 + Swap16IfLE(msg.fur.w); box.y2 = box.y1 + Swap16IfLE(msg.fur.h); SAFE_REGION_INIT(pScreen,&tmpRegion,&box,0); REGION_UNION(pScreen, &cl->requestedRegion, &cl->requestedRegion, &tmpRegion); if (!cl->readyForSetColourMapEntries) { /* client hasn't sent a SetPixelFormat so is using server's */ cl->readyForSetColourMapEntries = TRUE; if (!cl->format.trueColour) { if (!rfbSetClientColourMap(cl, 0, 0)) { REGION_UNINIT(pScreen,&tmpRegion); return; } } } if (!msg.fur.incremental) { REGION_UNION(pScreen,&cl->modifiedRegion,&cl->modifiedRegion, &tmpRegion); REGION_SUBTRACT(pScreen,&cl->copyRegion,&cl->copyRegion, &tmpRegion); } if (FB_UPDATE_PENDING(cl)) { rfbSendFramebufferUpdate(cl); } REGION_UNINIT(pScreen,&tmpRegion); return; } case rfbKeyEvent: cl->rfbKeyEventsRcvd++; if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbKeyEventMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } #ifdef CORBA addCapability(cl, KEYBOARD_DEVICE); if (!isKeyboardEnabled(cl)) return; #endif if (!rfbViewOnly && !cl->viewOnly) { KbdAddEvent(msg.ke.down, (KeySym)Swap32IfLE(msg.ke.key), cl); } return; case rfbPointerEvent: cl->rfbPointerEventsRcvd++; if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbPointerEventMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } #ifdef CORBA addCapability(cl, POINTER_DEVICE); if (!isPointerEnabled(cl)) return; #endif if (pointerClient && (pointerClient != cl)) return; if (msg.pe.buttonMask == 0) pointerClient = NULL; else pointerClient = cl; if (!rfbViewOnly && !cl->viewOnly) { cl->cursorX = (int)Swap16IfLE(msg.pe.x); cl->cursorY = (int)Swap16IfLE(msg.pe.y); PtrAddEvent(msg.pe.buttonMask, cl->cursorX, cl->cursorY, cl); } return; case rfbClientCutText: if ((n = ReadExact(cl->sock, ((char *)&msg) + 1, sz_rfbClientCutTextMsg - 1)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); rfbCloseSock(cl->sock); return; } msg.cct.length = Swap32IfLE(msg.cct.length); str = (char *)xalloc(msg.cct.length); if ((n = ReadExact(cl->sock, str, msg.cct.length)) <= 0) { if (n != 0) rfbLogPerror("rfbProcessClientNormalMessage: read"); xfree(str); rfbCloseSock(cl->sock); return; } /* NOTE: We do not accept cut text from a view-only client */ if (!rfbViewOnly && !cl->viewOnly) rfbSetXCutText(str, msg.cct.length); xfree(str); return; default: rfbLog("rfbProcessClientNormalMessage: unknown message type %d\n", msg.type); rfbLog(" ... closing connection\n"); rfbCloseSock(cl->sock); return; } } /* * rfbSendFramebufferUpdate - send the currently pending framebuffer update to * the RFB client. */ Bool rfbSendFramebufferUpdate(cl) rfbClientPtr cl; { ScreenPtr pScreen = screenInfo.screens[0]; int i; int nUpdateRegionRects; rfbFramebufferUpdateMsg *fu = (rfbFramebufferUpdateMsg *)updateBuf; RegionRec updateRegion, updateCopyRegion; int dx, dy; Bool sendCursorShape = FALSE; Bool sendCursorPos = FALSE; /* * If this client understands cursor shape updates, cursor should be * removed from the framebuffer. Otherwise, make sure it's put up. */ if (cl->enableCursorShapeUpdates) { if (rfbScreen.cursorIsDrawn) rfbSpriteRemoveCursor(pScreen); if (!rfbScreen.cursorIsDrawn && cl->cursorWasChanged) sendCursorShape = TRUE; } else { if (!rfbScreen.cursorIsDrawn) rfbSpriteRestoreCursor(pScreen); } /* * Do we plan to send cursor position update? */ if (cl->enableCursorPosUpdates && cl->cursorWasMoved) sendCursorPos = TRUE; /* * The modifiedRegion may overlap the destination copyRegion. We remove * any overlapping bits from the copyRegion (since they'd only be * overwritten anyway). */ REGION_SUBTRACT(pScreen, &cl->copyRegion, &cl->copyRegion, &cl->modifiedRegion); /* * The client is interested in the region requestedRegion. The region * which should be updated now is the intersection of requestedRegion * and the union of modifiedRegion and copyRegion. If it's empty then * no update is needed. */ REGION_INIT(pScreen,&updateRegion,NullBox,0); REGION_UNION(pScreen, &updateRegion, &cl->copyRegion, &cl->modifiedRegion); REGION_INTERSECT(pScreen, &updateRegion, &cl->requestedRegion, &updateRegion); if ( !REGION_NOTEMPTY(pScreen,&updateRegion) && !sendCursorShape && !sendCursorPos ) { REGION_UNINIT(pScreen,&updateRegion); return TRUE; } /* * We assume that the client doesn't have any pixel data outside the * requestedRegion. In other words, both the source and destination of a * copy must lie within requestedRegion. So the region we can send as a * copy is the intersection of the copyRegion with both the requestedRegion * and the requestedRegion translated by the amount of the copy. We set * updateCopyRegion to this. */ REGION_INIT(pScreen,&updateCopyRegion,NullBox,0); REGION_INTERSECT(pScreen, &updateCopyRegion, &cl->copyRegion, &cl->requestedRegion); REGION_TRANSLATE(pScreen, &cl->requestedRegion, cl->copyDX, cl->copyDY); REGION_INTERSECT(pScreen, &updateCopyRegion, &updateCopyRegion, &cl->requestedRegion); dx = cl->copyDX; dy = cl->copyDY; /* * Next we remove updateCopyRegion from updateRegion so that updateRegion * is the part of this update which is sent as ordinary pixel data (i.e not * a copy). */ REGION_SUBTRACT(pScreen, &updateRegion, &updateRegion, &updateCopyRegion); /* * Finally we leave modifiedRegion to be the remainder (if any) of parts of * the screen which are modified but outside the requestedRegion. We also * empty both the requestedRegion and the copyRegion - note that we never * carry over a copyRegion for a future update. */ REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &cl->copyRegion); REGION_SUBTRACT(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &updateRegion); REGION_SUBTRACT(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &updateCopyRegion); REGION_EMPTY(pScreen, &cl->requestedRegion); REGION_EMPTY(pScreen, &cl->copyRegion); cl->copyDX = 0; cl->copyDY = 0; /* * Now send the update. */ cl->rfbFramebufferUpdateMessagesSent++; if (cl->preferredEncoding == rfbEncodingCoRRE) { nUpdateRegionRects = 0; for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; nUpdateRegionRects += (((w-1) / cl->correMaxWidth + 1) * ((h-1) / cl->correMaxHeight + 1)); } } else if (cl->preferredEncoding == rfbEncodingZlib) { nUpdateRegionRects = 0; for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1); } } else if (cl->preferredEncoding == rfbEncodingTight) { nUpdateRegionRects = 0; for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; int n = rfbNumCodedRectsTight(cl, x, y, w, h); if (n == 0) { nUpdateRegionRects = 0xFFFF; break; } nUpdateRegionRects += n; } } else { nUpdateRegionRects = REGION_NUM_RECTS(&updateRegion); } fu->type = rfbFramebufferUpdate; if (nUpdateRegionRects != 0xFFFF) { fu->nRects = Swap16IfLE(REGION_NUM_RECTS(&updateCopyRegion) + nUpdateRegionRects + !!sendCursorShape + !!sendCursorPos); } else { fu->nRects = 0xFFFF; } ublen = sz_rfbFramebufferUpdateMsg; if (sendCursorShape) { cl->cursorWasChanged = FALSE; if (!rfbSendCursorShape(cl, pScreen)) return FALSE; } if (sendCursorPos) { cl->cursorWasMoved = FALSE; if (!rfbSendCursorPos(cl, pScreen)) return FALSE; } if (REGION_NOTEMPTY(pScreen,&updateCopyRegion)) { if (!rfbSendCopyRegion(cl,&updateCopyRegion,dx,dy)) { REGION_UNINIT(pScreen,&updateRegion); REGION_UNINIT(pScreen,&updateCopyRegion); return FALSE; } } REGION_UNINIT(pScreen,&updateCopyRegion); for (i = 0; i < REGION_NUM_RECTS(&updateRegion); i++) { int x = REGION_RECTS(&updateRegion)[i].x1; int y = REGION_RECTS(&updateRegion)[i].y1; int w = REGION_RECTS(&updateRegion)[i].x2 - x; int h = REGION_RECTS(&updateRegion)[i].y2 - y; cl->rfbRawBytesEquivalent += (sz_rfbFramebufferUpdateRectHeader + w * (cl->format.bitsPerPixel / 8) * h); switch (cl->preferredEncoding) { case rfbEncodingRaw: if (!rfbSendRectEncodingRaw(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; case rfbEncodingRRE: if (!rfbSendRectEncodingRRE(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; case rfbEncodingCoRRE: if (!rfbSendRectEncodingCoRRE(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; case rfbEncodingHextile: if (!rfbSendRectEncodingHextile(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; case rfbEncodingZlib: if (!rfbSendRectEncodingZlib(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; case rfbEncodingTight: if (!rfbSendRectEncodingTight(cl, x, y, w, h)) { REGION_UNINIT(pScreen,&updateRegion); return FALSE; } break; } } REGION_UNINIT(pScreen,&updateRegion); if (nUpdateRegionRects == 0xFFFF && !rfbSendLastRectMarker(cl)) return FALSE; if (!rfbSendUpdateBuf(cl)) return FALSE; return TRUE; } /* * Send the copy region as a string of CopyRect encoded rectangles. * The only slightly tricky thing is that we should send the messages in * the correct order so that an earlier CopyRect will not corrupt the source * of a later one. */ static Bool rfbSendCopyRegion(cl, reg, dx, dy) rfbClientPtr cl; RegionPtr reg; int dx, dy; { int nrects, nrectsInBand, x_inc, y_inc, thisRect, firstInNextBand; int x, y, w, h; rfbFramebufferUpdateRectHeader rect; rfbCopyRect cr; nrects = REGION_NUM_RECTS(reg); if (dx <= 0) { x_inc = 1; } else { x_inc = -1; } if (dy <= 0) { thisRect = 0; y_inc = 1; } else { thisRect = nrects - 1; y_inc = -1; } while (nrects > 0) { firstInNextBand = thisRect; nrectsInBand = 0; while ((nrects > 0) && (REGION_RECTS(reg)[firstInNextBand].y1 == REGION_RECTS(reg)[thisRect].y1)) { firstInNextBand += y_inc; nrects--; nrectsInBand++; } if (x_inc != y_inc) { thisRect = firstInNextBand - y_inc; } while (nrectsInBand > 0) { if ((ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbCopyRect) > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } x = REGION_RECTS(reg)[thisRect].x1; y = REGION_RECTS(reg)[thisRect].y1; w = REGION_RECTS(reg)[thisRect].x2 - x; h = REGION_RECTS(reg)[thisRect].y2 - y; rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingCopyRect); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cr.srcX = Swap16IfLE(x - dx); cr.srcY = Swap16IfLE(y - dy); memcpy(&updateBuf[ublen], (char *)&cr, sz_rfbCopyRect); ublen += sz_rfbCopyRect; cl->rfbRectanglesSent[rfbEncodingCopyRect]++; cl->rfbBytesSent[rfbEncodingCopyRect] += sz_rfbFramebufferUpdateRectHeader + sz_rfbCopyRect; thisRect += x_inc; nrectsInBand--; } thisRect = firstInNextBand; } return TRUE; } /* * Send a given rectangle in raw encoding (rfbEncodingRaw). */ Bool rfbSendRectEncodingRaw(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; int nlines; int bytesPerLine = w * (cl->format.bitsPerPixel / 8); char *fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); /* Flush the buffer to guarantee correct alignment for translateFn(). */ if (ublen > 0) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingRaw); memcpy(&updateBuf[ublen], (char *)&rect,sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingRaw]++; cl->rfbBytesSent[rfbEncodingRaw] += sz_rfbFramebufferUpdateRectHeader + bytesPerLine * h; nlines = (UPDATE_BUF_SIZE - ublen) / bytesPerLine; while (TRUE) { if (nlines > h) nlines = h; (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, &updateBuf[ublen], rfbScreen.paddedWidthInBytes, w, nlines); ublen += nlines * bytesPerLine; h -= nlines; if (h == 0) /* rect fitted in buffer, do next one */ return TRUE; /* buffer full - flush partial rect and do another nlines */ if (!rfbSendUpdateBuf(cl)) return FALSE; fbptr += (rfbScreen.paddedWidthInBytes * nlines); nlines = (UPDATE_BUF_SIZE - ublen) / bytesPerLine; if (nlines == 0) { rfbLog("rfbSendRectEncodingRaw: send buffer too small for %d " "bytes per line\n", bytesPerLine); rfbCloseSock(cl->sock); return FALSE; } } } /* * Send an empty rectangle with encoding field set to value of * rfbEncodingLastRect to notify client that this is the last * rectangle in framebuffer update ("LastRect" extension of RFB * protocol). */ static Bool rfbSendLastRectMarker(cl) rfbClientPtr cl; { rfbFramebufferUpdateRectHeader rect; if (ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.encoding = Swap32IfLE(rfbEncodingLastRect); rect.r.x = 0; rect.r.y = 0; rect.r.w = 0; rect.r.h = 0; memcpy(&updateBuf[ublen], (char *)&rect,sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbLastRectMarkersSent++; cl->rfbLastRectBytesSent += sz_rfbFramebufferUpdateRectHeader; return TRUE; } /* * Send the contents of updateBuf. Returns 1 if successful, -1 if * not (errno should be set). */ Bool rfbSendUpdateBuf(cl) rfbClientPtr cl; { /* int i; for (i = 0; i < ublen; i++) { fprintf(stderr,"%02x ",((unsigned char *)updateBuf)[i]); } fprintf(stderr,"\n"); */ if (ublen > 0 && WriteExact(cl->sock, updateBuf, ublen) < 0) { rfbLogPerror("rfbSendUpdateBuf: write"); rfbCloseSock(cl->sock); return FALSE; } ublen = 0; return TRUE; } /* * rfbSendSetColourMapEntries sends a SetColourMapEntries message to the * client, using values from the currently installed colormap. */ Bool rfbSendSetColourMapEntries(cl, firstColour, nColours) rfbClientPtr cl; int firstColour; int nColours; { char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2]; rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf; CARD16 *rgb = (CARD16 *)(&buf[sz_rfbSetColourMapEntriesMsg]); EntryPtr pent; int i, len; scme->type = rfbSetColourMapEntries; scme->firstColour = Swap16IfLE(firstColour); scme->nColours = Swap16IfLE(nColours); len = sz_rfbSetColourMapEntriesMsg; pent = (EntryPtr)&rfbInstalledColormap->red[firstColour]; for (i = 0; i < nColours; i++) { if (pent->fShared) { rgb[i*3] = Swap16IfLE(pent->co.shco.red->color); rgb[i*3+1] = Swap16IfLE(pent->co.shco.green->color); rgb[i*3+2] = Swap16IfLE(pent->co.shco.blue->color); } else { rgb[i*3] = Swap16IfLE(pent->co.local.red); rgb[i*3+1] = Swap16IfLE(pent->co.local.green); rgb[i*3+2] = Swap16IfLE(pent->co.local.blue); } pent++; } len += nColours * 3 * 2; if (WriteExact(cl->sock, buf, len) < 0) { rfbLogPerror("rfbSendSetColourMapEntries: write"); rfbCloseSock(cl->sock); return FALSE; } return TRUE; } /* * rfbSendBell sends a Bell message to all the clients. */ void rfbSendBell() { rfbClientPtr cl, nextCl; rfbBellMsg b; for (cl = rfbClientHead; cl; cl = nextCl) { nextCl = cl->next; if (cl->state != RFB_NORMAL) continue; b.type = rfbBell; if (WriteExact(cl->sock, (char *)&b, sz_rfbBellMsg) < 0) { rfbLogPerror("rfbSendBell: write"); rfbCloseSock(cl->sock); } } } /* * rfbSendServerCutText sends a ServerCutText message to all the clients. */ void rfbSendServerCutText(char *str, int len) { rfbClientPtr cl, nextCl; rfbServerCutTextMsg sct; if (rfbViewOnly) return; for (cl = rfbClientHead; cl; cl = nextCl) { nextCl = cl->next; if (cl->state != RFB_NORMAL || cl->viewOnly) continue; sct.type = rfbServerCutText; sct.length = Swap32IfLE(len); if (WriteExact(cl->sock, (char *)&sct, sz_rfbServerCutTextMsg) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseSock(cl->sock); continue; } if (WriteExact(cl->sock, str, len) < 0) { rfbLogPerror("rfbSendServerCutText: write"); rfbCloseSock(cl->sock); } } } /***************************************************************************** * * UDP can be used for keyboard and pointer events when the underlying * network is highly reliable. This is really here to support ORL's * videotile, whose TCP implementation doesn't like sending lots of small * packets (such as 100s of pen readings per second!). */ void rfbNewUDPConnection(sock) int sock; { if (write(sock, &ptrAcceleration, 1) < 0) { rfbLogPerror("rfbNewUDPConnection: write"); } } /* * Because UDP is a message based service, we can't read the first byte and * then the rest of the packet separately like we do with TCP. We will always * get a whole packet delivered in one go, so we ask read() for the maximum * number of bytes we can possibly get. */ void rfbProcessUDPInput(sock) int sock; { int n; rfbClientToServerMsg msg; if ((n = read(sock, (char *)&msg, sizeof(msg))) <= 0) { if (n < 0) { rfbLogPerror("rfbProcessUDPInput: read"); } rfbDisconnectUDPSock(); return; } switch (msg.type) { case rfbKeyEvent: if (n != sz_rfbKeyEventMsg) { rfbLog("rfbProcessUDPInput: key event incorrect length\n"); rfbDisconnectUDPSock(); return; } if (!rfbViewOnly) { KbdAddEvent(msg.ke.down, (KeySym)Swap32IfLE(msg.ke.key), 0); } break; case rfbPointerEvent: if (n != sz_rfbPointerEventMsg) { rfbLog("rfbProcessUDPInput: ptr event incorrect length\n"); rfbDisconnectUDPSock(); return; } if (!rfbViewOnly) { PtrAddEvent(msg.pe.buttonMask, Swap16IfLE(msg.pe.x), Swap16IfLE(msg.pe.y), 0); } break; default: rfbLog("rfbProcessUDPInput: unknown message type %d\n", msg.type); rfbDisconnectUDPSock(); } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/stats.c0100664000076400007640000000673507557741162021435 0ustar constconst/* * stats.c */ /* * Copyright (C) 2002 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "rfb.h" static char* encNames[] = { "raw", "copyRect", "RRE", "[encoding 3]", "CoRRE", "hextile", "zlib", "tight", "[encoding 8]", "[encoding 9]" }; void rfbResetStats(rfbClientPtr cl) { int i; for (i = 0; i < MAX_ENCODINGS; i++) { cl->rfbBytesSent[i] = 0; cl->rfbRectanglesSent[i] = 0; } cl->rfbLastRectMarkersSent = 0; cl->rfbLastRectBytesSent = 0; cl->rfbCursorShapeBytesSent = 0; cl->rfbCursorShapeUpdatesSent = 0; cl->rfbCursorPosBytesSent = 0; cl->rfbCursorPosUpdatesSent = 0; cl->rfbFramebufferUpdateMessagesSent = 0; cl->rfbRawBytesEquivalent = 0; cl->rfbKeyEventsRcvd = 0; cl->rfbPointerEventsRcvd = 0; } void rfbPrintStats(rfbClientPtr cl) { int i; int totalRectanglesSent = 0; int totalBytesSent = 0; rfbLog("Statistics:\n"); if ((cl->rfbKeyEventsRcvd != 0) || (cl->rfbPointerEventsRcvd != 0)) rfbLog(" key events received %d, pointer events %d\n", cl->rfbKeyEventsRcvd, cl->rfbPointerEventsRcvd); for (i = 0; i < MAX_ENCODINGS; i++) { totalRectanglesSent += cl->rfbRectanglesSent[i]; totalBytesSent += cl->rfbBytesSent[i]; } totalRectanglesSent += (cl->rfbCursorShapeUpdatesSent + cl->rfbCursorPosUpdatesSent + cl->rfbLastRectMarkersSent); totalBytesSent += (cl->rfbCursorShapeBytesSent + cl->rfbCursorPosBytesSent + cl->rfbLastRectBytesSent); rfbLog(" framebuffer updates %d, rectangles %d, bytes %d\n", cl->rfbFramebufferUpdateMessagesSent, totalRectanglesSent, totalBytesSent); if (cl->rfbLastRectMarkersSent != 0) rfbLog(" LastRect markers %d, bytes %d\n", cl->rfbLastRectMarkersSent, cl->rfbLastRectBytesSent); if (cl->rfbCursorShapeUpdatesSent != 0) rfbLog(" cursor shape updates %d, bytes %d\n", cl->rfbCursorShapeUpdatesSent, cl->rfbCursorShapeBytesSent); if (cl->rfbCursorPosUpdatesSent != 0) rfbLog(" cursor position updates %d, bytes %d\n", cl->rfbCursorPosUpdatesSent, cl->rfbCursorPosBytesSent); for (i = 0; i < MAX_ENCODINGS; i++) { if (cl->rfbRectanglesSent[i] != 0) rfbLog(" %s rectangles %d, bytes %d\n", encNames[i], cl->rfbRectanglesSent[i], cl->rfbBytesSent[i]); } if ((totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect]) != 0) { rfbLog(" raw bytes equivalent %d, compression ratio %f\n", cl->rfbRawBytesEquivalent, (double)cl->rfbRawBytesEquivalent / (double)(totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect] - cl->rfbCursorShapeBytesSent - cl->rfbCursorPosBytesSent - cl->rfbLastRectBytesSent)); } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/tableinittctemplate.c0100664000076400007640000001047707120677563024332 0ustar constconst/* * tableinittctemplate.c - template for initialising lookup tables for * truecolour to truecolour translation. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with a different definition of the macro OUT. * For each value of OUT, this file defines two functions for initialising * lookup tables. One is for truecolour translation using a single lookup * table, the other is for truecolour translation using three separate * lookup tables for the red, green and blue values. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define OUT_T CONCAT2E(CARD,OUT) #define SwapOUT(x) CONCAT2E(Swap,OUT(x)) #define rfbInitTrueColourSingleTableOUT \ CONCAT2E(rfbInitTrueColourSingleTable,OUT) #define rfbInitTrueColourRGBTablesOUT CONCAT2E(rfbInitTrueColourRGBTables,OUT) #define rfbInitOneRGBTableOUT CONCAT2E(rfbInitOneRGBTable,OUT) static void rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift, int swap); /* * rfbInitTrueColourSingleTable sets up a single lookup table for truecolour * translation. */ static void rfbInitTrueColourSingleTableOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { int i; int inRed, inGreen, inBlue, outRed, outGreen, outBlue; OUT_T *t; int nEntries = 1 << in->bitsPerPixel; if (*table) free(*table); *table = (char *)malloc(nEntries * sizeof(OUT_T)); t = (OUT_T *)*table; for (i = 0; i < nEntries; i++) { inRed = (i >> in->redShift) & in->redMax; inGreen = (i >> in->greenShift) & in->greenMax; inBlue = (i >> in->blueShift) & in->blueMax; outRed = (inRed * out->redMax + in->redMax / 2) / in->redMax; outGreen = (inGreen * out->greenMax + in->greenMax / 2) / in->greenMax; outBlue = (inBlue * out->blueMax + in->blueMax / 2) / in->blueMax; t[i] = ((outRed << out->redShift) | (outGreen << out->greenShift) | (outBlue << out->blueShift)); #if (OUT != 8) if (out->bigEndian != in->bigEndian) { t[i] = SwapOUT(t[i]); } #endif } } /* * rfbInitTrueColourRGBTables sets up three separate lookup tables for the * red, green and blue values. */ static void rfbInitTrueColourRGBTablesOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { OUT_T *redTable; OUT_T *greenTable; OUT_T *blueTable; if (*table) free(*table); *table = (char *)malloc((in->redMax + in->greenMax + in->blueMax + 3) * sizeof(OUT_T)); redTable = (OUT_T *)*table; greenTable = redTable + in->redMax + 1; blueTable = greenTable + in->greenMax + 1; rfbInitOneRGBTableOUT (redTable, in->redMax, out->redMax, out->redShift, (out->bigEndian != in->bigEndian)); rfbInitOneRGBTableOUT (greenTable, in->greenMax, out->greenMax, out->greenShift, (out->bigEndian != in->bigEndian)); rfbInitOneRGBTableOUT (blueTable, in->blueMax, out->blueMax, out->blueShift, (out->bigEndian != in->bigEndian)); } static void rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift, int swap) { int i; int nEntries = inMax + 1; for (i = 0; i < nEntries; i++) { table[i] = ((i * outMax + inMax / 2) / inMax) << outShift; #if (OUT != 8) if (swap) { table[i] = SwapOUT(table[i]); } #endif } } #undef OUT_T #undef SwapOUT #undef rfbInitTrueColourSingleTableOUT #undef rfbInitTrueColourRGBTablesOUT #undef rfbInitOneRGBTableOUT vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/zlib.c0100664000076400007640000002155407231001547021214 0ustar constconst/* * zlib.c * * Routines to implement zlib based encoding (deflate). */ /* * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. * * For the latest source code, please check: * * http://www.developVNC.org/ * * or send email to feedback@developvnc.org. */ #include #include "rfb.h" /* * zlibBeforeBuf contains pixel data in the client's format. * zlibAfterBuf contains the zlib (deflated) encoding version. * If the zlib compressed/encoded version is * larger than the raw data or if it exceeds zlibAfterBufSize then * raw encoding is used instead. */ static int zlibBeforeBufSize = 0; static char *zlibBeforeBuf = NULL; static int zlibAfterBufSize = 0; static char *zlibAfterBuf = NULL; static int zlibAfterBufLen; /* * rfbSendOneRectEncodingZlib - send a given rectangle using one Zlib * rectangle encoding. */ Bool rfbSendOneRectEncodingZlib(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; rfbZlibHeader hdr; int deflateResult; int previousOut; int i; char *fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize; int maxCompSize; maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (zlibBeforeBufSize < maxRawSize) { zlibBeforeBufSize = maxRawSize; if (zlibBeforeBuf == NULL) zlibBeforeBuf = (char *)xalloc(zlibBeforeBufSize); else zlibBeforeBuf = (char *)xrealloc(zlibBeforeBuf, zlibBeforeBufSize); } /* zlib compression is not useful for very small data sets. * So, we just send these raw without any compression. */ if (( w * h * (rfbScreen.bitsPerPixel / 8)) < VNC_ENCODE_ZLIB_MIN_COMP_SIZE ) { int result; /* The translation function (used also by the in raw encoding) * requires 4/2/1 byte alignment in the output buffer (which is * updateBuf for the raw encoding) based on the bitsPerPixel of * the viewer/client. This prevents SIGBUS errors on some * architectures like SPARC, PARISC... */ if (( cl->format.bitsPerPixel > 8 ) && ( ublen % ( cl->format.bitsPerPixel / 8 )) != 0 ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } result = rfbSendRectEncodingRaw(cl, x, y, w, h); return result; } /* * zlib requires output buffer to be slightly larger than the input * buffer, in the worst case. */ maxCompSize = maxRawSize + (( maxRawSize + 99 ) / 100 ) + 12; if (zlibAfterBufSize < maxCompSize) { zlibAfterBufSize = maxCompSize; if (zlibAfterBuf == NULL) zlibAfterBuf = (char *)xalloc(zlibAfterBufSize); else zlibAfterBuf = (char *)xrealloc(zlibAfterBuf, zlibAfterBufSize); } /* * Convert pixel data to client format. */ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, zlibBeforeBuf, rfbScreen.paddedWidthInBytes, w, h); cl->compStream.next_in = ( Bytef * )zlibBeforeBuf; cl->compStream.avail_in = w * h * (cl->format.bitsPerPixel / 8); cl->compStream.next_out = ( Bytef * )zlibAfterBuf; cl->compStream.avail_out = maxCompSize; cl->compStream.data_type = Z_BINARY; /* Initialize the deflation state. */ if ( cl->compStreamInited == FALSE ) { cl->compStream.total_in = 0; cl->compStream.total_out = 0; cl->compStream.zalloc = Z_NULL; cl->compStream.zfree = Z_NULL; cl->compStream.opaque = Z_NULL; deflateInit2( &(cl->compStream), cl->zlibCompressLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY ); /* deflateInit( &(cl->compStream), Z_BEST_COMPRESSION ); */ /* deflateInit( &(cl->compStream), Z_BEST_SPEED ); */ cl->compStreamInited = TRUE; } previousOut = cl->compStream.total_out; /* Perform the compression here. */ deflateResult = deflate( &(cl->compStream), Z_SYNC_FLUSH ); /* Find the total size of the resulting compressed data. */ zlibAfterBufLen = cl->compStream.total_out - previousOut; if ( deflateResult != Z_OK ) { rfbLog("zlib deflation error: %s\n", cl->compStream.msg); return FALSE; } /* Note that it is not possible to switch zlib parameters based on * the results of the compression pass. The reason is * that we rely on the compressor and decompressor states being * in sync. Compressing and then discarding the results would * cause lose of synchronization. */ /* Update statics */ cl->rfbRectanglesSent[rfbEncodingZlib]++; cl->rfbBytesSent[rfbEncodingZlib] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader + zlibAfterBufLen); if (ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingZlib); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nBytes = Swap32IfLE(zlibAfterBufLen); memcpy(&updateBuf[ublen], (char *)&hdr, sz_rfbZlibHeader); ublen += sz_rfbZlibHeader; for (i = 0; i < zlibAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - ublen; if (i + bytesToCopy > zlibAfterBufLen) { bytesToCopy = zlibAfterBufLen - i; } memcpy(&updateBuf[ublen], &zlibAfterBuf[i], bytesToCopy); ublen += bytesToCopy; i += bytesToCopy; if (ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * rfbSendRectEncodingZlib - send a given rectangle using one or more * Zlib encoding rectangles. */ Bool rfbSendRectEncodingZlib(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { int totalSize = 0; int partialSize = 0; int maxLines; int linesRemaining; rfbRectangle partialRect; partialRect.x = x; partialRect.y = y; partialRect.w = w; partialRect.h = h; /* Determine maximum pixel/scan lines allowed per rectangle. */ maxLines = ( ZLIB_MAX_SIZE(w) / w ); /* Initialize number of scan lines left to do. */ linesRemaining = h; /* Loop until all work is done. */ while ( linesRemaining > 0 ) { int linesToComp; if ( maxLines < linesRemaining ) linesToComp = maxLines; else linesToComp = linesRemaining; partialRect.h = linesToComp; /* Encode (compress) and send the next rectangle. */ if ( ! rfbSendOneRectEncodingZlib( cl, partialRect.x, partialRect.y, partialRect.w, partialRect.h )) { return FALSE; } /* Technically, flushing the buffer here is not extrememly * efficient. However, this improves the overall throughput * of the system over very slow networks. By flushing * the buffer with every maximum size zlib rectangle, we * improve the pipelining usage of the server CPU, network, * and viewer CPU components. Insuring that these components * are working in parallel actually improves the performance * seen by the user. * Since, zlib is most useful for slow networks, this flush * is appropriate for the desired behavior of the zlib encoding. */ if (( ublen > 0 ) && ( linesToComp == maxLines )) { if (!rfbSendUpdateBuf(cl)) { return FALSE; } } /* Update remaining and incremental rectangle location. */ linesRemaining -= linesToComp; partialRect.y += linesToComp; } return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/hextile.c0100664000076400007640000002545607176101667021737 0ustar constconst/* * hextile.c * * Routines to implement Hextile Encoding */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" static Bool sendHextiles8(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendHextiles16(rfbClientPtr cl, int x, int y, int w, int h); static Bool sendHextiles32(rfbClientPtr cl, int x, int y, int w, int h); /* * rfbSendRectEncodingHextile - send a rectangle using hextile encoding. */ Bool rfbSendRectEncodingHextile(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; if (ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingHextile); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingHextile]++; cl->rfbBytesSent[rfbEncodingHextile] += sz_rfbFramebufferUpdateRectHeader; switch (cl->format.bitsPerPixel) { case 8: return sendHextiles8(cl, x, y, w, h); case 16: return sendHextiles16(cl, x, y, w, h); case 32: return sendHextiles32(cl, x, y, w, h); } rfbLog("rfbSendRectEncodingHextile: bpp %d?\n", cl->format.bitsPerPixel); return FALSE; } #define PUT_PIXEL8(pix) (updateBuf[ublen++] = (pix)) #define PUT_PIXEL16(pix) (updateBuf[ublen++] = ((char*)&(pix))[0], \ updateBuf[ublen++] = ((char*)&(pix))[1]) #define PUT_PIXEL32(pix) (updateBuf[ublen++] = ((char*)&(pix))[0], \ updateBuf[ublen++] = ((char*)&(pix))[1], \ updateBuf[ublen++] = ((char*)&(pix))[2], \ updateBuf[ublen++] = ((char*)&(pix))[3]) #define DEFINE_SEND_HEXTILES(bpp) \ \ \ static Bool subrectEncode##bpp(CARD##bpp *data, int w, int h, CARD##bpp bg, \ CARD##bpp fg, Bool mono); \ static void testColours##bpp(CARD##bpp *data, int size, Bool *mono, \ Bool *solid, CARD##bpp *bg, CARD##bpp *fg); \ \ \ /* \ * rfbSendHextiles \ */ \ \ static Bool \ sendHextiles##bpp(cl, rx, ry, rw, rh) \ rfbClientPtr cl; \ int rx, ry, rw, rh; \ { \ int x, y, w, h; \ int startUblen; \ char *fbptr; \ CARD##bpp bg, fg, newBg, newFg; \ Bool mono, solid; \ Bool validBg = FALSE; \ Bool validFg = FALSE; \ CARD##bpp clientPixelData[16*16*(bpp/8)]; \ \ for (y = ry; y < ry+rh; y += 16) { \ for (x = rx; x < rx+rw; x += 16) { \ w = h = 16; \ if (rx+rw - x < 16) \ w = rx+rw - x; \ if (ry+rh - y < 16) \ h = ry+rh - y; \ \ if ((ublen + 1 + (2 + 16 * 16) * (bpp/8)) > UPDATE_BUF_SIZE) { \ if (!rfbSendUpdateBuf(cl)) \ return FALSE; \ } \ \ fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) \ + (x * (rfbScreen.bitsPerPixel / 8))); \ \ (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, \ &cl->format, fbptr, (char *)clientPixelData, \ rfbScreen.paddedWidthInBytes, w, h); \ \ startUblen = ublen; \ updateBuf[startUblen] = 0; \ ublen++; \ \ testColours##bpp(clientPixelData, w * h, \ &mono, &solid, &newBg, &newFg); \ \ if (!validBg || (newBg != bg)) { \ validBg = TRUE; \ bg = newBg; \ updateBuf[startUblen] |= rfbHextileBackgroundSpecified; \ PUT_PIXEL##bpp(bg); \ } \ \ if (solid) { \ cl->rfbBytesSent[rfbEncodingHextile] += ublen - startUblen; \ continue; \ } \ \ updateBuf[startUblen] |= rfbHextileAnySubrects; \ \ if (mono) { \ if (!validFg || (newFg != fg)) { \ validFg = TRUE; \ fg = newFg; \ updateBuf[startUblen] |= rfbHextileForegroundSpecified; \ PUT_PIXEL##bpp(fg); \ } \ } else { \ validFg = FALSE; \ updateBuf[startUblen] |= rfbHextileSubrectsColoured; \ } \ \ if (!subrectEncode##bpp(clientPixelData, w, h, bg, fg, mono)) { \ /* encoding was too large, use raw */ \ validBg = FALSE; \ validFg = FALSE; \ ublen = startUblen; \ updateBuf[ublen++] = rfbHextileRaw; \ (*cl->translateFn)(cl->translateLookupTable, \ &rfbServerFormat, &cl->format, fbptr, \ (char *)clientPixelData, \ rfbScreen.paddedWidthInBytes, w, h); \ \ memcpy(&updateBuf[ublen], (char *)clientPixelData, \ w * h * (bpp/8)); \ \ ublen += w * h * (bpp/8); \ } \ \ cl->rfbBytesSent[rfbEncodingHextile] += ublen - startUblen; \ } \ } \ \ return TRUE; \ } \ \ \ static Bool \ subrectEncode##bpp(CARD##bpp *data, int w, int h, CARD##bpp bg, \ CARD##bpp fg, Bool mono) \ { \ CARD##bpp cl; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ int nSubrectsUblen; \ \ nSubrectsUblen = ublen; \ ublen++; \ \ for (y=0; y 0) && (i >= hx)) { \ hy += 1; \ } else { \ hyflag = 0; \ } \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and \ * (x,y,vx,vy). We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ if (mono) { \ newLen = ublen - nSubrectsUblen + 2; \ } else { \ newLen = ublen - nSubrectsUblen + bpp/8 + 2; \ } \ \ if (newLen > (w * h * (bpp/8))) \ return FALSE; \ \ numsubs += 1; \ \ if (!mono) PUT_PIXEL##bpp(cl); \ \ updateBuf[ublen++] = rfbHextilePackXY(thex,they); \ updateBuf[ublen++] = rfbHextilePackWH(thew,theh); \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ updateBuf[nSubrectsUblen] = numsubs; \ \ return TRUE; \ } \ \ \ /* \ * testColours() tests if there are one (solid), two (mono) or more \ * colours in a tile and gets a reasonable guess at the best background \ * pixel, and the foreground pixel for mono. \ */ \ \ static void \ testColours##bpp(data,size,mono,solid,bg,fg) \ CARD##bpp *data; \ int size; \ Bool *mono; \ Bool *solid; \ CARD##bpp *bg; \ CARD##bpp *fg; \ { \ CARD##bpp colour1, colour2; \ int n1 = 0, n2 = 0; \ *mono = TRUE; \ *solid = TRUE; \ \ for (; size > 0; size--, data++) { \ \ if (n1 == 0) \ colour1 = *data; \ \ if (*data == colour1) { \ n1++; \ continue; \ } \ \ if (n2 == 0) { \ *solid = FALSE; \ colour2 = *data; \ } \ \ if (*data == colour2) { \ n2++; \ continue; \ } \ \ *mono = FALSE; \ break; \ } \ \ if (n1 > n2) { \ *bg = colour1; \ *fg = colour2; \ } else { \ *bg = colour2; \ *fg = colour1; \ } \ } DEFINE_SEND_HEXTILES(8) DEFINE_SEND_HEXTILES(16) DEFINE_SEND_HEXTILES(32) vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/auth.c0100664000076400007640000003733110536205641021220 0ustar constconst/* * auth.c - deal with authentication. * * This file implements authentication when setting up an RFB connection. */ /* * Copyright (C) 2003-2006 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "windowstr.h" #include "rfb.h" char *rfbAuthPasswdFile = NULL; static void rfbSendSecurityType(rfbClientPtr cl, int securityType); static void rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType); static void rfbSendTunnelingCaps(rfbClientPtr cl); static void rfbSendAuthCaps(rfbClientPtr cl); static void rfbVncAuthSendChallenge(rfbClientPtr cl); /* * rfbAuthNewClient is called right after negotiating the protocol * version. Depending on the protocol version, we send either a code * for authentication scheme to be used (protocol 3.3), or a list of * possible "security types" (protocol 3.7 and above). */ void rfbAuthNewClient(cl) rfbClientPtr cl; { int securityType = rfbSecTypeInvalid; if (!rfbAuthPasswdFile || cl->reverseConnection) { securityType = rfbSecTypeNone; } else { if (rfbAuthIsBlocked()) { rfbLog("Too many authentication failures - client rejected\n"); rfbClientConnFailed(cl, "Too many authentication failures"); return; } if (rfbAuthPasswdFile) securityType = rfbSecTypeVncAuth; } if (cl->protocol_minor_ver < 7) { /* Make sure we use only RFB 3.3 compatible security types. */ if (securityType == rfbSecTypeInvalid) { rfbLog("VNC authentication disabled - RFB 3.3 client rejected\n"); rfbClientConnFailed(cl, "Your viewer cannot handle required " "authentication methods"); return; } rfbSendSecurityType(cl, securityType); } else { /* Here it's ok when securityType is set to rfbSecTypeInvalid. */ rfbSendSecurityTypeList(cl, securityType); } } /* * Tell the client what security type will be used (protocol 3.3). */ static void rfbSendSecurityType(cl, securityType) rfbClientPtr cl; int securityType; { CARD32 value32; /* Send the value. */ value32 = Swap32IfLE(securityType); if (WriteExact(cl->sock, (char *)&value32, 4) < 0) { rfbLogPerror("rfbSendSecurityType: write"); rfbCloseSock(cl->sock); return; } /* Decide what to do next. */ switch (securityType) { case rfbSecTypeNone: /* Dispatch client input to rfbProcessClientInitMessage. */ cl->state = RFB_INITIALISATION; break; case rfbSecTypeVncAuth: /* Begin the standard VNC authentication procedure. */ rfbVncAuthSendChallenge(cl); break; default: /* Impossible case (hopefully). */ rfbLogPerror("rfbSendSecurityType: assertion failed"); rfbCloseSock(cl->sock); } } /* * Advertise our supported security types (protocol 3.7 and above). * The list includes one standard security type (if primaryType is not * set to rfbSecTypeInvalid), and then one more value telling the * client that we support TightVNC protocol extensions. Thus, * currently, there will be either 1 or 2 items in the list. */ static void rfbSendSecurityTypeList(cl, primaryType) rfbClientPtr cl; int primaryType; { int count = 1; /* Fill in the list of security types in the client structure. */ if (primaryType != rfbSecTypeInvalid) { cl->securityTypes[count++] = (CARD8)primaryType; } cl->securityTypes[count] = (CARD8)rfbSecTypeTight; cl->securityTypes[0] = (CARD8)count++; /* Send the list. */ if (WriteExact(cl->sock, (char *)cl->securityTypes, count) < 0) { rfbLogPerror("rfbSendSecurityTypeList: write"); rfbCloseSock(cl->sock); return; } /* Dispatch client input to rfbProcessClientSecurityType. */ cl->state = RFB_SECURITY_TYPE; } /* * Read the security type chosen by the client (protocol 3.7 and * above). */ void rfbProcessClientSecurityType(cl) rfbClientPtr cl; { int n, count, i; CARD8 chosenType; /* Read the security type. */ n = ReadExact(cl->sock, (char *)&chosenType, 1); if (n <= 0) { if (n == 0) rfbLog("rfbProcessClientSecurityType: client gone\n"); else rfbLogPerror("rfbProcessClientSecurityType: read"); rfbCloseSock(cl->sock); return; } /* Make sure it was present in the list sent by the server. */ count = (int)cl->securityTypes[0]; for (i = 1; i <= count; i++) { if (chosenType == cl->securityTypes[i]) break; } if (i > count) { rfbLog("rfbProcessClientSecurityType: " "wrong security type requested\n"); rfbCloseSock(cl->sock); return; } /* Now go to the proper authentication procedure. */ switch (chosenType) { case rfbSecTypeNone: /* No authentication needed. */ rfbClientAuthSucceeded(cl, rfbAuthNone); break; case rfbSecTypeVncAuth: /* Begin the standard VNC authentication procedure. */ rfbVncAuthSendChallenge(cl); break; case rfbSecTypeTight: /* We are lucky: the viewer supports TightVNC extensions. */ rfbLog("Enabling TightVNC protocol extensions\n"); /* Switch to the protocol 3.7t/3.8t. */ cl->protocol_tightvnc = TRUE; /* Advertise our tunneling capabilities. */ rfbSendTunnelingCaps(cl); break; default: /* Impossible case (hopefully). */ rfbLog("rfbProcessClientSecurityType: " "unknown authentication scheme\n"); rfbCloseSock(cl->sock); } } /* * Send the list of our tunneling capabilities (protocol 3.7t/3.8t). */ static void rfbSendTunnelingCaps(cl) rfbClientPtr cl; { rfbTunnelingCapsMsg caps; CARD32 nTypes = 0; /* we don't support tunneling yet */ caps.nTunnelTypes = Swap32IfLE(nTypes); if (WriteExact(cl->sock, (char *)&caps, sz_rfbTunnelingCapsMsg) < 0) { rfbLogPerror("rfbSendTunnelingCaps: write"); rfbCloseSock(cl->sock); return; } if (nTypes) { /* Dispatch client input to rfbProcessClientTunnelingType(). */ cl->state = RFB_TUNNELING_TYPE; } else { rfbSendAuthCaps(cl); } } /* * Read tunneling type requested by the client (protocol 3.7t/3.8t). * NOTE: Currently, we don't support tunneling, and this function * can never be called. */ void rfbProcessClientTunnelingType(cl) rfbClientPtr cl; { /* If we were called, then something's really wrong. */ rfbLog("rfbProcessClientTunnelingType: not implemented\n"); rfbCloseSock(cl->sock); return; } /* * Send the list of our authentication capabilities to the client * (protocol 3.7t/3.8t). */ static void rfbSendAuthCaps(cl) rfbClientPtr cl; { Bool authRequired; rfbAuthenticationCapsMsg caps; rfbCapabilityInfo caplist[MAX_AUTH_CAPS]; int count = 0; authRequired = (rfbAuthPasswdFile != NULL && !cl->reverseConnection); if (authRequired) { if (rfbAuthPasswdFile != NULL) { SetCapInfo(&caplist[count], rfbAuthVNC, rfbStandardVendor); cl->authCaps[count++] = rfbAuthVNC; } if (count == 0) { /* Should never happen. */ rfbLog("rfbSendAuthCaps: assertion failed\n"); rfbCloseSock(cl->sock); return; } } cl->nAuthCaps = count; caps.nAuthTypes = Swap32IfLE((CARD32)count); if (WriteExact(cl->sock, (char *)&caps, sz_rfbAuthenticationCapsMsg) < 0) { rfbLogPerror("rfbSendAuthCaps: write"); rfbCloseSock(cl->sock); return; } if (count) { if (WriteExact(cl->sock, (char *)&caplist[0], count * sz_rfbCapabilityInfo) < 0) { rfbLogPerror("rfbSendAuthCaps: write"); rfbCloseSock(cl->sock); return; } /* Dispatch client input to rfbProcessClientAuthType. */ cl->state = RFB_AUTH_TYPE; } else { /* No authentication needed. */ rfbClientAuthSucceeded(cl, rfbAuthNone); } } /* * Read client's preferred authentication type (protocol 3.7t/3.8t). */ void rfbProcessClientAuthType(cl) rfbClientPtr cl; { CARD32 auth_type; int n, i; /* Read authentication type selected by the client. */ n = ReadExact(cl->sock, (char *)&auth_type, sizeof(auth_type)); if (n <= 0) { if (n == 0) rfbLog("rfbProcessClientAuthType: client gone\n"); else rfbLogPerror("rfbProcessClientAuthType: read"); rfbCloseSock(cl->sock); return; } auth_type = Swap32IfLE(auth_type); /* Make sure it was present in the list sent by the server. */ for (i = 0; i < cl->nAuthCaps; i++) { if (auth_type == cl->authCaps[i]) break; } if (i >= cl->nAuthCaps) { rfbLog("rfbProcessClientAuthType: " "wrong authentication type requested\n"); rfbCloseSock(cl->sock); return; } switch (auth_type) { case rfbAuthNone: /* Dispatch client input to rfbProcessClientInitMessage. */ cl->state = RFB_INITIALISATION; break; case rfbAuthVNC: rfbVncAuthSendChallenge(cl); break; default: rfbLog("rfbProcessClientAuthType: unknown authentication scheme\n"); rfbCloseSock(cl->sock); } } /* * Send the authentication challenge. */ static void rfbVncAuthSendChallenge(cl) rfbClientPtr cl; { vncRandomBytes(cl->authChallenge); if (WriteExact(cl->sock, (char *)cl->authChallenge, CHALLENGESIZE) < 0) { rfbLogPerror("rfbVncAuthSendChallenge: write"); rfbCloseSock(cl->sock); return; } /* Dispatch client input to rfbVncAuthProcessResponse. */ cl->state = RFB_AUTHENTICATION; } /* * rfbVncAuthProcessResponse is called when the client sends its * authentication response. */ void rfbVncAuthProcessResponse(cl) rfbClientPtr cl; { char passwdFullControl[9]; char passwdViewOnly[9]; int numPasswords; Bool ok; int n; CARD8 encryptedChallenge1[CHALLENGESIZE]; CARD8 encryptedChallenge2[CHALLENGESIZE]; CARD8 response[CHALLENGESIZE]; n = ReadExact(cl->sock, (char *)response, CHALLENGESIZE); if (n <= 0) { if (n != 0) rfbLogPerror("rfbVncAuthProcessResponse: read"); rfbCloseSock(cl->sock); return; } numPasswords = vncDecryptPasswdFromFile2(rfbAuthPasswdFile, passwdFullControl, passwdViewOnly); if (numPasswords == 0) { rfbLog("rfbVncAuthProcessResponse: could not get password from %s\n", rfbAuthPasswdFile); rfbClientAuthFailed(cl, "The server is not configured properly"); return; } memcpy(encryptedChallenge1, cl->authChallenge, CHALLENGESIZE); vncEncryptBytes(encryptedChallenge1, passwdFullControl); memcpy(encryptedChallenge2, cl->authChallenge, CHALLENGESIZE); vncEncryptBytes(encryptedChallenge2, (numPasswords == 2) ? passwdViewOnly : passwdFullControl); /* Lose the passwords from memory */ memset(passwdFullControl, 0, 9); memset(passwdViewOnly, 0, 9); ok = FALSE; if (memcmp(encryptedChallenge1, response, CHALLENGESIZE) == 0) { rfbLog("Full-control authentication passed by %s\n", cl->host); ok = TRUE; cl->viewOnly = FALSE; } else if (memcmp(encryptedChallenge2, response, CHALLENGESIZE) == 0) { rfbLog("View-only authentication passed by %s\n", cl->host); ok = TRUE; cl->viewOnly = TRUE; } if (ok) { rfbAuthUnblock(); rfbClientAuthSucceeded(cl, rfbAuthVNC); } else { rfbLog("rfbVncAuthProcessResponse: authentication failed from %s\n", cl->host); if (rfbAuthConsiderBlocking()) { rfbClientAuthFailed(cl, "Authentication failed, too many tries"); } else { rfbClientAuthFailed(cl, "Authentication failed"); } } } /* * rfbClientConnFailed is called when a client connection has failed * before the authentication stage. */ void rfbClientConnFailed(cl, reason) rfbClientPtr cl; char *reason; { int headerLen, reasonLen; char buf[8]; headerLen = (cl->protocol_minor_ver >= 7) ? 1 : 4; reasonLen = strlen(reason); ((CARD32 *)buf)[0] = 0; ((CARD32 *)buf)[1] = Swap32IfLE(reasonLen); if ( WriteExact(cl->sock, buf, headerLen) < 0 || WriteExact(cl->sock, buf + 4, 4) < 0 || WriteExact(cl->sock, reason, reasonLen) < 0 ) { rfbLogPerror("rfbClientConnFailed: write"); } rfbCloseSock(cl->sock); } /* * rfbClientAuthFailed is called on authentication failure. Sending a * reason string is defined in the RFB protocol 3.8 and above. */ void rfbClientAuthFailed(cl, reason) rfbClientPtr cl; char *reason; { int reasonLen; char buf[8]; if (cl->protocol_minor_ver < 8) reason = NULL; /* invalidate the pointer */ reasonLen = (reason == NULL) ? 0 : strlen(reason); ((CARD32 *)buf)[0] = Swap32IfLE(rfbAuthFailed); ((CARD32 *)buf)[1] = Swap32IfLE(reasonLen); if (reasonLen == 0) { if (WriteExact(cl->sock, buf, 4) < 0) { rfbLogPerror("rfbClientAuthFailed: write"); } } else { if ( WriteExact(cl->sock, buf, 8) < 0 || WriteExact(cl->sock, reason, reasonLen) < 0 ) { rfbLogPerror("rfbClientAuthFailed: write"); } } rfbCloseSock(cl->sock); } /* * rfbClientAuthSucceeded is called on successful authentication. * It just sends rfbAuthOK and dispatches client input to * rfbProcessClientInitMessage(). However, rfbAuthOK message is * not sent if authentication was not required and the protocol * version is 3.7 or lower. */ void rfbClientAuthSucceeded(cl, authType) rfbClientPtr cl; CARD32 authType; { CARD32 authResult; if (cl->protocol_minor_ver >= 8 || authType != rfbAuthNone) { authResult = Swap32IfLE(rfbAuthOK); if (WriteExact(cl->sock, (char *)&authResult, 4) < 0) { rfbLogPerror("rfbClientAuthSucceeded: write"); rfbCloseSock(cl->sock); return; } } /* Dispatch client input to rfbProcessClientInitMessage(). */ cl->state = RFB_INITIALISATION; } /********************************************************************* * Functions to prevent too many successive authentication failures. * FIXME: This should be performed separately per each client IP. */ /* Maximum authentication failures before blocking connections */ #define MAX_AUTH_TRIES 5 /* Delay in ms, doubles for each failure over MAX_AUTH_TRIES */ #define AUTH_TOO_MANY_BASE_DELAY 10 * 1000 static int rfbAuthTries = 0; static Bool rfbAuthTooManyTries = FALSE; static OsTimerPtr timer = NULL; /* * This function should not be called directly, it is called by * setting a timer in rfbAuthConsiderBlocking(). */ static CARD32 rfbAuthReenable(OsTimerPtr timer, CARD32 now, pointer arg) { rfbAuthTooManyTries = FALSE; return 0; } /* * This function should be called after each authentication failure. * The return value will be true if there was too many failures. */ Bool rfbAuthConsiderBlocking(void) { int i; rfbAuthTries++; if (rfbAuthTries >= MAX_AUTH_TRIES) { CARD32 delay = AUTH_TOO_MANY_BASE_DELAY; for (i = MAX_AUTH_TRIES; i < rfbAuthTries; i++) delay *= 2; timer = TimerSet(timer, 0, delay, rfbAuthReenable, NULL); rfbAuthTooManyTries = TRUE; return TRUE; } return FALSE; } /* * This function should be called after successful authentication. * It resets the counter of authentication failures. Note that it's * not necessary to clear the rfbAuthTooManyTries flag as it will be * reset by the timer function. */ void rfbAuthUnblock(void) { rfbAuthTries = 0; } /* * This function should be called before authentication process. * The return value will be true if there was too many authentication * failures, and the server should not allow another try. */ Bool rfbAuthIsBlocked(void) { return rfbAuthTooManyTries; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/Imakefile0100664000076400007640000000150110533026354021711 0ustar constconstXCOMM $XConsortium: Imakefile,v 1.5 94/01/21 22:04:27 dpw Exp $ #include SRCS = init.c sockets.c kbdptr.c cmap.c draw.c cutpaste.c \ dispcur.c sprite.c rfbserver.c translate.c httpd.c auth.c \ rre.c corre.c stats.c hextile.c zlib.c tight.c cursor.c OBJS = init.o sockets.o kbdptr.o cmap.o draw.o cutpaste.o \ dispcur.o sprite.o rfbserver.o translate.o httpd.o auth.o \ rre.o corre.o stats.o hextile.o zlib.o tight.o cursor.o #include INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(XINCLUDESRC) \ -I../../cfb -I../../mfb -I../../mi -I../../include -I../../os \ $(VNCCPPFLAGS) DEFINES = ServerOSDefines all:: $(OBJS) NormalLibraryObjectRule() NormalLibraryTarget(vnc,$(OBJS)) SpecialCObjectRule(init,$(ICONFIGFILES),-DXVNCRELEASE=XvncRelease) DependTarget() vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/init.c0100664000076400007640000005674310615425625021236 0ustar constconst/* * init.c */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* Use ``#define CORBA'' to enable CORBA control interface */ #include #include #include #include #include #include #include #include "X11/X.h" #define NEED_EVENTS #include "X11/Xproto.h" #include "X11/Xos.h" #include "scrnintstr.h" #include "servermd.h" #define PSZ 8 #include "cfb.h" #include "mibstore.h" #include "colormapst.h" #include "gcstruct.h" #include "input.h" #include "mipointer.h" #include "dixstruct.h" #include "propertyst.h" #include #include #include #include "dix.h" #include "rfb.h" #include #ifdef CORBA #include #endif #define RFB_DEFAULT_WIDTH 640 #define RFB_DEFAULT_HEIGHT 480 #define RFB_DEFAULT_DEPTH 8 #define RFB_DEFAULT_WHITEPIXEL 0 #define RFB_DEFAULT_BLACKPIXEL 1 rfbScreenInfo rfbScreen; int rfbGCIndex; static Bool initOutputCalled = FALSE; static Bool noCursor = FALSE; char *desktopName = "x11"; char rfbThisHost[256]; Atom VNC_LAST_CLIENT_ID; Atom VNC_CONNECT; static HWEventQueueType alwaysCheckForInput[2] = { 0, 1 }; static HWEventQueueType *mieqCheckForInput[2]; static char primaryOrder[4] = ""; static int redBits, greenBits, blueBits; static Bool rfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv); static int rfbKeybdProc(DeviceIntPtr pDevice, int onoff); static int rfbMouseProc(DeviceIntPtr pDevice, int onoff); static Bool CheckDisplayNumber(int n); static Bool rfbAlwaysTrue(); static char *rfbAllocateFramebufferMemory(rfbScreenInfoPtr prfb); static Bool rfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y); static void rfbCrossScreen(ScreenPtr pScreen, Bool entering); static void rfbClientStateChange(CallbackListPtr *, pointer myData, pointer client); static miPointerScreenFuncRec rfbPointerCursorFuncs = { rfbCursorOffScreen, rfbCrossScreen, miPointerWarpCursor }; int inetdSock = -1; static char inetdDisplayNumStr[10]; /* Interface address to bind to. */ struct in_addr interface; /* * ddxProcessArgument is our first entry point and will be called at the * very start for each argument. It is not called again on server reset. */ int ddxProcessArgument (argc, argv, i) int argc; char *argv[]; int i; { static Bool firstTime = TRUE; if (firstTime) { rfbScreen.width = RFB_DEFAULT_WIDTH; rfbScreen.height = RFB_DEFAULT_HEIGHT; rfbScreen.depth = RFB_DEFAULT_DEPTH; rfbScreen.blackPixel = RFB_DEFAULT_BLACKPIXEL; rfbScreen.whitePixel = RFB_DEFAULT_WHITEPIXEL; rfbScreen.pfbMemory = NULL; gethostname(rfbThisHost, 255); interface.s_addr = htonl (INADDR_ANY); firstTime = FALSE; } if (strcmp (argv[i], "-geometry") == 0) /* -geometry WxH */ { if (i + 1 >= argc) UseMsg(); if (sscanf(argv[i+1],"%dx%d", &rfbScreen.width,&rfbScreen.height) != 2) { ErrorF("Invalid geometry %s\n", argv[i+1]); UseMsg(); } #ifdef CORBA screenWidth= rfbScreen.width; screenHeight= rfbScreen.height; #endif return 2; } if (strcmp (argv[i], "-depth") == 0) /* -depth D */ { if (i + 1 >= argc) UseMsg(); rfbScreen.depth = atoi(argv[i+1]); #ifdef CORBA screenDepth= rfbScreen.depth; #endif return 2; } if (strcmp (argv[i], "-pixelformat") == 0) { if (i + 1 >= argc) UseMsg(); if (sscanf(argv[i+1], "%3s%1d%1d%1d", primaryOrder, &redBits, &greenBits, &blueBits) < 4) { ErrorF("Invalid pixel format %s\n", argv[i+1]); UseMsg(); } if (strcasecmp(primaryOrder, "bgr") == 0) { int tmp = redBits; redBits = blueBits; blueBits = tmp; } else if (strcasecmp(primaryOrder, "rgb") != 0) { ErrorF("Invalid pixel format %s\n", argv[i+1]); UseMsg(); } return 2; } if (strcmp (argv[i], "-blackpixel") == 0) { /* -blackpixel n */ if (i + 1 >= argc) UseMsg(); rfbScreen.blackPixel = atoi(argv[i+1]); return 2; } if (strcmp (argv[i], "-whitepixel") == 0) { /* -whitepixel n */ if (i + 1 >= argc) UseMsg(); rfbScreen.whitePixel = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-udpinputport") == 0) { /* -udpinputport port */ if (i + 1 >= argc) UseMsg(); udpPort = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-rfbport") == 0) { /* -rfbport port */ if (i + 1 >= argc) UseMsg(); rfbPort = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-rfbwait") == 0) { /* -rfbwait ms */ if (i + 1 >= argc) UseMsg(); rfbMaxClientWait = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-nocursor") == 0) { noCursor = TRUE; return 1; } if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */ if (i + 1 >= argc) UseMsg(); rfbAuthPasswdFile = argv[i+1]; return 2; } if (strcmp(argv[i], "-httpd") == 0) { if (i + 1 >= argc) UseMsg(); httpDir = argv[i+1]; return 2; } if (strcmp(argv[i], "-httpport") == 0) { if (i + 1 >= argc) UseMsg(); httpPort = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate ms */ if (i + 1 >= argc) UseMsg(); rfbDeferUpdateTime = atoi(argv[i+1]); return 2; } if (strcmp(argv[i], "-economictranslate") == 0) { rfbEconomicTranslate = TRUE; return 1; } if (strcmp(argv[i], "-lazytight") == 0) { rfbTightDisableGradient = TRUE; return 1; } if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */ if (i + 1 >= argc) UseMsg(); desktopName = argv[i+1]; return 2; } if (strcmp(argv[i], "-alwaysshared") == 0) { rfbAlwaysShared = TRUE; return 1; } if (strcmp(argv[i], "-nevershared") == 0) { rfbNeverShared = TRUE; return 1; } if (strcmp(argv[i], "-dontdisconnect") == 0) { rfbDontDisconnect = TRUE; return 1; } /* Run server in view-only mode - Ehud Karni SW */ if (strcmp(argv[i], "-viewonly") == 0) { rfbViewOnly = TRUE; return 1; } if (strcmp(argv[i], "-localhost") == 0) { interface.s_addr = htonl (INADDR_LOOPBACK); return 1; } if (strcmp(argv[i], "-interface") == 0) { /* -interface ipaddr */ struct in_addr got; unsigned long octet; char *p, *end; int q; if (i + 1 >= argc) { UseMsg(); return 2; } if (interface.s_addr != htonl (INADDR_ANY)) { /* Already set (-localhost?). */ return 2; } p = argv[i + 1]; for (q = 0; q < 4; q++) { octet = strtoul (p, &end, 10); if (p == end || octet > 255) { UseMsg (); return 2; } if (q < 3 && *end != '.' || q == 3 && *end != '\0') { UseMsg (); return 2; } got.s_addr = (got.s_addr << 8) | octet; p = end + 1; } interface.s_addr = htonl (got.s_addr); return 2; } if (strcmp(argv[i], "-inetd") == 0) { /* -inetd */ int n; for (n = 1; n < 100; n++) { if (CheckDisplayNumber(n)) break; } if (n >= 100) FatalError("-inetd: couldn't find free display number"); sprintf(inetdDisplayNumStr, "%d", n); display = inetdDisplayNumStr; /* fds 0, 1 and 2 (stdin, out and err) are all the same socket to the RFB client. OsInit() closes stdout and stdin, and we don't want stderr to go to the RFB client, so make the client socket 3 and close stderr. OsInit() will redirect stderr logging to an appropriate log file or /dev/null if that doesn't work. */ dup2(0,3); inetdSock = 3; close(2); return 1; } if (strcmp(argv[i], "-compatiblekbd") == 0) { compatibleKbd = TRUE; return 1; } if (strcmp(argv[i], "-version") == 0) { ErrorF("Xvnc version %s\n", XVNCRELEASE); exit(0); } if (inetdSock != -1 && argv[i][0] == ':') { FatalError("can't specify both -inetd and :displaynumber"); } return 0; } /* * InitOutput is called every time the server resets. It should call * AddScreen for each screen (but we only ever have one), and in turn this * will call rfbScreenInit. */ void InitOutput(screenInfo, argc, argv) ScreenInfo *screenInfo; int argc; char **argv; { initOutputCalled = TRUE; rfbLog("Xvnc version %s\n", XVNCRELEASE); rfbLog("Copyright (C) 2000-2007 TightVNC Group\n"); rfbLog("Copyright (C) 1999 AT&T Laboratories Cambridge\n"); rfbLog("All Rights Reserved.\n"); rfbLog("See http://www.tightvnc.com/ for information on TightVNC\n"); rfbLog("Desktop name '%s' (%s:%s)\n",desktopName,rfbThisHost,display); rfbLog("Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t\n"); VNC_LAST_CLIENT_ID = MakeAtom("VNC_LAST_CLIENT_ID", strlen("VNC_LAST_CLIENT_ID"), TRUE); VNC_CONNECT = MakeAtom("VNC_CONNECT", strlen("VNC_CONNECT"), TRUE); rfbInitSockets(); if (inetdSock == -1) httpInitSockets(); #ifdef CORBA initialiseCORBA(argc, argv, desktopName); #endif /* initialize pixmap formats */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; screenInfo->numPixmapFormats = 2; screenInfo->formats[0].depth = 1; screenInfo->formats[0].bitsPerPixel = 1; screenInfo->formats[0].scanlinePad = BITMAP_SCANLINE_PAD; screenInfo->formats[1].depth = rfbScreen.depth; screenInfo->formats[1].bitsPerPixel = rfbBitsPerPixel(rfbScreen.depth); screenInfo->formats[1].scanlinePad = BITMAP_SCANLINE_PAD; rfbGCIndex = AllocateGCPrivateIndex(); if (rfbGCIndex < 0) { FatalError("InitOutput: AllocateGCPrivateIndex failed\n"); } if (!AddCallback(&ClientStateCallback, rfbClientStateChange, NULL)) { rfbLog("InitOutput: AddCallback failed\n"); return; } /* initialize screen */ if (AddScreen(rfbScreenInit, argc, argv) == -1) { FatalError("Couldn't add screen"); } } static Bool rfbScreenInit(index, pScreen, argc, argv) int index; ScreenPtr pScreen; int argc; char ** argv; { rfbScreenInfoPtr prfb = &rfbScreen; int dpix = 75, dpiy = 75; int ret; char *pbits; VisualPtr vis; extern int monitorResolution; if (monitorResolution != 0) { dpix = monitorResolution; dpiy = monitorResolution; } prfb->paddedWidthInBytes = PixmapBytePad(prfb->width, prfb->depth); prfb->bitsPerPixel = rfbBitsPerPixel(prfb->depth); pbits = rfbAllocateFramebufferMemory(prfb); if (!pbits) return FALSE; if (prfb->bitsPerPixel > 1) { extern int defaultColorVisualClass; if (defaultColorVisualClass != -1) { cfbSetVisualTypes(prfb->depth, (1 << defaultColorVisualClass), 8); } else { cfbSetVisualTypes(prfb->depth, (1 << TrueColor), 8); } } switch (prfb->bitsPerPixel) { case 1: ret = mfbScreenInit(pScreen, pbits, prfb->width, prfb->height, dpix, dpiy, prfb->paddedWidthInBytes * 8); break; case 8: ret = cfbScreenInit(pScreen, pbits, prfb->width, prfb->height, dpix, dpiy, prfb->paddedWidthInBytes); break; case 16: ret = cfb16ScreenInit(pScreen, pbits, prfb->width, prfb->height, dpix, dpiy, prfb->paddedWidthInBytes / 2); break; case 32: ret = cfb32ScreenInit(pScreen, pbits, prfb->width, prfb->height, dpix, dpiy, prfb->paddedWidthInBytes / 4); break; default: return FALSE; } if (!ret) return FALSE; if (!AllocateGCPrivate(pScreen, rfbGCIndex, sizeof(rfbGCRec))) { FatalError("rfbScreenInit: AllocateGCPrivate failed\n"); } prfb->cursorIsDrawn = FALSE; prfb->dontSendFramebufferUpdate = FALSE; prfb->CloseScreen = pScreen->CloseScreen; prfb->CreateGC = pScreen->CreateGC; prfb->PaintWindowBackground = pScreen->PaintWindowBackground; prfb->PaintWindowBorder = pScreen->PaintWindowBorder; prfb->CopyWindow = pScreen->CopyWindow; prfb->ClearToBackground = pScreen->ClearToBackground; prfb->RestoreAreas = pScreen->RestoreAreas; pScreen->CloseScreen = rfbCloseScreen; pScreen->CreateGC = rfbCreateGC; pScreen->PaintWindowBackground = rfbPaintWindowBackground; pScreen->PaintWindowBorder = rfbPaintWindowBorder; pScreen->CopyWindow = rfbCopyWindow; pScreen->ClearToBackground = rfbClearToBackground; pScreen->RestoreAreas = rfbRestoreAreas; pScreen->InstallColormap = rfbInstallColormap; pScreen->UninstallColormap = rfbUninstallColormap; pScreen->ListInstalledColormaps = rfbListInstalledColormaps; pScreen->StoreColors = rfbStoreColors; pScreen->SaveScreen = rfbAlwaysTrue; rfbDCInitialize(pScreen, &rfbPointerCursorFuncs); if (noCursor) { pScreen->DisplayCursor = rfbAlwaysTrue; prfb->cursorIsDrawn = TRUE; } pScreen->blackPixel = prfb->blackPixel; pScreen->whitePixel = prfb->whitePixel; for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++) ; if (!vis) { rfbLog("rfbScreenInit: couldn't find root visual\n"); exit(1); } if (strcasecmp(primaryOrder, "rgb") == 0) { vis->offsetBlue = 0; vis->blueMask = (1 << blueBits) - 1; vis->offsetGreen = blueBits; vis->greenMask = ((1 << greenBits) - 1) << vis->offsetGreen; vis->offsetRed = vis->offsetGreen + greenBits; vis->redMask = ((1 << redBits) - 1) << vis->offsetRed; } else if (strcasecmp(primaryOrder, "bgr") == 0) { rfbLog("BGR format %d %d %d\n", blueBits, greenBits, redBits); vis->offsetRed = 0; vis->redMask = (1 << redBits) - 1; vis->offsetGreen = redBits; vis->greenMask = ((1 << greenBits) - 1) << vis->offsetGreen; vis->offsetBlue = vis->offsetGreen + greenBits; vis->blueMask = ((1 << blueBits) - 1) << vis->offsetBlue; } rfbServerFormat.bitsPerPixel = prfb->bitsPerPixel; rfbServerFormat.depth = prfb->depth; rfbServerFormat.bigEndian = !(*(char *)&rfbEndianTest); rfbServerFormat.trueColour = (vis->class == TrueColor); if (rfbServerFormat.trueColour) { rfbServerFormat.redMax = vis->redMask >> vis->offsetRed; rfbServerFormat.greenMax = vis->greenMask >> vis->offsetGreen; rfbServerFormat.blueMax = vis->blueMask >> vis->offsetBlue; rfbServerFormat.redShift = vis->offsetRed; rfbServerFormat.greenShift = vis->offsetGreen; rfbServerFormat.blueShift = vis->offsetBlue; } else { rfbServerFormat.redMax = rfbServerFormat.greenMax = rfbServerFormat.blueMax = 0; rfbServerFormat.redShift = rfbServerFormat.greenShift = rfbServerFormat.blueShift = 0; } if (prfb->bitsPerPixel == 1) { ret = mfbCreateDefColormap(pScreen); } else { ret = cfbCreateDefColormap(pScreen); } return ret; } /* end rfbScreenInit */ /* * InitInput is also called every time the server resets. It is called after * InitOutput so we can assume that rfbInitSockets has already been called. */ void InitInput(argc, argv) int argc; char *argv[]; { DeviceIntPtr p, k; k = AddInputDevice(rfbKeybdProc, TRUE); p = AddInputDevice(rfbMouseProc, TRUE); RegisterKeyboardDevice(k); RegisterPointerDevice(p); miRegisterPointerDevice(screenInfo.screens[0], p); (void)mieqInit (k, p); mieqCheckForInput[0] = checkForInput[0]; mieqCheckForInput[1] = checkForInput[1]; SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]); } static int rfbKeybdProc(pDevice, onoff) DeviceIntPtr pDevice; int onoff; { KeySymsRec keySyms; CARD8 modMap[MAP_LENGTH]; DevicePtr pDev = (DevicePtr)pDevice; switch (onoff) { case DEVICE_INIT: KbdDeviceInit(pDevice, &keySyms, modMap); InitKeyboardDeviceStruct(pDev, &keySyms, modMap, (BellProcPtr)rfbSendBell, (KbdCtrlProcPtr)NoopDDA); break; case DEVICE_ON: pDev->on = TRUE; KbdDeviceOn(); break; case DEVICE_OFF: pDev->on = FALSE; KbdDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) KbdDeviceOff(); break; } return Success; } static int rfbMouseProc(pDevice, onoff) DeviceIntPtr pDevice; int onoff; { BYTE map[6]; DevicePtr pDev = (DevicePtr)pDevice; switch (onoff) { case DEVICE_INIT: PtrDeviceInit(); map[1] = 1; map[2] = 2; map[3] = 3; map[4] = 4; map[5] = 5; InitPointerDeviceStruct(pDev, map, 5, miPointerGetMotionEvents, PtrDeviceControl, miPointerGetMotionBufferSize()); break; case DEVICE_ON: pDev->on = TRUE; PtrDeviceOn(pDevice); break; case DEVICE_OFF: pDev->on = FALSE; PtrDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) PtrDeviceOff(); break; } return Success; } Bool LegalModifier(key, pDev) unsigned int key; DevicePtr pDev; { return TRUE; } void ProcessInputEvents() { rfbCheckFds(); httpCheckFds(); #ifdef CORBA corbaCheckFds(); #endif if (*mieqCheckForInput[0] != *mieqCheckForInput[1]) { mieqProcessInputEvents(); miPointerUpdate(); } } static Bool CheckDisplayNumber(int n) { char fname[32]; int sock; struct sockaddr_in addr; sock = socket(AF_INET, SOCK_STREAM, 0); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_ANY); addr.sin_port = htons(6000+n); if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { close(sock); return FALSE; } close(sock); sprintf(fname, "/tmp/.X%d-lock", n); if (access(fname, F_OK) == 0) return FALSE; sprintf(fname, "/tmp/.X11-unix/X%d", n); if (access(fname, F_OK) == 0) return FALSE; return TRUE; } void rfbRootPropertyChange(PropertyPtr pProp) { if ((pProp->propertyName == XA_CUT_BUFFER0) && (pProp->type == XA_STRING) && (pProp->format == 8)) { rfbGotXCutText(pProp->data, pProp->size); return; } if ((pProp->propertyName == VNC_CONNECT) && (pProp->type == XA_STRING) && (pProp->format == 8)) { int i; rfbClientPtr cl; int port = 5500; char *host = (char *)Xalloc(pProp->size+1); memcpy(host, pProp->data, pProp->size); host[pProp->size] = 0; for (i = 0; i < pProp->size; i++) { if (host[i] == ':') { port = atoi(&host[i+1]); host[i] = 0; } } cl = rfbReverseConnection(host, port); #ifdef CORBA if (cl != NULL) newConnection(cl, (KEYBOARD_DEVICE|POINTER_DEVICE), 1, 1, 1); #endif free(host); } } int rfbBitsPerPixel(depth) int depth; { if (depth == 1) return 1; else if (depth <= 8) return 8; else if (depth <= 16) return 16; else return 32; } static Bool rfbAlwaysTrue() { return TRUE; } static char * rfbAllocateFramebufferMemory(prfb) rfbScreenInfoPtr prfb; { if (prfb->pfbMemory) return prfb->pfbMemory; /* already done */ prfb->sizeInBytes = (prfb->paddedWidthInBytes * prfb->height); prfb->pfbMemory = (char *)Xalloc(prfb->sizeInBytes); return prfb->pfbMemory; } static Bool rfbCursorOffScreen (ppScreen, x, y) ScreenPtr *ppScreen; int *x, *y; { return FALSE; } static void rfbCrossScreen (pScreen, entering) ScreenPtr pScreen; Bool entering; { } static void rfbClientStateChange(cbl, myData, clt) CallbackListPtr *cbl; pointer myData; pointer clt; { dispatchException &= ~DE_RESET; /* hack - force server not to reset */ } void ddxGiveUp() { Xfree(rfbScreen.pfbMemory); if (initOutputCalled) { char unixSocketName[32]; sprintf(unixSocketName,"/tmp/.X11-unix/X%s",display); unlink(unixSocketName); #ifdef CORBA shutdownCORBA(); #endif } } void AbortDDX() { ddxGiveUp(); } void OsVendorInit() { } void OsVendorFatalError() { } #ifdef DDXTIME /* from ServerOSDefines */ CARD32 GetTimeInMillis() { struct timeval tp; X_GETTIMEOFDAY(&tp); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); } #endif void ddxUseMsg() { ErrorF("-geometry WxH set framebuffer width & height\n"); ErrorF("-depth D set framebuffer depth\n"); ErrorF("-pixelformat format set pixel format (BGRnnn or RGBnnn)\n"); ErrorF("-udpinputport port UDP port for keyboard/pointer data\n"); ErrorF("-rfbport port TCP port for RFB protocol\n"); ErrorF("-rfbwait time max time in ms to wait for RFB client\n"); ErrorF("-nocursor don't put up a cursor\n"); ErrorF("-rfbauth passwd-file use authentication on RFB protocol\n"); ErrorF("-httpd dir serve files via HTTP from here\n"); ErrorF("-httpport port port for HTTP\n"); ErrorF("-deferupdate time time in ms to defer updates " "(default 40)\n"); ErrorF("-economictranslate less memory-hungry translation\n"); ErrorF("-lazytight disable \"gradient\" filter in tight " "encoding\n"); ErrorF("-desktop name VNC desktop name (default x11)\n"); ErrorF("-alwaysshared always treat new clients as shared\n"); ErrorF("-nevershared never treat new clients as shared\n"); ErrorF("-dontdisconnect don't disconnect existing clients when a " "new non-shared\n" " connection comes in (refuse new connection " "instead)\n"); ErrorF("-viewonly let clients only to view the desktop\n"); ErrorF("-localhost only allow connections from localhost\n"); ErrorF("-interface ipaddr only bind to specified interface " "address\n"); ErrorF("-inetd Xvnc is launched by inetd\n"); ErrorF("-compatiblekbd set META key = ALT key as in the original " "VNC\n"); ErrorF("-version report Xvnc version on stderr\n"); exit(1); } /* * rfbLog prints a time-stamped message to the log file (stderr). */ void rfbLog(char *format, ...) { va_list args; char buf[256]; time_t clock; va_start(args, format); time(&clock); strftime(buf, 255, "%d/%m/%y %T ", localtime(&clock)); fprintf(stderr, buf); vfprintf(stderr, format, args); fflush(stderr); va_end(args); } void rfbLogPerror(char *str) { rfbLog(""); perror(str); } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/dispcur.c0100664000076400007640000002734107120677563021743 0ustar constconst/* * dispcur.c * * cursor display routines - based on midispcur.c */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #define NEED_EVENTS # include "X.h" # include "misc.h" # include "input.h" # include "cursorstr.h" # include "windowstr.h" # include "regionstr.h" # include "dixstruct.h" # include "scrnintstr.h" # include "servermd.h" # include "mipointer.h" # include "sprite.h" # include "gcstruct.h" extern WindowPtr *WindowTable; /* per-screen private data */ static int rfbDCScreenIndex; static unsigned long rfbDCGeneration = 0; static Bool rfbDCCloseScreen(); typedef struct { GCPtr pSourceGC, pMaskGC; GCPtr pSaveGC, pRestoreGC; GCPtr pPixSourceGC, pPixMaskGC; CloseScreenProcPtr CloseScreen; PixmapPtr pSave; } rfbDCScreenRec, *rfbDCScreenPtr; /* per-cursor per-screen private data */ typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ } rfbDCCursorRec, *rfbDCCursorPtr; /* * sprite/cursor method table */ static Bool rfbDCRealizeCursor(), rfbDCUnrealizeCursor(); static Bool rfbDCPutUpCursor(), rfbDCSaveUnderCursor(); static Bool rfbDCRestoreUnderCursor(); static rfbSpriteCursorFuncRec rfbDCFuncs = { rfbDCRealizeCursor, rfbDCUnrealizeCursor, rfbDCPutUpCursor, rfbDCSaveUnderCursor, rfbDCRestoreUnderCursor, }; Bool rfbDCInitialize (pScreen, screenFuncs) ScreenPtr pScreen; miPointerScreenFuncPtr screenFuncs; { rfbDCScreenPtr pScreenPriv; if (rfbDCGeneration != serverGeneration) { rfbDCScreenIndex = AllocateScreenPrivateIndex (); if (rfbDCScreenIndex < 0) return FALSE; rfbDCGeneration = serverGeneration; } pScreenPriv = (rfbDCScreenPtr) xalloc (sizeof (rfbDCScreenRec)); if (!pScreenPriv) return FALSE; /* * initialize the entire private structure to zeros */ pScreenPriv->pSourceGC = pScreenPriv->pMaskGC = pScreenPriv->pSaveGC = pScreenPriv->pRestoreGC = pScreenPriv->pPixSourceGC = pScreenPriv->pPixMaskGC = NULL; pScreenPriv->pSave = NULL; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = rfbDCCloseScreen; pScreen->devPrivates[rfbDCScreenIndex].ptr = (pointer) pScreenPriv; if (!rfbSpriteInitialize (pScreen, &rfbDCFuncs, screenFuncs)) { xfree ((pointer) pScreenPriv); return FALSE; } return TRUE; } #define tossGC(gc) (gc ? FreeGC (gc, (GContext) 0) : 0) #define tossPix(pix) (pix ? (*pScreen->DestroyPixmap) (pix) : TRUE) static Bool rfbDCCloseScreen (index, pScreen) ScreenPtr pScreen; { rfbDCScreenPtr pScreenPriv; pScreenPriv = (rfbDCScreenPtr) pScreen->devPrivates[rfbDCScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; tossGC (pScreenPriv->pSourceGC); tossGC (pScreenPriv->pMaskGC); tossGC (pScreenPriv->pSaveGC); tossGC (pScreenPriv->pRestoreGC); tossGC (pScreenPriv->pPixSourceGC); tossGC (pScreenPriv->pPixMaskGC); tossPix (pScreenPriv->pSave); xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (index, pScreen); } static Bool rfbDCRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { if (pCursor->bits->refcnt <= 1) pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; return TRUE; } static rfbDCCursorPtr rfbDCRealize (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { rfbDCCursorPtr pPriv; GCPtr pGC; XID gcvals[3]; pPriv = (rfbDCCursorPtr) xalloc (sizeof (rfbDCCursorRec)); if (!pPriv) return (rfbDCCursorPtr)NULL; pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); if (!pPriv->sourceBits) { xfree ((pointer) pPriv); return (rfbDCCursorPtr)NULL; } pPriv->maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1); if (!pPriv->maskBits) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); xfree ((pointer) pPriv); return (rfbDCCursorPtr)NULL; } pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC (1, pScreen); if (!pGC) { (void) rfbDCUnrealizeCursor (pScreen, pCursor); return (rfbDCCursorPtr)NULL; } ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); gcvals[0] = GXand; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals[0] = GXcopy; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->mask); gcvals[0] = GXandInverted; ChangeGC (pGC, GCFunction, gcvals); ValidateGC ((DrawablePtr)pPriv->maskBits, pGC); (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *)pCursor->bits->source); FreeScratchGC (pGC); return pPriv; } static Bool rfbDCUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { rfbDCCursorPtr pPriv; pPriv = (rfbDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (pPriv && (pCursor->bits->refcnt <= 1)) { (*pScreen->DestroyPixmap) (pPriv->sourceBits); (*pScreen->DestroyPixmap) (pPriv->maskBits); xfree ((pointer) pPriv); pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; } return TRUE; } static void rfbDCPutBits (pDrawable, pPriv, sourceGC, maskGC, x, y, w, h, source, mask) DrawablePtr pDrawable; GCPtr sourceGC, maskGC; int x, y; unsigned w, h; rfbDCCursorPtr pPriv; unsigned long source, mask; { XID gcvals[1]; if (sourceGC->fgPixel != source) { gcvals[0] = source; DoChangeGC (sourceGC, GCForeground, gcvals, 0); } if (sourceGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, sourceGC); (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcvals[0] = mask; DoChangeGC (maskGC, GCForeground, gcvals, 0); } if (maskGC->serialNumber != pDrawable->serialNumber) ValidateGC (pDrawable, maskGC); (*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y); } #define EnsureGC(gc,win) (gc || rfbDCMakeGC(&gc, win)) static GCPtr rfbDCMakeGC(ppGC, pWin) GCPtr *ppGC; WindowPtr pWin; { GCPtr pGC; int status; XID gcvals[2]; gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, GCSubwindowMode|GCGraphicsExposures, gcvals, &status); if (pGC) (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); *ppGC = pGC; return pGC; } static Bool rfbDCPutUpCursor (pScreen, pCursor, x, y, source, mask) ScreenPtr pScreen; CursorPtr pCursor; int x, y; unsigned long source, mask; { rfbDCScreenPtr pScreenPriv; rfbDCCursorPtr pPriv; WindowPtr pWin; pPriv = (rfbDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; if (!pPriv) { pPriv = rfbDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } pScreenPriv = (rfbDCScreenPtr) pScreen->devPrivates[rfbDCScreenIndex].ptr; pWin = WindowTable[pScreen->myNum]; if (!EnsureGC(pScreenPriv->pSourceGC, pWin)) return FALSE; if (!EnsureGC(pScreenPriv->pMaskGC, pWin)) { FreeGC (pScreenPriv->pSourceGC, (GContext) 0); pScreenPriv->pSourceGC = 0; return FALSE; } rfbDCPutBits ((DrawablePtr)pWin, pPriv, pScreenPriv->pSourceGC, pScreenPriv->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); return TRUE; } static Bool rfbDCSaveUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { rfbDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (rfbDCScreenPtr) pScreen->devPrivates[rfbDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) { if (pSave) (*pScreen->DestroyPixmap) (pSave); pScreenPriv->pSave = pSave = (*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth); if (!pSave) return FALSE; } if (!EnsureGC(pScreenPriv->pSaveGC, pWin)) return FALSE; pGC = pScreenPriv->pSaveGC; if (pSave->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pSave, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC, x, y, w, h, 0, 0); return TRUE; } static Bool rfbDCRestoreUnderCursor (pScreen, x, y, w, h) ScreenPtr pScreen; int x, y, w, h; { rfbDCScreenPtr pScreenPriv; PixmapPtr pSave; WindowPtr pWin; GCPtr pGC; pScreenPriv = (rfbDCScreenPtr) pScreen->devPrivates[rfbDCScreenIndex].ptr; pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave) return FALSE; if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) return FALSE; pGC = pScreenPriv->pRestoreGC; if (pWin->drawable.serialNumber != pGC->serialNumber) ValidateGC ((DrawablePtr) pWin, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC, 0, 0, w, h, x, y); return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/sprite.c0100664000076400007640000014755310200215403021556 0ustar constconst/* * sprite.c * * software sprite routines - based on misprite */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* $XConsortium: misprite.c,v 5.47 94/04/17 20:27:53 dpw Exp $ */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # include "X.h" # include "Xproto.h" # include "misc.h" # include "pixmapstr.h" # include "input.h" # include "mi.h" # include "cursorstr.h" # include "font.h" # include "scrnintstr.h" # include "colormapst.h" # include "windowstr.h" # include "gcstruct.h" # include "mipointer.h" # include "spritest.h" # include "dixfontstr.h" # include "fontstruct.h" #include "rfb.h" /* * screen wrappers */ static int rfbSpriteScreenIndex; static unsigned long rfbSpriteGeneration = 0; static Bool rfbSpriteCloseScreen(); static void rfbSpriteGetImage(); static void rfbSpriteGetSpans(); static void rfbSpriteSourceValidate(); static Bool rfbSpriteCreateGC(); static void rfbSpriteInstallColormap(); static void rfbSpriteStoreColors(); static void rfbSpritePaintWindowBackground(); static void rfbSpritePaintWindowBorder(); static void rfbSpriteCopyWindow(); static void rfbSpriteClearToBackground(); static void rfbSpriteSaveDoomedAreas(); static RegionPtr rfbSpriteRestoreAreas(); static void rfbSpriteComputeSaved(); #define SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ ((rfbSpriteScreenPtr) (pScreen)->devPrivates[rfbSpriteScreenIndex].ptr)->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) /* * GC func wrappers */ static int rfbSpriteGCIndex; static void rfbSpriteValidateGC (), rfbSpriteCopyGC (); static void rfbSpriteDestroyGC(), rfbSpriteChangeGC(); static void rfbSpriteChangeClip(), rfbSpriteDestroyClip(); static void rfbSpriteCopyClip(); static GCFuncs rfbSpriteGCFuncs = { rfbSpriteValidateGC, rfbSpriteChangeGC, rfbSpriteCopyGC, rfbSpriteDestroyGC, rfbSpriteChangeClip, rfbSpriteDestroyClip, rfbSpriteCopyClip, }; #define GC_FUNC_PROLOGUE(pGC) \ rfbSpriteGCPtr pGCPriv = \ (rfbSpriteGCPtr) (pGC)->devPrivates[rfbSpriteGCIndex].ptr;\ (pGC)->funcs = pGCPriv->wrapFuncs; \ if (pGCPriv->wrapOps) \ (pGC)->ops = pGCPriv->wrapOps; #define GC_FUNC_EPILOGUE(pGC) \ pGCPriv->wrapFuncs = (pGC)->funcs; \ (pGC)->funcs = &rfbSpriteGCFuncs; \ if (pGCPriv->wrapOps) \ { \ pGCPriv->wrapOps = (pGC)->ops; \ (pGC)->ops = &rfbSpriteGCOps; \ } /* * GC op wrappers */ static void rfbSpriteFillSpans(), rfbSpriteSetSpans(); static void rfbSpritePutImage(); static RegionPtr rfbSpriteCopyArea(), rfbSpriteCopyPlane(); static void rfbSpritePolyPoint(), rfbSpritePolylines(); static void rfbSpritePolySegment(), rfbSpritePolyRectangle(); static void rfbSpritePolyArc(), rfbSpriteFillPolygon(); static void rfbSpritePolyFillRect(), rfbSpritePolyFillArc(); static int rfbSpritePolyText8(), rfbSpritePolyText16(); static void rfbSpriteImageText8(), rfbSpriteImageText16(); static void rfbSpriteImageGlyphBlt(), rfbSpritePolyGlyphBlt(); static void rfbSpritePushPixels(); #ifdef NEED_LINEHELPER static void rfbSpriteLineHelper(); #endif static GCOps rfbSpriteGCOps = { rfbSpriteFillSpans, rfbSpriteSetSpans, rfbSpritePutImage, rfbSpriteCopyArea, rfbSpriteCopyPlane, rfbSpritePolyPoint, rfbSpritePolylines, rfbSpritePolySegment, rfbSpritePolyRectangle, rfbSpritePolyArc, rfbSpriteFillPolygon, rfbSpritePolyFillRect, rfbSpritePolyFillArc, rfbSpritePolyText8, rfbSpritePolyText16, rfbSpriteImageText8, rfbSpriteImageText16, rfbSpriteImageGlyphBlt, rfbSpritePolyGlyphBlt, rfbSpritePushPixels #ifdef NEED_LINEHELPER , rfbSpriteLineHelper #endif }; /* * testing only -- remove cursor for every draw. Eventually, * each draw operation will perform a bounding box check against * the saved cursor area */ #define GC_SETUP_CHEAP(pDrawable) \ rfbSpriteScreenPtr pScreenPriv = (rfbSpriteScreenPtr) \ (pDrawable)->pScreen->devPrivates[rfbSpriteScreenIndex].ptr; \ #define GC_SETUP(pDrawable, pGC) \ GC_SETUP_CHEAP(pDrawable) \ rfbSpriteGCPtr pGCPrivate = (rfbSpriteGCPtr) \ (pGC)->devPrivates[rfbSpriteGCIndex].ptr; \ GCFuncs *oldFuncs = pGC->funcs; #define GC_SETUP_AND_CHECK(pDrawable, pGC) \ GC_SETUP(pDrawable, pGC); \ if (GC_CHECK((WindowPtr)pDrawable)) \ rfbSpriteRemoveCursor (pDrawable->pScreen); #define GC_CHECK(pWin) \ (rfbScreen.cursorIsDrawn && \ (pScreenPriv->pCacheWin == pWin ? \ pScreenPriv->isInCacheWin : ( \ ((int) (pScreenPriv->pCacheWin = (pWin))) , \ (pScreenPriv->isInCacheWin = \ (pWin)->drawable.x < pScreenPriv->saved.x2 && \ pScreenPriv->saved.x1 < (pWin)->drawable.x + \ (int) (pWin)->drawable.width && \ (pWin)->drawable.y < pScreenPriv->saved.y2 && \ pScreenPriv->saved.y1 < (pWin)->drawable.y + \ (int) (pWin)->drawable.height &&\ RECT_IN_REGION((pWin)->drawable.pScreen, &(pWin)->borderClip, \ &pScreenPriv->saved) != rgnOUT)))) #define GC_OP_PROLOGUE(pGC) { \ (pGC)->funcs = pGCPrivate->wrapFuncs; \ (pGC)->ops = pGCPrivate->wrapOps; \ } #define GC_OP_EPILOGUE(pGC) { \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->funcs = oldFuncs; \ (pGC)->ops = &rfbSpriteGCOps; \ } /* * pointer-sprite method table */ static Bool rfbSpriteRealizeCursor (), rfbSpriteUnrealizeCursor (); static void rfbSpriteSetCursor (), rfbSpriteMoveCursor (); miPointerSpriteFuncRec rfbSpritePointerFuncs = { rfbSpriteRealizeCursor, rfbSpriteUnrealizeCursor, rfbSpriteSetCursor, rfbSpriteMoveCursor, }; /* * other misc functions */ static Bool rfbDisplayCursor (ScreenPtr pScreen, CursorPtr pCursor); /* * rfbSpriteInitialize -- called from device-dependent screen * initialization proc after all of the function pointers have * been stored in the screen structure. */ Bool rfbSpriteInitialize (pScreen, cursorFuncs, screenFuncs) ScreenPtr pScreen; rfbSpriteCursorFuncPtr cursorFuncs; miPointerScreenFuncPtr screenFuncs; { rfbSpriteScreenPtr pPriv; VisualPtr pVisual; if (rfbSpriteGeneration != serverGeneration) { rfbSpriteScreenIndex = AllocateScreenPrivateIndex (); if (rfbSpriteScreenIndex < 0) return FALSE; rfbSpriteGeneration = serverGeneration; rfbSpriteGCIndex = AllocateGCPrivateIndex (); } if (!AllocateGCPrivate(pScreen, rfbSpriteGCIndex, sizeof(rfbSpriteGCRec))) return FALSE; pPriv = (rfbSpriteScreenPtr) xalloc (sizeof (rfbSpriteScreenRec)); if (!pPriv) return FALSE; if (!miPointerInitialize (pScreen, &rfbSpritePointerFuncs, screenFuncs,TRUE)) { xfree ((pointer) pPriv); return FALSE; } for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++) ; pPriv->pVisual = pVisual; pPriv->CloseScreen = pScreen->CloseScreen; pPriv->GetImage = pScreen->GetImage; pPriv->GetSpans = pScreen->GetSpans; pPriv->SourceValidate = pScreen->SourceValidate; pPriv->CreateGC = pScreen->CreateGC; pPriv->InstallColormap = pScreen->InstallColormap; pPriv->StoreColors = pScreen->StoreColors; pPriv->DisplayCursor = pScreen->DisplayCursor; pPriv->PaintWindowBackground = pScreen->PaintWindowBackground; pPriv->PaintWindowBorder = pScreen->PaintWindowBorder; pPriv->CopyWindow = pScreen->CopyWindow; pPriv->ClearToBackground = pScreen->ClearToBackground; pPriv->SaveDoomedAreas = pScreen->SaveDoomedAreas; pPriv->RestoreAreas = pScreen->RestoreAreas; pPriv->pCursor = NULL; pPriv->x = 0; pPriv->y = 0; pPriv->pCacheWin = NullWindow; pPriv->isInCacheWin = FALSE; pPriv->checkPixels = TRUE; pPriv->pInstalledMap = NULL; pPriv->pColormap = NULL; pPriv->funcs = cursorFuncs; pPriv->colors[SOURCE_COLOR].red = 0; pPriv->colors[SOURCE_COLOR].green = 0; pPriv->colors[SOURCE_COLOR].blue = 0; pPriv->colors[MASK_COLOR].red = 0; pPriv->colors[MASK_COLOR].green = 0; pPriv->colors[MASK_COLOR].blue = 0; pScreen->devPrivates[rfbSpriteScreenIndex].ptr = (pointer) pPriv; pScreen->CloseScreen = rfbSpriteCloseScreen; pScreen->GetImage = rfbSpriteGetImage; pScreen->GetSpans = rfbSpriteGetSpans; pScreen->SourceValidate = rfbSpriteSourceValidate; pScreen->CreateGC = rfbSpriteCreateGC; pScreen->InstallColormap = rfbSpriteInstallColormap; pScreen->StoreColors = rfbSpriteStoreColors; pScreen->PaintWindowBackground = rfbSpritePaintWindowBackground; pScreen->PaintWindowBorder = rfbSpritePaintWindowBorder; pScreen->CopyWindow = rfbSpriteCopyWindow; pScreen->ClearToBackground = rfbSpriteClearToBackground; pScreen->SaveDoomedAreas = rfbSpriteSaveDoomedAreas; pScreen->RestoreAreas = rfbSpriteRestoreAreas; pScreen->DisplayCursor = rfbDisplayCursor; return TRUE; } /* * Screen wrappers */ /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped function */ static Bool rfbSpriteCloseScreen (i, pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; pScreen->SourceValidate = pScreenPriv->SourceValidate; pScreen->CreateGC = pScreenPriv->CreateGC; pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->StoreColors = pScreenPriv->StoreColors; pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground; pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder; pScreen->CopyWindow = pScreenPriv->CopyWindow; pScreen->ClearToBackground = pScreenPriv->ClearToBackground; pScreen->SaveDoomedAreas = pScreenPriv->SaveDoomedAreas; pScreen->RestoreAreas = pScreenPriv->RestoreAreas; xfree ((pointer) pScreenPriv); return (*pScreen->CloseScreen) (i, pScreen); } static void rfbSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) DrawablePtr pDrawable; int sx, sy, w, h; unsigned int format; unsigned long planemask; char *pdstLine; { ScreenPtr pScreen = pDrawable->pScreen; rfbSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetImage); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && rfbScreen.cursorIsDrawn && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h)) { rfbSpriteRemoveCursor (pScreen); } (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); SCREEN_EPILOGUE (pScreen, GetImage, rfbSpriteGetImage); } static void rfbSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) DrawablePtr pDrawable; int wMax; DDXPointPtr ppt; int *pwidth; int nspans; char *pdstStart; { ScreenPtr pScreen = pDrawable->pScreen; rfbSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, GetSpans); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && rfbScreen.cursorIsDrawn) { register DDXPointPtr pts; register int *widths; register int nPts; register int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y+yorg, pts->x+xorg,*widths)) { rfbSpriteRemoveCursor (pScreen); break; } } } (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); SCREEN_EPILOGUE (pScreen, GetSpans, rfbSpriteGetSpans); } static void rfbSpriteSourceValidate (pDrawable, x, y, width, height) DrawablePtr pDrawable; int x, y, width, height; { ScreenPtr pScreen = pDrawable->pScreen; rfbSpriteScreenPtr pScreenPriv; SCREEN_PROLOGUE (pScreen, SourceValidate); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (pDrawable->type == DRAWABLE_WINDOW && rfbScreen.cursorIsDrawn && ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y, x, y, width, height)) { rfbSpriteRemoveCursor (pScreen); } if (pScreen->SourceValidate) (*pScreen->SourceValidate) (pDrawable, x, y, width, height); SCREEN_EPILOGUE (pScreen, SourceValidate, rfbSpriteSourceValidate); } static Bool rfbSpriteCreateGC (pGC) GCPtr pGC; { ScreenPtr pScreen = pGC->pScreen; Bool ret; rfbSpriteGCPtr pPriv; SCREEN_PROLOGUE (pScreen, CreateGC); pPriv = (rfbSpriteGCPtr)pGC->devPrivates[rfbSpriteGCIndex].ptr; ret = (*pScreen->CreateGC) (pGC); pPriv->wrapOps = NULL; pPriv->wrapFuncs = pGC->funcs; pGC->funcs = &rfbSpriteGCFuncs; SCREEN_EPILOGUE (pScreen, CreateGC, rfbSpriteCreateGC); return ret; } static void rfbSpriteInstallColormap (pMap) ColormapPtr pMap; { ScreenPtr pScreen = pMap->pScreen; rfbSpriteScreenPtr pPriv; pPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); SCREEN_EPILOGUE(pScreen, InstallColormap, rfbSpriteInstallColormap); pPriv->pInstalledMap = pMap; if (pPriv->pColormap != pMap) { pPriv->checkPixels = TRUE; if (rfbScreen.cursorIsDrawn) rfbSpriteRemoveCursor (pScreen); } } static void rfbSpriteStoreColors (pMap, ndef, pdef) ColormapPtr pMap; int ndef; xColorItem *pdef; { ScreenPtr pScreen = pMap->pScreen; rfbSpriteScreenPtr pPriv; int i; int updated; VisualPtr pVisual; pPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; SCREEN_PROLOGUE(pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); SCREEN_EPILOGUE(pScreen, StoreColors, rfbSpriteStoreColors); if (pPriv->pColormap == pMap) { updated = 0; pVisual = pMap->pVisual; if (pVisual->class == DirectColor) { /* Direct color - match on any of the subfields */ #define MaskMatch(a,b,mask) ((a) & (pVisual->mask) == (b) & (pVisual->mask)) #define UpdateDAC(plane,dac,mask) {\ if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\ pPriv->colors[plane].dac = pdef[i].dac; \ updated = 1; \ } \ } #define CheckDirect(plane) \ UpdateDAC(plane,red,redMask) \ UpdateDAC(plane,green,greenMask) \ UpdateDAC(plane,blue,blueMask) for (i = 0; i < ndef; i++) { CheckDirect (SOURCE_COLOR) CheckDirect (MASK_COLOR) } } else { /* PseudoColor/GrayScale - match on exact pixel */ for (i = 0; i < ndef; i++) { if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel) { pPriv->colors[SOURCE_COLOR] = pdef[i]; if (++updated == 2) break; } if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel) { pPriv->colors[MASK_COLOR] = pdef[i]; if (++updated == 2) break; } } } if (updated) { pPriv->checkPixels = TRUE; if (rfbScreen.cursorIsDrawn) rfbSpriteRemoveCursor (pScreen); } } } static void rfbSpriteFindColors (pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; CursorPtr pCursor; xColorItem *sourceColor, *maskColor; pCursor = pScreenPriv->pCursor; sourceColor = &pScreenPriv->colors[SOURCE_COLOR]; maskColor = &pScreenPriv->colors[MASK_COLOR]; if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap || !(pCursor->foreRed == sourceColor->red && pCursor->foreGreen == sourceColor->green && pCursor->foreBlue == sourceColor->blue && pCursor->backRed == maskColor->red && pCursor->backGreen == maskColor->green && pCursor->backBlue == maskColor->blue)) { pScreenPriv->pColormap = pScreenPriv->pInstalledMap; sourceColor->red = pCursor->foreRed; sourceColor->green = pCursor->foreGreen; sourceColor->blue = pCursor->foreBlue; FakeAllocColor (pScreenPriv->pColormap, sourceColor); maskColor->red = pCursor->backRed; maskColor->green = pCursor->backGreen; maskColor->blue = pCursor->backBlue; FakeAllocColor (pScreenPriv->pColormap, maskColor); /* "free" the pixels right away, don't let this confuse you */ FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel); FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel); } pScreenPriv->checkPixels = FALSE; } /* * BackingStore wrappers */ static void rfbSpriteSaveDoomedAreas (pWin, pObscured, dx, dy) WindowPtr pWin; RegionPtr pObscured; int dx, dy; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; BoxRec cursorBox; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, SaveDoomedAreas); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (rfbScreen.cursorIsDrawn) { cursorBox = pScreenPriv->saved; if (dx || dy) { cursorBox.x1 += dx; cursorBox.y1 += dy; cursorBox.x2 += dx; cursorBox.y2 += dy; } if (RECT_IN_REGION( pScreen, pObscured, &cursorBox) != rgnOUT) rfbSpriteRemoveCursor (pScreen); } (*pScreen->SaveDoomedAreas) (pWin, pObscured, dx, dy); SCREEN_EPILOGUE (pScreen, SaveDoomedAreas, rfbSpriteSaveDoomedAreas); } static RegionPtr rfbSpriteRestoreAreas (pWin, prgnExposed) WindowPtr pWin; RegionPtr prgnExposed; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; RegionPtr result; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, RestoreAreas); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (rfbScreen.cursorIsDrawn) { if (RECT_IN_REGION( pScreen, prgnExposed, &pScreenPriv->saved) != rgnOUT) rfbSpriteRemoveCursor (pScreen); } result = (*pScreen->RestoreAreas) (pWin, prgnExposed); SCREEN_EPILOGUE (pScreen, RestoreAreas, rfbSpriteRestoreAreas); return result; } /* * Window wrappers */ static void rfbSpritePaintWindowBackground (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, PaintWindowBackground); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (rfbScreen.cursorIsDrawn) { /* * If the cursor is on the same screen as the window, check the * region to paint for the cursor and remove it as necessary */ if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT) rfbSpriteRemoveCursor (pScreen); } (*pScreen->PaintWindowBackground) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBackground, rfbSpritePaintWindowBackground); } static void rfbSpritePaintWindowBorder (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, PaintWindowBorder); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (rfbScreen.cursorIsDrawn) { /* * If the cursor is on the same screen as the window, check the * region to paint for the cursor and remove it as necessary */ if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT) rfbSpriteRemoveCursor (pScreen); } (*pScreen->PaintWindowBorder) (pWin, pRegion, what); SCREEN_EPILOGUE (pScreen, PaintWindowBorder, rfbSpritePaintWindowBorder); } static void rfbSpriteCopyWindow (pWin, ptOldOrg, pRegion) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr pRegion; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; BoxRec cursorBox; int dx, dy; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, CopyWindow); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (rfbScreen.cursorIsDrawn) { /* * check both the source and the destination areas. The given * region is source relative, so offset the cursor box by * the delta position */ cursorBox = pScreenPriv->saved; dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; cursorBox.x1 -= dx; cursorBox.x2 -= dx; cursorBox.y1 -= dy; cursorBox.y2 -= dy; if (RECT_IN_REGION( pScreen, pRegion, &pScreenPriv->saved) != rgnOUT || RECT_IN_REGION( pScreen, pRegion, &cursorBox) != rgnOUT) rfbSpriteRemoveCursor (pScreen); } (*pScreen->CopyWindow) (pWin, ptOldOrg, pRegion); SCREEN_EPILOGUE (pScreen, CopyWindow, rfbSpriteCopyWindow); } static void rfbSpriteClearToBackground (pWin, x, y, w, h, generateExposures) WindowPtr pWin; short x,y; unsigned short w,h; Bool generateExposures; { ScreenPtr pScreen; rfbSpriteScreenPtr pScreenPriv; int realw, realh; pScreen = pWin->drawable.pScreen; SCREEN_PROLOGUE (pScreen, ClearToBackground); pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (GC_CHECK(pWin)) { if (!(realw = w)) realw = (int) pWin->drawable.width - x; if (!(realh = h)) realh = (int) pWin->drawable.height - y; if (ORG_OVERLAP(&pScreenPriv->saved, pWin->drawable.x, pWin->drawable.y, x, y, realw, realh)) { rfbSpriteRemoveCursor (pScreen); } } (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); SCREEN_EPILOGUE (pScreen, ClearToBackground, rfbSpriteClearToBackground); } /* * GC Func wrappers */ static void rfbSpriteValidateGC (pGC, changes, pDrawable) GCPtr pGC; Mask changes; DrawablePtr pDrawable; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); pGCPriv->wrapOps = NULL; if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr) pDrawable)->viewable) { WindowPtr pWin; RegionPtr pRegion; pWin = (WindowPtr) pDrawable; pRegion = &pWin->clipList; if (pGC->subWindowMode == IncludeInferiors) pRegion = &pWin->borderClip; if (REGION_NOTEMPTY(pDrawable->pScreen, pRegion)) pGCPriv->wrapOps = pGC->ops; } GC_FUNC_EPILOGUE (pGC); } static void rfbSpriteChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeGC) (pGC, mask); GC_FUNC_EPILOGUE (pGC); } static void rfbSpriteCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { GC_FUNC_PROLOGUE (pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); GC_FUNC_EPILOGUE (pGCDst); } static void rfbSpriteDestroyGC (pGC) GCPtr pGC; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->DestroyGC) (pGC); GC_FUNC_EPILOGUE (pGC); } static void rfbSpriteChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { GC_FUNC_PROLOGUE (pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); GC_FUNC_EPILOGUE (pGC); } static void rfbSpriteCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { GC_FUNC_PROLOGUE (pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); GC_FUNC_EPILOGUE (pgcDst); } static void rfbSpriteDestroyClip(pGC) GCPtr pGC; { GC_FUNC_PROLOGUE (pGC); (* pGC->funcs->DestroyClip)(pGC); GC_FUNC_EPILOGUE (pGC); } /* * GC Op wrappers */ static void rfbSpriteFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = pptInit, widths = pwidthInit, nPts = nInit; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); GC_OP_EPILOGUE (pGC); } static void rfbSpriteSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register DDXPointPtr pts; register int *widths; register int nPts; for (pts = ppt, widths = pwidth, nPts = nspans; nPts--; pts++, widths++) { if (SPN_OVERLAP(&pScreenPriv->saved,pts->y,pts->x,*widths)) { rfbSpriteRemoveCursor(pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); GC_OP_EPILOGUE (pGC); } static void rfbSpritePutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int format; char *pBits; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { if (ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, x,y,w,h)) { rfbSpriteRemoveCursor (pDrawable->pScreen); } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); GC_OP_EPILOGUE (pGC); } static RegionPtr rfbSpriteCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { RegionPtr rgn; GC_SETUP(pDst, pGC); /* check destination/source overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { rfbSpriteRemoveCursor (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); GC_OP_EPILOGUE (pGC); return rgn; } static RegionPtr rfbSpriteCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GCPtr pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane; { RegionPtr rgn; GC_SETUP(pDst, pGC); /* * check destination/source for overlap. */ if (GC_CHECK((WindowPtr) pDst) && (ORG_OVERLAP(&pScreenPriv->saved,pDst->x,pDst->y,dstx,dsty,w,h) || ((pDst == pSrc) && ORG_OVERLAP(&pScreenPriv->saved,pSrc->x,pSrc->y,srcx,srcy,w,h)))) { rfbSpriteRemoveCursor (pDst->pScreen); } GC_OP_PROLOGUE (pGC); rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); GC_OP_EPILOGUE (pGC); return rgn; } static void rfbSpritePolyPoint (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pptInit; { xPoint t; int n; BoxRec cursor; register xPoint *pts; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor.x1 = pScreenPriv->saved.x1 - pDrawable->x; cursor.y1 = pScreenPriv->saved.y1 - pDrawable->y; cursor.x2 = pScreenPriv->saved.x2 - pDrawable->x; cursor.y2 = pScreenPriv->saved.y2 - pDrawable->y; if (mode == CoordModePrevious) { t.x = 0; t.y = 0; for (pts = pptInit, n = npt; n--; pts++) { t.x += pts->x; t.y += pts->y; if (cursor.x1 <= t.x && t.x <= cursor.x2 && cursor.y1 <= t.y && t.y <= cursor.y2) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } else { for (pts = pptInit, n = npt; n--; pts++) { if (cursor.x1 <= pts->x && pts->x <= cursor.x2 && cursor.y1 <= pts->y && pts->y <= cursor.y2) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolylines (pDrawable, pGC, mode, npt, pptInit) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr pptInit; { BoxPtr cursor; register DDXPointPtr pts; int n; int x, y, x1, y1, x2, y2; int lw; int extra; GC_SETUP (pDrawable, pGC); if (npt && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; lw = pGC->lineWidth; x = pptInit->x + pDrawable->x; y = pptInit->y + pDrawable->y; if (npt == 1) { extra = lw >> 1; if (LINE_OVERLAP(cursor, x, y, x, y, extra)) rfbSpriteRemoveCursor (pDrawable->pScreen); } else { extra = lw >> 1; /* * mitered joins can project quite a way from * the line end; the 11 degree miter limit limits * this extension to 10.43 * lw / 2, rounded up * and converted to int yields 6 * lw */ if (pGC->joinStyle == JoinMiter) extra = 6 * lw; else if (pGC->capStyle == CapProjecting) extra = lw; for (pts = pptInit + 1, n = npt - 1; n--; pts++) { x1 = x; y1 = y; if (mode == CoordModeOrigin) { x2 = pDrawable->x + pts->x; y2 = pDrawable->y + pts->y; } else { x2 = x + pts->x; y2 = y + pts->y; } x = x2; y = y2; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, pptInit); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolySegment(pDrawable, pGC, nseg, pSegs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *pSegs; { int n; register xSegment *segs; BoxPtr cursor; int x1, y1, x2, y2; int extra; GC_SETUP(pDrawable, pGC); if (nseg && GC_CHECK((WindowPtr) pDrawable)) { cursor = &pScreenPriv->saved; extra = pGC->lineWidth >> 1; if (pGC->capStyle == CapProjecting) extra = pGC->lineWidth; for (segs = pSegs, n = nseg; n--; segs++) { x1 = segs->x1 + pDrawable->x; y1 = segs->y1 + pDrawable->y; x2 = segs->x2 + pDrawable->x; y2 = segs->y2 + pDrawable->y; LINE_SORT(x1, y1, x2, y2); if (LINE_OVERLAP(cursor, x1, y1, x2, y2, extra)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolySegment) (pDrawable, pGC, nseg, pSegs); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolyRectangle(pDrawable, pGC, nrects, pRects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *pRects; { register xRectangle *rects; BoxPtr cursor; int lw; int n; int x1, y1, x2, y2; GC_SETUP (pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { lw = pGC->lineWidth >> 1; cursor = &pScreenPriv->saved; for (rects = pRects, n = nrects; n--; rects++) { x1 = rects->x + pDrawable->x; y1 = rects->y + pDrawable->y; x2 = x1 + (int)rects->width; y2 = y1 + (int)rects->height; if (LINE_OVERLAP(cursor, x1, y1, x2, y1, lw) || LINE_OVERLAP(cursor, x2, y1, x2, y2, lw) || LINE_OVERLAP(cursor, x1, y2, x2, y2, lw) || LINE_OVERLAP(cursor, x1, y1, x1, y2, lw)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyRectangle) (pDrawable, pGC, nrects, pRects); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolyArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; register GCPtr pGC; int narcs; xArc *parcs; { BoxPtr cursor; int lw; int n; register xArc *arcs; GC_SETUP (pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { lw = pGC->lineWidth >> 1; cursor = &pScreenPriv->saved; for (arcs = parcs, n = narcs; n--; arcs++) { if (ORG_OVERLAP (cursor, pDrawable->x, pDrawable->y, arcs->x - lw, arcs->y - lw, (int) arcs->width + pGC->lineWidth, (int) arcs->height + pGC->lineWidth)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, parcs); GC_OP_EPILOGUE (pGC); } static void rfbSpriteFillPolygon(pDrawable, pGC, shape, mode, count, pPts) register DrawablePtr pDrawable; register GCPtr pGC; int shape, mode; int count; DDXPointPtr pPts; { int x, y, minx, miny, maxx, maxy; register DDXPointPtr pts; int n; GC_SETUP (pDrawable, pGC); if (count && GC_CHECK((WindowPtr) pDrawable)) { x = pDrawable->x; y = pDrawable->y; pts = pPts; minx = maxx = pts->x; miny = maxy = pts->y; pts++; n = count - 1; if (mode == CoordModeOrigin) { for (; n--; pts++) { if (pts->x < minx) minx = pts->x; else if (pts->x > maxx) maxx = pts->x; if (pts->y < miny) miny = pts->y; else if (pts->y > maxy) maxy = pts->y; } minx += x; miny += y; maxx += x; maxy += y; } else { x += minx; y += miny; minx = maxx = x; miny = maxy = y; for (; n--; pts++) { x += pts->x; y += pts->y; if (x < minx) minx = x; else if (x > maxx) maxx = x; if (y < miny) miny = y; else if (y > maxy) maxy = y; } } if (BOX_OVERLAP(&pScreenPriv->saved,minx,miny,maxx,maxy)) rfbSpriteRemoveCursor (pDrawable->pScreen); } GC_OP_PROLOGUE (pGC); (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pPts); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolyFillRect(pDrawable, pGC, nrectFill, prectInit) DrawablePtr pDrawable; GCPtr pGC; int nrectFill; /* number of rectangles to fill */ xRectangle *prectInit; /* Pointer to first rectangle to fill */ { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register int nRect; register xRectangle *pRect; register int xorg, yorg; xorg = pDrawable->x; yorg = pDrawable->y; for (nRect = nrectFill, pRect = prectInit; nRect--; pRect++) { if (ORGRECT_OVERLAP(&pScreenPriv->saved,xorg,yorg,pRect)){ rfbSpriteRemoveCursor(pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrectFill, prectInit); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolyFillArc(pDrawable, pGC, narcs, parcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *parcs; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable)) { register int n; BoxPtr cursor; register xArc *arcs; cursor = &pScreenPriv->saved; for (arcs = parcs, n = narcs; n--; arcs++) { if (ORG_OVERLAP(cursor, pDrawable->x, pDrawable->y, arcs->x, arcs->y, (int) arcs->width, (int) arcs->height)) { rfbSpriteRemoveCursor (pDrawable->pScreen); break; } } } GC_OP_PROLOGUE (pGC); (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, parcs); GC_OP_EPILOGUE (pGC); } /* * general Poly/Image text function. Extract glyph information, * compute bounding box and remove cursor if it is overlapped. */ static Bool rfbSpriteTextOverlap (pDraw, font, x, y, n, charinfo, imageblt, w, cursorBox) DrawablePtr pDraw; FontPtr font; int x, y; unsigned int n; CharInfoPtr *charinfo; Bool imageblt; unsigned int w; BoxPtr cursorBox; { ExtentInfoRec extents; x += pDraw->x; y += pDraw->y; if (FONTMINBOUNDS(font,characterWidth) >= 0) { /* compute an approximate (but covering) bounding box */ if (!imageblt || (charinfo[0]->metrics.leftSideBearing < 0)) extents.overallLeft = charinfo[0]->metrics.leftSideBearing; else extents.overallLeft = 0; if (w) extents.overallRight = w - charinfo[n-1]->metrics.characterWidth; else extents.overallRight = FONTMAXBOUNDS(font,characterWidth) * (n - 1); if (imageblt && (charinfo[n-1]->metrics.characterWidth > charinfo[n-1]->metrics.rightSideBearing)) extents.overallRight += charinfo[n-1]->metrics.characterWidth; else extents.overallRight += charinfo[n-1]->metrics.rightSideBearing; if (imageblt && FONTASCENT(font) > FONTMAXBOUNDS(font,ascent)) extents.overallAscent = FONTASCENT(font); else extents.overallAscent = FONTMAXBOUNDS(font, ascent); if (imageblt && FONTDESCENT(font) > FONTMAXBOUNDS(font,descent)) extents.overallDescent = FONTDESCENT(font); else extents.overallDescent = FONTMAXBOUNDS(font,descent); if (!BOX_OVERLAP(cursorBox, x + extents.overallLeft, y - extents.overallAscent, x + extents.overallRight, y + extents.overallDescent)) return FALSE; else if (imageblt && w) return TRUE; /* if it does overlap, fall through and compute exactly, because * taking down the cursor is expensive enough to make this worth it */ } QueryGlyphExtents(font, charinfo, n, &extents); if (imageblt) { if (extents.overallWidth > extents.overallRight) extents.overallRight = extents.overallWidth; if (extents.overallWidth < extents.overallLeft) extents.overallLeft = extents.overallWidth; if (extents.overallLeft > 0) extents.overallLeft = 0; if (extents.fontAscent > extents.overallAscent) extents.overallAscent = extents.fontAscent; if (extents.fontDescent > extents.overallDescent) extents.overallDescent = extents.fontDescent; } return (BOX_OVERLAP(cursorBox, x + extents.overallLeft, y - extents.overallAscent, x + extents.overallRight, y + extents.overallDescent)); } /* * values for textType: */ #define TT_POLY8 0 #define TT_IMAGE8 1 #define TT_POLY16 2 #define TT_IMAGE16 3 static int rfbSpriteText (pDraw, pGC, x, y, count, chars, fontEncoding, textType, cursorBox) DrawablePtr pDraw; GCPtr pGC; int x, y; unsigned long count; char *chars; FontEncoding fontEncoding; Bool textType; BoxPtr cursorBox; { CharInfoPtr *charinfo; register CharInfoPtr *info; unsigned long i; unsigned int n; int w; void (*drawFunc)(); Bool imageblt; imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr)); if (!charinfo) return x; GetGlyphs(pGC->font, count, (unsigned char *)chars, fontEncoding, &i, charinfo); n = (unsigned int)i; w = 0; if (!imageblt) for (info = charinfo; i--; info++) w += (*info)->metrics.characterWidth; if (n != 0) { if (rfbSpriteTextOverlap(pDraw, pGC->font, x, y, n, charinfo, imageblt, w, cursorBox)) rfbSpriteRemoveCursor(pDraw->pScreen); #ifdef AVOID_GLYPHBLT /* * On displays like Apollos, which do not optimize the GlyphBlt functions because they * convert fonts to their internal form in RealizeFont and optimize text directly, we * want to invoke the text functions here, not the GlyphBlt functions. */ switch (textType) { case TT_POLY8: drawFunc = (void (*)())pGC->ops->PolyText8; break; case TT_IMAGE8: drawFunc = pGC->ops->ImageText8; break; case TT_POLY16: drawFunc = (void (*)())pGC->ops->PolyText16; break; case TT_IMAGE16: drawFunc = pGC->ops->ImageText16; break; } (*drawFunc) (pDraw, pGC, x, y, (int) count, chars); #else /* don't AVOID_GLYPHBLT */ /* * On the other hand, if the device does use GlyphBlt ultimately to do text, we * don't want to slow it down by invoking the text functions and having them call * GetGlyphs all over again, so we go directly to the GlyphBlt functions here. */ drawFunc = imageblt ? pGC->ops->ImageGlyphBlt : pGC->ops->PolyGlyphBlt; (*drawFunc) (pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); #endif /* AVOID_GLYPHBLT */ } DEALLOCATE_LOCAL(charinfo); return x + w; } static int rfbSpritePolyText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { int ret; GC_SETUP (pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) ret = rfbSpriteText (pDrawable, pGC, x, y, (unsigned long)count, chars, Linear8Bit, TT_POLY8, &pScreenPriv->saved); else ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); return ret; } static int rfbSpritePolyText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { int ret; GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) ret = rfbSpriteText (pDrawable, pGC, x, y, (unsigned long)count, (char *)chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_POLY16, &pScreenPriv->saved); else ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); return ret; } static void rfbSpriteImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) (void) rfbSpriteText (pDrawable, pGC, x, y, (unsigned long)count, chars, Linear8Bit, TT_IMAGE8, &pScreenPriv->saved); else (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); } static void rfbSpriteImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable)) (void) rfbSpriteText (pDrawable, pGC, x, y, (unsigned long)count, (char *)chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_IMAGE16, &pScreenPriv->saved); else (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); GC_OP_EPILOGUE (pGC); } static void rfbSpriteImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { GC_SETUP(pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable) && rfbSpriteTextOverlap (pDrawable, pGC->font, x, y, nglyph, ppci, TRUE, 0, &pScreenPriv->saved)) { rfbSpriteRemoveCursor(pDrawable->pScreen); } (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); GC_OP_EPILOGUE (pGC); } static void rfbSpritePolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { GC_SETUP (pDrawable, pGC); GC_OP_PROLOGUE (pGC); if (GC_CHECK((WindowPtr) pDrawable) && rfbSpriteTextOverlap (pDrawable, pGC->font, x, y, nglyph, ppci, FALSE, 0, &pScreenPriv->saved)) { rfbSpriteRemoveCursor(pDrawable->pScreen); } (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); GC_OP_EPILOGUE (pGC); } static void rfbSpritePushPixels(pGC, pBitMap, pDrawable, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int w, h, x, y; { GC_SETUP(pDrawable, pGC); if (GC_CHECK((WindowPtr) pDrawable) && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y,x,y,w,h)) { rfbSpriteRemoveCursor (pDrawable->pScreen); } GC_OP_PROLOGUE (pGC); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); GC_OP_EPILOGUE (pGC); } #ifdef NEED_LINEHELPER /* * I don't expect this routine will ever be called, as the GC * will have been unwrapped for the line drawing */ static void rfbSpriteLineHelper() { FatalError("rfbSpriteLineHelper called\n"); } #endif /* * miPointer interface routines */ static Bool rfbSpriteRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (pCursor == pScreenPriv->pCursor) pScreenPriv->checkPixels = TRUE; return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor); } static Bool rfbSpriteUnrealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); } static void rfbSpriteSetCursor (pScreen, pCursor, x, y) ScreenPtr pScreen; CursorPtr pCursor; { rfbSpriteScreenPtr pScreenPriv; rfbClientPtr cl, nextCl; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; if (pScreenPriv->x == x && pScreenPriv->y == y && pScreenPriv->pCursor == pCursor && !pScreenPriv->checkPixels) { return; } if (rfbScreen.cursorIsDrawn) rfbSpriteRemoveCursor (pScreen); pScreenPriv->x = x; pScreenPriv->y = y; pScreenPriv->pCursor = pCursor; for (cl = rfbClientHead; cl; cl = nextCl) { nextCl = cl->next; if (cl->enableCursorPosUpdates) { if (x == cl->cursorX && y == cl->cursorY) { cl->cursorWasMoved = FALSE; continue; } cl->cursorWasMoved = TRUE; } if ( !cl->deferredUpdateScheduled && REGION_NOTEMPTY(pScreen,&cl->requestedRegion) ) { /* cursorIsDrawn is guaranteed to be FALSE here, so we definitely want to send a screen update to the client, even if that's only putting up the cursor */ rfbSendFramebufferUpdate(cl); } } } static void rfbSpriteMoveCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; rfbSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y); } /* * undraw/draw cursor */ void rfbSpriteRemoveCursor (pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv; if (!rfbScreen.cursorIsDrawn) return; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; rfbScreen.dontSendFramebufferUpdate = TRUE; rfbScreen.cursorIsDrawn = FALSE; pScreenPriv->pCacheWin = NullWindow; if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { rfbScreen.cursorIsDrawn = TRUE; } rfbScreen.dontSendFramebufferUpdate = FALSE; } void rfbSpriteRestoreCursor (pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv; int x, y; CursorPtr pCursor; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; if (rfbScreen.cursorIsDrawn || !pCursor) return; rfbScreen.dontSendFramebufferUpdate = TRUE; rfbSpriteComputeSaved (pScreen); x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; if ((*pScreenPriv->funcs->SaveUnderCursor) (pScreen, pScreenPriv->saved.x1, pScreenPriv->saved.y1, pScreenPriv->saved.x2 - pScreenPriv->saved.x1, pScreenPriv->saved.y2 - pScreenPriv->saved.y1)) { if (pScreenPriv->checkPixels) rfbSpriteFindColors (pScreen); if ((*pScreenPriv->funcs->PutUpCursor) (pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) rfbScreen.cursorIsDrawn = TRUE; } rfbScreen.dontSendFramebufferUpdate = FALSE; } /* * compute the desired area of the screen to save */ static void rfbSpriteComputeSaved (pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv; int x, y, w, h; CursorPtr pCursor; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; w = pCursor->bits->width; h = pCursor->bits->height; pScreenPriv->saved.x1 = x; pScreenPriv->saved.y1 = y; pScreenPriv->saved.x2 = pScreenPriv->saved.x1 + w; pScreenPriv->saved.y2 = pScreenPriv->saved.y1 + h; } /* * this function is called when the cursor shape is being changed */ static Bool rfbDisplayCursor(pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; { rfbClientPtr cl; rfbSpriteScreenPtr pPriv; Bool result; pPriv = (rfbSpriteScreenPtr)pScreen->devPrivates[rfbSpriteScreenIndex].ptr; result = (*pPriv->DisplayCursor)(pScreen, pCursor); for (cl = rfbClientHead; cl; cl = cl->next) { if (cl->enableCursorShapeUpdates) { cl->cursorWasChanged = TRUE; if ( !cl->deferredUpdateScheduled && REGION_NOTEMPTY(pScreen,&cl->requestedRegion) ) { rfbSendFramebufferUpdate(cl); } } } return result; } /* * obtain current cursor pointer */ CursorPtr rfbSpriteGetCursorPtr (pScreen) ScreenPtr pScreen; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; return pScreenPriv->pCursor; } /* * obtain current cursor position */ void rfbSpriteGetCursorPos (pScreen, px, py) ScreenPtr pScreen; int *px, *py; { rfbSpriteScreenPtr pScreenPriv; pScreenPriv = (rfbSpriteScreenPtr) pScreen->devPrivates[rfbSpriteScreenIndex].ptr; *px = pScreenPriv->x; *py = pScreenPriv->y; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/sockets.c0100664000076400007640000002755710543216033021736 0ustar constconst/* * sockets.c - deal with TCP & UDP sockets. * * This code should be independent of any changes in the RFB protocol. It just * deals with the X server scheduling stuff, calling rfbNewClientConnection and * rfbProcessClientMessage to actually deal with the protocol. If a socket * needs to be closed for any reason then rfbCloseSock should be called, and * this in turn will call rfbClientConnectionGone. To make an active * connection out, call rfbConnect - note that this does _not_ call * rfbNewClientConnection. * * This file is divided into two types of function. Those beginning with * "rfb" are specific to sockets using the RFB protocol. Those without the * "rfb" prefix are more general socket routines (which are used by the http * code). * * Thanks to Karl Hakimian for pointing out that some platforms return EAGAIN * not EWOULDBLOCK. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include #include #include #include #include #include #include #include #ifndef USE_LIBWRAP #define USE_LIBWRAP 0 #endif #if USE_LIBWRAP #include #include int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; #endif #include "rfb.h" int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has gone away - needed to stop us hanging */ int rfbPort = 0; int rfbListenSock = -1; int udpPort = 0; int udpSock = -1; Bool udpSockConnected = FALSE; static struct sockaddr_in udpRemoteAddr; static fd_set allFds; static int maxFd = 0; /* * rfbInitSockets sets up the TCP and UDP sockets to listen for RFB * connections. It does nothing if called again. */ void rfbInitSockets() { static Bool done = FALSE; if (done) return; done = TRUE; if (inetdSock != -1) { const int one = 1; if (fcntl(inetdSock, F_SETFL, O_NONBLOCK) < 0) { rfbLogPerror("fcntl"); exit(1); } if (setsockopt(inetdSock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { rfbLogPerror("setsockopt"); exit(1); } AddEnabledDevice(inetdSock); FD_ZERO(&allFds); FD_SET(inetdSock, &allFds); maxFd = inetdSock; return; } if (rfbPort == 0) { rfbPort = 5900 + atoi(display); } rfbLog("Listening for VNC connections on TCP port %d\n", rfbPort); if ((rfbListenSock = ListenOnTCPPort(rfbPort)) < 0) { rfbLogPerror("ListenOnTCPPort"); exit(1); } AddEnabledDevice(rfbListenSock); FD_ZERO(&allFds); FD_SET(rfbListenSock, &allFds); maxFd = rfbListenSock; if (udpPort != 0) { rfbLog("rfbInitSockets: listening for input on UDP port %d\n",udpPort); if ((udpSock = ListenOnUDPPort(udpPort)) < 0) { rfbLogPerror("ListenOnUDPPort"); exit(1); } AddEnabledDevice(udpSock); FD_SET(udpSock, &allFds); maxFd = max(udpSock,maxFd); } } /* * rfbCheckFds is called from ProcessInputEvents to check for input on the RFB * socket(s). If there is input to process, the appropriate function in the * RFB server code will be called (rfbNewClientConnection, * rfbProcessClientMessage, etc). */ void rfbCheckFds() { int nfds; fd_set fds; struct timeval tv; struct sockaddr_in addr; int addrlen = sizeof(addr); char buf[6]; const int one = 1; int sock; static Bool inetdInitDone = FALSE; if (!inetdInitDone && inetdSock != -1) { rfbNewClientConnection(inetdSock); inetdInitDone = TRUE; } memcpy((char *)&fds, (char *)&allFds, sizeof(fd_set)); tv.tv_sec = 0; tv.tv_usec = 0; nfds = select(maxFd + 1, &fds, NULL, NULL, &tv); if (nfds == 0) { return; } if (nfds < 0) { rfbLogPerror("rfbCheckFds: select"); return; } if (rfbListenSock != -1 && FD_ISSET(rfbListenSock, &fds)) { if ((sock = accept(rfbListenSock, (struct sockaddr *)&addr, &addrlen)) < 0) { rfbLogPerror("rfbCheckFds: accept"); return; } if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { rfbLogPerror("rfbCheckFds: fcntl"); close(sock); return; } if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { rfbLogPerror("rfbCheckFds: setsockopt"); close(sock); return; } fprintf(stderr,"\n"); #if USE_LIBWRAP if (!hosts_ctl("Xvnc", STRING_UNKNOWN, inet_ntoa(addr.sin_addr), STRING_UNKNOWN)) { rfbLog("Rejected connection from client %s\n", inet_ntoa(addr.sin_addr)); close(sock); return; } #endif rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr)); AddEnabledDevice(sock); FD_SET(sock, &allFds); maxFd = max(sock,maxFd); rfbNewClientConnection(sock); FD_CLR(rfbListenSock, &fds); if (--nfds == 0) return; } if ((udpSock != -1) && FD_ISSET(udpSock, &fds)) { if (recvfrom(udpSock, buf, 1, MSG_PEEK, (struct sockaddr *)&addr, &addrlen) < 0) { rfbLogPerror("rfbCheckFds: UDP: recvfrom"); rfbDisconnectUDPSock(); } else { if (!udpSockConnected || (memcmp(&addr, &udpRemoteAddr, addrlen) != 0)) { /* new remote end */ rfbLog("rfbCheckFds: UDP: got connection\n"); memcpy(&udpRemoteAddr, &addr, addrlen); udpSockConnected = TRUE; if (connect(udpSock, (struct sockaddr *)&addr, addrlen) < 0) { rfbLogPerror("rfbCheckFds: UDP: connect"); rfbDisconnectUDPSock(); return; } rfbNewUDPConnection(udpSock); } rfbProcessUDPInput(udpSock); } FD_CLR(udpSock, &fds); if (--nfds == 0) return; } for (sock = 0; sock <= maxFd; sock++) { if (FD_ISSET(sock, &fds) && FD_ISSET(sock, &allFds)) { rfbProcessClientMessage(sock); } } } void rfbDisconnectUDPSock() { udpSockConnected = FALSE; } void rfbCloseSock(sock) int sock; { close(sock); RemoveEnabledDevice(sock); FD_CLR(sock, &allFds); rfbClientConnectionGone(sock); if (sock == inetdSock) GiveUp(0); } /* * rfbWaitForClient can be called to wait for the RFB client to send us a * message. When one is received it is processed by calling * rfbProcessClientMessage(). */ void rfbWaitForClient(sock) int sock; { int n; fd_set fds; struct timeval tv; FD_ZERO(&fds); FD_SET(sock, &fds); tv.tv_sec = rfbMaxClientWait / 1000; tv.tv_usec = (rfbMaxClientWait % 1000) * 1000; n = select(sock+1, &fds, NULL, NULL, &tv); if (n < 0) { rfbLogPerror("rfbWaitForClient: select"); exit(1); } if (n == 0) { rfbCloseSock(sock); return; } rfbProcessClientMessage(sock); } /* * rfbConnect is called to make a connection out to a given TCP address. */ int rfbConnect(host, port) char *host; int port; { int sock; int one = 1; fprintf(stderr,"\n"); rfbLog("Making connection to client on host %s port %d\n", host,port); if ((sock = ConnectToTcpAddr(host, port)) < 0) { rfbLogPerror("connection failed"); return -1; } if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) { rfbLogPerror("fcntl failed"); close(sock); return -1; } if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { rfbLogPerror("setsockopt failed"); close(sock); return -1; } AddEnabledDevice(sock); FD_SET(sock, &allFds); maxFd = max(sock,maxFd); return sock; } /* * ReadExact reads an exact number of bytes on a TCP socket. Returns 1 if * those bytes have been read, 0 if the other end has closed, or -1 if an error * occurred (errno is set to ETIMEDOUT if it timed out). */ int ReadExact(sock, buf, len) int sock; char *buf; int len; { int n; fd_set fds; struct timeval tv; while (len > 0) { n = read(sock, buf, len); if (n > 0) { buf += n; len -= n; } else if (n == 0) { return 0; } else { if (errno != EWOULDBLOCK && errno != EAGAIN) { return n; } FD_ZERO(&fds); FD_SET(sock, &fds); tv.tv_sec = rfbMaxClientWait / 1000; tv.tv_usec = (rfbMaxClientWait % 1000) * 1000; n = select(sock+1, &fds, NULL, NULL, &tv); if (n < 0) { rfbLogPerror("ReadExact: select"); return n; } if (n == 0) { errno = ETIMEDOUT; return -1; } } } return 1; } /* * WriteExact writes an exact number of bytes on a TCP socket. Returns 1 if * those bytes have been written, or -1 if an error occurred (errno is set to * ETIMEDOUT if it timed out). */ int WriteExact(sock, buf, len) int sock; char *buf; int len; { int n; fd_set fds; struct timeval tv; int totalTimeWaited = 0; while (len > 0) { n = write(sock, buf, len); if (n > 0) { buf += n; len -= n; } else if (n == 0) { rfbLog("WriteExact: write returned 0?\n"); exit(1); } else { if (errno != EWOULDBLOCK && errno != EAGAIN) { return n; } /* Retry every 5 seconds until we exceed rfbMaxClientWait. We need to do this because select doesn't necessarily return immediately when the other end has gone away */ FD_ZERO(&fds); FD_SET(sock, &fds); tv.tv_sec = 5; tv.tv_usec = 0; n = select(sock+1, NULL, &fds, NULL, &tv); if (n < 0) { rfbLogPerror("WriteExact: select"); return n; } if (n == 0) { totalTimeWaited += 5000; if (totalTimeWaited >= rfbMaxClientWait) { errno = ETIMEDOUT; return -1; } } else { totalTimeWaited = 0; } } } return 1; } int ListenOnTCPPort(port) int port; { struct sockaddr_in addr; int sock; int one = 1; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = interface.s_addr; if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) { close(sock); return -1; } if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { close(sock); return -1; } if (listen(sock, 5) < 0) { close(sock); return -1; } return sock; } int ConnectToTcpAddr(host, port) char *host; int port; { struct hostent *hp; int sock; struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); if ((addr.sin_addr.s_addr = inet_addr(host)) == -1) { if (!(hp = gethostbyname(host))) { errno = EINVAL; return -1; } addr.sin_addr.s_addr = *(unsigned long *)hp->h_addr; } if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { return -1; } if (connect(sock, (struct sockaddr *)&addr, (sizeof(addr))) < 0) { close(sock); return -1; } return sock; } int ListenOnUDPPort(port) int port; { struct sockaddr_in addr; int sock; int one = 1; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = interface.s_addr; if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { return -1; } if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one)) < 0) { return -1; } if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { return -1; } return sock; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/corre.c0100664000076400007640000002365107231145216021370 0ustar constconst/* * corre.c * * Routines to implement Compact Rise-and-Run-length Encoding (CoRRE). This * code is based on krw's original javatel rfbserver. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" /* * rreBeforeBuf contains pixel data in the client's format. * rreAfterBuf contains the RRE encoded version. If the RRE encoded version is * larger than the raw data or if it exceeds rreAfterBufSize then * raw encoding is used instead. */ static int rreBeforeBufSize = 0; static char *rreBeforeBuf = NULL; static int rreAfterBufSize = 0; static char *rreAfterBuf = NULL; static int rreAfterBufLen; static int subrectEncode8(CARD8 *data, int w, int h); static int subrectEncode16(CARD16 *data, int w, int h); static int subrectEncode32(CARD32 *data, int w, int h); static CARD32 getBgColour(char *data, int size, int bpp); static Bool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y, int w, int h); /* * rfbSendRectEncodingCoRRE - send an arbitrary size rectangle using CoRRE * encoding. */ Bool rfbSendRectEncodingCoRRE(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { if (h > cl->correMaxHeight) { return (rfbSendRectEncodingCoRRE(cl, x, y, w, cl->correMaxHeight) && rfbSendRectEncodingCoRRE(cl, x, y + cl->correMaxHeight, w, h - cl->correMaxHeight)); } if (w > cl->correMaxWidth) { return (rfbSendRectEncodingCoRRE(cl, x, y, cl->correMaxWidth, h) && rfbSendRectEncodingCoRRE(cl, x + cl->correMaxWidth, y, w - cl->correMaxWidth, h)); } return rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h); } /* * rfbSendSmallRectEncodingCoRRE - send a small (guaranteed < 256x256) * rectangle using CoRRE encoding. */ static Bool rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; rfbRREHeader hdr; int nSubrects; int i; char *fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (rreBeforeBufSize < maxRawSize) { rreBeforeBufSize = maxRawSize; if (rreBeforeBuf == NULL) rreBeforeBuf = (char *)xalloc(rreBeforeBufSize); else rreBeforeBuf = (char *)xrealloc(rreBeforeBuf, rreBeforeBufSize); } if (rreAfterBufSize < maxRawSize) { rreAfterBufSize = maxRawSize; if (rreAfterBuf == NULL) rreAfterBuf = (char *)xalloc(rreAfterBufSize); else rreAfterBuf = (char *)xrealloc(rreAfterBuf, rreAfterBufSize); } (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, rreBeforeBuf, rfbScreen.paddedWidthInBytes, w, h); switch (cl->format.bitsPerPixel) { case 8: nSubrects = subrectEncode8((CARD8 *)rreBeforeBuf, w, h); break; case 16: nSubrects = subrectEncode16((CARD16 *)rreBeforeBuf, w, h); break; case 32: nSubrects = subrectEncode32((CARD32 *)rreBeforeBuf, w, h); break; default: rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel); exit(1); } if (nSubrects < 0) { /* RRE encoding was too large, use raw */ return rfbSendRectEncodingRaw(cl, x, y, w, h); } cl->rfbRectanglesSent[rfbEncodingCoRRE]++; cl->rfbBytesSent[rfbEncodingCoRRE] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + rreAfterBufLen); if (ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingCoRRE); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nSubrects = Swap32IfLE(nSubrects); memcpy(&updateBuf[ublen], (char *)&hdr, sz_rfbRREHeader); ublen += sz_rfbRREHeader; for (i = 0; i < rreAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - ublen; if (i + bytesToCopy > rreAfterBufLen) { bytesToCopy = rreAfterBufLen - i; } memcpy(&updateBuf[ublen], &rreAfterBuf[i], bytesToCopy); ublen += bytesToCopy; i += bytesToCopy; if (ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * subrectEncode() encodes the given multicoloured rectangle as a background * colour overwritten by single-coloured rectangles. It returns the number * of subrectangles in the encoded buffer, or -1 if subrect encoding won't * fit in the buffer. It puts the encoded rectangles in rreAfterBuf. The * single-colour rectangle partition is not optimal, but does find the biggest * horizontal or vertical rectangle top-left anchored to each consecutive * coordinate position. * * The coding scheme is simply [...] where each * is []. */ #define DEFINE_SUBRECT_ENCODE(bpp) \ static int \ subrectEncode##bpp(data,w,h) \ CARD##bpp *data; \ int w; \ int h; \ { \ CARD##bpp cl; \ rfbCoRRERectangle subrect; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp); \ \ *((CARD##bpp*)rreAfterBuf) = bg; \ \ rreAfterBufLen = (bpp/8); \ \ for (y=0; y 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \ * We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ subrect.x = thex; \ subrect.y = they; \ subrect.w = thew; \ subrect.h = theh; \ \ newLen = rreAfterBufLen + (bpp/8) + sz_rfbCoRRERectangle; \ if ((newLen > (w * h * (bpp/8))) || (newLen > rreAfterBufSize)) \ return -1; \ \ numsubs += 1; \ *((CARD##bpp*)(rreAfterBuf + rreAfterBufLen)) = cl; \ rreAfterBufLen += (bpp/8); \ memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbCoRRERectangle); \ rreAfterBufLen += sz_rfbCoRRERectangle; \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ return numsubs; \ } DEFINE_SUBRECT_ENCODE(8) DEFINE_SUBRECT_ENCODE(16) DEFINE_SUBRECT_ENCODE(32) /* * getBgColour() gets the most prevalent colour in a byte array. */ static CARD32 getBgColour(data,size,bpp) char *data; int size; int bpp; { #define NUMCLRS 256 static int counts[NUMCLRS]; int i,j,k; int maxcount = 0; CARD8 maxclr = 0; if (bpp != 8) { if (bpp == 16) { return ((CARD16 *)data)[0]; } else if (bpp == 32) { return ((CARD32 *)data)[0]; } else { rfbLog("getBgColour: bpp %d?\n",bpp); exit(1); } } for (i=0; i= NUMCLRS) { rfbLog("getBgColour: unusual colour = %d\n", k); exit(1); } counts[k] += 1; if (counts[k] > maxcount) { maxcount = counts[k]; maxclr = ((CARD8 *)data)[j]; } } return maxclr; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/sprite.h0100664000076400007640000000675707557741162021616 0ustar constconst/* * sprite.h * * software-sprite/sprite drawing - based on misprite */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ typedef struct { Bool (*RealizeCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); Bool (*UnrealizeCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/ #endif ); Bool (*PutUpCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, CursorPtr /*pCursor*/, int /*x*/, int /*y*/, unsigned long /*source*/, unsigned long /*mask*/ #endif ); Bool (*SaveUnderCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); Bool (*RestoreUnderCursor)( #if NeedNestedPrototypes ScreenPtr /*pScreen*/, int /*x*/, int /*y*/, int /*w*/, int /*h*/ #endif ); } rfbSpriteCursorFuncRec, *rfbSpriteCursorFuncPtr; extern Bool rfbSpriteInitialize( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, rfbSpriteCursorFuncPtr /*cursorFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/ #endif ); extern void rfbSpriteRestoreCursor( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern void rfbSpriteRemoveCursor( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern CursorPtr rfbSpriteGetCursorPtr( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/ #endif ); extern void rfbSpriteGetCursorPos( #if NeedFunctionPrototypes ScreenPtr /*pScreen*/, int * /*px*/, int * /*py*/ #endif ); vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/spritest.h0100664000076400007640000001025607177266423022152 0ustar constconst/* * spritest.h * * sprite structures - based on misprite */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ # include "sprite.h" /* * per screen information */ typedef struct { CloseScreenProcPtr CloseScreen; GetImageProcPtr GetImage; GetSpansProcPtr GetSpans; SourceValidateProcPtr SourceValidate; CreateGCProcPtr CreateGC; InstallColormapProcPtr InstallColormap; StoreColorsProcPtr StoreColors; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; SaveDoomedAreasProcPtr SaveDoomedAreas; RestoreAreasProcPtr RestoreAreas; DisplayCursorProcPtr DisplayCursor; CursorPtr pCursor; int x; int y; BoxRec saved; WindowPtr pCacheWin; Bool isInCacheWin; Bool checkPixels; xColorItem colors[2]; ColormapPtr pInstalledMap; ColormapPtr pColormap; VisualPtr pVisual; rfbSpriteCursorFuncPtr funcs; } rfbSpriteScreenRec, *rfbSpriteScreenPtr; #define SOURCE_COLOR 0 #define MASK_COLOR 1 typedef struct { GCFuncs *wrapFuncs; GCOps *wrapOps; } rfbSpriteGCRec, *rfbSpriteGCPtr; /* * Overlap BoxPtr and Box elements */ #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \ (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \ ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2)) /* * Overlap BoxPtr, origins, and rectangle */ #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \ BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h)) /* * Overlap BoxPtr, origins and RectPtr */ #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \ ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \ (int)((pRect)->width), (int)((pRect)->height)) /* * Overlap BoxPtr and horizontal span */ #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) #define LINE_SORT(x1,y1,x2,y2) \ { int _t; \ if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \ BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2)) vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/README0100664000076400007640000000023207235006654020766 0ustar constconst This is the directory containing the code specific to the TightVNC X server. Note that within this directory the name RFB is still used instead of VNC. vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/cursor.c0100664000076400007640000002660007557741162021605 0ustar constconst/* * cursor.c - support for cursor shape updates. */ /* * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" #include "mipointer.h" #include "sprite.h" #include "cursorstr.h" #include "servermd.h" /* Copied from Xvnc/lib/font/util/utilbitmap.c */ static unsigned char _reverse_byte[0x100] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff }; static int EncodeRichCursorData8 (char *buf, rfbPixelFormat *fmt, CursorPtr pCursor); static int EncodeRichCursorData16 (char *buf, rfbPixelFormat *fmt, CursorPtr pCursor); static int EncodeRichCursorData32 (char *buf, rfbPixelFormat *fmt, CursorPtr pCursor); /* * Send cursor shape either in X-style format or in client pixel format. */ Bool rfbSendCursorShape(cl, pScreen) rfbClientPtr cl; ScreenPtr pScreen; { CursorPtr pCursor; rfbFramebufferUpdateRectHeader rect; rfbXCursorColors colors; int saved_ublen; int bitmapRowBytes, paddedRowBytes, maskBytes, dataBytes; int i, j; CARD8 *bitmapData; CARD8 bitmapByte; if (cl->useRichCursorEncoding) { rect.encoding = Swap32IfLE(rfbEncodingRichCursor); } else { rect.encoding = Swap32IfLE(rfbEncodingXCursor); } pCursor = rfbSpriteGetCursorPtr(pScreen); /* If there is no cursor, send update with empty cursor data. */ if ( pCursor != NULL && pCursor->bits->width == 1 && pCursor->bits->height == 1 && pCursor->bits->mask[0] == 0 ) { pCursor = NULL; } if (pCursor == NULL) { if (ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = rect.r.y = 0; rect.r.w = rect.r.h = 0; memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbCursorShapeBytesSent += sz_rfbFramebufferUpdateRectHeader; cl->rfbCursorShapeUpdatesSent++; return TRUE; } /* Calculate data sizes. */ bitmapRowBytes = (pCursor->bits->width + 7) / 8; paddedRowBytes = PixmapBytePad(pCursor->bits->width, 1); maskBytes = bitmapRowBytes * pCursor->bits->height; dataBytes = (cl->useRichCursorEncoding) ? (pCursor->bits->width * pCursor->bits->height * (cl->format.bitsPerPixel / 8)) : maskBytes; /* Send buffer contents if needed. */ if ( ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } if ( ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) { return FALSE; /* FIXME. */ } saved_ublen = ublen; /* Prepare rectangle header. */ rect.r.x = Swap16IfLE(pCursor->bits->xhot); rect.r.y = Swap16IfLE(pCursor->bits->yhot); rect.r.w = Swap16IfLE(pCursor->bits->width); rect.r.h = Swap16IfLE(pCursor->bits->height); memcpy(&updateBuf[ublen], (char *)&rect,sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; /* Prepare actual cursor data (depends on encoding used). */ if (!cl->useRichCursorEncoding) { /* XCursor encoding. */ colors.foreRed = (char)(pCursor->foreRed >> 8); colors.foreGreen = (char)(pCursor->foreGreen >> 8); colors.foreBlue = (char)(pCursor->foreBlue >> 8); colors.backRed = (char)(pCursor->backRed >> 8); colors.backGreen = (char)(pCursor->backGreen >> 8); colors.backBlue = (char)(pCursor->backBlue >> 8); memcpy(&updateBuf[ublen], (char *)&colors, sz_rfbXCursorColors); ublen += sz_rfbXCursorColors; bitmapData = (CARD8 *)pCursor->bits->source; for (i = 0; i < pCursor->bits->height; i++) { for (j = 0; j < bitmapRowBytes; j++) { bitmapByte = bitmapData[i * paddedRowBytes + j]; if (screenInfo.bitmapBitOrder == LSBFirst) { bitmapByte = _reverse_byte[bitmapByte]; } updateBuf[ublen++] = (char)bitmapByte; } } } else { /* RichCursor encoding. */ switch (cl->format.bitsPerPixel) { case 8: ublen += EncodeRichCursorData8(&updateBuf[ublen], &cl->format, pCursor); break; case 16: ublen += EncodeRichCursorData16(&updateBuf[ublen], &cl->format, pCursor); break; case 32: ublen += EncodeRichCursorData32(&updateBuf[ublen], &cl->format, pCursor); break; default: return FALSE; } } /* Prepare transparency mask. */ bitmapData = (CARD8 *)pCursor->bits->mask; for (i = 0; i < pCursor->bits->height; i++) { for (j = 0; j < bitmapRowBytes; j++) { bitmapByte = bitmapData[i * paddedRowBytes + j]; if (screenInfo.bitmapBitOrder == LSBFirst) { bitmapByte = _reverse_byte[bitmapByte]; } updateBuf[ublen++] = (char)bitmapByte; } } /* Update statistics. */ cl->rfbCursorShapeBytesSent += (ublen - saved_ublen); cl->rfbCursorShapeUpdatesSent++; return TRUE; } /* * Send cursor position (PointerPos pseudo-encoding). */ Bool rfbSendCursorPos(cl, pScreen) rfbClientPtr cl; ScreenPtr pScreen; { rfbFramebufferUpdateRectHeader rect; int x, y; if (ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rfbSpriteGetCursorPos(pScreen, &x, &y); rect.encoding = Swap32IfLE(rfbEncodingPointerPos); rect.r.x = Swap16IfLE((CARD16)x); rect.r.y = Swap16IfLE((CARD16)y); rect.r.w = 0; rect.r.h = 0; memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbCursorPosBytesSent += sz_rfbFramebufferUpdateRectHeader; cl->rfbCursorPosUpdatesSent++; if (!rfbSendUpdateBuf(cl)) return FALSE; cl->cursorX = x; cl->cursorY = y; return TRUE; } /* * Code to convert cursor source bitmap to the desired pixel format. */ #define RGB48_TO_PIXEL(fmt,r,g,b) \ (((CARD32)(r) * ((fmt)->redMax + 1) >> 16) << (fmt)->redShift | \ ((CARD32)(g) * ((fmt)->greenMax + 1) >> 16) << (fmt)->greenShift | \ ((CARD32)(b) * ((fmt)->blueMax + 1) >> 16) << (fmt)->blueShift) static int EncodeRichCursorData8(buf, fmt, pCursor) char *buf; rfbPixelFormat *fmt; CursorPtr pCursor; { int widthPixels, widthBytes; int x, y, b; CARD8 *src; char pix[2]; CARD8 bitmapByte; pix[0] = (char)RGB48_TO_PIXEL(fmt, pCursor->backRed, pCursor->backGreen, pCursor->backBlue); pix[1] = (char)RGB48_TO_PIXEL(fmt, pCursor->foreRed, pCursor->foreGreen, pCursor->foreBlue); src = (CARD8 *)pCursor->bits->source; widthPixels = pCursor->bits->width; widthBytes = PixmapBytePad(widthPixels, 1); for (y = 0; y < pCursor->bits->height; y++) { for (x = 0; x < widthPixels / 8; x++) { bitmapByte = src[y * widthBytes + x]; if (screenInfo.bitmapBitOrder == LSBFirst) { bitmapByte = _reverse_byte[bitmapByte]; } for (b = 7; b >= 0; b--) { *buf++ = pix[bitmapByte >> b & 1]; } } if (widthPixels % 8) { bitmapByte = src[y * widthBytes + x]; if (screenInfo.bitmapBitOrder == LSBFirst) { bitmapByte = _reverse_byte[bitmapByte]; } for (b = 7; b > 7 - widthPixels % 8; b--) { *buf++ = pix[bitmapByte >> b & 1]; } } } return (widthPixels * pCursor->bits->height); } #define DEFINE_RICH_ENCODE(bpp) \ \ static int \ EncodeRichCursorData##bpp(buf, fmt, pCursor) \ char *buf; \ rfbPixelFormat *fmt; \ CursorPtr pCursor; \ { \ int widthPixels, widthBytes; \ int x, y, b; \ CARD8 *src; \ CARD##bpp pix[2]; \ CARD8 bitmapByte; \ \ pix[0] = (CARD##bpp)RGB48_TO_PIXEL(fmt, pCursor->backRed, \ pCursor->backGreen, \ pCursor->backBlue); \ pix[1] = (CARD##bpp)RGB48_TO_PIXEL(fmt, pCursor->foreRed, \ pCursor->foreGreen, \ pCursor->foreBlue); \ if (!rfbServerFormat.bigEndian != !fmt->bigEndian) { \ pix[0] = Swap##bpp(pix[0]); \ pix[1] = Swap##bpp(pix[1]); \ } \ \ src = (CARD8 *)pCursor->bits->source; \ widthPixels = pCursor->bits->width; \ widthBytes = PixmapBytePad(widthPixels, 1); \ \ for (y = 0; y < pCursor->bits->height; y++) { \ for (x = 0; x < widthPixels / 8; x++) { \ bitmapByte = src[y * widthBytes + x]; \ if (screenInfo.bitmapBitOrder == LSBFirst) { \ bitmapByte = _reverse_byte[bitmapByte]; \ } \ for (b = 7; b >= 0; b--) { \ memcpy (buf, (char *)&pix[bitmapByte >> b & 1], \ sizeof(CARD##bpp)); \ buf += sizeof(CARD##bpp); \ } \ } \ if (widthPixels % 8) { \ bitmapByte = src[y * widthBytes + x]; \ if (screenInfo.bitmapBitOrder == LSBFirst) { \ bitmapByte = _reverse_byte[bitmapByte]; \ } \ for (b = 7; b > 7 - widthPixels % 8; b--) { \ memcpy (buf, (char *)&pix[bitmapByte >> b & 1], \ sizeof(CARD##bpp)); \ buf += sizeof(CARD##bpp); \ } \ } \ } \ \ return (widthPixels * pCursor->bits->height * (bpp / 8)); \ } DEFINE_RICH_ENCODE(16) DEFINE_RICH_ENCODE(32) vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/rfb.h0100664000076400007640000004520010543216033021022 0ustar constconst/* * rfb.h - header file for RFB DDX implementation. */ /* * Copyright (C) 2000-2004 Const Kaplinsky. All Rights Reserved. * Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include "scrnintstr.h" #include "colormapst.h" #include "gcstruct.h" #include "osdep.h" #include #include #include #include /* It's a good idea to keep these values a bit greater than required. */ #define MAX_ENCODINGS 10 #define MAX_SECURITY_TYPES 4 #define MAX_TUNNELING_CAPS 16 #define MAX_AUTH_CAPS 16 extern char *display; /* * Per-screen (framebuffer) structure. There is only one of these, since we * don't allow the X server to have multiple screens. */ typedef struct { int width; int paddedWidthInBytes; int height; int depth; int bitsPerPixel; int sizeInBytes; char *pfbMemory; Pixel blackPixel; Pixel whitePixel; /* The following two members are used to minimise the amount of unnecessary drawing caused by cursor movement. Whenever any drawing affects the part of the screen where the cursor is, the cursor is removed first and then the drawing is done (this is what the sprite routines test for). Afterwards, however, we do not replace the cursor, even when the cursor is logically being moved across the screen. We only draw the cursor again just as we are about to send the client a framebuffer update. We need to be careful when removing and drawing the cursor because of their relationship with the normal drawing routines. The drawing routines can invoke the cursor routines, but also the cursor routines themselves end up invoking drawing routines. Removing the cursor (rfbSpriteRemoveCursor) is eventually achieved by doing a CopyArea from a pixmap to the screen, where the pixmap contains the saved contents of the screen under the cursor. Before doing this, however, we set cursorIsDrawn to FALSE. Then, when CopyArea is called, it sees that cursorIsDrawn is FALSE and so doesn't feel the need to (recursively!) remove the cursor before doing it. Putting up the cursor (rfbSpriteRestoreCursor) involves a call to PushPixels. While this is happening, cursorIsDrawn must be FALSE so that PushPixels doesn't think it has to remove the cursor first. Obviously cursorIsDrawn is set to TRUE afterwards. Another problem we face is that drawing routines sometimes cause a framebuffer update to be sent to the RFB client. When the RFB client is already waiting for a framebuffer update and some drawing to the framebuffer then happens, the drawing routine sees that the client is ready, so it calls rfbSendFramebufferUpdate. If the cursor is not drawn at this stage, it must be put up, and so rfbSpriteRestoreCursor is called. However, if the original drawing routine was actually called from within rfbSpriteRestoreCursor or rfbSpriteRemoveCursor we don't want this to happen. So both the cursor routines set dontSendFramebufferUpdate to TRUE, and all the drawing routines check this before calling rfbSendFramebufferUpdate. */ Bool cursorIsDrawn; /* TRUE if the cursor is currently drawn */ Bool dontSendFramebufferUpdate; /* TRUE while removing or drawing the cursor */ /* wrapped screen functions */ CloseScreenProcPtr CloseScreen; CreateGCProcPtr CreateGC; PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; CopyWindowProcPtr CopyWindow; ClearToBackgroundProcPtr ClearToBackground; RestoreAreasProcPtr RestoreAreas; } rfbScreenInfo, *rfbScreenInfoPtr; /* * rfbTranslateFnType is the type of translation functions. */ struct rfbClientRec; typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height); /* * Per-client structure. */ typedef struct rfbClientRec { int sock; char *host; char *login; int protocol_minor_ver; /* RFB protocol minor version in use */ Bool protocol_tightvnc; /* TightVNC protocol extensions enabled */ /* Possible client states: */ enum { RFB_PROTOCOL_VERSION, /* establishing protocol version */ RFB_SECURITY_TYPE, /* negotiating security (RFB v.3.7) */ RFB_TUNNELING_TYPE, /* establishing tunneling (RFB v.3.7t) */ RFB_AUTH_TYPE, /* negotiating authentication (RFB v.3.7t) */ RFB_AUTHENTICATION, /* authenticating (VNC authentication) */ RFB_INITIALISATION, /* sending initialisation messages */ RFB_NORMAL /* normal protocol messages */ } state; Bool viewOnly; /* Do not accept input from this client. */ Bool reverseConnection; Bool readyForSetColourMapEntries; Bool useCopyRect; int preferredEncoding; int correMaxWidth, correMaxHeight; /* The list of security types sent to this client (protocol 3.7). Note that the first entry is the number of list items following. */ CARD8 securityTypes[MAX_SECURITY_TYPES + 1]; /* Lists of capability codes sent to clients. We remember these lists to restrict clients from choosing those tunneling and authentication types that were not advertised. */ int nAuthCaps; CARD32 authCaps[MAX_AUTH_CAPS]; /* This is not useful while we don't support tunneling: int nTunnelingCaps; CARD32 tunnelingCaps[MAX_TUNNELING_CAPS]; */ /* The following member is only used during VNC authentication */ CARD8 authChallenge[CHALLENGESIZE]; /* The following members represent the update needed to get the client's framebuffer from its present state to the current state of our framebuffer. If the client does not accept CopyRect encoding then the update is simply represented as the region of the screen which has been modified (modifiedRegion). If the client does accept CopyRect encoding, then the update consists of two parts. First we have a single copy from one region of the screen to another (the destination of the copy is copyRegion), and second we have the region of the screen which has been modified in some other way (modifiedRegion). Although the copy is of a single region, this region may have many rectangles. When sending an update, the copyRegion is always sent before the modifiedRegion. This is because the modifiedRegion may overlap parts of the screen which are in the source of the copy. In fact during normal processing, the modifiedRegion may even overlap the destination copyRegion. Just before an update is sent we remove from the copyRegion anything in the modifiedRegion. */ RegionRec copyRegion; /* the destination region of the copy */ int copyDX, copyDY; /* the translation by which the copy happens */ RegionRec modifiedRegion; /* the region of the screen modified in any other way */ /* As part of the FramebufferUpdateRequest, a client can express interest in a subrectangle of the whole framebuffer. This is stored in the requestedRegion member. In the normal case this is the whole framebuffer if the client is ready, empty if it's not. */ RegionRec requestedRegion; /* The following members represent the state of the "deferred update" timer - when the framebuffer is modified and the client is ready, in most cases it is more efficient to defer sending the update by a few milliseconds so that several changes to the framebuffer can be combined into a single update. */ Bool deferredUpdateScheduled; OsTimerPtr deferredUpdateTimer; /* translateFn points to the translation function which is used to copy and translate a rectangle from the framebuffer to an output buffer. */ rfbTranslateFnType translateFn; char *translateLookupTable; rfbPixelFormat format; /* statistics */ int rfbBytesSent[MAX_ENCODINGS]; int rfbRectanglesSent[MAX_ENCODINGS]; int rfbLastRectMarkersSent; int rfbLastRectBytesSent; int rfbCursorShapeBytesSent; int rfbCursorShapeUpdatesSent; int rfbCursorPosBytesSent; int rfbCursorPosUpdatesSent; int rfbFramebufferUpdateMessagesSent; int rfbRawBytesEquivalent; int rfbKeyEventsRcvd; int rfbPointerEventsRcvd; /* zlib encoding -- necessary compression state info per client */ struct z_stream_s compStream; Bool compStreamInited; CARD32 zlibCompressLevel; /* tight encoding -- preserve zlib streams' state for each client */ z_stream zsStruct[4]; Bool zsActive[4]; int zsLevel[4]; int tightCompressLevel; int tightQualityLevel; Bool enableLastRectEncoding; /* client supports LastRect encoding */ Bool enableCursorShapeUpdates; /* client supports cursor shape updates */ Bool enableCursorPosUpdates; /* client supports PointerPos updates */ Bool useRichCursorEncoding; /* rfbEncodingRichCursor is preferred */ Bool cursorWasChanged; /* cursor shape update should be sent */ Bool cursorWasMoved; /* cursor position update should be sent */ int cursorX, cursorY; /* client's cursor position */ struct rfbClientRec *next; } rfbClientRec, *rfbClientPtr; /* * This macro is used to test whether there is a framebuffer update needing to * be sent to the client. */ #define FB_UPDATE_PENDING(cl) \ ((!(cl)->enableCursorShapeUpdates && !rfbScreen.cursorIsDrawn) || \ ((cl)->enableCursorShapeUpdates && (cl)->cursorWasChanged) || \ ((cl)->enableCursorPosUpdates && (cl)->cursorWasMoved) || \ REGION_NOTEMPTY((pScreen),&(cl)->copyRegion) || \ REGION_NOTEMPTY((pScreen),&(cl)->modifiedRegion)) /* * This macro creates an empty region (ie. a region with no areas) if it is * given a rectangle with a width or height of zero. It appears that * REGION_INTERSECT does not quite do the right thing with zero-width * rectangles, but it should with completely empty regions. */ #define SAFE_REGION_INIT(pscreen, preg, rect, size) \ { \ if ( ( (rect) ) && \ ( ( (rect)->x2 == (rect)->x1 ) || \ ( (rect)->y2 == (rect)->y1 ) ) ) { \ REGION_INIT( (pscreen), (preg), NullBox, 0 ); \ } else { \ REGION_INIT( (pscreen), (preg), (rect), (size) ); \ } \ } /* * An rfbGCRec is where we store the pointers to the original GC funcs and ops * which we wrap (NULL means not wrapped). */ typedef struct { GCFuncs *wrapFuncs; GCOps *wrapOps; } rfbGCRec, *rfbGCPtr; /* * Macros for endian swapping. */ #define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) #define Swap32(l) (((l) >> 24) | \ (((l) & 0x00ff0000) >> 8) | \ (((l) & 0x0000ff00) << 8) | \ ((l) << 24)) static const int rfbEndianTest = 1; #define Swap16IfLE(s) (*(const char *)&rfbEndianTest ? Swap16(s) : (s)) #define Swap32IfLE(l) (*(const char *)&rfbEndianTest ? Swap32(l) : (l)) /* * Macro to fill in an rfbCapabilityInfo structure (protocol 3.7t). * Normally, using macros is no good, but this macro saves us from * writing constants twice -- it constructs signature names from codes. * Note that "code_sym" argument should be a single symbol, not an expression. */ #define SetCapInfo(cap_ptr, code_sym, vendor) \ { \ rfbCapabilityInfo *pcap; \ pcap = (cap_ptr); \ pcap->code = Swap32IfLE(code_sym); \ memcpy(pcap->vendorSignature, (vendor), \ sz_rfbCapabilityInfoVendor); \ memcpy(pcap->nameSignature, sig_##code_sym, \ sz_rfbCapabilityInfoName); \ } /* init.c */ extern char *desktopName; extern char rfbThisHost[]; extern Atom VNC_LAST_CLIENT_ID; extern rfbScreenInfo rfbScreen; extern int rfbGCIndex; extern int inetdSock; extern struct in_addr interface; extern int rfbBitsPerPixel(int depth); extern void rfbLog(char *format, ...); extern void rfbLogPerror(char *str); /* sockets.c */ extern int rfbMaxClientWait; extern int udpPort; extern int udpSock; extern Bool udpSockConnected; extern int rfbPort; extern int rfbListenSock; extern void rfbInitSockets(); extern void rfbDisconnectUDPSock(); extern void rfbCloseSock(); extern void rfbCheckFds(); extern void rfbWaitForClient(int sock); extern int rfbConnect(char *host, int port); extern int ReadExact(int sock, char *buf, int len); extern int WriteExact(int sock, char *buf, int len); extern int ListenOnTCPPort(int port); extern int ListenOnUDPPort(int port); extern int ConnectToTcpAddr(char *host, int port); /* cmap.c */ extern ColormapPtr rfbInstalledColormap; extern int rfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps); extern void rfbInstallColormap(ColormapPtr pmap); extern void rfbUninstallColormap(ColormapPtr pmap); extern void rfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs); /* draw.c */ extern int rfbDeferUpdateTime; extern Bool rfbCloseScreen(int,ScreenPtr); extern Bool rfbCreateGC(GCPtr); extern void rfbPaintWindowBackground(WindowPtr, RegionPtr, int what); extern void rfbPaintWindowBorder(WindowPtr, RegionPtr, int what); extern void rfbCopyWindow(WindowPtr, DDXPointRec, RegionPtr); extern void rfbClearToBackground(WindowPtr, int x, int y, int w, int h, Bool generateExposures); extern RegionPtr rfbRestoreAreas(WindowPtr, RegionPtr); /* cutpaste.c */ extern void rfbSetXCutText(char *str, int len); extern void rfbGotXCutText(char *str, int len); /* kbdptr.c */ extern Bool compatibleKbd; extern unsigned char ptrAcceleration; extern void PtrDeviceInit(); extern void PtrDeviceOn(); extern void PtrDeviceOff(); extern void PtrDeviceControl(); extern void PtrAddEvent(int buttonMask, int x, int y, rfbClientPtr cl); extern void KbdDeviceInit(); extern void KbdDeviceOn(); extern void KbdDeviceOff(); extern void KbdAddEvent(Bool down, KeySym keySym, rfbClientPtr cl); extern void KbdReleaseAllKeys(); /* rfbserver.c */ /* * UPDATE_BUF_SIZE must be big enough to send at least one whole line of the * framebuffer. So for a max screen width of say 2K with 32-bit pixels this * means 8K minimum. */ #define UPDATE_BUF_SIZE 30000 extern char updateBuf[UPDATE_BUF_SIZE]; extern int ublen; extern rfbClientPtr rfbClientHead; extern rfbClientPtr pointerClient; extern Bool rfbAlwaysShared; extern Bool rfbNeverShared; extern Bool rfbDontDisconnect; extern Bool rfbViewOnly; /* run server in view-only mode - Ehud Karni SW */ extern void rfbNewClientConnection(int sock); extern rfbClientPtr rfbReverseConnection(char *host, int port); extern void rfbClientConnectionGone(int sock); extern void rfbProcessClientMessage(int sock); extern void rfbNewUDPConnection(int sock); extern void rfbProcessUDPInput(int sock); extern Bool rfbSendFramebufferUpdate(rfbClientPtr cl); extern Bool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h); extern Bool rfbSendUpdateBuf(rfbClientPtr cl); extern Bool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours); extern void rfbSendBell(); extern void rfbSendServerCutText(char *str, int len); /* translate.c */ extern Bool rfbEconomicTranslate; extern rfbPixelFormat rfbServerFormat; extern void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height); extern Bool rfbSetTranslateFunction(rfbClientPtr cl); extern void rfbSetClientColourMaps(int firstColour, int nColours); extern Bool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours); /* httpd.c */ extern int httpPort; extern char *httpDir; extern void httpInitSockets(); extern void httpCheckFds(); /* auth.c */ extern char *rfbAuthPasswdFile; extern void rfbAuthNewClient(rfbClientPtr cl); extern void rfbProcessClientSecurityType(rfbClientPtr cl); extern void rfbProcessClientTunnelingType(rfbClientPtr cl); extern void rfbProcessClientAuthType(rfbClientPtr cl); extern void rfbVncAuthProcessResponse(rfbClientPtr cl); extern void rfbClientConnFailed(rfbClientPtr cl, char *reason); extern void rfbClientAuthFailed(rfbClientPtr cl, char *reason); extern void rfbClientAuthSucceeded(rfbClientPtr cl, CARD32 authType); /* Functions to prevent too many successive authentication failures */ extern Bool rfbAuthConsiderBlocking(void); extern void rfbAuthUnblock(void); extern Bool rfbAuthIsBlocked(void); /* rre.c */ extern Bool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h); /* corre.c */ extern Bool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h); /* hextile.c */ extern Bool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, int h); /* zlib.c */ /* Minimum zlib rectangle size in bytes. Anything smaller will * not compress well due to overhead. */ #define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17) /* Set maximum zlib rectangle size in pixels. Always allow at least * two scan lines. */ #define ZLIB_MAX_RECT_SIZE (128*256) #define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \ ( min * 2 ) : ZLIB_MAX_RECT_SIZE ) extern Bool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, int h); /* tight.c */ #define TIGHT_DEFAULT_COMPRESSION 6 extern Bool rfbTightDisableGradient; extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); extern Bool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h); /* cursor.c */ extern Bool rfbSendCursorShape(rfbClientPtr cl, ScreenPtr pScreen); extern Bool rfbSendCursorPos(rfbClientPtr cl, ScreenPtr pScreen); /* stats.c */ extern void rfbResetStats(rfbClientPtr cl); extern void rfbPrintStats(rfbClientPtr cl); vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/tight.c0100664000076400007640000020427507537325217021412 0ustar constconst/* * tight.c * * Routines to implement Tight Encoding */ /* * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" #include /* Note: The following constant should not be changed. */ #define TIGHT_MIN_TO_COMPRESS 12 /* The parameters below may be adjusted. */ #define MIN_SPLIT_RECT_SIZE 4096 #define MIN_SOLID_SUBRECT_SIZE 2048 #define MAX_SPLIT_TILE_SIZE 16 /* May be set to TRUE with "-lazytight" Xvnc option. */ Bool rfbTightDisableGradient = FALSE; /* This variable is set on every rfbSendRectEncodingTight() call. */ static Bool usePixelFormat24; /* Compression level stuff. The following array contains various encoder parameters for each of 10 compression levels (0..9). Last three parameters correspond to JPEG quality levels (0..9). */ typedef struct TIGHT_CONF_s { int maxRectSize, maxRectWidth; int monoMinRectSize, gradientMinRectSize; int idxZlibLevel, monoZlibLevel, rawZlibLevel, gradientZlibLevel; int gradientThreshold, gradientThreshold24; int idxMaxColorsDivisor; int jpegQuality, jpegThreshold, jpegThreshold24; } TIGHT_CONF; static TIGHT_CONF tightConf[10] = { { 512, 32, 6, 65536, 0, 0, 0, 0, 0, 0, 4, 5, 10000, 23000 }, { 2048, 128, 6, 65536, 1, 1, 1, 0, 0, 0, 8, 10, 8000, 18000 }, { 6144, 256, 8, 65536, 3, 3, 2, 0, 0, 0, 24, 15, 6500, 15000 }, { 10240, 1024, 12, 65536, 5, 5, 3, 0, 0, 0, 32, 25, 5000, 12000 }, { 16384, 2048, 12, 65536, 6, 6, 4, 0, 0, 0, 32, 37, 4000, 10000 }, { 32768, 2048, 12, 4096, 7, 7, 5, 4, 150, 380, 32, 50, 3000, 8000 }, { 65536, 2048, 16, 4096, 7, 7, 6, 4, 170, 420, 48, 60, 2000, 5000 }, { 65536, 2048, 16, 4096, 8, 8, 7, 5, 180, 450, 64, 70, 1000, 2500 }, { 65536, 2048, 32, 8192, 9, 9, 8, 6, 190, 475, 64, 75, 500, 1200 }, { 65536, 2048, 32, 8192, 9, 9, 9, 6, 200, 500, 96, 80, 200, 500 } }; static int compressLevel; static int qualityLevel; /* Stuff dealing with palettes. */ typedef struct COLOR_LIST_s { struct COLOR_LIST_s *next; int idx; CARD32 rgb; } COLOR_LIST; typedef struct PALETTE_ENTRY_s { COLOR_LIST *listNode; int numPixels; } PALETTE_ENTRY; typedef struct PALETTE_s { PALETTE_ENTRY entry[256]; COLOR_LIST *hash[256]; COLOR_LIST list[256]; } PALETTE; static int paletteNumColors, paletteMaxColors; static CARD32 monoBackground, monoForeground; static PALETTE palette; /* Pointers to dynamically-allocated buffers. */ static int tightBeforeBufSize = 0; static char *tightBeforeBuf = NULL; static int tightAfterBufSize = 0; static char *tightAfterBuf = NULL; static int *prevRowBuf = NULL; /* Prototypes for static functions. */ static void FindBestSolidArea (int x, int y, int w, int h, CARD32 colorValue, int *w_ptr, int *h_ptr); static void ExtendSolidArea (int x, int y, int w, int h, CARD32 colorValue, int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr); static Bool CheckSolidTile (int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile8 (int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile16 (int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool CheckSolidTile32 (int x, int y, int w, int h, CARD32 *colorPtr, Bool needSameColor); static Bool SendRectSimple (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendSubrect (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendTightHeader (rfbClientPtr cl, int x, int y, int w, int h); static Bool SendSolidRect (rfbClientPtr cl); static Bool SendMonoRect (rfbClientPtr cl, int w, int h); static Bool SendIndexedRect (rfbClientPtr cl, int w, int h); static Bool SendFullColorRect (rfbClientPtr cl, int w, int h); static Bool SendGradientRect (rfbClientPtr cl, int w, int h); static Bool CompressData(rfbClientPtr cl, int streamId, int dataLen, int zlibLevel, int zlibStrategy); static Bool SendCompressedData(rfbClientPtr cl, int compressedLen); static void FillPalette8(int count); static void FillPalette16(int count); static void FillPalette32(int count); static void PaletteReset(void); static int PaletteInsert(CARD32 rgb, int numPixels, int bpp); static void Pack24(char *buf, rfbPixelFormat *fmt, int count); static void EncodeIndexedRect16(CARD8 *buf, int count); static void EncodeIndexedRect32(CARD8 *buf, int count); static void EncodeMonoRect8(CARD8 *buf, int w, int h); static void EncodeMonoRect16(CARD8 *buf, int w, int h); static void EncodeMonoRect32(CARD8 *buf, int w, int h); static void FilterGradient24(char *buf, rfbPixelFormat *fmt, int w, int h); static void FilterGradient16(CARD16 *buf, rfbPixelFormat *fmt, int w, int h); static void FilterGradient32(CARD32 *buf, rfbPixelFormat *fmt, int w, int h); static int DetectSmoothImage(rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage24(rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage16(rfbPixelFormat *fmt, int w, int h); static unsigned long DetectSmoothImage32(rfbPixelFormat *fmt, int w, int h); static Bool SendJpegRect(rfbClientPtr cl, int x, int y, int w, int h, int quality); static void PrepareRowForJpeg(CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg24(CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg16(CARD8 *dst, int x, int y, int count); static void PrepareRowForJpeg32(CARD8 *dst, int x, int y, int count); static void JpegInitDestination(j_compress_ptr cinfo); static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo); static void JpegTermDestination(j_compress_ptr cinfo); static void JpegSetDstManager(j_compress_ptr cinfo); /* * Tight encoding implementation. */ int rfbNumCodedRectsTight(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { int maxRectSize, maxRectWidth; int subrectMaxWidth, subrectMaxHeight; /* No matter how many rectangles we will send if LastRect markers are used to terminate rectangle stream. */ if (cl->enableLastRectEncoding && w * h >= MIN_SPLIT_RECT_SIZE) return 0; maxRectSize = tightConf[cl->tightCompressLevel].maxRectSize; maxRectWidth = tightConf[cl->tightCompressLevel].maxRectWidth; if (w > maxRectWidth || w * h > maxRectSize) { subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; subrectMaxHeight = maxRectSize / subrectMaxWidth; return (((w - 1) / maxRectWidth + 1) * ((h - 1) / subrectMaxHeight + 1)); } else { return 1; } } Bool rfbSendRectEncodingTight(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { int nMaxRows; CARD32 colorValue; int dx, dy, dw, dh; int x_best, y_best, w_best, h_best; char *fbptr; compressLevel = cl->tightCompressLevel; qualityLevel = cl->tightQualityLevel; if ( cl->format.depth == 24 && cl->format.redMax == 0xFF && cl->format.greenMax == 0xFF && cl->format.blueMax == 0xFF ) { usePixelFormat24 = TRUE; } else { usePixelFormat24 = FALSE; } if (!cl->enableLastRectEncoding || w * h < MIN_SPLIT_RECT_SIZE) return SendRectSimple(cl, x, y, w, h); /* Make sure we can write at least one pixel into tightBeforeBuf. */ if (tightBeforeBufSize < 4) { tightBeforeBufSize = 4; if (tightBeforeBuf == NULL) tightBeforeBuf = (char *)xalloc(tightBeforeBufSize); else tightBeforeBuf = (char *)xrealloc(tightBeforeBuf, tightBeforeBufSize); } /* Calculate maximum number of rows in one non-solid rectangle. */ { int maxRectSize, maxRectWidth, nMaxWidth; maxRectSize = tightConf[compressLevel].maxRectSize; maxRectWidth = tightConf[compressLevel].maxRectWidth; nMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; nMaxRows = maxRectSize / nMaxWidth; } /* Try to find large solid-color areas and send them separately. */ for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) { /* If a rectangle becomes too large, send its upper part now. */ if (dy - y >= nMaxRows) { if (!SendRectSimple(cl, x, y, w, nMaxRows)) return 0; y += nMaxRows; h -= nMaxRows; } dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ? MAX_SPLIT_TILE_SIZE : (y + h - dy); for (dx = x; dx < x + w; dx += MAX_SPLIT_TILE_SIZE) { dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w) ? MAX_SPLIT_TILE_SIZE : (x + w - dx); if (CheckSolidTile(dx, dy, dw, dh, &colorValue, FALSE)) { /* Get dimensions of solid-color area. */ FindBestSolidArea(dx, dy, w - (dx - x), h - (dy - y), colorValue, &w_best, &h_best); /* Make sure a solid rectangle is large enough (or the whole rectangle is of the same color). */ if ( w_best * h_best != w * h && w_best * h_best < MIN_SOLID_SUBRECT_SIZE ) continue; /* Try to extend solid rectangle to maximum size. */ x_best = dx; y_best = dy; ExtendSolidArea(x, y, w, h, colorValue, &x_best, &y_best, &w_best, &h_best); /* Send rectangles at top and left to solid-color area. */ if ( y_best != y && !SendRectSimple(cl, x, y, w, y_best-y) ) return FALSE; if ( x_best != x && !rfbSendRectEncodingTight(cl, x, y_best, x_best-x, h_best) ) return FALSE; /* Send solid-color rectangle. */ if (!SendTightHeader(cl, x_best, y_best, w_best, h_best)) return FALSE; fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y_best) + (x_best * (rfbScreen.bitsPerPixel / 8))); (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, tightBeforeBuf, rfbScreen.paddedWidthInBytes, 1, 1); if (!SendSolidRect(cl)) return FALSE; /* Send remaining rectangles (at right and bottom). */ if ( x_best + w_best != x + w && !rfbSendRectEncodingTight(cl, x_best+w_best, y_best, w-(x_best-x)-w_best, h_best) ) return FALSE; if ( y_best + h_best != y + h && !rfbSendRectEncodingTight(cl, x, y_best+h_best, w, h-(y_best-y)-h_best) ) return FALSE; /* Return after all recursive calls are done. */ return TRUE; } } } /* No suitable solid-color rectangles found. */ return SendRectSimple(cl, x, y, w, h); } static void FindBestSolidArea(x, y, w, h, colorValue, w_ptr, h_ptr) int x, y, w, h; CARD32 colorValue; int *w_ptr, *h_ptr; { int dx, dy, dw, dh; int w_prev; int w_best = 0, h_best = 0; w_prev = w; for (dy = y; dy < y + h; dy += MAX_SPLIT_TILE_SIZE) { dh = (dy + MAX_SPLIT_TILE_SIZE <= y + h) ? MAX_SPLIT_TILE_SIZE : (y + h - dy); dw = (w_prev > MAX_SPLIT_TILE_SIZE) ? MAX_SPLIT_TILE_SIZE : w_prev; if (!CheckSolidTile(x, dy, dw, dh, &colorValue, TRUE)) break; for (dx = x + dw; dx < x + w_prev;) { dw = (dx + MAX_SPLIT_TILE_SIZE <= x + w_prev) ? MAX_SPLIT_TILE_SIZE : (x + w_prev - dx); if (!CheckSolidTile(dx, dy, dw, dh, &colorValue, TRUE)) break; dx += dw; } w_prev = dx - x; if (w_prev * (dy + dh - y) > w_best * h_best) { w_best = w_prev; h_best = dy + dh - y; } } *w_ptr = w_best; *h_ptr = h_best; } static void ExtendSolidArea(x, y, w, h, colorValue, x_ptr, y_ptr, w_ptr, h_ptr) int x, y, w, h; CARD32 colorValue; int *x_ptr, *y_ptr, *w_ptr, *h_ptr; { int cx, cy; /* Try to extend the area upwards. */ for ( cy = *y_ptr - 1; cy >= y && CheckSolidTile(*x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy-- ); *h_ptr += *y_ptr - (cy + 1); *y_ptr = cy + 1; /* ... downwards. */ for ( cy = *y_ptr + *h_ptr; cy < y + h && CheckSolidTile(*x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy++ ); *h_ptr += cy - (*y_ptr + *h_ptr); /* ... to the left. */ for ( cx = *x_ptr - 1; cx >= x && CheckSolidTile(cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx-- ); *w_ptr += *x_ptr - (cx + 1); *x_ptr = cx + 1; /* ... to the right. */ for ( cx = *x_ptr + *w_ptr; cx < x + w && CheckSolidTile(cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx++ ); *w_ptr += cx - (*x_ptr + *w_ptr); } /* * Check if a rectangle is all of the same color. If needSameColor is * set to non-zero, then also check that its color equals to the * *colorPtr value. The result is 1 if the test is successfull, and in * that case new color will be stored in *colorPtr. */ static Bool CheckSolidTile(x, y, w, h, colorPtr, needSameColor) int x, y, w, h; CARD32 *colorPtr; Bool needSameColor; { switch(rfbServerFormat.bitsPerPixel) { case 32: return CheckSolidTile32(x, y, w, h, colorPtr, needSameColor); case 16: return CheckSolidTile16(x, y, w, h, colorPtr, needSameColor); default: return CheckSolidTile8(x, y, w, h, colorPtr, needSameColor); } } #define DEFINE_CHECK_SOLID_FUNCTION(bpp) \ \ static Bool \ CheckSolidTile##bpp(x, y, w, h, colorPtr, needSameColor) \ int x, y; \ CARD32 *colorPtr; \ Bool needSameColor; \ { \ CARD##bpp *fbptr; \ CARD##bpp colorValue; \ int dx, dy; \ \ fbptr = (CARD##bpp *) \ &rfbScreen.pfbMemory[y * rfbScreen.paddedWidthInBytes + x * (bpp/8)]; \ \ colorValue = *fbptr; \ if (needSameColor && (CARD32)colorValue != *colorPtr) \ return FALSE; \ \ for (dy = 0; dy < h; dy++) { \ for (dx = 0; dx < w; dx++) { \ if (colorValue != fbptr[dx]) \ return FALSE; \ } \ fbptr = (CARD##bpp *)((CARD8 *)fbptr + rfbScreen.paddedWidthInBytes); \ } \ \ *colorPtr = (CARD32)colorValue; \ return TRUE; \ } DEFINE_CHECK_SOLID_FUNCTION(8) DEFINE_CHECK_SOLID_FUNCTION(16) DEFINE_CHECK_SOLID_FUNCTION(32) static Bool SendRectSimple(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { int maxBeforeSize, maxAfterSize; int maxRectSize, maxRectWidth; int subrectMaxWidth, subrectMaxHeight; int dx, dy; int rw, rh; maxRectSize = tightConf[compressLevel].maxRectSize; maxRectWidth = tightConf[compressLevel].maxRectWidth; maxBeforeSize = maxRectSize * (cl->format.bitsPerPixel / 8); maxAfterSize = maxBeforeSize + (maxBeforeSize + 99) / 100 + 12; if (tightBeforeBufSize < maxBeforeSize) { tightBeforeBufSize = maxBeforeSize; if (tightBeforeBuf == NULL) tightBeforeBuf = (char *)xalloc(tightBeforeBufSize); else tightBeforeBuf = (char *)xrealloc(tightBeforeBuf, tightBeforeBufSize); } if (tightAfterBufSize < maxAfterSize) { tightAfterBufSize = maxAfterSize; if (tightAfterBuf == NULL) tightAfterBuf = (char *)xalloc(tightAfterBufSize); else tightAfterBuf = (char *)xrealloc(tightAfterBuf, tightAfterBufSize); } if (w > maxRectWidth || w * h > maxRectSize) { subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w; subrectMaxHeight = maxRectSize / subrectMaxWidth; for (dy = 0; dy < h; dy += subrectMaxHeight) { for (dx = 0; dx < w; dx += maxRectWidth) { rw = (dx + maxRectWidth < w) ? maxRectWidth : w - dx; rh = (dy + subrectMaxHeight < h) ? subrectMaxHeight : h - dy; if (!SendSubrect(cl, x+dx, y+dy, rw, rh)) return FALSE; } } } else { if (!SendSubrect(cl, x, y, w, h)) return FALSE; } return TRUE; } static Bool SendSubrect(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { char *fbptr; Bool success = FALSE; /* Send pending data if there is more than 128 bytes. */ if (ublen > 128) { if (!rfbSendUpdateBuf(cl)) return FALSE; } if (!SendTightHeader(cl, x, y, w, h)) return FALSE; fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, tightBeforeBuf, rfbScreen.paddedWidthInBytes, w, h); paletteMaxColors = w * h / tightConf[compressLevel].idxMaxColorsDivisor; if ( paletteMaxColors < 2 && w * h >= tightConf[compressLevel].monoMinRectSize ) { paletteMaxColors = 2; } switch (cl->format.bitsPerPixel) { case 8: FillPalette8(w * h); break; case 16: FillPalette16(w * h); break; default: FillPalette32(w * h); } switch (paletteNumColors) { case 0: /* Truecolor image */ if (DetectSmoothImage(&cl->format, w, h)) { if (qualityLevel != -1) { success = SendJpegRect(cl, x, y, w, h, tightConf[qualityLevel].jpegQuality); } else { success = SendGradientRect(cl, w, h); } } else { success = SendFullColorRect(cl, w, h); } break; case 1: /* Solid rectangle */ success = SendSolidRect(cl); break; case 2: /* Two-color rectangle */ success = SendMonoRect(cl, w, h); break; default: /* Up to 256 different colors */ if ( paletteNumColors > 96 && qualityLevel != -1 && qualityLevel <= 3 && DetectSmoothImage(&cl->format, w, h) ) { success = SendJpegRect(cl, x, y, w, h, tightConf[qualityLevel].jpegQuality); } else { success = SendIndexedRect(cl, w, h); } } return success; } static Bool SendTightHeader(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; if (ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingTight); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; cl->rfbRectanglesSent[rfbEncodingTight]++; cl->rfbBytesSent[rfbEncodingTight] += sz_rfbFramebufferUpdateRectHeader; return TRUE; } /* * Subencoding implementations. */ static Bool SendSolidRect(cl) rfbClientPtr cl; { int len; if (usePixelFormat24) { Pack24(tightBeforeBuf, &cl->format, 1); len = 3; } else len = cl->format.bitsPerPixel / 8; if (ublen + 1 + len > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } updateBuf[ublen++] = (char)(rfbTightFill << 4); memcpy (&updateBuf[ublen], tightBeforeBuf, len); ublen += len; cl->rfbBytesSent[rfbEncodingTight] += len + 1; return TRUE; } static Bool SendMonoRect(cl, w, h) rfbClientPtr cl; int w, h; { int streamId = 1; int paletteLen, dataLen; if ( (ublen + TIGHT_MIN_TO_COMPRESS + 6 + 2 * cl->format.bitsPerPixel / 8) > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } /* Prepare tight encoding header. */ dataLen = (w + 7) / 8; dataLen *= h; updateBuf[ublen++] = (streamId | rfbTightExplicitFilter) << 4; updateBuf[ublen++] = rfbTightFilterPalette; updateBuf[ublen++] = 1; /* Prepare palette, convert image. */ switch (cl->format.bitsPerPixel) { case 32: EncodeMonoRect32((CARD8 *)tightBeforeBuf, w, h); ((CARD32 *)tightAfterBuf)[0] = monoBackground; ((CARD32 *)tightAfterBuf)[1] = monoForeground; if (usePixelFormat24) { Pack24(tightAfterBuf, &cl->format, 2); paletteLen = 6; } else paletteLen = 8; memcpy(&updateBuf[ublen], tightAfterBuf, paletteLen); ublen += paletteLen; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteLen; break; case 16: EncodeMonoRect16((CARD8 *)tightBeforeBuf, w, h); ((CARD16 *)tightAfterBuf)[0] = (CARD16)monoBackground; ((CARD16 *)tightAfterBuf)[1] = (CARD16)monoForeground; memcpy(&updateBuf[ublen], tightAfterBuf, 4); ublen += 4; cl->rfbBytesSent[rfbEncodingTight] += 7; break; default: EncodeMonoRect8((CARD8 *)tightBeforeBuf, w, h); updateBuf[ublen++] = (char)monoBackground; updateBuf[ublen++] = (char)monoForeground; cl->rfbBytesSent[rfbEncodingTight] += 5; } return CompressData(cl, streamId, dataLen, tightConf[compressLevel].monoZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendIndexedRect(cl, w, h) rfbClientPtr cl; int w, h; { int streamId = 2; int i, entryLen; if ( (ublen + TIGHT_MIN_TO_COMPRESS + 6 + paletteNumColors * cl->format.bitsPerPixel / 8) > UPDATE_BUF_SIZE ) { if (!rfbSendUpdateBuf(cl)) return FALSE; } /* Prepare tight encoding header. */ updateBuf[ublen++] = (streamId | rfbTightExplicitFilter) << 4; updateBuf[ublen++] = rfbTightFilterPalette; updateBuf[ublen++] = (char)(paletteNumColors - 1); /* Prepare palette, convert image. */ switch (cl->format.bitsPerPixel) { case 32: EncodeIndexedRect32((CARD8 *)tightBeforeBuf, w * h); for (i = 0; i < paletteNumColors; i++) { ((CARD32 *)tightAfterBuf)[i] = palette.entry[i].listNode->rgb; } if (usePixelFormat24) { Pack24(tightAfterBuf, &cl->format, paletteNumColors); entryLen = 3; } else entryLen = 4; memcpy(&updateBuf[ublen], tightAfterBuf, paletteNumColors * entryLen); ublen += paletteNumColors * entryLen; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteNumColors * entryLen; break; case 16: EncodeIndexedRect16((CARD8 *)tightBeforeBuf, w * h); for (i = 0; i < paletteNumColors; i++) { ((CARD16 *)tightAfterBuf)[i] = (CARD16)palette.entry[i].listNode->rgb; } memcpy(&updateBuf[ublen], tightAfterBuf, paletteNumColors * 2); ublen += paletteNumColors * 2; cl->rfbBytesSent[rfbEncodingTight] += 3 + paletteNumColors * 2; break; default: return FALSE; /* Should never happen. */ } return CompressData(cl, streamId, w * h, tightConf[compressLevel].idxZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendFullColorRect(cl, w, h) rfbClientPtr cl; int w, h; { int streamId = 0; int len; if (ublen + TIGHT_MIN_TO_COMPRESS + 1 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } updateBuf[ublen++] = 0x00; /* stream id = 0, no flushing, no filter */ cl->rfbBytesSent[rfbEncodingTight]++; if (usePixelFormat24) { Pack24(tightBeforeBuf, &cl->format, w * h); len = 3; } else len = cl->format.bitsPerPixel / 8; return CompressData(cl, streamId, w * h * len, tightConf[compressLevel].rawZlibLevel, Z_DEFAULT_STRATEGY); } static Bool SendGradientRect(cl, w, h) rfbClientPtr cl; int w, h; { int streamId = 3; int len; if (cl->format.bitsPerPixel == 8) return SendFullColorRect(cl, w, h); if (ublen + TIGHT_MIN_TO_COMPRESS + 2 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } if (prevRowBuf == NULL) prevRowBuf = (int *)xalloc(2048 * 3 * sizeof(int)); updateBuf[ublen++] = (streamId | rfbTightExplicitFilter) << 4; updateBuf[ublen++] = rfbTightFilterGradient; cl->rfbBytesSent[rfbEncodingTight] += 2; if (usePixelFormat24) { FilterGradient24(tightBeforeBuf, &cl->format, w, h); len = 3; } else if (cl->format.bitsPerPixel == 32) { FilterGradient32((CARD32 *)tightBeforeBuf, &cl->format, w, h); len = 4; } else { FilterGradient16((CARD16 *)tightBeforeBuf, &cl->format, w, h); len = 2; } return CompressData(cl, streamId, w * h * len, tightConf[compressLevel].gradientZlibLevel, Z_FILTERED); } static Bool CompressData(cl, streamId, dataLen, zlibLevel, zlibStrategy) rfbClientPtr cl; int streamId, dataLen, zlibLevel, zlibStrategy; { z_streamp pz; int err; if (dataLen < TIGHT_MIN_TO_COMPRESS) { memcpy(&updateBuf[ublen], tightBeforeBuf, dataLen); ublen += dataLen; cl->rfbBytesSent[rfbEncodingTight] += dataLen; return TRUE; } pz = &cl->zsStruct[streamId]; /* Initialize compression stream if needed. */ if (!cl->zsActive[streamId]) { pz->zalloc = Z_NULL; pz->zfree = Z_NULL; pz->opaque = Z_NULL; err = deflateInit2 (pz, zlibLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, zlibStrategy); if (err != Z_OK) return FALSE; cl->zsActive[streamId] = TRUE; cl->zsLevel[streamId] = zlibLevel; } /* Prepare buffer pointers. */ pz->next_in = (Bytef *)tightBeforeBuf; pz->avail_in = dataLen; pz->next_out = (Bytef *)tightAfterBuf; pz->avail_out = tightAfterBufSize; /* Change compression parameters if needed. */ if (zlibLevel != cl->zsLevel[streamId]) { if (deflateParams (pz, zlibLevel, zlibStrategy) != Z_OK) { return FALSE; } cl->zsLevel[streamId] = zlibLevel; } /* Actual compression. */ if ( deflate (pz, Z_SYNC_FLUSH) != Z_OK || pz->avail_in != 0 || pz->avail_out == 0 ) { return FALSE; } return SendCompressedData(cl, tightAfterBufSize - pz->avail_out); } static Bool SendCompressedData(cl, compressedLen) rfbClientPtr cl; int compressedLen; { int i, portionLen; updateBuf[ublen++] = compressedLen & 0x7F; cl->rfbBytesSent[rfbEncodingTight]++; if (compressedLen > 0x7F) { updateBuf[ublen-1] |= 0x80; updateBuf[ublen++] = compressedLen >> 7 & 0x7F; cl->rfbBytesSent[rfbEncodingTight]++; if (compressedLen > 0x3FFF) { updateBuf[ublen-1] |= 0x80; updateBuf[ublen++] = compressedLen >> 14 & 0xFF; cl->rfbBytesSent[rfbEncodingTight]++; } } portionLen = UPDATE_BUF_SIZE; for (i = 0; i < compressedLen; i += portionLen) { if (i + portionLen > compressedLen) { portionLen = compressedLen - i; } if (ublen + portionLen > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } memcpy(&updateBuf[ublen], &tightAfterBuf[i], portionLen); ublen += portionLen; } cl->rfbBytesSent[rfbEncodingTight] += compressedLen; return TRUE; } /* * Code to determine how many different colors used in rectangle. */ static void FillPalette8(count) int count; { CARD8 *data = (CARD8 *)tightBeforeBuf; CARD8 c0, c1; int i, n0, n1; paletteNumColors = 0; c0 = data[0]; for (i = 1; i < count && data[i] == c0; i++); if (i == count) { paletteNumColors = 1; return; /* Solid rectangle */ } if (paletteMaxColors < 2) return; n0 = i; c1 = data[i]; n1 = 0; for (i++; i < count; i++) { if (data[i] == c0) { n0++; } else if (data[i] == c1) { n1++; } else break; } if (i == count) { if (n0 > n1) { monoBackground = (CARD32)c0; monoForeground = (CARD32)c1; } else { monoBackground = (CARD32)c1; monoForeground = (CARD32)c0; } paletteNumColors = 2; /* Two colors */ } } #define DEFINE_FILL_PALETTE_FUNCTION(bpp) \ \ static void \ FillPalette##bpp(count) \ int count; \ { \ CARD##bpp *data = (CARD##bpp *)tightBeforeBuf; \ CARD##bpp c0, c1, ci; \ int i, n0, n1, ni; \ \ c0 = data[0]; \ for (i = 1; i < count && data[i] == c0; i++); \ if (i >= count) { \ paletteNumColors = 1; /* Solid rectangle */ \ return; \ } \ \ if (paletteMaxColors < 2) { \ paletteNumColors = 0; /* Full-color encoding preferred */ \ return; \ } \ \ n0 = i; \ c1 = data[i]; \ n1 = 0; \ for (i++; i < count; i++) { \ ci = data[i]; \ if (ci == c0) { \ n0++; \ } else if (ci == c1) { \ n1++; \ } else \ break; \ } \ if (i >= count) { \ if (n0 > n1) { \ monoBackground = (CARD32)c0; \ monoForeground = (CARD32)c1; \ } else { \ monoBackground = (CARD32)c1; \ monoForeground = (CARD32)c0; \ } \ paletteNumColors = 2; /* Two colors */ \ return; \ } \ \ PaletteReset(); \ PaletteInsert (c0, (CARD32)n0, bpp); \ PaletteInsert (c1, (CARD32)n1, bpp); \ \ ni = 1; \ for (i++; i < count; i++) { \ if (data[i] == ci) { \ ni++; \ } else { \ if (!PaletteInsert (ci, (CARD32)ni, bpp)) \ return; \ ci = data[i]; \ ni = 1; \ } \ } \ PaletteInsert (ci, (CARD32)ni, bpp); \ } DEFINE_FILL_PALETTE_FUNCTION(16) DEFINE_FILL_PALETTE_FUNCTION(32) /* * Functions to operate with palette structures. */ #define HASH_FUNC16(rgb) ((int)((((rgb) >> 8) + (rgb)) & 0xFF)) #define HASH_FUNC32(rgb) ((int)((((rgb) >> 16) + ((rgb) >> 8)) & 0xFF)) static void PaletteReset(void) { paletteNumColors = 0; memset(palette.hash, 0, 256 * sizeof(COLOR_LIST *)); } static int PaletteInsert(rgb, numPixels, bpp) CARD32 rgb; int numPixels; int bpp; { COLOR_LIST *pnode; COLOR_LIST *prev_pnode = NULL; int hash_key, idx, new_idx, count; hash_key = (bpp == 16) ? HASH_FUNC16(rgb) : HASH_FUNC32(rgb); pnode = palette.hash[hash_key]; while (pnode != NULL) { if (pnode->rgb == rgb) { /* Such palette entry already exists. */ new_idx = idx = pnode->idx; count = palette.entry[idx].numPixels + numPixels; if (new_idx && palette.entry[new_idx-1].numPixels < count) { do { palette.entry[new_idx] = palette.entry[new_idx-1]; palette.entry[new_idx].listNode->idx = new_idx; new_idx--; } while (new_idx && palette.entry[new_idx-1].numPixels < count); palette.entry[new_idx].listNode = pnode; pnode->idx = new_idx; } palette.entry[new_idx].numPixels = count; return paletteNumColors; } prev_pnode = pnode; pnode = pnode->next; } /* Check if palette is full. */ if (paletteNumColors == 256 || paletteNumColors == paletteMaxColors) { paletteNumColors = 0; return 0; } /* Move palette entries with lesser pixel counts. */ for ( idx = paletteNumColors; idx > 0 && palette.entry[idx-1].numPixels < numPixels; idx-- ) { palette.entry[idx] = palette.entry[idx-1]; palette.entry[idx].listNode->idx = idx; } /* Add new palette entry into the freed slot. */ pnode = &palette.list[paletteNumColors]; if (prev_pnode != NULL) { prev_pnode->next = pnode; } else { palette.hash[hash_key] = pnode; } pnode->next = NULL; pnode->idx = idx; pnode->rgb = rgb; palette.entry[idx].listNode = pnode; palette.entry[idx].numPixels = numPixels; return (++paletteNumColors); } /* * Converting 32-bit color samples into 24-bit colors. * Should be called only when redMax, greenMax and blueMax are 255. * Color components assumed to be byte-aligned. */ static void Pack24(buf, fmt, count) char *buf; rfbPixelFormat *fmt; int count; { CARD32 *buf32; CARD32 pix; int r_shift, g_shift, b_shift; buf32 = (CARD32 *)buf; if (!rfbServerFormat.bigEndian == !fmt->bigEndian) { r_shift = fmt->redShift; g_shift = fmt->greenShift; b_shift = fmt->blueShift; } else { r_shift = 24 - fmt->redShift; g_shift = 24 - fmt->greenShift; b_shift = 24 - fmt->blueShift; } while (count--) { pix = *buf32++; *buf++ = (char)(pix >> r_shift); *buf++ = (char)(pix >> g_shift); *buf++ = (char)(pix >> b_shift); } } /* * Converting truecolor samples into palette indices. */ #define DEFINE_IDX_ENCODE_FUNCTION(bpp) \ \ static void \ EncodeIndexedRect##bpp(buf, count) \ CARD8 *buf; \ int count; \ { \ COLOR_LIST *pnode; \ CARD##bpp *src; \ CARD##bpp rgb; \ int rep = 0; \ \ src = (CARD##bpp *) buf; \ \ while (count--) { \ rgb = *src++; \ while (count && *src == rgb) { \ rep++, src++, count--; \ } \ pnode = palette.hash[HASH_FUNC##bpp(rgb)]; \ while (pnode != NULL) { \ if ((CARD##bpp)pnode->rgb == rgb) { \ *buf++ = (CARD8)pnode->idx; \ while (rep) { \ *buf++ = (CARD8)pnode->idx; \ rep--; \ } \ break; \ } \ pnode = pnode->next; \ } \ } \ } DEFINE_IDX_ENCODE_FUNCTION(16) DEFINE_IDX_ENCODE_FUNCTION(32) #define DEFINE_MONO_ENCODE_FUNCTION(bpp) \ \ static void \ EncodeMonoRect##bpp(buf, w, h) \ CARD8 *buf; \ int w, h; \ { \ CARD##bpp *ptr; \ CARD##bpp bg; \ unsigned int value, mask; \ int aligned_width; \ int x, y, bg_bits; \ \ ptr = (CARD##bpp *) buf; \ bg = (CARD##bpp) monoBackground; \ aligned_width = w - w % 8; \ \ for (y = 0; y < h; y++) { \ for (x = 0; x < aligned_width; x += 8) { \ for (bg_bits = 0; bg_bits < 8; bg_bits++) { \ if (*ptr++ != bg) \ break; \ } \ if (bg_bits == 8) { \ *buf++ = 0; \ continue; \ } \ mask = 0x80 >> bg_bits; \ value = mask; \ for (bg_bits++; bg_bits < 8; bg_bits++) { \ mask >>= 1; \ if (*ptr++ != bg) { \ value |= mask; \ } \ } \ *buf++ = (CARD8)value; \ } \ \ mask = 0x80; \ value = 0; \ if (x >= w) \ continue; \ \ for (; x < w; x++) { \ if (*ptr++ != bg) { \ value |= mask; \ } \ mask >>= 1; \ } \ *buf++ = (CARD8)value; \ } \ } DEFINE_MONO_ENCODE_FUNCTION(8) DEFINE_MONO_ENCODE_FUNCTION(16) DEFINE_MONO_ENCODE_FUNCTION(32) /* * ``Gradient'' filter for 24-bit color samples. * Should be called only when redMax, greenMax and blueMax are 255. * Color components assumed to be byte-aligned. */ static void FilterGradient24(buf, fmt, w, h) char *buf; rfbPixelFormat *fmt; int w, h; { CARD32 *buf32; CARD32 pix32; int *prevRowPtr; int shiftBits[3]; int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3]; int prediction; int x, y, c; buf32 = (CARD32 *)buf; memset (prevRowBuf, 0, w * 3 * sizeof(int)); if (!rfbServerFormat.bigEndian == !fmt->bigEndian) { shiftBits[0] = fmt->redShift; shiftBits[1] = fmt->greenShift; shiftBits[2] = fmt->blueShift; } else { shiftBits[0] = 24 - fmt->redShift; shiftBits[1] = 24 - fmt->greenShift; shiftBits[2] = 24 - fmt->blueShift; } for (y = 0; y < h; y++) { for (c = 0; c < 3; c++) { pixUpper[c] = 0; pixHere[c] = 0; } prevRowPtr = prevRowBuf; for (x = 0; x < w; x++) { pix32 = *buf32++; for (c = 0; c < 3; c++) { pixUpperLeft[c] = pixUpper[c]; pixLeft[c] = pixHere[c]; pixUpper[c] = *prevRowPtr; pixHere[c] = (int)(pix32 >> shiftBits[c] & 0xFF); *prevRowPtr++ = pixHere[c]; prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c]; if (prediction < 0) { prediction = 0; } else if (prediction > 0xFF) { prediction = 0xFF; } *buf++ = (char)(pixHere[c] - prediction); } } } } /* * ``Gradient'' filter for other color depths. */ #define DEFINE_GRADIENT_FILTER_FUNCTION(bpp) \ \ static void \ FilterGradient##bpp(buf, fmt, w, h) \ CARD##bpp *buf; \ rfbPixelFormat *fmt; \ int w, h; \ { \ CARD##bpp pix, diff; \ Bool endianMismatch; \ int *prevRowPtr; \ int maxColor[3], shiftBits[3]; \ int pixHere[3], pixUpper[3], pixLeft[3], pixUpperLeft[3]; \ int prediction; \ int x, y, c; \ \ memset (prevRowBuf, 0, w * 3 * sizeof(int)); \ \ endianMismatch = (!rfbServerFormat.bigEndian != !fmt->bigEndian); \ \ maxColor[0] = fmt->redMax; \ maxColor[1] = fmt->greenMax; \ maxColor[2] = fmt->blueMax; \ shiftBits[0] = fmt->redShift; \ shiftBits[1] = fmt->greenShift; \ shiftBits[2] = fmt->blueShift; \ \ for (y = 0; y < h; y++) { \ for (c = 0; c < 3; c++) { \ pixUpper[c] = 0; \ pixHere[c] = 0; \ } \ prevRowPtr = prevRowBuf; \ for (x = 0; x < w; x++) { \ pix = *buf; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ diff = 0; \ for (c = 0; c < 3; c++) { \ pixUpperLeft[c] = pixUpper[c]; \ pixLeft[c] = pixHere[c]; \ pixUpper[c] = *prevRowPtr; \ pixHere[c] = (int)(pix >> shiftBits[c] & maxColor[c]); \ *prevRowPtr++ = pixHere[c]; \ \ prediction = pixLeft[c] + pixUpper[c] - pixUpperLeft[c]; \ if (prediction < 0) { \ prediction = 0; \ } else if (prediction > maxColor[c]) { \ prediction = maxColor[c]; \ } \ diff |= ((pixHere[c] - prediction) & maxColor[c]) \ << shiftBits[c]; \ } \ if (endianMismatch) { \ diff = Swap##bpp(diff); \ } \ *buf++ = diff; \ } \ } \ } DEFINE_GRADIENT_FILTER_FUNCTION(16) DEFINE_GRADIENT_FILTER_FUNCTION(32) /* * Code to guess if given rectangle is suitable for smooth image * compression (by applying "gradient" filter or JPEG coder). */ #define JPEG_MIN_RECT_SIZE 4096 #define DETECT_SUBROW_WIDTH 7 #define DETECT_MIN_WIDTH 8 #define DETECT_MIN_HEIGHT 8 static int DetectSmoothImage (fmt, w, h) rfbPixelFormat *fmt; int w, h; { unsigned long avgError; if ( rfbServerFormat.bitsPerPixel == 8 || fmt->bitsPerPixel == 8 || w < DETECT_MIN_WIDTH || h < DETECT_MIN_HEIGHT ) { return 0; } if (qualityLevel != -1) { if (w * h < JPEG_MIN_RECT_SIZE) { return 0; } } else { if ( rfbTightDisableGradient || w * h < tightConf[compressLevel].gradientMinRectSize ) { return 0; } } if (fmt->bitsPerPixel == 32) { if (usePixelFormat24) { avgError = DetectSmoothImage24(fmt, w, h); if (qualityLevel != -1) { return (avgError < tightConf[qualityLevel].jpegThreshold24); } return (avgError < tightConf[compressLevel].gradientThreshold24); } else { avgError = DetectSmoothImage32(fmt, w, h); } } else { avgError = DetectSmoothImage16(fmt, w, h); } if (qualityLevel != -1) { return (avgError < tightConf[qualityLevel].jpegThreshold); } return (avgError < tightConf[compressLevel].gradientThreshold); } static unsigned long DetectSmoothImage24 (fmt, w, h) rfbPixelFormat *fmt; int w, h; { int off; int x, y, d, dx, c; int diffStat[256]; int pixelCount = 0; int pix, left[3]; unsigned long avgError; /* If client is big-endian, color samples begin from the second byte (offset 1) of a 32-bit pixel value. */ off = (fmt->bigEndian != 0); memset(diffStat, 0, 256*sizeof(int)); y = 0, x = 0; while (y < h && x < w) { for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) { for (c = 0; c < 3; c++) { left[c] = (int)tightBeforeBuf[((y+d)*w+x+d)*4+off+c] & 0xFF; } for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) { for (c = 0; c < 3; c++) { pix = (int)tightBeforeBuf[((y+d)*w+x+d+dx)*4+off+c] & 0xFF; diffStat[abs(pix - left[c])]++; left[c] = pix; } pixelCount++; } } if (w > h) { x += h; y = 0; } else { x = 0; y += w; } } if (diffStat[0] * 33 / pixelCount >= 95) return 0; avgError = 0; for (c = 1; c < 8; c++) { avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2) return 0; } for (; c < 256; c++) { avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); } avgError /= (pixelCount * 3 - diffStat[0]); return avgError; } #define DEFINE_DETECT_FUNCTION(bpp) \ \ static unsigned long \ DetectSmoothImage##bpp (fmt, w, h) \ rfbPixelFormat *fmt; \ int w, h; \ { \ Bool endianMismatch; \ CARD##bpp pix; \ int maxColor[3], shiftBits[3]; \ int x, y, d, dx, c; \ int diffStat[256]; \ int pixelCount = 0; \ int sample, sum, left[3]; \ unsigned long avgError; \ \ endianMismatch = (!rfbServerFormat.bigEndian != !fmt->bigEndian); \ \ maxColor[0] = fmt->redMax; \ maxColor[1] = fmt->greenMax; \ maxColor[2] = fmt->blueMax; \ shiftBits[0] = fmt->redShift; \ shiftBits[1] = fmt->greenShift; \ shiftBits[2] = fmt->blueShift; \ \ memset(diffStat, 0, 256*sizeof(int)); \ \ y = 0, x = 0; \ while (y < h && x < w) { \ for (d = 0; d < h - y && d < w - x - DETECT_SUBROW_WIDTH; d++) { \ pix = ((CARD##bpp *)tightBeforeBuf)[(y+d)*w+x+d]; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ for (c = 0; c < 3; c++) { \ left[c] = (int)(pix >> shiftBits[c] & maxColor[c]); \ } \ for (dx = 1; dx <= DETECT_SUBROW_WIDTH; dx++) { \ pix = ((CARD##bpp *)tightBeforeBuf)[(y+d)*w+x+d+dx]; \ if (endianMismatch) { \ pix = Swap##bpp(pix); \ } \ sum = 0; \ for (c = 0; c < 3; c++) { \ sample = (int)(pix >> shiftBits[c] & maxColor[c]); \ sum += abs(sample - left[c]); \ left[c] = sample; \ } \ if (sum > 255) \ sum = 255; \ diffStat[sum]++; \ pixelCount++; \ } \ } \ if (w > h) { \ x += h; \ y = 0; \ } else { \ x = 0; \ y += w; \ } \ } \ \ if ((diffStat[0] + diffStat[1]) * 100 / pixelCount >= 90) \ return 0; \ \ avgError = 0; \ for (c = 1; c < 8; c++) { \ avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); \ if (diffStat[c] == 0 || diffStat[c] > diffStat[c-1] * 2) \ return 0; \ } \ for (; c < 256; c++) { \ avgError += (unsigned long)diffStat[c] * (unsigned long)(c * c); \ } \ avgError /= (pixelCount - diffStat[0]); \ \ return avgError; \ } DEFINE_DETECT_FUNCTION(16) DEFINE_DETECT_FUNCTION(32) /* * JPEG compression stuff. */ static struct jpeg_destination_mgr jpegDstManager; static Bool jpegError; static int jpegDstDataLen; static Bool SendJpegRect(cl, x, y, w, h, quality) rfbClientPtr cl; int x, y, w, h; int quality; { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; CARD8 *srcBuf; JSAMPROW rowPointer[1]; int dy; if (rfbServerFormat.bitsPerPixel == 8) return SendFullColorRect(cl, w, h); srcBuf = (CARD8 *)xalloc(w * 3); if (srcBuf == NULL) { return SendFullColorRect(cl, w, h); } rowPointer[0] = srcBuf; cinfo.err = jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); cinfo.image_width = w; cinfo.image_height = h; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo, quality, TRUE); JpegSetDstManager (&cinfo); jpeg_start_compress(&cinfo, TRUE); for (dy = 0; dy < h; dy++) { PrepareRowForJpeg(srcBuf, x, y + dy, w); jpeg_write_scanlines(&cinfo, rowPointer, 1); if (jpegError) break; } if (!jpegError) jpeg_finish_compress(&cinfo); jpeg_destroy_compress(&cinfo); xfree((char *)srcBuf); if (jpegError) return SendFullColorRect(cl, w, h); if (ublen + TIGHT_MIN_TO_COMPRESS + 1 > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } updateBuf[ublen++] = (char)(rfbTightJpeg << 4); cl->rfbBytesSent[rfbEncodingTight]++; return SendCompressedData(cl, jpegDstDataLen); } static void PrepareRowForJpeg(dst, x, y, count) CARD8 *dst; int x, y, count; { if (rfbServerFormat.bitsPerPixel == 32) { if ( rfbServerFormat.redMax == 0xFF && rfbServerFormat.greenMax == 0xFF && rfbServerFormat.blueMax == 0xFF ) { PrepareRowForJpeg24(dst, x, y, count); } else { PrepareRowForJpeg32(dst, x, y, count); } } else { /* 16 bpp assumed. */ PrepareRowForJpeg16(dst, x, y, count); } } static void PrepareRowForJpeg24(dst, x, y, count) CARD8 *dst; int x, y, count; { CARD32 *fbptr; CARD32 pix; fbptr = (CARD32 *) &rfbScreen.pfbMemory[y * rfbScreen.paddedWidthInBytes + x * 4]; while (count--) { pix = *fbptr++; *dst++ = (CARD8)(pix >> rfbServerFormat.redShift); *dst++ = (CARD8)(pix >> rfbServerFormat.greenShift); *dst++ = (CARD8)(pix >> rfbServerFormat.blueShift); } } #define DEFINE_JPEG_GET_ROW_FUNCTION(bpp) \ \ static void \ PrepareRowForJpeg##bpp(dst, x, y, count) \ CARD8 *dst; \ int x, y, count; \ { \ CARD##bpp *fbptr; \ CARD##bpp pix; \ int inRed, inGreen, inBlue; \ \ fbptr = (CARD##bpp *) \ &rfbScreen.pfbMemory[y * rfbScreen.paddedWidthInBytes + \ x * (bpp / 8)]; \ \ while (count--) { \ pix = *fbptr++; \ \ inRed = (int) \ (pix >> rfbServerFormat.redShift & rfbServerFormat.redMax); \ inGreen = (int) \ (pix >> rfbServerFormat.greenShift & rfbServerFormat.greenMax); \ inBlue = (int) \ (pix >> rfbServerFormat.blueShift & rfbServerFormat.blueMax); \ \ *dst++ = (CARD8)((inRed * 255 + rfbServerFormat.redMax / 2) / \ rfbServerFormat.redMax); \ *dst++ = (CARD8)((inGreen * 255 + rfbServerFormat.greenMax / 2) / \ rfbServerFormat.greenMax); \ *dst++ = (CARD8)((inBlue * 255 + rfbServerFormat.blueMax / 2) / \ rfbServerFormat.blueMax); \ } \ } DEFINE_JPEG_GET_ROW_FUNCTION(16) DEFINE_JPEG_GET_ROW_FUNCTION(32) /* * Destination manager implementation for JPEG library. */ static void JpegInitDestination(j_compress_ptr cinfo) { jpegError = FALSE; jpegDstManager.next_output_byte = (JOCTET *)tightAfterBuf; jpegDstManager.free_in_buffer = (size_t)tightAfterBufSize; } static boolean JpegEmptyOutputBuffer(j_compress_ptr cinfo) { jpegError = TRUE; jpegDstManager.next_output_byte = (JOCTET *)tightAfterBuf; jpegDstManager.free_in_buffer = (size_t)tightAfterBufSize; return TRUE; } static void JpegTermDestination(j_compress_ptr cinfo) { jpegDstDataLen = tightAfterBufSize - jpegDstManager.free_in_buffer; } static void JpegSetDstManager(j_compress_ptr cinfo) { jpegDstManager.init_destination = JpegInitDestination; jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer; jpegDstManager.term_destination = JpegTermDestination; cinfo->dest = &jpegDstManager; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/cmap.c0100664000076400007640000000752607120677563021215 0ustar constconst/* * cmap.c */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1993 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include #include "scrnintstr.h" #include "resource.h" #include "colormapst.h" #include "rfb.h" ColormapPtr rfbInstalledColormap; int rfbListInstalledColormaps(pScreen, pmaps) ScreenPtr pScreen; Colormap *pmaps; { /* By the time we are processing requests, we can guarantee that there * is always a colormap installed */ *pmaps = rfbInstalledColormap->mid; return (1); } void rfbInstallColormap(pmap) ColormapPtr pmap; { ColormapPtr oldpmap = rfbInstalledColormap; if (pmap != oldpmap) { if(oldpmap != (ColormapPtr)None) WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); /* Install pmap */ rfbInstalledColormap = pmap; WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); rfbSetClientColourMaps(0, 0); } } void rfbUninstallColormap(pmap) ColormapPtr pmap; { ColormapPtr curpmap = rfbInstalledColormap; if(pmap == curpmap) { if (pmap->mid != pmap->pScreen->defColormap) { curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, RT_COLORMAP); (*pmap->pScreen->InstallColormap)(curpmap); } } } /* * rfbStoreColors. We have a set of pixels but they may be in any order. * If some of them happen to be in continuous ascending order then we can * group them together into a single call to rfbSetClientColourMaps. */ void rfbStoreColors(pmap, ndef, pdefs) ColormapPtr pmap; int ndef; xColorItem *pdefs; { int i; int first = -1; int n = 0; if (pmap == rfbInstalledColormap) { for (i = 0; i < ndef; i++) { if ((first != -1) && (first + n == pdefs[i].pixel)) { n++; } else { if (first != -1) { rfbSetClientColourMaps(first, n); } first = pdefs[i].pixel; n = 1; } } rfbSetClientColourMaps(first, n); } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/cutpaste.c0100664000076400007640000000464707176101667022124 0ustar constconst/* * cutpaste.c - routines to deal with cut & paste buffers / selection. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #define NEED_EVENTS #include #include #include "rfb.h" #include "selection.h" #include "input.h" #include extern WindowPtr *WindowTable; /* Why isn't this in a header file? */ extern Selection *CurrentSelections; extern int NumCurrentSelections; static Bool inSetXCutText = FALSE; /* * rfbSetXCutText sets the cut buffer to be the given string. We also clear * the primary selection. Ideally we'd like to set it to the same thing, but I * can't work out how to do that without some kind of helper X client. */ void rfbSetXCutText(char *str, int len) { int i = 0; inSetXCutText = TRUE; ChangeWindowProperty(WindowTable[0], XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, len, (pointer)str, TRUE); while ((i < NumCurrentSelections) && CurrentSelections[i].selection != XA_PRIMARY) i++; if (i < NumCurrentSelections) { xEvent event; if (CurrentSelections[i].client) { event.u.u.type = SelectionClear; event.u.selectionClear.time = GetTimeInMillis(); event.u.selectionClear.window = CurrentSelections[i].window; event.u.selectionClear.atom = CurrentSelections[i].selection; (void) TryClientEvents (CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); } CurrentSelections[i].window = None; CurrentSelections[i].pWin = NULL; CurrentSelections[i].client = NullClient; } inSetXCutText = FALSE; } void rfbGotXCutText(char *str, int len) { if (!inSetXCutText) rfbSendServerCutText(str, len); } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/httpd.c0100664000076400007640000002676110543216033021402 0ustar constconst/* * httpd.c - a simple HTTP server */ /* * Copyright (C) 2002 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include #include #include #include #include #include #include #include #include #ifndef USE_LIBWRAP #define USE_LIBWRAP 0 #endif #if USE_LIBWRAP #include #include #endif #include "rfb.h" #define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\n\r\n" \ "File Not Found\n" \ "

File Not Found

\n" #define OK_STR "HTTP/1.0 200 OK\r\n\r\n" static void httpProcessInput(); static Bool compareAndSkip(char **ptr, const char *str); static Bool parseParams(const char *request, char *result, int max_bytes); static Bool validateString(char *str); int httpPort = 0; char *httpDir = NULL; int httpListenSock = -1; int httpSock = -1; #define BUF_SIZE 32768 static char buf[BUF_SIZE]; static size_t buf_filled = 0; /* * httpInitSockets sets up the TCP socket to listen for HTTP connections. */ void httpInitSockets() { static Bool done = FALSE; if (done) return; done = TRUE; if (!httpDir) return; if (httpPort == 0) { httpPort = 5800 + atoi(display); } rfbLog("Listening for HTTP connections on TCP port %d\n", httpPort); rfbLog(" URL http://%s:%d\n",rfbThisHost,httpPort); if ((httpListenSock = ListenOnTCPPort(httpPort)) < 0) { rfbLogPerror("ListenOnTCPPort"); exit(1); } AddEnabledDevice(httpListenSock); } /* * httpCheckFds is called from ProcessInputEvents to check for input on the * HTTP socket(s). If there is input to process, httpProcessInput is called. */ void httpCheckFds() { int nfds, n; fd_set fds; struct timeval tv; struct sockaddr_in addr; int addrlen = sizeof(addr); if (!httpDir) return; FD_ZERO(&fds); FD_SET(httpListenSock, &fds); if (httpSock >= 0) { FD_SET(httpSock, &fds); } tv.tv_sec = 0; tv.tv_usec = 0; nfds = select(max(httpSock,httpListenSock) + 1, &fds, NULL, NULL, &tv); if (nfds == 0) { return; } if (nfds < 0) { rfbLogPerror("httpCheckFds: select"); return; } if ((httpSock >= 0) && FD_ISSET(httpSock, &fds)) { httpProcessInput(); } if (FD_ISSET(httpListenSock, &fds)) { int flags; if (httpSock >= 0) close(httpSock); if ((httpSock = accept(httpListenSock, (struct sockaddr *)&addr, &addrlen)) < 0) { rfbLogPerror("httpCheckFds: accept"); return; } #if USE_LIBWRAP if (!hosts_ctl("Xvnc", STRING_UNKNOWN, inet_ntoa(addr.sin_addr), STRING_UNKNOWN)) { rfbLog("Rejected HTTP connection from client %s\n", inet_ntoa(addr.sin_addr)); close(httpSock); httpSock = -1; return; } #endif flags = fcntl (httpSock, F_GETFL); if (flags == -1 || fcntl (httpSock, F_SETFL, flags | O_NONBLOCK) == -1) { rfbLogPerror("httpCheckFds: fcntl"); close (httpSock); httpSock = -1; return; } AddEnabledDevice(httpSock); } } static void httpCloseSock() { close(httpSock); RemoveEnabledDevice(httpSock); httpSock = -1; buf_filled = 0; } /* * httpProcessInput is called when input is received on the HTTP socket. */ static void httpProcessInput() { struct sockaddr_in addr; int addrlen = sizeof(addr); char fullFname[512]; char params[1024]; char *ptr; char *fname; int maxFnameLen; int fd; Bool performSubstitutions = FALSE; char str[256]; struct passwd *user; user = getpwuid(getuid()); if (strlen(httpDir) > 255) { rfbLog("-httpd directory too long\n"); httpCloseSock(); return; } strcpy(fullFname, httpDir); fname = &fullFname[strlen(fullFname)]; maxFnameLen = 511 - strlen(fullFname); /* Read data from the HTTP client until we get a complete request. */ while (1) { ssize_t got = read (httpSock, buf + buf_filled, sizeof (buf) - buf_filled - 1); if (got <= 0) { if (got == 0) { rfbLog("httpd: premature connection close\n"); } else { if (errno == EAGAIN) { return; } rfbLogPerror("httpProcessInput: read"); } httpCloseSock(); return; } buf_filled += got; buf[buf_filled] = '\0'; /* Is it complete yet (is there a blank line)? */ if (strstr (buf, "\r\r") || strstr (buf, "\n\n") || strstr (buf, "\r\n\r\n") || strstr (buf, "\n\r\n\r")) break; } /* Process the request. */ if (strncmp(buf, "GET ", 4)) { rfbLog("httpd: no GET line\n"); httpCloseSock(); return; } else { /* Only use the first line. */ buf[strcspn(buf, "\n\r")] = '\0'; } if (strlen(buf) > maxFnameLen) { rfbLog("httpd: GET line too long\n"); httpCloseSock(); return; } if (sscanf(buf, "GET %s HTTP/1.0", fname) != 1) { rfbLog("httpd: couldn't parse GET line\n"); httpCloseSock(); return; } if (fname[0] != '/') { rfbLog("httpd: filename didn't begin with '/'\n"); WriteExact(httpSock, NOT_FOUND_STR, strlen(NOT_FOUND_STR)); httpCloseSock(); return; } if (strchr(fname+1, '/') != NULL) { rfbLog("httpd: asking for file in other directory\n"); WriteExact(httpSock, NOT_FOUND_STR, strlen(NOT_FOUND_STR)); httpCloseSock(); return; } getpeername(httpSock, (struct sockaddr *)&addr, &addrlen); rfbLog("httpd: get '%s' for %s\n", fname+1, inet_ntoa(addr.sin_addr)); /* Extract parameters from the URL string if necessary */ params[0] = '\0'; ptr = strchr(fname, '?'); if (ptr != NULL) { *ptr = '\0'; if (!parseParams(&ptr[1], params, 1024)) { params[0] = '\0'; rfbLog("httpd: bad parameters in the URL\n"); } } /* If we were asked for '/', actually read the file index.vnc */ if (strcmp(fname, "/") == 0) { strcpy(fname, "/index.vnc"); rfbLog("httpd: defaulting to '%s'\n", fname+1); } /* Substitutions are performed on files ending .vnc */ if (strlen(fname) >= 4 && strcmp(&fname[strlen(fname)-4], ".vnc") == 0) { performSubstitutions = TRUE; } /* Open the file */ if ((fd = open(fullFname, O_RDONLY)) < 0) { rfbLogPerror("httpProcessInput: open"); WriteExact(httpSock, NOT_FOUND_STR, strlen(NOT_FOUND_STR)); httpCloseSock(); return; } WriteExact(httpSock, OK_STR, strlen(OK_STR)); while (1) { int n = read(fd, buf, BUF_SIZE-1); if (n < 0) { rfbLogPerror("httpProcessInput: read"); close(fd); httpCloseSock(); return; } if (n == 0) break; if (performSubstitutions) { /* Substitute $WIDTH, $HEIGHT, etc with the appropriate values. This won't quite work properly if the .vnc file is longer than BUF_SIZE, but it's reasonable to assume that .vnc files will always be short. */ char *ptr = buf; char *dollar; buf[n] = 0; /* make sure it's null-terminated */ while (dollar = strchr(ptr, '$')) { WriteExact(httpSock, ptr, (dollar - ptr)); ptr = dollar; if (compareAndSkip(&ptr, "$WIDTH")) { sprintf(str, "%d", rfbScreen.width); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$HEIGHT")) { sprintf(str, "%d", rfbScreen.height); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$APPLETWIDTH")) { sprintf(str, "%d", rfbScreen.width); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$APPLETHEIGHT")) { sprintf(str, "%d", rfbScreen.height + 32); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$PORT")) { sprintf(str, "%d", rfbPort); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$DESKTOP")) { WriteExact(httpSock, desktopName, strlen(desktopName)); } else if (compareAndSkip(&ptr, "$DISPLAY")) { sprintf(str, "%s:%s", rfbThisHost, display); WriteExact(httpSock, str, strlen(str)); } else if (compareAndSkip(&ptr, "$USER")) { if (user) { WriteExact(httpSock, user->pw_name, strlen(user->pw_name)); } else { WriteExact(httpSock, "?", 1); } } else if (compareAndSkip(&ptr, "$PARAMS")) { if (params[0] != '\0') WriteExact(httpSock, params, strlen(params)); } else { if (!compareAndSkip(&ptr, "$$")) ptr++; if (WriteExact(httpSock, "$", 1) < 0) { close(fd); httpCloseSock(); return; } } } if (WriteExact(httpSock, ptr, (&buf[n] - ptr)) < 0) break; } else { /* For files not ending .vnc, just write out the buffer */ if (WriteExact(httpSock, buf, n) < 0) break; } } close(fd); httpCloseSock(); } static Bool compareAndSkip(char **ptr, const char *str) { if (strncmp(*ptr, str, strlen(str)) == 0) { *ptr += strlen(str); return TRUE; } return FALSE; } /* * Parse the request tail after the '?' character, and format a sequence * of tags for inclusion into an HTML page with embedded applet. */ static Bool parseParams(const char *request, char *result, int max_bytes) { char param_request[128]; char param_formatted[196]; const char *tail; char *delim_ptr; char *value_str; int cur_bytes, len; result[0] = '\0'; cur_bytes = 0; tail = request; for (;;) { /* Copy individual "name=value" string into a buffer */ delim_ptr = strchr((char *)tail, '&'); if (delim_ptr == NULL) { if (strlen(tail) >= sizeof(param_request)) { return FALSE; } strcpy(param_request, tail); } else { len = delim_ptr - tail; if (len >= sizeof(param_request)) { return FALSE; } memcpy(param_request, tail, len); param_request[len] = '\0'; } /* Split the request into parameter name and value */ value_str = strchr(¶m_request[1], '='); if (value_str == NULL) { return FALSE; } *value_str++ = '\0'; if (strlen(value_str) == 0) { return FALSE; } /* Validate both parameter name and value */ if (!validateString(param_request) || !validateString(value_str)) { return FALSE; } /* Prepare HTML-formatted representation of the name=value pair */ len = sprintf(param_formatted, "\n", param_request, value_str); if (cur_bytes + len + 1 > max_bytes) { return FALSE; } strcat(result, param_formatted); cur_bytes += len; /* Go to the next parameter */ if (delim_ptr == NULL) { break; } tail = delim_ptr + 1; } return TRUE; } /* * Check if the string consists only of alphanumeric characters, '+' * signs, underscores, and dots. Replace all '+' signs with spaces. */ static Bool validateString(char *str) { char *ptr; for (ptr = str; *ptr != '\0'; ptr++) { if (!isalnum(*ptr) && *ptr != '_' && *ptr != '.') { if (*ptr == '+') { *ptr = ' '; } else { return FALSE; } } } return TRUE; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/kbdptr.c0100664000076400007640000003704307231126414021543 0ustar constconst/* * kbdptr.c - deal with keyboard and pointer device over TCP & UDP. * * */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "X11/X.h" #define NEED_EVENTS #include "X11/Xproto.h" #include "inputstr.h" #define XK_CYRILLIC #include #include #include "rfb.h" extern WindowPtr *WindowTable; /* Why isn't this in a header file? */ #define KEY_IS_PRESSED(keycode) \ (kbdDevice->key->down[(keycode) >> 3] & (1 << ((keycode) & 7))) static void XConvertCase(KeySym sym, KeySym *lower, KeySym *upper); static DeviceIntPtr kbdDevice; /* If TRUE, then keys META == ALT as in the original AT&T version. */ Bool compatibleKbd = FALSE; unsigned char ptrAcceleration = 50; #define MIN_KEY_CODE 8 #define MAX_KEY_CODE 255 #define NO_OF_KEYS (MAX_KEY_CODE - MIN_KEY_CODE + 1) #define GLYPHS_PER_KEY 2 static KeySym kbdMap[] = { /* Modifiers */ XK_Control_L, NoSymbol, #define CONTROL_L_KEY_CODE MIN_KEY_CODE XK_Control_R, NoSymbol, #define CONTROL_R_KEY_CODE (MIN_KEY_CODE + 1) XK_Shift_L, NoSymbol, #define SHIFT_L_KEY_CODE (MIN_KEY_CODE + 2) XK_Shift_R, NoSymbol, #define SHIFT_R_KEY_CODE (MIN_KEY_CODE + 3) XK_Meta_L, NoSymbol, #define META_L_KEY_CODE (MIN_KEY_CODE + 4) XK_Meta_R, NoSymbol, #define META_R_KEY_CODE (MIN_KEY_CODE + 5) XK_Alt_L, NoSymbol, #define ALT_L_KEY_CODE (MIN_KEY_CODE + 6) XK_Alt_R, NoSymbol, #define ALT_R_KEY_CODE (MIN_KEY_CODE + 7) /* Standard US keyboard */ XK_space, NoSymbol, XK_0, XK_parenright, XK_1, XK_exclam, XK_2, XK_at, XK_3, XK_numbersign, XK_4, XK_dollar, XK_5, XK_percent, XK_6, XK_asciicircum, XK_7, XK_ampersand, XK_8, XK_asterisk, XK_9, XK_parenleft, XK_minus, XK_underscore, XK_equal, XK_plus, XK_bracketleft, XK_braceleft, XK_bracketright, XK_braceright, XK_semicolon, XK_colon, XK_apostrophe, XK_quotedbl, XK_grave, XK_asciitilde, XK_comma, XK_less, XK_period, XK_greater, XK_slash, XK_question, XK_backslash, XK_bar, XK_a, XK_A, XK_b, XK_B, XK_c, XK_C, XK_d, XK_D, XK_e, XK_E, XK_f, XK_F, XK_g, XK_G, XK_h, XK_H, XK_i, XK_I, XK_j, XK_J, XK_k, XK_K, XK_l, XK_L, XK_m, XK_M, XK_n, XK_N, XK_o, XK_O, XK_p, XK_P, XK_q, XK_Q, XK_r, XK_R, XK_s, XK_S, XK_t, XK_T, XK_u, XK_U, XK_v, XK_V, XK_w, XK_W, XK_x, XK_X, XK_y, XK_Y, XK_z, XK_Z, /* Other useful keys */ XK_BackSpace, NoSymbol, XK_Return, NoSymbol, XK_Tab, NoSymbol, XK_Escape, NoSymbol, XK_Delete, NoSymbol, XK_Home, NoSymbol, XK_End, NoSymbol, XK_Page_Up, NoSymbol, XK_Page_Down, NoSymbol, XK_Up, NoSymbol, XK_Down, NoSymbol, XK_Left, NoSymbol, XK_Right, NoSymbol, XK_F1, NoSymbol, XK_F2, NoSymbol, XK_F3, NoSymbol, XK_F4, NoSymbol, XK_F5, NoSymbol, XK_F6, NoSymbol, XK_F7, NoSymbol, XK_F8, NoSymbol, XK_F9, NoSymbol, XK_F10, NoSymbol, XK_F11, NoSymbol, XK_F12, NoSymbol, /* Plus blank ones which can be filled in using xmodmap */ }; #define N_PREDEFINED_KEYS (sizeof(kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY)) void PtrDeviceInit() { } void KbdDeviceInit(pDevice, pKeySyms, pModMap) DeviceIntPtr pDevice; KeySymsPtr pKeySyms; CARD8 *pModMap; { int i; kbdDevice = pDevice; for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = NoSymbol; pModMap[CONTROL_L_KEY_CODE] = ControlMask; pModMap[CONTROL_R_KEY_CODE] = ControlMask; pModMap[SHIFT_L_KEY_CODE] = ShiftMask; pModMap[SHIFT_R_KEY_CODE] = ShiftMask; if (compatibleKbd) { pModMap[META_L_KEY_CODE] = Mod1Mask; pModMap[META_R_KEY_CODE] = Mod1Mask; } else { pModMap[META_L_KEY_CODE] = Mod4Mask; pModMap[META_R_KEY_CODE] = Mod4Mask; } pModMap[ALT_L_KEY_CODE] = Mod1Mask; pModMap[ALT_R_KEY_CODE] = Mod1Mask; pKeySyms->minKeyCode = MIN_KEY_CODE; pKeySyms->maxKeyCode = MAX_KEY_CODE; pKeySyms->mapWidth = GLYPHS_PER_KEY; pKeySyms->map = (KeySym *)xalloc(sizeof(KeySym) * MAP_LENGTH * GLYPHS_PER_KEY); if (!pKeySyms->map) { rfbLog("xalloc failed\n"); exit(1); } for (i = 0; i < MAP_LENGTH * GLYPHS_PER_KEY; i++) pKeySyms->map[i] = NoSymbol; for (i = 0; i < N_PREDEFINED_KEYS * GLYPHS_PER_KEY; i++) { pKeySyms->map[i] = kbdMap[i]; } } void KbdDeviceOn() { } void KbdDeviceOff() { } void PtrDeviceOn(pDev) DeviceIntPtr pDev; { ptrAcceleration = (char)pDev->ptrfeed->ctrl.num; } void PtrDeviceOff() { } void PtrDeviceControl(dev, ctrl) DevicePtr dev; PtrCtrl *ctrl; { ptrAcceleration = (char)ctrl->num; if (udpSockConnected) { if (write(udpSock, &ptrAcceleration, 1) <= 0) { rfbLogPerror("PtrDeviceControl: UDP input: write"); rfbDisconnectUDPSock(); } } } void KbdAddEvent(down, keySym, cl) Bool down; KeySym keySym; rfbClientPtr cl; { xEvent ev, fake; KeySymsPtr keySyms = &kbdDevice->key->curKeySyms; int i; int keyCode = 0; int freeIndex = -1; unsigned long time; Bool fakeShiftPress = FALSE; Bool fakeShiftLRelease = FALSE; Bool fakeShiftRRelease = FALSE; Bool shiftMustBeReleased = FALSE; Bool shiftMustBePressed = FALSE; #ifdef CORBA if (cl) { CARD32 clientId = cl->sock; ChangeWindowProperty(WindowTable[0], VNC_LAST_CLIENT_ID, XA_INTEGER, 32, PropModeReplace, 1, (pointer)&clientId, TRUE); } #endif if (down) { ev.u.u.type = KeyPress; } else { ev.u.u.type = KeyRelease; } /* First check if it's one of our predefined keys. If so then we can make some attempt at allowing an xmodmap inside a VNC desktop behave something like you'd expect - e.g. if keys A & B are swapped over and the VNC client sends an A, then map it to a B when generating the X event. We don't attempt to do this for keycodes which we make up on the fly because it's too hard... */ for (i = 0; i < N_PREDEFINED_KEYS * GLYPHS_PER_KEY; i++) { if (keySym == kbdMap[i]) { keyCode = MIN_KEY_CODE + i / GLYPHS_PER_KEY; if (kbdMap[(i/GLYPHS_PER_KEY) * GLYPHS_PER_KEY + 1] != NoSymbol) { /* this keycode has more than one symbol associated with it, so shift state is important */ if ((i % GLYPHS_PER_KEY) == 0) shiftMustBeReleased = TRUE; else shiftMustBePressed = TRUE; } break; } } if (!keyCode) { /* not one of our predefined keys - see if it's in the current keyboard mapping (i.e. we've already allocated an extra keycode for it) */ if (keySyms->mapWidth < 2) { rfbLog("KbdAddEvent: Sanity check failed - Keyboard mapping has " "less than 2 keysyms per keycode (KeySym 0x%x)\n", keySym); return; } for (i = 0; i < NO_OF_KEYS * keySyms->mapWidth; i++) { if (keySym == keySyms->map[i]) { keyCode = MIN_KEY_CODE + i / keySyms->mapWidth; if (keySyms->map[(i / keySyms->mapWidth) * keySyms->mapWidth + 1] != NoSymbol) { /* this keycode has more than one symbol associated with it, so shift state is important */ if ((i % keySyms->mapWidth) == 0) shiftMustBeReleased = TRUE; else shiftMustBePressed = TRUE; } break; } if ((freeIndex == -1) && (keySyms->map[i] == NoSymbol) && (i % keySyms->mapWidth) == 0) { freeIndex = i; } } } if (!keyCode) { KeySym lower, upper; /* we don't have an existing keycode - make one up on the fly and add it to the keyboard mapping. Thanks to Vlad Harchev for pointing out problems with non-ascii capitalisation. */ if (freeIndex == -1) { rfbLog("KbdAddEvent: ignoring KeySym 0x%x - no free KeyCodes\n", keySym); return; } keyCode = MIN_KEY_CODE + freeIndex / keySyms->mapWidth; XConvertCase(keySym, &lower, &upper); if (lower == upper) { keySyms->map[freeIndex] = keySym; } else { keySyms->map[freeIndex] = lower; keySyms->map[freeIndex+1] = upper; if (keySym == lower) shiftMustBeReleased = TRUE; else shiftMustBePressed = TRUE; } SendMappingNotify(MappingKeyboard, keyCode, 1, serverClient); rfbLog("KbdAddEvent: unknown KeySym 0x%x - allocating KeyCode %d\n", keySym, keyCode); } time = GetTimeInMillis(); if (down) { if (shiftMustBePressed && !(kbdDevice->key->state & ShiftMask)) { fakeShiftPress = TRUE; fake.u.u.type = KeyPress; fake.u.u.detail = SHIFT_L_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } if (shiftMustBeReleased && (kbdDevice->key->state & ShiftMask)) { if (KEY_IS_PRESSED(SHIFT_L_KEY_CODE)) { fakeShiftLRelease = TRUE; fake.u.u.type = KeyRelease; fake.u.u.detail = SHIFT_L_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } if (KEY_IS_PRESSED(SHIFT_R_KEY_CODE)) { fakeShiftRRelease = TRUE; fake.u.u.type = KeyRelease; fake.u.u.detail = SHIFT_R_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } } } ev.u.u.detail = keyCode; ev.u.keyButtonPointer.time = time; mieqEnqueue(&ev); if (fakeShiftPress) { fake.u.u.type = KeyRelease; fake.u.u.detail = SHIFT_L_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } if (fakeShiftLRelease) { fake.u.u.type = KeyPress; fake.u.u.detail = SHIFT_L_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } if (fakeShiftRRelease) { fake.u.u.type = KeyPress; fake.u.u.detail = SHIFT_R_KEY_CODE; fake.u.keyButtonPointer.time = time; mieqEnqueue(&fake); } } void PtrAddEvent(buttonMask, x, y, cl) int buttonMask; int x; int y; rfbClientPtr cl; { xEvent ev; int i; unsigned long time; static int oldButtonMask = 0; #ifdef CORBA if (cl) { CARD32 clientId = cl->sock; ChangeWindowProperty(WindowTable[0], VNC_LAST_CLIENT_ID, XA_INTEGER, 32, PropModeReplace, 1, (pointer)&clientId, TRUE); } #endif time = GetTimeInMillis(); miPointerAbsoluteCursor(x, y, time); for (i = 0; i < 5; i++) { if ((buttonMask ^ oldButtonMask) & (1<key->down[i] != 0) { for (j = 0; j < 8; j++) { if (kbdDevice->key->down[i] & (1 << j)) { ev.u.u.type = KeyRelease; ev.u.u.detail = (i << 3) | j; ev.u.keyButtonPointer.time = time; mieqEnqueue(&ev); } } } } } /* copied from Xlib source */ static void XConvertCase(KeySym sym, KeySym *lower, KeySym *upper) { *lower = sym; *upper = sym; switch(sym >> 8) { case 0: /* Latin 1 */ if ((sym >= XK_A) && (sym <= XK_Z)) *lower += (XK_a - XK_A); else if ((sym >= XK_a) && (sym <= XK_z)) *upper -= (XK_a - XK_A); else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis)) *lower += (XK_agrave - XK_Agrave); else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis)) *upper -= (XK_agrave - XK_Agrave); else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn)) *lower += (XK_oslash - XK_Ooblique); else if ((sym >= XK_oslash) && (sym <= XK_thorn)) *upper -= (XK_oslash - XK_Ooblique); break; case 1: /* Latin 2 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym == XK_Aogonek) *lower = XK_aogonek; else if (sym >= XK_Lstroke && sym <= XK_Sacute) *lower += (XK_lstroke - XK_Lstroke); else if (sym >= XK_Scaron && sym <= XK_Zacute) *lower += (XK_scaron - XK_Scaron); else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) *lower += (XK_zcaron - XK_Zcaron); else if (sym == XK_aogonek) *upper = XK_Aogonek; else if (sym >= XK_lstroke && sym <= XK_sacute) *upper -= (XK_lstroke - XK_Lstroke); else if (sym >= XK_scaron && sym <= XK_zacute) *upper -= (XK_scaron - XK_Scaron); else if (sym >= XK_zcaron && sym <= XK_zabovedot) *upper -= (XK_zcaron - XK_Zcaron); else if (sym >= XK_Racute && sym <= XK_Tcedilla) *lower += (XK_racute - XK_Racute); else if (sym >= XK_racute && sym <= XK_tcedilla) *upper -= (XK_racute - XK_Racute); break; case 2: /* Latin 3 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) *lower += (XK_hstroke - XK_Hstroke); else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) *lower += (XK_gbreve - XK_Gbreve); else if (sym >= XK_hstroke && sym <= XK_hcircumflex) *upper -= (XK_hstroke - XK_Hstroke); else if (sym >= XK_gbreve && sym <= XK_jcircumflex) *upper -= (XK_gbreve - XK_Gbreve); else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) *lower += (XK_cabovedot - XK_Cabovedot); else if (sym >= XK_cabovedot && sym <= XK_scircumflex) *upper -= (XK_cabovedot - XK_Cabovedot); break; case 3: /* Latin 4 */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Rcedilla && sym <= XK_Tslash) *lower += (XK_rcedilla - XK_Rcedilla); else if (sym >= XK_rcedilla && sym <= XK_tslash) *upper -= (XK_rcedilla - XK_Rcedilla); else if (sym == XK_ENG) *lower = XK_eng; else if (sym == XK_eng) *upper = XK_ENG; else if (sym >= XK_Amacron && sym <= XK_Umacron) *lower += (XK_amacron - XK_Amacron); else if (sym >= XK_amacron && sym <= XK_umacron) *upper -= (XK_amacron - XK_Amacron); break; case 6: /* Cyrillic */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) *lower -= (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) *upper += (XK_Serbian_DJE - XK_Serbian_dje); else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); break; case 7: /* Greek */ /* Assume the KeySym is a legal value (ignore discontinuities) */ if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && sym != XK_Greek_iotaaccentdieresis && sym != XK_Greek_upsilonaccentdieresis) *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) *lower += (XK_Greek_alpha - XK_Greek_ALPHA); else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && sym != XK_Greek_finalsmallsigma) *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); break; } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/translate.c0100664000076400007640000002556607175647567022311 0ustar constconst/* * translate.c - translate between different pixel formats */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" static void PrintPixelFormat(rfbPixelFormat *pf); static Bool rfbSetClientColourMapBGR233(); Bool rfbEconomicTranslate = FALSE; /* * Structure representing pixel format for RFB server (i.e. us). */ rfbPixelFormat rfbServerFormat; /* * Some standard pixel formats. */ static const rfbPixelFormat BGR233Format = { 8, 8, 0, 1, 7, 7, 3, 0, 3, 6 }; /* * Macro to compare pixel formats. */ #define PF_EQ(x,y) \ ((x.bitsPerPixel == y.bitsPerPixel) && \ (x.depth == y.depth) && \ ((x.bigEndian == y.bigEndian) || (x.bitsPerPixel == 8)) && \ (x.trueColour == y.trueColour) && \ (!x.trueColour || ((x.redMax == y.redMax) && \ (x.greenMax == y.greenMax) && \ (x.blueMax == y.blueMax) && \ (x.redShift == y.redShift) && \ (x.greenShift == y.greenShift) && \ (x.blueShift == y.blueShift)))) #define CONCAT2(a,b) a##b #define CONCAT2E(a,b) CONCAT2(a,b) #define CONCAT4(a,b,c,d) a##b##c##d #define CONCAT4E(a,b,c,d) CONCAT4(a,b,c,d) #define OUT 8 #include "tableinittctemplate.c" #include "tableinitcmtemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT #define OUT 16 #include "tableinittctemplate.c" #include "tableinitcmtemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT #define OUT 32 #include "tableinittctemplate.c" #include "tableinitcmtemplate.c" #define IN 8 #include "tabletranstemplate.c" #undef IN #define IN 16 #include "tabletranstemplate.c" #undef IN #define IN 32 #include "tabletranstemplate.c" #undef IN #undef OUT typedef void (*rfbInitTableFnType)(char **table, rfbPixelFormat *in, rfbPixelFormat *out); rfbInitTableFnType rfbInitTrueColourSingleTableFns[3] = { rfbInitTrueColourSingleTable8, rfbInitTrueColourSingleTable16, rfbInitTrueColourSingleTable32 }; rfbInitTableFnType rfbInitColourMapSingleTableFns[3] = { rfbInitColourMapSingleTable8, rfbInitColourMapSingleTable16, rfbInitColourMapSingleTable32 }; rfbInitTableFnType rfbInitTrueColourRGBTablesFns[3] = { rfbInitTrueColourRGBTables8, rfbInitTrueColourRGBTables16, rfbInitTrueColourRGBTables32 }; rfbTranslateFnType rfbTranslateWithSingleTableFns[3][3] = { { rfbTranslateWithSingleTable8to8, rfbTranslateWithSingleTable8to16, rfbTranslateWithSingleTable8to32 }, { rfbTranslateWithSingleTable16to8, rfbTranslateWithSingleTable16to16, rfbTranslateWithSingleTable16to32 }, { rfbTranslateWithSingleTable32to8, rfbTranslateWithSingleTable32to16, rfbTranslateWithSingleTable32to32 } }; rfbTranslateFnType rfbTranslateWithRGBTablesFns[3][3] = { { rfbTranslateWithRGBTables8to8, rfbTranslateWithRGBTables8to16, rfbTranslateWithRGBTables8to32 }, { rfbTranslateWithRGBTables16to8, rfbTranslateWithRGBTables16to16, rfbTranslateWithRGBTables16to32 }, { rfbTranslateWithRGBTables32to8, rfbTranslateWithRGBTables32to16, rfbTranslateWithRGBTables32to32 } }; /* * rfbTranslateNone is used when no translation is required. */ void rfbTranslateNone(char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { int bytesPerOutputLine = width * (out->bitsPerPixel / 8); while (height > 0) { memcpy(optr, iptr, bytesPerOutputLine); iptr += bytesBetweenInputLines; optr += bytesPerOutputLine; height--; } } /* * rfbSetTranslateFunction sets the translation function. */ Bool rfbSetTranslateFunction(cl) rfbClientPtr cl; { rfbLog("Pixel format for client %s:\n",cl->host); PrintPixelFormat(&cl->format); /* * Check that bits per pixel values are valid */ if ((rfbServerFormat.bitsPerPixel != 8) && (rfbServerFormat.bitsPerPixel != 16) && (rfbServerFormat.bitsPerPixel != 32)) { rfbLog("%s: server bits per pixel not 8, 16 or 32\n", "rfbSetTranslateFunction"); rfbCloseSock(cl->sock); return FALSE; } if ((cl->format.bitsPerPixel != 8) && (cl->format.bitsPerPixel != 16) && (cl->format.bitsPerPixel != 32)) { rfbLog("%s: client bits per pixel not 8, 16 or 32\n", "rfbSetTranslateFunction"); rfbCloseSock(cl->sock); return FALSE; } if (!rfbServerFormat.trueColour && (rfbServerFormat.bitsPerPixel != 8)) { rfbLog("rfbSetTranslateFunction: server has colour map " "but %d-bit - can only cope with 8-bit colour maps\n", rfbServerFormat.bitsPerPixel); rfbCloseSock(cl->sock); return FALSE; } if (!cl->format.trueColour && (cl->format.bitsPerPixel != 8)) { rfbLog("rfbSetTranslateFunction: client has colour map " "but %d-bit - can only cope with 8-bit colour maps\n", cl->format.bitsPerPixel); rfbCloseSock(cl->sock); return FALSE; } /* * bpp is valid, now work out how to translate */ if (!cl->format.trueColour) { /* ? -> colour map */ if (!rfbServerFormat.trueColour) { /* colour map -> colour map */ rfbLog("rfbSetTranslateFunction: both 8-bit colour map: " "no translation needed\n"); cl->translateFn = rfbTranslateNone; return rfbSetClientColourMap(cl, 0, 0); } /* * truecolour -> colour map * * Set client's colour map to BGR233, then effectively it's * truecolour as well */ if (!rfbSetClientColourMapBGR233(cl)) return FALSE; cl->format = BGR233Format; } /* ? -> truecolour */ if (!rfbServerFormat.trueColour) { /* colour map -> truecolour */ rfbLog("rfbSetTranslateFunction: client is %d-bit trueColour," " server has colour map\n",cl->format.bitsPerPixel); cl->translateFn = rfbTranslateWithSingleTableFns [rfbServerFormat.bitsPerPixel / 16] [cl->format.bitsPerPixel / 16]; return rfbSetClientColourMap(cl, 0, 0); } /* truecolour -> truecolour */ if (PF_EQ(cl->format,rfbServerFormat)) { /* client & server the same */ rfbLog(" no translation needed\n"); cl->translateFn = rfbTranslateNone; return TRUE; } if ((rfbServerFormat.bitsPerPixel < 16) || (!rfbEconomicTranslate && (rfbServerFormat.bitsPerPixel == 16))) { /* we can use a single lookup table for <= 16 bpp */ cl->translateFn = rfbTranslateWithSingleTableFns [rfbServerFormat.bitsPerPixel / 16] [cl->format.bitsPerPixel / 16]; (*rfbInitTrueColourSingleTableFns [cl->format.bitsPerPixel / 16]) (&cl->translateLookupTable, &rfbServerFormat, &cl->format); } else { /* otherwise we use three separate tables for red, green and blue */ cl->translateFn = rfbTranslateWithRGBTablesFns [rfbServerFormat.bitsPerPixel / 16] [cl->format.bitsPerPixel / 16]; (*rfbInitTrueColourRGBTablesFns [cl->format.bitsPerPixel / 16]) (&cl->translateLookupTable, &rfbServerFormat, &cl->format); } return TRUE; } /* * rfbSetClientColourMapBGR233 sets the client's colour map so that it's * just like an 8-bit BGR233 true colour client. */ static Bool rfbSetClientColourMapBGR233(cl) rfbClientPtr cl; { char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2]; rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf; CARD16 *rgb = (CARD16 *)(&buf[sz_rfbSetColourMapEntriesMsg]); int i, len; int r, g, b; if (cl->format.bitsPerPixel != 8) { rfbLog("%s: client not 8 bits per pixel\n", "rfbSetClientColourMapBGR233"); rfbCloseSock(cl->sock); return FALSE; } scme->type = rfbSetColourMapEntries; scme->firstColour = Swap16IfLE(0); scme->nColours = Swap16IfLE(256); len = sz_rfbSetColourMapEntriesMsg; i = 0; for (b = 0; b < 4; b++) { for (g = 0; g < 8; g++) { for (r = 0; r < 8; r++) { rgb[i++] = Swap16IfLE(r * 65535 / 7); rgb[i++] = Swap16IfLE(g * 65535 / 7); rgb[i++] = Swap16IfLE(b * 65535 / 3); } } } len += 256 * 3 * 2; if (WriteExact(cl->sock, buf, len) < 0) { rfbLogPerror("rfbSetClientColourMapBGR233: write"); rfbCloseSock(cl->sock); return FALSE; } return TRUE; } /* * rfbSetClientColourMap is called to set the client's colour map. If the * client is a true colour client, we simply update our own translation table * and mark the whole screen as having been modified. */ Bool rfbSetClientColourMap(cl, firstColour, nColours) rfbClientPtr cl; int firstColour; int nColours; { EntryPtr pent; int i, r, g, b; BoxRec box; if (nColours == 0) { nColours = rfbInstalledColormap->pVisual->ColormapEntries; } if (rfbServerFormat.trueColour || !cl->readyForSetColourMapEntries) { return TRUE; } if (cl->format.trueColour) { (*rfbInitColourMapSingleTableFns [cl->format.bitsPerPixel / 16]) (&cl->translateLookupTable, &rfbServerFormat, &cl->format); REGION_UNINIT(pScreen,&cl->modifiedRegion); box.x1 = box.y1 = 0; box.x2 = rfbScreen.width; box.y2 = rfbScreen.height; REGION_INIT(pScreen,&cl->modifiedRegion,&box,0); return TRUE; } return rfbSendSetColourMapEntries(cl, firstColour, nColours); } /* * rfbSetClientColourMaps sets the colour map for each RFB client. */ void rfbSetClientColourMaps(firstColour, nColours) int firstColour; int nColours; { rfbClientPtr cl, nextCl; for (cl = rfbClientHead; cl; cl = nextCl) { nextCl = cl->next; rfbSetClientColourMap(cl, firstColour, nColours); } } static void PrintPixelFormat(pf) rfbPixelFormat *pf; { if (pf->bitsPerPixel == 1) { rfbLog(" 1 bpp, %s sig bit in each byte is leftmost on the screen.\n", (pf->bigEndian ? "most" : "least")); } else { rfbLog(" %d bpp, depth %d%s\n",pf->bitsPerPixel,pf->depth, ((pf->bitsPerPixel == 8) ? "" : (pf->bigEndian ? ", big endian" : ", little endian"))); if (pf->trueColour) { rfbLog(" true colour: max r %d g %d b %d, shift r %d g %d b %d\n", pf->redMax, pf->greenMax, pf->blueMax, pf->redShift, pf->greenShift, pf->blueShift); } else { rfbLog(" uses a colour map (not true colour).\n"); } } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/rre.c0100664000076400007640000002223007120677563021052 0ustar constconst/* * rre.c * * Routines to implement Rise-and-Run-length Encoding (RRE). This * code is based on krw's original javatel rfbserver. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include "rfb.h" /* * rreBeforeBuf contains pixel data in the client's format. * rreAfterBuf contains the RRE encoded version. If the RRE encoded version is * larger than the raw data or if it exceeds rreAfterBufSize then * raw encoding is used instead. */ static int rreBeforeBufSize = 0; static char *rreBeforeBuf = NULL; static int rreAfterBufSize = 0; static char *rreAfterBuf = NULL; static int rreAfterBufLen; static int subrectEncode8(CARD8 *data, int w, int h); static int subrectEncode16(CARD16 *data, int w, int h); static int subrectEncode32(CARD32 *data, int w, int h); static CARD32 getBgColour(char *data, int size, int bpp); /* * rfbSendRectEncodingRRE - send a given rectangle using RRE encoding. */ Bool rfbSendRectEncodingRRE(cl, x, y, w, h) rfbClientPtr cl; int x, y, w, h; { rfbFramebufferUpdateRectHeader rect; rfbRREHeader hdr; int nSubrects; int i; char *fbptr = (rfbScreen.pfbMemory + (rfbScreen.paddedWidthInBytes * y) + (x * (rfbScreen.bitsPerPixel / 8))); int maxRawSize = (rfbScreen.width * rfbScreen.height * (cl->format.bitsPerPixel / 8)); if (rreBeforeBufSize < maxRawSize) { rreBeforeBufSize = maxRawSize; if (rreBeforeBuf == NULL) rreBeforeBuf = (char *)xalloc(rreBeforeBufSize); else rreBeforeBuf = (char *)xrealloc(rreBeforeBuf, rreBeforeBufSize); } if (rreAfterBufSize < maxRawSize) { rreAfterBufSize = maxRawSize; if (rreAfterBuf == NULL) rreAfterBuf = (char *)xalloc(rreAfterBufSize); else rreAfterBuf = (char *)xrealloc(rreAfterBuf, rreAfterBufSize); } (*cl->translateFn)(cl->translateLookupTable, &rfbServerFormat, &cl->format, fbptr, rreBeforeBuf, rfbScreen.paddedWidthInBytes, w, h); switch (cl->format.bitsPerPixel) { case 8: nSubrects = subrectEncode8((CARD8 *)rreBeforeBuf, w, h); break; case 16: nSubrects = subrectEncode16((CARD16 *)rreBeforeBuf, w, h); break; case 32: nSubrects = subrectEncode32((CARD32 *)rreBeforeBuf, w, h); break; default: rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel); exit(1); } if (nSubrects < 0) { /* RRE encoding was too large, use raw */ return rfbSendRectEncodingRaw(cl, x, y, w, h); } cl->rfbRectanglesSent[rfbEncodingRRE]++; cl->rfbBytesSent[rfbEncodingRRE] += (sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + rreAfterBufLen); if (ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader > UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } rect.r.x = Swap16IfLE(x); rect.r.y = Swap16IfLE(y); rect.r.w = Swap16IfLE(w); rect.r.h = Swap16IfLE(h); rect.encoding = Swap32IfLE(rfbEncodingRRE); memcpy(&updateBuf[ublen], (char *)&rect, sz_rfbFramebufferUpdateRectHeader); ublen += sz_rfbFramebufferUpdateRectHeader; hdr.nSubrects = Swap32IfLE(nSubrects); memcpy(&updateBuf[ublen], (char *)&hdr, sz_rfbRREHeader); ublen += sz_rfbRREHeader; for (i = 0; i < rreAfterBufLen;) { int bytesToCopy = UPDATE_BUF_SIZE - ublen; if (i + bytesToCopy > rreAfterBufLen) { bytesToCopy = rreAfterBufLen - i; } memcpy(&updateBuf[ublen], &rreAfterBuf[i], bytesToCopy); ublen += bytesToCopy; i += bytesToCopy; if (ublen == UPDATE_BUF_SIZE) { if (!rfbSendUpdateBuf(cl)) return FALSE; } } return TRUE; } /* * subrectEncode() encodes the given multicoloured rectangle as a background * colour overwritten by single-coloured rectangles. It returns the number * of subrectangles in the encoded buffer, or -1 if subrect encoding won't * fit in the buffer. It puts the encoded rectangles in rreAfterBuf. The * single-colour rectangle partition is not optimal, but does find the biggest * horizontal or vertical rectangle top-left anchored to each consecutive * coordinate position. * * The coding scheme is simply [...] where each * is []. */ #define DEFINE_SUBRECT_ENCODE(bpp) \ static int \ subrectEncode##bpp(data,w,h) \ CARD##bpp *data; \ int w; \ int h; \ { \ CARD##bpp cl; \ rfbRectangle subrect; \ int x,y; \ int i,j; \ int hx=0,hy,vx=0,vy; \ int hyflag; \ CARD##bpp *seg; \ CARD##bpp *line; \ int hw,hh,vw,vh; \ int thex,they,thew,theh; \ int numsubs = 0; \ int newLen; \ CARD##bpp bg = (CARD##bpp)getBgColour((char*)data,w*h,bpp); \ \ *((CARD##bpp*)rreAfterBuf) = bg; \ \ rreAfterBufLen = (bpp/8); \ \ for (y=0; y 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \ } \ vy = j-1; \ \ /* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \ * We'll choose the bigger of the two. \ */ \ hw = hx-x+1; \ hh = hy-y+1; \ vw = vx-x+1; \ vh = vy-y+1; \ \ thex = x; \ they = y; \ \ if ((hw*hh) > (vw*vh)) { \ thew = hw; \ theh = hh; \ } else { \ thew = vw; \ theh = vh; \ } \ \ subrect.x = Swap16IfLE(thex); \ subrect.y = Swap16IfLE(they); \ subrect.w = Swap16IfLE(thew); \ subrect.h = Swap16IfLE(theh); \ \ newLen = rreAfterBufLen + (bpp/8) + sz_rfbRectangle; \ if ((newLen > (w * h * (bpp/8))) || (newLen > rreAfterBufSize)) \ return -1; \ \ numsubs += 1; \ *((CARD##bpp*)(rreAfterBuf + rreAfterBufLen)) = cl; \ rreAfterBufLen += (bpp/8); \ memcpy(&rreAfterBuf[rreAfterBufLen],&subrect,sz_rfbRectangle); \ rreAfterBufLen += sz_rfbRectangle; \ \ /* \ * Now mark the subrect as done. \ */ \ for (j=they; j < (they+theh); j++) { \ for (i=thex; i < (thex+thew); i++) { \ data[j*w+i] = bg; \ } \ } \ } \ } \ } \ \ return numsubs; \ } DEFINE_SUBRECT_ENCODE(8) DEFINE_SUBRECT_ENCODE(16) DEFINE_SUBRECT_ENCODE(32) /* * getBgColour() gets the most prevalent colour in a byte array. */ static CARD32 getBgColour(data,size,bpp) char *data; int size; int bpp; { #define NUMCLRS 256 static int counts[NUMCLRS]; int i,j,k; int maxcount = 0; CARD8 maxclr = 0; if (bpp != 8) { if (bpp == 16) { return ((CARD16 *)data)[0]; } else if (bpp == 32) { return ((CARD32 *)data)[0]; } else { rfbLog("getBgColour: bpp %d?\n",bpp); exit(1); } } for (i=0; i= NUMCLRS) { rfbLog("getBgColour: unusual colour = %d\n", k); exit(1); } counts[k] += 1; if (counts[k] > maxcount) { maxcount = counts[k]; maxclr = ((CARD8 *)data)[j]; } } return maxclr; } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/tableinitcmtemplate.c0100664000076400007640000000504407120677563024315 0ustar constconst/* * tableinitcmtemplate.c - template for initialising lookup tables for * translation from a colour map to true colour. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with a different definition of the macro OUT. * For each value of OUT, this file defines a function which allocates an * appropriately sized lookup table and initialises it. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define OUT_T CONCAT2E(CARD,OUT) #define SwapOUT(x) CONCAT2E(Swap,OUT(x)) #define rfbInitColourMapSingleTableOUT \ CONCAT2E(rfbInitColourMapSingleTable,OUT) static void rfbInitColourMapSingleTableOUT (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { int i, r, g, b; OUT_T *t; EntryPtr pent; int nEntries = 1 << in->bitsPerPixel; if (*table) free(*table); *table = (char *)malloc(nEntries * sizeof(OUT_T)); t = (OUT_T *)*table; pent = (EntryPtr)&rfbInstalledColormap->red[0]; for (i = 0; i < nEntries; i++) { if (pent->fShared) { r = pent->co.shco.red->color; g = pent->co.shco.green->color; b = pent->co.shco.blue->color; } else { r = pent->co.local.red; g = pent->co.local.green; b = pent->co.local.blue; } t[i] = ((((r * out->redMax + 32767) / 65535) << out->redShift) | (((g * out->greenMax + 32767) / 65535) << out->greenShift) | (((b * out->blueMax + 32767) / 65535) << out->blueShift)); #if (OUT != 8) if (out->bigEndian != in->bigEndian) { t[i] = SwapOUT(t[i]); } #endif pent++; } } #undef OUT_T #undef SwapOUT #undef rfbInitColourMapSingleTableOUT vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/draw.c0100664000076400007640000013546507176101667021234 0ustar constconst/* * draw.c - drawing routines for the RFB X server. This is a set of * wrappers around the standard MI/MFB/CFB drawing routines which work out * to a fair approximation the region of the screen being modified by the * drawing. If the RFB client is ready then the modified region of the screen * is sent to the client, otherwise the modified region will simply grow with * each drawing request until the client is ready. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ /* Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include #include "scrnintstr.h" #include "gcstruct.h" #include "windowstr.h" #include "regionstr.h" #include "dixfontstr.h" #include "rfb.h" #include "mfb.h" extern WindowPtr *WindowTable; /* Why isn't this in a header file? */ int rfbDeferUpdateTime = 40; /* ms */ /****************************************************************************/ /* * Macro definitions */ /****************************************************************************/ /* SLIGHTLY DIRTY HACK - use Composite Clip region calculated by mfb */ #define WINDOW_CLIP_REGION(_w, _gc) \ (((mfbPrivGCPtr)((_gc)->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip) #define TRC(x) /* (fprintf x) */ /* ADD_TO_MODIFIED_REGION adds the given region to the modified region for each client */ #define ADD_TO_MODIFIED_REGION(pScreen,reg) \ { \ rfbClientPtr cl; \ for (cl = rfbClientHead; cl; cl = cl->next) { \ REGION_UNION((pScreen),&cl->modifiedRegion,&cl->modifiedRegion,reg);\ } \ } /* SCHEDULE_FB_UPDATE is used at the end of each drawing routine to schedule an update to be sent to each client if there is one pending and the client is ready for it. */ #define SCHEDULE_FB_UPDATE(pScreen,prfb) \ if (!prfb->dontSendFramebufferUpdate) { \ rfbClientPtr cl, nextCl; \ for (cl = rfbClientHead; cl; cl = nextCl) { \ nextCl = cl->next; \ if (!cl->deferredUpdateScheduled && FB_UPDATE_PENDING(cl) && \ REGION_NOTEMPTY(pScreen,&cl->requestedRegion)) \ { \ rfbScheduleDeferredUpdate(cl); \ } \ } \ } /* function prototypes */ static void rfbScheduleDeferredUpdate(rfbClientPtr cl); static void rfbCopyRegion(ScreenPtr pScreen, rfbClientPtr cl, RegionPtr src, RegionPtr dst, int dx, int dy); static void PrintRegion(ScreenPtr pScreen, RegionPtr reg); /* GC funcs */ static void rfbValidateGC(GCPtr, unsigned long /*changes*/, DrawablePtr); static void rfbChangeGC(GCPtr, unsigned long /*mask*/); static void rfbCopyGC(GCPtr /*src*/, unsigned long /*mask*/, GCPtr /*dst*/); static void rfbDestroyGC(GCPtr); static void rfbChangeClip(GCPtr, int /*type*/, pointer /*pValue*/, int /*nrects*/); static void rfbDestroyClip(GCPtr); static void rfbCopyClip(GCPtr /*dst*/, GCPtr /*src*/); /* GC ops */ static void rfbFillSpans(); static void rfbSetSpans(); static void rfbPutImage(); static RegionPtr rfbCopyArea(); static RegionPtr rfbCopyPlane(); static void rfbPolyPoint(); static void rfbPolylines(); static void rfbPolySegment(); static void rfbPolyRectangle(); static void rfbPolyArc(); static void rfbFillPolygon(); static void rfbPolyFillRect(); static void rfbPolyFillArc(); static int rfbPolyText8(); static int rfbPolyText16(); static void rfbImageText8(); static void rfbImageText16(); static void rfbImageGlyphBlt(); static void rfbPolyGlyphBlt(); static void rfbPushPixels(); static GCFuncs rfbGCFuncs = { rfbValidateGC, rfbChangeGC, rfbCopyGC, rfbDestroyGC, rfbChangeClip, rfbDestroyClip, rfbCopyClip, }; static GCOps rfbGCOps = { rfbFillSpans, rfbSetSpans, rfbPutImage, rfbCopyArea, rfbCopyPlane, rfbPolyPoint, rfbPolylines, rfbPolySegment, rfbPolyRectangle, rfbPolyArc, rfbFillPolygon, rfbPolyFillRect, rfbPolyFillArc, rfbPolyText8, rfbPolyText16, rfbImageText8, rfbImageText16, rfbImageGlyphBlt, rfbPolyGlyphBlt, rfbPushPixels }; /****************************************************************************/ /* * Screen functions wrapper stuff */ /****************************************************************************/ #define SCREEN_PROLOGUE(scrn, field) \ ScreenPtr pScreen = scrn; \ rfbScreenInfoPtr prfb = &rfbScreen; \ pScreen->field = prfb->field; #define SCREEN_EPILOGUE(field, wrapper) \ pScreen->field = wrapper; /* * CloseScreen wrapper -- unwrap everything, free the private data * and call the wrapped CloseScreen function. */ Bool rfbCloseScreen (i, pScreen) int i; ScreenPtr pScreen; { rfbScreenInfoPtr prfb = &rfbScreen; pScreen->CloseScreen = prfb->CloseScreen; pScreen->CreateGC = prfb->CreateGC; pScreen->PaintWindowBackground = prfb->PaintWindowBackground; pScreen->PaintWindowBorder = prfb->PaintWindowBorder; pScreen->CopyWindow = prfb->CopyWindow; pScreen->ClearToBackground = prfb->ClearToBackground; pScreen->RestoreAreas = prfb->RestoreAreas; TRC((stderr,"Unwrapped screen functions\n")); return (*pScreen->CloseScreen) (i, pScreen); } /* * CreateGC - wrap the GC funcs (the GC ops will be wrapped when the GC * func "ValidateGC" is called). */ Bool rfbCreateGC (pGC) GCPtr pGC; { Bool ret; rfbGCPtr pGCPriv; SCREEN_PROLOGUE(pGC->pScreen,CreateGC); pGCPriv = (rfbGCPtr)pGC->devPrivates[rfbGCIndex].ptr; ret = (*pScreen->CreateGC) (pGC); TRC((stderr,"rfbCreateGC called\n")); pGCPriv->wrapOps = NULL; pGCPriv->wrapFuncs = pGC->funcs; pGC->funcs = &rfbGCFuncs; SCREEN_EPILOGUE(CreateGC,rfbCreateGC); return ret; } /* * PaintWindowBackground - the region being modified is just the given region. */ void rfbPaintWindowBackground (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { SCREEN_PROLOGUE(pWin->drawable.pScreen,PaintWindowBackground); TRC((stderr,"rfbPaintWindowBackground called\n")); ADD_TO_MODIFIED_REGION(pScreen,pRegion); (*pScreen->PaintWindowBackground) (pWin, pRegion, what); SCHEDULE_FB_UPDATE(pScreen, prfb); SCREEN_EPILOGUE(PaintWindowBackground,rfbPaintWindowBackground); } /* * PaintWindowBorder - the region being modified is just the given region. */ void rfbPaintWindowBorder (pWin, pRegion, what) WindowPtr pWin; RegionPtr pRegion; int what; { SCREEN_PROLOGUE(pWin->drawable.pScreen,PaintWindowBorder); TRC((stderr,"rfbPaintWindowBorder called\n")); ADD_TO_MODIFIED_REGION(pScreen,pRegion); (*pScreen->PaintWindowBorder) (pWin, pRegion, what); SCHEDULE_FB_UPDATE(pScreen, prfb); SCREEN_EPILOGUE(PaintWindowBorder,rfbPaintWindowBorder); } /* * CopyWindow - the region being modified is the translation of the old * region, clipped to the border clip region of the window. Note that any * parts of the window which have become newly-visible will not be affected by * this call - a separate PaintWindowBackground/Border will be called to do * that. If the client will accept CopyRect messages then use rfbCopyRegion to * optimise the pending screen changes into a single "copy region" plus the * ordinary modified region. */ void rfbCopyWindow (pWin, ptOldOrg, pOldRegion) WindowPtr pWin; DDXPointRec ptOldOrg; RegionPtr pOldRegion; { rfbClientPtr cl; RegionRec srcRegion, dstRegion; SCREEN_PROLOGUE(pWin->drawable.pScreen,CopyWindow); TRC((stderr,"rfbCopyWindow called\n")); REGION_INIT(pScreen,&dstRegion,NullBox,0); REGION_COPY(pScreen,&dstRegion,pOldRegion); REGION_TRANSLATE(pWin->drawable.pScreen, &dstRegion, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); REGION_INTERSECT(pWin->drawable.pScreen, &dstRegion, &dstRegion, &pWin->borderClip); for (cl = rfbClientHead; cl; cl = cl->next) { if (cl->useCopyRect) { REGION_INIT(pScreen,&srcRegion,NullBox,0); REGION_COPY(pScreen,&srcRegion,pOldRegion); rfbCopyRegion(pScreen, cl, &srcRegion, &dstRegion, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); REGION_UNINIT(pSrc->pScreen, &srcRegion); } else { REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &dstRegion); } } REGION_UNINIT(pSrc->pScreen, &dstRegion); (*pScreen->CopyWindow) (pWin, ptOldOrg, pOldRegion); SCHEDULE_FB_UPDATE(pScreen, prfb); SCREEN_EPILOGUE(CopyWindow,rfbCopyWindow); } /* * ClearToBackground - when generateExposures is false, the region being * modified is the given rectangle (clipped to the "window clip region"). */ void rfbClearToBackground (pWin, x, y, w, h, generateExposures) WindowPtr pWin; int x,y,w,h; Bool generateExposures; { RegionRec tmpRegion; BoxRec box; SCREEN_PROLOGUE(pWin->drawable.pScreen,ClearToBackground); TRC((stderr,"rfbClearToBackground called\n")); if (!generateExposures) { box.x1 = x + pWin->drawable.x; box.y1 = y + pWin->drawable.y; box.x2 = w ? (box.x1 + w) : (pWin->drawable.x + pWin->drawable.width); box.y2 = h ? (box.y1 + h) : (pWin->drawable.y + pWin->drawable.height); SAFE_REGION_INIT(pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pScreen, &tmpRegion, &tmpRegion, &pWin->clipList); ADD_TO_MODIFIED_REGION(pScreen, &tmpRegion); REGION_UNINIT(pScreen, &tmpRegion); } (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); if (!generateExposures) { SCHEDULE_FB_UPDATE(pScreen, prfb); } SCREEN_EPILOGUE(ClearToBackground,rfbClearToBackground); } /* * RestoreAreas - just be safe here - the region being modified is the whole * exposed region. */ RegionPtr rfbRestoreAreas (pWin, prgnExposed) WindowPtr pWin; RegionPtr prgnExposed; { RegionPtr result; SCREEN_PROLOGUE(pWin->drawable.pScreen,RestoreAreas); TRC((stderr,"rfbRestoreAreas called\n")); ADD_TO_MODIFIED_REGION(pScreen, prgnExposed); result = (*pScreen->RestoreAreas) (pWin, prgnExposed); SCHEDULE_FB_UPDATE(pScreen, prfb); SCREEN_EPILOGUE(RestoreAreas,rfbRestoreAreas); return result; } /****************************************************************************/ /* * GC funcs wrapper stuff * * We only really want to wrap the GC ops, but to do this we need to wrap * ValidateGC and so all the other GC funcs must be wrapped as well. */ /****************************************************************************/ #define GC_FUNC_PROLOGUE(pGC) \ rfbGCPtr pGCPriv = (rfbGCPtr) (pGC)->devPrivates[rfbGCIndex].ptr; \ (pGC)->funcs = pGCPriv->wrapFuncs; \ if (pGCPriv->wrapOps) \ (pGC)->ops = pGCPriv->wrapOps; #define GC_FUNC_EPILOGUE(pGC) \ pGCPriv->wrapFuncs = (pGC)->funcs; \ (pGC)->funcs = &rfbGCFuncs; \ if (pGCPriv->wrapOps) { \ pGCPriv->wrapOps = (pGC)->ops; \ (pGC)->ops = &rfbGCOps; \ } /* * ValidateGC - call the wrapped ValidateGC, then wrap the resulting GC ops if * the drawing will be to a viewable window. */ static void rfbValidateGC (pGC, changes, pDrawable) GCPtr pGC; unsigned long changes; DrawablePtr pDrawable; { GC_FUNC_PROLOGUE(pGC); TRC((stderr,"rfbValidateGC called\n")); (*pGC->funcs->ValidateGC) (pGC, changes, pDrawable); pGCPriv->wrapOps = NULL; if (pDrawable->type == DRAWABLE_WINDOW && ((WindowPtr)pDrawable)->viewable) { WindowPtr pWin = (WindowPtr) pDrawable; RegionPtr pRegion = &pWin->clipList; if (pGC->subWindowMode == IncludeInferiors) pRegion = &pWin->borderClip; if (REGION_NOTEMPTY(pDrawable->pScreen, pRegion)) { pGCPriv->wrapOps = pGC->ops; TRC((stderr,"rfbValidateGC: wrapped GC ops\n")); } } GC_FUNC_EPILOGUE(pGC); } /* * All other GC funcs simply unwrap the GC funcs and ops, call the wrapped * function and then rewrap the funcs and ops. */ static void rfbChangeGC (pGC, mask) GCPtr pGC; unsigned long mask; { GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ChangeGC) (pGC, mask); GC_FUNC_EPILOGUE(pGC); } static void rfbCopyGC (pGCSrc, mask, pGCDst) GCPtr pGCSrc, pGCDst; unsigned long mask; { GC_FUNC_PROLOGUE(pGCDst); (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); GC_FUNC_EPILOGUE(pGCDst); } static void rfbDestroyGC (pGC) GCPtr pGC; { GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->DestroyGC) (pGC); GC_FUNC_EPILOGUE(pGC); } static void rfbChangeClip (pGC, type, pvalue, nrects) GCPtr pGC; int type; pointer pvalue; int nrects; { GC_FUNC_PROLOGUE(pGC); (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); GC_FUNC_EPILOGUE(pGC); } static void rfbDestroyClip(pGC) GCPtr pGC; { GC_FUNC_PROLOGUE(pGC); (* pGC->funcs->DestroyClip)(pGC); GC_FUNC_EPILOGUE(pGC); } static void rfbCopyClip(pgcDst, pgcSrc) GCPtr pgcDst, pgcSrc; { GC_FUNC_PROLOGUE(pgcDst); (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); GC_FUNC_EPILOGUE(pgcDst); } /****************************************************************************/ /* * GC ops wrapper stuff * * Note that these routines will only have been wrapped for drawing to * viewable windows so we don't need to check each time that the drawable * is a viewable window. */ /****************************************************************************/ #define GC_OP_PROLOGUE(pDrawable,pGC) \ rfbScreenInfoPtr prfb = &rfbScreen; \ rfbGCPtr pGCPrivate = (rfbGCPtr) (pGC)->devPrivates[rfbGCIndex].ptr; \ GCFuncs *oldFuncs = pGC->funcs; \ (pGC)->funcs = pGCPrivate->wrapFuncs; \ (pGC)->ops = pGCPrivate->wrapOps; #define GC_OP_EPILOGUE(pGC) \ pGCPrivate->wrapOps = (pGC)->ops; \ (pGC)->funcs = oldFuncs; \ (pGC)->ops = &rfbGCOps; /* * FillSpans - being very safe - the region being modified is the border clip * region of the window. */ static void rfbFillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) DrawablePtr pDrawable; GCPtr pGC; int nInit; /* number of spans to fill */ DDXPointPtr pptInit; /* pointer to list of start points */ int *pwidthInit; /* pointer to list of n widths */ int fSorted; { GC_OP_PROLOGUE(pDrawable,pGC); TRC((stderr,"rfbFillSpans called\n")); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &((WindowPtr)pDrawable)->borderClip); (*pGC->ops->FillSpans) (pDrawable, pGC, nInit, pptInit,pwidthInit,fSorted); SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); GC_OP_EPILOGUE(pGC); } /* * SetSpans - being very safe - the region being modified is the border clip * region of the window. */ static void rfbSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted) DrawablePtr pDrawable; GCPtr pGC; char *psrc; register DDXPointPtr ppt; int *pwidth; int nspans; int fSorted; { GC_OP_PROLOGUE(pDrawable,pGC); TRC((stderr,"rfbSetSpans called\n")); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &((WindowPtr)pDrawable)->borderClip); (*pGC->ops->SetSpans) (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); GC_OP_EPILOGUE(pGC); } /* * PutImage - the region being modified is the rectangle of the * PutImage (clipped to the window clip region). */ static void rfbPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits) DrawablePtr pDrawable; GCPtr pGC; int depth; int x; int y; int w; int h; int leftPad; int format; char *pBits; { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPutImage called\n")); box.x1 = x + pDrawable->x; box.y1 = y + pDrawable->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, pBits); SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); GC_OP_EPILOGUE(pGC); } /* * CopyArea - the region being modified is the destination rectangle (clipped * to the window clip region). * If the client will accept CopyRect messages then use rfbCopyRegion * to optimise the pending screen changes into a single "copy region" plus * the ordinary modified region. */ static RegionPtr rfbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty) DrawablePtr pSrc; DrawablePtr pDst; GCPtr pGC; int srcx; int srcy; int w; int h; int dstx; int dsty; { rfbClientPtr cl; RegionPtr rgn; RegionRec srcRegion, dstRegion; BoxRec box; GC_OP_PROLOGUE(pDst, pGC); TRC((stderr,"rfbCopyArea called\n")); box.x1 = dstx + pDst->x; box.y1 = dsty + pDst->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; SAFE_REGION_INIT(pDst->pScreen, &dstRegion, &box, 0); REGION_INTERSECT(pDst->pScreen, &dstRegion, &dstRegion, WINDOW_CLIP_REGION((WindowPtr)pDst,pGC)); if ((pSrc->type == DRAWABLE_WINDOW) && (pSrc->pScreen == pDst->pScreen)) { box.x1 = srcx + pSrc->x; box.y1 = srcy + pSrc->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; for (cl = rfbClientHead; cl; cl = cl->next) { if (cl->useCopyRect) { SAFE_REGION_INIT(pSrc->pScreen, &srcRegion, &box, 0); REGION_INTERSECT(pSrc->pScreen, &srcRegion, &srcRegion, &((WindowPtr)pSrc)->clipList); rfbCopyRegion(pSrc->pScreen, cl, &srcRegion, &dstRegion, dstx + pDst->x - srcx - pSrc->x, dsty + pDst->y - srcy - pSrc->y); REGION_UNINIT(pSrc->pScreen, &srcRegion); } else { REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &dstRegion); } } } else { ADD_TO_MODIFIED_REGION(pDst->pScreen, &dstRegion); } REGION_UNINIT(pDst->pScreen, &dstRegion); rgn = (*pGC->ops->CopyArea) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); SCHEDULE_FB_UPDATE(pDst->pScreen, prfb); GC_OP_EPILOGUE(pGC); return rgn; } /* * CopyPlane - the region being modified is the destination rectangle (clipped * to the window clip region). */ static RegionPtr rfbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane) DrawablePtr pSrc; DrawablePtr pDst; register GCPtr pGC; int srcx, srcy; int w, h; int dstx, dsty; unsigned long plane; { RegionPtr rgn; RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDst, pGC); TRC((stderr,"rfbCopyPlane called\n")); box.x1 = dstx + pDst->x; box.y1 = dsty + pDst->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; SAFE_REGION_INIT(pDst->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDst->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDst,pGC)); ADD_TO_MODIFIED_REGION(pDst->pScreen, &tmpRegion); REGION_UNINIT(pDst->pScreen, &tmpRegion); rgn = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane); SCHEDULE_FB_UPDATE(pDst->pScreen, prfb); GC_OP_EPILOGUE(pGC); return rgn; } /* * PolyPoint - find the smallest rectangle which encloses the points drawn * (and clip). */ static void rfbPolyPoint (pDrawable, pGC, mode, npt, pts) DrawablePtr pDrawable; GCPtr pGC; int mode; /* Origin or Previous */ int npt; xPoint *pts; { int i; RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyPoint called\n")); if (npt) { int minX = pts[0].x, maxX = pts[0].x; int minY = pts[0].y, maxY = pts[0].y; if (mode == CoordModePrevious) { int x = pts[0].x, y = pts[0].y; for (i = 1; i < npt; i++) { x += pts[i].x; y += pts[i].y; if (x < minX) minX = x; if (x > maxX) maxX = x; if (y < minY) minY = y; if (y > maxY) maxY = y; } } else { for (i = 1; i < npt; i++) { if (pts[i].x < minX) minX = pts[i].x; if (pts[i].x > maxX) maxX = pts[i].x; if (pts[i].y < minY) minY = pts[i].y; if (pts[i].y > maxY) maxY = pts[i].y; } } box.x1 = minX + pDrawable->x; box.y1 = minY + pDrawable->y; box.x2 = maxX + 1 + pDrawable->x; box.y2 = maxY + 1 + pDrawable->y; SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pts); if (npt) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyLines - take the union of bounding boxes around each line (and clip). */ static void rfbPolylines (pDrawable, pGC, mode, npt, ppts) DrawablePtr pDrawable; GCPtr pGC; int mode; int npt; DDXPointPtr ppts; { RegionPtr tmpRegion; xRectangle *rects; int i, extra, nlines, lw; int x1, x2, y1, y2; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolylines called\n")); if (npt) { lw = pGC->lineWidth; if (lw == 0) lw = 1; if (npt == 1) { nlines = 1; rects = (xRectangle *)xalloc(sizeof(xRectangle)); if (!rects) { FatalError("rfbPolylines: xalloc failed\n"); } rects[0].x = ppts[0].x - lw + pDrawable->x; /* being safe here */ rects[0].y = ppts[0].y - lw + pDrawable->y; rects[0].width = 2*lw; rects[0].height = 2*lw; } else { nlines = npt - 1; rects = (xRectangle *)xalloc(nlines*sizeof(xRectangle)); if (!rects) { FatalError("rfbPolylines: xalloc failed\n"); } /* * mitered joins can project quite a way from * the line end; the 11 degree miter limit limits * this extension to lw / (2 * tan(11/2)), rounded up * and converted to int yields 6 * lw */ if (pGC->joinStyle == JoinMiter) { extra = 6 * lw; } else { extra = lw / 2; } x1 = ppts[0].x + pDrawable->x; y1 = ppts[0].y + pDrawable->y; for (i = 0; i < nlines; i++) { if (mode == CoordModeOrigin) { x2 = pDrawable->x + ppts[i+1].x; y2 = pDrawable->y + ppts[i+1].y; } else { x2 = x1 + ppts[i+1].x; y2 = y1 + ppts[i+1].y; } if (x1 > x2) { rects[i].x = x2 - extra; rects[i].width = x1 - x2 + 1 + 2 * extra; } else { rects[i].x = x1 - extra; rects[i].width = x2 - x1 + 1 + 2 * extra; } if (y1 > y2) { rects[i].y = y2 - extra; rects[i].height = y1 - y2 + 1 + 2 * extra; } else { rects[i].y = y1 - extra; rects[i].height = y2 - y1 + 1 + 2 * extra; } x1 = x2; y1 = y2; } } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, nlines, rects,CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)rects); } (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppts); if (npt) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolySegment - take the union of bounding boxes around each segment (and * clip). */ static void rfbPolySegment(pDrawable, pGC, nseg, segs) DrawablePtr pDrawable; GCPtr pGC; int nseg; xSegment *segs; { RegionPtr tmpRegion; xRectangle *rects; int i, extra, lw; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolySegment called\n")); if (nseg) { rects = (xRectangle *)xalloc(nseg*sizeof(xRectangle)); if (!rects) { FatalError("rfbPolySegment: xalloc failed\n"); } lw = pGC->lineWidth; if (lw == 0) lw = 1; extra = lw / 2; for (i = 0; i < nseg; i++) { if (segs[i].x1 > segs[i].x2) { rects[i].x = segs[i].x2 - extra + pDrawable->x; rects[i].width = segs[i].x1 - segs[i].x2 + 1 + 2 * extra; } else { rects[i].x = segs[i].x1 - extra + pDrawable->x; rects[i].width = segs[i].x2 - segs[i].x1 + 1 + 2 * extra; } if (segs[i].y1 > segs[i].y2) { rects[i].y = segs[i].y2 - extra + pDrawable->y; rects[i].height = segs[i].y1 - segs[i].y2 + 1 + 2 * extra; } else { rects[i].y = segs[i].y1 - extra + pDrawable->y; rects[i].height = segs[i].y2 - segs[i].y1 + 1 + 2 * extra; } } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, nseg, rects, CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)rects); } (*pGC->ops->PolySegment) (pDrawable, pGC, nseg, segs); if (nseg) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyRectangle (rectangle outlines) - take the union of bounding boxes * around each line (and clip). */ static void rfbPolyRectangle(pDrawable, pGC, nrects, rects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *rects; { int i, extra, lw; RegionPtr tmpRegion; xRectangle *regRects; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyRectangle called\n")); if (nrects) { regRects = (xRectangle *)xalloc(nrects*4*sizeof(xRectangle)); if (!regRects) { FatalError("rfbPolyRectangle: xalloc failed\n"); } lw = pGC->lineWidth; if (lw == 0) lw = 1; extra = lw / 2; for (i = 0; i < nrects; i++) { regRects[i*4].x = rects[i].x - extra + pDrawable->x; regRects[i*4].y = rects[i].y - extra + pDrawable->y; regRects[i*4].width = rects[i].width + 1 + 2 * extra; regRects[i*4].height = 1 + 2 * extra; regRects[i*4+1].x = rects[i].x - extra + pDrawable->x; regRects[i*4+1].y = rects[i].y - extra + pDrawable->y; regRects[i*4+1].width = 1 + 2 * extra; regRects[i*4+1].height = rects[i].height + 1 + 2 * extra; regRects[i*4+2].x = rects[i].x + rects[i].width - extra + pDrawable->x; regRects[i*4+2].y = rects[i].y - extra + pDrawable->y; regRects[i*4+2].width = 1 + 2 * extra; regRects[i*4+2].height = rects[i].height + 1 + 2 * extra; regRects[i*4+3].x = rects[i].x - extra + pDrawable->x; regRects[i*4+3].y = rects[i].y + rects[i].height - extra + pDrawable->y; regRects[i*4+3].width = rects[i].width + 1 + 2 * extra; regRects[i*4+3].height = 1 + 2 * extra; } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, nrects*4, regRects, CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)regRects); } (*pGC->ops->PolyRectangle) (pDrawable, pGC, nrects, rects); if (nrects) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyArc - take the union of bounding boxes around each arc (and clip). * Bounding boxes assume each is a full circle / ellipse. */ static void rfbPolyArc(pDrawable, pGC, narcs, arcs) DrawablePtr pDrawable; register GCPtr pGC; int narcs; xArc *arcs; { int i, extra, lw; RegionPtr tmpRegion; xRectangle *rects; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyArc called\n")); if (narcs) { rects = (xRectangle *)xalloc(narcs*sizeof(xRectangle)); if (!rects) { FatalError("rfbPolyArc: xalloc failed\n"); } lw = pGC->lineWidth; if (lw == 0) lw = 1; extra = lw / 2; for (i = 0; i < narcs; i++) { rects[i].x = arcs[i].x - extra + pDrawable->x; rects[i].y = arcs[i].y - extra + pDrawable->y; rects[i].width = arcs[i].width + lw; rects[i].height = arcs[i].height + lw; } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, narcs, rects, CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)rects); } (*pGC->ops->PolyArc) (pDrawable, pGC, narcs, arcs); if (narcs) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * FillPolygon - take bounding box around polygon (and clip). */ static void rfbFillPolygon(pDrawable, pGC, shape, mode, count, pts) register DrawablePtr pDrawable; register GCPtr pGC; int shape, mode; int count; DDXPointPtr pts; { int i; RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbFillPolygon called\n")); if (count) { int minX = pts[0].x, maxX = pts[0].x; int minY = pts[0].y, maxY = pts[0].y; if (mode == CoordModePrevious) { int x = pts[0].x, y = pts[0].y; for (i = 1; i < count; i++) { x += pts[i].x; y += pts[i].y; if (x < minX) minX = x; if (x > maxX) maxX = x; if (y < minY) minY = y; if (y > maxY) maxY = y; } } else { for (i = 1; i < count; i++) { if (pts[i].x < minX) minX = pts[i].x; if (pts[i].x > maxX) maxX = pts[i].x; if (pts[i].y < minY) minY = pts[i].y; if (pts[i].y > maxY) maxY = pts[i].y; } } box.x1 = minX + pDrawable->x; box.y1 = minY + pDrawable->y; box.x2 = maxX + 1 + pDrawable->x; box.y2 = maxY + 1 + pDrawable->y; SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts); if (count) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyFillRect - take the union of the given rectangles (and clip). */ static void rfbPolyFillRect(pDrawable, pGC, nrects, rects) DrawablePtr pDrawable; GCPtr pGC; int nrects; xRectangle *rects; { RegionPtr tmpRegion; xRectangle *regRects; int i; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyFillRect called\n")); if (nrects) { regRects = (xRectangle *)xalloc(nrects*sizeof(xRectangle)); if (!regRects) { FatalError("rfbPolyFillRect: xalloc failed\n"); } for (i = 0; i < nrects; i++) { regRects[i].x = rects[i].x + pDrawable->x; regRects[i].y = rects[i].y + pDrawable->y; regRects[i].width = rects[i].width; regRects[i].height = rects[i].height; } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, nrects, regRects, CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)regRects); } (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, rects); if (nrects) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyFillArc - take the union of bounding boxes around each arc (and clip). * Bounding boxes assume each is a full circle / ellipse. */ static void rfbPolyFillArc(pDrawable, pGC, narcs, arcs) DrawablePtr pDrawable; GCPtr pGC; int narcs; xArc *arcs; { int i, extra, lw; RegionPtr tmpRegion; xRectangle *rects; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyFillArc called\n")); if (narcs) { rects = (xRectangle *)xalloc(narcs*sizeof(xRectangle)); if (!rects) { FatalError("rfbPolyFillArc: xalloc failed\n"); } lw = pGC->lineWidth; if (lw == 0) lw = 1; extra = lw / 2; for (i = 0; i < narcs; i++) { rects[i].x = arcs[i].x - extra + pDrawable->x; rects[i].y = arcs[i].y - extra + pDrawable->y; rects[i].width = arcs[i].width + lw; rects[i].height = arcs[i].height + lw; } tmpRegion = RECTS_TO_REGION(pDrawable->pScreen, narcs, rects, CT_NONE); REGION_INTERSECT(pDrawable->pScreen, tmpRegion, tmpRegion, WINDOW_CLIP_REGION((WindowPtr)pDrawable,pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, tmpRegion); REGION_DESTROY(pDrawable->pScreen, tmpRegion); xfree((char *)rects); } (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, arcs); if (narcs) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * Get a rough bounding box around n characters of the given font. */ static void GetTextBoundingBox(pDrawable, font, x, y, n, pbox) DrawablePtr pDrawable; FontPtr font; int x, y, n; BoxPtr pbox; { int maxAscent, maxDescent, maxCharWidth; if (FONTASCENT(font) > FONTMAXBOUNDS(font,ascent)) maxAscent = FONTASCENT(font); else maxAscent = FONTMAXBOUNDS(font,ascent); if (FONTDESCENT(font) > FONTMAXBOUNDS(font,descent)) maxDescent = FONTDESCENT(font); else maxDescent = FONTMAXBOUNDS(font,descent); if (FONTMAXBOUNDS(font,rightSideBearing) > FONTMAXBOUNDS(font,characterWidth)) maxCharWidth = FONTMAXBOUNDS(font,rightSideBearing); else maxCharWidth = FONTMAXBOUNDS(font,characterWidth); pbox->x1 = pDrawable->x + x; pbox->y1 = pDrawable->y + y - maxAscent; pbox->x2 = pbox->x1 + maxCharWidth * n; pbox->y2 = pbox->y1 + maxAscent + maxDescent; if (FONTMINBOUNDS(font,leftSideBearing) < 0) { pbox->x1 += FONTMINBOUNDS(font,leftSideBearing); } } /* * PolyText8 - use rough bounding box. */ static int rfbPolyText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { int ret; RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyText8 called '%.*s'\n",count,chars)); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); if (count) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); return ret; } /* * PolyText16 - use rough bounding box. */ static int rfbPolyText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { int ret; RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyText16 called\n")); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); if (count) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); return ret; } /* * ImageText8 - use rough bounding box. */ static void rfbImageText8(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; char *chars; { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbImageText8 called '%.*s'\n",count,chars)); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); if (count) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * ImageText16 - use rough bounding box. */ static void rfbImageText16(pDrawable, pGC, x, y, count, chars) DrawablePtr pDrawable; GCPtr pGC; int x, y; int count; unsigned short *chars; { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbImageText16 called\n")); if (count) { GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); if (count) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * ImageGlyphBlt - use rough bounding box. */ static void rfbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbImageGlyphBlt called\n")); if (nglyph) { GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,pglyphBase); if (nglyph) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PolyGlyphBlt - use rough bounding box. */ static void rfbPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) DrawablePtr pDrawable; GCPtr pGC; int x, y; unsigned int nglyph; CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPolyGlyphBlt called\n")); if (nglyph) { GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box); SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); } (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); if (nglyph) { SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); } GC_OP_EPILOGUE(pGC); } /* * PushPixels - be fairly safe - region modified is intersection of the given * rectangle with the window clip region. */ static void rfbPushPixels(pGC, pBitMap, pDrawable, w, h, x, y) GCPtr pGC; PixmapPtr pBitMap; DrawablePtr pDrawable; int w, h, x, y; { RegionRec tmpRegion; BoxRec box; GC_OP_PROLOGUE(pDrawable, pGC); TRC((stderr,"rfbPushPixels called\n")); box.x1 = x + pDrawable->x; box.y1 = y + pDrawable->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; SAFE_REGION_INIT(pDrawable->pScreen, &tmpRegion, &box, 0); REGION_INTERSECT(pDrawable->pScreen, &tmpRegion, &tmpRegion, WINDOW_CLIP_REGION(((WindowPtr)pDrawable),pGC)); ADD_TO_MODIFIED_REGION(pDrawable->pScreen, &tmpRegion); REGION_UNINIT(pDrawable->pScreen, &tmpRegion); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); SCHEDULE_FB_UPDATE(pDrawable->pScreen, prfb); GC_OP_EPILOGUE(pGC); } /****************************************************************************/ /* * Other functions */ /****************************************************************************/ /* * rfbCopyRegion. Args are src and dst regions plus a translation (dx,dy). * Takes these args together with the existing modified region and possibly an * existing copy region and translation. Produces a combined modified region * plus copy region and translation. Note that the copy region is the * destination of the copy. * * First we trim parts of src which are invalid (ie in the modified region). * Then we see if there is any overlap between the src and the existing copy * region. If not then the two copies cannot be combined, so we choose * whichever is bigger to form the basis of a new copy, while the other copy is * just done the hard way by being added to the modified region. So if the * existing copy is bigger then we simply add the destination of the new copy * to the modified region and we're done. If the new copy is bigger, we add * the old copy region to the modified region and behave as though there is no * existing copy region. * * At this stage we now know that either the two copies can be combined, or * that there is no existing copy. We temporarily add both the existing copy * region and dst to the modified region (this is the entire area of the screen * affected in any way). Finally we calculate the new copy region, and remove * it from the modified region. * * Note: * 1. The src region is modified by this routine. * 2. When the copy region is empty, copyDX and copyDY MUST be set to zero. */ static void rfbCopyRegion(pScreen, cl, src, dst, dx, dy) ScreenPtr pScreen; rfbClientPtr cl; RegionPtr src; RegionPtr dst; int dx, dy; { RegionRec tmp; /* src = src - modifiedRegion */ REGION_SUBTRACT(pScreen, src, src, &cl->modifiedRegion); if (REGION_NOTEMPTY(pScreen, &cl->copyRegion)) { REGION_INIT(pScreen, &tmp, NullBox, 0); REGION_INTERSECT(pScreen, &tmp, src, &cl->copyRegion); if (REGION_NOTEMPTY(pScreen, &tmp)) { /* if src and copyRegion overlap: src = src intersect copyRegion */ REGION_COPY(pScreen, src, &tmp); } else { /* if no overlap, find bigger region */ int newArea = (((REGION_EXTENTS(pScreen,src))->x2 - (REGION_EXTENTS(pScreen,src))->x1) * ((REGION_EXTENTS(pScreen,src))->y2 - (REGION_EXTENTS(pScreen,src))->y1)); int oldArea = (((REGION_EXTENTS(pScreen,&cl->copyRegion))->x2 - (REGION_EXTENTS(pScreen,&cl->copyRegion))->x1) * ((REGION_EXTENTS(pScreen,&cl->copyRegion))->y2 - (REGION_EXTENTS(pScreen,&cl->copyRegion))->y1)); if (oldArea > newArea) { /* existing copy is bigger: modifiedRegion = modifiedRegion union dst copyRegion = copyRegion - dst return */ REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, dst); REGION_SUBTRACT(pScreen, &cl->copyRegion, &cl->copyRegion, dst); if (!REGION_NOTEMPTY(pScreen, &cl->copyRegion)) { cl->copyDX = 0; cl->copyDY = 0; } return; } /* new copy is bigger: modifiedRegion = modifiedRegion union copyRegion copyRegion = empty */ REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &cl->copyRegion); REGION_EMPTY(pScreen, &cl->copyRegion); cl->copyDX = cl->copyDY = 0; } } /* modifiedRegion = modifiedRegion union dst union copyRegion */ REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, dst); REGION_UNION(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &cl->copyRegion); /* copyRegion = T(src) intersect dst */ REGION_TRANSLATE(pScreen, src, dx, dy); REGION_INTERSECT(pScreen, &cl->copyRegion, src, dst); /* modifiedRegion = modifiedRegion - copyRegion */ REGION_SUBTRACT(pScreen, &cl->modifiedRegion, &cl->modifiedRegion, &cl->copyRegion); /* combine new translation T with existing translation */ if (REGION_NOTEMPTY(pScreen, &cl->copyRegion)) { cl->copyDX += dx; cl->copyDY += dy; } else { cl->copyDX = 0; cl->copyDY = 0; } } /* * rfbDeferredUpdateCallback() is called when a client's deferredUpdateTimer * goes off. */ static CARD32 rfbDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) { rfbClientPtr cl = (rfbClientPtr)arg; rfbSendFramebufferUpdate(cl); cl->deferredUpdateScheduled = FALSE; return 0; } /* * rfbScheduleDeferredUpdate() is called from the SCHEDULE_FB_UPDATE macro * to schedule an update. */ static void rfbScheduleDeferredUpdate(rfbClientPtr cl) { if (rfbDeferUpdateTime != 0) { cl->deferredUpdateTimer = TimerSet(cl->deferredUpdateTimer, 0, rfbDeferUpdateTime, rfbDeferredUpdateCallback, cl); cl->deferredUpdateScheduled = TRUE; } else { rfbSendFramebufferUpdate(cl); } } /* * PrintRegion is useful for debugging. */ static void PrintRegion(pScreen,reg) ScreenPtr pScreen; RegionPtr reg; { int nrects = REGION_NUM_RECTS(reg); int i; rfbLog("Region num rects %d extents %d,%d %d,%d\n",nrects, (REGION_EXTENTS(pScreen,reg))->x1, (REGION_EXTENTS(pScreen,reg))->y1, (REGION_EXTENTS(pScreen,reg))->x2, (REGION_EXTENTS(pScreen,reg))->y2); for (i = 0; i < nrects; i++) { rfbLog(" rect %d,%d %dx%d\n", REGION_RECTS(reg)[i].x1, REGION_RECTS(reg)[i].y1, REGION_RECTS(reg)[i].x2-REGION_RECTS(reg)[i].x1, REGION_RECTS(reg)[i].y2-REGION_RECTS(reg)[i].y1); } } vnc_unixsrc/Xvnc/programs/Xserver/hw/vnc/tabletranstemplate.c0100664000076400007640000000665107120677563024166 0ustar constconst/* * tabletranstemplate.c - template for translation using lookup tables. * * This file shouldn't be compiled. It is included multiple times by * translate.c, each time with different definitions of the macros IN and OUT. * * For each pair of values IN and OUT, this file defines two functions for * translating a given rectangle of pixel data. One uses a single lookup * table, and the other uses three separate lookup tables for the red, green * and blue values. * * I know this code isn't nice to read because of all the macros, but * efficiency is important here. */ /* * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #if !defined(IN) || !defined(OUT) #error "This file shouldn't be compiled." #error "It is included as part of translate.c" #endif #define IN_T CONCAT2E(CARD,IN) #define OUT_T CONCAT2E(CARD,OUT) #define rfbTranslateWithSingleTableINtoOUT \ CONCAT4E(rfbTranslateWithSingleTable,IN,to,OUT) #define rfbTranslateWithRGBTablesINtoOUT \ CONCAT4E(rfbTranslateWithRGBTables,IN,to,OUT) /* * rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data * using a single lookup table. */ static void rfbTranslateWithSingleTableINtoOUT (char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { IN_T *ip = (IN_T *)iptr; OUT_T *op = (OUT_T *)optr; int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width; OUT_T *opLineEnd; OUT_T *t = (OUT_T *)table; while (height > 0) { opLineEnd = op + width; while (op < opLineEnd) { *(op++) = t[*(ip++)]; } ip += ipextra; height--; } } /* * rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data * using three separate lookup tables for the red, green and blue values. */ static void rfbTranslateWithRGBTablesINtoOUT (char *table, rfbPixelFormat *in, rfbPixelFormat *out, char *iptr, char *optr, int bytesBetweenInputLines, int width, int height) { IN_T *ip = (IN_T *)iptr; OUT_T *op = (OUT_T *)optr; int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width; OUT_T *opLineEnd; OUT_T *redTable = (OUT_T *)table; OUT_T *greenTable = redTable + in->redMax + 1; OUT_T *blueTable = greenTable + in->greenMax + 1; while (height > 0) { opLineEnd = op + width; while (op < opLineEnd) { *(op++) = (redTable[(*ip >> in->redShift) & in->redMax] | greenTable[(*ip >> in->greenShift) & in->greenMax] | blueTable[(*ip >> in->blueShift) & in->blueMax]); ip++; } ip += ipextra; height--; } } #undef IN_T #undef OUT_T #undef rfbTranslateWithSingleTableINtoOUT #undef rfbTranslateWithRGBTablesINtoOUT vnc_unixsrc/Xvnc/programs/Xserver/hw/xfree86/0040775000076400007640000000000010616336474020620 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/hw/xfree86/common/0040775000076400007640000000000010616336474022110 5ustar constconstvnc_unixsrc/Xvnc/programs/Xserver/hw/xfree86/common/compiler.h0100664000076400007640000007730507120677563024107 0ustar constconst/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.24.2.2 1998/02/07 00:44:37 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Thomas Roell not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Thomas Roell makes no representations * about the suitability of this software for any purpose. It is provided * "as is" without express or implied warranty. * * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * */ /* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */ #ifndef _COMPILER_H #define _COMPILER_H #ifndef __STDC__ # ifdef signed # undef signed # endif # ifdef volatile # undef volatile # endif # ifdef const # undef const # endif # define signed /**/ # ifdef __GNUC__ # define volatile __volatile__ # define const __const__ # ifdef PC98 # undef NO_INLINE # endif # else # define const /**/ # ifdef PC98 # define __inline__ /**/ # endif # endif /* __GNUC__ */ #endif /* !__STDC__ */ #if defined(IODEBUG) && defined(__GNUC__) #define outb RealOutb #define outw RealOutw #define outl RealOutl #define inb RealInb #define inw RealInw #define inl RealInl #endif #ifdef NO_INLINE extern void outb(); extern void outw(); extern void outl(); extern unsigned int inb(); extern unsigned int inw(); extern unsigned int inl(); #if NeedFunctionPrototypes extern unsigned char rdinx(unsigned short int, unsigned char); extern void wrinx(unsigned short int, unsigned char, unsigned char); extern void modinx(unsigned short int, unsigned char, unsigned char, unsigned char); extern int testrg(unsigned short int, unsigned char); extern int testinx2(unsigned short int, unsigned char, unsigned char); extern int testinx(unsigned short int, unsigned char); #else /* NeedFunctionProtoypes */ extern unsigned char rdinx(); extern void wrinx(); extern void modinx(); extern int testrg(); extern int testinx2(); extern int testinx(); #endif /* NeedFunctionProtoypes */ #else /* NO_INLINE */ #ifdef __GNUC__ #if defined(linux) && defined(__alpha__) /* for Linux on Alpha, we use the LIBC _inx/_outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ static __inline__ void outb(port, val) unsigned short port; char val; { extern void _outb(char val, unsigned short port); _outb(val, port); } static __inline__ void outw(port, val) unsigned short port; short val; { extern void _outw(short val, unsigned short port); _outw(val, port); } static __inline__ void outl(port, val) unsigned short port; int val; { extern void _outl(int val, unsigned short port); _outl(val, port); } static __inline__ unsigned int inb(port) unsigned short port; { extern unsigned int _inb(unsigned short port); return _inb(port); } static __inline__ unsigned int inw(port) unsigned short port; { extern unsigned int _inw(unsigned short port); return _inw(port); } static __inline__ unsigned int inl(port) unsigned short port; { extern unsigned int _inl(unsigned short port); return _inl(port); } /* * inline functions to do unaligned accesses * from linux/include/asm-alpha/unaligned.h */ static __inline__ unsigned long ldq_u(unsigned long * r11) { unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" "extql %0,%2,%0\n\t" "extqh %1,%2,%1\n\t" "bis %1,%0,%0" :"=&r" (r1), "=&r" (r2) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(7+(char *) r11))); return r1; } static __inline__ unsigned long ldl_u(unsigned int * r11) { unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" "extll %0,%2,%0\n\t" "extlh %1,%2,%1\n\t" "bis %1,%0,%0" :"=&r" (r1), "=&r" (r2) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(3+(char *) r11))); return r1; } static __inline__ unsigned long ldw_u(unsigned short * r11) { unsigned long r1,r2; __asm__("ldq_u %0,%3\n\t" "ldq_u %1,%4\n\t" "extwl %0,%2,%0\n\t" "extwh %1,%2,%1\n\t" "bis %1,%0,%0" :"=&r" (r1), "=&r" (r2) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(1+(char *) r11))); return r1; } static __inline__ void stq_u(unsigned long r5, unsigned long * r11) { unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" "ldq_u %2,%0\n\t" "insqh %6,%7,%5\n\t" "insql %6,%7,%4\n\t" "mskqh %3,%7,%3\n\t" "mskql %2,%7,%2\n\t" "bis %3,%5,%3\n\t" "bis %2,%4,%2\n\t" "stq_u %3,%1\n\t" "stq_u %2,%0" :"=m" (*r11), "=m" (*(unsigned long *)(7+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); } static __inline__ void stl_u(unsigned long r5, unsigned int * r11) { unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" "ldq_u %2,%0\n\t" "inslh %6,%7,%5\n\t" "insll %6,%7,%4\n\t" "msklh %3,%7,%3\n\t" "mskll %2,%7,%2\n\t" "bis %3,%5,%3\n\t" "bis %2,%4,%2\n\t" "stq_u %3,%1\n\t" "stq_u %2,%0" :"=m" (*r11), "=m" (*(unsigned long *)(3+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); } static __inline__ void stw_u(unsigned long r5, unsigned short * r11) { unsigned long r1,r2,r3,r4; __asm__("ldq_u %3,%1\n\t" "ldq_u %2,%0\n\t" "inswh %6,%7,%5\n\t" "inswl %6,%7,%4\n\t" "mskwh %3,%7,%3\n\t" "mskwl %2,%7,%2\n\t" "bis %3,%5,%3\n\t" "bis %2,%4,%2\n\t" "stq_u %3,%1\n\t" "stq_u %2,%0" :"=m" (*r11), "=m" (*(unsigned long *)(1+(char *) r11)), "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4) :"r" (r5), "r" (r11)); } #define mem_barrier() __asm__ __volatile__("mb" : : : "memory") #ifdef __ELF__ #define write_mem_barrier() __asm__ __volatile__("wmb" : : : "memory") #else /* ECOFF gas 2.6 doesn't know "wmb" :-( */ #define write_mem_barrier() mem_barrier() #endif #else /* defined(linux) && defined(__alpha__) */ #if defined(__mips__) unsigned int IOPortBase; /* Memory mapped I/O port area */ static __inline__ void outb(port, val) short port; char val; { *(volatile unsigned char*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ void outw(port, val) short port; short val; { *(volatile unsigned short*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ void outl(port, val) short port; int val; { *(volatile unsigned long*)(((unsigned short)(port))+IOPortBase) = val; } static __inline__ unsigned int inb(port) short port; { return(*(volatile unsigned char*)(((unsigned short)(port))+IOPortBase)); } static __inline__ unsigned int inw(port) short port; { return(*(volatile unsigned short*)(((unsigned short)(port))+IOPortBase)); } static __inline__ unsigned int inl(port) short port; { return(*(volatile unsigned long*)(((unsigned short)(port))+IOPortBase)); } static __inline__ unsigned long ldq_u(unsigned long * r11) { unsigned long r1; __asm__("lwr %0,%2\n\t" "lwl %0,%3\n\t" :"=&r" (r1) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(3+(char *) r11))); return r1; } static __inline__ unsigned long ldl_u(unsigned int * r11) { unsigned long r1; __asm__("lwr %0,%2\n\t" "lwl %0,%3\n\t" :"=&r" (r1) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(3+(char *) r11))); return r1; } static __inline__ unsigned long ldw_u(unsigned short * r11) { unsigned long r1; __asm__("lwr %0,%2\n\t" "lwl %0,%3\n\t" :"=&r" (r1) :"r" (r11), "m" (*r11), "m" (*(unsigned long *)(1+(char *) r11))); return r1; } #define stq_u(v,p) stl_u(v,p) #define stl_u(v,p) ((unsigned char *)(p)) = (v); \ ((unsigned char *)(p)+1) = ((v) >> 8); \ ((unsigned char *)(p)+2) = ((v) >> 16); \ ((unsigned char *)(p)+3) = ((v) >> 24) #define stw_u(v,p) ((unsigned char *)(p)) = (v); \ ((unsigned char *)(p)+1) = ((v) >> 8) #define mem_barrier() /* NOP */ #else /* defined(mips) */ #define ldq_u(p) (*((unsigned long *)(p))) #define ldl_u(p) (*((unsigned int *)(p))) #define ldw_u(p) (*((unsigned short *)(p))) #define stq_u(v,p) ((unsigned long *)(p)) = (v) #define stl_u(v,p) ((unsigned int *)(p)) = (v) #define stw_u(v,p) ((unsigned short *)(p)) = (v) #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ #if !defined(FAKEIT) && !defined(__mc68000__) #ifdef GCCUSESGAS /* * If gcc uses gas rather than the native assembler, the syntax of these * inlines has to be different. DHD */ #ifndef PC98 static __inline__ void #if NeedFunctionPrototypes outb( unsigned short int port, unsigned char val) #else outb(port, val) unsigned short int port; unsigned char val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes outw( unsigned short int port, unsigned short int val) #else outw(port, val) unsigned short int port; unsigned short int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes outl( unsigned short int port, unsigned int val) #else outl(port, val) unsigned short int port; unsigned int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); } static __inline__ unsigned int #if NeedFunctionPrototypes inb( unsigned short int port) #else inb(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned char ret; __asm__ __volatile__("inb %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inw( unsigned short int port) #else inw(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned short int ret; __asm__ __volatile__("inw %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inl( unsigned short int port) #else inl(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned int ret; __asm__ __volatile__("inl %1,%0" : "=a" (ret) : "d" (port)); return ret; } #else /* PC98 */ static __inline__ void #if NeedFunctionPrototypes _outb( unsigned short int port, unsigned char val) #else _outb(port, val) unsigned short int port; unsigned char val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outb %0,%1" ::"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes _outw( unsigned short int port, unsigned short int val) #else _outw(port, val) unsigned short int port; unsigned short int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outw %0,%1" ::"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes _outl( unsigned short int port, unsigned int val) #else _outl(port, val) unsigned short int port; unsigned int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); } static __inline__ unsigned int #if NeedFunctionPrototypes _inb( unsigned short int port) #else _inb(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned char ret; __asm__ __volatile__("inb %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes _inw( unsigned short int port) #else _inw(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned short ret; __asm__ __volatile__("inw %1,%0" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes _inl( unsigned short int port) #else _inl(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned int ret; __asm__ __volatile__("inl %1,%0" : "=a" (ret) : "d" (port)); return ret; } #if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968) #define PW_PORT 0x600 extern short chipID; #if NeedFunctionPrototypes extern void *mmioBase; #else extern unsigned char *mmioBase; #endif extern unsigned short _port_tbl[]; #define port_convert(x) _port_tbl[(unsigned short)x] #endif #if defined(PC98_WAB) || defined(PC98_GANB_WAP) static __inline__ unsigned short port_convert(unsigned short port) { port <<= 8; port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ port |= 0xE0; return port; } #endif /* PC98_WAB || PC98_GANB_WAP */ #if defined(PC98_WABEP) static __inline__ unsigned short port_convert(unsigned short port) { port &= 0x7f; /* Mask 0000 0000 0111 1111 */ port |= 0x0f00; return port; } #endif /* PC98_WABEP */ #ifdef PC98_WSNA static __inline__ unsigned short port_convert(unsigned short port) { port <<= 8; port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ port |= 0xE2; return port; } #endif /* PC98_WSNA */ #ifdef PC98_NKVNEC #ifdef PC98_NEC_CIRRUS2 static __inline__ unsigned short port_convert(unsigned short port) { port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050; return port; } #else static __inline__ unsigned short port_convert(unsigned short port) { port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0; return port; } #endif /* PC98_NEC_CIRRUS2 */ #endif /* PC98_NKVNEC */ #if defined(PC98_TGUI) || defined(PC98_MGA) #if NeedFunctionPrototypes extern void *mmioBase; #else extern unsigned char *mmioBase; #endif #endif static __inline__ void #if NeedFunctionPrototypes outb( unsigned short port, unsigned char val) #else outb(port, val) unsigned short port; unsigned char val; #endif /* NeedFunctionPrototypes */ { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val); #else __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); #endif } static __inline__ void #if NeedFunctionPrototypes outw( unsigned short port, unsigned short val) #else outw(port, val) unsigned short port; unsigned short val; #endif /* NeedFunctionPrototypes */ { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val); #else __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); #endif } static __inline__ void #if NeedFunctionPrototypes outl( unsigned short port, unsigned int val) #else outl(port, val) unsigned short port; unsigned int val; #endif /* NeedFunctionPrototypes */ { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val); #else __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); #endif } static __inline__ unsigned int #if NeedFunctionPrototypes inb( unsigned short port) #else inb(port) unsigned short port; #endif /* NeedFunctionPrototypes */ { unsigned char ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned char *)((char *)mmioBase+(port)); #else __asm__ __volatile__("inb %1,%0" : "=a" (ret) : "d" (port)); #endif return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inw( unsigned short port) #else inw(port) unsigned short port; #endif /* NeedFunctionPrototypes */ { unsigned short ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned short *)((char *)mmioBase+(port)); #else __asm__ __volatile__("inw %1,%0" : "=a" (ret) : "d" (port)); #endif return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inl( unsigned short port) #else inl(port) unsigned short port; #endif /* NeedFunctionPrototypes */ { unsigned int ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned int *)((char *)mmioBase+(port)); #else __asm__ __volatile__("inl %1,%0" : "=a" (ret) : "d" (port)); #endif return ret; } #endif /* PC98 */ #else /* GCCUSESGAS */ static __inline__ void #if NeedFunctionPrototypes outb( unsigned short int port, unsigned char val) #else outb(port, val) unsigned short int port; unsigned char val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes outw( unsigned short int port, unsigned short int val) #else outw(port, val) unsigned short int port; unsigned short int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); } static __inline__ void #if NeedFunctionPrototypes outl( unsigned short int port, unsigned int val) #else outl(port, val) unsigned short int port; unsigned int val; #endif /* NeedFunctionPrototypes */ { __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port)); } static __inline__ unsigned int #if NeedFunctionPrototypes inb( unsigned short int port) #else inb(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned char ret; __asm__ __volatile__("in%B0 (%1)" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inw( unsigned short int port) #else inw(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned short int ret; __asm__ __volatile__("in%W0 (%1)" : "=a" (ret) : "d" (port)); return ret; } static __inline__ unsigned int #if NeedFunctionPrototypes inl( unsigned short int port) #else inl(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { unsigned int ret; __asm__ __volatile__("in%L0 (%1)" : "=a" (ret) : "d" (port)); return ret; } #endif /* GCCUSESGAS */ #else /* !defined(FAKEIT) && !defined(__mc68000__) */ static __inline__ void #if NeedFunctionPrototypes outb( unsigned short int port, unsigned char val) #else outb(port, val) unsigned short int port; unsigned char val; #endif /* NeedFunctionPrototypes */ { } static __inline__ void #if NeedFunctionPrototypes outw( unsigned short int port, unsigned short int val) #else outw(port, val) unsigned short int port; unsigned short int val; #endif /* NeedFunctionPrototypes */ { } static __inline__ void #if NeedFunctionPrototypes outl( unsigned short int port, unsigned int val) #else outl(port, val) unsigned short int port; unsigned int val; #endif /* NeedFunctionPrototypes */ { } static __inline__ unsigned int #if NeedFunctionPrototypes inb( unsigned short int port) #else inb(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { return 0; } static __inline__ unsigned int #if NeedFunctionPrototypes inw( unsigned short int port) #else inw(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { return 0; } static __inline__ unsigned int #if NeedFunctionPrototypes inl( unsigned short int port) #else inl(port) unsigned short int port; #endif /* NeedFunctionPrototypes */ { return 0; } #endif /* FAKEIT */ #endif /* defined(mips) */ #endif /* defined(AlphaArchitecture) && defined(LinuxArchitecture) */ #else /* __GNUC__ */ #if !defined(AMOEBA) && !defined(MINIX) # if defined(__STDC__) && (__STDC__ == 1) # ifndef asm # define asm __asm # endif # endif # ifdef SVR4 # include # ifndef __HIGHC__ # ifndef __USLC__ # define __USLC__ # endif # endif # endif # ifndef PC98 # ifndef SCO325 # include # else # include "scoasm.h" # endif # else #if defined(PC98_PW) || defined(PC98_XKB) || defined(PC98_NEC) || defined(PC98_PWLB) || defined(PC98_GA968) #define PW_PORT 0x600 extern short chipID; #if NeedFunctionPrototypes extern void *mmioBase; #else extern unsigned char *mmioBase; #endif extern unsigned short _port_tbl[]; #define port_convert(x) _port_tbl[(unsigned short)x] #endif #if defined(PC98_TGUI) || defined(PC98_MGA) #if NeedFunctionPrototypes extern void *mmioBase; #else extern unsigned char *mmioBase; #endif #endif asm void _outl(port,val) { %reg port,val; movl port, %edx movl val, %eax outl (%dx) %reg port; mem val; movl port, %edx movl val, %eax outl (%dx) %mem port; reg val; movw port, %dx movl val, %eax outl (%dx) %mem port,val; movw port, %dx movl val, %eax outl (%dx) } asm void _outw(port,val) { %reg port,val; movl port, %edx movl val, %eax data16 outl (%dx) %reg port; mem val; movl port, %edx movw val, %ax data16 outl (%dx) %mem port; reg val; movw port, %dx movl val, %eax data16 outl (%dx) %mem port,val; movw port, %dx movw val, %ax data16 outl (%dx) } asm void _outb(port,val) { %reg port,val; movl port, %edx movl val, %eax outb (%dx) %reg port; mem val; movl port, %edx movb val, %al outb (%dx) %mem port; reg val; movw port, %dx movl val, %eax outb (%dx) %mem port,val; movw port, %dx movb val, %al outb (%dx) } asm int _inl(port) { %reg port; movl port, %edx inl (%dx) %mem port; movw port, %dx inl (%dx) } asm int _inw(port) { %reg port; subl %eax, %eax movl port, %edx data16 inl (%dx) %mem port; subl %eax, %eax movw port, %dx data16 inl (%dx) } asm int _inb(port) { %reg port; subl %eax, %eax movl port, %edx inb (%dx) %mem port; subl %eax, %eax movw port, %dx inb (%dx) } #if defined(PC98_WAB) || defined(PC98_GANB_WAP) static unsigned short port_convert(unsigned short port) { port <<= 8; port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ port |= 0xE0; return port; } #endif /* PC98_WAB || PC98_GANB_WAP */ #if defined(PC98_WABEP) static unsigned short port_convert(unsigned short port) { port &= 0x7f; /* Mask 0000 0000 0111 1111 */ port |= 0x0f00; return port; } #endif /* PC98_WABEP */ #ifdef PC98_WSNA static unsigned short port_convert(unsigned short port) { port <<= 8; port &= 0x7f00; /* Mask 0111 1111 0000 0000 */ port |= 0xE2; return port; } #endif /* PC98_WSNA */ #ifdef PC98_NKVNEC #ifdef PC98_NEC_CIRRUS2 static unsigned short port_convert(unsigned short port) { port = (port & 0xf) + ((port & 0xf0) << 4) + 0x0050; return port; } #else static unsigned short port_convert(unsigned short port) { port = (port & 0xf) + ((port & 0xf0) << 4) + 0x00a0; return port; } #endif /* PC98_NEC_CIRRUS2 */ #endif /* PC98_NKVNEC */ static void outl(port,val) { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned int *)((char *)mmioBase+(port)) = (unsigned int)(val); #else _outl(port,val); #endif } static void outw(port,val) { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned short *)((char *)mmioBase+(port)) = (unsigned short)(val); #else _outw(port,val); #endif } static void outb(port,val) { #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) *(volatile unsigned char *)((char *)mmioBase+(port)) = (unsigned char)(val); #else _outb(port,val); #endif } static int inl(port) { unsigned int ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned int *)((char *)mmioBase+(port)); #else ret = _inl(port); #endif return ret; } static int inw(port) { unsigned short ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned short *)((char *)mmioBase+(port)); #else ret = _inw(port); #endif return ret; } static int inb(port) { unsigned char ret; #if defined(PC98_GANB_WAP) || defined(PC98_NKVNEC) || defined(PC98_WAB) || \ defined(PC98_WABEP) || defined(PC98_WSNA) || defined(PC98_PW) || \ defined(PC98_XKB) || defined(PC98_NEC) unsigned short tmp; tmp=port_convert(port); port=tmp; #endif #if defined(PC98_NEC)||defined(PC98_PWLB)||defined(PC98_TGUI)||defined(PC98_MGA) ret =*(volatile unsigned char *)((char *)mmioBase+(port)); #else ret = _inb(port); #endif return ret; } # endif /* PC98 */ # if !defined(__HIGHC__) && !defined(SCO325) # pragma asm partial_optimization outl # pragma asm partial_optimization outw # pragma asm partial_optimization outb # pragma asm partial_optimization inl # pragma asm partial_optimization inw # pragma asm partial_optimization inb # endif #endif #define ldq_u(p) (*((unsigned long *)(p))) #define ldl_u(p) (*((unsigned int *)(p))) #define ldw_u(p) (*((unsigned short *)(p))) #define stq_u(v,p) ((unsigned long *)(p)) = (v) #define stl_u(v,p) ((unsigned int *)(p)) = (v) #define stw_u(v,p) ((unsigned short *)(p)) = (v) #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ #endif /* __GNUC__ */ #if defined(IODEBUG) && defined(__GNUC__) #undef inb #undef inw #undef inl #undef outb #undef outw #undef outl #define inb(a) __extension__ ({unsigned char __c=RealInb(a); ErrorF("inb(0x%03x) = 0x%02x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) #define inw(a) __extension__ ({unsigned short __c=RealInw(a); ErrorF("inw(0x%03x) = 0x%04x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) #define inl(a) __extension__ ({unsigned long __c=RealInl(a); ErrorF("inl(0x%03x) = 0x%08x\t@ line %4d, file %s\n", a, __c, __LINE__, __FILE__);__c;}) #define outb(a,b) (ErrorF("outb(0x%03x, 0x%02x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutb(a,b)) #define outw(a,b) (ErrorF("outw(0x%03x, 0x%04x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutw(a,b)) #define outl(a,b) (ErrorF("outl(0x%03x, 0x%08x)\t@ line %4d, file %s\n", a, b, __LINE__, __FILE__),RealOutl(a,b)) #endif /* * This header sometimes gets included where is isn't needed, and on some * OSs this causes problems because the following functions generate * references to inb() and outb() which can't be resolved. Defining * NO_COMPILER_H_EXTRAS avoids this problem. */ #ifndef NO_COMPILER_H_EXTRAS /* *----------------------------------------------------------------------- * Port manipulation convenience functions *----------------------------------------------------------------------- */ #ifndef __GNUC__ #define __inline__ /**/ #endif /* * rdinx - read the indexed byte port 'port', index 'ind', and return its value */ static __inline__ unsigned char #ifdef __STDC__ rdinx(unsigned short int port, unsigned char ind) #else rdinx(port, ind) unsigned short int port; unsigned char ind; #endif { if (port == 0x3C0) /* reset attribute flip-flop */ (void) inb(0x3DA); outb(port, ind); return(inb(port+1)); } /* * wrinx - write 'val' to port 'port', index 'ind' */ static __inline__ void #ifdef __STDC__ wrinx(unsigned short int port, unsigned char ind, unsigned char val) #else wrinx(port, ind, val) unsigned short int port; unsigned char ind, val; #endif { outb(port, ind); outb(port+1, val); } /* * modinx - in register 'port', index 'ind', set the bits in 'mask' as in 'new'; * the other bits are unchanged. */ static __inline__ void #ifdef __STDC__ modinx(unsigned short int port, unsigned char ind, unsigned char mask, unsigned char new) #else modinx(port, ind, mask, new) unsigned short int port; unsigned char ind, mask, new; #endif { unsigned char tmp; tmp = (rdinx(port, ind) & ~mask) | (new & mask); wrinx(port, ind, tmp); } /* * tstrg - returns true iff the bits in 'mask' of register 'port' are * readable & writable. */ static __inline__ int #ifdef __STDC__ testrg(unsigned short int port, unsigned char mask) #else tstrg(port, mask) unsigned short int port; unsigned char mask; #endif { unsigned char old, new1, new2; old = inb(port); outb(port, old & ~mask); new1 = inb(port) & mask; outb(port, old | mask); new2 = inb(port) & mask; outb(port, old); return((new1 == 0) && (new2 == mask)); } /* * testinx2 - returns true iff the bits in 'mask' of register 'port', index * 'ind' are readable & writable. */ static __inline__ int #ifdef __STDC__ testinx2(unsigned short int port, unsigned char ind, unsigned char mask) #else testinx2(port, ind, mask) unsigned short int port; unsigned char ind, mask; #endif { unsigned char old, new1, new2; old = rdinx(port, ind); wrinx(port, ind, old & ~mask); new1 = rdinx(port, ind) & mask; wrinx(port, ind, old | mask); new2 = rdinx(port, ind) & mask; wrinx(port, ind, old); return((new1 == 0) && (new2 == mask)); } /* * testinx - returns true iff all bits of register 'port', index 'ind' are * readable & writable. */ static __inline__ int #ifdef __STDC__ testinx(unsigned short int port, unsigned char ind) #else testinx(port, ind, mask) unsigned short int port; unsigned char ind; #endif { return(testinx2(port, ind, 0xFF)); } #endif /* NO_COMPILER_H_EXTRAS */ #endif /* NO_INLINE */ #endif /* _COMPILER_H */ vnc_unixsrc/Xvnc/programs/Xserver/hw/xfree86/common/scoasm.h0100664000076400007640000000307407120677563023552 0ustar constconst/* $XFree86: xc/programs/Xserver/hw/xfree86/common/scoasm.h,v 3.0 1996/10/03 08:34:06 dawes Exp $ */ /* * scoasm.h - used to define inline versions of certain functions which * do NOT appear in sys/inline.h. */ #ifdef SCO325 #ifndef _SCOASM_HDR_INC #define _SCOASM_HDR_INC asm void outl(port,val) { %reg port,val; movl port, %edx movl val, %eax outl (%dx) %reg port; mem val; movl port, %edx movl val, %eax outl (%dx) %mem port; reg val; movw port, %dx movl val, %eax outl (%dx) %mem port,val; movw port, %dx movl val, %eax outl (%dx) } asm void outw(port,val) { %reg port,val; movl port, %edx movl val, %eax data16 outl (%dx) %reg port; mem val; movl port, %edx movw val, %ax data16 outl (%dx) %mem port; reg val; movw port, %dx movl val, %eax data16 outl (%dx) %mem port,val; movw port, %dx movw val, %ax data16 outl (%dx) } asm void outb(port,val) { %reg port,val; movl port, %edx movl val, %eax outb (%dx) %reg port; mem val; movl port, %edx movb val, %al outb (%dx) %mem port; reg val; movw port, %dx movl val, %eax outb (%dx) %mem port,val; movw port, %dx movb val, %al outb (%dx) } asm int inl(port) { %reg port; movl port, %edx inl (%dx) %mem port; movw port, %dx inl (%dx) } asm int inw(port) { %reg port; subl %eax, %eax movl port, %edx data16 inl (%dx) %mem port; subl %eax, %eax movw port, %dx data16 inl (%dx) } asm int inb(port) { %reg port; subl %eax, %eax movl port, %edx inb (%dx) %mem port; subl %eax, %eax movw port, %dx inb (%dx) } #endif /* _SCOASM_HDR_INC */ #endif /* SCO325 */ vnc_unixsrc/Xvnc/programs/Xserver/Xserver.man0100664000076400007640000006271107120677563021055 0ustar constconst.\" $XConsortium: Xserver.man /main/62 1996/12/09 17:06:18 kaleb $ .\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.5.2.4 1998/02/24 13:20:02 dawes Exp $ .\" Copyright (c) 1984 - 1991, 1993, 1994 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of the X Consortium shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .TH XSERVER 1 "Release 6.3" "X Version 11" .SH NAME Xserver \- X Window System display server .SH SYNOPSIS .B X [option ...] .SH DESCRIPTION .I X is the generic name for the X Window System display server. It is frequently a link or a copy of the appropriate server binary for driving the most frequently used server on a given machine. .SH "STARTING THE SERVER" The X server is usually started from the X Display Manager program \fIxdm(1)\fP. This utility is run from the system boot files and takes care of keeping the server running, prompting for usernames and passwords, and starting up the user sessions. .PP Installations that run more than one window system may need to use the \fIxinit(1)\fP utility instead of \fIxdm\fP. However, \fIxinit\fP is to be considered a tool for building startup scripts and is not intended for use by end users. Site administrators are \fBstrongly\fP urged to use \fIxdm\fP, or build other interfaces for novice users. .PP The X server may also be started directly by the user, though this method is usually reserved for testing and is not recommended for normal operation. On some platforms, the user must have special permission to start the X server, often because access to certain devices (e.g. /dev/mouse) is restricted. .PP When the X server starts up, it typically takes over the display. If you are running on a workstation whose console is the display, you may not be able to log into the console while the server is running. .SH OPTIONS All of the X servers accept the following command line options: .TP 8 .B :\fIdisplaynumber\fP the X server runs as the given \fIdisplaynumber\fP, which by default is 0. If multiple X servers are to run simultaneously on a host, each must have a unique display number. See the DISPLAY NAMES section of the \fIX(1)\fP manual page to learn how to specify which display number clients should try to use. .TP 8 .B \-a \fInumber\fP sets pointer acceleration (i.e. the ratio of how much is reported to how much the user actually moved the pointer). .TP 8 .B \-ac disables host-based access control mechanisms. Enables access by any host, and permits any host to modify the access control list. Use with extreme caution. This option exists primarily for running test suites remotely. .TP 8 .B \-audit \fIlevel\fP Sets the audit trail level. The default level is 1, meaning only connection rejections are reported. Level 2 additionally reports all successful connections and disconnects. Level 4 enables messages from the SECURITY extension, if present, including generation and revocation of authorizations and violations of the security policy. Level 0 turns off the audit trail. Audit lines are sent as standard error output. .TP 8 .B \-auth \fIauthorization-file\fP Specifies a file which contains a collection of authorization records used to authenticate access. See also the \fIxdm\fP and \fIXsecurity\fP manual pages. .TP 8 .B bc disables certain kinds of error checking, for bug compatibility with previous releases (e.g., to work around bugs in R2 and R3 xterms and toolkits). Deprecated. .TP 8 .B \-bs disables backing store support on all screens. .TP 8 .B \-c turns off key-click. .TP 8 .B c \fIvolume\fP sets key-click volume (allowable range: 0-100). .TP 8 .B \-cc \fIclass\fP sets the visual class for the root window of color screens. The class numbers are as specified in the X protocol. Not obeyed by all servers. .TP 8 .B \-co \fIfilename\fP sets name of RGB color database. The default is /lib/X11/rgb, where refers to the root of the X11 install tree. .ig .TP 8 .B \-config \fIfilename\fP reads more options from the given file. Options in the file may be separated by newlines if desired. If a '#' character appears on a line, all characters between it and the next newline are ignored, providing a simple commenting facility. The \fB\-config\fP option itself may appear in the file. .. .TP 8 .B \-core causes the server to generate a core dump on fatal errors. .TP 8 .B \-dpi \fIresolution\fP sets the resolution of the screen, in dots per inch. To be used when the server cannot determine the screen size from the hardware. .TP 8 .B dpms Enable DPMS (when supported). .TP 8 .B \-dpms Disable DPMS. .TP 8 .B \-deferglyphs \fIwhichfonts\fP specifies the types of fonts for which the server should attempt to use deferred glyph loading. \fIwhichfonts\fP can be all (all fonts), none (no fonts), or 16 (16 bit fonts only). .TP 8 .B \-f \fIvolume\fP sets feep (bell) volume (allowable range: 0-100). .TP 8 .B \-fc \fIcursorFont\fP sets default cursor font. .TP 8 .B \-fn \fIfont\fP sets the default font. .TP 8 .B \-fp \fIfontPath\fP sets the search path for fonts. This path is a comma separated list of directories which the X server searches for font databases. .TP 8 .B \-help prints a usage message. .TP 8 .B \-I causes all remaining command line arguments to be ignored. .TP 8 .B \-kb disables the XKEYBOARD extension if present. .TP 8 .B \-nolisten \fItrans-type\fP Disable a transport type. For example, TCP/IP connections can be disabled with .B \-nolisten tcp .TP 8 .B \-nolock Disable the use of an X server lock file. .TP 8 .B \-p \fIminutes\fP sets screen-saver pattern cycle time in minutes. .TP 8 .B \-pn permits the server to continue running if it fails to establish all of its well-known sockets (connection points for clients), but establishes at least one. .TP 8 .B \-r turns off auto-repeat. .TP 8 .B r turns on auto-repeat. .TP 8 .B \-s \fIminutes\fP sets screen-saver timeout time in minutes. .TP 8 .B \-su disables save under support on all screens. .TP 8 .B \-t \fInumber\fP sets pointer acceleration threshold in pixels (i.e. after how many pixels pointer acceleration should take effect). .TP 8 .B \-terminate causes the server to terminate at server reset, instead of continuing to run. .TP 8 .B \-to \fIseconds\fP sets default connection timeout in seconds. .TP 8 .B \-tst disables all testing extensions (e.g., XTEST, XTrap, XTestExtension1, RECORD). .TP 8 .B tty\fIxx\fP ignored, for servers started the ancient way (from init). .TP 8 .B v sets video-off screen-saver preference. .TP 8 .B \-v sets video-on screen-saver preference. .TP 8 .B \-wm forces the default backing-store of all windows to be WhenMapped. This is a backdoor way of getting backing-store to apply to all windows. Although all mapped windows will have backing store, the backing store attribute value reported by the server for a window will be the last value established by a client. If it has never been set by a client, the server will report the default value, NotUseful. This behavior is required by the X protocol, which allows the server to exceed the client's backing store expectations but does not provide a way to tell the client that it is doing so. .TP 8 .B \-x \fIextension\fP loads the specified extension at init. This is a no-op for most implementations. .SH SERVER DEPENDENT OPTIONS Some X servers accept the following options: .TP 8 .B \-ld \fIkilobytes\fP sets the data space limit of the server to the specified number of kilobytes. A value of zero makes the data size as large as possible. The default value of \-1 leaves the data space limit unchanged. .TP 8 .B \-lf \fIfiles\fP sets the number-of-open-files limit of the server to the specified number. A value of zero makes the limit as large as possible. The default value of \-1 leaves the limit unchanged. .TP 8 .B \-ls \fIkilobytes\fP sets the stack space limit of the server to the specified number of kilobytes. A value of zero makes the stack size as large as possible. The default value of \-1 leaves the stack space limit unchanged. .TP 8 .B \-logo turns on the X Window System logo display in the screen-saver. There is currently no way to change this from a client. .TP 8 .B nologo turns off the X Window System logo display in the screen-saver. There is currently no way to change this from a client. .SH XDMCP OPTIONS X servers that support XDMCP have the following options. See the \fIX Display Manager Control Protocol\fP specification for more information. .TP 8 .B \-query \fIhost-name\fP Enable XDMCP and send Query packets to the specified host. .TP 8 .B \-broadcast Enable XDMCP and broadcast BroadcastQuery packets to the network. The first responding display manager will be chosen for the session. .TP 8 .B \-indirect \fIhost-name\fP Enable XDMCP and send IndirectQuery packets to the specified host. .TP 8 .B \-port \fIport-num\fP Use an alternate port number for XDMCP packets. Must be specified before any \-query, \-broadcast or \-indirect options. .TP 8 .B \-class \fIdisplay-class\fP XDMCP has an additional display qualifier used in resource lookup for display-specific options. This option sets that value, by default it is "MIT-Unspecified" (not a very useful value). .TP 8 .B \-cookie \fIxdm-auth-bits\fP When testing XDM-AUTHENTICATION-1, a private key is shared between the server and the manager. This option sets the value of that private data (not that it is very private, being on the command line!). .TP 8 .B \-displayID \fIdisplay-id\fP Yet another XDMCP specific value, this one allows the display manager to identify each display so that it can locate the shared key. .SH XKEYBOARD OPTIONS X servers that support the XKEYBOARD extension accept the following options: .ig .TP 8 .B \-xkbdir \fIdirectory\fP base directory for keyboard layout files .. .TP 8 .B \-xkbmap \fIfilename\fP keyboard description to load on startup .TP 8 .B [+-]accessx enable(+) or disable(-) AccessX key sequences .TP 8 .B \-ar1 \fImilliseconds\fP sets the length of time in milliseconds that a key must be depressed before autorepeat starts .TP 8 .B \-ar2 \fImilliseconds\fP sets the length of time in milliseconds that should elapse between autorepeat-generated keystrokes .PP Many servers also have device-specific command line options. See the manual pages for the individual servers for more details. .SH SECURITY EXTENSION OPTIONS X servers that support the SECURITY extension accept the following option: .TP 8 .B \-sp \fIfilename\fP causes the server to attempt to read and interpret filename as a security policy file with the format described below. The file is read at server startup and reread at each server reset. .PP The syntax of the security policy file is as follows. Notation: "*" means zero or more occurrences of the preceding element, and "+" means one or more occurrences. To interpret , ignore the text after the /; it is used to distinguish between instances of in the next section. .PP .nf ::= * ::= '\en' ::= | | | ::= # * '\en' ::= '\en' ::= sitepolicy '\en' ::= property '\en' ::= ::= any | root | ::= | ::= = ::= [ | | ]* ::= r | w | d ::= a | i | e ::= | | ::= " * " ::= ' * ' ::= + ::= [ ' ' | '\et' ]* Character sets: ::= any character except '\en' ::= any character except " ::= any character except ' ::= any character except those in .fi .PP The semantics associated with the above syntax are as follows. .PP , the first line in the file, specifies the file format version. If the server does not recognize the version , it ignores the rest of the file. The version string for the file format described here is "version-1" . .PP Once past the , lines that do not match the above syntax are ignored. .PP lines are ignored. .PP lines are currently ignored. They are intended to specify the site policies used by the XC-QUERY-SECURITY-1 authorization method. .PP lines specify how the server should react to untrusted client requests that affect the X Window property named . The rest of this section describes the interpretation of an . .PP For an to apply to a given instance of , must be on a window that is in the set of windows specified by . If is any, the rule applies to on any window. If is root, the rule applies to only on root windows. .PP If is , the following apply. If is a , the rule applies when the window also has that , regardless of its value. If is a , must also have the value specified by . In this case, the property must have type STRING and format 8, and should contain one or more null-terminated strings. If any of the strings match , the rule applies. .PP The definition of string matching is simple case-sensitive string comparison with one elaboration: the occurence of the character '*' in is a wildcard meaning "any string." A can contain multiple wildcards anywhere in the string. For example, "x*" matches strings that begin with x, "*x" matches strings that end with x, "*x*" matches strings containing x, and "x*y*" matches strings that start with x and subsequently contain y. .PP There may be multiple lines for a given . The rules are tested in the order that they appear in the file. The first rule that applies is used. .PP specify operations that untrusted clients may attempt, and the actions that the server should take in response to those operations. .PP can be r (read), w (write), or d (delete). The following table shows how X Protocol property requests map to these operations in the X Consortium server implementation. .PP .nf GetProperty r, or r and d if delete = True ChangeProperty w RotateProperties r and w DeleteProperty d ListProperties none, untrusted clients can always list all properties .fi .PP can be a (allow), i (ignore), or e (error). Allow means execute the request as if it had been issued by a trusted client. Ignore means treat the request as a no-op. In the case of GetProperty, ignore means return an empty property value if the property exists, regardless of its actual value. Error means do not execute the request and return a BadAtom error with the atom set to the property name. Error is the default action for all properties, including those not listed in the security policy file. .PP An applies to all s that follow it, until the next is encountered. Thus, irwad means ignore read and write, allow delete. .PP GetProperty and RotateProperties may do multiple operations (r and d, or r and w). If different actions apply to the operations, the most severe action is applied to the whole request; there is no partial request execution. The severity ordering is: allow < ignore < error. Thus, if the for a property are ired (ignore read, error delete), and an untrusted client attempts GetProperty on that property with delete = True, an error is returned, but the property value is not. Similarly, if any of the properties in a RotateProperties do not allow both read and write, an error is returned without changing any property values. .PP Here is an example security policy file. .PP .ta 3i 4i .nf version-1 # Allow reading of application resources, but not writing. property RESOURCE_MANAGER root ar iw property SCREEN_RESOURCES root ar iw # Ignore attempts to use cut buffers. Giving errors causes apps to crash, # and allowing access may give away too much information. property CUT_BUFFER0 root irw property CUT_BUFFER1 root irw property CUT_BUFFER2 root irw property CUT_BUFFER3 root irw property CUT_BUFFER4 root irw property CUT_BUFFER5 root irw property CUT_BUFFER6 root irw property CUT_BUFFER7 root irw # If you are using Motif, you probably want these. property _MOTIF_DEFAULT_BINDINGS root ar iw property _MOTIF_DRAG_WINDOW root ar iw property _MOTIF_DRAG_TARGETS any ar iw property _MOTIF_DRAG_ATOMS any ar iw property _MOTIF_DRAG_ATOM_PAIRS any ar iw # The next two rules let xwininfo -tree work when untrusted. property WM_NAME any ar # Allow read of WM_CLASS, but only for windows with WM_NAME. # This might be more restrictive than necessary, but demonstrates # the facility, and is also an attempt to # say "top level windows only." property WM_CLASS WM_NAME ar # These next three let xlsclients work untrusted. Think carefully # before including these; giving away the client machine name and command # may be exposing too much. property WM_STATE WM_NAME ar property WM_CLIENT_MACHINE WM_NAME ar property WM_COMMAND WM_NAME ar # To let untrusted clients use the standard colormaps created by # xstdcmap, include these lines. property RGB_DEFAULT_MAP root ar property RGB_BEST_MAP root ar property RGB_RED_MAP root ar property RGB_GREEN_MAP root ar property RGB_BLUE_MAP root ar property RGB_GRAY_MAP root ar # To let untrusted clients use the color management database created # by xcmsdb, include these lines. property XDCCC_LINEAR_RGB_CORRECTION root ar property XDCCC_LINEAR_RGB_MATRICES root ar property XDCCC_GRAY_SCREENWHITEPOINT root ar property XDCCC_GRAY_CORRECTION root ar # To let untrusted clients use the overlay visuals that many vendors # support, include this line. property SERVER_OVERLAY_VISUALS root ar # Dumb examples to show other capabilities. # oddball property names and explicit specification of error conditions property "property with spaces" 'property with "' aw er ed # Allow deletion of Woo-Hoo if window also has property OhBoy with value # ending in "son". Reads and writes will cause an error. property Woo-Hoo OhBoy = "*son" ad .fi .SH "NETWORK CONNECTIONS" The X server supports client connections via a platform-dependent subset of the following transport types: TCP\/IP, Unix Domain sockets, DECnet, and several varieties of SVR4 local connections. See the DISPLAY NAMES section of the \fIX(1)\fP manual page to learn how to specify which transport type clients should try to use. .SH GRANTING ACCESS The X server implements a platform-dependent subset of the following authorization protocols: MIT-MAGIC-COOKIE-1, XDM-AUTHORIZATION-1, SUN-DES-1, and MIT-KERBEROS-5. See the \fIXsecurity(1)\fP manual page for information on the operation of these protocols. .PP Authorization data required by the above protocols is passed to the server in a private file named with the \fB\-auth\fP command line option. Each time the server is about to accept the first connection after a reset (or when the server is starting), it reads this file. If this file contains any authorization records, the local host is not automatically allowed access to the server, and only clients which send one of the authorization records contained in the file in the connection setup information will be allowed access. See the \fIXau\fP manual page for a description of the binary format of this file. See \fIxauth(1)\fP for maintenance of this file, and distribution of its contents to remote hosts. .PP The X server also uses a host-based access control list for deciding whether or not to accept connections from clients on a particular machine. If no other authorization mechanism is being used, this list initially consists of the host on which the server is running as well as any machines listed in the file \fI/etc/X\fBn\fI.hosts\fR, where \fBn\fP is the display number of the server. Each line of the file should contain either an Internet hostname (e.g. expo.lcs.mit.edu) or a DECnet hostname in double colon format (e.g. hydra::). There should be no leading or trailing spaces on any lines. For example: .sp .in +8 .nf joesworkstation corporate.company.com star:: bigcpu:: .fi .in -8 .PP Users can add or remove hosts from this list and enable or disable access control using the \fIxhost\fP command from the same machine as the server. .PP The X protocol intrinsically does not have any notion of window operation permissions or place any restrictions on what a client can do; if a program can connect to a display, it has full run of the screen. X servers that support the SECURITY extension fare better because clients can be designated untrusted via the authorization they use to connect; see the \fIxauth(1)\fP manual page for details. Restrictions are imposed on untrusted clients that curtail the mischief they can do. See the SECURITY extension specification for a complete list of these restrictions. .PP Sites that have better authentication and authorization systems might wish to make use of the hooks in the libraries and the server to provide additional security models. .SH SIGNALS The X server attaches special meaning to the following signals: .TP 8 .I SIGHUP This signal causes the server to close all existing connections, free all resources, and restore all defaults. It is sent by the display manager whenever the main user's main application (usually an \fIxterm\fP or window manager) exits to force the server to clean up and prepare for the next user. .TP 8 .I SIGTERM This signal causes the server to exit cleanly. .TP 8 .I SIGUSR1 This signal is used quite differently from either of the above. When the server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to its parent process after it has set up the various connection schemes. \fIXdm\fP uses this feature to recognize when connecting to the server is possible. .SH FONTS The X server can obtain fonts from directories and/or from font servers. The list of directories and font servers the X server uses when trying to open a font is controlled by the \fIfont path\fP. .LP The default font path is "/lib/X11/fonts/misc/, /lib/X11/fonts/Speedo/, /lib/X11/fonts/Type1/, /lib/X11/fonts/75dpi/, /lib/X11/fonts/100dpi/" . where refers to the root of the X11 install tree. .LP The font path can be set with the \fB\-fp\fP option or by \fIxset(1)\fP after the server has started. .SH FILES .TP 30 /etc/X\fBn\fP.hosts Initial access control list for display number \fBn\fP .TP 30 /lib/X11/fonts/misc, /lib/X11/fonts/75dpi, /lib/X11/fonts/100dpi Bitmap font directories .TP 30 /lib/X11/fonts/Speedo, /lib/X11/fonts/Type1 Outline font directories .TP 30 /lib/X11/fonts/PEX PEX font directories .TP 30 /lib/X11/rgb.txt Color database .TP 30 /tmp/.X11-unix/X\fBn\fP Unix domain socket for display number \fBn\fP .TP 30 /tmp/rcX\fBn\fP Kerberos 5 replay cache for display number \fBn\fP .TP 30 /usr/adm/X\fBn\fPmsgs Error log file for display number \fBn\fP if run from \fIinit(8)\fP .TP 30 /lib/X11/xdm/xdm-errors Default error log file if the server is run from \fIxdm(1)\fP .LP Note: refers to the root of the X11 install tree. .SH "SEE ALSO" General information: X(1) .PP Protocols: .I "X Window System Protocol," .I "The X Font Service Protocol," .I "X Display Manager Control Protocol" .PP Fonts: bdftopcf(1), mkfontdir(1), xfs(1), xlsfonts(1), xfontsel(1), xfd(1), .I "X Logical Font Description Conventions" .PP Security: Xsecurity(1), xauth(1), Xau(1), xdm(1), xhost(1), .I "Security Extension Specification" .PP Starting the server: xdm(1), xinit(1) .PP Controlling the server once started: xset(1), xsetroot(1), xhost(1) .PP Server-specific man pages: Xdec(1), XmacII(1), Xsun(1), Xnest(1), Xvfb(1), XF86_Accel(1), XF86_Mono(1), XF86_SVGA(1), XF86_VGA16(1), XFree86(1) .PP Server internal documentation: .I "Definition of the Porting Layer for the X v11 Sample Server" .SH AUTHORS The sample server was originally written by Susan Angebranndt, Raymond Drewry, Philip Karlton, and Todd Newman, from Digital Equipment Corporation, with support from a large cast. It has since been extensively rewritten by Keith Packard and Bob Scheifler, from MIT. Dave Wiggins took over post-R5 and made substantial improvements. vnc_unixsrc/Xvnc/programs/Imakefile0100664000076400007640000000363107120677563017071 0ustar constconstXCOMM $XConsortium: Imakefile /main/83 1996/12/18 16:29:30 lehors $ XCOMM $XFree86: xc/programs/Imakefile,v 3.15.2.2 1998/02/15 16:08:40 hohndel Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" #if BuildServer RGBSRCDIR = rgb XSSRCDIR = Xserver #endif #ifndef Win32Architecture #if HasXServer XINITSRCDIR = xinit #endif #if BuildFontServer XFSSRCDIR = xfs #endif #if BuildXKBlib XKBSRCDIRS = setxkbmap xkbcomp xkbevd xkbprint xkbutils #endif #if BuildScreenSaverExt SCREENSAVESRCDIR = beforelight #endif #if BuildXF86VidModeExt XVIDTUNESRCDIR = xvidtune #endif #if BuildXF86DGA XF86DGASRCDIR = xf86dga #endif #if BuildXAServer XASSRCDIR = Xaserver #endif #if BuildLBX LBXPROXYSRCDIR = lbxproxy #endif PROXYMGRSRCDIR = proxymngr RSTARTSRCDIR = rstart SMPROXYSRCDIR = smproxy TWMSRCDIR = twm XCONSOLESRCDIR = xconsole XDMSRCDIR = xdm XFINDPROXYSRCDIR = xfindproxy XFWPSRCDIR = xfwp XHOSTSRCDIR = xhost XMHSRCDIR = xmh XRXSRCDIR = xrx XSMSRCDIR = xsm XTERMSRCDIR = xterm SCRIPTSDIR = scripts #endif #if BuildServersOnly SUBDIRS = $(XSSRCDIR) #else SUBDIRS = \ appres bdftopcf bitmap $(SCREENSAVESRCDIR) editres fsinfo \ fslsfonts fstobdf \ iceauth mkfontdir oclock $(PROXYMGRSRCDIR) \ $(RGBSRCDIR) $(RSTARTSRCDIR) $(SMPROXYSRCDIR) $(TWMSRCDIR) x11perf \ xauth xclipboard xclock xcmsdb $(XCONSOLESRCDIR) $(XDMSRCDIR) \ xdpyinfo $(XF86DGASRCDIR) xfd $(XFSSRCDIR) $(XFINDPROXYSRCDIR) \ $(XFWPSRCDIR) \ $(XHOSTSRCDIR) xieperf $(XINITSRCDIR) $(XKBSRCDIRS) xkill xlogo \ xlsatoms xlsclients xlsfonts xmag $(XMHSRCDIR) xmodmap xprop \ xrdb xrefresh $(XRXSRCDIR) xset xsetroot $(XSMSRCDIR) xstdcmap \ xsetmode xsetpointer \ $(XTERMSRCDIR) $(XVIDTUNESRCDIR) xwd xwininfo xwud \ $(XSSRCDIR) $(XASSRCDIR) \ $(LBXPROXYSRCDIR) $(SCRIPTSDIR) #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) vnc_unixsrc/Xvnc/INSTALL.TXT0100664000076400007640000005445707120677563015151 0ustar constconst Building and Installing the X Window System Stephen Gildea X Consortium March 5, 1996 Updated For Release 6.3 Copyright c 1995, 1996 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dis- tribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the fol- lowing conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL- ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. X Window System is a trademark of X Consortium, Inc. 1. Easy Build Instructions This quick summary is no substitute for reading the full build instruc- tions later in this document. Edit xc/config/cf/site.def for local preferences. If you want to build with gcc uncomment the HasGcc2 line. If you want to install somewhere other than /usr/X11R6.3, change ProjectRoot. (Do not use DESTDIR.) If any fixes have been released by the X Consortium, stop here and fol- low the instructions at the top of each patch, but don't do any of the make commands suggested in the patches. Then continue here. Check the appropriate vendor-specific .cf file in xc/config/cf/ to make sure that OSMajorVersion and OSMinorVersion are set correctly for your system. Override them in site.def if necessary. See if there is a BootstrapCFlags mentioned in the comments in the vendor-specific .cf file. If there isn't one, cd to the xc directory and type: % make World >& world.log If there is a BootstrapCFlags, take its value and type: % make World BOOTSTRAPCFLAGS="value" >& world.log Do not call the output file "make.log" when doing "make World". After a successful build, you can install with: % make install >& install.log You can install manual pages with: % make install.man >& man.log While the system is building (or if things fail), read the rest of these installation instructions. 2. Building X This document gives detailed instructions for building Release 6: get- ting it off the distribution medium, configuring, compiling, installing, running, and updating. Release Notes are in xc/RELNOTES.* (various formats) in the distribu- tion. More recent information about newly-discovered problems may be found in the Frequently Asked Questions posting appearing monthly on the comp.windows.x newsgroup and xpert mailing list. It is also available via anonymous FTP on ftp.x.org in the file contrib/faqs/FAQ.Z, or on your local X mirror site. 2.1. Preparing the Site If you are unpacking tar files, you will need about 130 Mb to hold the xc/ part. To install requires 30-50 Mb assuming you have shared libraries (80-100 Mb without). You will need an equivalent amount of extra space to build, since you also need room for all the object files. Distributed as tar files, Release 6.3 core is divided into parts as fol- lows: xc-1.tar contains everything in xc/ that isn't in the other tar files xc-2.tar contains xc/fonts, xc/doc/specs, xc/util xc-3.tar contains xc/doc/hardcopy If you define BuildFonts to NO, you only need to unpack xc-1.tar to build. If you build fonts, then you will also need xc-2.tar to build. 2.2. Unpacking the Distribution The distribution normally comes as multiple tar files, either on tape or across a network, or as a CD-ROM. 2.2.1. Unpacking a Compressed FTP Distribution If you have obtained compressed tar files over the network, create a directory to hold the sources and cd into it: mkdir sourcedir cd sourcedir Then for each tar file xc-*.tar.Z, execute this: zcat ftp-dir/xc-N.tar.Z | tar xf - 2.2.2. Unpacking a gzipped FTP Distribution If you have obtained gzipped tar files over the network, create a direc- tory to hold the sources and cd into it: mkdir sourcedir cd sourcedir Then for each tar file xc-*.tar.gz, execute this: gunzip -c ftp-dir/xc-N.tar.gz | tar xf - 2.2.3. Unpacking a Split Compressed FTP Distribution If you have obtained compressed and split tar files over the network, create a directory to hold the sources: mkdir sourcedir Then for each directory xc-*: cd ftp-dir/xc-N cat xc-N.?? | uncompress | (cd sourcedir; tar xf -) 2.2.4. Unpacking the Tape Distribution If you have obtained a tape, create a directory to hold the sources and untar everything into that directory: mkdir sourcedir cd sourcedir tar xf tape-device 2.2.5. Using the CD-ROM If you have obtained a CD-ROM, you don't have to do anything to unpack it. However, you will have to create a symbolic link tree to build X. See the next section. To mount the CD-ROM, see the mount(8) manual page on your system or the liner notes that came with the CD-ROM. Some systems, e.g., Solaris 2, can automatically mount the CD-ROM for you. 2.3. Apply Patches If there are fixes released that are more recent than your distribution, apply them now. Follow the instructions at the top of each patch, but don't do any make commands. See the section "Public Patches" later in this document. Then continue here. 2.4. Symbolic Link Trees If you expect to build the distribution on more than one machine using a shared source tree, or you are building from CD-ROM, or you just want to keep the source tree pure, you may want to use the program xc/config/util/lndir.c to create a symbolic link tree on each build machine. The links may use an additional 10 megabytes, but it is cheaper than having multiple copies of the source tree. It may be tricky to compile lndir before the distribution is built. If you have a copy from a previous release, use that. Makefile.ini can be used for building lndir the first time. You may have to specify OSFLAGS=-Dsomething to get it to compile. What you would pass as BOOTSTRAPCFLAGS might work. The command line looks something like this: make -f Makefile.ini OSFLAGS=-Dflag To use a symbolic link tree, create a directory for the build, cd to it, and type this: lndir sourcedir where sourcedir is the pathname of the directory where you stored the sources. All of the build instructions given below should then be done in the build directory on each machine, rather than in the source direc- tory. xc/config/util/mkshadow/ contains mkshadow, an alternative program to lndir. 2.5. Configuration Parameters Build information for each source directory is in files called Imakefile. An Imakefile, along with local configuration information in xc/config/cf/, is used by the program imake to generate a Makefile. Most of the configuration work prior to building the release is to set parameters so that imake will generate correct files. Most of those parameters are set in xc/config/cf/site.def. You will also need to check the appropriate vendor-specific .cf file in xc/config/cf/ to make sure that OSMajorVersion, OSMinorVersion, and OsTeenyVersion are set correctly for your system. Override them in site.def if necessary. The site.def file has two parts, one protected with "#ifdef BeforeVen- dorCF" and one with "#ifdef AfterVendorCF". The file is actually pro- cessed twice, once before the .cf file and once after. About the only thing you need to set in the "before" section is HasGcc2; just about everything else can be set in the "after" section. The sample site.def also has commented out support to include another file, host.def. This scheme may be useful if you want to set most parameters site-wide, but some parameters vary from machine to machine. If you use a symbolic link tree, you can share site.def across all machines, and give each machine its own copy of host.def. The config parameters are listed in xc/config/cf/README, but here are some of the more common parameters that you may wish to set in site.def. ProjectRoot The destination where X will be installed. This variable needs to be set before you build, as some programs that read files at run- time have the installation directory compiled in to them. Assuming you have set the variable to some value /path, files will be installed into /path/bin, /path/include/X11, /path/lib, and /path/man. HasGccSet to YES to build with gcc version 1. HasGcc2 Set to YES to build with gcc version 2. Both this option and HasGcc look for a compiler named gcc, but HasGcc2 will cause the build to use more features of gcc 2, such as the ability to compile shared libraries. BuildXInputExt Set to YES to build the X Input Extension. This extension requires device-dependent support in the X server, which exists only in Xhp in our implementation. BuildPexExt Set to NO to not build the PEX server extension and fonts. DefaultUsrBin This is a directory where programs will be found even if PATH is not set in the environment. It is independent of ProjectRoot and defaults to /usr/bin. It is used, for example, when connecting from a remote system via rsh. The rstart program installs its server in this directory. InstallServerSetUID Some systems require the X server to run as root to access the dev- ices it needs. If you are on such a system and will not be using xdm, you can set this variable to YES to install the X server setuid to root. Note that the X server has not been analyzed by the X Consortium for security in such an installation; talk to your system manager before setting this variable. InstallXdmConfig By default set to NO, which suppresses installing xdm config files over existing ones. Leave it set to NO if your site has customized the files in /usr/X11R6.3/lib/X11/xdm, as many sites do. If you don't install the new files, merge any changes present in the new files. MotifBC Causes Xlib and Xt to work around some bugs in older versions of Motif. Set to YES only if you will be linking with Motif version 1.1.1, 1.1.2, or 1.1.3. GetValuesBC Setting this variable to YES allows illegal XtGetValues requests with NULL ArgVal to usually succeed, as R5 did. Some applications erroneously rely on this behavior. Support for this will be removed in a future release. The following vendor-specific .cf files are in the release but have not been tested recently and hence probably need changes to work: apollo.cf, bsd.cf, convex.cf, DGUX.cf, luna.cf, macII.cf, Mips.cf, moto.cf, Oki.cf, pegasus.cf, x386.cf. Amoeba.cf is known to require additional patches. The file xc/lib/Xdmcp/Wraphelp.c, for XDM-AUTHORIZATION-1, is not included in this release. 2.6. System Build Notes This section contains hints on building X with specific compilers and operating systems. If the build isn't finding things right, make sure you are using a com- piler for your operating system. For example, a pre-compiled gcc for a different OS will not have right symbols defined, so imake will not work correctly. 2.6.1. gcc gcc version 2 is in regular use at the X Consortium on Sparc platforms. Set the variable HasGcc2. X will not compile on some systems with gcc version 2.5, 2.5.1, or 2.5.2 because of an incorrect declaration of mem- move() in a gcc include file. If you are using a gcc version older than 2.7 on Solaris x86, you need to specify BOOTSTRAPCFLAGS="-Dsun" in the "make World" command. 2.6.2. Other GNU tools Use of the GNU assembler, as, or linker, ld, is not supported. GNU make is not supported. 2.6.3. SparcWorks 2.0 If you have a non-threaded program and want to debug it with the old SparcWorks 2.0 dbx, you will need to use the thread stubs library in xc/util/misc/thr_stubs.c. Compile it as follows: cc -c thr_stubs.c ar cq libthr_stubs.a thr_stubs.o ranlib libthr_stubs.a Install libthr_stubs.a in the same directory with your X libraries (e.g., /usr/X11R6.3/lib/libthr_stubs.a). Add the following line to site.def: #define ExtraLibraries -lsocket -lnsl $(CDEBUGFLAGS:-g=-lthr_stubs) This example uses a make macro substitution; not all make implementa- tions support this feature. 2.6.4. CenterLine C under Solaris 2 If you are using the CenterLine C compiler to compile the distribution under Solaris 2, place the following line in your site.def: #define HasCenterLineC YES If clcc is not in your default search path, add this line to site.def: #define CcCmd /path/to/your/clcc If you are using CodeCenter 4.0.4 or earlier, the following files trigger bugs in the clcc optimizer: xc/programs/Xserver/cfb16/cfbgetsp.c xc/programs/Xserver/cfb16/cfbfillsp.c xc/programs/Xserver/cfb/cfbgetsp.c Thus to build the server, you will have to compile these files by hand with the -g flag: % cd xc/programs/Xserver/cfb16 % make CDEBUGFLAGS="-g" cfbgetsp.o cfbfillsp.o % cd ../cfb % make CDEBUGFLAGS="-g" cfbgetsp.o This optimizer bug appears to be fixed in CodeCenter 4.0.6. 2.6.5. IBM AIX 4.1.4 On AIX 4.1.4, the file lib/font/Type1/objects.c must be compiled without optimization (-O) else the X server will exit when Type 1 fonts are used. 2.6.6. SunOS 4 SunOS 4.0 and earlier need BOOTSTRAPCFLAGS=-DNOSTDHDRS because they do not have unistd.h nor stdlib.h. Do not supply a BOOTSTRAPCFLAGS when building any SunOS 4.1 version. 2.6.7. Microsoft Windows NT All of the base libraries are supported, including multi-threading in Xlib and Xt, but some of the more complicated applications, specifically xterm and xdm, are not supported. There are also some other rough edges in the implementation, such as lack of support for non-socket file descriptors as Xt alternate inputs and not using the registry for configurable parameters like the system filenames and search paths. The Xnest server has been made to run on NT. It requires a real X server for output still. 2.6.8. Omron Luna The Omron Luna platform is no longer supported. The Luna version of the make program doesn't define the standard macro MAKE, so you must run it as "make MAKE=make" at top level, e.g., "make MAKE=make World". 2.7. The Build On NT, type nmake World.Win32 > world.log On other systems, find the BootstrapCFlags line, if any, in the vendor- specific .cf file. If there isn't one, type % make World >& world.log otherwise type % make World BOOTSTRAPCFLAGS="value" >& world.log You can call the output file something other than "world.log", but do not call it "make.log" because files with this name are automatically deleted during the "cleaning" stage of the build. Because the build can take several hours to complete, you will probably want to run it in the background and keep a watch on the output. For example: % make World >& world.log & % tail -f world.log If something goes wrong, the easiest thing is to just start over (typing "make World" again) once you have corrected the problem. 2.8. Installing X If everything is built successfully, you can install the software by typing the following as root: % make install >& install.log Again, you might want to run this in the background and use tail to watch the progress. You can install the manual pages by typing the following as root: % make install.man >& man.log 2.8.1. System Installation Notes This section contains hints on installing and using X with specific com- pilers and operating systems. 2.8.1.1. The X Server on AIX 4 For IBM's AIX 4, you need to make sure the LFT device is associated with the correct graphics adapter. It's a one-time setup that does not hap- pen automatically, even if there's only one graphics adapter in the sys- tem. To configure the LFT device properly, become root and start SMIT. Go to the "Devices" category, choose "LFT", then "Displays", then "Move the LFT to Another Display". Select "Both" for when the change should take effect, then select the display adapter where you want to run the X server. Confirm the changes and exit SMIT; from now on, you should be able to run the server just fine. To run Xibm from xdm, you must provide the "-force" flag on the server command line in the Xservers file. 2.9. Shared Libraries The version number of some of the the shared libraries has been changed. On SunOS 4, which supports minor version numbers for shared libraries, programs linked with the R6 libraries will use the new libraries with no special action required. On other platforms you have the following choices: 1. Keep the old versions of the libraries around. 2. Relink all applications with the new libraries. 3. Create a link from the old name to the new name. For example, to have programs that were linked against libX11.so.6.0 use libX11.so.6.3, make this link: ln -s libX11.so.6.3 libX11.so.6.0 2.10. Setting Up xterm If your /etc/termcap and /usr/lib/terminfo databases do not have correct entries for xterm, use the sample entries provided in the directory xc/programs/xterm/. System V users may need to compile and install the terminfo entry with the tic utility. Since each xterm will need a separate pseudoterminal, you need a reason- able number of them for normal execution. You probably will want at least 32 on a small, multiuser system. On most systems, each pty has two devices, a master and a slave, which are usually named /dev/tty[pqrstu][0-f] and /dev/pty[pqrstu][0-f]. If you don't have at least the "p" and "q" sets configured (try typing "ls /dev/?ty??"), you should have your system administrator add them. This is commonly done by running the MAKEDEV script in the /dev directory with appropriate ar- guments. 2.11. Starting Servers at System Boot The xfs and xdm programs are designed to be run automatically at system startup. Please read the manual pages for details on setting up confi- guration files; reasonable sample files are in xc/programs/xdm/config/ and xc/programs/xfs/. 2.11.1. On BSD-based systems using /etc/rc If your system uses an /etc/rc file at boot time, you can usually enable these programs by placing the following at or near the end of the file: if [ -f /usr/X11R6.3/bin/xfs ]; then /usr/X11R6.3/bin/xfs & echo -n ' xfs' fi if [ -f /usr/X11R6.3/bin/xdm ]; then /usr/X11R6.3/bin/xdm; echo -n ' xdm' fi Since xfs can serve fonts over the network, you do not need to run a font server on every machine with an X display. You should start xfs before xdm, since xdm may start an X server which is a client of the font server. The examples here use /usr/X11R6.3/bin, but if you have installed into a different directory by setting (or unsetting) ProjectRoot then you need to substitute the correct directory. If you are unsure about how system boot works, or if your system does not use /etc/rc, consult your system administrator for help. 2.11.2. On SystemV-based systems There are two ways you can get On systems with a /etc/inittab file, you can edit this file to add the lines xfs:3:once:/usr/X11R6.3/bin/xfs xdm:3:once:/usr/X11R6.3/bin/xdm On some systems, you can edit a file in /etc/init.d to run the X Consor- tium xdm instead of the vendor's product xdm. On Sony this file is /etc/init.d/consxdm. On IRIX edit /etc/init.d/xdm. 2.12. Using OPEN LOOK applications You can use the X11R6 Xsun server with OPEN LOOK applications, but you must pass the -swapLkeys flag to the server on startup, or the OPEN LOOK Undo, Copy, Paste, Find, and Cut keys may not work correctly. For exam- ple, to run Sun's OpenWindows 3.3 desktop environment with an X11R6 server, use the command: % openwin -server /usr/X11R6.3/bin/Xsun -swapLkeys The keysyms reported by keys on the numeric keypad have also changed since X11R5; if you find that OpenWindows applications do not respond to keypad keys and cursor control keys when using the R6 server, you can remap the keypad to generate R5 style keysyms using the following xmod- map commands: keysym Pause = F21 keysym Print = F22 keysym Break = F23 keysym KP_Equal = F24 keysym KP_Divide = F25 keysym KP_Multiply = F26 keysym KP_Home = F27 keysym KP_Up = Up keysym KP_Prior = F29 keysym KP_Left = Left keycode 100 = F31 keysym KP_Right = Right keysym KP_End = F33 keysym KP_Down = Down keysym KP_Next = F35 keysym KP_Insert = Insert keysym KP_Delete = Delete 2.13. Rebuilding after Patches You shouldn't need this right away, but eventually you are probably go- ing to make changes to the sources, for example by applying any public patches that may be released. Each patch comes with explicit instructions at the top of it saying what to do. Thus the procedure here is only an overview of the types of com- mands that might be necessary to rebuild X after changing it. If you are building from CD-ROM, apply the patches to the symbolic link tree. The links to changed files will be replaced with local files con- taining the new contents. If only source files are changed, you should be able to rebuild just by going to the xc directory in your build tree and typing: % make >& make.log If configuration files are changed, the safest thing to do is type: % make Everything >& every.log "Everything" is similar to "World" in that it rebuilds every Makefile, but unlike "World" it does not delete the existing objects, libraries, and executables, and only rebuilds what is out of date. 2.14. Formatting the Documentation The PostScript files in xc/doc/hardcopy can be generated from the sources in xc/doc/specs. Most of the documentation is in troff using the -ms macros. The easiest way to format it is to use the Imakefiles provided. Set the name of your local troff program by setting the variable TroffCmd in xc/config/cf/site.def. Then build the Makefiles: cd xc/doc make SUBDIRS=specs Makefiles Finally, go to the directory you are interested in and type "make" there. This command will generate .PS files. You can also generate text files by specifying the document name with a .txt extension as a make target, e.g., "make icccm.txt". vnc_unixsrc/Xvnc/Imakefile0100664000076400007640000001054607463513423015234 0ustar constconstXCOMM $XConsortium: Imakefile /main/137 1996/10/08 07:38:14 swick $ XCOMM $XFree86: xc/Imakefile,v 3.11.2.2 1998/02/28 04:47:00 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" RELEASE = "Release 6.3" #ifndef OSName #define OSName Unknown Operating System! #endif #if !BuildServersOnly #if BuildFonts FONTSDIR = fonts #endif #ifndef Win32Architecture DOCSDIR = doc NLSSUBDIR = nls #endif #endif SUBDIRS = include config lib $(NLSSUBDIR) \ programs $(FONTSDIR) $(DOCSDIR) LNINSTALLDIRS = lib #if HasParallelMake #ifdef ParallelDefines PARALLELOPTS = ParallelDefines #endif #endif MakeSubdirs($(SUBDIRS)) MakeLintSubdirs($(LNINSTALLDIRS),install.ln,install.ln) MakeLintSubdirs($(LNINSTALLDIRS),external.ln,lintlib) DependSubdirs($(SUBDIRS)) #define IHaveSpecialMakefileTarget #ifndef Win32Architecture #ifndef OS2Architecture VerifyOS:: @echo "" @echo Building on OSName "("OSMajorVersion"."OSMinorVersion"."OSTeenyVersion")." @echo "" #ifdef LinuxArchitecture @echo libc version LinuxCLibMajorVersion"."LinuxCLibMinorVersion"."LinuxCLibTeenyVersion @echo "" #endif includes:: MakeDir($(BUILDINCDIR)) MakeDir($(BUILDBINDIR)) XCOMM XCOMM Watch out!!! Make sure you do make includes after removing X11.... XCOMM clean:: $(RM) -r $(BUILDINCDIR) $(RM) -r $(BUILDLIBDIR) $(RM) -r $(BUILDBINDIR) World:: $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(PARALLELOPTS) all Everything:: @echo "" @echo Rebuilding $(RELEASE) of the X Window System. @echo "" @date @echo "" cd $(IMAKESRC) && if [ -f Makefile ]; then \ $(MAKE) $(MFLAGS) BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ else \ $(MAKE) $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ fi $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) includes $(MAKE) $(MFLAGS) $(MAKE_OPTS) depend $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(WORLDOPTS) @echo "" @date @echo "" @echo Rebuild of $(RELEASE) of the X Window System complete. @echo "" XCOMM clean out link tree looking for stuff that should get checked in dangerous_strip_clean:: $(MAKE) -k clean find . -type l -exec rm {} \; find . \( \! \( -type d -o -name Makefile \) \) -print #else /* OS2Architecture */ VerifyOS:: @echo : @echo Building on OSName. @echo : includes:: MakeDir($(subst /,\,$(BUILDINCDIR))) XCOMM XCOMM Watch out!!! Make sure you do make includes after removing X11.... XCOMM clean:: $(RM) -r $(BUILDINCDIR) $(RM) -r $(BUILDLIBDIR) Everything:: @echo : @echo Building $(RELEASE) of the X Window System on OS/2 @echo : @echo : \indir $(IMAKESRC) $(MAKE) $(MFLAGS) SHELL= -f Makefile.ini BOOTSTRAPCFLAGS=-Zexe if exist Makefile.bak del Makefile.bak if exist MAkefile ren Makefile Makefile.bak $(MAKE) $(MFLAGS) -f Makefile.bak Makefile $(MAKE) $(MFLAGS) SHELL= VerifyOS $(MAKE) $(MFLAGS) SHELL= Makefiles $(MAKE) $(MFLAGS) SHELL= clean $(MAKE) $(MFLAGS) SHELL= includes $(MAKE) $(MFLAGS) SHELL= depend $(MAKE) $(MFLAGS) @echo : @echo : @echo Rebuild of $(RELEASE) of the X Window System complete. @echo : #ifdef ProjectRoot install:: MakeDir($(subst /,\,$(PROJECTROOT))) #endif install:: MakeDir($(subst /,\,$(INCROOT))) MakeDir($(subst /,\,$(USRLIBDIR))) MakeDir($(subst /,\,$(LIBDIR))) #endif #else /* not Win32Architecture else */ VerifyOS:: @echo : @echo Building on OSName. @echo : includes:: MakeDir($(BUILDINCDIR:/=\)) XCOMM XCOMM Watch out!!! Make sure you do make includes after removing X11.... XCOMM clean:: RmTreeCmd $(BUILDINCDIR:/=\) RmTreeCmd $(BUILDLIBDIR:/=\) Everything:: @echo : @echo Rebuilding $(RELEASE) of the X Window System. @echo : @echo : cd $(IMAKESRC) $(MAKE) $(MFLAGS) -f Makefile.ini imake.exe cd ..\.. $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) includes $(MAKE) $(MFLAGS) $(MAKE_OPTS) depend $(MAKE) $(MFLAGS) $(MAKE_OPTS) $(WORLDOPTS) @echo : @echo : @echo Rebuild of $(RELEASE) of the X Window System complete. @echo : #ifdef ProjectRoot install:: MakeDir($(PROJECTROOT:/=\)) #endif install:: MakeDir($(INCROOT:/=\)) MakeDir($(USRLIBDIR:/=\)) MakeDir($(LIBDIR:/=\)) #endif /* not Win32Architecture else */ #ifndef MakeManKeywords #define MakeManKeywords YES /* install.man rebuilds "man -k" database? */ #endif #undef BootstrapCleanSubdirs #define BootstrapCleanSubdirs BOOTSTRAPSUBDIRS="$(BOOTSTRAPSUBDIRS)" BOOTSTRAPSUBDIRS = imake makedepend vnc_unixsrc/Xvnc/bug-report0100664000076400007640000000374307120677563015443 0ustar constconstTo: xbugs@x.org Subject: [area]: [synopsis] [replace with actual area and short description] VERSION: R6.3, public-patch-2 [X Consortium public patches edit this line to indicate the patch level] CLIENT MACHINE and OPERATING SYSTEM: [e.g. Sparc/SunOS 5.3, DECstation 5000/Ultrix 4.3, HP 9000-730/HP-UX 9.1] DISPLAY TYPE: [e.g. Sun GX, 8-bit framebuffer, IBM Skyway ...] WINDOW MANAGER: [e.g. twm, mwm, gwm, olwm, ...] COMPILER: [e.g. native ANSI cc, native cc, gcc 2.5.8, ...] AREA: [Area of the source tree affected, e.g., Xserver, Xlib, Xt, Xaw, PEX, twm, xterm, xmh, config, .... Please only one area per bug report.] SYNOPSIS: [Brief description of the problem and where it is located] DESCRIPTION: [Detailed description of problem. Don't just say " doesn't work, here's a fix," explain what your program does to get to the state. If this is a request for an enhancement, justify it.] REPEAT BY: [What you did to get the error; include test program or session transcript if at all possible. If you include a program, make sure it depends only on libraries in the X distribution, not on any vendor or third-party libraries. Be specific; if we can't reproduce it, we can't fix it. Don't just say "run this program and it will be obvious," tell us exactly what we should see when the program is run. Bug reports without a clear, deterministic way of reproducing them will be fixed only after all bug reports that do.] SAMPLE FIX: [Preferred, but not necessary. Please send context diffs (`diff -c original-file fixed-file`). Be sure to include our "XConsortium" ident line in any diffs. The best way to do this is to add your own versioning line immediately after ours.] [PLEASE make your Subject: line as descriptive as possible. Subjects like "xterm bug" or "bug report" are not helpful!] [Remove all the explanatory text in brackets before mailing.] [Send to xbugs@x.org, as shown in the sample message header above] vnc_unixsrc/Xvnc/INSTALL.PS0100664000076400007640000015043307120677563015003 0ustar constconst%!PS-Adobe-3.0 %%Creator: groff version 1.09 %%CreationDate: Sun Dec 22 20:42:59 1996 %%DocumentNeededResources: font Times-Bold %%+ font Times-Italic %%+ font Times-Roman %%DocumentSuppliedResources: procset grops 1.09 0 %%Pages: 13 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.09 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore showpage }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{ pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit [] 0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{} def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic %%IncludeResource: font Times-Roman grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron /scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent /ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen /period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O /P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex /underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y /z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft /guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl /endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut /dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash /quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen /brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft /logicalnot/minus/registered/macron/degree/plusminus/twosuperior /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior /ordmasculine/guilsinglright/onequarter/onehalf/threequarters /questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE /Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex /Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis /multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn /germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash /ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def /Times-Roman@0 ENC0/Times-Roman RE/Times-Italic@0 ENC0/Times-Italic RE /Times-Bold@0 ENC0/Times-Bold RE %%EndProlog %%Page: title 1 %%BeginPageSetup BP %%EndPageSetup /F0 15/Times-Bold@0 SF(Building and Installing the X W)159.51 123 Q (indo)-.27 E 3.75(wS)-.15 G(ystem)-3.75 E/F1 11/Times-Italic@0 SF (Stephen Gildea)272.241 219 Q/F2 11/Times-Roman@0 SF 2.75(XC)274.677 249 S(onsortium)-2.75 E(March 5, 1996)273.77 333 Q(Updated F)251.704 357 Q (or Release 6.3)-.165 E EP %%Page: copyr 2 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF(Cop)72 192 Q (yright \251 1995, 1996 X Consortium)-.11 E/F1 9/Times-Roman@0 SF (Permission is hereby granted, free of char)72 206.6 Q(ge, to an)-.162 E 2.25(yp)-.135 G(erson obtaining a cop)-2.25 E 2.25(yo)-.09 G 2.25(ft) -2.25 G(his softw)-2.25 E(are and associated documentation \214les)-.09 E(\(the `)72 217.6 Q(`Softw)-.75 E(are')-.09 E ('\), to deal in the Softw)-.75 E(are without restriction, including wi\ thout limitation the rights to use, cop)-.09 E 1.17 -.585(y, m)-.09 H (odify).585 E 2.25(,m)-.585 G(er)-2.25 E(ge,)-.162 E(publish, distrib)72 228.6 Q(ute, sublicense, and/or sell copies of the Softw)-.18 E (are, and to permit persons to whom the Softw)-.09 E (are is furnished to do)-.09 E(so, subject to the follo)72 239.6 Q (wing conditions:)-.225 E(The abo)72 254.2 Q .27 -.135(ve c)-.135 H(op) .135 E(yright notice and this permission notice shall be included in al\ l copies or substantial portions of the Softw)-.09 E(are.)-.09 E (THE SOFTW)72 268.8 Q(ARE IS PR)-1.08 E -.45(OV)-.36 G(IDED `).45 E -.72 (`A)-.75 G 2.25(SI).72 G(S')-2.25 E(', WITHOUT W)-.75 E (ARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUD-)-1.08 E(ING B)72 279.8 Q(UT NO)-.09 E 2.25(TL)-.36 G(IMITED T)-2.25 E 2.25(OT)-.162 G(HE W) -2.25 E(ARRANTIES OF MERCHANT)-1.08 E(ABILITY)-.837 E 2.25(,F)-1.161 G (ITNESS FOR A P)-2.25 E(AR)-.828 E(TICULAR PURPOSE)-.54 E (AND NONINFRINGEMENT)72 290.8 Q 4.5(.I)-.666 G 2.25(NN)-4.5 G 2.25(OE) -2.25 G(VENT SHALL THE X CONSOR)-2.25 E(TIUM BE LIABLE FOR ANY CLAIM, D) -.54 E(AMA)-.36 E(GES)-.36 E(OR O)72 301.8 Q(THER LIABILITY)-.36 E 2.25 (,W)-1.161 G(HETHER IN AN A)-2.25 E(CTION OF CONTRA)-.36 E(CT)-.36 E 2.25(,T)-.666 G(OR)-2.412 E 2.25(TO)-.54 G 2.25(RO)-2.25 G(THER)-2.61 E (WISE, ARISING FR)-.495 E(OM, OUT OF)-.36 E (OR IN CONNECTION WITH THE SOFTW)72 312.8 Q(ARE OR THE USE OR O)-1.08 E (THER DEALINGS IN THE SOFTW)-.36 E(ARE.)-1.08 E(Except as contained in \ this notice, the name of the X Consortium shall not be used in adv)72 327.4 Q(ertising or otherwise to promote the)-.135 E (sale, use or other dealings in this Softw)72 338.4 Q (are without prior written authorization from the X Consortium.)-.09 E /F2 9/Times-Italic@0 SF 2.25(XW)72 353 S(indow System)-2.745 E F1 (is a trademark of X Consortium, Inc.)2.25 E EP %%Page: i 3 %%BeginPageSetup BP %%EndPageSetup /F0 13/Times-Bold@0 SF -1.196(Ta)257.126 85 S(ble of Contents)1.196 E/F1 11/Times-Roman@0 SF(1. Easy Build Instructions)72 127.6 Q -2.75 11 (........................ 1)7.221 H(2. Building X)72 144.2 Q -2.75 11 (............................ 1)6.297 H(2.1. Preparing the Site)72 160.8 Q -2.75 11(......................... 1)9.674 H (2.2. Unpacking the Distrib)72 177.4 Q 6.836(ution .)-.22 F -2.75 11 (..................... 2)11 H(2.2.1. Unpacking a Compressed FTP Distrib) 72 194 Q 10.807(ution .)-.22 F -2.75 11(............... 2)11 H (2.2.2. Unpacking a gzipped FTP Distrib)72 210.6 Q 2.865(ution .)-.22 F -2.75 11(................. 2)11 H (2.2.3. Unpacking a Split Compressed FTP Distrib)72 227.2 Q 1.017 (ution .)-.22 F -2.75 11(.............. 2)11 H(2.2.4. Unpacking the T)72 243.8 Q(ape Distrib)-.88 E 2.227(ution .)-.22 F -2.75 11 (................... 3)11 H(2.2.5. Using the CD-R)72 260.4 Q 2.469(OM .) -.44 F -2.75 11(....................... 3)11 H(2.3. Apply P)72 277 Q 8.31(atches .)-.165 F -2.75 11(......................... 3)11 H (2.4. Symbolic Link T)72 293.6 Q 7.001(rees .)-.385 F -2.75 11 (....................... 3)11 H(2.5. Con\214guration P)72 310.2 Q .676 (arameters .)-.165 F -2.75 11(...................... 3)11 H (2.6. System Build Notes)72 326.8 Q -2.75 11(........................ 5) 14.239 H(2.6.1. gcc)72 343.4 Q -2.75 11(............................. 5) 9.982 H(2.6.2. Other GNU tools)72 360 Q -2.75 11 (......................... 5)4.482 H(2.6.3. SparcW)72 376.6 Q(orks 2.0) -.88 E -2.75 11(......................... 5)10.257 H (2.6.4. CenterLine C under Solaris 2)72 393.2 Q -2.75 11 (..................... 5)6.319 H(2.6.5. IBM AIX 4.1.4)72 409.8 Q -2.75 11(......................... 6)12.424 H(2.6.6. SunOS 4)72 426.4 Q -2.75 11(........................... 6)13.326 H(2.6.7. Microsoft W)72 443 Q (indo)-.44 E(ws NT)-.275 E -2.75 11(....................... 6)2.755 H (2.6.8. Omron Luna)72 459.6 Q -2.75 11(.......................... 6) 9.982 H(2.7. The Build)72 476.2 Q -2.75 11 (............................ 7)2.942 H(2.8. Installing X)72 492.8 Q -2.75 11(........................... 7)8.75 H (2.8.1. System Installation Notes)72 509.4 Q -2.75 11 (...................... 7)8.442 H(2.8.1.1. The X Serv)72 526 Q (er on AIX 4)-.165 E -2.75 11(...................... 7)9.861 H (2.9. Shared Libraries)72 542.6 Q -2.75 11(......................... 8) 15.493 H(2.10. Setting Up xterm)72 559.2 Q -2.75 11 (......................... 8)7.221 H(2.11. Starting Serv)72 575.8 Q (ers at System Boot)-.165 E -2.75 11(.................... 8)11.357 H (2.11.1. On BSD-based systems using /etc/rc)72 592.4 Q -2.75 11 (.................. 8)10.29 H(2.11.2. On SystemV)72 609 Q (-based systems)-1.1 E -2.75 11(..................... 9)8.024 H (2.12. Using OPEN LOOK applications)72 625.6 Q -2.75 11 (.................... 9)4.79 H(2.13. Reb)72 642.2 Q(uilding after P)-.22 E 13.733(atches .)-.165 F -8.25 11(..................... 1)11 H(0)-11 E (2.14. F)72 658.8 Q(ormatting the Documentation)-.165 E -8.25 11 (.................... 1)16.252 H(0)-11 E(i)304.471 769 Q EP %%Page: blank 4 showpage %%Page: 1 5 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Bold@0 SF 2.75(1. Easy)72 85 R(Build Instructions)2.75 E/F1 11/Times-Roman@0 SF (This quick summary is no substitute for reading the full b)72 101.6 Q (uild instructions later in this document.)-.22 E(Edit)72 118.2 Q F0 (xc/con\214g/cf/site.def)2.75 E F1(for local preferences.)2.75 E (If you w)5.5 E(ant to b)-.11 E(uild with)-.22 E/F2 11/Times-Italic@0 SF (gcc)2.75 E F1(uncomment the)2.75 E F0(HasGcc2)2.75 E F1 2.75(line. If) 72 131.2 R(you w)2.75 E(ant to install some)-.11 E(where other than) -.275 E F0(/usr/X11R6.3)2.75 E F1 2.75(,c)C(hange)-2.75 E F0(Pr)2.75 E (ojectRoot)-.198 E F1 5.5(.\()C(Do)-5.5 E F2(not)2.75 E F1(use)2.75 E F0 (DESTDIR)72 144.2 Q F1(.\))A(If an)72 160.8 Q 2.75<798c>-.165 G -.165 (xe)-2.75 G 2.75(sh).165 G -2.475 -.22(av e)-2.75 H (been released by the X Consortium, stop here and follo)2.97 E 2.75(wt) -.275 G(he instructions at the top of)-2.75 E(each patch, b)72 173.8 Q (ut don')-.22 E 2.75(td)-.198 G 2.75(oa)-2.75 G .33 -.165(ny o)-2.75 H 2.75(ft).165 G(he)-2.75 E F2(mak)2.75 E(e)-.11 E F1 (commands suggested in the patches.)2.75 E(Then continue here.)5.5 E (Check the appropriate v)72 190.4 Q(endor)-.165 E(-speci\214c)-.22 E F0 (.cf)2.75 E F1(\214le in)2.75 E F0(xc/con\214g/cf/)2.75 E F1(to mak)2.75 E 2.75(es)-.11 G(ure that)-2.75 E F0(OSMajorV)2.75 E(ersion)-1.1 E F1 (and)2.75 E F0(OSMinorV)72 203.4 Q(ersion)-1.1 E F1 (are set correctly for your system.)2.75 E(Ov)5.5 E(erride them in)-.165 E F0(site.def)2.75 E F1(if necessary)2.75 E(.)-.715 E(See if there is a) 72 220 Q F0(BootstrapCFlags)2.75 E F1 (mentioned in the comments in the v)2.75 E(endor)-.165 E(-speci\214c) -.22 E F0(.cf)2.75 E F1 2.75(\214le. If)2.75 F(there isn')2.75 E(t)-.198 E(one,)72 233 Q F2(cd)2.75 E F1(to the)2.75 E F0(xc)2.75 E F1 (directory and type:)2.75 E 2.75(%m)108 252 S(ak)-2.75 E 2.75(eW)-.11 G (orld >& w)-3.63 E(orld.log)-.11 E(If there is a)72 274.6 Q F0 (BootstrapCFlags)2.75 E F1 2.75(,t)C(ak)-2.75 E 2.75(ei)-.11 G(ts v) -2.75 E(alue and type:)-.275 E 2.75(%m)108 293.6 S(ak)-2.75 E 2.75(eW) -.11 G(orld BOO)-3.63 E(TSTRAPCFLA)-.44 E(GS=")-.44 E F2(value)A F1 2.75 (">)C 2.75(&w)-2.75 G(orld.log)-2.86 E(Do not call the output \214le `) 72 316.2 Q(`mak)-.916 E(e.log')-.11 E 2.75('w)-.916 G(hen doing `)-2.75 E(`mak)-.916 E 2.75(eW)-.11 G(orld')-3.63 E 2.75('. After)-.916 F 2.75 (as)2.75 G(uccessful b)-2.75 E(uild, you can)-.22 E(install with:)72 329.2 Q 2.75(%m)108 348.2 S(ak)-2.75 E 2.75(ei)-.11 G (nstall >& install.log)-2.75 E -1.21(Yo)72 370.8 S 2.75(uc)1.21 G (an install manual pages with:)-2.75 E 2.75(%m)108 389.8 S(ak)-2.75 E 2.75(ei)-.11 G(nstall.man >& man.log)-2.75 E(While the system is b)72 412.4 Q(uilding \(or if things f)-.22 E (ail\), read the rest of these installation instructions.)-.11 E F0 2.75 (2. Building)72 464.4 R(X)2.75 E F1(This document gi)72 494 Q -.165(ve) -.275 G 2.75(sd).165 G(etailed instructions for b)-2.75 E (uilding Release 6: getting it of)-.22 E 2.75(ft)-.275 G(he distrib) -2.75 E(ution medium,)-.22 E (con\214guring, compiling, installing, running, and updating.)72 507 Q (Release Notes are in)72 523.6 Q F0(xc/RELNO)2.75 E(TES.*)-.44 E F1(\(v) 2.75 E(arious formats\) in the distrib)-.275 E(ution.)-.22 E (More recent information about ne)72 540.2 Q(wly-disco)-.275 E -.165(ve) -.165 G(red problems may be found in the).165 E F2 -1.947 -.605(Fr e) 2.75 H(quently Ask).605 E(ed Ques-)-.11 E(tions)72 553.2 Q F1 (posting appearing monthly on the comp.windo)2.75 E(ws.x ne)-.275 E (wsgroup and xpert mailing list.)-.275 E(It is also)5.5 E -.22(av)72 566.2 S(ailable via anon)-.055 E(ymous FTP on)-.165 E F0(ftp.x.or)2.75 E (g)-.11 E F1(in the \214le)2.75 E F0(contrib/faqs/F)2.75 E -1.98 -.495 (AQ .)-.99 H(Z).495 E F1 2.75(,o)C 2.75(ro)-2.75 G 2.75(ny)-2.75 G (our local X mirror site.)-2.75 E F0 2.75(2.1. Pr)72 605.2 R (eparing the Site)-.198 E F1(If you are unpacking tar \214les, you will\ need about 130 Mb to hold the)72 634.8 Q F0(xc/)2.75 E F1 2.75(part. T) 2.75 F 2.75(oi)-.88 G(nstall requires 30-50)-2.75 E(Mb assuming you ha) 72 647.8 Q .33 -.165(ve s)-.22 H(hared libraries \(80-100 Mb without\).) .165 E -1.21(Yo)5.5 G 2.75(uw)1.21 G(ill need an equi)-2.75 E -.275(va) -.275 G(lent amount of).275 E -.165(ex)72 660.8 S(tra space to b).165 E (uild, since you also need room for all the object \214les.)-.22 E (Distrib)72 677.4 Q(uted as tar \214les, Release 6.3 core is di)-.22 E (vided into parts as follo)-.275 E(ws:)-.275 E(1)303.25 769 Q EP %%Page: 2 6 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XW)72 49 S(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation V)-2.75 E(ersion 11, Release 6.3 Snapshot)-1.221 E 71.348(xc-1.tar contains)108 85 R -2.365 -.275(ev e)2.75 H (rything in xc/ that isn').275 E 2.75(ti)-.198 G 2.75(nt)-2.75 G (he other tar \214les)-2.75 E 71.348(xc-2.tar contains)108 98 R (xc/fonts, xc/doc/specs, xc/util)2.75 E 71.348(xc-3.tar contains)108 111 R(xc/doc/hardcop)2.75 E(y)-.11 E(If you de\214ne BuildF)72 133.6 Q (onts to NO, you only need to unpack xc-1.tar to b)-.165 E 2.75 (uild. If)-.22 F(you b)2.75 E(uild fonts, then you)-.22 E (will also need xc-2.tar to b)72 146.6 Q(uild.)-.22 E/F1 11/Times-Bold@0 SF 2.75(2.2. Unpacking)72 185.6 R(the Distrib)2.75 E(ution)-.22 E F0 (The distrib)72 215.2 Q(ution normally comes as multiple tar \214les, e\ ither on tape or across a netw)-.22 E(ork, or as a CD-R)-.11 E(OM.)-.44 E F1 2.75(2.2.1. Unpacking)72 254.2 R 2.75(aC)2.75 G(ompr)-2.75 E (essed FTP Distrib)-.198 E(ution)-.22 E F0(If you ha)72 283.8 Q .33 -.165(ve o)-.22 H(btained compressed tar \214les o).165 E -.165(ve)-.165 G 2.75(rt).165 G(he netw)-2.75 E (ork, create a directory to hold the sources and)-.11 E/F2 11 /Times-Italic@0 SF(cd)2.75 E F0(into it:)72 296.8 Q(mkdir)108 315.8 Q F2 (sour)2.75 E(cedir)-.407 E F0(cd)108 328.8 Q F2(sour)2.75 E(cedir)-.407 E F0(Then for each tar \214le)72 347.8 Q F1(xc\255*.tar)2.75 E(.Z)-1.1 E F0 2.75(,e)C -.165(xe)-2.915 G(cute this:).165 E(zcat)108 366.8 Q F2 (ftp-dir)5.5 E F0(/xc\255)A F2(N)A F0(.tar)A(.Z | tar xf)-.605 E5.5 E F1 2.75(2.2.2. Unpacking)72 411.8 R 2.75(ag)2.75 G(zipped FTP Distrib) -2.75 E(ution)-.22 E F0(If you ha)72 441.4 Q .33 -.165(ve o)-.22 H (btained gzipped tar \214les o).165 E -.165(ve)-.165 G 2.75(rt).165 G (he netw)-2.75 E(ork, create a directory to hold the sources and)-.11 E F2(cd)2.75 E F0(into)2.75 E(it:)72 454.4 Q(mkdir)108 473.4 Q F2(sour) 2.75 E(cedir)-.407 E F0(cd)108 486.4 Q F2(sour)2.75 E(cedir)-.407 E F0 (Then for each tar \214le)72 505.4 Q F1(xc\255*.tar)2.75 E(.gz)-1.1 E F0 2.75(,e)C -.165(xe)-2.915 G(cute this:).165 E 2.75(gunzip \255c)108 524.4 R F2(ftp-dir)5.5 E F0(/xc\255)A F2(N)A F0(.tar)A(.gz | tar xf) -.605 E5.5 E F1 2.75(2.2.3. Unpacking)72 569.4 R 2.75(aS)2.75 G (plit Compr)-2.75 E(essed FTP Distrib)-.198 E(ution)-.22 E F0(If you ha) 72 599 Q .33 -.165(ve o)-.22 H (btained compressed and split tar \214les o).165 E -.165(ve)-.165 G 2.75 (rt).165 G(he netw)-2.75 E(ork, create a directory to hold the)-.11 E (sources:)72 612 Q(mkdir)108 631 Q F2(sour)2.75 E(cedir)-.407 E F0 (Then for each directory)72 650 Q F1(xc\255*)2.75 E F0(:)A(cd)108 669 Q F2(ftp-dir)2.75 E F0(/xc\255)A F2(N)A F0(cat xc\255)108 682 Q F2(N)A F0 (.?? | uncompress | \(cd)A F2(sour)2.75 E(cedir)-.407 E F0 2.75(;t)1.833 G(ar xf)-2.75 E 1.8335.5 G(2)303.25 769 Q EP %%Page: 3 7 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XV)72 49 S(ersion 11, Release 6.3 Snapshot) -3.971 E 2.75(XW)175.4 G(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation)-2.75 E/F1 11/Times-Bold@0 SF 2.75(2.2.4. Unpacking) 72 85 R(the T)2.75 E(ape Distrib)-1.012 E(ution)-.22 E F0(If you ha)72 114.6 Q .33 -.165(ve o)-.22 H (btained a tape, create a directory to hold the sources and untar e).165 E -.165(ve)-.275 G(rything into that directory:).165 E(mkdir)108 133.6 Q /F2 11/Times-Italic@0 SF(sour)2.75 E(cedir)-.407 E F0(cd)108 146.6 Q F2 (sour)2.75 E(cedir)-.407 E F0(tar xf)108 159.6 Q F2(tape-de)2.75 E(vice) -.165 E F1 2.75(2.2.5. Using)72 204.6 R(the CD-R)2.75 E(OM)-.33 E F0 (If you ha)72 234.2 Q .33 -.165(ve o)-.22 H(btained a CD-R).165 E (OM, you don')-.44 E 2.75(th)-.198 G -2.475 -.22(av e)-2.75 H(to do an) 2.97 E(ything to unpack it.)-.165 E(Ho)5.5 E(we)-.275 E -.165(ve)-.275 G .88 -.44(r, y).165 H(ou will ha).44 E .33 -.165(ve t)-.22 H(o).165 E (create a symbolic link tree to b)72 247.2 Q(uild X.)-.22 E(See the ne) 5.5 E(xt section.)-.165 E 1.76 -.88(To m)72 263.8 T(ount the CD-R).88 E (OM, see the mount\(8\) manual page on your system or the liner notes t\ hat came with)-.44 E(the CD-R)72 276.8 Q 2.75(OM. Some)-.44 F (systems, e.g., Solaris 2, can automatically mount the CD-R)2.75 E (OM for you.)-.44 E F1 2.75(2.3. A)72 315.8 R(pply P)-.275 E(atches)-.11 E F0(If there are \214x)72 345.4 Q (es released that are more recent than your distrib)-.165 E (ution, apply them no)-.22 E 4.18 -.715(w. F)-.275 H(ollo).55 E 2.75(wt) -.275 G(he instruc-)-2.75 E(tions at the top of each patch, b)72 358.4 Q (ut don')-.22 E 2.75(td)-.198 G 2.75(oa)-2.75 G .33 -.165(ny m)-2.75 H (ak).165 E 2.75(ec)-.11 G 2.75(ommands. See)-2.75 F(the section `)2.75 E (`Public P)-.916 E(atches')-.165 E 2.75('l)-.916 G(ater)-2.75 E (in this document.)72 371.4 Q(Then continue here.)5.5 E F1 2.75 (2.4. Symbolic)72 410.4 R(Link T)2.75 E -.198(re)-.814 G(es).198 E F0 (If you e)72 440 Q(xpect to b)-.165 E(uild the distrib)-.22 E (ution on more than one machine using a shared source tree, or you are) -.22 E -.22(bu)72 453 S(ilding from CD-R).22 E(OM, or you just w)-.44 E (ant to k)-.11 E(eep the source tree pure, you may w)-.11 E (ant to use the program)-.11 E F1(xc/con\214g/util/lndir)72 466 Q(.c) -1.1 E F0(to create a symbolic link tree on each b)2.75 E(uild machine.) -.22 E(The links may use an addi-)5.5 E(tional 10 me)72 479 Q -.055(ga) -.165 G(bytes, b).055 E(ut it is cheaper than ha)-.22 E (ving multiple copies of the source tree.)-.22 E(It may be trick)72 495.6 Q 2.75(yt)-.165 G 2.75(oc)-2.75 G(ompile)-2.75 E F2(lndir)2.75 E F0(before the distrib)2.75 E(ution is b)-.22 E 2.75(uilt. If)-.22 F (you ha)2.75 E .33 -.165(ve a c)-.22 H(op).165 E 2.75(yf)-.11 G (rom a pre)-2.75 E(vious)-.275 E(release, use that.)72 508.6 Q F1(Mak) 5.5 E(e\214le.ini)-.11 E F0(can be used for b)2.75 E(uilding)-.22 E F2 (lndir)2.75 E F0(the \214rst time.)2.75 E -1.21(Yo)5.5 G 2.75(um)1.21 G (ay ha)-2.75 E .33 -.165(ve t)-.22 H 2.75(os).165 G(pecify)-2.75 E F1 (OSFLA)72 521.6 Q(GS=\255D)-.605 E F2(something)A F0 (to get it to compile.)2.75 E(What you w)5.5 E(ould pass as)-.11 E F1 (BOO)2.75 E(TSTRAPCFLA)-.44 E(GS)-.605 E F0(might)2.75 E -.11(wo)72 534.6 S 2.75(rk. The).11 F(command line looks something lik)2.75 E 2.75 (et)-.11 G(his:)-2.75 E(mak)108 553.6 Q 5.5<65ad>-.11 G 5.5(fM)-5.5 G (ak)-5.5 E 2.75(e\214le.ini OSFLA)-.11 F(GS=\255D)-.44 E F2<8d61>A(g) -.11 E F0 1.76 -.88(To u)72 576.2 T (se a symbolic link tree, create a directory for the b).88 E(uild,)-.22 E F2(cd)2.75 E F0(to it, and type this:)2.75 E(lndir)108 595.2 Q F2 (sour)2.75 E(cedir)-.407 E F0(where)72 617.8 Q F2(sour)2.75 E(cedir) -.407 E F0 (is the pathname of the directory where you stored the sources.)2.75 E (All of the b)5.5 E(uild instruc-)-.22 E(tions gi)72 630.8 Q -.165(ve) -.275 G 2.75(nb).165 G(elo)-2.75 E 2.75(ws)-.275 G (hould then be done in the b)-2.75 E (uild directory on each machine, rather than in the source)-.22 E (directory)72 643.8 Q(.)-.715 E F1(xc/con\214g/util/mkshado)72 660.4 Q (w/)-.11 E F0(contains)2.75 E F2(mkshadow)2.75 E F0 2.75(,a)C 2.75(na) -2.75 G(lternati)-2.75 E .33 -.165(ve p)-.275 H(rogram to).165 E F2 (lndir)2.75 E F0(.)A F1 2.75(2.5. Con\214guration)72 699.4 R -.11(Pa) 2.75 G(rameters).11 E F0 (Build information for each source directory is in \214les called)72 729 Q F1(Imak)2.75 E(e\214le)-.11 E F0 5.5(.A)C(n)-5.5 E F1(Imak)2.75 E (e\214le)-.11 E F0 2.75(,a)C(long with local)-2.75 E(3)303.25 769 Q EP %%Page: 4 8 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XW)72 49 S(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation V)-2.75 E(ersion 11, Release 6.3 Snapshot)-1.221 E (con\214guration information in)72 85 Q/F1 11/Times-Bold@0 SF (xc/con\214g/cf/)2.75 E F0 2.75(,i)C 2.75(su)-2.75 G(sed by the program) -2.75 E/F2 11/Times-Italic@0 SF(imak)2.75 E(e)-.11 E F0(to generate a) 2.75 E F1(Mak)2.75 E(e\214le)-.11 E F0(.)A (Most of the con\214guration w)72 101.6 Q(ork prior to b)-.11 E (uilding the release is to set parameters so that)-.22 E F2(imak)2.75 E (e)-.11 E F0(will gener)2.75 E(-)-.22 E(ate correct \214les.)72 114.6 Q (Most of those parameters are set in)5.5 E F1(xc/con\214g/cf/site.def) 2.75 E F0 5.5(.Y)C(ou will also need to check the)-6.71 E(appropriate v) 72 127.6 Q(endor)-.165 E(-speci\214c)-.22 E F1(.cf)2.75 E F0(\214le in) 2.75 E F1(xc/con\214g/cf/)2.75 E F0(to mak)2.75 E 2.75(es)-.11 G (ure that OSMajorV)-2.75 E(ersion, OSMinorV)-1.221 E(ersion,)-1.221 E (and OsT)72 140.6 Q(een)-.77 E(yV)-.165 E (ersion are set correctly for your system.)-1.221 E(Ov)5.5 E (erride them in)-.165 E F1(site.def)2.75 E F0(if necessary)2.75 E(.) -.715 E(The)72 157.2 Q F1(site.def)2.75 E F0(\214le has tw)2.75 E 2.75 (op)-.11 G(arts, one protected with `)-2.75 E(`#ifdef BeforeV)-.916 E (endorCF')-1.221 E 2.75('a)-.916 G(nd one with `)-2.75 E(`#ifdef)-.916 E (AfterV)72 170.2 Q(endorCF')-1.221 E 2.75('. The)-.916 F (\214le is actually processed twice, once before the)2.75 E F1(.cf)2.75 E F0(\214le and once after)2.75 E 5.5(.A)-.605 G(bout the)-5.5 E (only thing you need to set in the `)72 183.2 Q(`before')-.916 E 2.75 ('s)-.916 G(ection is)-2.75 E F1(HasGcc2)2.75 E F0 2.75(;j)C (ust about e)-2.75 E -.165(ve)-.275 G(rything else can be set in the) .165 E -.916(``)72 196.2 S(after').916 E 2.75('s)-.916 G(ection.)-2.75 E (The sample)72 212.8 Q F1(site.def)2.75 E F0 (also has commented out support to include another \214le,)2.75 E F1 (host.def)2.75 E F0 5.5(.T)C(his scheme may)-5.5 E(be useful if you w)72 225.8 Q(ant to set most parameters site-wide, b)-.11 E (ut some parameters v)-.22 E(ary from machine to)-.275 E 2.75 (machine. If)72 238.8 R(you use a symbolic link tree, you can share)2.75 E F1(site.def)2.75 E F0(across all machines, and gi)2.75 E .33 -.165 (ve e)-.275 H(ach).165 E(machine its o)72 251.8 Q(wn cop)-.275 E 2.75 (yo)-.11 G(f)-2.75 E F1(host.def)2.75 E F0(.)A (The con\214g parameters are listed in)72 268.4 Q F1 (xc/con\214g/cf/README)2.75 E F0 2.75(,b)C (ut here are some of the more common)-2.97 E (parameters that you may wish to set in)72 281.4 Q F1(site.def)2.75 E F0 (.)A F1(Pr)72 298 Q(ojectRoot)-.198 E F0 (The destination where X will be installed.)97 311 Q(This v)5.5 E (ariable needs to be set before you b)-.275 E(uild, as some)-.22 E (programs that read \214les at run-time ha)97 324 Q .33 -.165(ve t)-.22 H(he installation directory compiled in to them.).165 E(Assuming)5.5 E (you ha)97 337 Q .33 -.165(ve s)-.22 H(et the v).165 E (ariable to some v)-.275 E(alue /)-.275 E F2(path)A F0 2.75<2c8c>C (les will be installed into /)-2.75 E F2(path)A F0(/bin,)A(/)97 350 Q F2 (path)A F0(/include/X11, /)A F2(path)A F0(/lib, and /)A F2(path)A F0 (/man.)A F1(HasGcc)72 366.6 Q F0(Set to)97 379.6 Q F1(YES)2.75 E F0 (to b)2.75 E(uild with)-.22 E F2(gcc)2.75 E F0 -.165(ve)2.75 G(rsion 1.) .165 E F1(HasGcc2)72 396.2 Q F0(Set to)97 409.2 Q F1(YES)2.75 E F0(to b) 2.75 E(uild with)-.22 E F2(gcc)2.75 E F0 -.165(ve)2.75 G(rsion 2.).165 E (Both this option and)5.5 E F1(HasGcc)2.75 E F0 (look for a compiler named)2.75 E F2(gcc)97 422.2 Q F0 2.75(,b)C(ut) -2.97 E F1(HasGcc2)2.75 E F0(will cause the b)2.75 E (uild to use more features of)-.22 E F2(gcc)2.75 E F0 (2, such as the ability to compile)2.75 E(shared libraries.)97 435.2 Q F1(BuildXInputExt)72 451.8 Q F0(Set to)97 464.8 Q F1(YES)2.75 E F0(to b) 2.75 E(uild the X Input Extension.)-.22 E(This e)5.5 E (xtension requires de)-.165 E(vice-dependent support in the)-.275 E 2.75 (Xs)97 477.8 S(erv)-2.75 E(er)-.165 E 2.75(,w)-.44 G(hich e)-2.75 E (xists only in)-.165 E F2(Xhp)2.75 E F0(in our implementation.)2.75 E F1 (BuildP)72 494.4 Q(exExt)-.22 E F0(Set to)97 507.4 Q F1(NO)2.75 E F0 (to not b)2.75 E(uild the PEX serv)-.22 E(er e)-.165 E (xtension and fonts.)-.165 E F1(DefaultUsrBin)72 524 Q F0 (This is a directory where programs will be found e)97 537 Q -.165(ve) -.275 G 2.75(ni).165 G 2.75(fP)-2.75 G -1.221(AT)-3.762 G 2.75(Hi)1.221 G 2.75(sn)-2.75 G(ot set in the en)-2.75 E 2.75(vironment. It)-.44 F(is) 2.75 E(independent of ProjectRoot and def)97 550 Q(aults to)-.11 E F1 (/usr/bin)2.75 E F0 5.5(.I)C 2.75(ti)-5.5 G 2.75(su)-2.75 G(sed, for e) -2.75 E(xample, when connecting from)-.165 E 2.75(ar)97 563 S (emote system via)-2.75 E F2 -.11(rs)2.75 G(h).11 E F0 5.5(.T)C(he)-5.5 E F2 -.11(rs)2.75 G(tart).11 E F0(program installs its serv)2.75 E (er in this directory)-.165 E(.)-.715 E F1(InstallSer)72 579.6 Q -.11 (ve)-.11 G(rSetUID).11 E F0(Some systems require the X serv)97 592.6 Q (er to run as root to access the de)-.165 E(vices it needs.)-.275 E (If you are on such a)5.5 E(system and will not be using)97 605.6 Q F2 (xdm)2.75 E F0 2.75(,y)C(ou can set this v)-2.75 E(ariable to)-.275 E F1 (YES)2.75 E F0(to install the X serv)2.75 E(er setuid to)-.165 E 2.75 (root. Note)97 618.6 R(that the X serv)2.75 E (er has not been analyzed by the X Consortium for security in such an) -.165 E(installation; talk to your system manager before setting this v) 97 631.6 Q(ariable.)-.275 E F1(InstallXdmCon\214g)72 648.2 Q F0(By def) 97 661.2 Q (ault set to NO, which suppresses installing xdm con\214g \214les o)-.11 E -.165(ve)-.165 G 2.75(re).165 G(xisting ones.)-2.915 E(Lea)5.5 E .33 -.165(ve i)-.22 H 2.75(ts).165 G(et to)-2.75 E (NO if your site has customized the \214les in)97 674.2 Q F1 (/usr/X11R6.3/lib/X11/xdm)2.75 E F0 2.75(,a)C 2.75(sm)-2.75 G(an)-2.75 E 2.75(ys)-.165 G(ites do.)-2.75 E(If you)5.5 E(don')97 687.2 Q 2.75(ti) -.198 G(nstall the ne)-2.75 E 2.75<778c>-.275 G(les, mer)-2.75 E(ge an) -.198 E 2.75(yc)-.165 G(hanges present in the ne)-2.75 E 2.75<778c>-.275 G(les.)-2.75 E F1(MotifBC)72 703.8 Q F0(Causes Xlib and Xt to w)97 716.8 Q(ork around some b)-.11 E(ugs in older v)-.22 E(ersions of Motif.)-.165 E(Set to)5.5 E F1(YES)2.75 E F0(only if you)2.75 E (will be linking with Motif v)97 729.8 Q(ersion 1.1.1, 1.1.2, or 1.1.3.) -.165 E(4)303.25 769 Q EP %%Page: 5 9 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XV)72 49 S(ersion 11, Release 6.3 Snapshot) -3.971 E 2.75(XW)175.4 G(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation)-2.75 E/F1 11/Times-Bold@0 SF(GetV)72 85 Q(aluesBC) -1.012 E F0(Setting this v)97 98 Q(ariable to)-.275 E F1(YES)2.75 E F0 (allo)2.75 E(ws ille)-.275 E -.055(ga)-.165 G 2.75(lX).055 G(tGetV)-2.75 E(alues requests with NULL Ar)-1.221 E(gV)-.198 E(al to usually suc-) -1.221 E(ceed, as R5 did.)97 111 Q (Some applications erroneously rely on this beha)5.5 E(vior)-.22 E 5.5 (.S)-.605 G(upport for this will be)-5.5 E(remo)97 124 Q -.165(ve)-.165 G 2.75(di).165 G 2.75(naf)-2.75 G(uture release.)-2.75 E(The follo)72 140.6 Q(wing v)-.275 E(endor)-.165 E(-speci\214c)-.22 E F1(.cf)2.75 E F0 (\214les are in the release b)2.75 E(ut ha)-.22 E .33 -.165(ve n)-.22 H (ot been tested recently and hence prob-).165 E(ably need changes to w) 72 153.6 Q(ork:)-.11 E F1(apollo.cf)2.75 E F0(,)A F1(bsd.cf)2.75 E F0(,) A F1(con)2.75 E -.11(ve)-.44 G(x.cf).11 E F0(,)A F1(DGUX.cf)2.75 E F0(,) A F1(luna.cf)2.75 E F0(,)A F1(macII.cf)2.75 E F0(,)A F1(Mips.cf)2.75 E F0(,)A F1(moto.cf)2.75 E F0(,)A F1(Oki.cf)72 166.6 Q F0(,)A F1 (pegasus.cf)2.75 E F0(,)A F1(x386.cf)2.75 E F0(.)A F1(Amoeba.cf)5.5 E F0 (is kno)2.75 E(wn to require additional patches.)-.275 E(The \214le)72 183.2 Q F1(xc/lib/Xdmcp/Wraphelp.c)2.75 E F0 2.75(,f)C(or XDM-A)-2.75 E (UTHORIZA)-.605 E(TION-1, is not included in this release.)-1.221 E F1 2.75(2.6. System)72 222.2 R(Build Notes)2.75 E F0 (This section contains hints on b)72 251.8 Q (uilding X with speci\214c compilers and operating systems.)-.22 E (If the b)72 268.4 Q(uild isn')-.22 E 2.75<748c>-.198 G (nding things right, mak)-2.75 E 2.75(es)-.11 G (ure you are using a compiler for your operating system.)-2.75 E -.165 (Fo)5.5 G(r).165 E -.165(ex)72 281.4 S(ample, a pre-compiled).165 E/F2 11/Times-Italic@0 SF(gcc)2.75 E F0(for a dif)2.75 E (ferent OS will not ha)-.275 E .33 -.165(ve r)-.22 H (ight symbols de\214ned, so).165 E F2(imak)2.75 E(e)-.11 E F0(will not) 2.75 E -.11(wo)72 294.4 S(rk correctly).11 E(.)-.715 E F1 2.75 (2.6.1. gcc)72 333.4 R F2(gcc)72 350 Q F0 -.165(ve)2.75 G (rsion 2 is in re).165 E (gular use at the X Consortium on Sparc platforms.)-.165 E(Set the v)5.5 E(ariable)-.275 E F1(HasGcc2)2.75 E F0 5.5(.X)C(will)-2.75 E (not compile on some systems with)72 363 Q F2(gcc)2.75 E F0 -.165(ve) 2.75 G (rsion 2.5, 2.5.1, or 2.5.2 because of an incorrect declaration of).165 E(memmo)72 376 Q -.165(ve)-.165 G(\(\) in a gcc include \214le.).165 E (If you are using a)72 392.6 Q F2(gcc)2.75 E F0 -.165(ve)2.75 G (rsion older than 2.7 on Solaris x86, you need to specify).165 E F1(BOO) 72 405.6 Q(TSTRAPCFLA)-.44 E(GS="\255Dsun")-.605 E F0(in the `)2.75 E (`mak)-.916 E 2.75(eW)-.11 G(orld')-3.63 E 2.75('c)-.916 G(ommand.)-2.75 E F1 2.75(2.6.2. Other)72 444.6 R(GNU tools)2.75 E F0 (Use of the GNU assembler)72 461.2 Q(,)-.44 E F2(as)2.75 E F0 2.75(,o)C 2.75(rl)-2.75 G(ink)-2.75 E(er)-.11 E(,)-.44 E F2(ld)2.75 E F0 2.75(,i)C 2.75(sn)-2.75 G(ot supported.)-2.75 E(GNU)5.5 E F2(mak)2.75 E(e)-.11 E F0(is not supported.)2.75 E F1 2.75(2.6.3. Spar)72 500.2 R(cW)-.198 E (orks 2.0)-.825 E F0(If you ha)72 529.8 Q .33 -.165(ve a n)-.22 H (on-threaded program and w).165 E(ant to deb)-.11 E (ug it with the old SparcW)-.22 E(orks 2.0 dbx, you will need)-.88 E (to use the thread stubs library in)72 542.8 Q F1 (xc/util/misc/thr_stubs.c)2.75 E F0 5.5(.C)C(ompile it as follo)-5.5 E (ws:)-.275 E(cc -c thr_stubs.c)108 561.8 Q (ar cq libthr_stubs.a thr_stubs.o)108 574.8 Q(ranlib libthr_stubs.a)108 587.8 Q(Install libthr_stubs.a in the same directory with your X librar\ ies \(e.g.,)72 606.8 Q F1(/usr/X11R6.3/lib/libthr_stubs.a)2.75 E F0(\).) A(Add the follo)72 619.8 Q(wing line to)-.275 E F1(site.def)2.75 E F0(:) A(#de\214ne ExtraLibraries)108 638.8 Q(\255lsock)5.5 E 2.75(et \255lnsl) -.11 F($\(CDEB)2.75 E(UGFLA)-.11 E(GS:\255g=\255lthr_stubs\))-.44 E (This e)72 657.8 Q(xample uses a)-.165 E F2(mak)2.75 E(e)-.11 E F0 (macro substitution; not all)2.75 E F2(mak)2.75 E(e)-.11 E F0 (implementations support this feature.)2.75 E F1 2.75(2.6.4. CenterLine) 72 696.8 R 2.75(Cu)2.75 G(nder Solaris 2)-2.75 E F0 (If you are using the CenterLine C compiler to compile the distrib)72 726.4 Q(ution under Solaris 2, place the)-.22 E(5)303.25 769 Q EP %%Page: 6 10 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XW)72 49 S(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation V)-2.75 E(ersion 11, Release 6.3 Snapshot)-1.221 E (follo)72 85 Q(wing line in your)-.275 E/F1 11/Times-Bold@0 SF(site.def) 2.75 E F0(:)A(#de\214ne HasCenterLineC YES)108 104 Q (If clcc is not in your def)72 123 Q(ault search path, add this line to) -.11 E F1(site.def)2.75 E F0(:)A(#de\214ne CcCmd /path/to/your/clcc)108 142 Q(If you are using CodeCenter 4.0.4 or earlier)72 164.6 Q 2.75(,t) -.44 G(he follo)-2.75 E(wing \214les trigger b)-.275 E(ugs in the)-.22 E /F2 11/Times-Italic@0 SF(clcc)2.75 E F0(optimizer:)2.75 E (xc/programs/Xserv)108 183.6 Q(er/cfb16/cfbgetsp.c)-.165 E (xc/programs/Xserv)108 196.6 Q(er/cfb16/cfb\214llsp.c)-.165 E (xc/programs/Xserv)108 209.6 Q(er/cfb/cfbgetsp.c)-.165 E(Thus to b)72 232.2 Q(uild the serv)-.22 E(er)-.165 E 2.75(,y)-.44 G(ou will ha)-2.75 E .33 -.165(ve t)-.22 H 2.75(oc).165 G (ompile these \214les by hand with the)-2.75 E F12.75 E F0 (\215ag:)2.75 E 2.75(%c)108 251.2 S 2.75(dx)-2.75 G(c/programs/Xserv) -2.75 E(er/cfb16)-.165 E 2.75(%m)108 264.2 S(ak)-2.75 E 2.75(eC)-.11 G (DEB)-2.75 E(UGFLA)-.11 E(GS="\255g" cfbgetsp.o cfb\214llsp.o)-.44 E 2.75(%c)108 277.2 S 2.75(d.)-2.75 G(./cfb)-2.75 E 2.75(%m)108 290.2 S (ak)-2.75 E 2.75(eC)-.11 G(DEB)-2.75 E(UGFLA)-.11 E (GS="\255g" cfbgetsp.o)-.44 E(This optimizer b)72 309.2 Q (ug appears to be \214x)-.22 E(ed in CodeCenter 4.0.6.)-.165 E F1 2.75 (2.6.5. IBM)72 348.2 R(AIX 4.1.4)2.75 E F0(On AIX 4.1.4, the \214le)72 377.8 Q F1(lib/f)2.75 E(ont/T)-.275 E(ype1/objects.c)-.814 E F0 (must be compiled without optimization \()2.75 E F1A F0 2.75(\)e)C (lse the X)-2.75 E(serv)72 390.8 Q(er will e)-.165 E(xit when T)-.165 E (ype 1 fonts are used.)-.88 E F1 2.75(2.6.6. SunOS)72 429.8 R(4)2.75 E F0(SunOS 4.0 and earlier need BOO)72 459.4 Q(TSTRAPCFLA)-.44 E (GS=-DNOSTDHDRS because the)-.44 E 2.75(yd)-.165 G 2.75(on)-2.75 G (ot ha)-2.75 E .33 -.165(ve u)-.22 H(nistd.h).165 E(nor stdlib)72 472.4 Q 2.75(.h. Do)-.44 F F2(not)2.75 E F0(supply a BOO)2.75 E(TSTRAPCFLA) -.44 E(GS when b)-.44 E(uilding an)-.22 E 2.75(yS)-.165 G(unOS 4.1 v) -2.75 E(ersion.)-.165 E F1 2.75(2.6.7. Micr)72 511.4 R(osoft W)-.198 E (indo)-.198 E(ws NT)-.11 E F0(All of the base libraries are supported, \ including multi-threading in Xlib and Xt, b)72 541 Q (ut some of the more)-.22 E(complicated applications, speci\214cally)72 554 Q F2(xterm)2.75 E F0(and)2.75 E F2(xdm)2.75 E F0 2.75(,a)C (re not supported.)-2.75 E(There are also some other rough edges in the\ implementation, such as lack of support for non-sock)72 570.6 Q (et \214le)-.11 E (descriptors as Xt alternate inputs and not using the re)72 583.6 Q (gistry for con\214gurable parameters lik)-.165 E 2.75(et)-.11 G (he system)-2.75 E(\214lenames and search paths.)72 596.6 Q(The)72 613.2 Q F2(Xnest)2.75 E F0(serv)2.75 E(er has been made to run on NT)-.165 E 5.5(.I)-.814 G 2.75(tr)-5.5 G(equires a real X serv)-2.75 E (er for output still.)-.165 E F1 2.75(2.6.8. Omr)72 652.2 R(on Luna) -.198 E F0(The Omron Luna platform is no longer supported.)72 681.8 Q (The Luna v)5.5 E(ersion of the)-.165 E F2(mak)2.75 E(e)-.11 E F0 (program doesn')2.75 E 2.75(td)-.198 G(e\214ne)-2.75 E (the standard macro MAKE, so you must run it as `)72 694.8 Q(`mak)-.916 E 2.75(eM)-.11 G(AKE=mak)-2.75 E(e')-.11 E 2.75('a)-.916 G 2.75(tt)-2.75 G(op le)-2.75 E -.165(ve)-.275 G(l, e.g., `).165 E(`mak)-.916 E(e)-.11 E (MAKE=mak)72 707.8 Q 2.75(eW)-.11 G(orld')-3.63 E('.)-.916 E(6)303.25 769 Q EP %%Page: 7 11 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XV)72 49 S(ersion 11, Release 6.3 Snapshot) -3.971 E 2.75(XW)175.4 G(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation)-2.75 E/F1 11/Times-Bold@0 SF 2.75(2.7. The)72 85 R (Build)2.75 E F0(On NT)72 114.6 Q 2.75(,t)-.814 G(ype)-2.75 E(nmak)108 133.6 Q 2.75(eW)-.11 G(orld.W)-3.63 E(in32 > w)-.44 E(orld.log)-.11 E (On other systems, \214nd the BootstrapCFlags line, if an)72 152.6 Q 1.43 -.715(y, i)-.165 H 2.75(nt).715 G(he v)-2.75 E(endor)-.165 E (-speci\214c)-.22 E F1(.cf)2.75 E F0 2.75(\214le. If)2.75 F(there isn') 2.75 E 2.75(to)-.198 G(ne,)-2.75 E(type)72 165.6 Q 2.75(%m)108 184.6 S (ak)-2.75 E 2.75(eW)-.11 G(orld >& w)-3.63 E(orld.log)-.11 E (otherwise type)72 203.6 Q 2.75(%m)108 222.6 S(ak)-2.75 E 2.75(eW)-.11 G (orld BOO)-3.63 E(TSTRAPCFLA)-.44 E(GS="v)-.44 E(alue" >& w)-.275 E (orld.log)-.11 E -1.21(Yo)72 245.2 S 2.75(uc)1.21 G (an call the output \214le something other than `)-2.75 E(`w)-.916 E (orld.log')-.11 E(', b)-.916 E(ut do not call it `)-.22 E(`mak)-.916 E (e.log')-.11 E 2.75('b)-.916 G(ecause \214les)-2.75 E (with this name are automatically deleted during the `)72 258.2 Q (`cleaning')-.916 E 2.75('s)-.916 G(tage of the b)-2.75 E(uild.)-.22 E (Because the b)72 274.8 Q(uild can tak)-.22 E 2.75(es)-.11 G -2.365 -.275(ev e)-2.75 H(ral hours to complete, you will probably w).275 E (ant to run it in the background)-.11 E(and k)72 287.8 Q(eep a w)-.11 E (atch on the output.)-.11 E -.165(Fo)5.5 G 2.75(re).165 G(xample:)-2.915 E 2.75(%m)108 306.8 S(ak)-2.75 E 2.75(eW)-.11 G(orld >& w)-3.63 E (orld.log &)-.11 E 2.75(%t)108 319.8 S 2.75(ail \255f w)-2.75 F (orld.log)-.11 E (If something goes wrong, the easiest thing is to just start o)72 342.4 Q -.165(ve)-.165 G 2.75(r\().165 G(typing `)-2.75 E(`mak)-.916 E 2.75 (eW)-.11 G(orld')-3.63 E 2.75('a)-.916 G -.055(ga)-2.75 G(in\) once you) .055 E(ha)72 355.4 Q .33 -.165(ve c)-.22 H(orrected the problem.).165 E F1 2.75(2.8. Installing)72 394.4 R(X)2.75 E F0(If e)72 424 Q -.165(ve) -.275 G(rything is b).165 E(uilt successfully)-.22 E 2.75(,y)-.715 G (ou can install the softw)-2.75 E(are by typing the follo)-.11 E (wing as root:)-.275 E 2.75(%m)108 443 S(ak)-2.75 E 2.75(ei)-.11 G (nstall >& install.log)-2.75 E(Ag)72 465.6 Q(ain, you might w)-.055 E (ant to run this in the background and use)-.11 E/F2 11/Times-Italic@0 SF(tail)2.75 E F0(to w)2.75 E(atch the progress.)-.11 E -1.21(Yo)72 482.2 S 2.75(uc)1.21 G(an install the manual pages by typing the follo) -2.75 E(wing as root:)-.275 E 2.75(%m)108 501.2 S(ak)-2.75 E 2.75(ei) -.11 G(nstall.man >& man.log)-2.75 E F1 2.75(2.8.1. System)72 546.2 R (Installation Notes)2.75 E F0(This section contains hints on installing\ and using X with speci\214c compilers and operating systems.)72 575.8 Q F1 2.75(2.8.1.1. The)72 614.8 R 2.75(XS)2.75 G(er)-2.75 E -.11(ve)-.11 G 2.75(ro).11 G 2.75(nA)-2.75 G(IX 4)-2.75 E F0 -.165(Fo)72 644.4 S 2.75 (rI).165 G(BM')-2.75 E 2.75(sA)-.605 G(IX 4, you need to mak)-2.75 E 2.75(es)-.11 G(ure the LFT de)-2.75 E (vice is associated with the correct graphics adapter)-.275 E(.)-.605 E (It')72 657.4 Q 2.75(sao)-.605 G(ne-time setup that does)-2.75 E F2(not) 2.75 E F0(happen automatically)2.75 E 2.75(,e)-.715 G -.165(ve)-3.025 G 2.75(ni).165 G 2.75(ft)-2.75 G(here')-2.75 E 2.75(so)-.605 G (nly one graphics adapter in the)-2.75 E 2.75(system. T)72 670.4 R 2.75 (oc)-.88 G(on\214gure the LFT de)-2.75 E(vice properly)-.275 E 2.75(,b) -.715 G(ecome root and start SMIT)-2.75 E 5.5(.G)-.814 G 2.75(ot)-5.5 G 2.75(ot)-2.75 G(he `)-2.75 E(`De)-.916 E(vices')-.275 E 2.75('c)-.916 G (ate-)-2.75 E(gory)72 683.4 Q 2.75(,c)-.715 G(hoose `)-2.75 E(`LFT') -.916 E(', then `)-.916 E(`Displays')-.916 E(', then `)-.916 E(`Mo)-.916 E .33 -.165(ve t)-.165 H(he LFT to Another Display').165 E('.)-.916 E (Select `)72 700 Q(`Both')-.916 E 2.75('f)-.916 G (or when the change should tak)-2.75 E 2.75(ee)-.11 G -.275(ff)-2.75 G (ect, then select the display adapter where you w).275 E(ant to)-.11 E (run the X serv)72 713 Q(er)-.165 E 5.5(.C)-.605 G (on\214rm the changes and e)-5.5 E(xit SMIT)-.165 E 2.75(;f)-.605 G (rom no)-2.75 E 2.75(wo)-.275 G(n, you should be able to run the serv) -2.75 E(er)-.165 E(just \214ne.)72 726 Q(7)303.25 769 Q EP %%Page: 8 12 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XW)72 49 S(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation V)-2.75 E(ersion 11, Release 6.3 Snapshot)-1.221 E 1.76 -.88(To r)72 85 T(un).88 E/F1 11/Times-Italic@0 SF(Xibm)2.75 E F0 (from)2.75 E F1(xdm)2.75 E F0 2.75(,y)C(ou must pro)-2.75 E(vide the `) -.165 E(`\255force')-.916 E 2.75<278d>-.916 G(ag on the serv)-2.75 E (er command line in the)-.165 E/F2 11/Times-Bold@0 SF(Xser)2.75 E -.11 (ve)-.11 G(rs).11 E F0(\214le.)72 98 Q F2 2.75(2.9. Shar)72 137 R (ed Libraries)-.198 E F0(The v)72 166.6 Q (ersion number of some of the the shared libraries has been changed.) -.165 E(On SunOS 4, which supports)5.5 E(minor v)72 179.6 Q (ersion numbers for shared libraries, programs link)-.165 E (ed with the R6 libraries will use the ne)-.11 E(w)-.275 E (libraries with no special action required.)72 192.6 Q (On other platforms you ha)5.5 E .33 -.165(ve t)-.22 H(he follo).165 E (wing choices:)-.275 E 14(1. K)72 209.2 R(eep the old v)-.275 E (ersions of the libraries around.)-.165 E 14(2. Relink)72 225.8 R (all applications with the ne)2.75 E 2.75(wl)-.275 G(ibraries.)-2.75 E 14(3. Create)72 242.4 R 2.75(al)2.75 G(ink from the old name to the ne) -2.75 E 2.75(wn)-.275 G(ame.)-2.75 E -.165(Fo)97 259 S 2.75(re).165 G (xample, to ha)-2.915 E .33 -.165(ve p)-.22 H(rograms that were link) .165 E(ed ag)-.11 E(ainst libX11.so.6.0 use libX11.so.6.3, mak)-.055 E 2.75(et)-.11 G(his)-2.75 E(link:)97 272 Q 2.75(ln \255s)133 291 R (libX11.so.6.3 libX11.so.6.0)2.75 E F2 2.75(2.10. Setting)72 336 R (Up xterm)2.75 E F0(If your)72 365.6 Q F2(/etc/termcap)2.75 E F0(and) 2.75 E F2(/usr/lib/terminf)2.75 E(o)-.275 E F0(databases do not ha)2.75 E .33 -.165(ve c)-.22 H(orrect entries for).165 E F1(xterm)2.75 E F0 2.75(,u)C(se the sample)-2.75 E(entries pro)72 378.6 Q (vided in the directory)-.165 E F2(xc/pr)2.75 E(ograms/xterm/)-.198 E F0 5.5(.S)C(ystem V users may need to compile and install)-5.5 E(the)72 391.6 Q F2(terminf)2.75 E(o)-.275 E F0(entry with the)2.75 E F1(tic)2.75 E F0(utility)2.75 E(.)-.715 E(Since each)72 408.2 Q F1(xterm)2.75 E F0(\ will need a separate pseudoterminal, you need a reasonable number of th\ em for normal)2.75 E -.165(exe)72 421.2 S 2.75(cution. Y).165 F (ou probably will w)-1.21 E (ant at least 32 on a small, multiuser system.)-.11 E (On most systems, each pty)5.5 E(has tw)72 434.2 Q 2.75(od)-.11 G -.275 (ev)-2.75 G(ices, a master and a sla).275 E -.165(ve)-.22 G 2.75(,w).165 G(hich are usually named /de)-2.75 E(v/tty[pqrstu][0-f] and)-.275 E(/de) 72 447.2 Q 2.75(v/pty[pqrstu][0-f]. If)-.275 F(you don')2.75 E 2.75(th) -.198 G -2.475 -.22(av e)-2.75 H(at least the `)2.97 E(`p')-.916 E 2.75 ('a)-.916 G(nd `)-2.75 E(`q')-.916 E 2.75('s)-.916 G (ets con\214gured \(try typing `)-2.75 E(`ls)-.916 E(/de)72 460.2 Q (v/?ty??')-.275 E('\), you should ha)-.916 E .33 -.165(ve y)-.22 H (our system administrator add them.).165 E (This is commonly done by running)5.5 E(the)72 473.2 Q F1(MAKEDEV)2.75 E F0(script in the)2.75 E F2(/de)2.75 E(v)-.165 E F0 (directory with appropriate ar)2.75 E(guments.)-.198 E F2 2.75 (2.11. Starting)72 512.2 R(Ser)2.75 E -.11(ve)-.11 G(rs at System Boot) .11 E F0(The)72 541.8 Q F1(xfs)2.75 E F0(and)2.75 E F1(xdm)2.75 E F0 (programs are designed to be run automatically at system startup.)2.75 E (Please read the manual)5.5 E(pages for details on setting up con\214gu\ ration \214les; reasonable sample \214les are in)72 554.8 Q F2(xc/pr)72 567.8 Q(ograms/xdm/con\214g/)-.198 E F0(and)2.75 E F2(xc/pr)2.75 E (ograms/xfs/)-.198 E F0(.)A F2 2.75(2.11.1. On)72 606.8 R (BSD-based systems using /etc/r)2.75 E(c)-.198 E F0 (If your system uses an)72 636.4 Q F2(/etc/r)2.75 E(c)-.198 E F0(\214le\ at boot time, you can usually enable these programs by placing the fol\ -)2.75 E(lo)72 649.4 Q(wing at or near the end of the \214le:)-.275 E (if [ \255f /usr/X11R6.3/bin/xfs ]; then)108 668.4 Q (/usr/X11R6.3/bin/xfs & echo \255n ' xfs')130 681.4 Q<8c>108 694.4 Q (if [ \255f /usr/X11R6.3/bin/xdm ]; then)108 720.4 Q(8)303.25 769 Q EP %%Page: 9 13 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XV)72 49 S(ersion 11, Release 6.3 Snapshot) -3.971 E 2.75(XW)175.4 G(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation)-2.75 E(/usr/X11R6.3/bin/xdm; echo \255n ' xdm')130 85 Q<8c>108 98 Q(Since)72 120.6 Q/F1 11/Times-Italic@0 SF(xfs)2.75 E F0 (can serv)2.75 E 2.75(ef)-.165 G(onts o)-2.75 E -.165(ve)-.165 G 2.75 (rt).165 G(he netw)-2.75 E(ork, you do not need to run a font serv)-.11 E(er on e)-.165 E -.165(ve)-.275 G(ry machine with an).165 E 2.75(Xd)72 133.6 S(isplay)-2.75 E 5.5(.Y)-.715 G(ou should start)-6.71 E F1(xfs) 2.75 E F0(before)2.75 E F1(xdm)2.75 E F0 2.75(,s)C(ince)-2.75 E F1(xdm) 2.75 E F0(may start an X serv)2.75 E(er which is a client of the font) -.165 E(serv)72 146.6 Q(er)-.165 E(.)-.605 E(The e)72 163.2 Q (xamples here use)-.165 E/F2 11/Times-Bold@0 SF(/usr/X11R6.3/bin)2.75 E F0 2.75(,b)C(ut if you ha)-2.97 E .33 -.165(ve i)-.22 H (nstalled into a dif).165 E(ferent directory by setting \(or)-.275 E (unsetting\))72 176.2 Q F2(Pr)2.75 E(ojectRoot)-.198 E F0 (then you need to substitute the correct directory)2.75 E(.)-.715 E (If you are unsure about ho)72 192.8 Q 2.75(ws)-.275 G(ystem boot w) -2.75 E(orks, or if your system does not use)-.11 E F2(/etc/r)2.75 E(c) -.198 E F0 2.75(,c)C(onsult your sys-)-2.75 E (tem administrator for help.)72 205.8 Q F2 2.75(2.11.2. On)72 244.8 R (SystemV)2.75 E(-based systems)-.814 E F0(There are tw)72 274.4 Q 2.75 (ow)-.11 G(ays you can get On systems with a)-2.86 E F2(/etc/inittab) 2.75 E F0(\214le, you can edit this \214le to add the lines)2.75 E (xfs:3:once:/usr/X11R6.3/bin/xfs)108 293.4 Q (xdm:3:once:/usr/X11R6.3/bin/xdm)108 306.4 Q(On some systems, you can e\ dit a \214le in /etc/init.d to run the X Consortium xdm instead of the \ v)72 329 Q(endor')-.165 E(s)-.605 E(product xdm.)72 342 Q(On Son)5.5 E 2.75(yt)-.165 G(his \214le is /etc/init.d/consxdm.)-2.75 E (On IRIX edit /etc/init.d/xdm.)5.5 E F2 2.75(2.12. Using)72 381 R (OPEN LOOK applications)2.75 E F0 -1.21(Yo)72 410.6 S 2.75(uc)1.21 G (an use the X11R6 Xsun serv)-2.75 E(er with OPEN LOOK applications, b) -.165 E(ut you must pass the)-.22 E F2(\255swapLk)2.75 E(eys)-.11 E F0 (\215ag to the serv)72 423.6 Q (er on startup, or the OPEN LOOK Undo, Cop)-.165 E 1.43 -.715(y, P)-.11 H(aste, Find, and Cut k).55 E -.165(ey)-.11 G 2.75(sm).165 G(ay not w) -2.75 E(ork)-.11 E(correctly)72 436.6 Q 5.5(.F)-.715 G(or e)-5.665 E (xample, to run Sun')-.165 E 2.75(sO)-.605 G(penW)-2.75 E(indo)-.44 E (ws 3.3 desktop en)-.275 E(vironment with an X11R6 serv)-.44 E(er)-.165 E 2.75(,u)-.44 G(se)-2.75 E(the command:)72 449.6 Q 2.75(%o)108 468.6 S 2.75(penwin \255serv)-2.75 F 2.75(er /usr/X11R6.3/bin/Xsun \255sw)-.165 F(apLk)-.11 E -.165(ey)-.11 G(s).165 E(The k)72 491.2 Q -.165(ey)-.11 G (syms reported by k).165 E -.165(ey)-.11 G 2.75(so).165 G 2.75(nt)-2.75 G(he numeric k)-2.75 E -.165(ey)-.11 G(pad ha).165 E .33 -.165(ve a)-.22 H(lso changed since X11R5; if you \214nd that).165 E(OpenW)72 504.2 Q (indo)-.44 E(ws applications do not respond to k)-.275 E -.165(ey)-.11 G (pad k).165 E -.165(ey)-.11 G 2.75(sa).165 G(nd cursor control k)-2.75 E -.165(ey)-.11 G 2.75(sw).165 G(hen using the R6)-2.75 E(serv)72 517.2 Q (er)-.165 E 2.75(,y)-.44 G(ou can remap the k)-2.75 E -.165(ey)-.11 G (pad to generate R5 style k).165 E -.165(ey)-.11 G(syms using the follo) .165 E(wing)-.275 E F1(xmodmap)2.75 E F0(commands:)2.75 E -.11(ke)108 536.2 S(ysym P)-.055 E(ause = F21)-.165 E -.11(ke)108 549.2 S (ysym Print = F22)-.055 E -.11(ke)108 562.2 S(ysym Break = F23)-.055 E -.11(ke)108 575.2 S(ysym KP_Equal = F24)-.055 E -.11(ke)108 588.2 S (ysym KP_Di)-.055 E(vide = F25)-.275 E -.11(ke)108 601.2 S (ysym KP_Multiply = F26)-.055 E -.11(ke)108 614.2 S(ysym KP_Home = F27) -.055 E -.11(ke)108 627.2 S(ysym KP_Up = Up)-.055 E -.11(ke)108 640.2 S (ysym KP_Prior = F29)-.055 E -.11(ke)108 653.2 S(ysym KP_Left = Left) -.055 E -.11(ke)108 666.2 S(ycode 100 = F31)-.055 E -.11(ke)108 679.2 S (ysym KP_Right = Right)-.055 E -.11(ke)108 692.2 S(ysym KP_End = F33) -.055 E -.11(ke)108 705.2 S(ysym KP_Do)-.055 E(wn = Do)-.275 E(wn)-.275 E -.11(ke)108 718.2 S(ysym KP_Ne)-.055 E(xt = F35)-.165 E -.11(ke)108 731.2 S(ysym KP_Insert = Insert)-.055 E(9)303.25 769 Q EP %%Page: 10 14 %%BeginPageSetup BP %%EndPageSetup /F0 11/Times-Roman@0 SF 2.75(XW)72 49 S(indo)-3.19 E 2.75(wS)-.275 G (ystem Installation V)-2.75 E(ersion 11, Release 6.3 Snapshot)-1.221 E -.11(ke)108 85 S(ysym KP_Delete = Delete)-.055 E/F1 11/Times-Bold@0 SF 2.75(2.13. Reb)72 130 R(uilding after P)-.22 E(atches)-.11 E F0 -1.21 (Yo)72 159.6 S 2.75(us)1.21 G(houldn')-2.75 E 2.75(tn)-.198 G (eed this right a)-2.75 E -.11(wa)-.165 G 1.43 -.715(y, b).11 H(ut e) .495 E -.165(ve)-.275 G(ntually you are probably going to mak).165 E 2.75(ec)-.11 G(hanges to the sources,)-2.75 E(for e)72 172.6 Q (xample by applying an)-.165 E 2.75(yp)-.165 G (ublic patches that may be released.)-2.75 E(Each patch comes with e)72 189.2 Q(xplicit instructions at the top of it saying what to do.)-.165 E (Thus the procedure here is)5.5 E(only an o)72 202.2 Q -.165(ve)-.165 G (rvie).165 E 2.75(wo)-.275 G 2.75(ft)-2.75 G (he types of commands that might be necessary to reb)-2.75 E (uild X after changing it.)-.22 E(If you are b)72 218.8 Q (uilding from CD-R)-.22 E (OM, apply the patches to the symbolic link tree.)-.44 E (The links to changed \214les)5.5 E (will be replaced with local \214les containing the ne)72 231.8 Q 2.75 (wc)-.275 G(ontents.)-2.75 E (If only source \214les are changed, you should be able to reb)72 248.4 Q(uild just by going to the)-.22 E F1(xc)2.75 E F0(directory in your) 2.75 E -.22(bu)72 261.4 S(ild tree and typing:).22 E 2.75(%m)108 280.4 S (ak)-2.75 E 2.75(e>)-.11 G 2.75(&m)-2.75 G(ak)-2.75 E(e.log)-.11 E(If c\ on\214guration \214les are changed, the safest thing to do is type:)72 303 Q 2.75(%m)108 322 S(ak)-2.75 E 2.75(eE)-.11 G -.165(ve)-2.75 G (rything >& e).165 E -.165(ve)-.275 G(ry).165 E(.log)-.715 E -.916(``)72 344.6 S(Ev).916 E(erything')-.165 E 2.75('i)-.916 G 2.75(ss)-2.75 G (imilar to `)-2.75 E(`W)-.916 E(orld')-.88 E 2.75('i)-.916 G 2.75(nt) -2.75 G(hat it reb)-2.75 E(uilds e)-.22 E -.165(ve)-.275 G(ry).165 E F1 (Mak)2.75 E(e\214le)-.11 E F0 2.75(,b)C(ut unlik)-2.97 E 2.75(e`)-.11 G (`W)-3.666 E(orld')-.88 E 2.75('i)-.916 G 2.75(td)-2.75 G(oes not)-2.75 E(delete the e)72 357.6 Q(xisting objects, libraries, and e)-.165 E -.165(xe)-.165 G(cutables, and only reb).165 E (uilds what is out of date.)-.22 E F1 2.75(2.14. F)72 396.6 R (ormatting the Documentation)-.275 E F0(The PostScript \214les in)72 426.2 Q F1(xc/doc/hardcopy)2.75 E F0 (can be generated from the sources in)2.75 E F1(xc/doc/specs)2.75 E F0 5.5(.M)C(ost of the)-5.5 E(documentation is in trof)72 439.2 Q 2.75(fu) -.275 G(sing the)-2.75 E(\255ms macros.)4.583 E(The easiest w)5.5 E (ay to format it is to use the Imak)-.11 E(e\214les pro-)-.11 E(vided.) 72 452.2 Q(Set the name of your local trof)72 468.8 Q 2.75(fp)-.275 G (rogram by setting the v)-2.75 E(ariable)-.275 E F1 -1.32 -.814(Tr o) 2.75 H(ffCmd).814 E F0(in)2.75 E F1(xc/con\214g/cf/site.def)2.75 E F0 5.5(.T)C(hen)-5.5 E -.22(bu)72 481.8 S(ild the Mak).22 E(e\214les:)-.11 E(cd xc/doc)108 500.8 Q(mak)108 513.8 Q 2.75(eS)-.11 G(UBDIRS=specs Mak) -2.75 E(e\214les)-.11 E(Finally)72 536.4 Q 2.75(,g)-.715 G 2.75(ot)-2.75 G 2.75(ot)-2.75 G(he directory you are interested in and type `)-2.75 E (`mak)-.916 E(e')-.11 E 2.75('t)-.916 G 2.75(here. This)-2.75 F (command will generate)2.75 E F1(.PS)2.75 E F0 2.75(\214les. Y)72 549.4 R(ou can also generate te)-1.21 E (xt \214les by specifying the document name with a)-.165 E F1(.txt)2.75 E F0 -.165(ex)2.75 G(tension as a).165 E/F2 11/Times-Italic@0 SF(mak) 2.75 E(e)-.11 E F0(tar)72 562.4 Q(get, e.g., `)-.198 E(`mak)-.916 E 2.75 (ei)-.11 G(cccm.txt')-2.75 E('.)-.916 E(10)300.5 769 Q EP %%Trailer end %%EOF vnc_unixsrc/Xvnc/config/0040775000076400007640000000000010616336477014673 5ustar constconstvnc_unixsrc/Xvnc/config/imake/0040775000076400007640000000000010616336474015756 5ustar constconstvnc_unixsrc/Xvnc/config/imake/imake.man0100664000076400007640000002313407120677563017544 0ustar constconst.\" $XConsortium: imake.man /main/29 1996/09/28 16:14:42 rws $ .\" Copyright (c) 1993, 1994 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. .\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. .\" .\" Except as contained in this notice, the name of the X Consortium shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .TH IMAKE 1 "Release 6.1" "X Version 11" .SH NAME imake \- C preprocessor interface to the make utility .SH SYNOPSIS \fBimake\fP [ \fB\-D\fP\fIdefine\fP ] [ \fB\-I\fP\fIdir\fP ] [ \fB\-T\fP\fItemplate\fP ] [ \fB\-f\fP \fIfilename\fP ] [ \fB\-C\fP \fIfilename\fP ] [ \fB\-s\fP \fIfilename\fP ] [ \fB\-e\fP ] [ \fB\-v\fP ] .SH DESCRIPTION .I Imake is used to generate \fIMakefiles\fP from a template, a set of \fIcpp\fP macro functions, and a per-directory input file called an \fIImakefile\fP. This allows machine dependencies (such as compiler options, alternate command names, and special \fImake\fP rules) to be kept separate from the descriptions of the various items to be built. .SH OPTIONS The following command line options may be passed to \fIimake\fP: .TP 8 .B \-D\fIdefine\fP This option is passed directly to \fIcpp\fP. It is typically used to set directory-specific variables. For example, the X Window System uses this flag to set \fITOPDIR\fP to the name of the directory containing the top of the core distribution and \fICURDIR\fP to the name of the current directory, relative to the top. .TP 8 .B \-I\fIdirectory\fP This option is passed directly to \fIcpp\fP. It is typically used to indicate the directory in which the \fIimake\fP template and configuration files may be found. .TP 8 .B \-T\fItemplate\fP This option specifies the name of the master template file (which is usually located in the directory specified with \fI\-I\fP) used by \fIcpp\fP. The default is \fIImake.tmpl\fP. .TP 8 .B \-f \fIfilename\fP This option specifies the name of the per-directory input file. The default is \fIImakefile\fP. .TP 8 .B \-C \fIfilename\fP This option specifies the name of the .c file that is constructed in the current directory. The default is \fIImakefile.c\fP. .TP 8 .B \-s \fIfilename\fP This option specifies the name of the \fImake\fP description file to be generated but \fImake\fP should not be invoked. If the \fIfilename\fP is a dash (\-), the output is written to \fIstdout\fP. The default is to generate, but not execute, a \fIMakefile\fP. .TP 8 .B \-e This option indicates the \fIimake\fP should execute the generated \fIMakefile\fP. The default is to leave this to the user. .TP 8 .B \-v This option indicates that \fIimake\fP should print the \fIcpp\fP command line that it is using to generate the \fIMakefile\fP. .SH "HOW IT WORKS" \fIImake\fP invokes \fIcpp\fP with any \fI\-I\fP or \fI\-D\fP flags passed on the command line and passes the name of a file containing the following 3 lines: .sp .nf #define IMAKE_TEMPLATE "Imake.tmpl" #define INCLUDE_IMAKEFILE #include IMAKE_TEMPLATE .fi .sp where \fIImake.tmpl\fP and \fIImakefile\fP may be overridden by the \fI\-T\fP and \fI\-f\fP command options, respectively. .PP The IMAKE_TEMPLATE typically reads in a file containing machine-dependent parameters (specified as \fIcpp\fP symbols), a site-specific parameters file, a file defining variables, a file containing \fIcpp\fP macro functions for generating \fImake\fP rules, and finally the \fIImakefile\fP (specified by INCLUDE_IMAKEFILE) in the current directory. The \fIImakefile\fP uses the macro functions to indicate what targets should be built; \fIimake\fP takes care of generating the appropriate rules. .PP .I Imake configuration files contain two types of variables, imake variables and make variables. The imake variables are interpreted by cpp when .I imake is run. By convention they are mixed case. The make variables are written into the .I Makefile for later interpretation by .I make. By convention make variables are upper case. .PP The rules file (usually named \fIImake.rules\fP in the configuration directory) contains a variety of \fIcpp\fP macro functions that are configured according to the current platform. \fIImake\fP replaces any occurrences of the string ``@@'' with a newline to allow macros that generate more than one line of \fImake\fP rules. For example, the macro .ta 1i 1.6i 5i .nf #define program_target(program, objlist) @@\e program: objlist @@\e $(CC) \-o $@ objlist $(LDFLAGS) .fi when called with .I "program_target(foo, foo1.o foo2.o)" will expand to .nf foo: foo1.o foo2.o $(CC) \-o $@ foo1.o foo2.o $(LDFLAGS) .fi .PP \fIImake\fP also replaces any occurrences of the word ``XCOMM'' with the character ``#'' to permit placing comments in the Makefile without causing ``invalid directive'' errors from the preprocessor. .PP Some complex \fIimake\fP macros require generated \fImake\fP variables local to each invocation of the macro, often because their value depends on parameters passed to the macro. Such variables can be created by using an \fIimake\fP variable of the form \fBXVARdef\fP\fIn\fP, where \fIn\fP is a single digit. A unique \fImake\fP variable will be substituted. Later occurrences of the variable \fBXVARuse\fP\fIn\fP will be replaced by the variable created by the corresponding \fBXVARdef\fP\fIn\fP. .PP On systems whose \fIcpp\fP reduces multiple tabs and spaces to a single space, \fIimake\fP attempts to put back any necessary tabs (\fImake\fP is very picky about the difference between tabs and spaces). For this reason, colons (:) in command lines must be preceded by a backslash (\\). .SH "USE WITH THE X WINDOW SYSTEM" The X Window System uses \fIimake\fP extensively, for both full builds within the source tree and external software. As mentioned above, two special variables, \fITOPDIR\fP and \fICURDIR,\fP are set to make referencing files using relative path names easier. For example, the following command is generated automatically to build the \fIMakefile\fP in the directory \fIlib/X/\fP (relative to the top of the sources): .sp .nf % ../.././config/imake \-I../.././config \\ \-DTOPDIR=../../. \-DCURDIR=./lib/X .fi .sp When building X programs outside the source tree, a special symbol \fIUseInstalled\fP is defined and \fITOPDIR\fP and \fICURDIR\fP are omitted. If the configuration files have been properly installed, the script \fIxmkmf\fP(1) may be used. .SH "INPUT FILES" Here is a summary of the files read by .I imake as used by X. The indentation shows what files include what other files. .nf .sp .ta 3i Imake.tmpl generic variables site.def site-specific, BeforeVendorCF defined *.cf machine-specific *Lib.rules shared library rules site.def site-specific, AfterVendorCF defined Imake.rules rules Project.tmpl X-specific variables *Lib.tmpl shared library variables Imakefile Library.tmpl library rules Server.tmpl server rules Threads.tmpl multi-threaded rules .fi .LP Note that \fIsite.def\fP gets included twice, once before the \fI*.cf\fP file and once after. Although most site customizations should be specified after the \fI*.cf\fP file, some, such as the choice of compiler, need to be specified before, because other variable settings may depend on them. .LP The first time \fIsite.def\fP is included, the variable BeforeVendorCF is defined, and the second time, the variable AfterVendorCF is defined. All code in \fIsite.def\fP should be inside an #ifdef for one of these symbols. .SH FILES .ta 3i Imakefile.c temporary input file for cpp .br /tmp/Imf.XXXXXX temporary Makefile for -s .br /tmp/IIf.XXXXXX temporary Imakefile if specified Imakefile uses # comments .br /lib/cpp default C preprocessor .DT .SH "SEE ALSO" make(1), xmkmf(1) .br S. I. Feldman, .I Make \(em A Program for Maintaining Computer Programs .SH "ENVIRONMENT VARIABLES" The following environment variables may be set, however their use is not recommended as they introduce dependencies that are not readily apparent when \fIimake\fP is run: .TP 5 .B IMAKEINCLUDE If defined, this specifies a ``\-I'' include argument to pass to the C preprocessor. E.g., ``\-I/usr/X11/config''. .TP 5 .B IMAKECPP If defined, this should be a valid path to a preprocessor program. E.g., ``/usr/local/cpp''. By default, .I imake will use /lib/cpp. .TP 5 .B IMAKEMAKE If defined, this should be a valid path to a make program, such as ``/usr/local/make''. By default, .I imake will use whatever .I make program is found using .I execvp(3). This variable is only used if the ``\-e'' option is specified. .SH "AUTHOR" Todd Brunhoff, Tektronix and MIT Project Athena; Jim Fulton, MIT X Consortium vnc_unixsrc/Xvnc/config/imake/imakemdep.h0100664000076400007640000005134507624731532020067 0ustar constconst/* $TOG: imakemdep.h /main/101 1997/06/06 09:13:20 bill $ */ /* Copyright (c) 1993, 1994 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ /* $XFree86: xc/config/imake/imakemdep.h,v 3.24.2.3 1997/07/27 02:41:05 dawes Exp $ */ /* * This file contains machine-dependent constants for the imake utility. * When porting imake, read each of the steps below and add in any necessary * definitions. In general you should *not* edit ccimake.c or imake.c! */ #ifdef CCIMAKE /* * Step 1: imake_ccflags * Define any special flags that will be needed to get imake.c to compile. * These will be passed to the compile along with the contents of the * make variable BOOTSTRAPCFLAGS. */ #if defined(clipper) || defined(__clipper__) #define imake_ccflags "-O -DSYSV -DBOOTSTRAPCFLAGS=-DSYSV" #endif #ifdef hpux #ifdef hp9000s800 #define imake_ccflags "-DSYSV" #else #define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" #endif #endif #if defined(macII) || defined(_AUX_SOURCE) #define imake_ccflags "-DmacII -DSYSV" #endif #ifdef stellar #define imake_ccflags "-DSYSV" #endif #if defined(USL) || defined(__USLC__) || defined(Oki) || defined(NCR) #define imake_ccflags "-Xa -DSVR4" #endif /* SCO may define __USLC__ so put this after the USL check */ #if defined(M_UNIX) || defined(_SCO_DS) #ifdef imake_ccflags #undef imake_ccflags #endif #define imake_ccflags "-Dsco -DSYSV" #endif #ifdef sony #if defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV) #define imake_ccflags "-DSVR4" #else #include #if NEWSOS < 41 #define imake_ccflags "-Dbsd43 -DNOSTDHDRS" #else #if NEWSOS < 42 #define imake_ccflags "-Dbsd43" #endif #endif #endif #endif #ifdef _CRAY #define imake_ccflags "-DSYSV -DUSG" #endif #if defined(_IBMR2) || defined(aix) #define imake_ccflags "-Daix -DSYSV" #endif #ifdef Mips # if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) # define imake_ccflags "-DBSD43" # else # define imake_ccflags "-DSYSV" # endif #endif #ifdef is68k #define imake_ccflags "-Dluna -Duniosb" #endif #ifdef SYSV386 # ifdef SVR4 # define imake_ccflags "-Xa -DSVR4" # else # define imake_ccflags "-DSYSV" # endif #endif #ifdef SVR4 # ifdef i386 # define imake_ccflags "-Xa -DSVR4" # endif #endif #ifdef SYSV # ifdef i386 # define imake_ccflags "-DSYSV" # endif #endif #ifdef __convex__ #define imake_ccflags "-fn -tm c1" #endif #ifdef apollo #define imake_ccflags "-DX_NOT_POSIX" #endif #ifdef WIN32 #if _MSC_VER < 1000 #define imake_ccflags "-nologo -batch -D__STDC__" #else #define imake_ccflags "-nologo -D__STDC__" #endif #endif #ifdef __uxp__ #define imake_ccflags "-DSVR4 -DANSICPP" #endif #ifdef __sxg__ #define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS" #endif #ifdef sequent #define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX" #endif #ifdef _SEQUENT_ #define imake_ccflags "-DSYSV -DUSG" #endif #if defined(SX) || defined(PC_UX) #define imake_ccflags "-DSYSV" #endif #ifdef nec_ews_svr2 #define imake_ccflags "-DUSG" #endif #if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft) #define imake_ccflags "-DSVR4" #endif #ifdef MACH #define imake_ccflags "-DNOSTDHDRS" #endif /* this is for OS/2 under EMX. This won't work with DOS */ #if defined(__EMX__) #define imake_ccflags "-DBSD43" #endif #else /* not CCIMAKE */ #ifndef MAKEDEPEND /* * Step 2: dup2 * If your OS doesn't have a dup2() system call to duplicate one file * descriptor onto another, define such a mechanism here (if you don't * already fall under the existing category(ies). */ #if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_) && !defined(sco) #define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \ fcntl(fd1, F_DUPFD, fd2))) #endif /* * Step 3: FIXUP_CPP_WHITESPACE * If your cpp collapses tabs macro expansions into a single space and * replaces escaped newlines with a space, define this symbol. This will * cause imake to attempt to patch up the generated Makefile by looking * for lines that have colons in them (this is why the rules file escapes * all colons). One way to tell if you need this is to see whether or not * your Makefiles have no tabs in them and lots of @@ strings. */ #if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || defined(sco) || (defined(AMOEBA) && defined(CROSS_COMPILE)) #define FIXUP_CPP_WHITESPACE #endif #ifdef WIN32 #define REMOVE_CPP_LEADSPACE #define INLINE_SYNTAX #define MAGIC_MAKE_VARS #endif #ifdef __minix_vmd #define FIXUP_CPP_WHITESPACE #endif /* * Step 4: USE_CC_E, DEFAULT_CC, DEFAULT_CPP * If you want to use cc -E instead of cpp, define USE_CC_E. * If use cc -E but want a different compiler, define DEFAULT_CC. * If the cpp you need is not in /lib/cpp, define DEFAULT_CPP. */ #ifdef hpux #define USE_CC_E #endif #ifdef WIN32 #define USE_CC_E #define DEFAULT_CC "cl" #endif #ifdef apollo #define DEFAULT_CPP "/usr/lib/cpp" #endif #if defined(clipper) || defined(__clipper__) #define DEFAULT_CPP "/usr/lib/cpp" #endif #if defined(_IBMR2) && !defined(DEFAULT_CPP) #define DEFAULT_CPP "/usr/ccs/lib/cpp" #endif #if defined(sun) && (defined(SVR4) || defined(__svr4__) || defined(__SVR4) || defined(__sol__)) #define DEFAULT_CPP "/usr/ccs/lib/cpp" #endif #ifdef __bsdi__ #define DEFAULT_CPP "/usr/bin/cpp" #endif #ifdef __uxp__ #define DEFAULT_CPP "/usr/ccs/lib/cpp" #endif #ifdef __sxg__ #define DEFAULT_CPP "/usr/lib/cpp" #endif #ifdef _CRAY #define DEFAULT_CPP "/lib/pcpp" #endif #if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) #define DEFAULT_CPP "/usr/libexec/cpp" #endif #if defined(__sgi) && defined(__ANSI_CPP__) #define USE_CC_E #endif #ifdef MACH #define USE_CC_E #endif #ifdef __minix_vmd #define DEFAULT_CPP "/usr/lib/cpp" #endif #if defined(__EMX__) /* expects cpp in PATH */ #define DEFAULT_CPP "cpp" #endif #ifdef __MACH__ #define DEFAULT_CPP "/usr/bin/cpp" #endif /* * Step 5: cpp_argv * The following table contains the flags that should be passed * whenever a Makefile is being generated. If your preprocessor * doesn't predefine any unique symbols, choose one and add it to the * end of this table. Then, do the following: * * a. Use this symbol in Imake.tmpl when setting MacroFile. * b. Put this symbol in the definition of BootstrapCFlags in your * .cf file. * c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol" * to the end of the command line. * * Note that you may define more than one symbol (useful for platforms * that support multiple operating systems). */ #define ARGUMENTS 50 /* number of arguments in various arrays */ char *cpp_argv[ARGUMENTS] = { "cc", /* replaced by the actual program to exec */ "-I.", /* add current directory to include path */ #ifdef unix "-Uunix", /* remove unix symbol so that filename unix.c okay */ #endif #if defined(__386BSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(MACH) || defined(linux) || defined(__GNU__) # ifdef __i386__ "-D__i386__", # endif # ifdef __sparc__ "-D__sparc__", # endif # ifdef __alpha__ "-D__alpha__", # endif # ifdef __GNUC__ "-traditional", # endif #endif #ifdef M4330 "-DM4330", /* Tektronix */ #endif #ifdef M4310 "-DM4310", /* Tektronix */ #endif #if defined(macII) || defined(_AUX_SOURCE) "-DmacII", /* Apple A/UX */ #endif #if defined(USL) || defined(__USLC__) "-DUSL", /* USL */ #endif #ifdef sony "-Dsony", /* Sony */ #if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) && NEWSOS < 42 "-Dbsd43", #endif #endif #ifdef _IBMR2 "-D_IBMR2", /* IBM RS-6000 (we ensured that aix is defined above */ #ifndef aix #define aix /* allow BOOTSTRAPCFLAGS="-D_IBMR2" */ #endif #endif /* _IBMR2 */ #ifdef aix "-Daix", /* AIX instead of AOS */ #ifndef ibm #define ibm /* allow BOOTSTRAPCFLAGS="-Daix" */ #endif #endif /* aix */ #ifdef ibm "-Dibm", /* IBM PS/2 and RT under both AOS and AIX */ #endif #ifdef luna "-Dluna", /* OMRON luna 68K and 88K */ #ifdef luna1 "-Dluna1", #endif #ifdef luna88k /* need not on UniOS-Mach Vers. 1.13 */ "-traditional", /* for some older version */ #endif /* instead of "-DXCOMM=\\#" */ #ifdef uniosb "-Duniosb", #endif #ifdef uniosu "-Duniosu", #endif #endif /* luna */ #ifdef _CRAY /* Cray */ "-Ucray", #endif #ifdef Mips "-DMips", /* Define and use Mips for Mips Co. OS/mach. */ # if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) "-DBSD43", /* Mips RISCOS supports two environments */ # else "-DSYSV", /* System V environment is the default */ # endif #endif /* Mips */ #ifdef MOTOROLA "-DMOTOROLA", /* Motorola Delta Systems */ # ifdef SYSV "-DSYSV", # endif # ifdef SVR4 "-DSVR4", # endif #endif /* MOTOROLA */ #if defined(M_UNIX) || defined(sco) "-Dsco", "-DSYSV", #endif #ifdef i386 "-Di386", # ifdef SVR4 "-DSVR4", # endif # ifdef SYSV "-DSYSV", # ifdef ISC "-DISC", # ifdef ISC40 "-DISC40", /* ISC 4.0 */ # else # ifdef ISC202 "-DISC202", /* ISC 2.0.2 */ # else # ifdef ISC30 "-DISC30", /* ISC 3.0 */ # else "-DISC22", /* ISC 2.2.1 */ # endif # endif # endif # endif # ifdef SCO "-DSCO", # ifdef _SCO_DS "-DSCO325 -DSVR4", # endif # endif # endif # ifdef ESIX "-DESIX", # endif # ifdef ATT "-DATT", # endif # ifdef DELL "-DDELL", # endif #endif #ifdef SYSV386 /* System V/386 folks, obsolete */ "-Di386", # ifdef SVR4 "-DSVR4", # endif # ifdef ISC "-DISC", # ifdef ISC40 "-DISC40", /* ISC 4.0 */ # else # ifdef ISC202 "-DISC202", /* ISC 2.0.2 */ # else # ifdef ISC30 "-DISC30", /* ISC 3.0 */ # else "-DISC22", /* ISC 2.2.1 */ # endif # endif # endif # endif # ifdef SCO "-DSCO", # ifdef _SCO_DS "-DSCO325 -DSVR4", # endif # endif # ifdef ESIX "-DESIX", # endif # ifdef ATT "-DATT", # endif # ifdef DELL "-DDELL", # endif #endif #ifdef __osf__ "-D__osf__", # ifdef __mips__ "-D__mips__", # endif # ifdef __alpha "-D__alpha", # endif # ifdef __alpha__ "-D__alpha__", # endif # ifdef __i386__ "-D__i386__", # endif # ifdef __s390__ "-D__s390__", # endif # ifdef __GNUC__ "-traditional", # endif #endif #ifdef __s390__ "-D__s390__", #endif #ifdef __s390x__ "-D__s390x__", #endif #ifdef Oki "-DOki", #endif #ifdef sun #if defined(SVR4) || defined(__svr4__) || defined(__SVR4) || defined(__sol__) "-DSVR4", #endif #endif #ifdef WIN32 "-DWIN32", "-nologo", #if _MSC_VER < 1000 "-batch", #endif "-D__STDC__", #endif #ifdef NCR "-DNCR", /* NCR */ #endif #ifdef linux "-traditional", "-Dlinux", #endif #ifdef __uxp__ "-D__uxp__", #endif #ifdef __sxg__ "-D__sxg__", #endif #ifdef nec_ews_svr2 "-Dnec_ews_svr2", #endif #ifdef AMOEBA "-DAMOEBA", # ifdef CROSS_COMPILE "-DCROSS_COMPILE", # ifdef CROSS_i80386 "-Di80386", # endif # ifdef CROSS_sparc "-Dsparc", # endif # ifdef CROSS_mc68000 "-Dmc68000", # endif # else # ifdef i80386 "-Di80386", # endif # ifdef sparc "-Dsparc", # endif # ifdef mc68000 "-Dmc68000", # endif # endif #endif #if defined(__sgi) && defined(__ANSI_CPP__) "-cckr", #endif #ifdef __minix_vmd "-Dminix", #endif #if defined(__EMX__) "-traditional", "-Demxos2", #endif }; /* * Step 6: DEFAULT_OS_MAJOR_REV, DEFAULT_OS_MINOR_REV, DEFAULT_OS_TEENY_REV, * and DEFAULT_OS_NAME. * If your systems provides a way to generate the default major, * minor, teeny, or system names at runtime add commands below. * The syntax of the _REV strings is 'f fmt' where 'f' is an argument * you would give to uname, and "fmt" is a scanf() format string. * Supported uname arguments are "snrvm", and if you specify multiple * arguments they will be separated by spaces. No more than 5 arguments * may be given. Unlike uname() order of arguments matters. * * DEFAULT_OS_MAJOR_REV_FROB, DEFAULT_OS_MINOR_REV_FROB, * DEFAULT_OS_TEENY_REV_FROB, and DEFAULT_OS_NAME_FROB can be used to * modify the results of the use of the various strings. */ #if defined(aix) /* uname -v returns "x" (e.g. "4"), and uname -r returns "y" (e.g. "1") */ # define DEFAULT_OS_MAJOR_REV "v %[0-9]" # define DEFAULT_OS_MINOR_REV "r %[0-9]" /* No information available to generate default OSTeenyVersion value. */ # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(sun) || defined(sgi) || defined(ultrix) || defined(__uxp__) || defined(sony) /* uname -r returns "x.y[.z]", e.g. "5.4" or "4.1.3" */ # define DEFAULT_OS_MAJOR_REV "r %[0-9]" # define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]" # define DEFAULT_OS_TEENY_REV "r %*d.%*d.%[0-9]" # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(hpux) /* uname -r returns "W.x.yz", e.g. "B.10.01" */ # define DEFAULT_OS_MAJOR_REV "r %*[^.].%[0-9]" # define DEFAULT_OS_MINOR_REV "r %*[^.].%*d.%1s" # define DEFAULT_OS_TEENY_REV "r %*[^.].%*d.%*c%[0-9]" # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(USL) || defined(__USLC__) /* uname -v returns "x.yz" or "x.y.z", e.g. "2.02" or "2.1.2". */ # define DEFAULT_OS_MAJOR_REV "v %[0-9]" # define DEFAULT_OS_MINOR_REV "v %*d.%1s" # define DEFAULT_OS_TEENY_REV "v %*d.%*c%[.0-9]" # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(__osf__) /* uname -r returns "Wx.y", e.g. "V3.2" or "T4.0" */ # define DEFAULT_OS_MAJOR_REV "r %*[^0-9]%[0-9]" # define DEFAULT_OS_MINOR_REV "r %*[^.].%[0-9]" # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(__uxp__) /* NOTE: "x.y[.z]" above handles UXP/DF. This is a sample alternative. */ /* uname -v returns "VxLy Yzzzzz ....", e.g. "V20L10 Y95021 Increment 5 ..." */ # define DEFAULT_OS_MAJOR_REV "v V%[0-9]" # define DEFAULT_OS_MINOR_REV "v V%*dL%[0-9]" # define DEFAULT_OS_NAME "srvm %[^\n]" #elif defined(linux) # define DEFAULT_OS_MAJOR_REV "r %[0-9]" # define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]" # define DEFAULT_OS_TEENY_REV "r %*d.%*d.%[0-9]" # define DEFAULT_OS_NAME "srm %[^\n]" #elif defined(ISC) /* ISC all Versions ? */ /* uname -r returns "x.y", e.g. "3.2" ,uname -v returns "x" e.g. "2" */ # define DEFAULT_OS_MAJOR_REV "r %[0-9]" # define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]" # define DEFAULT_OS_TEENY_REV "v %[0-9]" /* # define DEFAULT_OS_NAME "srm %[^\n]" */ /* Not useful on ISC */ #elif defined(__FreeBSD__) || defined(__OpenBSD__) /* BSD/OS too? */ /* uname -r returns "x.y[.z]-mumble", e.g. "2.1.5-RELEASE" or "2.2-0801SNAP" */ # define DEFAULT_OS_MAJOR_REV "r %[0-9]" # define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]" # define DEFAULT_OS_TEENY_REV "r %*d.%*d.%[0-9]" # define DEFAULT_OS_NAME "srm %[^\n]" # if defined(__FreeBSD__) /* Use an alternate way to find the teeny version for -STABLE, -SNAP versions */ # define DEFAULT_OS_TEENY_REV_FROB(buf, size) \ do { \ if (*buf == 0) { \ int __mib[2]; \ size_t __len; \ int __osrel; \ \ __mib[0] = CTL_KERN; \ __mib[1] = KERN_OSRELDATE; \ __len = sizeof(__osrel); \ sysctl(__mib, 2, &__osrel, &__len, NULL, 0); \ if (__osrel < 210000) { \ if (__osrel < 199607) \ buf[0] = '0'; \ else if (__osrel < 199612) \ buf[0] = '5'; \ else if (__osrel == 199612) \ buf[0] = '6'; \ else \ buf[0] = '8'; /* guess */ \ } else { \ buf[0] = ((__osrel / 1000) % 10) + '0'; \ } \ buf[1] = 0; \ } \ } while (0) # else /* OpenBSD - Add DEFAULT_MACHINE_ARCHITECTURE */ # define DEFAULT_MACHINE_ARCHITECTURE "m %[^\n]" # endif #elif defined(__NetBSD__) /* * uname -r returns "x.y([ABCD...]|_mumble)", e.g.: * 1.2 1.2_BETA 1.2A 1.2B * * That means that we have to do something special to turn the * TEENY revision into a form that we can use (i.e., a string of * decimal digits). * * We also frob the name DEFAULT_OS_NAME so that it looks like the * 'standard' NetBSD name for the version, e.g. "NetBSD/i386 1.2B" for * NetBSD 1.2B on an i386. */ # define DEFAULT_OS_MAJOR_REV "r %[0-9]" # define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]" # define DEFAULT_OS_TEENY_REV "r %*d.%*d%[A-Z]" # define DEFAULT_OS_TEENY_REV_FROB(buf, size) \ do { \ if (*(buf) >= 'A' && *(buf) <= 'Z') /* sanity check */ \ snprintf((buf), (size), "%d", *(buf) - 'A' + 1); \ else \ *(buf) = '\0'; \ } while (0) # define DEFAULT_OS_NAME "smr %[^\n]" # define DEFAULT_OS_NAME_FROB(buf, size) \ do { \ char *__sp; \ if ((__sp = strchr((buf), ' ')) != NULL) \ *__sp = '/'; \ } while (0) #endif #else /* else MAKEDEPEND */ /* * Step 7: predefs * If your compiler and/or preprocessor define any specific symbols, add * them to the the following table. The definition of struct symtab is * in util/makedepend/def.h. */ struct symtab predefs[] = { #ifdef apollo {"apollo", "1"}, #endif #if defined(clipper) || defined(__clipper__) {"clipper", "1"}, {"__clipper__", "1"}, {"clix", "1"}, {"__clix__", "1"}, #endif #ifdef ibm032 {"ibm032", "1"}, #endif #ifdef ibm {"ibm", "1"}, #endif #ifdef aix {"aix", "1"}, #endif #ifdef sun {"sun", "1"}, #endif #ifdef sun2 {"sun2", "1"}, #endif #ifdef sun3 {"sun3", "1"}, #endif #ifdef sun4 {"sun4", "1"}, #endif #ifdef sparc {"sparc", "1"}, #endif #ifdef __sparc__ {"__sparc__", "1"}, #endif #ifdef hpux {"hpux", "1"}, #endif #ifdef __hpux {"__hpux", "1"}, #endif #ifdef __hp9000s800 {"__hp9000s800", "1"}, #endif #ifdef __hp9000s700 {"__hp9000s700", "1"}, #endif #ifdef vax {"vax", "1"}, #endif #ifdef VMS {"VMS", "1"}, #endif #ifdef cray {"cray", "1"}, #endif #ifdef CRAY {"CRAY", "1"}, #endif #ifdef _CRAY {"_CRAY", "1"}, #endif #ifdef att {"att", "1"}, #endif #ifdef mips {"mips", "1"}, #endif #ifdef __mips__ {"__mips__", "1"}, #endif #ifdef ultrix {"ultrix", "1"}, #endif #ifdef stellar {"stellar", "1"}, #endif #ifdef mc68000 {"mc68000", "1"}, #endif #ifdef mc68020 {"mc68020", "1"}, #endif #ifdef __GNUC__ {"__GNUC__", "1"}, #endif #if __STDC__ {"__STDC__", "1"}, #endif #ifdef __HIGHC__ {"__HIGHC__", "1"}, #endif #ifdef CMU {"CMU", "1"}, #endif #ifdef luna {"luna", "1"}, #ifdef luna1 {"luna1", "1"}, #endif #ifdef luna2 {"luna2", "1"}, #endif #ifdef luna88k {"luna88k", "1"}, #endif #ifdef uniosb {"uniosb", "1"}, #endif #ifdef uniosu {"uniosu", "1"}, #endif #endif #ifdef ieeep754 {"ieeep754", "1"}, #endif #ifdef is68k {"is68k", "1"}, #endif #ifdef m68k {"m68k", "1"}, #endif #ifdef m88k {"m88k", "1"}, #endif #ifdef __m88k__ {"__m88k__", "1"}, #endif #ifdef bsd43 {"bsd43", "1"}, #endif #ifdef hcx {"hcx", "1"}, #endif #ifdef sony {"sony", "1"}, #ifdef SYSTYPE_SYSV {"SYSTYPE_SYSV", "1"}, #endif #ifdef _SYSTYPE_SYSV {"_SYSTYPE_SYSV", "1"}, #endif #endif #ifdef __OSF__ {"__OSF__", "1"}, #endif #ifdef __osf__ {"__osf__", "1"}, #endif #ifdef __alpha {"__alpha", "1"}, #endif #ifdef __alpha__ {"__alpha__", "1"}, #endif #ifdef __DECC {"__DECC", "1"}, #endif #ifdef __decc {"__decc", "1"}, #endif #ifdef __unix__ {"__unix__", "1"}, #endif #ifdef __uxp__ {"__uxp__", "1"}, #endif #ifdef __sxg__ {"__sxg__", "1"}, #endif #ifdef _SEQUENT_ {"_SEQUENT_", "1"}, {"__STDC__", "1"}, #endif #ifdef __bsdi__ {"__bsdi__", "1"}, #endif #ifdef nec_ews_svr2 {"nec_ews_svr2", "1"}, #endif #ifdef nec_ews_svr4 {"nec_ews_svr4", "1"}, #endif #ifdef _nec_ews_svr4 {"_nec_ews_svr4", "1"}, #endif #ifdef _nec_up {"_nec_up", "1"}, #endif #ifdef SX {"SX", "1"}, #endif #ifdef nec {"nec", "1"}, #endif #ifdef _nec_ft {"_nec_ft", "1"}, #endif #ifdef PC_UX {"PC_UX", "1"}, #endif #ifdef sgi {"sgi", "1"}, #endif #ifdef __sgi {"__sgi", "1"}, #endif #ifdef __FreeBSD__ {"__FreeBSD__", "1"}, #endif #ifdef __OpenBSD__ {"__OpenBSD__", "1"}, #endif #ifdef __NetBSD__ {"__NetBSD__", "1"}, #endif #ifdef __ELF__ {"__ELF__", "1"}, #endif #ifdef __EMX__ {"__EMX__", "1"}, #endif /* add any additional symbols before this line */ {NULL, NULL} }; #endif /* MAKEDEPEND */ #endif /* CCIMAKE */ vnc_unixsrc/Xvnc/config/imake/imakesvc.cmd0100664000076400007640000001610007120677563020243 0ustar constconst/* Rexx OS/2 * This script serves as a helper cmd file for imake. Install this in * the path just like imake itself. * * $XFree86: xc/config/imake/imakesvc.cmd,v 3.10.2.1 1997/07/19 04:59:10 dawes Exp $ */ '@echo off' ADDRESS CMD CALL RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete' CALL RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree' CALL RxFuncAdd 'SysRmDir', 'RexxUtil', 'SysRmDir' CALL RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir' PARSE ARG all code = WORD(all,1) SELECT WHEN code=1 THEN DO /* imakesvc 1 u/n dir ruledir top current */ instflg = WORD(all,2) imakecmd = '\imake' ruledir = WORD(all,4) topdir = WORD(all,5) currentdir = WORD(all,6) IF instflg = 'u' THEN DO root = VALUE('X11ROOT',,'OS2ENVIRONMENT') IF root = '' THEN DO SAY 'Fatal error: no X11ROOT environment variable found!' EXIT 99 END imakecmd = 'imake' IF POS(':',ruledir) = 0 THEN ruledir1 = root||ruledir ELSE ruledir1 = ruledir topdir1 = topdir useinst = '-DUseInstalled' END ELSE DO /* in n mode, we must add a prefix ../ for MakeMakeSubdirs */ ruledir1 = '../'||ruledir topdir1 = '../'||topdir useinst = '' END ruledir = ruledir1 topdir = topdir1 curdir = DIRECTORY() dir = fixbadprefix(WORD(all,3)) d = DIRECTORY(dir) dirfwd=TRANSLATE(dir,'/','\') RC = SysFileDelete('Makefile.bak') IF exists('Makefile') THEN REN Makefile Makefile.bak /* There is a difficulty in the Imakefiles. Some builds refer * to directories that are in a different subtree. We need to adjust * the CURDIR and TOPDIR and -I paths */ IF SUBSTR(dirfwd,1,2)='..' THEN DO /* must recalculate passed topdir, currentdir, and ruledir */ ndist = nlevels(topdir) ncurdir = './'striplevel(dirfwd,ndist-1) ntopdir = maketop(nlevels(ncurdir)) nruledir = ntopdir||'/config/cf' END ELSE DO /* this is simple it is relative to this dir */ pfx = downlevels(dirfwd) nruledir = ruledir IF instflg = 'n' THEN DO /*sm120296*/ nruledir = pfx||ruledir END ntopdir = pfx||topdir ncurdir = currentdir /* use to be pfx || currentdir */ END imakecmd useinst '-I'nruledir' -DTOPDIR='ntopdir' -DCURDIR='ncurdir'/'dirfwd 'x11make MAKE=x11make SHELL= Makefiles' d = DIRECTORY(curdir) END WHEN code=2 THEN DO /* imakesvc 2 buildincdir buildinctop currentdir file */ bid = WORD(all,3) cid = WORD(all,4) fil = WORD(all,5) curdir = DIRECTORY() d = DIRECTORY(WORD(all,2)) rc = SysFileDelete(fil) dir = TRANSLATE(bid'/'cid'/'fil,'\','/') COPY dir .' >nul 2>&1 ' d = DIRECTORY(curdir) END WHEN code=3 THEN DO /* imakesvc 3 subdir updir file */ sdi = WORD(all,2) fil = WORD(all,4) curdir = DIRECTORY() d = DIRECTORY(WORD(all,3)) rc = SysFileDelete(fil) dir = TRANSLATE(sdi'/'fil,'\','/') COPY dir' . >nul 2>&1' d = DIRECTORY(curdir) END WHEN code=4 THEN DO /* imakesvc 4 [-r] files... */ rec = WORD(all,2) fp = 2 IF rec = '-r' THEN fp = 3 ELSE rec = '-n' DO i=fp TO WORDS(all) CALL discard rec,TRANSLATE(WORD(all,i),'\','/') END END WHEN code=5 THEN DO /* imakesvc 5 file */ file = TRANSLATE(WORD(all,2),'\','/') RC = SysFileDelete(file'.bak') if exists(file) THEN 'REN 'file file||'.bak' END WHEN code=6 THEN DO /* imakesvc 6 file */ file = TRANSLATE(WORD(all,2),'\','/') CALL SysFileDelete(file||'.bak') if exists(file) THEN 'REN 'file file||'.bak' END WHEN code=7 THEN DO /* imakesvc 7 from to */ from = TRANSLATE(WORD(all,2),'\','/') to = TRANSLATE(WORD(all,3),'\','/') CALL SysFileDelete(to) COPY from to' >nul 2>&1' END WHEN code=8 THEN DO /* imakesvc 8 arg */ SAY SUBWORD(TRANSLATE(all,' ','222c'x),2) END WHEN code=9 THEN DO /* imakesvc 9 dst.c incl.h src.c */ dst = TRANSLATE(WORD(all,2),'\','/') src = TRANSLATE(WORD(all,4),'\','/') CALL SysFileDelete(dst) CALL LINEOUT dst,'#include "'WORD(all,3)'"' CALL LINEOUT dst,'#include "'src'"' CALL LINEOUT dst END WHEN code=10 THEN DO /* imakesvc 10 srcfile destdir destfile suffix */ src = stripsuffix(WORD(all,2)) destdir = TRANSLATE(WORD(all,3),'\','/') dest = stripsuffix(WORD(all,4)) suffix = WORD(all,5) tgt = destdir'\'dest'.'suffix /* if you have no col.exe get one from 4.4BSD */ 'groff -e -t -man -Tascii 'src'.man | col -b >'tgt END WHEN code=11 THEN DO /* imakesvc 11 dirtomake */ dirtomake = TRANSLATE(WORD(all,2),'\','/') rc = SysMkDir(dirtomake) END WHEN code=12 THEN DO /* imakesvc 12 srcfile destdir destfile */ src = stripsuffix(WORD(all,2)) destdir = TRANSLATE(WORD(all,3),'\','/') dest = stripsuffix(WORD(all,4)) tgt = destdir'\'dest'.gz' /* if you have no col.exe get one from 4.4BSD */ 'groff -e -t -man -Tascii 'src'.man | col -b | gzip -n >'tgt END WHEN code=13 THEN DO /* imakesvc 13 indir fromfile tofile */ ind = TRANSLATE(WORD(all,2),'\','/') frm = TRANSLATE(WORD(all,3),'\','/') tof = ind'\'WORD(all,4) IF \(exists(ind)) THEN MKDIR ind rc = SysFileDelete(tof) COPY frm' 'tof END OTHERWISE NOP END RETURN downlevels: oldpos = 1 pfx = '' DO FOREVER newpos = POS('/',ARG(1),oldpos) IF newpos = 0 THEN LEAVE newpfx = '../'pfx oldpos = newpos+1 pfx = newpfx END RETURN pfx /* returns 1, if file exists */ exists: 'DIR "'arg(1)'" >nul 2>&1' IF rc = 0 THEN return 1 RETURN 0 discard: PROCEDURE rec=ARG(1) files=ARG(2) IF rec = '-r' THEN DO old = DIRECTORY() nd = DIRECTORY CALL SysFileTree files, 'deld', 'DO' IF deld.0 > 0 THEN DO DO m=1 TO deld.0 CALL DIRECTORY deld.m CALL discard '-R' . CALL DIRECTORY .. CALL SysRmDir deld.m END CALL SysRmDir files END CALL SysFileTree files, 'delf', 'FO' DO k=1 TO delf.0 DEL '"'delf.k'"' '>nul 2>&1' END CALL SysRmDir files END ELSE DO DEL '"'files'"' '>nul 2>&1' END RETURN /* somehow make or cmd manages to convert a relative path ..\..\. to ..... */ fixbadprefix: count = 1 str = ARG(1) DO WHILE SUBSTR(str,count,2) = '..' count = count+1 str = INSERT('\',str,count) count = count+2 END RETURN str striplevel: str=ARG(1) n=arg(2) DO count=0 TO n p = POS('/',str) IF p = 0 THEN LEAVE str = DELSTR(str,1,p) END RETURN str nlevels: str = ARG(1) count = 0 oldpos = 1 DO FOREVER newpos = POS('/',str,oldpos) IF newpos = 0 THEN LEAVE oldpos = newpos + 1 count = count + 1 END RETURN count maketop: str = '' n = ARG(1) DO k=1 TO n str = str||'../' END RETURN str||'.' stripsuffix: str = ARG(1) spos = POS('.',str) IF spos = 0 THEN RETURN str ELSE RETURN LEFT(str,spos-1) vnc_unixsrc/Xvnc/config/imake/Imakefile0100664000076400007640000000257407120677563017577 0ustar constconstXCOMM $TOG: Imakefile /main/10 1997/04/30 15:39:17 kaleb $ XCOMM XCOMM XCOMM XCOMM XCOMM $XFree86: xc/config/imake/Imakefile,v 3.6.2.1 1997/06/11 12:08:33 dawes Exp $ XCOMM Some compilers generate fatal errors if an -L directory does XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use. LDPRELIB = LDPRELIBS = DEPLIBS = INCLUDES = -I$(TOP)/include $(TOP_X_INCLUDES)/X11 CPP_PROGRAM = CppCmd CPP_DEFINES = -DCPP_PROGRAM="\"$(CPP_PROGRAM)\"" DEFINES = $(SIGNAL_DEFINES) $(BOOTSTRAPCFLAGS) $(CPP_DEFINES) #if defined(MacIIArchitecture) || defined(SequentArchitecture) || defined(i386ScoArchitecture) XBSDLIB = /**/ #endif #if !defined(OS2Architecture) #undef ImakeDependency #define ImakeDependency(dummy) @@\ Makefile:: ProgramTargetName(imake) #if CrossCompiling SimpleHostProgramTarget(imake) #else SimpleProgramTarget(imake) #endif InstallLinkKitNamedProg(imake,imake,$(LINKKITDIR)/config/imake) #else /* OS2Architecture */ all:: CCOPTIONS = -Zsysv-signals EXTRA_LIBRARIES = /*nothing*/ SimpleProgramTarget(imake) InstallLinkKitNamedProg(imake,imake,$(LINKKITDIR)/config/imake) InstallNamedProg(imakesvc.cmd,imakesvc.cmd,$(BINDIR)) InstallLinkKitNamedProg(imakesvc.cmd,imakesvc.cmd,$(LINKKITDIR)/config/imake) #endif #if HasClearmake bootstrapdepend: depend #else bootstrapdepend: #endif clean:: RemoveFile(ProgramTargetName(ccimake)) $(RM) -r bootstrap vnc_unixsrc/Xvnc/config/imake/imake.c0100664000076400007640000010722007120677563017212 0ustar constconst/* $TOG: imake.c /main/97 1997/06/20 20:23:51 kaleb $ */ /*************************************************************************** * * * Porting Note * * * * Add the value of BOOTSTRAPCFLAGS to the cpp_argv table so that it will * * be passed to the template file. * * * ***************************************************************************/ /* $XFree86: xc/config/imake/imake.c,v 3.13.2.16 1998/03/01 00:34:54 dawes Exp $ */ /* * Copyright (c) 1985, 1986, 1987 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. * * Original Author: * Todd Brunhoff * Tektronix, inc. * While a guest engineer at Project Athena, MIT * * imake: the include-make program. * * Usage: imake [-Idir] [-Ddefine] [-T template] [-f imakefile ] [-C Imakefile.c ] [-s] [-e] [-v] [make flags] * * Imake takes a template file (Imake.tmpl) and a prototype (Imakefile) * and runs cpp on them producing a Makefile. It then optionally runs make * on the Makefile. * Options: * -D define. Same as cpp -D argument. * -I Include directory. Same as cpp -I argument. * -T template. Designate a template other * than Imake.tmpl * -f specify the Imakefile file * -C specify the name to use instead of Imakefile.c * -s[F] show. Show the produced makefile on the standard * output. Make is not run is this case. If a file * argument is provided, the output is placed there. * -e[F] execute instead of show; optionally name Makefile F * -v verbose. Show the make command line executed. * * Environment variables: * * IMAKEINCLUDE Include directory to use in addition to "." * IMAKECPP Cpp to use instead of /lib/cpp * IMAKEMAKE make program to use other than what is * found by searching the $PATH variable. * Other features: * imake reads the entire cpp output into memory and then scans it * for occurences of "@@". If it encounters them, it replaces it with * a newline. It also trims any trailing white space on output lines * (because make gets upset at them). This helps when cpp expands * multi-line macros but you want them to appear on multiple lines. * It also changes occurences of "XCOMM" to "#", to avoid problems * with treating commands as invalid preprocessor commands. * * The macros MAKEFILE and MAKE are provided as macros * to make. MAKEFILE is set to imake's makefile (not the constructed, * preprocessed one) and MAKE is set to argv[0], i.e. the name of * the imake program. * * Theory of operation: * 1. Determine the name of the imakefile from the command line (-f) * or from the content of the current directory (Imakefile or imakefile). * Call this . This gets added to the arguments for * make as MAKEFILE=. * 2. Determine the name of the template from the command line (-T) * or the default, Imake.tmpl. Call this