Constantin Kaplinsky | 47ed8d3 | 2004-10-08 09:43:57 +0000 | [diff] [blame] | 1 | /* Copyright (C) 2002-2003 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 | |
| 21 | #include <rfb/Configuration.h> |
| 22 | #include <rfb/Logger_stdio.h> |
| 23 | #include <rfb/LogWriter.h> |
| 24 | |
| 25 | extern "C" { |
| 26 | #define class c_class |
| 27 | #define private c_private |
| 28 | #define bool c_bool |
| 29 | #define new c_new |
| 30 | #include "xf86.h" |
| 31 | #include "xf86Module.h" |
| 32 | #undef class |
| 33 | #undef private |
| 34 | #undef bool |
| 35 | #undef new |
| 36 | |
| 37 | extern void vncExtensionInit(); |
| 38 | static void vncExtensionInitWithParams(INITARGS); |
| 39 | |
| 40 | #ifdef XFree86LOADER |
| 41 | |
| 42 | static MODULESETUPPROTO(vncSetup); |
| 43 | |
| 44 | ExtensionModule vncExt = |
| 45 | { |
| 46 | vncExtensionInitWithParams, |
| 47 | "VNC", |
| 48 | NULL, |
| 49 | NULL, |
| 50 | NULL |
| 51 | }; |
| 52 | |
| 53 | static XF86ModuleVersionInfo vncVersRec = |
| 54 | { |
| 55 | "vnc", |
Peter Åstrand | 9fb4e0e | 2004-12-30 10:03:00 +0000 | [diff] [blame^] | 56 | "Constantin Kaplinsky", |
Constantin Kaplinsky | 47ed8d3 | 2004-10-08 09:43:57 +0000 | [diff] [blame] | 57 | MODINFOSTRING1, |
| 58 | MODINFOSTRING2, |
| 59 | XF86_VERSION_CURRENT, |
| 60 | 1, 0, 0, |
| 61 | ABI_CLASS_EXTENSION, /* needs the server extension ABI */ |
| 62 | ABI_EXTENSION_VERSION, |
| 63 | MOD_CLASS_EXTENSION, |
| 64 | {0,0,0,0} |
| 65 | }; |
| 66 | |
| 67 | XF86ModuleData vncModuleData = { &vncVersRec, vncSetup, NULL }; |
| 68 | |
| 69 | static pointer |
| 70 | vncSetup(pointer module, pointer opts, int *errmaj, int *errmin) { |
| 71 | LoadExtension(&vncExt, FALSE); |
| 72 | /* Need a non-NULL return value to indicate success */ |
| 73 | return (pointer)1; |
| 74 | } |
| 75 | |
| 76 | static void vncExtensionInitWithParams(INITARGS) |
| 77 | { |
| 78 | rfb::initStdIOLoggers(); |
| 79 | rfb::LogWriter::setLogParams("*:stderr:30"); |
| 80 | |
| 81 | for (int scr = 0; scr < screenInfo.numScreens; scr++) { |
| 82 | ScrnInfoPtr pScrn = xf86Screens[scr]; |
| 83 | |
| 84 | rfb::VoidParameter* p; |
| 85 | for (p = rfb::Configuration::head; p; p = p->_next) { |
| 86 | char* val = xf86FindOptionValue(pScrn->options, p->getName()); |
| 87 | if (val) |
| 88 | p->setParam(val); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | vncExtensionInit(); |
| 93 | } |
| 94 | |
| 95 | #endif /* XFree86LOADER */ |
| 96 | } |