home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xt / SelectionI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-21  |  4.1 KB  |  135 lines

  1. /* $XConsortium: SelectionI.h,v 1.34 93/01/26 16:25:31 converse Exp $ */
  2.  
  3. /***********************************************************
  4. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  5. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  6.  
  7.                         All Rights Reserved
  8.  
  9. Permission to use, copy, modify, and distribute this software and its 
  10. documentation for any purpose and without fee is hereby granted, 
  11. provided that the above copyright notice appear in all copies and that
  12. both that copyright notice and this permission notice appear in 
  13. supporting documentation, and that the names of Digital or MIT not be
  14. used in advertising or publicity pertaining to distribution of the
  15. software without specific, written prior permission.  
  16.  
  17. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  19. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23. SOFTWARE.
  24.  
  25. ******************************************************************/
  26.  
  27. #ifndef _XtselectionI_h
  28. #define _XtselectionI_h
  29.  
  30. #include "Intrinsic.h"
  31.  
  32. typedef struct _RequestRec *Request;
  33. typedef struct _SelectRec *Select;
  34.  
  35. typedef struct _RequestRec {
  36.    Select ctx;              /* logical owner */
  37.    Widget widget;          /* widget actually receiving Selection events */
  38.    Window requestor;
  39.    Atom property;
  40.    Atom target;
  41.    Atom type;
  42.    int format;
  43.    XtPointer value;
  44.    unsigned long bytelength;
  45.    int offset;
  46.    XtIntervalId timeout;
  47.    XSelectionRequestEvent event; /* for XtGetSelectionRequest */
  48.    Boolean allSent;
  49. } RequestRec;
  50.  
  51. typedef struct {
  52.   Atom prop;
  53.   Boolean avail;
  54. } SelectionPropRec, *SelectionProp;
  55.  
  56. typedef struct {
  57.   Display *dpy;
  58.   Atom incr_atom, indirect_atom, timestamp_atom;
  59. #ifdef DRAFT_ICCCM_COMPATIBILITY
  60.   Atom incremental_atom;    /* X11R2 ICCCM Draft 25 February 1988 */
  61. #endif
  62.   int propCount;
  63.   SelectionProp list;
  64. } PropListRec, *PropList;
  65.  
  66. typedef struct _SelectRec {
  67.     Atom selection;             /* constant */
  68.     Display *dpy;             /* constant */
  69.     Widget widget;
  70.     Time time;
  71.     unsigned long serial;
  72.     XtConvertSelectionProc convert;
  73.     XtLoseSelectionProc loses;
  74.     XtSelectionDoneProc notify;
  75.     XtCancelConvertSelectionProc owner_cancel;
  76.     XtPointer owner_closure;
  77.     PropList prop_list;
  78.     Request req;            /* state for local non-incr xfer */
  79.     int ref_count;            /* of active transfers */
  80.     unsigned int incremental:1;
  81.     unsigned int free_when_done:1;
  82.     unsigned int was_disowned:1;
  83. } SelectRec;
  84.  
  85. typedef struct {
  86.     XtSelectionCallbackProc callback;
  87.     XtPointer *req_closure;
  88.     Atom property;
  89.     Atom *target;
  90.     Atom type;
  91.     int format;
  92.     char *value;
  93.     int bytelength;
  94.     int offset;
  95.     XtIntervalId timeout;
  96.     XtEventHandler proc;
  97.     Widget widget;
  98.     Time time;
  99.     Select ctx;
  100.     Boolean incremental;
  101. } CallBackInfoRec, *CallBackInfo;
  102.  
  103. typedef struct {
  104.   Atom target;
  105.   Atom property;
  106. } IndirectPair;
  107.  
  108. #define IndirectPairWordSize 2
  109.  
  110. typedef struct {
  111.   int active_transfer_count;
  112. } RequestWindowRec;
  113.  
  114. #define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \
  115.     (65536 << 2)  : (XMaxRequestSize(dpy) << 2))-100)
  116.  
  117. #ifdef DRAFT_ICCCM_COMPATIBILITY
  118. #define MATCH_SELECT(event, info) ((event->time == info->time) && \
  119.         (event->requestor == XtWindow(info->widget)) && \
  120.         (event->selection == info->ctx->selection) && \
  121.         ((event->target == *info->target) || \
  122.          ((event->target == info->ctx->prop_list->incr_atom) && \
  123.           (event->property == info->property)) || \
  124.          ((event->target == info->ctx->prop_list->incremental_atom) && \
  125.           (event->property == info->property))))
  126. #else
  127. #define MATCH_SELECT(event, info) ((event->time == info->time) && \
  128.         (event->requestor == XtWindow(info->widget)) && \
  129.         (event->selection == info->ctx->selection) && \
  130.         (event->target == *info->target))
  131. #endif
  132.  
  133. #endif /* _XtselectionI_h */
  134. /* DON'T ADD STUFF AFTER THIS #endif */
  135.