2 * Xephyr - A kdrive X server thats runs in a host X window.
3 * Authored by Matthew Allum <mallum@o-hand.com>
5 * Copyright © 2004 Nokia
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Nokia not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Nokia makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
17 * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
27 #include <kdrive-config.h>
31 extern Window EphyrPreExistingHostWin
;
32 extern Bool EphyrWantGrayScale
;
33 extern Bool kdHasPointer
;
44 KdCardInfoAdd (&ephyrFuncs
, &attr
, 0);
48 InitOutput (ScreenInfo
*pScreenInfo
, int argc
, char **argv
)
50 KdInitOutput (pScreenInfo
, argc
, argv
);
54 InitInput (int argc
, char **argv
)
59 KdAddKeyboardDriver(&EphyrKeyboardDriver
);
61 KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver
);
63 KdAddPointerDriver(&EphyrMouseDriver
);
65 KdAddPointerDriver(&LinuxEvdevMouseDriver
);
71 FatalError("Couldn't create Xephyr keyboard\n");
72 ki
->driver
= &EphyrKeyboardDriver
;
79 FatalError("Couldn't create Xephyr pointer\n");
80 pi
->driver
= &EphyrMouseDriver
;
92 ErrorF("\nXephyr Option Usage:\n");
93 ErrorF("-parent XID Use existing window as Xephyr root win\n");
94 ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
95 ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
96 ErrorF("-grayscale Simulate 8bit grayscale\n");
97 ErrorF("-fakexa Simulate acceleration using software rendering\n");
104 ddxProcessArgument (int argc
, char **argv
, int i
)
108 if (!strcmp (argv
[i
], "-parent"))
112 hostx_use_preexisting_window(strtol(argv
[i
+1], NULL
, 0));
119 else if (!strcmp (argv
[i
], "-host-cursor"))
121 hostx_use_host_cursor();
124 else if (!strcmp (argv
[i
], "-fullscreen"))
126 hostx_use_fullscreen();
129 else if (!strcmp (argv
[i
], "-grayscale"))
131 EphyrWantGrayScale
= 1;
134 else if (!strcmp (argv
[i
], "-fakexa"))
136 ephyrFuncs
.initAccel
= ephyrDrawInit
;
137 ephyrFuncs
.enableAccel
= ephyrDrawEnable
;
138 ephyrFuncs
.disableAccel
= ephyrDrawDisable
;
139 ephyrFuncs
.finiAccel
= ephyrDrawFini
;
142 else if (argv
[i
][0] == ':')
144 hostx_set_display_name(argv
[i
]);
147 return KdProcessArgument (argc
, argv
, i
);
155 if (hostx_want_host_cursor())
157 ephyrFuncs
.initCursor
= &ephyrCursorInit
;
158 ephyrFuncs
.enableCursor
= &ephyrCursorEnable
;
161 KdOsInit (&EphyrOsFuncs
);
164 /* 'Fake' cursor stuff, could be improved */
167 ephyrRealizeCursor(ScreenPtr pScreen
, CursorPtr pCursor
)
173 ephyrUnrealizeCursor(ScreenPtr pScreen
, CursorPtr pCursor
)
179 ephyrSetCursor(ScreenPtr pScreen
, CursorPtr pCursor
, int x
, int y
)
185 ephyrMoveCursor(ScreenPtr pScreen
, int x
, int y
)
190 miPointerSpriteFuncRec EphyrPointerSpriteFuncs
= {
192 ephyrUnrealizeCursor
,
199 ephyrCursorInit(ScreenPtr pScreen
)
201 miPointerInitialize(pScreen
, &EphyrPointerSpriteFuncs
,
202 &kdPointerScreenFuncs
, FALSE
);
208 ephyrCursorEnable(ScreenPtr pScreen
)
213 KdCardFuncs ephyrFuncs
= {
214 ephyrCardInit
, /* cardinit */
215 ephyrScreenInit
, /* scrinit */
216 ephyrInitScreen
, /* initScreen */
217 ephyrFinishInitScreen
, /* finishInitScreen */
218 ephyrCreateResources
, /* createRes */
219 ephyrPreserve
, /* preserve */
220 ephyrEnable
, /* enable */
221 ephyrDPMS
, /* dpms */
222 ephyrDisable
, /* disable */
223 ephyrRestore
, /* restore */
224 ephyrScreenFini
, /* scrfini */
225 ephyrCardFini
, /* cardfini */
228 0, /* enableCursor */
229 0, /* disableCursor */
231 0, /* recolorCursor */
235 0, /* disableAccel */
238 ephyrGetColors
, /* getColors */
239 ephyrPutColors
, /* putColors */