You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vncModule.c 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2015 Pierre Ossman for Cendio AB
  3. *
  4. * This is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This software is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this software; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  17. * USA.
  18. */
  19. /* This is the xf86 module code for the vnc extension.
  20. */
  21. #ifdef HAVE_DIX_CONFIG_H
  22. #include <dix-config.h>
  23. #endif
  24. #include "opaque.h"
  25. #include "randrstr.h"
  26. #include "xorg-version.h"
  27. #if XORG <= 111
  28. typedef pointer XF86OptionPtr;
  29. #endif
  30. #include "xf86.h"
  31. #include "xf86Module.h"
  32. #include "vncExtInit.h"
  33. #include "RFBGlue.h"
  34. #include "XorgGlue.h"
  35. #include "RandrGlue.h"
  36. static void vncModuleInit(INITARGS);
  37. static MODULESETUPPROTO(vncSetup);
  38. ExtensionModule vncExt =
  39. {
  40. vncModuleInit,
  41. "VNC",
  42. #if XORG < 112
  43. NULL,
  44. NULL,
  45. #endif
  46. NULL
  47. };
  48. static XF86ModuleVersionInfo vncVersRec =
  49. {
  50. "vnc",
  51. "TigerVNC Project",
  52. MODINFOSTRING1,
  53. MODINFOSTRING2,
  54. XORG_VERSION_CURRENT,
  55. 1, 0, 0,
  56. ABI_CLASS_EXTENSION, /* needs the server extension ABI */
  57. ABI_EXTENSION_VERSION,
  58. MOD_CLASS_EXTENSION,
  59. {0,0,0,0}
  60. };
  61. _X_EXPORT XF86ModuleData vncModuleData = { &vncVersRec, vncSetup, NULL };
  62. static void *
  63. vncSetup(void * module, void * opts, int *errmaj, int *errmin) {
  64. #if XORG >= 116
  65. LoadExtensionList(&vncExt, 1, FALSE);
  66. #else
  67. LoadExtension(&vncExt, FALSE);
  68. #endif
  69. /* Need a non-NULL return value to indicate success */
  70. return (void *)1;
  71. }
  72. static void vncModuleInit(INITARGS)
  73. {
  74. static char once = 0;
  75. if (!once) {
  76. once++;
  77. vncInitRFB();
  78. for (int scr = 0; scr < screenInfo.numScreens; scr++) {
  79. ScrnInfoPtr pScrn;
  80. XF86OptionPtr option;
  81. pScrn = xf86Screens[scr];
  82. option = pScrn->options;
  83. while (option != NULL) {
  84. vncSetParam(xf86OptionName(option), xf86OptionValue(option));
  85. option = xf86NextOption(option);
  86. }
  87. }
  88. }
  89. vncExtensionInit();
  90. }
  91. void vncClientGone(int fd)
  92. {
  93. }
  94. int vncRandRCanCreateScreenOutputs(int scrIdx, int extraOutputs)
  95. {
  96. return 0;
  97. }
  98. int vncRandRCreateScreenOutputs(int scrIdx, int extraOutputs)
  99. {
  100. return 0;
  101. }
  102. int vncRandRCanCreateModes(void)
  103. {
  104. return 0;
  105. }
  106. void* vncRandRCreateMode(void* output, int width, int height)
  107. {
  108. return 0;
  109. }
  110. void* vncRandRSetPreferredMode(void* output, void* mode)
  111. {
  112. /*
  113. * We're not going to change which modes are preferred,
  114. * so just return the incoming mode.
  115. */
  116. return mode;
  117. }