~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to Xprint/ddxInit.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: ddxInit.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
 
2
/*
 
3
(c) Copyright 1996 Hewlett-Packard Company
 
4
(c) Copyright 1996 International Business Machines Corp.
 
5
(c) Copyright 1996 Sun Microsystems, Inc.
 
6
(c) Copyright 1996 Novell, Inc.
 
7
(c) Copyright 1996 Digital Equipment Corp.
 
8
(c) Copyright 1996 Fujitsu Limited
 
9
(c) Copyright 1996 Hitachi, Ltd.
 
10
 
 
11
Permission is hereby granted, free of charge, to any person obtaining a copy
 
12
of this software and associated documentation files (the "Software"), to deal
 
13
in the Software without restriction, including without limitation the rights
 
14
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
15
copies of the Software, and to permit persons to whom the Software is
 
16
furnished to do so, subject to the following conditions:
 
17
 
 
18
The above copyright notice and this permission notice shall be included in
 
19
all copies or substantial portions of the Software.
 
20
 
 
21
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
24
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 
25
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
26
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
27
 
 
28
Except as contained in this notice, the names of the copyright holders shall
 
29
not be used in advertising or otherwise to promote the sale, use or other
 
30
dealings in this Software without prior written authorization from said
 
31
copyright holders.
 
32
*/
 
33
 
 
34
#ifdef HAVE_DIX_CONFIG_H
 
35
#include <dix-config.h>
 
36
#endif
 
37
 
 
38
#include <X11/X.h>
 
39
#include <X11/Xos.h>
 
40
#include <X11/Xproto.h>
 
41
#include "windowstr.h"
 
42
#include "servermd.h"
 
43
#include "DiPrint.h"
 
44
 
 
45
/*-
 
46
 *-----------------------------------------------------------------------
 
47
 * InitOutput --
 
48
 *      If this is built as a print-only server, then we must supply
 
49
 *      an InitOutput routine.  If a normal server's real ddx InitOutput
 
50
 *      is used, then it should call PrinterInitOutput if it so desires.
 
51
 *      The ddx-level hook is needed to allow the printer stuff to 
 
52
 *      create additional screens.  An extension can't reliably do
 
53
 *      this for two reasons:
 
54
 *
 
55
 *          1) If InitOutput doesn't create any screens, then main()
 
56
 *             exits before calling InitExtensions().
 
57
 *
 
58
 *          2) Other extensions may rely on knowing about all screens
 
59
 *             when they initialize, and we can't guarantee the order
 
60
 *             of extension initialization.
 
61
 *
 
62
 * Results:
 
63
 *      ScreenInfo filled in, and PrinterInitOutput is called to create
 
64
 *      the screens associated with printers.
 
65
 *
 
66
 * Side Effects:
 
67
 *      None
 
68
 *
 
69
 *-----------------------------------------------------------------------
 
70
 */
 
71
 
 
72
void 
 
73
InitOutput(
 
74
    ScreenInfo   *pScreenInfo,
 
75
    int          argc,
 
76
    char         **argv)
 
77
 
 
78
{
 
79
    int i;
 
80
 
 
81
    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
 
82
    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
 
83
    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
 
84
    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
 
85
 
 
86
    pScreenInfo->numPixmapFormats = 0; /* get them in PrinterInitOutput */
 
87
    screenInfo.numVideoScreens = 0;
 
88
    
 
89
#ifdef PRINT_ONLY_SERVER
 
90
    PrinterInitOutput(pScreenInfo, argc, argv);
 
91
#endif
 
92
 
 
93
}
 
94
 
 
95
static void
 
96
BellProc(
 
97
    int volume,
 
98
    DeviceIntPtr pDev)
 
99
{
 
100
    return;
 
101
}
 
102
 
 
103
static void
 
104
KeyControlProc(
 
105
    DeviceIntPtr pDev,
 
106
    KeybdCtrl *ctrl)
 
107
{
 
108
    return;
 
109
}
 
110
 
 
111
static KeySym printKeyMap[256];
 
112
static CARD8 printModMap[256];
 
113
 
 
114
static int
 
115
KeyboardProc(
 
116
    DevicePtr pKbd,
 
117
    int what,
 
118
    int argc,
 
119
    char *argv[])
 
120
{
 
121
    KeySymsRec keySyms;
 
122
 
 
123
    keySyms.minKeyCode = 8;
 
124
    keySyms.maxKeyCode = 8;
 
125
    keySyms.mapWidth = 1;
 
126
    keySyms.map = printKeyMap;
 
127
 
 
128
    switch(what)
 
129
    {
 
130
        case DEVICE_INIT:
 
131
            InitKeyboardDeviceStruct(pKbd, &keySyms, printModMap, 
 
132
                                     (BellProcPtr)BellProc,
 
133
                                     KeyControlProc);
 
134
            break;
 
135
        case DEVICE_ON:
 
136
            break;
 
137
        case DEVICE_OFF:
 
138
            break;
 
139
        case DEVICE_CLOSE:
 
140
            break;
 
141
    }
 
142
    return Success;
 
143
}
 
144
 
 
145
#include "../mi/mipointer.h"
 
146
static int
 
147
PointerProc(
 
148
     DevicePtr pPtr,
 
149
     int what,
 
150
     int argc,
 
151
     char *argv[])
 
152
{
 
153
#define NUM_BUTTONS 1
 
154
    CARD8 map[NUM_BUTTONS];
 
155
 
 
156
    switch(what)
 
157
      {
 
158
        case DEVICE_INIT:
 
159
          {
 
160
              map[0] = 0;
 
161
              InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS, 
 
162
                                      miPointerGetMotionEvents, 
 
163
                                      (PtrCtrlProcPtr)_XpVoidNoop,
 
164
                                      miPointerGetMotionBufferSize());
 
165
              break;
 
166
          }
 
167
        case DEVICE_ON:
 
168
          break;
 
169
        case DEVICE_OFF:
 
170
          break;
 
171
        case DEVICE_CLOSE:
 
172
          break;
 
173
      }
 
174
    return Success;
 
175
}
 
176
 
 
177
void
 
178
InitInput(
 
179
     int       argc,
 
180
     char **argv)
 
181
{
 
182
    DevicePtr ptr, kbd;
 
183
 
 
184
    ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
 
185
    kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
 
186
    RegisterPointerDevice(ptr);
 
187
    RegisterKeyboardDevice(kbd);
 
188
    return;
 
189
}
 
190
 
 
191
 
 
192
Bool
 
193
LegalModifier(
 
194
     unsigned int key,
 
195
     DevicePtr dev)
 
196
{
 
197
    return TRUE;
 
198
}
 
199
 
 
200
void
 
201
ProcessInputEvents(void)
 
202
{
 
203
}
 
204
 
 
205
#ifdef __DARWIN__
 
206
#include "micmap.h"
 
207
 
 
208
void GlxExtensionInit(void);
 
209
void GlxWrapInitVisuals(miInitVisualsProcPtr *procPtr);
 
210
 
 
211
void
 
212
DarwinHandleGUI(int argc, char *argv[])
 
213
{
 
214
}
 
215
 
 
216
void DarwinGlxExtensionInit(void)
 
217
{
 
218
    GlxExtensionInit();
 
219
}
 
220
 
 
221
void DarwinGlxWrapInitVisuals(
 
222
    miInitVisualsProcPtr *procPtr)
 
223
{
 
224
    GlxWrapInitVisuals(procPtr);
 
225
}
 
226
#endif
 
227
 
 
228
#ifdef DDXOSINIT
 
229
void
 
230
OsVendorInit(void)
 
231
{
 
232
}
 
233
#endif
 
234
 
 
235
#ifdef DDXOSFATALERROR
 
236
void
 
237
OsVendorFatalError(void)
 
238
{
 
239
}
 
240
#endif
 
241
 
 
242
void
 
243
ddxBeforeReset(void)
 
244
{
 
245
    return;
 
246
}
 
247
 
 
248
#ifdef DDXTIME
 
249
CARD32
 
250
GetTimeInMillis(void)
 
251
{
 
252
    struct timeval  tp;
 
253
 
 
254
    X_GETTIMEOFDAY(&tp);
 
255
    return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
 
256
}
 
257
#endif
 
258
 
 
259
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
 
260
void ddxInitGlobals(void)
 
261
{
 
262
    PrinterInitGlobals();
 
263
}
 
264
 
 
265
/****************************************
 
266
* ddxUseMsg()
 
267
*
 
268
* Called my usemsg from os/utils/c
 
269
*
 
270
*****************************************/
 
271
 
 
272
void ddxUseMsg(void)
 
273
{
 
274
}
 
275
 
 
276
void AbortDDX (void)
 
277
{
 
278
}
 
279
 
 
280
void ddxGiveUp(void)    /* Called by GiveUp() */
 
281
{
 
282
}
 
283
 
 
284
int
 
285
ddxProcessArgument (
 
286
    int argc,
 
287
    char *argv[],
 
288
    int i)
 
289
{
 
290
    return(0);
 
291
}
 
292
 
 
293
#ifdef XINPUT
 
294
 
 
295
#include <X11/extensions/XI.h>
 
296
#include <X11/extensions/XIproto.h>
 
297
#include "XIstubs.h"
 
298
 
 
299
extern  int     BadDevice;
 
300
 
 
301
int
 
302
ChangePointerDevice (
 
303
    DeviceIntPtr       old_dev,
 
304
    DeviceIntPtr       new_dev,
 
305
    unsigned char      x,
 
306
    unsigned char      y)
 
307
{
 
308
        return (BadDevice);
 
309
}
 
310
 
 
311
int
 
312
ChangeDeviceControl (
 
313
    register    ClientPtr       client,
 
314
    DeviceIntPtr dev,
 
315
    xDeviceCtl  *control)
 
316
{
 
317
    return BadMatch;
 
318
}
 
319
 
 
320
void
 
321
OpenInputDevice (
 
322
    DeviceIntPtr dev,
 
323
    ClientPtr client,
 
324
    int *status)
 
325
{
 
326
    return;
 
327
}
 
328
 
 
329
void
 
330
AddOtherInputDevices (void)
 
331
{
 
332
    return;
 
333
}
 
334
 
 
335
void
 
336
CloseInputDevice (
 
337
    DeviceIntPtr        dev,
 
338
    ClientPtr           client)
 
339
{
 
340
    return;
 
341
}
 
342
 
 
343
int
 
344
ChangeKeyboardDevice (
 
345
    DeviceIntPtr        old_dev,
 
346
    DeviceIntPtr        new_dev)
 
347
{
 
348
    return (Success);
 
349
}
 
350
 
 
351
int
 
352
SetDeviceMode (
 
353
    register    ClientPtr       client,
 
354
    DeviceIntPtr dev,
 
355
    int         mode)
 
356
{
 
357
    return BadMatch;
 
358
}
 
359
 
 
360
int
 
361
SetDeviceValuators (
 
362
    register    ClientPtr       client,
 
363
    DeviceIntPtr dev,
 
364
    int         *valuators,
 
365
    int         first_valuator,
 
366
    int         num_valuators)
 
367
{
 
368
    return BadMatch;
 
369
}
 
370
 
 
371
 
 
372
#endif /* XINPUT */
 
373
 
 
374
#ifdef XTESTEXT1
 
375
 
 
376
void
 
377
XTestJumpPointer(int x, int y, int dev)
 
378
{
 
379
    return;
 
380
}
 
381
 
 
382
void
 
383
XTestGetPointerPos(int x, int y)
 
384
{
 
385
    return;
 
386
}
 
387
 
 
388
void
 
389
XTestGenerateEvent(int dev, int keycode, int keystate, int x, int y)
 
390
{
 
391
    return;
 
392
}
 
393
 
 
394
#endif /* XTESTEXT1 */
 
395
 
 
396
#ifdef AIXV3
 
397
/*
 
398
 * This is just to get the server to link on AIX, where some bits
 
399
 * that should be in os/ are instead in hw/ibm.
 
400
 */
 
401
int SelectWaitTime = 10000; /* usec */
 
402
#endif