~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools.raring-precise.backport

« back to all changes in this revision

Viewing changes to lib/include/region.h

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* **********************************************************
2
 
 * Copyright (C) 2002 VMware, Inc.
3
 
 * All Rights Reserved
4
 
 * **********************************************************/
5
 
 
6
 
/* $Xorg: regionstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */
7
 
/***********************************************************
8
 
 
9
 
Copyright 1987, 1998  The Open Group
10
 
 
11
 
Permission to use, copy, modify, distribute, and sell this software and its
12
 
documentation for any purpose is hereby granted without fee, provided that
13
 
the above copyright notice appear in all copies and that both that
14
 
copyright notice and this permission notice appear in supporting
15
 
documentation.
16
 
 
17
 
The above copyright notice and this permission notice shall be included in
18
 
all copies or substantial portions of the Software.
19
 
 
20
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
23
 
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
24
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
 
 
27
 
Except as contained in this notice, the name of The Open Group shall not be
28
 
used in advertising or otherwise to promote the sale, use or other dealings
29
 
in this Software without prior written authorization from The Open Group.
30
 
 
31
 
 
32
 
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
33
 
 
34
 
                        All Rights Reserved
35
 
 
36
 
Permission to use, copy, modify, and distribute this software and its
37
 
documentation for any purpose and without fee is hereby granted,
38
 
provided that the above copyright notice appear in all copies and that
39
 
both that copyright notice and this permission notice appear in
40
 
supporting documentation, and that the name of Digital not be
41
 
used in advertising or publicity pertaining to distribution of the
42
 
software without specific, written prior permission.
43
 
 
44
 
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
45
 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
46
 
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
47
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
48
 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
49
 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
50
 
SOFTWARE.
51
 
 
52
 
******************************************************************/
53
 
/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.7 2001/12/14 19:59:56 dawes Exp $ */
54
 
 
55
 
/*
56
 
 * region.h --
57
 
 *
58
 
 *      Interface definition for miRegion operations. Originally from X11
59
 
 *      source distribution. This version includes modifications made for the
60
 
 *      VNC Reflector package.
61
 
 *
62
 
 * ChangeLog:
63
 
 *
64
 
 *      07/21/2003 rrdharan     - added miRegionArea function prototype
65
 
 *                              - added REGION_AREA wrapper macro
66
 
 *                              - added this header, removed whitespace
67
 
 *      08/02/2005 akan         - fixed conflicting definition of MINSHORT
68
 
 *                                and MAXSHORT with winnt.h
69
 
 *      04/03/2007 shelleygong  - use int instead of short for data
70
 
 *                                inside the region
71
 
 *      02/12/2010 michael - Since coordinates are kept as ints, coordinate values
72
 
 *      shouldn't be clamped to the range of short. I removed R_{MIN,MAX}SHORT
73
 
 *      and changed clamping to be in the range R_MININT..R_MAXINT instead.
74
 
 *      Since some code does "n < R_MININT" and "n > R_MAXINT", R_MININT must be
75
 
 *      greater than INT_MIN and R_MAXINT must be less than INT_MAX.
76
 
 *      03/08/2010 amarp        - Move xalloc macro outside the header because of
77
 
 *                                boost conflict with macro
78
 
 */
79
 
 
80
 
#ifndef __REGION_H__
81
 
#define __REGION_H__
82
 
 
83
 
#include "vmware.h"
84
 
 
85
 
/* Return values from RectIn() */
86
 
#define rgnOUT 0
87
 
#define rgnIN  1
88
 
#define rgnPART 2
89
 
 
90
 
#define NullBox ((BoxPtr)0)
91
 
#define NullRegion ((RegionPtr)0)
92
 
 
93
 
#define R_MAXINT 0x0FFFFFFF   /* Must be less than INT_MAX */
94
 
#define R_MININT 0x8FFFFFFF   /* Must be greater than INT_MIN */
95
 
 
96
 
#define CT_YXBANDED 18
97
 
 
98
 
#define xrealloc(ptr, n) realloc((ptr), (n))
99
 
#define xfree(ptr)       free(ptr)
100
 
 
101
 
typedef enum {
102
 
   UpdateRect,
103
 
   ROPFillRect,
104
 
   Present3dRect,
105
 
   LockRect,
106
 
   FenceRect,
107
 
   MaxRect
108
 
} RectInfoType;
109
 
 
110
 
typedef struct RectInfo {
111
 
   RectInfoType type;
112
 
   union {
113
 
      struct {
114
 
         uint32 rop;
115
 
         uint32 color;
116
 
      } ROPFill;
117
 
      struct {
118
 
         uint32 sid;
119
 
         uint32 srcx, srcy;
120
 
      } Present3d;
121
 
      struct {
122
 
         uint32 fenceId;
123
 
      } Fence;
124
 
      /* add more here, then update miRectInfosEqual and miPrintRegion. */
125
 
   };
126
 
} RectInfo, *RectInfoPtr;
127
 
 
128
 
#define RECTINFO_ISVALID(info) \
129
 
   ((info).type >= UpdateRect && (info).type < MaxRect)
130
 
 
131
 
/*
132
 
 * X data types
133
 
 */
134
 
 
135
 
typedef struct _Box {
136
 
   int x1, y1, x2, y2;
137
 
   RectInfo info;
138
 
} BoxRec, *BoxPtr;
139
 
 
140
 
typedef struct _xPoint {
141
 
    int x, y;
142
 
} xPoint, *xPointPtr;
143
 
 
144
 
typedef xPoint DDXPointRec, *DDXPointPtr;
145
 
 
146
 
typedef struct _xRectangle {
147
 
    int x, y;
148
 
    unsigned short width, height;
149
 
    RectInfo info;
150
 
} xRectangle, *xRectanglePtr;
151
 
 
152
 
/*
153
 
 *   clip region
154
 
 */
155
 
 
156
 
typedef struct _RegData {
157
 
    int         size;
158
 
    int         numRects;
159
 
/*  BoxRec      rects[size];   in memory but not explicitly declared */
160
 
} RegDataRec, *RegDataPtr;
161
 
 
162
 
typedef struct _Region {
163
 
    BoxRec      extents;
164
 
    RegDataPtr  data;
165
 
} RegionRec, *RegionPtr;
166
 
 
167
 
extern BoxRec miEmptyBox;
168
 
extern RegDataRec miEmptyData;
169
 
extern RegDataRec miBrokenData;
170
 
 
171
 
#define REGION_EXTENTS(reg) (&(reg)->extents)
172
 
#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
173
 
#define REGION_NAR(reg) ((reg)->data == &miBrokenData)
174
 
#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
175
 
#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
176
 
#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
177
 
                                       : &(reg)->extents)
178
 
#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
179
 
#define REGION_BOX(reg,i) (&REGION_BOXPTR(reg)[i])
180
 
#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
181
 
#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
182
 
#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
183
 
 
184
 
#define REGION_VALIDINDEX(reg, i) (i >= 0 && i < REGION_NUM_RECTS((reg)))
185
 
 
186
 
#define BOX_X(ptr) (ptr->x1)
187
 
#define BOX_Y(ptr) (ptr->y1)
188
 
#define BOX_WIDTH(ptr) (ptr->x2 - ptr->x1)
189
 
#define BOX_HEIGHT(ptr) (ptr->y2 - ptr->y1)
190
 
#define BOX_XY(ptr) BOX_X(ptr), BOX_Y(ptr)
191
 
#define BOX_WH(ptr) BOX_WIDTH(ptr), BOX_HEIGHT(ptr)
192
 
#define BOX_XYWH(ptr) BOX_XY(ptr), BOX_WH(ptr)
193
 
 
194
 
#define RECT_SETBOX(r, rx, ry, rw, rh) do { \
195
 
  (r)->x1 = (rx); \
196
 
  (r)->x2 = (rx) + (rw); \
197
 
  (r)->y1 = (ry); \
198
 
  (r)->y2 = (ry) + (rh); \
199
 
  (r)->info.type = UpdateRect; \
200
 
} while (FALSE)
201
 
 
202
 
#define RECT_SETRECT(r, rx1, ry1, rx2, ry2) do { \
203
 
  RECT_SETBOX((r), (rx1), (ry1), ((rx2) - (rx1)), ((ry2) - (ry1))); \
204
 
} while (FALSE)
205
 
 
206
 
#define RECT_SETVMRECT(r, vmr) \
207
 
  RECT_SETRECT((r), (vmr)->left,  (vmr)->top,  (vmr)->right,  (vmr)->bottom)
208
 
 
209
 
/*
210
 
 * This will only work if the intersection is not empty.
211
 
 */
212
 
#define RECT_INTERSECT(r, r1, r2) \
213
 
{ \
214
 
   (r)->x1 = MAX((r1)->x1, (r2)->x1); \
215
 
   (r)->x2 = MIN((r1)->x2, (r2)->x2); \
216
 
   (r)->y1 = MAX((r1)->y1, (r2)->y1); \
217
 
   (r)->y2 = MIN((r1)->y2, (r2)->y2); \
218
 
}
219
 
 
220
 
/*
221
 
 *  True iff the two boxes overlap.
222
 
 */
223
 
#define RECT_EXTENTCHECK(r1, r2) \
224
 
   (!( ((r1)->x2 <= (r2)->x1)  || \
225
 
       ((r1)->x1 >= (r2)->x2)  || \
226
 
       ((r1)->y2 <= (r2)->y1)  || \
227
 
       ((r1)->y1 >= (r2)->y2) ) )
228
 
 
229
 
/*
230
 
 * True iff both the BoxRecs are identical.
231
 
 */
232
 
#define RECT_IDENTICAL(r1, r2) \
233
 
   (( ((r1)->x1 == (r2)->x1)  && \
234
 
      ((r1)->x2 == (r2)->x2)  && \
235
 
      ((r1)->y1 == (r2)->y1)  && \
236
 
      ((r1)->y2 == (r2)->y2) ) )
237
 
 
238
 
 
239
 
extern RegionPtr miRegionCreate(BoxPtr rect, int size);
240
 
extern void miRegionInit(RegionPtr pReg, BoxPtr rect, int size);
241
 
extern void miRegionDestroy(RegionPtr pReg);
242
 
extern void miRegionUninit(RegionPtr pReg);
243
 
extern Bool miRegionCopy(RegionPtr dst, RegionPtr src);
244
 
extern Bool miIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
245
 
extern Bool miUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2);
246
 
extern Bool miRegionAppend(RegionPtr dstrgn, RegionPtr rgn);
247
 
extern Bool miRegionValidate(RegionPtr badreg, Bool *pOverlap);
248
 
extern RegionPtr miRectsToRegion(int nrects, xRectanglePtr prect, int ctype);
249
 
extern RegionPtr miRectsToRegionbyBoundary(int nrects, xRectanglePtr prect, int ctype,
250
 
                                           int minValue, int maxValue);
251
 
extern Bool miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS);
252
 
extern Bool miInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect);
253
 
extern int miRectIn(RegionPtr region, BoxPtr prect);
254
 
extern void miTranslateRegion(RegionPtr pReg, int x, int y);
255
 
extern void miTranslateRegionByBoundary(RegionPtr pReg, int x, int y,
256
 
                                        int minValue, int maxValue);
257
 
extern void miRegionReset(RegionPtr pReg, BoxPtr pBox);
258
 
extern Bool miRegionBreak(RegionPtr pReg);
259
 
extern Bool miPointInRegion(RegionPtr pReg, int x, int y, BoxPtr box);
260
 
extern Bool miRegionNotEmpty(RegionPtr pReg);
261
 
extern void miRegionEmpty(RegionPtr pReg);
262
 
extern Bool miRegionsEqual(RegionPtr reg1, RegionPtr reg2);
263
 
extern BoxPtr miRegionExtents(RegionPtr pReg);
264
 
extern int miRegionArea(RegionPtr pReg);
265
 
extern void miRegionPack(RegionPtr pReg, int threshold);
266
 
 
267
 
extern Bool miApplyRect(RegionPtr newReg, RegionPtr reg, BoxPtr rect,
268
 
                        Bool (*op) (RegionPtr, RegionPtr, RegionPtr));
269
 
extern int miPrintRegion(RegionPtr rgn);
270
 
 
271
 
typedef Bool (*miRegionMatchFunc)(BoxPtr box, uintptr_t userData);
272
 
extern Bool miRegionMatch(RegionPtr newReg, RegionPtr reg,
273
 
                          miRegionMatchFunc match, uintptr_t userData);
274
 
 
275
 
// Extension to REGION_NIL that also checks for a 0 x 0 bounding rect.
276
 
extern Bool miIsRegionVoid(RegionPtr pReg);
277
 
 
278
 
#endif /* __REGION_H__ */