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.

xf86vncModule.cc 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. /* This is the xf86 module code for the vnc extension.
  19. */
  20. #include <rfb/Configuration.h>
  21. #include <rfb/Logger_stdio.h>
  22. #include <rfb/LogWriter.h>
  23. extern "C" {
  24. #define class c_class
  25. #define private c_private
  26. #define bool c_bool
  27. #define new c_new
  28. #include "xf86.h"
  29. #include "xf86Module.h"
  30. #undef class
  31. #undef private
  32. #undef bool
  33. #undef new
  34. using namespace rfb;
  35. extern void vncExtensionInit();
  36. static void vncExtensionInitWithParams(INITARGS);
  37. #ifdef XFree86LOADER
  38. static MODULESETUPPROTO(vncSetup);
  39. ExtensionModule vncExt =
  40. {
  41. vncExtensionInitWithParams,
  42. "VNC",
  43. NULL,
  44. NULL,
  45. NULL
  46. };
  47. static XF86ModuleVersionInfo vncVersRec =
  48. {
  49. "vnc",
  50. "Constantin Kaplinsky",
  51. MODINFOSTRING1,
  52. MODINFOSTRING2,
  53. XF86_VERSION_CURRENT,
  54. 1, 0, 0,
  55. ABI_CLASS_EXTENSION, /* needs the server extension ABI */
  56. ABI_EXTENSION_VERSION,
  57. MOD_CLASS_EXTENSION,
  58. {0,0,0,0}
  59. };
  60. XF86ModuleData vncModuleData = { &vncVersRec, vncSetup, NULL };
  61. static pointer
  62. vncSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
  63. LoadExtension(&vncExt, FALSE);
  64. /* Need a non-NULL return value to indicate success */
  65. return (pointer)1;
  66. }
  67. static void vncExtensionInitWithParams(INITARGS)
  68. {
  69. rfb::initStdIOLoggers();
  70. rfb::LogWriter::setLogParams("*:stderr:30");
  71. for (int scr = 0; scr < screenInfo.numScreens; scr++) {
  72. ScrnInfoPtr pScrn = xf86Screens[scr];
  73. for (ParameterIterator i(Configuration::global()); i.param; i.next()) {
  74. char* val = xf86FindOptionValue(pScrn->options, i.param->getName());
  75. if (val)
  76. i.param->setParam(val);
  77. }
  78. }
  79. vncExtensionInit();
  80. }
  81. #endif /* XFree86LOADER */
  82. }