Home | History | Annotate | Download | only in extensions
      1 /*
      2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
      3  * Copyright 2011 Red Hat, Inc.
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a
      6  * copy of this software and associated documentation files (the "Software"),
      7  * to deal in the Software without restriction, including without limitation
      8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      9  * and/or sell copies of the Software, and to permit persons to whom the
     10  * Software is furnished to do so, subject to the following conditions:
     11  *
     12  * The above copyright notice and this permission notice (including the next
     13  * paragraph) shall be included in all copies or substantial portions of the
     14  * Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     22  * DEALINGS IN THE SOFTWARE.
     23  */
     24 /*
     25  * Copyright  2002 Keith Packard, member of The XFree86 Project, Inc.
     26  *
     27  * Permission to use, copy, modify, distribute, and sell this software and its
     28  * documentation for any purpose is hereby granted without fee, provided that
     29  * the above copyright notice appear in all copies and that both that
     30  * copyright notice and this permission notice appear in supporting
     31  * documentation, and that the name of Keith Packard not be used in
     32  * advertising or publicity pertaining to distribution of the software without
     33  * specific, written prior permission.  Keith Packard makes no
     34  * representations about the suitability of this software for any purpose.  It
     35  * is provided "as is" without express or implied warranty.
     36  *
     37  * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     38  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
     39  * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
     40  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
     41  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
     42  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
     43  * PERFORMANCE OF THIS SOFTWARE.
     44  */
     45 
     46 #ifndef _XFIXES_H_
     47 #define _XFIXES_H_
     48 
     49 #include <X11/extensions/xfixeswire.h>
     50 
     51 #include <X11/Xfuncproto.h>
     52 #include <X11/Xlib.h>
     53 
     54 /*
     55  * This revision number also appears in configure.ac, they have
     56  * to be manually synchronized
     57  */
     58 #define XFIXES_REVISION	1
     59 #define XFIXES_VERSION	((XFIXES_MAJOR * 10000) + (XFIXES_MINOR * 100) + (XFIXES_REVISION))
     60 
     61 typedef struct {
     62     int type;			/* event base */
     63     unsigned long serial;
     64     Bool send_event;
     65     Display *display;
     66     Window window;
     67     int subtype;
     68     Window owner;
     69     Atom selection;
     70     Time timestamp;
     71     Time selection_timestamp;
     72 } XFixesSelectionNotifyEvent;
     73 
     74 typedef struct {
     75     int type;			/* event base */
     76     unsigned long serial;
     77     Bool send_event;
     78     Display *display;
     79     Window window;
     80     int subtype;
     81     unsigned long cursor_serial;
     82     Time timestamp;
     83     Atom cursor_name;
     84 } XFixesCursorNotifyEvent;
     85 
     86 typedef struct {
     87     short	    x, y;
     88     unsigned short  width, height;
     89     unsigned short  xhot, yhot;
     90     unsigned long   cursor_serial;
     91     unsigned long   *pixels;
     92 #if XFIXES_MAJOR >= 2
     93     Atom	    atom;		    /* Version >= 2 only */
     94     const char	    *name;		    /* Version >= 2 only */
     95 #endif
     96 } XFixesCursorImage;
     97 
     98 #if XFIXES_MAJOR >= 2
     99 /* Version 2 types */
    100 
    101 typedef XID XserverRegion;
    102 
    103 typedef struct {
    104     short	    x, y;
    105     unsigned short  width, height;
    106     unsigned short  xhot, yhot;
    107     unsigned long   cursor_serial;
    108     unsigned long   *pixels;
    109     Atom	    atom;
    110     const char	    *name;
    111 } XFixesCursorImageAndName;
    112 
    113 #endif
    114 
    115 _XFUNCPROTOBEGIN
    116 
    117 Bool XFixesQueryExtension (Display *dpy,
    118 			    int *event_base_return,
    119 			    int *error_base_return);
    120 Status XFixesQueryVersion (Display *dpy,
    121 			    int     *major_version_return,
    122 			    int     *minor_version_return);
    123 
    124 int XFixesVersion (void);
    125 
    126 void
    127 XFixesChangeSaveSet (Display	*dpy,
    128 		     Window	win,
    129 		     int	mode,
    130 		     int	target,
    131 		     int	map);
    132 
    133 void
    134 XFixesSelectSelectionInput (Display	    *dpy,
    135 			    Window	    win,
    136 			    Atom	    selection,
    137 			    unsigned long   eventMask);
    138 
    139 void
    140 XFixesSelectCursorInput (Display	*dpy,
    141 			 Window		win,
    142 			 unsigned long	eventMask);
    143 
    144 XFixesCursorImage *
    145 XFixesGetCursorImage (Display *dpy);
    146 
    147 #if XFIXES_MAJOR >= 2
    148 /* Version 2 functions */
    149 
    150 XserverRegion
    151 XFixesCreateRegion (Display *dpy, XRectangle *rectangles, int nrectangles);
    152 
    153 XserverRegion
    154 XFixesCreateRegionFromBitmap (Display *dpy, Pixmap bitmap);
    155 
    156 XserverRegion
    157 XFixesCreateRegionFromWindow (Display *dpy, Window window, int kind);
    158 
    159 XserverRegion
    160 XFixesCreateRegionFromGC (Display *dpy, GC gc);
    161 
    162 XserverRegion
    163 XFixesCreateRegionFromPicture (Display *dpy, XID picture);
    164 
    165 void
    166 XFixesDestroyRegion (Display *dpy, XserverRegion region);
    167 
    168 void
    169 XFixesSetRegion (Display *dpy, XserverRegion region,
    170 		 XRectangle *rectangles, int nrectangles);
    171 
    172 void
    173 XFixesCopyRegion (Display *dpy, XserverRegion dst, XserverRegion src);
    174 
    175 void
    176 XFixesUnionRegion (Display *dpy, XserverRegion dst,
    177 		   XserverRegion src1, XserverRegion src2);
    178 
    179 void
    180 XFixesIntersectRegion (Display *dpy, XserverRegion dst,
    181 		       XserverRegion src1, XserverRegion src2);
    182 
    183 void
    184 XFixesSubtractRegion (Display *dpy, XserverRegion dst,
    185 		      XserverRegion src1, XserverRegion src2);
    186 
    187 void
    188 XFixesInvertRegion (Display *dpy, XserverRegion dst,
    189 		    XRectangle *rect, XserverRegion src);
    190 
    191 void
    192 XFixesTranslateRegion (Display *dpy, XserverRegion region, int dx, int dy);
    193 
    194 void
    195 XFixesRegionExtents (Display *dpy, XserverRegion dst, XserverRegion src);
    196 
    197 XRectangle *
    198 XFixesFetchRegion (Display *dpy, XserverRegion region, int *nrectanglesRet);
    199 
    200 XRectangle *
    201 XFixesFetchRegionAndBounds (Display *dpy, XserverRegion region,
    202 			    int *nrectanglesRet,
    203 			    XRectangle *bounds);
    204 
    205 void
    206 XFixesSetGCClipRegion (Display *dpy, GC gc,
    207 		       int clip_x_origin, int clip_y_origin,
    208 		       XserverRegion region);
    209 
    210 void
    211 XFixesSetWindowShapeRegion (Display *dpy, Window win, int shape_kind,
    212 			    int x_off, int y_off, XserverRegion region);
    213 
    214 void
    215 XFixesSetPictureClipRegion (Display *dpy, XID picture,
    216 			    int clip_x_origin, int clip_y_origin,
    217 			    XserverRegion region);
    218 
    219 void
    220 XFixesSetCursorName (Display *dpy, Cursor cursor, const char *name);
    221 
    222 const char *
    223 XFixesGetCursorName (Display *dpy, Cursor cursor, Atom *atom);
    224 
    225 void
    226 XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination);
    227 
    228 void
    229 XFixesChangeCursorByName (Display *dpy, Cursor source, const char *name);
    230 
    231 #endif	/* XFIXES_MAJOR >= 2 */
    232 
    233 #if XFIXES_MAJOR >= 3
    234 
    235 void
    236 XFixesExpandRegion (Display *dpy, XserverRegion dst, XserverRegion src,
    237 		    unsigned left, unsigned right,
    238 		    unsigned top, unsigned bottom);
    239 
    240 #endif	/* XFIXES_MAJOR >= 3 */
    241 
    242 #if XFIXES_MAJOR >= 4
    243 /* Version 4.0 externs */
    244 
    245 void
    246 XFixesHideCursor (Display *dpy, Window win);
    247 
    248 void
    249 XFixesShowCursor (Display *dpy, Window win);
    250 
    251 #endif /* XFIXES_MAJOR >= 4 */
    252 
    253 #if XFIXES_MAJOR >= 5
    254 
    255 typedef XID PointerBarrier;
    256 
    257 PointerBarrier
    258 XFixesCreatePointerBarrier(Display *dpy, Window w, int x1, int y1,
    259 			   int x2, int y2, int directions,
    260 			   int num_devices, int *devices);
    261 
    262 PointerBarrier
    263 XFixesCreatePointerBarrierVelocity(Display *dpy, Window w, int x1, int y1,
    264 			   int x2, int y2, int directions, int velocity,
    265 			   int num_devices, int *devices);
    266 
    267 void
    268 XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b);
    269 
    270 #endif /* XFIXES_MAJOR >= 5 */
    271 
    272 #if XFIXES_MAJOR >= 6
    273 
    274 typedef int32_t BarrierEventID;
    275 
    276 typedef struct {
    277     int type;			/* event base */
    278     unsigned long serial;
    279     Bool send_event;
    280     Display *display;
    281     Window window;
    282     int subtype;
    283     BarrierEventID event_id;
    284     int directions;
    285     PointerBarrier barrier;
    286     int x;
    287     int y;
    288     int velocity;
    289     Time timestamp;
    290 } XFixesBarrierNotifyEvent;
    291 
    292 void
    293 XFixesSelectBarrierInput (Display	*dpy,
    294 			 Window		win,
    295 			 unsigned long	eventMask);
    296 
    297 void
    298 XFixesBarrierReleasePointer(Display *dpy,
    299 			    PointerBarrier b,
    300 			    BarrierEventID event_id);
    301 
    302 #endif
    303 
    304 _XFUNCPROTOEND
    305 
    306 #endif /* _XFIXES_H_ */
    307