PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/include/dixstruct.h

https://gitlab.com/Manizuca/xserver
C Header | 190 lines | 129 code | 30 blank | 31 comment | 4 complexity | 9f076f3a2479956464e5a33b154d70f3 MD5 | raw file
  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  3. All Rights Reserved
  4. Permission to use, copy, modify, and distribute this software and its
  5. documentation for any purpose and without fee is hereby granted,
  6. provided that the above copyright notice appear in all copies and that
  7. both that copyright notice and this permission notice appear in
  8. supporting documentation, and that the name of Digital not be
  9. used in advertising or publicity pertaining to distribution of the
  10. software without specific, written prior permission.
  11. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  12. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  13. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  14. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  15. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  16. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  17. SOFTWARE.
  18. ******************************************************************/
  19. #ifndef DIXSTRUCT_H
  20. #define DIXSTRUCT_H
  21. #include "client.h"
  22. #include "dix.h"
  23. #include "resource.h"
  24. #include "cursor.h"
  25. #include "gc.h"
  26. #include "pixmap.h"
  27. #include "privates.h"
  28. #include <X11/Xmd.h>
  29. /*
  30. * direct-mapped hash table, used by resource manager to store
  31. * translation from client ids to server addresses.
  32. */
  33. extern _X_EXPORT CallbackListPtr ClientStateCallback;
  34. typedef struct {
  35. ClientPtr client;
  36. xConnSetupPrefix *prefix;
  37. xConnSetup *setup;
  38. } NewClientInfoRec;
  39. typedef void (*ReplySwapPtr) (ClientPtr /* pClient */ ,
  40. int /* size */ ,
  41. void * /* pbuf */ );
  42. extern _X_EXPORT void
  43. ReplyNotSwappd(ClientPtr /* pClient */ ,
  44. int /* size */ ,
  45. void * /* pbuf */ ) _X_NORETURN;
  46. typedef enum { ClientStateInitial,
  47. ClientStateRunning,
  48. ClientStateRetained,
  49. ClientStateGone
  50. } ClientState;
  51. typedef struct _saveSet {
  52. struct _Window *windowPtr;
  53. Bool toRoot;
  54. Bool map;
  55. } SaveSetElt;
  56. #define SaveSetWindow(ss) ((ss).windowPtr)
  57. #define SaveSetToRoot(ss) ((ss).toRoot)
  58. #define SaveSetShouldMap(ss) ((ss).map)
  59. #define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w))
  60. #define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr))
  61. #define SaveSetAssignMap(ss,m) ((ss).map = (m))
  62. typedef struct _Client {
  63. void *requestBuffer;
  64. void *osPrivate; /* for OS layer, including scheduler */
  65. Mask clientAsMask;
  66. short index;
  67. unsigned char majorOp, minorOp;
  68. unsigned int swapped:1;
  69. unsigned int local:1;
  70. unsigned int big_requests:1; /* supports large requests */
  71. unsigned int clientGone:1;
  72. unsigned int closeDownMode:2;
  73. unsigned int clientState:2;
  74. signed char smart_priority;
  75. short noClientException; /* this client died or needs to be killed */
  76. int priority;
  77. ReplySwapPtr pSwapReplyFunc;
  78. XID errorValue;
  79. int sequence;
  80. int ignoreCount; /* count for Attend/IgnoreClient */
  81. int numSaved;
  82. SaveSetElt *saveSet;
  83. int (**requestVector) (ClientPtr /* pClient */ );
  84. CARD32 req_len; /* length of current request */
  85. unsigned int replyBytesRemaining;
  86. PrivateRec *devPrivates;
  87. unsigned short xkbClientFlags;
  88. unsigned short mapNotifyMask;
  89. unsigned short newKeyboardNotifyMask;
  90. unsigned short vMajor, vMinor;
  91. KeyCode minKC, maxKC;
  92. int smart_start_tick;
  93. int smart_stop_tick;
  94. DeviceIntPtr clientPtr;
  95. ClientIdPtr clientIds;
  96. #if XTRANS_SEND_FDS
  97. int req_fds;
  98. #endif
  99. } ClientRec;
  100. #if XTRANS_SEND_FDS
  101. static inline void
  102. SetReqFds(ClientPtr client, int req_fds) {
  103. if (client->req_fds != 0 && req_fds != client->req_fds)
  104. LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds);
  105. client->req_fds = req_fds;
  106. }
  107. #endif
  108. /*
  109. * Scheduling interface
  110. */
  111. extern long SmartScheduleTime;
  112. extern long SmartScheduleInterval;
  113. extern long SmartScheduleSlice;
  114. extern long SmartScheduleMaxSlice;
  115. extern Bool SmartScheduleDisable;
  116. extern void SmartScheduleStartTimer(void);
  117. extern void SmartScheduleStopTimer(void);
  118. #define SMART_MAX_PRIORITY (20)
  119. #define SMART_MIN_PRIORITY (-20)
  120. extern void SmartScheduleInit(void);
  121. /* This prototype is used pervasively in Xext, dix */
  122. #define DISPATCH_PROC(func) int func(ClientPtr /* client */)
  123. typedef struct _WorkQueue {
  124. struct _WorkQueue *next;
  125. Bool (*function) (ClientPtr /* pClient */ ,
  126. void * /* closure */
  127. );
  128. ClientPtr client;
  129. void *closure;
  130. } WorkQueueRec;
  131. extern _X_EXPORT TimeStamp currentTime;
  132. extern _X_EXPORT int
  133. CompareTimeStamps(TimeStamp /*a */ ,
  134. TimeStamp /*b */ );
  135. extern _X_EXPORT TimeStamp
  136. ClientTimeToServerTime(CARD32 /*c */ );
  137. typedef struct _CallbackRec {
  138. CallbackProcPtr proc;
  139. void *data;
  140. Bool deleted;
  141. struct _CallbackRec *next;
  142. } CallbackRec, *CallbackPtr;
  143. typedef struct _CallbackList {
  144. int inCallback;
  145. Bool deleted;
  146. int numDeleted;
  147. CallbackPtr list;
  148. } CallbackListRec;
  149. /* proc vectors */
  150. extern int (*InitialVector[3]) (ClientPtr /*client */ );
  151. extern _X_EXPORT int (*ProcVector[256]) (ClientPtr /*client */ );
  152. extern _X_EXPORT int (*SwappedProcVector[256]) (ClientPtr /*client */ );
  153. extern ReplySwapPtr ReplySwapVector[256];
  154. extern _X_EXPORT int
  155. ProcBadRequest(ClientPtr /*client */ );
  156. #endif /* DIXSTRUCT_H */