blob: ef8ea50692dfd8d75403fc094f5706efe31ef22e [file] [log] [blame]
Constantin Kaplinsky95f6f7a2006-04-17 04:17:23 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00003 * 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
25extern "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
Constantin Kaplinsky95f6f7a2006-04-17 04:17:23 +000037using namespace rfb;
38
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000039extern void vncExtensionInit();
40static void vncExtensionInitWithParams(INITARGS);
41
42#ifdef XFree86LOADER
43
44static MODULESETUPPROTO(vncSetup);
45
46ExtensionModule vncExt =
47{
48 vncExtensionInitWithParams,
49 "VNC",
50 NULL,
51 NULL,
52 NULL
53};
54
55static XF86ModuleVersionInfo vncVersRec =
56{
57 "vnc",
Peter Åstrand9fb4e0e2004-12-30 10:03:00 +000058 "Constantin Kaplinsky",
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000059 MODINFOSTRING1,
60 MODINFOSTRING2,
61 XF86_VERSION_CURRENT,
62 1, 0, 0,
63 ABI_CLASS_EXTENSION, /* needs the server extension ABI */
64 ABI_EXTENSION_VERSION,
65 MOD_CLASS_EXTENSION,
66 {0,0,0,0}
67};
68
69XF86ModuleData vncModuleData = { &vncVersRec, vncSetup, NULL };
70
71static pointer
72vncSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
73 LoadExtension(&vncExt, FALSE);
74 /* Need a non-NULL return value to indicate success */
75 return (pointer)1;
76}
77
78static void vncExtensionInitWithParams(INITARGS)
79{
80 rfb::initStdIOLoggers();
81 rfb::LogWriter::setLogParams("*:stderr:30");
82
83 for (int scr = 0; scr < screenInfo.numScreens; scr++) {
84 ScrnInfoPtr pScrn = xf86Screens[scr];
85
Constantin Kaplinsky95f6f7a2006-04-17 04:17:23 +000086 for (ParameterIterator i(Configuration::global()); i.param; i.next()) {
87 char* val = xf86FindOptionValue(pScrn->options, i.param->getName());
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000088 if (val)
Constantin Kaplinsky95f6f7a2006-04-17 04:17:23 +000089 i.param->setParam(val);
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +000090 }
91 }
92
93 vncExtensionInit();
94}
95
96#endif /* XFree86LOADER */
97}