miinitext.c 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /***********************************************************
  2. Copyright 1987, 1998 The Open Group
  3. Permission to use, copy, modify, distribute, and sell this software and its
  4. documentation for any purpose is hereby granted without fee, provided that
  5. the above copyright notice appear in all copies and that both that
  6. copyright notice and this permission notice appear in supporting
  7. documentation.
  8. The above copyright notice and this permission notice shall be included in
  9. all copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  14. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  16. Except as contained in this notice, the name of The Open Group shall not be
  17. used in advertising or otherwise to promote the sale, use or other dealings
  18. in this Software without prior written authorization from The Open Group.
  19. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  20. All Rights Reserved
  21. Permission to use, copy, modify, and distribute this software and its
  22. documentation for any purpose and without fee is hereby granted,
  23. provided that the above copyright notice appear in all copies and that
  24. both that copyright notice and this permission notice appear in
  25. supporting documentation, and that the name of Digital not be
  26. used in advertising or publicity pertaining to distribution of the
  27. software without specific, written prior permission.
  28. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  29. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  30. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  31. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  32. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  33. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  34. SOFTWARE.
  35. ******************************************************************/
  36. #ifdef HAVE_DIX_CONFIG_H
  37. #include <dix-config.h>
  38. #endif
  39. #ifdef HAVE_KDRIVE_CONFIG_H
  40. #include <kdrive-config.h>
  41. #endif
  42. #include "misc.h"
  43. #include "extension.h"
  44. #include "micmap.h"
  45. #include "globals.h"
  46. extern Bool noTestExtensions;
  47. extern Bool noBigReqExtension;
  48. #ifdef DBE
  49. extern Bool noDbeExtension;
  50. #endif
  51. #ifdef DPMSExtension
  52. extern Bool noDPMSExtension;
  53. #endif
  54. #ifdef SCREENSAVER
  55. extern Bool noScreenSaverExtension;
  56. #endif
  57. extern Bool noMITShmExtension;
  58. extern Bool noRRExtension;
  59. extern Bool noRenderExtension;
  60. extern Bool noShapeExtension;
  61. extern Bool noSyncExtension;
  62. #ifdef RES
  63. extern Bool noResExtension;
  64. #endif
  65. extern Bool noXCMiscExtension;
  66. #ifdef XF86BIGFONT
  67. extern Bool noXFree86BigfontExtension;
  68. #endif
  69. extern Bool noXFixesExtension;
  70. #define INITARGS void
  71. typedef void (*InitExtension)(INITARGS);
  72. #define _XSHM_SERVER_
  73. #include <X11/extensions/shmstr.h>
  74. #define _XTEST_SERVER_
  75. #include <X11/extensions/XTest.h>
  76. #ifdef XF86BIGFONT
  77. #include <X11/extensions/xf86bigfproto.h>
  78. #endif
  79. #ifdef RES
  80. #include <X11/extensions/XResproto.h>
  81. #endif
  82. /* FIXME: this whole block of externs should be from the appropriate headers */
  83. extern void ShmExtensionInit(INITARGS);
  84. extern void XTestExtensionInit(INITARGS);
  85. extern void BigReqExtensionInit(INITARGS);
  86. #ifdef SCREENSAVER
  87. extern void ScreenSaverExtensionInit (INITARGS);
  88. #endif
  89. extern void SyncExtensionInit(INITARGS);
  90. extern void XCMiscExtensionInit(INITARGS);
  91. #ifdef DBE
  92. extern void DbeExtensionInit(INITARGS);
  93. #endif
  94. #ifdef XF86BIGFONT
  95. extern void XFree86BigfontExtensionInit(INITARGS);
  96. #endif
  97. #ifdef DPMSExtension
  98. extern void DPMSExtensionInit(INITARGS);
  99. #endif
  100. extern void RenderExtensionInit(INITARGS);
  101. extern void RRExtensionInit(INITARGS);
  102. #ifdef RES
  103. extern void ResExtensionInit(INITARGS);
  104. #endif
  105. extern void XFixesExtensionInit(INITARGS);
  106. extern void DamageExtensionInit(INITARGS);
  107. /* The following is only a small first step towards run-time
  108. * configurable extensions.
  109. */
  110. typedef struct {
  111. char *name;
  112. Bool *disablePtr;
  113. } ExtensionToggle;
  114. static const ExtensionToggle ExtensionToggleList[] =
  115. {
  116. /* sort order is extension name string as shown in xdpyinfo */
  117. { "BIG-REQUESTS", &noBigReqExtension },
  118. { "DAMAGE", &noDamageExtension },
  119. #ifdef DBE
  120. { "DOUBLE-BUFFER", &noDbeExtension },
  121. #endif
  122. #ifdef DPMSExtension
  123. { "DPMS", &noDPMSExtension },
  124. #endif
  125. #ifdef SCREENSAVER
  126. { "MIT-SCREEN-SAVER", &noScreenSaverExtension },
  127. #endif
  128. { SHMNAME, &noMITShmExtension },
  129. { "RANDR", &noRRExtension },
  130. { "RENDER", &noRenderExtension },
  131. { "SHAPE", &noShapeExtension },
  132. { "SYNC", &noSyncExtension },
  133. #ifdef RES
  134. { "X-Resource", &noResExtension },
  135. #endif
  136. { "XC-MISC", &noXCMiscExtension },
  137. #ifdef XF86BIGFONT
  138. { "XFree86-Bigfont", &noXFree86BigfontExtension },
  139. #endif
  140. { "XFIXES", &noXFixesExtension },
  141. { "XTEST", &noTestExtensions },
  142. { NULL, NULL }
  143. };
  144. Bool EnableDisableExtension(char *name, Bool enable)
  145. {
  146. const ExtensionToggle *ext = &ExtensionToggleList[0];
  147. for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) {
  148. if (strcmp(name, ext->name) == 0) {
  149. *ext->disablePtr = !enable;
  150. return TRUE;
  151. }
  152. }
  153. return FALSE;
  154. }
  155. void EnableDisableExtensionError(char *name, Bool enable)
  156. {
  157. const ExtensionToggle *ext = &ExtensionToggleList[0];
  158. ErrorF("Extension \"%s\" is not recognized\n", name);
  159. ErrorF("Only the following extensions can be run-time %s:\n",
  160. enable ? "enabled" : "disabled");
  161. for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++)
  162. ErrorF(" %s\n", ext->name);
  163. }
  164. /*ARGSUSED*/
  165. void
  166. InitExtensions(argc, argv)
  167. int argc;
  168. char *argv[];
  169. {
  170. if (!noShapeExtension) ShapeExtensionInit();
  171. if (!noMITShmExtension) ShmExtensionInit();
  172. if (!noTestExtensions) XTestExtensionInit();
  173. if (!noBigReqExtension) BigReqExtensionInit();
  174. #if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER)
  175. if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
  176. #endif
  177. if (!noSyncExtension) SyncExtensionInit();
  178. if (!noXCMiscExtension) XCMiscExtensionInit();
  179. #ifdef DBE
  180. if (!noDbeExtension) DbeExtensionInit();
  181. #endif
  182. #if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
  183. if (!noDPMSExtension) DPMSExtensionInit();
  184. #endif
  185. #ifdef XF86BIGFONT
  186. if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
  187. #endif
  188. #if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
  189. #endif
  190. /* must be before Render to layer DisplayCursor correctly */
  191. if (!noXFixesExtension) XFixesExtensionInit();
  192. if (!noRenderExtension) RenderExtensionInit();
  193. if (!noRRExtension) RRExtensionInit();
  194. #ifdef RES
  195. if (!noResExtension) ResExtensionInit();
  196. #endif
  197. if (!noDamageExtension) DamageExtensionInit();
  198. }
  199. void
  200. InitVisualWrap()
  201. {
  202. miResetInitVisuals();
  203. }