ddxInit.c 7.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/* $Xorg: ddxInit.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
/*
(c) Copyright 1996 Hewlett-Packard Company
(c) Copyright 1996 International Business Machines Corp.
(c) Copyright 1996 Sun Microsystems, Inc.
(c) Copyright 1996 Novell, Inc.
(c) Copyright 1996 Digital Equipment Corp.
(c) Copyright 1996 Fujitsu Limited
(c) Copyright 1996 Hitachi, Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the names of the copyright holders shall
not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/

34 35 36 37
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif

38 39 40
#include <X11/X.h>
#include <X11/Xos.h>
#include <X11/Xproto.h>
41 42
#include "windowstr.h"
#include "servermd.h"
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
43
#include "DiPrint.h"
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

/*-
 *-----------------------------------------------------------------------
 * InitOutput --
 *	If this is built as a print-only server, then we must supply
 *      an InitOutput routine.  If a normal server's real ddx InitOutput
 *      is used, then it should call PrinterInitOutput if it so desires.
 *      The ddx-level hook is needed to allow the printer stuff to 
 *      create additional screens.  An extension can't reliably do
 *      this for two reasons:
 *
 *          1) If InitOutput doesn't create any screens, then main()
 *             exits before calling InitExtensions().
 *
 *          2) Other extensions may rely on knowing about all screens
 *             when they initialize, and we can't guarantee the order
 *             of extension initialization.
 *
 * Results:
 *	ScreenInfo filled in, and PrinterInitOutput is called to create
 *      the screens associated with printers.
 *
 * Side Effects:
 *	None
 *
 *-----------------------------------------------------------------------
 */

void 
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
73
InitOutput(
Egbert Eich's avatar
Egbert Eich committed
74 75 76 77
    ScreenInfo   *pScreenInfo,
    int          argc,
    char         **argv)

78 79 80 81 82 83 84 85
{
    pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
    pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
    pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
    pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;

    pScreenInfo->numPixmapFormats = 0; /* get them in PrinterInitOutput */
    screenInfo.numVideoScreens = 0;
86 87 88 89 90
    
#ifdef PRINT_ONLY_SERVER
    PrinterInitOutput(pScreenInfo, argc, argv);
#endif

91 92 93
}

static void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
94 95 96
BellProc(
    int volume,
    DeviceIntPtr pDev)
97 98 99 100 101
{
    return;
}

static void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
102 103 104
KeyControlProc(
    DeviceIntPtr pDev,
    KeybdCtrl *ctrl)
105 106 107 108 109 110 111 112
{
    return;
}

static KeySym printKeyMap[256];
static CARD8 printModMap[256];

static int
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
113 114 115 116 117
KeyboardProc(
    DevicePtr pKbd,
    int what,
    int argc,
    char *argv[])
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
{
    KeySymsRec keySyms;

    keySyms.minKeyCode = 8;
    keySyms.maxKeyCode = 8;
    keySyms.mapWidth = 1;
    keySyms.map = printKeyMap;

    switch(what)
    {
	case DEVICE_INIT:
	    InitKeyboardDeviceStruct(pKbd, &keySyms, printModMap, 
				     (BellProcPtr)BellProc,
				     KeyControlProc);
	    break;
	case DEVICE_ON:
	    break;
	case DEVICE_OFF:
	    break;
	case DEVICE_CLOSE:
	    break;
    }
    return Success;
}

#include "../mi/mipointer.h"
static int
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
145 146 147 148 149
PointerProc(
     DevicePtr pPtr,
     int what,
     int argc,
     char *argv[])
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
{
#define NUM_BUTTONS 1
    CARD8 map[NUM_BUTTONS];

    switch(what)
      {
        case DEVICE_INIT:
	  {
	      map[0] = 0;
	      InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS, 
				      miPointerGetMotionEvents, 
				      (PtrCtrlProcPtr)_XpVoidNoop,
				      miPointerGetMotionBufferSize());
	      break;
	  }
        case DEVICE_ON:
	  break;
        case DEVICE_OFF:
	  break;
        case DEVICE_CLOSE:
	  break;
      }
    return Success;
}

void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
176
InitInput(
Egbert Eich's avatar
Egbert Eich committed
177
     int       argc,
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
178
     char **argv)
179
{
180
    DeviceIntPtr ptr, kbd;
181 182 183 184 185 186 187 188 189 190

    ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
    kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
    RegisterPointerDevice(ptr);
    RegisterKeyboardDevice(kbd);
    return;
}


Bool
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
191 192 193
LegalModifier(
     unsigned int key,
     DevicePtr dev)
194 195 196 197 198
{
    return TRUE;
}

void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
199 200 201 202 203
ProcessInputEvents(void)
{
}

#ifdef __DARWIN__
Torrey Lyons's avatar
Torrey Lyons committed
204 205 206 207 208
#include "micmap.h"

void GlxExtensionInit(void);
void GlxWrapInitVisuals(miInitVisualsProcPtr *procPtr);

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
209 210
void
DarwinHandleGUI(int argc, char *argv[])
211 212
{
}
Torrey Lyons's avatar
Torrey Lyons committed
213 214 215 216 217 218 219 220 221 222 223

void DarwinGlxExtensionInit(void)
{
    GlxExtensionInit();
}

void DarwinGlxWrapInitVisuals(
    miInitVisualsProcPtr *procPtr)
{
    GlxWrapInitVisuals(procPtr);
}
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
224
#endif
225 226 227

#ifdef DDXOSINIT
void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
228 229 230 231 232 233 234 235
OsVendorInit(void)
{
}
#endif

#ifdef DDXOSFATALERROR
void
OsVendorFatalError(void)
236 237 238 239
{
}
#endif

240
#ifdef DDXBEFORERESET
241 242 243 244 245
void
ddxBeforeReset(void)
{
    return;
}
246
#endif
Egbert Eich's avatar
Egbert Eich committed
247

248 249
#ifdef DDXTIME
CARD32
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
250
GetTimeInMillis(void)
251 252 253 254 255 256 257 258
{
    struct timeval  tp;

    X_GETTIMEOFDAY(&tp);
    return(tp.tv_sec * 1000) + (tp.tv_usec / 1000);
}
#endif

Egbert Eich's avatar
Egbert Eich committed
259 260 261
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
void ddxInitGlobals(void)
{
Roland Mainz's avatar
Roland Mainz committed
262
    PrinterInitGlobals();
Egbert Eich's avatar
Egbert Eich committed
263 264
}

265 266 267 268 269 270 271
/****************************************
* ddxUseMsg()
*
* Called my usemsg from os/utils/c
*
*****************************************/

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
272
void ddxUseMsg(void)
273 274 275
{
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
276
void AbortDDX (void)
277 278 279
{
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
280
void ddxGiveUp(void)	/* Called by GiveUp() */
281 282 283 284
{
}

int
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
285 286 287 288
ddxProcessArgument (
    int argc,
    char *argv[],
    int i)
289 290 291 292 293 294
{
    return(0);
}

#ifdef XINPUT

295 296
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
297
#include "XIstubs.h"
298
#include "exglobals.h"
299

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
300 301
int
ChangePointerDevice (
Egbert Eich's avatar
Egbert Eich committed
302 303 304 305
    DeviceIntPtr       old_dev,
    DeviceIntPtr       new_dev,
    unsigned char      x,
    unsigned char      y)
306
{
Egbert Eich's avatar
Egbert Eich committed
307
        return (BadDevice);
308 309 310
}

int
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
311 312 313 314
ChangeDeviceControl (
    register    ClientPtr       client,
    DeviceIntPtr dev,
    xDeviceCtl  *control)
315 316 317 318
{
    return BadMatch;
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
319 320 321 322 323
void
OpenInputDevice (
    DeviceIntPtr dev,
    ClientPtr client,
    int *status)
324 325 326 327
{
    return;
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
328 329
void
AddOtherInputDevices (void)
330 331 332 333
{
    return;
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
334 335 336 337
void
CloseInputDevice (
    DeviceIntPtr        dev,
    ClientPtr           client)
338 339 340 341
{
    return;
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
342 343 344 345
int
ChangeKeyboardDevice (
    DeviceIntPtr        old_dev,
    DeviceIntPtr        new_dev)
346 347 348 349
{
    return (Success);
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
350 351 352 353 354
int
SetDeviceMode (
    register    ClientPtr       client,
    DeviceIntPtr dev,
    int         mode)
355 356 357 358
{
    return BadMatch;
}

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
359 360 361 362 363 364 365
int
SetDeviceValuators (
    register    ClientPtr       client,
    DeviceIntPtr dev,
    int         *valuators,
    int         first_valuator,
    int         num_valuators)
366 367 368 369 370 371 372 373 374 375 376 377 378 379
{
    return BadMatch;
}


#endif /* XINPUT */

#ifdef AIXV3
/*
 * This is just to get the server to link on AIX, where some bits
 * that should be in os/ are instead in hw/ibm.
 */
int SelectWaitTime = 10000; /* usec */
#endif