1 | /* $Xorg: lbxdeltastr.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
|
---|
2 | /*
|
---|
3 | * Copyright 1993 Network Computing Devices
|
---|
4 | *
|
---|
5 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | * the above copyright notice appear in all copies and that both that
|
---|
8 | * copyright notice and this permission notice appear in supporting
|
---|
9 | * documentation, and that the name of NCD. not be used in advertising or
|
---|
10 | * publicity pertaining to distribution of the software without specific,
|
---|
11 | * written prior permission. NCD. makes no representations about the
|
---|
12 | * suitability of this software for any purpose. It is provided "as is"
|
---|
13 | * without express or implied warranty.
|
---|
14 | *
|
---|
15 | * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
---|
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
|
---|
17 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
---|
19 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
---|
20 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
21 | *
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef LBX_DELTA_STRUCT_H
|
---|
25 | #define LBX_DELTA_STRUCT_H
|
---|
26 |
|
---|
27 | #define MIN_CACHEABLE_LEN 8
|
---|
28 |
|
---|
29 | #define DELTA_CACHEABLE(pcache, len) \
|
---|
30 | ((len) > MIN_CACHEABLE_LEN && (len) <= (pcache)->maxDeltasize)
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * An entry in the delta compactor cache
|
---|
34 | */
|
---|
35 | typedef struct _LBXDeltaElem {
|
---|
36 | int length;
|
---|
37 | unsigned char *buf;
|
---|
38 | } LBXDeltaElemRec, *LBXDeltaElemPtr;
|
---|
39 |
|
---|
40 |
|
---|
41 | /*
|
---|
42 | * Delta compactor cache
|
---|
43 | */
|
---|
44 | typedef struct _LBXDeltas {
|
---|
45 | unsigned short nDeltas;
|
---|
46 | unsigned short maxDeltasize;
|
---|
47 | LBXDeltaElemPtr deltas;
|
---|
48 | unsigned short nextDelta;
|
---|
49 | unsigned short activeDeltas; /* only needed for outgoing */
|
---|
50 | } LBXDeltasRec, *LBXDeltasPtr;
|
---|
51 |
|
---|
52 |
|
---|
53 | /*
|
---|
54 | * Motion delta cache
|
---|
55 | */
|
---|
56 |
|
---|
57 | typedef struct {
|
---|
58 | BYTE swapped;
|
---|
59 | BYTE detail;
|
---|
60 | CARD16 sequenceNumber B16;
|
---|
61 | Time time B32;
|
---|
62 | Window root B32, event B32, child B32;
|
---|
63 | INT16 rootX B16, rootY B16, eventX B16, eventY B16;
|
---|
64 | KeyButMask state B16;
|
---|
65 | BOOL sameScreen;
|
---|
66 | } lbxMotionCache;
|
---|
67 |
|
---|
68 |
|
---|
69 | /*
|
---|
70 | * Motion delta events
|
---|
71 | */
|
---|
72 |
|
---|
73 | typedef struct {
|
---|
74 | BYTE type; /* always eventBase + LbxQuickMotionDeltaEvent */
|
---|
75 | CARD8 deltaTime;
|
---|
76 | INT8 deltaX;
|
---|
77 | INT8 deltaY;
|
---|
78 | } lbxQuickMotionDeltaEvent;
|
---|
79 | #define sz_lbxQuickMotionDeltaEvent 4
|
---|
80 |
|
---|
81 | typedef struct {
|
---|
82 | BYTE type; /* always eventBase + LbxEvent */
|
---|
83 | BYTE lbxType; /* LbxMotionDeltaEvent */
|
---|
84 | INT8 deltaX;
|
---|
85 | INT8 deltaY;
|
---|
86 | CARD16 deltaTime B16;
|
---|
87 | CARD16 deltaSequence B16;
|
---|
88 | } lbxMotionDeltaEvent;
|
---|
89 | #define sz_lbxMotionDeltaEvent 8
|
---|
90 |
|
---|
91 | extern int LBXInitDeltaCache ( LBXDeltasPtr pcache, int nDeltas,
|
---|
92 | int maxDeltasize );
|
---|
93 | extern void LBXFreeDeltaCache ( LBXDeltasPtr pcache );
|
---|
94 | extern int LBXDeltaMinDiffs ( LBXDeltasPtr pcache, unsigned char *inmsg,
|
---|
95 | int inmsglen, int maxdiff, int *pindex );
|
---|
96 | extern void LBXEncodeDelta ( LBXDeltasPtr pcache, unsigned char *inmsg,
|
---|
97 | int ndiff, int index, unsigned char *buf );
|
---|
98 | extern int LBXDecodeDelta ( LBXDeltasPtr pcache, xLbxDiffItem *deltas,
|
---|
99 | int ndiff, int index, unsigned char **buf );
|
---|
100 | extern void LBXAddDeltaOut ( LBXDeltasPtr pcache, unsigned char *inmsg,
|
---|
101 | int inmsglen );
|
---|
102 | extern void LBXAddDeltaIn ( LBXDeltasPtr pcache, unsigned char *inmsg,
|
---|
103 | int inmsglen );
|
---|
104 |
|
---|
105 | #endif /* LBX_DELTA_STRUCT_H */
|
---|