Add (stubbed out) Xgl server code

This commit is contained in:
Keith Packard 2004-06-04 17:06:18 +00:00
parent f8a1dd3ce7
commit d9cca52feb
12 changed files with 1189 additions and 0 deletions

17
hw/xgl/Makefile.am Normal file
View File

@ -0,0 +1,17 @@
INCLUDES = \
@XGL_INCS@ \
@XSERVER_CFLAGS@
bin_PROGRAMS = Xgl
Xgl_SOURCES = \
xglgc.c \
xglinit.c \
xglinput.c \
xgloutput.c \
xglpixmap.c \
xglspans.c
Xgl_LDADD = \
@XGL_LIBS@ \
@XSERVER_LIBS@

195
hw/xgl/kbd.c Normal file
View File

@ -0,0 +1,195 @@
/*
* Id: kbd.c,v 1.1 1999/11/02 18:39:28 keithp Exp $
*
* Copyright © 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/fake/kbd.c,v 1.1 1999/11/19 13:53:53 hohndel Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fake.h"
#include "kkeymap.h"
#include <X11/keysym.h>
#define FAKE_WIDTH 2
KeySym FakeKeymap[] = {
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
/* 3 10 */ XK_2, XK_at,
/* 4 11 */ XK_3, XK_numbersign,
/* 5 12 */ XK_4, XK_dollar,
/* 6 13 */ XK_5, XK_percent,
/* 7 14 */ XK_6, XK_asciicircum,
/* 8 15 */ XK_7, XK_ampersand,
/* 9 16 */ XK_8, XK_asterisk,
/* 10 17 */ XK_9, XK_parenleft,
/* 11 18 */ XK_0, XK_parenright,
/* 12 19 */ XK_minus, XK_underscore,
/* 13 20 */ XK_equal, XK_plus,
/* 14 21 */ XK_BackSpace, NoSymbol,
/* 15 22 */ XK_Tab, NoSymbol,
/* 16 23 */ XK_Q, NoSymbol,
/* 17 24 */ XK_W, NoSymbol,
/* 18 25 */ XK_E, NoSymbol,
/* 19 26 */ XK_R, NoSymbol,
/* 20 27 */ XK_T, NoSymbol,
/* 21 28 */ XK_Y, NoSymbol,
/* 22 29 */ XK_U, NoSymbol,
/* 23 30 */ XK_I, NoSymbol,
/* 24 31 */ XK_O, NoSymbol,
/* 25 32 */ XK_P, NoSymbol,
/* 26 33 */ XK_bracketleft, XK_braceleft,
/* 27 34 */ XK_bracketright, XK_braceright,
/* 28 35 */ XK_Return, NoSymbol,
/* 29 36 */ XK_Control_L, NoSymbol,
/* 30 37 */ XK_A, NoSymbol,
/* 31 38 */ XK_S, NoSymbol,
/* 32 39 */ XK_D, NoSymbol,
/* 33 40 */ XK_F, NoSymbol,
/* 34 41 */ XK_G, NoSymbol,
/* 35 42 */ XK_H, NoSymbol,
/* 36 43 */ XK_J, NoSymbol,
/* 37 44 */ XK_K, NoSymbol,
/* 38 45 */ XK_L, NoSymbol,
/* 39 46 */ XK_semicolon, XK_colon,
/* 40 47 */ XK_apostrophe, XK_quotedbl,
/* 41 48 */ XK_grave, XK_asciitilde,
/* 42 49 */ XK_Shift_L, NoSymbol,
/* 43 50 */ XK_backslash, XK_bar,
/* 44 51 */ XK_Z, NoSymbol,
/* 45 52 */ XK_X, NoSymbol,
/* 46 53 */ XK_C, NoSymbol,
/* 47 54 */ XK_V, NoSymbol,
/* 48 55 */ XK_B, NoSymbol,
/* 49 56 */ XK_N, NoSymbol,
/* 50 57 */ XK_M, NoSymbol,
/* 51 58 */ XK_comma, XK_less,
/* 52 59 */ XK_period, XK_greater,
/* 53 60 */ XK_slash, XK_question,
/* 54 61 */ XK_Shift_R, NoSymbol,
/* 55 62 */ XK_KP_Multiply, NoSymbol,
/* 56 63 */ XK_Alt_L, XK_Meta_L,
/* 57 64 */ XK_space, NoSymbol,
/* 58 65 */ XK_Caps_Lock, NoSymbol,
/* 59 66 */ XK_F1, NoSymbol,
/* 60 67 */ XK_F2, NoSymbol,
/* 61 68 */ XK_F3, NoSymbol,
/* 62 69 */ XK_F4, NoSymbol,
/* 63 70 */ XK_F5, NoSymbol,
/* 64 71 */ XK_F6, NoSymbol,
/* 65 72 */ XK_F7, NoSymbol,
/* 66 73 */ XK_F8, NoSymbol,
/* 67 74 */ XK_F9, NoSymbol,
/* 68 75 */ XK_F10, NoSymbol,
/* 69 76 */ XK_Break, XK_Pause,
/* 70 77 */ XK_Scroll_Lock, NoSymbol,
/* 71 78 */ XK_KP_Home, XK_KP_7,
/* 72 79 */ XK_KP_Up, XK_KP_8,
/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
/* 74 81 */ XK_KP_Subtract, NoSymbol,
/* 75 82 */ XK_KP_Left, XK_KP_4,
/* 76 83 */ XK_KP_5, NoSymbol,
/* 77 84 */ XK_KP_Right, XK_KP_6,
/* 78 85 */ XK_KP_Add, NoSymbol,
/* 79 86 */ XK_KP_End, XK_KP_1,
/* 80 87 */ XK_KP_Down, XK_KP_2,
/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
/* 82 89 */ XK_KP_Insert, XK_KP_0,
/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
/* 84 91 */ NoSymbol, NoSymbol,
/* 85 92 */ NoSymbol, NoSymbol,
/* 86 93 */ NoSymbol, NoSymbol,
/* 87 94 */ XK_F11, NoSymbol,
/* 88 95 */ XK_F12, NoSymbol,
/* These are remapped from the extended set (using ExtendMap) */
/* 89 96 */ XK_Control_R, NoSymbol,
/* 90 97 */ XK_KP_Enter, NoSymbol,
/* 91 98 */ XK_KP_Divide, NoSymbol,
/* 92 99 */ XK_Sys_Req, XK_Print,
/* 93 100 */ XK_Alt_R, XK_Meta_R,
/* 94 101 */ XK_Num_Lock, NoSymbol,
/* 95 102 */ XK_Home, NoSymbol,
/* 96 103 */ XK_Up, NoSymbol,
/* 97 104 */ XK_Page_Up, NoSymbol,
/* 98 105 */ XK_Left, NoSymbol,
/* 99 106 */ XK_Right, NoSymbol,
/* 100 107 */ XK_End, NoSymbol,
/* 101 108 */ XK_Down, NoSymbol,
/* 102 109 */ XK_Page_Down, NoSymbol,
/* 103 110 */ XK_Insert, NoSymbol,
/* 104 111 */ XK_Delete, NoSymbol,
/* 105 112 */ XK_Super_L, NoSymbol,
/* 106 113 */ XK_Super_R, NoSymbol,
/* 107 114 */ XK_Menu, NoSymbol,
/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
/* 110 117 */ XK_Up, NoSymbol, /* joypad */
/* 111 118 */ XK_Down, NoSymbol,
/* 112 119 */ XK_Left, NoSymbol,
/* 113 120 */ XK_Right, NoSymbol,
/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
static void
FakeKeyboardLoad (void)
{
kdMinScanCode = 1;
kdKeymapWidth = FAKE_WIDTH;
kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
}
static int
FakeKeyboardInit (void)
{
return 0;
}
static void
FakeKeyboardFini (void)
{
}
static void
FakeKeyboardLeds (int leds)
{
}
static void
FakeKeyboardBell (int volume, int frequency, int duration)
{
}
KdKeyboardFuncs FakeKeyboardFuncs = {
FakeKeyboardLoad,
FakeKeyboardInit,
FakeKeyboardLeds,
FakeKeyboardBell,
FakeKeyboardFini,
0,
};

53
hw/xgl/mouse.c Normal file
View File

@ -0,0 +1,53 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define NEED_EVENTS
#include <errno.h>
#include <termios.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xpoll.h>
#include "inputstr.h"
#include "scrnintstr.h"
#include "kdrive.h"
static Bool
MouseInit (void)
{
return TRUE;
}
static void
MouseFini (void)
{
}
KdMouseFuncs FakeMouseFuncs = {
MouseInit,
MouseFini,
};

97
hw/xgl/xgl.h Normal file
View File

@ -0,0 +1,97 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _XGL_H_
#define _XGL_H_
#include <stdio.h>
#include <X11/X.h>
#define NEED_EVENTS
#include <X11/Xproto.h>
#include <X11/Xos.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "mibstore.h"
#include "colormapst.h"
#include "gcstruct.h"
#include "inputstr.h"
#include "mipointer.h"
#include "mi.h"
#include "dix.h"
#include "shadow.h"
#include "randrstr.h"
#include "micmap.h"
#include "migc.h"
extern WindowPtr *WindowTable;
Bool
xglCreateGC (GCPtr pGC);
void
xglFillSpans (DrawablePtr pDrawable,
GCPtr pGC,
int n,
DDXPointPtr ppt,
int *pwidth,
int fSorted);
void
xglSetSpans (DrawablePtr pDrawable,
GCPtr pGC,
char *src,
DDXPointPtr ppt,
int *pwidth,
int nspans,
int fSorted);
void
xglGetSpans(DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,
int *pwidth,
int nspans,
char *pchardstStart);
void
xglPushPixels (GCPtr pGC,
PixmapPtr pBitmap,
DrawablePtr pDrawable,
int dx,
int dy,
int xOrg,
int yOrg);
PixmapPtr
xglCreatePixmap (ScreenPtr pScreen,
int width,
int height,
int depth);
Bool
xglDestroyPixmap (PixmapPtr pPixmap);
#endif /* _XGL_H_ */

26
hw/xgl/xglcursor.c Normal file
View File

@ -0,0 +1,26 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"

113
hw/xgl/xglgc.c Normal file
View File

@ -0,0 +1,113 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"
static void
xglValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
pGC->lastWinOrg.x = pDrawable->x;
pGC->lastWinOrg.y = pDrawable->y;
if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
)
{
miComputeCompositeClip (pGC, pDrawable);
}
}
static const GCFuncs xglGCFuncs = {
xglValidateGC,
miChangeGC,
miCopyGC,
miDestroyGC,
miChangeClip,
miDestroyClip,
miCopyClip,
};
static void
xglPolyLine (DrawablePtr pDrawable,
GCPtr pGC,
int mode,
int npt,
DDXPointPtr ppt)
{
void (*line) (DrawablePtr, GCPtr, int mode, int npt, DDXPointPtr ppt);
if (pGC->lineWidth == 0)
{
line = miZeroLine;
}
else
{
if (pGC->lineStyle != LineSolid)
line = miWideDash;
else
line = miWideLine;
}
(*line) (pDrawable, pGC, mode, npt, ppt);
}
static const GCOps xglGCOps = {
xglFillSpans,
xglSetSpans,
miPutImage,
miCopyArea,
miCopyPlane,
miPolyPoint,
xglPolyLine,
miPolySegment,
miPolyRectangle,
miPolyArc,
miFillPolygon,
miPolyFillRect,
miPolyFillArc,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
miImageGlyphBlt,
miPolyGlyphBlt,
xglPushPixels
#ifdef NEED_LINEHELPER
,NULL
#endif
};
Bool
xglCreateGC (GCPtr pGC)
{
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
pGC->funcs = (GCFuncs *) &xglGCFuncs;
pGC->ops = (GCOps *) &xglGCOps;
pGC->pCompositeClip = 0;
pGC->fExpose = 1;
pGC->freeCompClip = FALSE;
pGC->pRotatedPixmap = 0;
return TRUE;
}

54
hw/xgl/xglinit.c Normal file
View File

@ -0,0 +1,54 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "xgl.h"
void
ddxUseMsg (void)
{
}
int
ddxProcessArgument (int argc, char **argv, int i)
{
return 0;
}
void
AbortDDX(void)
{
}
void
ddxGiveUp ()
{
}
void
OsVendorInit (void)
{
}

264
hw/xgl/xglinput.c Normal file
View File

@ -0,0 +1,264 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"
#define XK_PUBLISHING
#include <X11/keysym.h>
#if HAVE_X11_XF86KEYSYM_H
#include <X11/XF86keysym.h>
#endif
Bool
LegalModifier(unsigned int key, DevicePtr pDev)
{
return TRUE;
}
void
ProcessInputEvents ()
{
}
#define NUM_BUTTONS 5
static int
xglMouseProc (DeviceIntPtr pDevice, int onoff)
{
BYTE map[NUM_BUTTONS + 1];
DevicePtr pDev = (DevicePtr) pDevice;
int i;
switch (onoff) {
case DEVICE_INIT:
for (i = 1; i <= NUM_BUTTONS; i++)
map[i] = i;
InitPointerDeviceStruct(pDev, map, NUM_BUTTONS,
miPointerGetMotionEvents,
(PtrCtrlProcPtr)NoopDDA,
miPointerGetMotionBufferSize());
break;
case DEVICE_ON:
pDev->on = TRUE;
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
if (pDev->on)
{
pDev->on = FALSE;
}
break;
}
return Success;
}
static void
xglBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
{
}
static void
xglKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
{
}
#define XGL_KEYMAP_WIDTH 2
KeySym xglKeymap[] = {
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
/* 3 10 */ XK_2, XK_at,
/* 4 11 */ XK_3, XK_numbersign,
/* 5 12 */ XK_4, XK_dollar,
/* 6 13 */ XK_5, XK_percent,
/* 7 14 */ XK_6, XK_asciicircum,
/* 8 15 */ XK_7, XK_ampersand,
/* 9 16 */ XK_8, XK_asterisk,
/* 10 17 */ XK_9, XK_parenleft,
/* 11 18 */ XK_0, XK_parenright,
/* 12 19 */ XK_minus, XK_underscore,
/* 13 20 */ XK_equal, XK_plus,
/* 14 21 */ XK_BackSpace, NoSymbol,
/* 15 22 */ XK_Tab, NoSymbol,
/* 16 23 */ XK_Q, NoSymbol,
/* 17 24 */ XK_W, NoSymbol,
/* 18 25 */ XK_E, NoSymbol,
/* 19 26 */ XK_R, NoSymbol,
/* 20 27 */ XK_T, NoSymbol,
/* 21 28 */ XK_Y, NoSymbol,
/* 22 29 */ XK_U, NoSymbol,
/* 23 30 */ XK_I, NoSymbol,
/* 24 31 */ XK_O, NoSymbol,
/* 25 32 */ XK_P, NoSymbol,
/* 26 33 */ XK_bracketleft, XK_braceleft,
/* 27 34 */ XK_bracketright, XK_braceright,
/* 28 35 */ XK_Return, NoSymbol,
/* 29 36 */ XK_Control_L, NoSymbol,
/* 30 37 */ XK_A, NoSymbol,
/* 31 38 */ XK_S, NoSymbol,
/* 32 39 */ XK_D, NoSymbol,
/* 33 40 */ XK_F, NoSymbol,
/* 34 41 */ XK_G, NoSymbol,
/* 35 42 */ XK_H, NoSymbol,
/* 36 43 */ XK_J, NoSymbol,
/* 37 44 */ XK_K, NoSymbol,
/* 38 45 */ XK_L, NoSymbol,
/* 39 46 */ XK_semicolon, XK_colon,
/* 40 47 */ XK_apostrophe, XK_quotedbl,
/* 41 48 */ XK_grave, XK_asciitilde,
/* 42 49 */ XK_Shift_L, NoSymbol,
/* 43 50 */ XK_backslash, XK_bar,
/* 44 51 */ XK_Z, NoSymbol,
/* 45 52 */ XK_X, NoSymbol,
/* 46 53 */ XK_C, NoSymbol,
/* 47 54 */ XK_V, NoSymbol,
/* 48 55 */ XK_B, NoSymbol,
/* 49 56 */ XK_N, NoSymbol,
/* 50 57 */ XK_M, NoSymbol,
/* 51 58 */ XK_comma, XK_less,
/* 52 59 */ XK_period, XK_greater,
/* 53 60 */ XK_slash, XK_question,
/* 54 61 */ XK_Shift_R, NoSymbol,
/* 55 62 */ XK_KP_Multiply, NoSymbol,
/* 56 63 */ XK_Alt_L, XK_Meta_L,
/* 57 64 */ XK_space, NoSymbol,
/* 58 65 */ XK_Caps_Lock, NoSymbol,
/* 59 66 */ XK_F1, NoSymbol,
/* 60 67 */ XK_F2, NoSymbol,
/* 61 68 */ XK_F3, NoSymbol,
/* 62 69 */ XK_F4, NoSymbol,
/* 63 70 */ XK_F5, NoSymbol,
/* 64 71 */ XK_F6, NoSymbol,
/* 65 72 */ XK_F7, NoSymbol,
/* 66 73 */ XK_F8, NoSymbol,
/* 67 74 */ XK_F9, NoSymbol,
/* 68 75 */ XK_F10, NoSymbol,
/* 69 76 */ XK_Break, XK_Pause,
/* 70 77 */ XK_Scroll_Lock, NoSymbol,
/* 71 78 */ XK_KP_Home, XK_KP_7,
/* 72 79 */ XK_KP_Up, XK_KP_8,
/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
/* 74 81 */ XK_KP_Subtract, NoSymbol,
/* 75 82 */ XK_KP_Left, XK_KP_4,
/* 76 83 */ XK_KP_5, NoSymbol,
/* 77 84 */ XK_KP_Right, XK_KP_6,
/* 78 85 */ XK_KP_Add, NoSymbol,
/* 79 86 */ XK_KP_End, XK_KP_1,
/* 80 87 */ XK_KP_Down, XK_KP_2,
/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
/* 82 89 */ XK_KP_Insert, XK_KP_0,
/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
/* 84 91 */ NoSymbol, NoSymbol,
/* 85 92 */ NoSymbol, NoSymbol,
/* 86 93 */ NoSymbol, NoSymbol,
/* 87 94 */ XK_F11, NoSymbol,
/* 88 95 */ XK_F12, NoSymbol,
/* 89 96 */ XK_Control_R, NoSymbol,
/* 90 97 */ XK_KP_Enter, NoSymbol,
/* 91 98 */ XK_KP_Divide, NoSymbol,
/* 92 99 */ XK_Sys_Req, XK_Print,
/* 93 100 */ XK_Alt_R, XK_Meta_R,
/* 94 101 */ XK_Num_Lock, NoSymbol,
/* 95 102 */ XK_Home, NoSymbol,
/* 96 103 */ XK_Up, NoSymbol,
/* 97 104 */ XK_Page_Up, NoSymbol,
/* 98 105 */ XK_Left, NoSymbol,
/* 99 106 */ XK_Right, NoSymbol,
/* 100 107 */ XK_End, NoSymbol,
/* 101 108 */ XK_Down, NoSymbol,
/* 102 109 */ XK_Page_Down, NoSymbol,
/* 103 110 */ XK_Insert, NoSymbol,
/* 104 111 */ XK_Delete, NoSymbol,
/* 105 112 */ XK_Super_L, NoSymbol,
/* 106 113 */ XK_Super_R, NoSymbol,
/* 107 114 */ XK_Menu, NoSymbol,
/* 108 115 */ XK_Next, NoSymbol, /* right button on side */
/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */
/* 110 117 */ XK_Up, NoSymbol, /* joypad */
/* 111 118 */ XK_Down, NoSymbol,
/* 112 119 */ XK_Left, NoSymbol,
/* 113 120 */ XK_Right, NoSymbol,
/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */
/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
CARD8 xglModMap[MAP_LENGTH];
KeySymsRec xglKeySyms = {
xglKeymap,
8,
8 + (sizeof (xglKeymap) / sizeof (xglKeymap[0]) / XGL_KEYMAP_WIDTH) - 1,
XGL_KEYMAP_WIDTH
};
static int
xglKeybdProc(DeviceIntPtr pDevice, int onoff)
{
Bool ret;
DevicePtr pDev = (DevicePtr)pDevice;
if (!pDev)
return BadImplementation;
switch (onoff)
{
case DEVICE_INIT:
if (pDev != LookupKeyboardDevice())
{
return !Success;
}
ret = InitKeyboardDeviceStruct(pDev,
&xglKeySyms,
xglModMap,
xglBell, xglKbdCtrl);
if (!ret)
return BadImplementation;
break;
case DEVICE_ON:
pDev->on = TRUE;
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
if (pDev->on)
{
pDev->on = FALSE;
}
break;
}
return Success;
}
void
InitInput (int argc, char **argv)
{
DeviceIntPtr pKeyboard, pPointer;
pPointer = AddInputDevice(xglMouseProc, TRUE);
pKeyboard = AddInputDevice(xglKeybdProc, TRUE);
RegisterPointerDevice(pPointer);
RegisterKeyboardDevice(pKeyboard);
miRegisterPointerDevice(screenInfo.screens[0], pPointer);
mieqInit(&pKeyboard->public, &pPointer->public);
}

188
hw/xgl/xgloutput.c Normal file
View File

@ -0,0 +1,188 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"
typedef struct _xglDepths {
CARD8 depth;
CARD8 bpp;
} XglDepths;
static XglDepths xglDepths[] = {
{ 1, 1 },
{ 4, 4 },
{ 8, 8 },
{ 15, 16 },
{ 16, 16 },
{ 24, 32 },
{ 32, 32 }
};
#define NUM_XGL_DEPTHS (sizeof (xglDepths) / sizeof (xglDepths[0]))
static void
xglSetPixmapFormats (ScreenInfo *pScreenInfo)
{
int i;
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
pScreenInfo->numPixmapFormats = 0;
for (i = 0; i < NUM_XGL_DEPTHS; i++)
{
PixmapFormatRec *format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats++];
format->depth = xglDepths[i].depth;
format->bitsPerPixel = xglDepths[i].bpp;
format->scanlinePad = BITMAP_SCANLINE_PAD;
}
}
#define xglQueryBestSize (void *) NoopDDA
#define xglSaveScreen (void *) NoopDDA
#define miGetImage (void *) NoopDDA
#define xglCreateWindow (void *) NoopDDA
#define xglDestroyWindow (void *) NoopDDA
#define xglPositionWindow (void *) NoopDDA
#define xglChangeWindowAttributes (void *) NoopDDA
#define xglRealizeWindow (void *) NoopDDA
#define xglUnrealizeWindow (void *) NoopDDA
#define xglPaintWindowBackground (void *) NoopDDA
#define xglPaintWindowBorder (void *) NoopDDA
#define xglCopyWindow (void *) NoopDDA
#define xglRealizeFont (void *) NoopDDA
#define xglUnrealizeFont (void *) NoopDDA
#define xglConstrainCursor (void *) NoopDDA
#define xglCursorLimits (void *) NoopDDA
#define xglDisplayCursor (void *) NoopDDA
#define xglRealizeCursor (void *) NoopDDA
#define xglUnrealizeCursor (void *) NoopDDA
#define xglRecolorCursor (void *) NoopDDA
#define xglSetCursorPosition (void *) NoopDDA
#define xglCreateColormap (void *) NoopDDA
#define xglDestroyColormap (void *) NoopDDA
#define xglInstallColormap (void *) NoopDDA
#define xglUninstallColormap (void *) NoopDDA
#define xglListInstalledColormaps (void *) NoopDDA
#define xglStoreColors (void *) NoopDDA
#define xglResolveColor (void *) NoopDDA
#define xglBitmapToRegion (void *) NoopDDA
static PixmapPtr
xglGetWindowPixmap (WindowPtr pWin)
{
return 0;
}
static void
xglSetWindowPixmap (WindowPtr pWin, PixmapPtr pPixmap)
{
}
static void
xglSetupScreen (ScreenPtr pScreen)
{
pScreen->defColormap = FakeClientID (0);
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
pScreen->QueryBestSize = xglQueryBestSize;
pScreen->SaveScreen = xglSaveScreen;
pScreen->GetImage = miGetImage;
pScreen->GetSpans = xglGetSpans;
pScreen->CreateWindow = xglCreateWindow;
pScreen->DestroyWindow = xglDestroyWindow;
pScreen->PositionWindow = xglPositionWindow;
pScreen->ChangeWindowAttributes = xglChangeWindowAttributes;
pScreen->RealizeWindow = xglRealizeWindow;
pScreen->UnrealizeWindow = xglUnrealizeWindow;
pScreen->PaintWindowBackground = xglPaintWindowBackground;
pScreen->PaintWindowBorder = xglPaintWindowBorder;
pScreen->CopyWindow = xglCopyWindow;
pScreen->CreatePixmap = xglCreatePixmap;
pScreen->DestroyPixmap = xglDestroyPixmap;
pScreen->RealizeFont = xglRealizeFont;
pScreen->UnrealizeFont = xglUnrealizeFont;
pScreen->ConstrainCursor = xglConstrainCursor;
pScreen->CursorLimits = xglCursorLimits;
pScreen->DisplayCursor = xglDisplayCursor;
pScreen->RealizeCursor = xglRealizeCursor;
pScreen->UnrealizeCursor = xglUnrealizeCursor;
pScreen->RecolorCursor = xglRecolorCursor;
pScreen->SetCursorPosition = xglSetCursorPosition;
pScreen->CreateGC = xglCreateGC;
pScreen->CreateColormap = miInitializeColormap;
pScreen->DestroyColormap = xglDestroyColormap;
pScreen->InstallColormap = miInstallColormap;
pScreen->UninstallColormap = miUninstallColormap;
pScreen->ListInstalledColormaps = miListInstalledColormaps;
pScreen->StoreColors = xglStoreColors;
pScreen->ResolveColor = miResolveColor;
pScreen->BitmapToRegion = xglBitmapToRegion;
pScreen->GetWindowPixmap = xglGetWindowPixmap;
pScreen->SetWindowPixmap = xglSetWindowPixmap;
}
static Bool
xglScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
{
VisualPtr visuals;
DepthPtr depths;
int nvisuals;
int ndepth;
int rootDepth;
VisualID defaultVisual;
rootDepth = 24;
miInitVisuals (&visuals, &depths, &nvisuals,
&ndepth, &rootDepth, &defaultVisual,
1 << 31, 8, -1);
miScreenInit (pScreen, 0, 800, 600, 96, 96, 800, rootDepth,
ndepth, depths, defaultVisual, nvisuals, visuals);
xglSetupScreen (pScreen);
if (!miCreateDefColormap (pScreen))
return FALSE;
return TRUE;
}
void
InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
{
xglSetPixmapFormats (pScreenInfo);
AddScreen (xglScreenInit, argc, argv);
}

68
hw/xgl/xglpixmap.c Normal file
View File

@ -0,0 +1,68 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"
PixmapPtr
xglCreatePixmap (ScreenPtr pScreen,
int width,
int height,
int depth)
{
PixmapPtr pPixmap;
pPixmap = AllocatePixmap (pScreen, 0);
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
pPixmap->drawable.class = 0;
pPixmap->drawable.pScreen = pScreen;
pPixmap->drawable.depth = depth;
pPixmap->drawable.bitsPerPixel = BitsPerPixel (depth);
pPixmap->drawable.id = 0;
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->drawable.x = 0;
pPixmap->drawable.y = 0;
pPixmap->drawable.width = width;
pPixmap->drawable.height = height;
#ifdef COMPOSITE
pPixmap->screen_x = 0;
pPixmap->screen_y = 0;
#endif
pPixmap->devKind = 0;
pPixmap->refcnt = 1;
pPixmap->devPrivate.ptr = 0;
return pPixmap;
}
Bool
xglDestroyPixmap (PixmapPtr pPixmap)
{
if(--pPixmap->refcnt)
return TRUE;
xfree(pPixmap);
return TRUE;
}

67
hw/xgl/xglspans.c Normal file
View File

@ -0,0 +1,67 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xgl.h"
void
xglFillSpans (DrawablePtr pDrawable,
GCPtr pGC,
int n,
DDXPointPtr ppt,
int *pwidth,
int fSorted)
{
}
void
xglSetSpans (DrawablePtr pDrawable,
GCPtr pGC,
char *src,
DDXPointPtr ppt,
int *pwidth,
int nspans,
int fSorted)
{
}
void
xglGetSpans(DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,
int *pwidth,
int nspans,
char *pchardstStart)
{
}
void
xglPushPixels (GCPtr pGC,
PixmapPtr pBitmap,
DrawablePtr pDrawable,
int dx,
int dy,
int xOrg,
int yOrg)
{
}

47
hw/xgl/xglx.c Normal file
View File

@ -0,0 +1,47 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "xglint.h"
#ifdef XGL_GLX_BACKEND
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <glitz-glx.h>
#include <GL/gl.h>
typedef struct _
#endif
#ifdef XGL_AGL_BACKEND
#include <glitz-agl.h>
#include <OpenGL/gl.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <math.h>