Home | History | Annotate | Line # | Download | only in X11
      1 /***********************************************************
      2 
      3 Copyright 1987, 1988, 1994, 1998  The Open Group
      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.
     10 
     11 The above copyright notice and this permission notice shall be included in
     12 all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     20 
     21 Except as contained in this notice, the name of The Open Group shall not be
     22 used in advertising or otherwise to promote the sale, use or other dealings
     23 in this Software without prior written authorization from The Open Group.
     24 
     25 
     26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
     27 
     28                         All Rights Reserved
     29 
     30 Permission to use, copy, modify, and distribute this software and its
     31 documentation for any purpose and without fee is hereby granted,
     32 provided that the above copyright notice appear in all copies and that
     33 both that copyright notice and this permission notice appear in
     34 supporting documentation, and that the name of Digital not be
     35 used in advertising or publicity pertaining to distribution of the
     36 software without specific, written prior permission.
     37 
     38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     44 SOFTWARE.
     45 
     46 ******************************************************************/
     47 
     48 #ifndef _XtselectionI_h
     49 #define _XtselectionI_h
     50 
     51 #include "Intrinsic.h"
     52 
     53 typedef struct _RequestRec *Request;
     54 typedef struct _SelectRec *Select;
     55 
     56 typedef struct _RequestRec {
     57    Select ctx;		      /* logical owner */
     58    Widget widget;	      /* widget actually receiving Selection events */
     59    Window requestor;
     60    Atom property;
     61    Atom target;
     62    Atom type;
     63    int format;
     64    XtPointer value;
     65    unsigned long bytelength;
     66    unsigned long offset;
     67    XtIntervalId timeout;
     68    XSelectionRequestEvent event; /* for XtGetSelectionRequest */
     69    Boolean allSent;
     70 } RequestRec;
     71 
     72 typedef struct {
     73   Atom prop;
     74   Boolean avail;
     75 } SelectionPropRec, *SelectionProp;
     76 
     77 typedef struct {
     78   Display *dpy;
     79   Atom incr_atom, indirect_atom, timestamp_atom;
     80   int propCount;
     81   SelectionProp list;
     82 } PropListRec, *PropList;
     83 
     84 typedef struct _SelectRec {
     85     Atom selection; 			/* constant */
     86     Display *dpy; 			/* constant */
     87     Widget widget;
     88     Time time;
     89     unsigned long serial;
     90     XtConvertSelectionProc convert;
     91     XtLoseSelectionProc loses;
     92     XtSelectionDoneProc notify;
     93     XtCancelConvertSelectionProc owner_cancel;
     94     XtPointer owner_closure;
     95     PropList prop_list;
     96     Request req;			/* state for local non-incr xfer */
     97     int ref_count;			/* of active transfers */
     98     unsigned int incremental:1;
     99     unsigned int free_when_done:1;
    100     unsigned int was_disowned:1;
    101 } SelectRec;
    102 
    103 typedef struct _ParamRec {
    104     Atom selection;
    105     Atom param;
    106 } ParamRec, *Param;
    107 
    108 typedef struct _ParamInfoRec {
    109     unsigned int count;
    110     Param paramlist;
    111 } ParamInfoRec, *ParamInfo;
    112 
    113 typedef struct _QueuedRequestRec {
    114     Atom selection;
    115     Atom target;
    116     Atom param;
    117     XtSelectionCallbackProc callback;
    118     XtPointer closure;
    119     Time time;
    120     Boolean incremental;
    121 } QueuedRequestRec, *QueuedRequest;
    122 
    123 typedef struct _QueuedRequestInfoRec {
    124     int count;
    125     Atom *selections;
    126     QueuedRequest *requests;
    127 } QueuedRequestInfoRec, *QueuedRequestInfo;
    128 
    129 typedef struct {
    130     XtSelectionCallbackProc *callbacks;
    131     XtPointer *req_closure;
    132     Atom property;
    133     Atom *target;
    134     Atom type;
    135     int format;
    136     char *value;
    137     int bytelength;
    138     int offset;
    139     XtIntervalId timeout;
    140     XtEventHandler proc;
    141     Widget widget;
    142     Time time;
    143     Select ctx;
    144     Boolean *incremental;
    145     int current;
    146 } CallBackInfoRec, *CallBackInfo;
    147 
    148 typedef struct {
    149   Atom target;
    150   Atom property;
    151 } IndirectPair;
    152 
    153 #define IndirectPairWordSize 2
    154 
    155 typedef struct {
    156   int active_transfer_count;
    157 } RequestWindowRec;
    158 
    159 #define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \
    160 	(65536 << 2)  : (XMaxRequestSize(dpy) << 2))-100)
    161 
    162 #define MATCH_SELECT(event, info) ((event->time == info->time) && \
    163 	    (event->requestor == XtWindow(info->widget)) && \
    164 	    (event->selection == info->ctx->selection) && \
    165 	    (event->target == *info->target))
    166 
    167 #endif /* _XtselectionI_h */
    168 /* DON'T ADD STUFF AFTER THIS #endif */
    169