kdrive: Purge Xsdl
From the original Xsdl commit: "sdl x server so that we can x-on-x the fb stuff for ease of debugging. if anyone uses this in production, a big scary monster will eat them. hrm, perhaps i should make it have a --i-know-what-i'm-doing param that it doens't start without, heh" That should be reason enough to not spend time maintaing it. Also, no more elephants. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
f713f447a2
commit
52bc6d9449
|
@ -79,7 +79,6 @@ hw/dmx/examples/xtest
|
||||||
hw/kdrive/ephyr/Xephyr
|
hw/kdrive/ephyr/Xephyr
|
||||||
hw/kdrive/fake/Xfake
|
hw/kdrive/fake/Xfake
|
||||||
hw/kdrive/fbdev/Xfbdev
|
hw/kdrive/fbdev/Xfbdev
|
||||||
hw/kdrive/sdl/Xsdl
|
|
||||||
hw/kdrive/vesa/Xvesa
|
hw/kdrive/vesa/Xvesa
|
||||||
hw/vfb/Xvfb
|
hw/vfb/Xvfb
|
||||||
hw/vfb/Xvfb.1x
|
hw/vfb/Xvfb.1x
|
||||||
|
|
21
COPYING
21
COPYING
|
@ -1256,27 +1256,6 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
PERFORMANCE OF THIS SOFTWARE.
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
Copyright © 2004 PillowElephantBadgerBankPond
|
|
||||||
|
|
||||||
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 PillowElephantBadgerBankPond not be used in
|
|
||||||
advertising or publicity pertaining to distribution of the software without
|
|
||||||
specific, written prior permission. PillowElephantBadgerBankPond makes no
|
|
||||||
representations about the suitability of this software for any purpose. It
|
|
||||||
is provided "as is" without express or implied warranty.
|
|
||||||
|
|
||||||
PillowElephantBadgerBankPond DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
EVENT SHALL PillowElephantBadgerBankPond 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.
|
|
||||||
|
|
||||||
|
|
||||||
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -616,7 +616,6 @@ AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server
|
||||||
dnl kdrive and its subsystems
|
dnl kdrive and its subsystems
|
||||||
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
|
||||||
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
|
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
|
||||||
AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
|
|
||||||
AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
|
AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
|
||||||
AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
|
AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
|
||||||
|
|
||||||
|
@ -1861,9 +1860,6 @@ dnl kdrive DDX
|
||||||
|
|
||||||
XEPHYR_LIBS=
|
XEPHYR_LIBS=
|
||||||
XEPHYR_INCS=
|
XEPHYR_INCS=
|
||||||
XSDL_LIBS=
|
|
||||||
XSDL_INCS=
|
|
||||||
XSDL_DIRS=
|
|
||||||
|
|
||||||
AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
|
AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
|
||||||
if test "$KDRIVE" = yes; then
|
if test "$KDRIVE" = yes; then
|
||||||
|
@ -1908,18 +1904,6 @@ if test "$KDRIVE" = yes; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADERS([SDL/SDL.h])
|
|
||||||
if test x"$ac_cv_header_SDL_SDL_h" = xyes && test "x$XSDL" = xauto; then
|
|
||||||
XSDL=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$XSDL" = xyes; then
|
|
||||||
# PKG_CHECK_MODULES(XSDL_EXTRA, Xfont xau $XDMCP_MODULES)
|
|
||||||
AC_DEFINE(XSDLSERVER,1,[Build Xsdl server])
|
|
||||||
XSDL_LIBS="`sdl-config --libs`"
|
|
||||||
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xfont xau xdmcp"
|
XEPHYR_REQUIRED_LIBS="x11 $LIBXEXT xfont xau xdmcp"
|
||||||
if test "x$XV" = xyes; then
|
if test "x$XV" = xyes; then
|
||||||
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
|
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv"
|
||||||
|
@ -1961,8 +1945,6 @@ if test "$KDRIVE" = yes; then
|
||||||
|
|
||||||
AC_SUBST([XEPHYR_LIBS])
|
AC_SUBST([XEPHYR_LIBS])
|
||||||
AC_SUBST([XEPHYR_INCS])
|
AC_SUBST([XEPHYR_INCS])
|
||||||
AC_SUBST([XSDL_LIBS])
|
|
||||||
AC_SUBST([XSDL_INCS])
|
|
||||||
fi
|
fi
|
||||||
AC_SUBST([KDRIVE_INCS])
|
AC_SUBST([KDRIVE_INCS])
|
||||||
AC_SUBST([KDRIVE_PURE_INCS])
|
AC_SUBST([KDRIVE_PURE_INCS])
|
||||||
|
@ -1974,7 +1956,6 @@ AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
|
||||||
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
|
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
|
||||||
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
|
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
|
||||||
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
|
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
|
||||||
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
|
|
||||||
AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
|
AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
|
||||||
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
|
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
|
||||||
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
|
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
|
||||||
|
|
|
@ -6,10 +6,6 @@ if XFAKESERVER
|
||||||
XFAKE_SUBDIRS = fake
|
XFAKE_SUBDIRS = fake
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if XSDLSERVER
|
|
||||||
XSDL_SUBDIRS = sdl
|
|
||||||
endif
|
|
||||||
|
|
||||||
if XEPHYR
|
if XEPHYR
|
||||||
XEPHYR_SUBDIRS = ephyr
|
XEPHYR_SUBDIRS = ephyr
|
||||||
endif
|
endif
|
||||||
|
@ -19,7 +15,6 @@ LINUX_SUBDIRS = linux
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SERVER_SUBDIRS = \
|
SERVER_SUBDIRS = \
|
||||||
$(XSDL_SUBDIRS) \
|
|
||||||
$(FBDEV_SUBDIRS) \
|
$(FBDEV_SUBDIRS) \
|
||||||
$(XEPHYR_SUBDIRS) \
|
$(XEPHYR_SUBDIRS) \
|
||||||
$(XFAKE_SUBDIRS)
|
$(XFAKE_SUBDIRS)
|
||||||
|
@ -29,7 +24,7 @@ SUBDIRS = \
|
||||||
$(LINUX_SUBDIRS) \
|
$(LINUX_SUBDIRS) \
|
||||||
$(SERVER_SUBDIRS)
|
$(SERVER_SUBDIRS)
|
||||||
|
|
||||||
DIST_SUBDIRS = fbdev sdl ephyr src linux fake
|
DIST_SUBDIRS = fbdev ephyr src linux fake
|
||||||
|
|
||||||
relink:
|
relink:
|
||||||
@for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done
|
@for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
INCLUDES = \
|
|
||||||
@KDRIVE_PURE_INCS@ \
|
|
||||||
@KDRIVE_CFLAGS@ \
|
|
||||||
@XSDL_INCS@
|
|
||||||
|
|
||||||
bin_PROGRAMS = Xsdl
|
|
||||||
|
|
||||||
Xsdl_SOURCES = sdl.c
|
|
||||||
|
|
||||||
Xsdl_LDADD = \
|
|
||||||
@KDRIVE_LIBS@ \
|
|
||||||
@XSDL_LIBS@
|
|
||||||
|
|
||||||
Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
|
|
||||||
|
|
||||||
Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
|
|
||||||
|
|
||||||
relink:
|
|
||||||
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
|
|
|
@ -1,342 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2004 PillowElephantBadgerBankPond
|
|
||||||
|
|
||||||
* 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 PillowElephantBadgerBankPond not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. PillowElephantBadgerBankPond makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* PillowElephantBadgerBankPond DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL PillowElephantBadgerBankPond 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.
|
|
||||||
*
|
|
||||||
* It's really not my fault - see it was the elephants!!
|
|
||||||
* - jaymz
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "kdrive-config.h"
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
#include <SDL/SDL.h>
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
|
|
||||||
static void xsdlFini(void);
|
|
||||||
static Bool sdlScreenInit(KdScreenInfo *screen);
|
|
||||||
static Bool sdlFinishInitScreen(ScreenPtr pScreen);
|
|
||||||
static Bool sdlCreateRes(ScreenPtr pScreen);
|
|
||||||
|
|
||||||
static void sdlKeyboardFini(KdKeyboardInfo *ki);
|
|
||||||
static Bool sdlKeyboardInit(KdKeyboardInfo *ki);
|
|
||||||
|
|
||||||
static Bool sdlMouseInit(KdPointerInfo *pi);
|
|
||||||
static void sdlMouseFini(KdPointerInfo *pi);
|
|
||||||
|
|
||||||
void *sdlShadowWindow (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure);
|
|
||||||
void sdlShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
|
|
||||||
|
|
||||||
void sdlTimer(void);
|
|
||||||
|
|
||||||
KdKeyboardInfo *sdlKeyboard = NULL;
|
|
||||||
KdPointerInfo *sdlPointer = NULL;
|
|
||||||
|
|
||||||
KdKeyboardDriver sdlKeyboardDriver = {
|
|
||||||
.name = "keyboard",
|
|
||||||
.Init = sdlKeyboardInit,
|
|
||||||
.Fini = sdlKeyboardFini,
|
|
||||||
};
|
|
||||||
|
|
||||||
KdPointerDriver sdlMouseDriver = {
|
|
||||||
.name = "mouse",
|
|
||||||
.Init = sdlMouseInit,
|
|
||||||
.Fini = sdlMouseFini,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
KdCardFuncs sdlFuncs = {
|
|
||||||
.scrinit = sdlScreenInit, /* scrinit */
|
|
||||||
.finishInitScreen = sdlFinishInitScreen, /* finishInitScreen */
|
|
||||||
.createRes = sdlCreateRes, /* createRes */
|
|
||||||
};
|
|
||||||
|
|
||||||
int mouseState=0;
|
|
||||||
|
|
||||||
struct SdlDriver
|
|
||||||
{
|
|
||||||
SDL_Surface *screen;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Bool sdlScreenInit(KdScreenInfo *screen)
|
|
||||||
{
|
|
||||||
struct SdlDriver *sdlDriver=calloc(1, sizeof(struct SdlDriver));
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("sdlScreenInit()\n");
|
|
||||||
#endif
|
|
||||||
if (!screen->width || !screen->height)
|
|
||||||
{
|
|
||||||
screen->width = 640;
|
|
||||||
screen->height = 480;
|
|
||||||
}
|
|
||||||
if (!screen->fb[0].depth)
|
|
||||||
screen->fb[0].depth = 4;
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Attempting for %dx%d/%dbpp mode\n", screen->width, screen->height, screen->fb[0].depth);
|
|
||||||
#endif
|
|
||||||
sdlDriver->screen=SDL_SetVideoMode(screen->width, screen->height, screen->fb[0].depth, 0);
|
|
||||||
if(sdlDriver->screen==NULL)
|
|
||||||
return FALSE;
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Set %dx%d/%dbpp mode\n", sdlDriver->screen->w, sdlDriver->screen->h, sdlDriver->screen->format->BitsPerPixel);
|
|
||||||
#endif
|
|
||||||
screen->width=sdlDriver->screen->w;
|
|
||||||
screen->height=sdlDriver->screen->h;
|
|
||||||
screen->fb[0].depth=sdlDriver->screen->format->BitsPerPixel;
|
|
||||||
screen->fb[0].visuals=(1<<TrueColor);
|
|
||||||
screen->fb[0].redMask=sdlDriver->screen->format->Rmask;
|
|
||||||
screen->fb[0].greenMask=sdlDriver->screen->format->Gmask;
|
|
||||||
screen->fb[0].blueMask=sdlDriver->screen->format->Bmask;
|
|
||||||
screen->fb[0].bitsPerPixel=sdlDriver->screen->format->BitsPerPixel;
|
|
||||||
screen->rate=60;
|
|
||||||
screen->memory_base=(CARD8 *)sdlDriver->screen->pixels;
|
|
||||||
screen->memory_size=0;
|
|
||||||
screen->off_screen_base=0;
|
|
||||||
screen->driver=sdlDriver;
|
|
||||||
screen->fb[0].byteStride=(sdlDriver->screen->w*sdlDriver->screen->format->BitsPerPixel)/8;
|
|
||||||
screen->fb[0].pixelStride=sdlDriver->screen->w;
|
|
||||||
screen->fb[0].frameBuffer=(CARD8 *)sdlDriver->screen->pixels;
|
|
||||||
SDL_WM_SetCaption("Freedesktop.org X server (SDL)", NULL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sdlShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
|
|
||||||
{
|
|
||||||
KdScreenPriv(pScreen);
|
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
|
||||||
struct SdlDriver *sdlDriver=screen->driver;
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Shadow update()\n");
|
|
||||||
#endif
|
|
||||||
if(SDL_MUSTLOCK(sdlDriver->screen))
|
|
||||||
{
|
|
||||||
if(SDL_LockSurface(sdlDriver->screen)<0)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Couldn't lock SDL surface - d'oh!\n");
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(SDL_MUSTLOCK(sdlDriver->screen))
|
|
||||||
SDL_UnlockSurface(sdlDriver->screen);
|
|
||||||
SDL_UpdateRect(sdlDriver->screen, 0, 0, sdlDriver->screen->w, sdlDriver->screen->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void *sdlShadowWindow (ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, CARD32 *size, void *closure)
|
|
||||||
{
|
|
||||||
KdScreenPriv(pScreen);
|
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
|
||||||
struct SdlDriver *sdlDriver=screen->driver;
|
|
||||||
*size=(sdlDriver->screen->w*sdlDriver->screen->format->BitsPerPixel)/8;
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Shadow window()\n");
|
|
||||||
#endif
|
|
||||||
return (void *)((CARD8 *)sdlDriver->screen->pixels + row * (*size) + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Bool sdlCreateRes(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdScreenPriv(pScreen);
|
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
|
||||||
KdShadowFbAlloc(screen, 0, FALSE);
|
|
||||||
KdShadowSet(pScreen, RR_Rotate_0, sdlShadowUpdate, sdlShadowWindow);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool sdlFinishInitScreen(ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
if (!shadowSetup (pScreen))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef RANDR
|
|
||||||
if (!sdlRandRInit (pScreen))
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sdlKeyboardFini(KdKeyboardInfo *ki)
|
|
||||||
{
|
|
||||||
sdlKeyboard = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool sdlKeyboardInit(KdKeyboardInfo *ki)
|
|
||||||
{
|
|
||||||
ki->minScanCode = 8;
|
|
||||||
ki->maxScanCode = 255;
|
|
||||||
|
|
||||||
sdlKeyboard = ki;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool sdlMouseInit (KdPointerInfo *pi)
|
|
||||||
{
|
|
||||||
sdlPointer = pi;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sdlMouseFini(KdPointerInfo *pi)
|
|
||||||
{
|
|
||||||
sdlPointer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InitCard(char *name)
|
|
||||||
{
|
|
||||||
KdCardAttr attr;
|
|
||||||
KdCardInfoAdd (&sdlFuncs, &attr, 0);
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("InitCard: %s\n", name);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
|
||||||
{
|
|
||||||
KdInitOutput(pScreenInfo, argc, argv);
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("InitOutput()\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitInput(int argc, char **argv)
|
|
||||||
{
|
|
||||||
KdPointerInfo *pi;
|
|
||||||
KdKeyboardInfo *ki;
|
|
||||||
|
|
||||||
KdAddKeyboardDriver(&sdlKeyboardDriver);
|
|
||||||
KdAddPointerDriver(&sdlMouseDriver);
|
|
||||||
|
|
||||||
ki = KdParseKeyboard("keyboard");
|
|
||||||
KdAddKeyboard(ki);
|
|
||||||
pi = KdParsePointer("mouse");
|
|
||||||
KdAddPointer(pi);
|
|
||||||
|
|
||||||
KdInitInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DDXBEFORERESET
|
|
||||||
void ddxBeforeReset(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ddxUseMsg(void)
|
|
||||||
{
|
|
||||||
KdUseMsg();
|
|
||||||
}
|
|
||||||
|
|
||||||
int ddxProcessArgument(int argc, char **argv, int i)
|
|
||||||
{
|
|
||||||
return KdProcessArgument(argc, argv, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void sdlTimer(void)
|
|
||||||
{
|
|
||||||
static int buttonState=0;
|
|
||||||
SDL_Event event;
|
|
||||||
SDL_ShowCursor(FALSE);
|
|
||||||
/* get the mouse state */
|
|
||||||
while ( SDL_PollEvent(&event) ) {
|
|
||||||
switch (event.type) {
|
|
||||||
case SDL_MOUSEMOTION:
|
|
||||||
KdEnqueuePointerEvent(sdlPointer, mouseState, event.motion.x, event.motion.y, 0);
|
|
||||||
break;
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
|
||||||
switch(event.button.button)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
buttonState=KD_BUTTON_1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
buttonState=KD_BUTTON_2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
buttonState=KD_BUTTON_3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mouseState|=buttonState;
|
|
||||||
KdEnqueuePointerEvent(sdlPointer, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
|
||||||
break;
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
|
||||||
switch(event.button.button)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
buttonState=KD_BUTTON_1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
buttonState=KD_BUTTON_2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
buttonState=KD_BUTTON_3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
mouseState &= ~buttonState;
|
|
||||||
KdEnqueuePointerEvent(sdlPointer, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
|
||||||
break;
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
case SDL_KEYUP:
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Keycode: %d\n", event.key.keysym.scancode);
|
|
||||||
#endif
|
|
||||||
KdEnqueueKeyboardEvent (sdlKeyboard, event.key.keysym.scancode, event.type==SDL_KEYUP);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDL_QUIT:
|
|
||||||
/* this should never happen */
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int xsdlInit(void)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Calling SDL_Init()\n");
|
|
||||||
#endif
|
|
||||||
return SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void xsdlFini(void)
|
|
||||||
{
|
|
||||||
SDL_Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOsFuncs sdlOsFuncs={
|
|
||||||
.Init = xsdlInit,
|
|
||||||
.Fini = xsdlFini,
|
|
||||||
.pollEvents = sdlTimer,
|
|
||||||
};
|
|
||||||
|
|
||||||
void OsVendorInit (void)
|
|
||||||
{
|
|
||||||
KdOsInit (&sdlOsFuncs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue