diff --git a/configure.ac b/configure.ac index ccb7c29f5..4d654da90 100644 --- a/configure.ac +++ b/configure.ac @@ -40,8 +40,6 @@ AC_CONFIG_HEADERS(include/xorg-server.h) dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just dnl dix/). AC_CONFIG_HEADERS(include/dix-config.h) -dnl xgl-config.h covers the Xgl DDX. -AC_CONFIG_HEADERS(include/xgl-config.h) dnl xorg-config.h covers the Xorg DDX. AC_CONFIG_HEADERS(include/xorg-config.h) dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs. @@ -567,9 +565,6 @@ AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto]) AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto]) AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto]) -AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no]) -AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no]) -AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no]) dnl legacy fb support AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no]) dnl kdrive and its subsystems @@ -1252,62 +1247,6 @@ if test "x$XORG" = xauto; then fi AC_MSG_RESULT([$XORG]) -dnl Xgl DDX - -AC_MSG_CHECKING([whether to build Xgl DDX]) -if test "x$XGL" != xno; then - PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XGL=yes], [XGL=no]) - AC_SUBST(XGLMODULES_CFLAGS) -fi -AC_MSG_RESULT([$XGL]) -AM_CONDITIONAL(XGL, [test "x$XGL" = xyes]) - -if test "x$XGL" = xyes; then - XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB" - XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS" - AC_SUBST([XGL_LIBS]) - AC_SUBST([XGL_SYS_LIBS]) - AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules]) - - xglmoduledir="$moduledir/xgl" - AC_SUBST([xglmoduledir]) - AC_DEFINE_DIR(XGL_MODULE_PATH, xglmoduledir, [Default XGL module search path]) -fi - -dnl Xegl DDX - -AC_MSG_CHECKING([whether to build Xegl DDX]) -if test "x$XEGL" != xno; then - PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XEGL=yes], [XEGL=no]) - AC_SUBST(XEGLMODULES_CFLAGS) -fi -AC_MSG_RESULT([$XEGL]) -AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes]) - -if test "x$XEGL" = xyes; then - XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB" - XEGL_SYS_LIBS = "$XEGL_SYS_LIBS $XEGLMODULES_LIBS $GLX_SYS_LIBS" - AC_SUBST([XEGL_LIBS]) - AC_SUBST([XEGL_SYS_LIBS]) -fi - -dnl Xglx DDX - -AC_MSG_CHECKING([whether to build Xglx DDX]) -if test "x$XGLX" != xno; then - PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= 0.4.3 xrender], [XGLX=yes], [XGLX=no]) - AC_SUBST(XGLXMODULES_CFLAGS) -fi -AC_MSG_RESULT([$XGLX]) -AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes]) - -if test "x$XGLX" = xyes; then - XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB" - XGLX_SYS_LIBS="$XGLX_SYS_LIBS $XGLXMODULES_LIBS $GLX_SYS_LIBS" - AC_SUBST([XGLX_LIBS]) - AC_SUBST([XGLX_SYS_LIBS]) -fi - xorg_bus_linuxpci=no xorg_bus_bsdpci=no xorg_bus_ix86pci=no @@ -1315,7 +1254,7 @@ xorg_bus_ppcpci=no xorg_bus_sparcpci=no xorg_bus_sparc=no -if test "x$XORG" = xyes -o "x$XGL" = xyes; then +if test "x$XORG" = xyes; then XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common' XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os' XORG_INCS="$XORG_DDXINCS $XORG_OSINCS" @@ -2054,13 +1993,6 @@ hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile hw/vfb/Makefile -hw/xgl/Makefile -hw/xgl/egl/Makefile -hw/xgl/egl/module/Makefile -hw/xgl/glx/Makefile -hw/xgl/glx/module/Makefile -hw/xgl/glxext/Makefile -hw/xgl/glxext/module/Makefile hw/xnest/Makefile hw/xwin/Makefile hw/xquartz/Makefile diff --git a/hw/Makefile.am b/hw/Makefile.am index 4589b7eef..7409906a8 100644 --- a/hw/Makefile.am +++ b/hw/Makefile.am @@ -18,10 +18,6 @@ if XWIN XWIN_SUBDIRS = xwin endif -if XGL -XGL_SUBDIRS = xgl -endif - if KDRIVE KDRIVE_SUBDIRS = kdrive endif @@ -32,7 +28,6 @@ endif SUBDIRS = \ $(XORG_SUBDIRS) \ - $(XGL_SUBDIRS) \ $(XWIN_SUBDIRS) \ $(XVFB_SUBDIRS) \ $(XNEST_SUBDIRS) \ @@ -40,7 +35,7 @@ SUBDIRS = \ $(KDRIVE_SUBDIRS) \ $(XQUARTZ_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl +DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive relink: for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done diff --git a/hw/xgl/Makefile.am b/hw/xgl/Makefile.am deleted file mode 100644 index 8df8ae9af..000000000 --- a/hw/xgl/Makefile.am +++ /dev/null @@ -1,83 +0,0 @@ -if GLX -GLX_SUBDIRS = glxext -endif - -if XGLX -XGLX_SUBDIRS = glx -endif - -if XEGL -XEGL_SUBDIRS = egl -endif - -DIST_SUBDIRS = glxext glx egl - -SUBDIRS = \ - . \ - $(GLX_SUBDIRS) \ - $(XGLX_SUBDIRS) \ - $(XEGL_SUBDIRS) - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DHAVE_XGL_CONFIG_H \ - -DHAVE_DIX_CONFIG_H \ - -I$(top_srcdir)/glx \ - -I$(top_srcdir)/GL/include \ - -I@MESA_SOURCE@/include \ - -I@MESA_SOURCE@/src/mesa/glapi \ - $(XGLMODULES_CFLAGS) - -noinst_LIBRARIES = libxgl.a - -libxgl_a_SOURCES = \ - xgl.h \ - xglmodule.h \ - xglglx.h \ - xglinput.c \ - xgloutput.c \ - xglcmap.c \ - xglparse.c \ - xglscreen.c \ - xglarea.c \ - xglgeometry.c \ - xglpixmap.c \ - xglsync.c \ - xglsolid.c \ - xgltile.c \ - xglcopy.c \ - xglfill.c \ - xglwindow.c \ - xglget.c \ - xglgc.c \ - xglshm.c \ - xglcompose.c \ - xglpict.c \ - xglglyph.c \ - xgltrap.c \ - xglloader.c \ - xglhash.c \ - xglglx.c \ - xglxv.c - -EXTRA_DIST = \ - xglmodule.h - -Xgl_LDFLAGS = -export-dynamic -Xgl_SOURCES = \ - xglinit.c \ - $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ - $(top_srcdir)/fb/fbcmap.c - -XGL_LIBS = \ - libxgl.a \ - @XGL_LIBS@ \ - $(XSERVER_LIBS) - -Xgl_DEPENDENCIES = $(XGL_LIBS) -Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS) -Xgl_programs = Xgl - -bin_PROGRAMS = $(Xgl_programs) diff --git a/hw/xgl/egl/Makefile.am b/hw/xgl/egl/Makefile.am deleted file mode 100644 index 8c4e9af75..000000000 --- a/hw/xgl/egl/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -if XGL -XGL_MODULE_DIRS = module -endif - -DIST_SUBDIRS = module - -SUBDIRS = \ - . \ - $(XGL_MODULE_DIRS) - -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -DHAVE_XGL_CONFIG_H \ - -DHAVE_DIX_CONFIG_H \ - $(XEGLMODULES_CFLAGS) - -noinst_LTLIBRARIES = libxegl.la - -libxegl_la_SOURCES = \ - xegl.h \ - xegl.c \ - xeglinput.c \ - kkeymap.h \ - kinput.c \ - evdev.c - -XEGL_LIBS = \ - @XEGL_LIBS@ \ - libxegl.la \ - ../libxgl.a \ - $XSERVER_LIBS - -Xegl_LDFLAGS = -export-dynamic -Xegl_SOURCES = \ - xeglinit.c \ - $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ - $(top_srcdir)/fb/fbcmap.c - -Xegl_DEPENDENCIES = $(XEGL_LIBS) -Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS) - -bin_PROGRAMS = Xegl diff --git a/hw/xgl/egl/evdev.c b/hw/xgl/egl/evdev.c deleted file mode 100644 index fff4524d1..000000000 --- a/hw/xgl/egl/evdev.c +++ /dev/null @@ -1,646 +0,0 @@ -/* - * 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 -#define NEED_EVENTS -#include -#include -#include -#include -#include -#define XK_PUBLISHING -#include -#include "inputstr.h" -#include "kkeymap.h" -#include "scrnintstr.h" -#include "xegl.h" - -#define NUM_EVENTS 128 -#define ABS_UNSET -65535 - -#define BITS_PER_LONG (sizeof(long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y)) -#define OFF(x) ((x)%BITS_PER_LONG) -#define LONG(x) ((x)/BITS_PER_LONG) -#define BIT(x) (1 << OFF(x)) -#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y)) -#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y)) -#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y))) - -typedef struct _kevdevMouse { - /* current device state */ - int rel[REL_MAX + 1]; - int abs[ABS_MAX + 1]; - int prevabs[ABS_MAX + 1]; - long key[NBITS(KEY_MAX + 1)]; - - /* supported device info */ - long relbits[NBITS(REL_MAX + 1)]; - long absbits[NBITS(ABS_MAX + 1)]; - long keybits[NBITS(KEY_MAX + 1)]; - struct input_absinfo absinfo[ABS_MAX + 1]; - int max_rel; - int max_abs; -} Kevdev; - -static int flags = 0; - -static void -EvdevMotion (KdMouseInfo *mi) -{ - Kevdev *ke = mi->driver; - int i; - - for (i = 0; i <= ke->max_rel; i++) - if (ke->rel[i]) - { - KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]); - int a; -// ErrorF ("rel"); - for (a = 0; a <= ke->max_rel; a++) - { -// if (ISBITSET (ke->relbits, a)) -// ErrorF (" %d=%d", a, ke->rel[a]); - ke->rel[a] = 0; - } -// ErrorF ("\n"); - break; - } - for (i = 0; i < ke->max_abs; i++) - if (ke->abs[i] != ke->prevabs[i]) - { - KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]); - int a; -// ErrorF ("abs"); - for (a = 0; a <= ke->max_abs; a++) - { -// if (ISBITSET (ke->absbits, a)) -// ErrorF (" %d=%d", a, ke->abs[a]); - ke->prevabs[a] = ke->abs[a]; - } -// ErrorF ("\n"); - break; - } -} - -static void -EvdevRead (int evdevPort, void *closure) -{ - KdMouseInfo *mi = closure; - Kevdev *ke = mi->driver; - int i, n; - struct input_event events[NUM_EVENTS]; - - n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event)); - if (n <= 0) - return; - n /= sizeof (struct input_event); - for (i = 0; i < n; i++) - { - switch (events[i].type) { - case EV_SYN: - break; - case EV_KEY: - EvdevMotion (mi); - ASSIGNBIT(ke->key,events[i].code, events[i].value); - if (events[i].code < 0x100) - ErrorF ("key %d %d\n", events[i].code, events[i].value); - else - ErrorF ("key 0x%x %d\n", events[i].code, events[i].value); - - if (events[i].value==1) { - switch (events[i].code) { - case BTN_LEFT: - flags |= KD_BUTTON_1; - break; - case BTN_RIGHT: - flags |= KD_BUTTON_3; - break; - case BTN_MIDDLE: - flags |= KD_BUTTON_2; - break; - case BTN_FORWARD: - flags |= KD_BUTTON_4; - break; - case BTN_BACK: - flags |= KD_BUTTON_5; - break; - } - } - else if (events[i].value==0) { - switch (events[i].code) { - case BTN_LEFT: - flags &= ~KD_BUTTON_1; - break; - case BTN_RIGHT: - flags &= ~KD_BUTTON_3; - break; - case BTN_MIDDLE: - flags &= ~KD_BUTTON_2; - break; - case BTN_FORWARD: - flags &= ~KD_BUTTON_4; - break; - case BTN_BACK: - flags &= ~KD_BUTTON_5; - break; - } - } - KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0); - break; - case EV_REL: - ke->rel[events[i].code] += events[i].value; - break; - case EV_ABS: - ke->abs[events[i].code] = events[i].value; - break; - } - } - EvdevMotion (mi); -} - -int EvdevInputType; - -char *kdefaultEvdev[] = { - // "/dev/input/event0", - "/dev/input/event1", - // "/dev/input/event2", - // "/dev/input/event3", - // "/dev/input/event4", - // "/dev/input/event5", -}; - -#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0])) - -static Bool -EvdevInit (void) -{ - int i; - int fd; - KdMouseInfo *mi, *next; - int n = 0; - char *prot; - char name[100]; - - if (!EvdevInputType) - EvdevInputType = KdAllocInputType (); - - for (mi = kdMouseInfo; mi; mi = next) - { - next = mi->next; - prot = mi->prot; - if (mi->inputType) - continue; - if (!mi->name) - { - for (i = 0; i < NUM_DEFAULT_EVDEV; i++) - { - fd = open (kdefaultEvdev[i], 2); - if (fd >= 0) - { - ioctl(fd, EVIOCGRAB, 1); - - ioctl(fd, EVIOCGNAME(sizeof(name)), name); - ErrorF("Name is %s\n", name); - ioctl(fd, EVIOCGPHYS(sizeof(name)), name); - ErrorF("Phys Loc is %s\n", name); - ioctl(fd, EVIOCGUNIQ(sizeof(name)), name); - ErrorF("Unique is %s\n", name); - - mi->name = KdSaveString (kdefaultEvdev[i]); - break; - } - } - } - else - fd = open (mi->name, 2); - - if (fd >= 0) - { - unsigned long ev[NBITS(EV_MAX)]; - Kevdev *ke; - - if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) - { - perror ("EVIOCGBIT 0"); - close (fd); - continue; - } - ke = xalloc (sizeof (Kevdev)); - if (!ke) - { - close (fd); - continue; - } - memset (ke, '\0', sizeof (Kevdev)); - if (ISBITSET (ev, EV_KEY)) - { - if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)), - ke->keybits) < 0) - { - perror ("EVIOCGBIT EV_KEY"); - xfree (ke); - close (fd); - continue; - } - } - if (ISBITSET (ev, EV_REL)) - { - if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)), - ke->relbits) < 0) - { - perror ("EVIOCGBIT EV_REL"); - xfree (ke); - close (fd); - continue; - } - for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--) - if (ISBITSET(ke->relbits, ke->max_rel)) - break; - } - if (ISBITSET (ev, EV_ABS)) - { - int i; - - if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)), - ke->absbits) < 0) - { - perror ("EVIOCGBIT EV_ABS"); - xfree (ke); - close (fd); - continue; - } - for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--) - if (ISBITSET(ke->absbits, ke->max_abs)) - break; - for (i = 0; i <= ke->max_abs; i++) - { - if (ISBITSET (ke->absbits, i)) - if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0) - { - perror ("EVIOCGABS"); - break; - } - ke->prevabs[i] = ABS_UNSET; - } - if (i <= ke->max_abs) - { - xfree (ke); - close (fd); - continue; - } - } - mi->driver = ke; - mi->inputType = EvdevInputType; - if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi)) - n++; - } - } - return TRUE; -} - -static void -EvdevFini (void) -{ - KdMouseInfo *mi; - - KdUnregisterFds (EvdevInputType, TRUE); - for (mi = kdMouseInfo; mi; mi = mi->next) - { - if (mi->inputType == EvdevInputType) - { - xfree (mi->driver); - mi->driver = 0; - mi->inputType = 0; - } - } -} - -KdMouseFuncs LinuxEvdevMouseFuncs = { - EvdevInit, - EvdevFini, -}; - - -KeySym evdevKeymap[(112 - 1 + 1) * 2] = { -/* These are directly mapped from DOS scanset 0 */ -/* 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 */ NoSymbol, NoSymbol, -/* 109 116 */ NoSymbol, NoSymbol, -/* 110 117 */ NoSymbol, NoSymbol, -/* 111 118 */ NoSymbol, NoSymbol, -/* 112 119 */ NoSymbol, NoSymbol, -}; - -static void -EvdevRead1 (int evdevPort, void *closure) -{ - int i, n, xk; - struct input_event events[NUM_EVENTS]; - - n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event)); - if (n <= 0) - return; - n /= sizeof (struct input_event); - for (i = 0; i < n; i++) - { - switch (events[i].type) { - case EV_SYN: - break; - case EV_KEY: - xk = events[i].code; - if (events[i].code < 0x100) - ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk); - else - ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk); - if (events[i].value == 2) { - //KdEnqueueKeyboardEvent (xk, 0); - KdEnqueueKeyboardEvent (xk, 0); - } else - KdEnqueueKeyboardEvent (xk, !events[i].value); - break; - } - } -} - -char *kdefaultEvdev1[] = { - "/dev/input/event0", - // "/dev/input/event1", - // "/dev/input/event2", - // "/dev/input/event3", - // "/dev/input/event4", - // "/dev/input/event5", -}; - -#define NUM_DEFAULT_EVDEV1 (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0])) - -static Bool -EvdevKbdInit (void) -{ - int i; - int fd; - int n = 0; - char name[100]; - - if (!EvdevInputType) - EvdevInputType = KdAllocInputType (); - - for (i = 0; i < NUM_DEFAULT_EVDEV; i++) - { - fd = open (kdefaultEvdev1[i], 2); - if (fd >= 0) - { - ioctl(fd, EVIOCGRAB, 1); - - ioctl(fd, EVIOCGNAME(sizeof(name)), name); - ErrorF("Name is %s\n", name); - ioctl(fd, EVIOCGPHYS(sizeof(name)), name); - ErrorF("Phys Loc is %s\n", name); - ioctl(fd, EVIOCGUNIQ(sizeof(name)), name); - ErrorF("Unique is %s\n", name); - - } - - if (fd >= 0) - { - unsigned long ev[NBITS(EV_MAX)]; - Kevdev *ke; - - if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) - { - perror ("EVIOCGBIT 0"); - close (fd); - continue; - } - ke = xalloc (sizeof (Kevdev)); - if (!ke) - { - close (fd); - continue; - } - memset (ke, '\0', sizeof (Kevdev)); - if (ISBITSET (ev, EV_KEY)) - { - if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)), - ke->keybits) < 0) - { - perror ("EVIOCGBIT EV_KEY"); - xfree (ke); - close (fd); - continue; - } - } - if (ISBITSET (ev, EV_REL)) - { - if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)), - ke->relbits) < 0) - { - perror ("EVIOCGBIT EV_REL"); - xfree (ke); - close (fd); - continue; - } - for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--) - if (ISBITSET(ke->relbits, ke->max_rel)) - break; - } - if (ISBITSET (ev, EV_ABS)) - { - int i; - - if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)), - ke->absbits) < 0) - { - perror ("EVIOCGBIT EV_ABS"); - xfree (ke); - close (fd); - continue; - } - for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--) - if (ISBITSET(ke->absbits, ke->max_abs)) - break; - for (i = 0; i <= ke->max_abs; i++) - { - if (ISBITSET (ke->absbits, i)) - if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0) - { - perror ("EVIOCGABS"); - break; - } - ke->prevabs[i] = ABS_UNSET; - } - if (i <= ke->max_abs) - { - xfree (ke); - close (fd); - continue; - } - } - if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL)) - n++; - } - } - return TRUE; -} - -static void EvdevKbdLoad(void) -{ - kdMinScanCode = 1; - kdMaxScanCode = 112; - kdKeymapWidth = 2; - memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap)); -} - -static void -EvdevKbdFini (void) -{ -} - -static void -EvdevKbdLeds (int leds) -{ -} - - -static void EvdevKbdBell(int volume, int pitch, int duration) -{ -} - - -KdKeyboardFuncs LinuxEvdevKeyboardFuncs = { - EvdevKbdLoad, - EvdevKbdInit, - EvdevKbdLeds, - EvdevKbdBell, - EvdevKbdFini, - 0, -}; diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c deleted file mode 100644 index 6c1018cb3..000000000 --- a/hw/xgl/egl/kinput.c +++ /dev/null @@ -1,1670 +0,0 @@ -/* - * 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. - */ - -#include - -#include -#include - -#include "xegl.h" -#include "mipointer.h" -#include "inputstr.h" - -#define XK_PUBLISHING -#include -#if HAVE_X11_XF86KEYSYM_H -#include -#endif -#include "kkeymap.h" - -#ifdef XKB -#define XKB_IN_SERVER -#include -#endif - -static DeviceIntPtr pKdKeyboard, pKdPointer; - -#define MAX_MOUSE_DRIVERS 6 - -static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS]; -static int kdNMouseFuncs; -static KdKeyboardFuncs *kdKeyboardFuncs; -static int kdBellPitch; -static int kdBellDuration; -static int kdLeds; -static Bool kdInputEnabled; -static Bool kdOffScreen; -static unsigned long kdOffScreenTime; -static KdMouseMatrix kdMouseMatrix = { - { { 1, 0, 0 }, - { 0, 1, 0 } } -}; - -int kdMouseButtonCount; -int kdMinScanCode; -int kdMaxScanCode; -int kdMinKeyCode; -int kdMaxKeyCode; -int kdKeymapWidth = KD_MAX_WIDTH; -KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH]; -CARD8 kdModMap[MAP_LENGTH]; -KeySymsRec kdKeySyms; - - -void -KdResetInputMachine (void); - -#define KD_KEY_COUNT 248 - -CARD8 kdKeyState[KD_KEY_COUNT/8]; - -#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1) - -#define KD_MAX_INPUT_FDS 8 - -typedef struct _kdInputFd { - int type; - int fd; - void (*read) (int fd, void *closure); - int (*enable) (int fd, void *closure); - void (*disable) (int fd, void *closure); - void *closure; -} KdInputFd; - -KdInputFd kdInputFds[KD_MAX_INPUT_FDS]; -int kdNumInputFds; -int kdInputTypeSequence; - -static void -KdSigio (int sig) -{ - int i; - - for (i = 0; i < kdNumInputFds; i++) - (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); -} - -static void -KdBlockSigio (void) -{ - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_BLOCK, &set, 0); -} - -static void -KdUnblockSigio (void) -{ - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_UNBLOCK, &set, 0); -} - -#undef VERIFY_SIGIO -#ifdef VERIFY_SIGIO - -void -KdAssertSigioBlocked (char *where) -{ - sigset_t set, old; - - sigemptyset (&set); - sigprocmask (SIG_BLOCK, &set, &old); - if (!sigismember (&old, SIGIO)) - ErrorF ("SIGIO not blocked at %s\n", where); -} - -#else - -#define KdAssertSigioBlocked(s) - -#endif - -static int kdnFds; - -#ifdef FNONBLOCK -#define NOBLOCK FNONBLOCK -#else -#define NOBLOCK FNDELAY -#endif - -static void -KdNonBlockFd (int fd) -{ - int flags; - flags = fcntl (fd, F_GETFL); - flags |= FASYNC|NOBLOCK; - fcntl (fd, F_SETFL, flags); -} - -static void -KdAddFd (int fd) -{ - struct sigaction act; - sigset_t set; - - kdnFds++; - fcntl (fd, F_SETOWN, getpid()); - KdNonBlockFd (fd); - AddEnabledDevice (fd); - memset (&act, '\0', sizeof act); - act.sa_handler = KdSigio; - sigemptyset (&act.sa_mask); - sigaddset (&act.sa_mask, SIGIO); - sigaddset (&act.sa_mask, SIGALRM); - sigaddset (&act.sa_mask, SIGVTALRM); - sigaction (SIGIO, &act, 0); - sigemptyset (&set); - sigprocmask (SIG_SETMASK, &set, 0); -} - -static void -KdRemoveFd (int fd) -{ - struct sigaction act; - int flags; - - kdnFds--; - RemoveEnabledDevice (fd); - flags = fcntl (fd, F_GETFL); - flags &= ~(FASYNC|NOBLOCK); - fcntl (fd, F_SETFL, flags); - if (kdnFds == 0) - { - memset (&act, '\0', sizeof act); - act.sa_handler = SIG_IGN; - sigemptyset (&act.sa_mask); - sigaction (SIGIO, &act, 0); - } -} - -int -KdAllocInputType (void) -{ - return ++kdInputTypeSequence; -} - -Bool -KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure) -{ - if (kdNumInputFds == KD_MAX_INPUT_FDS) - return FALSE; - kdInputFds[kdNumInputFds].type = type; - kdInputFds[kdNumInputFds].fd = fd; - kdInputFds[kdNumInputFds].read = read; - kdInputFds[kdNumInputFds].enable = 0; - kdInputFds[kdNumInputFds].disable = 0; - kdInputFds[kdNumInputFds].closure = closure; - ++kdNumInputFds; - if (kdInputEnabled) - KdAddFd (fd); - return TRUE; -} - -void -KdRegisterFdEnableDisable (int fd, - int (*enable) (int fd, void *closure), - void (*disable) (int fd, void *closure)) -{ - int i; - - for (i = 0; i < kdNumInputFds; i++) - if (kdInputFds[i].fd == fd) - { - kdInputFds[i].enable = enable; - kdInputFds[i].disable = disable; - break; - } -} - -void -KdUnregisterFds (int type, Bool do_close) -{ - int i, j; - - for (i = 0; i < kdNumInputFds;) - { - if (kdInputFds[i].type == type) - { - if (kdInputEnabled) - KdRemoveFd (kdInputFds[i].fd); - if (do_close) - close (kdInputFds[i].fd); - --kdNumInputFds; - for (j = i; j < kdNumInputFds; j++) - kdInputFds[j] = kdInputFds[j+1]; - } - else - i++; - } -} - -static void -KdDisableInput (void) -{ - int i; - - KdBlockSigio (); - - for (i = 0; i < kdNumInputFds; i++) - { - KdRemoveFd (kdInputFds[i].fd); - if (kdInputFds[i].disable) - (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure); - } - kdInputEnabled = FALSE; -} - -static void -KdEnableInput (void) -{ - xEvent xE; - int i; - - kdInputEnabled = TRUE; - for (i = 0; i < kdNumInputFds; i++) - { - KdNonBlockFd (kdInputFds[i].fd); - if (kdInputFds[i].enable) - kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure); - KdAddFd (kdInputFds[i].fd); - } - - /* reset screen saver */ - xE.u.keyButtonPointer.time = GetTimeInMillis (); - NoticeEventTime (&xE); - - KdUnblockSigio (); -} - -static int -KdMouseProc(DeviceIntPtr pDevice, int onoff) -{ - BYTE map[KD_MAX_BUTTON]; - DevicePtr pDev = (DevicePtr)pDevice; - int i; - - if (!pDev) - return BadImplementation; - - switch (onoff) - { - case DEVICE_INIT: - for (i = 1; i <= kdMouseButtonCount; i++) - map[i] = i; - InitPointerDeviceStruct(pDev, map, kdMouseButtonCount, - miPointerGetMotionEvents, - (PtrCtrlProcPtr)NoopDDA, - miPointerGetMotionBufferSize()); - break; - - case DEVICE_ON: - pDev->on = TRUE; - pKdPointer = pDevice; - for (i = 0; i < kdNMouseFuncs; i++) - (*kdMouseFuncs[i]->Init)(); - break; - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pDev->on) - { - pDev->on = FALSE; - pKdPointer = 0; - for (i = 0; i < kdNMouseFuncs; i++) - (*kdMouseFuncs[i]->Fini) (); - } - break; - } - return Success; -} - -Bool -KdLegalModifier(unsigned int key, DevicePtr pDev) -{ - return TRUE; -} - -static void -KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something) -{ - if (kdInputEnabled) - (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration); -} - - -static void -KdSetLeds (void) -{ - if (kdInputEnabled) - (*kdKeyboardFuncs->Leds) (kdLeds); -} - -static void -KdSetLed (int led, Bool on) -{ - NoteLedState (pKdKeyboard, led, on); - kdLeds = pKdKeyboard->kbdfeed->ctrl.leds; - KdSetLeds (); -} - -static void -KdSetMouseMatrix (KdMouseMatrix *matrix) -{ - kdMouseMatrix = *matrix; -} - -static void -KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height) -{ - int x_dir = 1, y_dir = 1; - int i, j; - int size[2]; - - size[0] = width; size[1] = height; - if (randr & RR_Reflect_X) - x_dir = -1; - if (randr & RR_Reflect_Y) - y_dir = -1; - switch (randr & (RR_Rotate_All)) { - case RR_Rotate_0: - m->matrix[0][0] = x_dir; m->matrix[0][1] = 0; - m->matrix[1][0] = 0; m->matrix[1][1] = y_dir; - break; - case RR_Rotate_90: - m->matrix[0][0] = 0; m->matrix[0][1] = -x_dir; - m->matrix[1][0] = y_dir; m->matrix[1][1] = 0; - break; - case RR_Rotate_180: - m->matrix[0][0] = -x_dir; m->matrix[0][1] = 0; - m->matrix[1][0] = 0; m->matrix[1][1] = -y_dir; - break; - case RR_Rotate_270: - m->matrix[0][0] = 0; m->matrix[0][1] = x_dir; - m->matrix[1][0] = -y_dir; m->matrix[1][1] = 0; - break; - } - for (i = 0; i < 2; i++) - { - m->matrix[i][2] = 0; - for (j = 0 ; j < 2; j++) - if (m->matrix[i][j] < 0) - m->matrix[i][2] = size[j] - 1; - } -} - -static void -KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) -{ - kdLeds = ctrl->leds; - kdBellPitch = ctrl->bell_pitch; - kdBellDuration = ctrl->bell_duration; - KdSetLeds (); -} - -static int -KdKeybdProc(DeviceIntPtr pDevice, int onoff) -{ - Bool ret; - DevicePtr pDev = (DevicePtr)pDevice; -#ifdef XKB - XkbComponentNamesRec names; -#endif - - if (!pDev) - return BadImplementation; - - switch (onoff) - { - case DEVICE_INIT: - if (pDev != (DevicePtr)inputInfo.keyboard) - { - return !Success; - } -#ifndef XKB - ret = InitKeyboardDeviceStruct(pDev, - &kdKeySyms, - kdModMap, - KdBell, KdKbdCtrl); -#else - memset(&names, 0, sizeof(XkbComponentNamesRec)); - - XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL); - ret = XkbInitKeyboardDeviceStruct (pDev, - &names, - &kdKeySyms, - kdModMap, - KdBell, KdKbdCtrl); -#endif - if (!ret) - return BadImplementation; - break; - case DEVICE_ON: - pDev->on = TRUE; - pKdKeyboard = pDevice; - if (kdKeyboardFuncs) - (*kdKeyboardFuncs->Init) (); - break; - case DEVICE_OFF: - case DEVICE_CLOSE: - pKdKeyboard = 0; - if (pDev->on) - { - pDev->on = FALSE; - if (kdKeyboardFuncs) - (*kdKeyboardFuncs->Fini) (); - } - break; - } - return Success; -} - -extern KeybdCtrl defaultKeyboardControl; - -static void -KdInitAutoRepeats (void) -{ - int key_code; - unsigned char mask; - int i; - unsigned char *repeats; - - repeats = defaultKeyboardControl.autoRepeats; - memset (repeats, '\0', 32); - for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++) - { - if (!kdModMap[key_code]) - { - i = key_code >> 3; - mask = 1 << (key_code & 7); - repeats[i] |= mask; - } - } -} - -const KdKeySymModsRec kdKeySymMods[] = { - { XK_Control_L, ControlMask }, - { XK_Control_R, ControlMask }, - { XK_Shift_L, ShiftMask }, - { XK_Shift_R, ShiftMask }, - { XK_Caps_Lock, LockMask }, - { XK_Shift_Lock, LockMask }, - { XK_Alt_L, Mod1Mask }, - { XK_Alt_R, Mod1Mask }, - { XK_Meta_L, Mod1Mask }, - { XK_Meta_R, Mod1Mask }, - { XK_Num_Lock, Mod2Mask }, - { XK_Super_L, Mod3Mask }, - { XK_Super_R, Mod3Mask }, - { XK_Hyper_L, Mod3Mask }, - { XK_Hyper_R, Mod3Mask }, - { XK_Mode_switch, Mod4Mask }, -#ifdef TOUCHSCREEN - /* PDA specific hacks */ -#ifdef XF86XK_Start - { XF86XK_Start, ControlMask }, -#endif - { XK_Menu, ShiftMask }, - { XK_telephone, Mod1Mask }, -#ifdef XF86XK_AudioRecord - { XF86XK_AudioRecord, Mod2Mask }, -#endif -#ifdef XF86XK_Calendar - { XF86XK_Calendar, Mod3Mask } -#endif -#endif -}; - -#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0])) - -static void -KdInitModMap (void) -{ - int key_code; - int row; - int width; - KeySym *syms; - int i; - - width = kdKeySyms.mapWidth; - for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++) - { - kdModMap[key_code] = 0; - syms = kdKeymap + (key_code - kdMinKeyCode) * width; - for (row = 0; row < width; row++, syms++) - { - for (i = 0; i < NUM_SYM_MODS; i++) - { - if (*syms == kdKeySymMods[i].modsym) - kdModMap[key_code] |= kdKeySymMods[i].modbit; - } - } - } -} - -static void -KdAddMouseDriver(KdMouseFuncs *pMouseFuncs) -{ - if (kdNMouseFuncs < MAX_MOUSE_DRIVERS) - kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs; -} - -void -eglInitInput(KdMouseFuncs *pMouseFuncs, - KdKeyboardFuncs *pKeyboardFuncs) -{ - DeviceIntPtr pKeyboard, pPointer; - KdMouseInfo *mi; - - if (!kdMouseInfo) - KdParseMouse (0); - kdMouseButtonCount = 0; - for (mi = kdMouseInfo; mi; mi = mi->next) - { - if (mi->nbutton > kdMouseButtonCount) - kdMouseButtonCount = mi->nbutton; - } - - kdNMouseFuncs = 0; - KdAddMouseDriver (pMouseFuncs); - kdKeyboardFuncs = pKeyboardFuncs; - memset (kdKeyState, '\0', sizeof (kdKeyState)); - if (kdKeyboardFuncs) - (*kdKeyboardFuncs->Load) (); - kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET; - kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET; - kdKeySyms.map = kdKeymap; - kdKeySyms.minKeyCode = kdMinKeyCode; - kdKeySyms.maxKeyCode = kdMaxKeyCode; - kdKeySyms.mapWidth = kdKeymapWidth; - kdLeds = 0; - kdBellPitch = 1000; - kdBellDuration = 200; - kdInputEnabled = TRUE; - KdInitModMap (); - KdInitAutoRepeats (); - KdResetInputMachine (); - pPointer = AddInputDevice(KdMouseProc, TRUE); - pKeyboard = AddInputDevice(KdKeybdProc, TRUE); - RegisterPointerDevice(pPointer); - RegisterKeyboardDevice(pKeyboard); - miRegisterPointerDevice(screenInfo.screens[0], pPointer); - mieqInit(&pKeyboard->public, &pPointer->public); - { - static long zero1, zero2; - - //SetExtInputCheck (&zero1, &zero2); - ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n", - __LINE__, __FILE__); - } -} - -/* - * Middle button emulation state machine - * - * Possible transitions: - * Button 1 press v1 - * Button 1 release ^1 - * Button 2 press v2 - * Button 2 release ^2 - * Button 3 press v3 - * Button 3 release ^3 - * Button other press vo - * Button other release ^o - * Mouse motion <> - * Keyboard event k - * timeout ... - * outside box <-> - * - * States: - * start - * button_1_pend - * button_1_down - * button_2_down - * button_3_pend - * button_3_down - * synthetic_2_down_13 - * synthetic_2_down_3 - * synthetic_2_down_1 - * - * Transition diagram - * - * start - * v1 -> (hold) (settimeout) button_1_pend - * ^1 -> (deliver) start - * v2 -> (deliver) button_2_down - * ^2 -> (deliever) start - * v3 -> (hold) (settimeout) button_3_pend - * ^3 -> (deliver) start - * vo -> (deliver) start - * ^o -> (deliver) start - * <> -> (deliver) start - * k -> (deliver) start - * - * button_1_pend (button 1 is down, timeout pending) - * ^1 -> (release) (deliver) start - * v2 -> (release) (deliver) button_1_down - * ^2 -> (release) (deliver) button_1_down - * v3 -> (cleartimeout) (generate v2) synthetic_2_down_13 - * ^3 -> (release) (deliver) button_1_down - * vo -> (release) (deliver) button_1_down - * ^o -> (release) (deliver) button_1_down - * <-> -> (release) (deliver) button_1_down - * <> -> (deliver) button_1_pend - * k -> (release) (deliver) button_1_down - * ... -> (release) button_1_down - * - * button_1_down (button 1 is down) - * ^1 -> (deliver) start - * v2 -> (deliver) button_1_down - * ^2 -> (deliver) button_1_down - * v3 -> (deliver) button_1_down - * ^3 -> (deliver) button_1_down - * vo -> (deliver) button_1_down - * ^o -> (deliver) button_1_down - * <> -> (deliver) button_1_down - * k -> (deliver) button_1_down - * - * button_2_down (button 2 is down) - * v1 -> (deliver) button_2_down - * ^1 -> (deliver) button_2_down - * ^2 -> (deliver) start - * v3 -> (deliver) button_2_down - * ^3 -> (deliver) button_2_down - * vo -> (deliver) button_2_down - * ^o -> (deliver) button_2_down - * <> -> (deliver) button_2_down - * k -> (deliver) button_2_down - * - * button_3_pend (button 3 is down, timeout pending) - * v1 -> (generate v2) synthetic_2_down - * ^1 -> (release) (deliver) button_3_down - * v2 -> (release) (deliver) button_3_down - * ^2 -> (release) (deliver) button_3_down - * ^3 -> (release) (deliver) start - * vo -> (release) (deliver) button_3_down - * ^o -> (release) (deliver) button_3_down - * <-> -> (release) (deliver) button_3_down - * <> -> (deliver) button_3_pend - * k -> (release) (deliver) button_3_down - * ... -> (release) button_3_down - * - * button_3_down (button 3 is down) - * v1 -> (deliver) button_3_down - * ^1 -> (deliver) button_3_down - * v2 -> (deliver) button_3_down - * ^2 -> (deliver) button_3_down - * ^3 -> (deliver) start - * vo -> (deliver) button_3_down - * ^o -> (deliver) button_3_down - * <> -> (deliver) button_3_down - * k -> (deliver) button_3_down - * - * synthetic_2_down_13 (button 1 and 3 are down) - * ^1 -> (generate ^2) synthetic_2_down_3 - * v2 -> synthetic_2_down_13 - * ^2 -> synthetic_2_down_13 - * ^3 -> (generate ^2) synthetic_2_down_1 - * vo -> (deliver) synthetic_2_down_13 - * ^o -> (deliver) synthetic_2_down_13 - * <> -> (deliver) synthetic_2_down_13 - * k -> (deliver) synthetic_2_down_13 - * - * synthetic_2_down_3 (button 3 is down) - * v1 -> (deliver) synthetic_2_down_3 - * ^1 -> (deliver) synthetic_2_down_3 - * v2 -> synthetic_2_down_3 - * ^2 -> synthetic_2_down_3 - * ^3 -> start - * vo -> (deliver) synthetic_2_down_3 - * ^o -> (deliver) synthetic_2_down_3 - * <> -> (deliver) synthetic_2_down_3 - * k -> (deliver) synthetic_2_down_3 - * - * synthetic_2_down_1 (button 1 is down) - * ^1 -> start - * v2 -> synthetic_2_down_1 - * ^2 -> synthetic_2_down_1 - * v3 -> (deliver) synthetic_2_down_1 - * ^3 -> (deliver) synthetic_2_down_1 - * vo -> (deliver) synthetic_2_down_1 - * ^o -> (deliver) synthetic_2_down_1 - * <> -> (deliver) synthetic_2_down_1 - * k -> (deliver) synthetic_2_down_1 - */ - -typedef enum _inputClass { - down_1, up_1, - down_2, up_2, - down_3, up_3, - down_o, up_o, - motion, outside_box, - keyboard, timeout, - num_input_class -} KdInputClass; - -typedef enum _inputAction { - noop, - hold, - setto, - deliver, - release, - clearto, - gen_down_2, - gen_up_2 -} KdInputAction; - -#define MAX_ACTIONS 2 - -typedef struct _inputTransition { - KdInputAction actions[MAX_ACTIONS]; - KdMouseState nextState; -} KdInputTransition; - -KdInputTransition kdInputMachine[num_input_states][num_input_class] = { - /* start */ - { - { { hold, setto }, button_1_pend }, /* v1 */ - { { deliver, noop }, start }, /* ^1 */ - { { deliver, noop }, button_2_down }, /* v2 */ - { { deliver, noop }, start }, /* ^2 */ - { { hold, setto }, button_3_pend }, /* v3 */ - { { deliver, noop }, start }, /* ^3 */ - { { deliver, noop }, start }, /* vo */ - { { deliver, noop }, start }, /* ^o */ - { { deliver, noop }, start }, /* <> */ - { { deliver, noop }, start }, /* <-> */ - { { noop, noop }, start }, /* k */ - { { noop, noop }, start }, /* ... */ - }, - /* button_1_pend */ - { - { { noop, noop }, button_1_pend }, /* v1 */ - { { release, deliver }, start }, /* ^1 */ - { { release, deliver }, button_1_down }, /* v2 */ - { { release, deliver }, button_1_down }, /* ^2 */ - { { clearto, gen_down_2 }, synth_2_down_13 }, /* v3 */ - { { release, deliver }, button_1_down }, /* ^3 */ - { { release, deliver }, button_1_down }, /* vo */ - { { release, deliver }, button_1_down }, /* ^o */ - { { deliver, noop }, button_1_pend }, /* <> */ - { { release, deliver }, button_1_down }, /* <-> */ - { { noop, noop }, button_1_down }, /* k */ - { { release, noop }, button_1_down }, /* ... */ - }, - /* button_1_down */ - { - { { noop, noop }, button_1_down }, /* v1 */ - { { deliver, noop }, start }, /* ^1 */ - { { deliver, noop }, button_1_down }, /* v2 */ - { { deliver, noop }, button_1_down }, /* ^2 */ - { { deliver, noop }, button_1_down }, /* v3 */ - { { deliver, noop }, button_1_down }, /* ^3 */ - { { deliver, noop }, button_1_down }, /* vo */ - { { deliver, noop }, button_1_down }, /* ^o */ - { { deliver, noop }, button_1_down }, /* <> */ - { { deliver, noop }, button_1_down }, /* <-> */ - { { noop, noop }, button_1_down }, /* k */ - { { noop, noop }, button_1_down }, /* ... */ - }, - /* button_2_down */ - { - { { deliver, noop }, button_2_down }, /* v1 */ - { { deliver, noop }, button_2_down }, /* ^1 */ - { { noop, noop }, button_2_down }, /* v2 */ - { { deliver, noop }, start }, /* ^2 */ - { { deliver, noop }, button_2_down }, /* v3 */ - { { deliver, noop }, button_2_down }, /* ^3 */ - { { deliver, noop }, button_2_down }, /* vo */ - { { deliver, noop }, button_2_down }, /* ^o */ - { { deliver, noop }, button_2_down }, /* <> */ - { { deliver, noop }, button_2_down }, /* <-> */ - { { noop, noop }, button_2_down }, /* k */ - { { noop, noop }, button_2_down }, /* ... */ - }, - /* button_3_pend */ - { - { { clearto, gen_down_2 }, synth_2_down_13 }, /* v1 */ - { { release, deliver }, button_3_down }, /* ^1 */ - { { release, deliver }, button_3_down }, /* v2 */ - { { release, deliver }, button_3_down }, /* ^2 */ - { { release, deliver }, button_3_down }, /* v3 */ - { { release, deliver }, start }, /* ^3 */ - { { release, deliver }, button_3_down }, /* vo */ - { { release, deliver }, button_3_down }, /* ^o */ - { { deliver, noop }, button_3_pend }, /* <> */ - { { release, deliver }, button_3_down }, /* <-> */ - { { release, noop }, button_3_down }, /* k */ - { { release, noop }, button_3_down }, /* ... */ - }, - /* button_3_down */ - { - { { deliver, noop }, button_3_down }, /* v1 */ - { { deliver, noop }, button_3_down }, /* ^1 */ - { { deliver, noop }, button_3_down }, /* v2 */ - { { deliver, noop }, button_3_down }, /* ^2 */ - { { noop, noop }, button_3_down }, /* v3 */ - { { deliver, noop }, start }, /* ^3 */ - { { deliver, noop }, button_3_down }, /* vo */ - { { deliver, noop }, button_3_down }, /* ^o */ - { { deliver, noop }, button_3_down }, /* <> */ - { { deliver, noop }, button_3_down }, /* <-> */ - { { noop, noop }, button_3_down }, /* k */ - { { noop, noop }, button_3_down }, /* ... */ - }, - /* synthetic_2_down_13 */ - { - { { noop, noop }, synth_2_down_13 }, /* v1 */ - { { gen_up_2, noop }, synth_2_down_3 }, /* ^1 */ - { { noop, noop }, synth_2_down_13 }, /* v2 */ - { { noop, noop }, synth_2_down_13 }, /* ^2 */ - { { noop, noop }, synth_2_down_13 }, /* v3 */ - { { gen_up_2, noop }, synth_2_down_1 }, /* ^3 */ - { { deliver, noop }, synth_2_down_13 }, /* vo */ - { { deliver, noop }, synth_2_down_13 }, /* ^o */ - { { deliver, noop }, synth_2_down_13 }, /* <> */ - { { deliver, noop }, synth_2_down_13 }, /* <-> */ - { { noop, noop }, synth_2_down_13 }, /* k */ - { { noop, noop }, synth_2_down_13 }, /* ... */ - }, - /* synthetic_2_down_3 */ - { - { { deliver, noop }, synth_2_down_3 }, /* v1 */ - { { deliver, noop }, synth_2_down_3 }, /* ^1 */ - { { deliver, noop }, synth_2_down_3 }, /* v2 */ - { { deliver, noop }, synth_2_down_3 }, /* ^2 */ - { { noop, noop }, synth_2_down_3 }, /* v3 */ - { { noop, noop }, start }, /* ^3 */ - { { deliver, noop }, synth_2_down_3 }, /* vo */ - { { deliver, noop }, synth_2_down_3 }, /* ^o */ - { { deliver, noop }, synth_2_down_3 }, /* <> */ - { { deliver, noop }, synth_2_down_3 }, /* <-> */ - { { noop, noop }, synth_2_down_3 }, /* k */ - { { noop, noop }, synth_2_down_3 }, /* ... */ - }, - /* synthetic_2_down_1 */ - { - { { noop, noop }, synth_2_down_1 }, /* v1 */ - { { noop, noop }, start }, /* ^1 */ - { { deliver, noop }, synth_2_down_1 }, /* v2 */ - { { deliver, noop }, synth_2_down_1 }, /* ^2 */ - { { deliver, noop }, synth_2_down_1 }, /* v3 */ - { { deliver, noop }, synth_2_down_1 }, /* ^3 */ - { { deliver, noop }, synth_2_down_1 }, /* vo */ - { { deliver, noop }, synth_2_down_1 }, /* ^o */ - { { deliver, noop }, synth_2_down_1 }, /* <> */ - { { deliver, noop }, synth_2_down_1 }, /* <-> */ - { { noop, noop }, synth_2_down_1 }, /* k */ - { { noop, noop }, synth_2_down_1 }, /* ... */ - }, -}; - -#define EMULATION_WINDOW 10 -#define EMULATION_TIMEOUT 100 - -#define EventX(e) ((e)->u.keyButtonPointer.rootX) -#define EventY(e) ((e)->u.keyButtonPointer.rootY) - -static int -KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev) -{ - if (ev->u.keyButtonPointer.pad1) - { - mi->emulationDx += EventX(ev); - mi->emulationDy += EventY(ev); - } - else - { - mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev); - mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev); - } - return (abs (mi->emulationDx) < EMULATION_WINDOW && - abs (mi->emulationDy) < EMULATION_WINDOW); -} - -static KdInputClass -KdClassifyInput (KdMouseInfo *mi, xEvent *ev) -{ - switch (ev->u.u.type) { - case ButtonPress: - switch (ev->u.u.detail) { - case 1: return down_1; - case 2: return down_2; - case 3: return down_3; - default: return down_o; - } - break; - case ButtonRelease: - switch (ev->u.u.detail) { - case 1: return up_1; - case 2: return up_2; - case 3: return up_3; - default: return up_o; - } - break; - case MotionNotify: - if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev)) - return outside_box; - else - return motion; - default: - return keyboard; - } - return keyboard; -} - -#ifdef DEBUG -char *kdStateNames[] = { - "start", - "button_1_pend", - "button_1_down", - "button_2_down", - "button_3_pend", - "button_3_down", - "synth_2_down_13", - "synth_2_down_3", - "synthetic_2_down_1", - "num_input_states" -}; - -char *kdClassNames[] = { - "down_1", "up_1", - "down_2", "up_2", - "down_3", "up_3", - "motion", "ouside_box", - "keyboard", "timeout", - "num_input_class" -}; - -char *kdActionNames[] = { - "noop", - "hold", - "setto", - "deliver", - "release", - "clearto", - "gen_down_2", - "gen_up_2", -}; -#endif /* DEBUG */ - -static void -KdQueueEvent (xEvent *ev) -{ - KdAssertSigioBlocked ("KdQueueEvent"); - if (ev->u.u.type == MotionNotify) - { - if (ev->u.keyButtonPointer.pad1) - { - ev->u.keyButtonPointer.pad1 = 0; - miPointerDeltaCursor (ev->u.keyButtonPointer.rootX, - ev->u.keyButtonPointer.rootY, - ev->u.keyButtonPointer.time); - } - else - { - miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX, - ev->u.keyButtonPointer.rootY, - ev->u.keyButtonPointer.time); - } - } - else - { - mieqEnqueue (ev); - } -} - -static void -KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev) -{ - KdInputTransition *t; - int a; - - t = &kdInputMachine[mi->mouseState][c]; - for (a = 0; a < MAX_ACTIONS; a++) - { - switch (t->actions[a]) { - case noop: - break; - case hold: - mi->eventHeld = TRUE; - mi->emulationDx = 0; - mi->emulationDy = 0; - mi->heldEvent = *ev; - break; - case setto: - mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT; - mi->timeoutPending = TRUE; - break; - case deliver: - KdQueueEvent (ev); - break; - case release: - mi->eventHeld = FALSE; - mi->timeoutPending = FALSE; - KdQueueEvent (&mi->heldEvent); - break; - case clearto: - mi->timeoutPending = FALSE; - break; - case gen_down_2: - ev->u.u.detail = 2; - mi->eventHeld = FALSE; - KdQueueEvent (ev); - break; - case gen_up_2: - ev->u.u.detail = 2; - KdQueueEvent (ev); - break; - } - } - mi->mouseState = t->nextState; -} - -void -KdResetInputMachine (void) -{ - KdMouseInfo *mi; - - for (mi = kdMouseInfo; mi; mi = mi->next) - { - mi->mouseState = start; - mi->eventHeld = FALSE; - } -} - -static void -KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev) -{ - if (mi->emulateMiddleButton) - KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev); - else - KdQueueEvent (ev); -} - -static void -KdReceiveTimeout (KdMouseInfo *mi) -{ - KdRunMouseMachine (mi, timeout, 0); -} - -#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10)) -#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT)) -#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b))) -#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b))) -#define KEYMAP (pKdKeyboard->key->curKeySyms) -#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth]) - -CARD32 KdSpecialKeys = 0; - -extern char dispatchException; - -/* - * kdCheckTermination - * - * This function checks for the key sequence that terminates the server. When - * detected, it sets the dispatchException flag and returns. The key sequence - * is: - * Control-Alt - * It's assumed that the server will be waken up by the caller when this - * function returns. - */ - -extern int nClients; - -static void -KdCheckSpecialKeys(xEvent *xE) -{ - KeySym sym = KEYCOL1(xE->u.u.detail); - - if (!pKdKeyboard) return; - - /* - * Ignore key releases - */ - - if (xE->u.u.type == KeyRelease) return; - -#ifdef XIPAQ - /* - * Check for buttons 1, 2 and 3 on the iPAQ - */ - if (sym == XK_Pointer_Button1 && kdMouseInfo) { - KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0); - return; - } - if (sym == XK_Pointer_Button2 && kdMouseInfo) { - KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0); - return; - } - if (sym == XK_Pointer_Button3 && kdMouseInfo) { - KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0); - return; - } -#endif - - /* - * Check for control/alt pressed - */ - if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) != - (ControlMask|Mod1Mask)) - return; - - - /* - * Let OS function see keysym first - */ - - if (kdOsFuncs->SpecialKey) - if ((*kdOsFuncs->SpecialKey) (sym)) - return; - - /* - * Now check for backspace or delete; these signal the - * X server to terminate - */ - switch (sym) { - case XK_BackSpace: - case XK_Delete: - case XK_KP_Delete: - /* - * Set the dispatch exception flag so the server will terminate the - * next time through the dispatch loop. - */ - if (kdDontZap == FALSE) - dispatchException |= DE_TERMINATE; - break; - } -} - -/* - * kdEnqueueKeyboardEvent - * - * This function converts hardware keyboard event information into an X event - * and enqueues it using MI. It wakes up the server before returning so that - * the event will be processed normally. - * - */ - -static void -KdHandleKeyboardEvent (xEvent *ev) -{ - int key = ev->u.u.detail; - int byte; - CARD8 bit; - KdMouseInfo *mi; - - byte = key >> 3; - bit = 1 << (key & 7); - switch (ev->u.u.type) { - case KeyPress: - kdKeyState[byte] |= bit; - break; - case KeyRelease: - kdKeyState[byte] &= ~bit; - break; - } - for (mi = kdMouseInfo; mi; mi = mi->next) - KdRunMouseMachine (mi, keyboard, 0); - KdQueueEvent (ev); -} - -static void -KdReleaseAllKeys (void) -{ - xEvent xE; - int key; - - KdBlockSigio (); - for (key = 0; key < KD_KEY_COUNT; key++) - if (IsKeyDown(key)) - { - xE.u.keyButtonPointer.time = GetTimeInMillis(); - xE.u.u.type = KeyRelease; - xE.u.u.detail = key; - KdHandleKeyboardEvent (&xE); - } - KdUnblockSigio (); -} - -static void -KdCheckLock (void) -{ - KeyClassPtr keyc = pKdKeyboard->key; - Bool isSet, shouldBeSet; - - if (kdKeyboardFuncs->LockLed) - { - isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0; - shouldBeSet = (keyc->state & LockMask) != 0; - if (isSet != shouldBeSet) - { - KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet); - } - } -} - -void -KdEnqueueKeyboardEvent(unsigned char scan_code, - unsigned char is_up) -{ - unsigned char key_code; - xEvent xE; - KeyClassPtr keyc; - - if (!pKdKeyboard) - return; - keyc = pKdKeyboard->key; - - xE.u.keyButtonPointer.time = GetTimeInMillis(); - - if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode) - { - key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode; - - /* - * Set up this event -- the type may be modified below - */ - if (is_up) - xE.u.u.type = KeyRelease; - else - xE.u.u.type = KeyPress; - xE.u.u.detail = key_code; - - switch (KEYCOL1(key_code)) - { - case XK_Num_Lock: - case XK_Scroll_Lock: - case XK_Shift_Lock: - case XK_Caps_Lock: - if (xE.u.u.type == KeyRelease) - return; - if (IsKeyDown (key_code)) - xE.u.u.type = KeyRelease; - else - xE.u.u.type = KeyPress; - } - - /* - * Check pressed keys which are already down - */ - if (IsKeyDown (key_code) && xE.u.u.type == KeyPress) - { - KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl; - - /* - * Check auto repeat - */ - if (!ctrl->autoRepeat || keyc->modifierMap[key_code] || - !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7)))) - { - return; - } - /* - * X delivers press/release even for autorepeat - */ - xE.u.u.type = KeyRelease; - KdHandleKeyboardEvent (&xE); - xE.u.u.type = KeyPress; - } - /* - * Check released keys which are already up - */ - else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease) - { - return; - } - KdCheckSpecialKeys (&xE); - KdHandleKeyboardEvent (&xE); - } -} - -#define SetButton(mi, b, v, s) \ -{\ - xE.u.u.detail = mi->map[b]; \ - xE.u.u.type = v; \ - KdHandleMouseEvent (mi, &xE); \ -} - -#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down") -#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up") - -/* - * kdEnqueueMouseEvent - * - * This function converts hardware mouse event information into X event - * information. A mouse movement event is passed off to MI to generate - * a MotionNotify event, if appropriate. Button events are created and - * passed off to MI for enqueueing. - */ - -static void -KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy) -{ - PtrCtrl *pCtrl = &device->ptrfeed->ctrl; - double speed = sqrt (*dx * *dx + *dy * *dy); - double accel; - double m; - - /* - * Ok, so we want it moving num/den times faster at threshold*2 - * - * accel = m *threshold + b - * 1 = m * 0 + b -> b = 1 - * - * num/den = m * (threshold * 2) + 1 - * - * num / den - 1 = m * threshold * 2 - * (num / den - 1) / threshold * 2 = m - */ - m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) / - ((double) pCtrl->threshold * 2.0)); - accel = m * speed + 1; - *dx = accel * *dx; - *dy = accel * *dy; -} - -void -KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry) -{ - CARD32 ms; - xEvent xE; - unsigned char buttons; - int x, y; - int (*matrix)[3] = kdMouseMatrix.matrix; - unsigned long button; - int n; - - if (!pKdPointer) - return; - - ms = GetTimeInMillis(); - - if (flags & KD_MOUSE_DELTA) - { - if (mi->transformCoordinates) - { - x = matrix[0][0] * rx + matrix[0][1] * ry; - y = matrix[1][0] * rx + matrix[1][1] * ry; - } - else - { - x = rx; - y = ry; - } - KdMouseAccelerate (pKdPointer, &x, &y); - xE.u.keyButtonPointer.pad1 = 1; - } - else - { - if (mi->transformCoordinates) - { - x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2]; - y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2]; - } - else - { - x = rx; - y = ry; - } - xE.u.keyButtonPointer.pad1 = 0; - } - xE.u.keyButtonPointer.time = ms; - xE.u.keyButtonPointer.rootX = x; - xE.u.keyButtonPointer.rootY = y; - - xE.u.u.type = MotionNotify; - xE.u.u.detail = 0; - KdHandleMouseEvent (mi, &xE); - - buttons = flags; - - for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++) - { - if ((mi->buttonState & button) ^ (buttons & button)) - { - if (buttons & button) - { - Press(mi, n); - } - else - { - Release(mi, n); - } - } - } - mi->buttonState = buttons; -} - -static void -KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y) -{ - xEvent xE; - CARD32 ms; - - ms = GetTimeInMillis(); - - xE.u.u.type = MotionNotify; - xE.u.keyButtonPointer.time = ms; - xE.u.keyButtonPointer.rootX = x; - xE.u.keyButtonPointer.rootY = y; - - KdHandleMouseEvent (mi, &xE); -} - -static void -KdBlockHandler (int screen, - pointer blockData, - pointer timeout, - pointer readmask) -{ - KdMouseInfo *mi; - int myTimeout=0; - - for (mi = kdMouseInfo; mi; mi = mi->next) - { - if (mi->timeoutPending) - { - int ms; - - ms = mi->emulationTimeout - GetTimeInMillis (); - if (ms < 1) - ms = 1; - if(mspollEvents) - { - (*kdOsFuncs->pollEvents)(); - myTimeout=20; - } - if(myTimeout>0) - AdjustWaitForDelay (timeout, myTimeout); -} - -void -KdWakeupHandler (pointer data, - int result, - pointer readmask) -{ - fd_set *pReadmask = (fd_set *) readmask; - int i; - KdMouseInfo *mi; - - if (kdInputEnabled && result > 0) - { - for (i = 0; i < kdNumInputFds; i++) - if (FD_ISSET (kdInputFds[i].fd, pReadmask)) - { - KdBlockSigio (); - (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); - KdUnblockSigio (); - } - } - for (mi = kdMouseInfo; mi; mi = mi->next) - { - if (mi->timeoutPending) - { - if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0) - { - mi->timeoutPending = FALSE; - KdBlockSigio (); - KdReceiveTimeout (mi); - KdUnblockSigio (); - } - } - } -// if (kdSwitchPending) -// kdProcessSwitch (); -} - -#define KdScreenOrigin(pScreen) (&(KdGetScreenPriv (pScreen)->origin)) - -static Bool -KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) -{ - ScreenPtr pScreen = *ppScreen; - ScreenPtr pNewScreen; - int n; - int dx, dy; - int best_x, best_y; - int n_best_x, n_best_y; - CARD32 ms; - - if (kdDisableZaphod || screenInfo.numScreens <= 1) - return FALSE; - - if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height) - return FALSE; - - ms = GetTimeInMillis (); - if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000) - return FALSE; - kdOffScreen = TRUE; - kdOffScreenTime = ms; - n_best_x = -1; - best_x = 32767; - n_best_y = -1; - best_y = 32767; - for (n = 0; n < screenInfo.numScreens; n++) - { - pNewScreen = screenInfo.screens[n]; - if (pNewScreen == pScreen) - continue; - dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x; - dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y; - if (*x < 0) - { - if (dx <= 0 && -dx < best_x) - { - best_x = -dx; - n_best_x = n; - } - } - else if (*x >= pScreen->width) - { - if (dx >= 0 && dx < best_x) - { - best_x = dx; - n_best_x = n; - } - } - if (*y < 0) - { - if (dy <= 0 && -dy < best_y) - { - best_y = -dy; - n_best_y = n; - } - } - else if (*y >= pScreen->height) - { - if (dy >= 0 && dy < best_y) - { - best_y = dy; - n_best_y = n; - } - } - } - if (best_y < best_x) - n_best_x = n_best_y; - if (n_best_x == -1) - return FALSE; - pNewScreen = screenInfo.screens[n_best_x]; - - if (*x < 0) - *x += pNewScreen->width; - if (*y < 0) - *y += pNewScreen->height; - - if (*x >= pScreen->width) - *x -= pScreen->width; - if (*y >= pScreen->height) - *y -= pScreen->height; - - *ppScreen = pNewScreen; - return TRUE; -} - -static void -KdCrossScreen(ScreenPtr pScreen, Bool entering) -{ -#ifndef XIPAQ -// if (entering) -// KdEnableScreen (pScreen); -// else -// KdDisableScreen (pScreen); -#endif -} - -int KdCurScreen; /* current event screen */ - -static void -KdWarpCursor (ScreenPtr pScreen, int x, int y) -{ - KdBlockSigio (); - KdCurScreen = pScreen->myNum; - miPointerWarpCursor (pScreen, x, y); - KdUnblockSigio (); -} - -miPointerScreenFuncRec kdPointerScreenFuncs = -{ - KdCursorOffScreen, - KdCrossScreen, - KdWarpCursor -}; - -void -KdProcessInputEvents (void) -{ - mieqProcessInputEvents(); - miPointerUpdate(); -// if (kdSwitchPending) -// KdProcessSwitch (); - KdCheckLock (); -} diff --git a/hw/xgl/egl/kkeymap.h b/hw/xgl/egl/kkeymap.h deleted file mode 100644 index 920e807e5..000000000 --- a/hw/xgl/egl/kkeymap.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -/* - * All global variables and functions pertaining to keyboard key mapping - * live in this header file. - */ - -#ifndef _KKEYMAP_H -#define _KKEYMAP_H - -/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */ -#define KD_KEY_OFFSET (8 - kdMinScanCode) - -#define KD_MIN_KEYCODE 8 -#define KD_MAX_KEYCODE 254 -#define KD_MAX_WIDTH 4 -#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1) - -extern int kdMinScanCode; -extern int kdMaxScanCode; -extern int kdMinKeyCode; -extern int kdMaxKeyCode; -extern int kdKeymapWidth; - -extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH]; - -extern CARD8 kdModMap[MAP_LENGTH]; - -extern KeySymsRec kdKeySyms; - -typedef struct { - KeySym modsym; - int modbit; -} KdKeySymModsRec; - -#endif /* _KKEYMAP_H */ diff --git a/hw/xgl/egl/module/Makefile.am b/hw/xgl/egl/module/Makefile.am deleted file mode 100644 index c84f85c90..000000000 --- a/hw/xgl/egl/module/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -I$(srcdir)/.. \ - -I$(srcdir)/../.. \ - $(XEGLMODULES_CFLAGS) - -libxegl_la_LDFLAGS = -avoid-version -libxegl_la_SOURCES = xeglmodule.c -libxegl_la_LIBADD = \ - $(top_builddir)/hw/xgl/glx/libxegl.la \ - $(XEGLMODULES_LIBS) - -moduledir = @xglmoduledir@ - -module_LTLIBRARIES = libxegl.la diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c deleted file mode 100644 index abd0d0d75..000000000 --- a/hw/xgl/egl/module/xeglmodule.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright © 2005 Novell, Inc. - * - * 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 - * Novell, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * Novell, Inc. makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NOVELL, INC. 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. - * - * Author: David Reveman - */ - -#include "xglmodule.h" -#include "xegl.h" - -#include - -char * -moduleVersion (void) -{ - return VERSION; -} - -Bool -moduleInit (const char *module) -{ - glitz_egl_init (module); - - return TRUE; -} - -void -InitOutput (ScreenInfo *pScreenInfo, - int argc, - char **argv) -{ - xeglInitOutput (pScreenInfo, argc, argv); -} - -Bool -LegalModifier (unsigned int key, - DeviceIntPtr pDev) -{ - return xeglLegalModifier (key, pDev); -} - -void -ProcessInputEvents (void) -{ - xeglProcessInputEvents (); -} - -void -InitInput (int argc, - char **argv) -{ - xeglInitInput (argc, argv); -} - -void -ddxUseMsg (void) -{ - ErrorF ("\nXegl usage:\n"); - xeglUseMsg (); -} - -int -ddxProcessArgument (int argc, - char **argv, - int i) -{ - return xeglProcessArgument (argc, argv, i); -} - -void -AbortDDX (void) -{ - xeglAbort (); -} - -void -ddxGiveUp (void) -{ - xeglGiveUp (); -} - -void -OsVendorInit (void) -{ - xeglOsVendorInit (); -} diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c deleted file mode 100644 index 1cf615bb6..000000000 --- a/hw/xgl/egl/xegl.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright © 2004 David Reveman - * - * 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 - * David Reveman not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * David Reveman makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL DAVID REVEMAN 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. - * - * Author: David Reveman - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "inputstr.h" -#include "cursorstr.h" -#include "mipointer.h" - -#include "xegl.h" - -#define XEGL_DEFAULT_SCREEN_WIDTH 800 -#define XEGL_DEFAULT_SCREEN_HEIGHT 600 - -DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey; - -#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) - -#define XEGL_SET_SCREEN_PRIV(pScreen, v) \ - dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v) - -#define XEGL_SCREEN_PRIV(pScreen) \ - xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen) - -static EGLDisplay eDisplay; -static EGLScreenMESA eScreen; -static ScreenPtr currentScreen = 0; -static Bool softCursor = TRUE; - -extern miPointerScreenFuncRec kdPointerScreenFuncs; - -static Bool -xeglAllocatePrivates (ScreenPtr pScreen) -{ - xeglScreenPtr pScreenPriv; - - pScreenPriv = xalloc (sizeof (xeglScreenRec)); - if (!pScreenPriv) - return FALSE; - - XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv); - - return TRUE; -} - -static Bool -xeglCloseScreen (int index, - ScreenPtr pScreen) -{ - glitz_drawable_t *drawable; - - XEGL_SCREEN_PRIV (pScreen); - - drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable; - if (drawable) - glitz_drawable_destroy (drawable); - - xglClearVisualTypes (); - - XGL_SCREEN_UNWRAP (CloseScreen); - xfree (pScreenPriv); - - return (*pScreen->CloseScreen) (index, pScreen); -} - -static Bool -xeglScreenInit (int index, - ScreenPtr pScreen, - int argc, - char **argv) -{ - EGLSurface eSurface; - EGLModeMESA mode; - int count; - xeglScreenPtr pScreenPriv; - glitz_drawable_format_t *format; - glitz_drawable_t *drawable; - EGLint screenAttribs[] = { - EGL_WIDTH, 1024, - EGL_HEIGHT, 768, - EGL_NONE - }; - - if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0) - { - xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH; - xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT; - - } - - screenAttribs[1] = xglScreenInfo.width; - screenAttribs[3] = xglScreenInfo.height; - - format = xglVisuals[0].format; - - if (!xeglAllocatePrivates (pScreen)) - return FALSE; - - currentScreen = pScreen; - - pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen); - - if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0) - { - xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH; - xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT; - } - - eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count); - - eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs); - if (eSurface == EGL_NO_SURFACE) - { - ErrorF ("failed to create screen surface\n"); - return FALSE; - } - - eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode); - - drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface, - xglScreenInfo.width, - xglScreenInfo.height); - if (!drawable) - { - ErrorF ("[%d] couldn't create glitz drawable for window\n", index); - return FALSE; - } - - xglScreenInfo.drawable = drawable; - - if (!xglScreenInit (pScreen)) - return FALSE; - -#ifdef GLXEXT - if (!xglInitVisualConfigs (pScreen)) - return FALSE; -#endif - - XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen); - - miDCInitialize (pScreen, &kdPointerScreenFuncs); - miCreateDefColormap(pScreen); - - if (!xglFinishScreenInit (pScreen)) - return FALSE; - - return TRUE; -} - -void -xeglInitOutput (ScreenInfo *pScreenInfo, - int argc, - char **argv) -{ - glitz_drawable_format_t *format, templ; - int i, maj, min, count; - unsigned long mask; - - xglSetPixmapFormats (pScreenInfo); - - if (!eDisplay) - { - eDisplay = eglGetDisplay (":0"); - - if (!eglInitialize (eDisplay, &maj, &min)) - FatalError ("can't open display"); - - eglGetScreensMESA (eDisplay, &eScreen, 1, &count); - } - - templ.samples = 1; - templ.doublebuffer = 1; - templ.color.alpha_size = 8; - - mask = GLITZ_FORMAT_SAMPLES_MASK; - - format = glitz_egl_find_window_config (eDisplay, eScreen, - mask, &templ, 0); - - if (!format) - FatalError ("no visual format found"); - - xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor)); - - xglInitVisuals (pScreenInfo); - - AddScreen (xeglScreenInit, argc, argv); -} - -static void -xeglBlockHandler (pointer blockData, - OSTimePtr pTimeout, - pointer pReadMask) -{ - XGL_SCREEN_PRIV (currentScreen); - - if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable)) - FatalError (XGL_SW_FAILURE_STRING); - - glitz_surface_flush (pScreenPriv->surface); - glitz_drawable_finish (pScreenPriv->drawable); -} - -void -xeglInitInput (int argc, - char **argv) -{ - eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs); - RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL); -} - -Bool -xeglLegalModifier (unsigned int key, - DeviceIntPtr pDev) -{ - return KdLegalModifier (key, pDev); -} - -void -xeglProcessInputEvents (void) -{ - KdProcessInputEvents (); -} - -void -xeglUseMsg (void) -{ - ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] " - "specify screen characteristics\n"); - ErrorF ("-softcursor force software cursor\n"); -} - -int -xeglProcessArgument (int argc, - char **argv, - int i) -{ - if (!strcmp (argv[i], "-screen")) - { - if ((i + 1) < argc) - { - xglParseScreen (argv[i + 1]); - } - else - return 1; - - return 2; - } - else if (!strcmp (argv[i], "-softcursor")) - { - softCursor = TRUE; - return 1; - } - - return 0; -} - -void -xeglAbort (void) -{ -} - -void -xeglGiveUp (void) -{ - AbortDDX (); -} - -void -xeglOsVendorInit (void) -{ -} diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h deleted file mode 100644 index 0a07397bf..000000000 --- a/hw/xgl/egl/xegl.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright © 2005 Novell, Inc. - * - * 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 - * Novell, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * Novell, Inc. makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NOVELL, INC. 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. - * - * Author: David Reveman - */ - -#ifndef _XEGL_H_ -#define _XEGL_H_ - -#include "xgl.h" - -#include "randrstr.h" - -#define KD_BUTTON_1 0x01 -#define KD_BUTTON_2 0x02 -#define KD_BUTTON_3 0x04 -#define KD_BUTTON_4 0x08 -#define KD_BUTTON_5 0x10 -#define KD_MOUSE_DELTA 0x80000000 - -typedef struct _KdMouseFuncs { - Bool (*Init) (void); - void (*Fini) (void); -} KdMouseFuncs; - -typedef struct _KdKeyboardFuncs { - void (*Load) (void); - int (*Init) (void); - void (*Leds) (int); - void (*Bell) (int, int, int); - void (*Fini) (void); - int LockLed; -} KdKeyboardFuncs; - -typedef struct _KdOsFuncs { - int (*Init) (void); - void (*Enable) (void); - Bool (*SpecialKey) (KeySym); - void (*Disable) (void); - void (*Fini) (void); - void (*pollEvents) (void); -} KdOsFuncs; - -typedef struct _KdMouseMatrix { - int matrix[2][3]; -} KdMouseMatrix; - -typedef enum _KdMouseState { - start, - button_1_pend, - button_1_down, - button_2_down, - button_3_pend, - button_3_down, - synth_2_down_13, - synth_2_down_3, - synth_2_down_1, - num_input_states -} KdMouseState; - -#define KD_MAX_BUTTON 7 - -typedef struct _KdMouseInfo { - struct _KdMouseInfo *next; - void *driver; - void *closure; - char *name; - char *prot; - char map[KD_MAX_BUTTON]; - int nbutton; - Bool emulateMiddleButton; - unsigned long emulationTimeout; - Bool timeoutPending; - KdMouseState mouseState; - Bool eventHeld; - xEvent heldEvent; - unsigned char buttonState; - int emulationDx, emulationDy; - int inputType; - Bool transformCoordinates; -} KdMouseInfo; - -typedef struct _xeglScreen { - CloseScreenProcPtr CloseScreen; - ScreenPtr pScreen; - DDXPointRec origin; -} xeglScreenRec, *xeglScreenPtr; - -extern KdMouseInfo *kdMouseInfo; -extern KdOsFuncs *kdOsFuncs; -extern Bool kdDontZap; -extern Bool kdDisableZaphod; -extern DevPrivateKey xeglScreenPrivateKey; -extern KdMouseFuncs LinuxEvdevMouseFuncs; -extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs; - -#define RR_Rotate_All \ - (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270) -#define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y) - -#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) -#define KdScreenPriv(pScreen) \ - xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen) - -void -eglInitInput (KdMouseFuncs *pMouseFuncs, - KdKeyboardFuncs *pKeyboardFuncs); - -void -KdParseMouse (char *arg); - -KdMouseInfo * -KdMouseInfoAdd (void); - -void -KdMouseInfoDispose (KdMouseInfo *mi); - -int -KdAllocInputType (void); - -char * -KdSaveString (char *str); - -Bool -KdRegisterFd (int type, - int fd, - void (*read) (int fd, void *closure), - void *closure); - -void -KdUnregisterFds (int type, - Bool do_close); - -void -KdEnqueueKeyboardEvent (unsigned char scan_code, - unsigned char is_up); - -void -KdEnqueueMouseEvent (KdMouseInfo *mi, - unsigned long flags, - int rx, - int ry); - -void -KdRegisterFdEnableDisable (int fd, - int (*enable) (int fd, void *closure), - void (*disable) (int fd, void *closure)); - -void -KdWakeupHandler (pointer data, - int result, - pointer readmask); - -Bool -KdLegalModifier (unsigned int key, - DeviceIntPtr pDev); - -void -KdProcessInputEvents (void); - -void -xeglInitOutput (ScreenInfo *pScreenInfo, - int argc, - char **argv); - -Bool -xeglLegalModifier (unsigned int key, - DevicePtr pDev); - -void -xeglProcessInputEvents (void); - -void -xeglInitInput (int argc, - char **argv); - -void -xeglUseMsg (void); - -int -xeglProcessArgument (int argc, - char **argv, - int i); - -void -xeglAbort (void); - -void -xeglGiveUp (void); - -void -xeglOsVendorInit (void); - -#endif /* _XEGL_H_ */ diff --git a/hw/xgl/egl/xeglinit.c b/hw/xgl/egl/xeglinit.c deleted file mode 100644 index c28d946ac..000000000 --- a/hw/xgl/egl/xeglinit.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright © 2004 David Reveman - * - * 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 - * David Reveman not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * David Reveman makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL DAVID REVEMAN 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. - * - * Author: David Reveman - */ - -#include "xegl.h" - -static xglScreenInfoRec xglScreenInfo = { - NULL, 0, 0, 0, 0, - DEFAULT_GEOMETRY_DATA_TYPE, - DEFAULT_GEOMETRY_USAGE, - FALSE, - XGL_DEFAULT_PBO_MASK, - FALSE, - FALSE -}; - -#ifdef GLXEXT -static Bool loadGlx = TRUE; -#endif - -void -InitOutput (ScreenInfo *pScreenInfo, - int argc, - char **argv) -{ - -#ifdef GLXEXT - if (loadGlx) - { - if (!xglLoadGLXModules ()) - FatalError ("No GLX modules loaded"); - } -#endif - - xeglInitOutput (pScreenInfo, argc, argv); -} - -Bool -LegalModifier (unsigned int key, - DeviceIntPtr pDev) -{ - return xeglLegalModifier (key, pDev); -} - -void -ProcessInputEvents (void) -{ - xeglProcessInputEvents (); -} - -void -InitInput (int argc, - char **argv) -{ - xeglInitInput (argc, argv); -} - -void -ddxUseMsg (void) -{ - ErrorF ("\nXgl usage:\n"); - -#ifdef GLXEXT - ErrorF ("-noglx don't load glx extension\n"); -#endif - - xglUseMsg (); - ErrorF ("\nXegl usage:\n"); - xeglUseMsg (); -} - -int -ddxProcessArgument (int argc, - char **argv, - int i) -{ - int skip; - -#ifdef GLXEXT - if (!strcmp (argv[i], "-noglx")) - { - loadGlx = FALSE; - return 1; - } -#endif - - skip = xglProcessArgument (argc, argv, i); - if (skip) - return skip; - - return xeglProcessArgument (argc, argv, i); -} - -void -AbortDDX (void) -{ - xeglAbort (); -} - -void -ddxGiveUp (void) -{ - xeglGiveUp (); -} - -void -OsVendorInit (void) -{ - xeglOsVendorInit (); -} diff --git a/hw/xgl/egl/xeglinput.c b/hw/xgl/egl/xeglinput.c deleted file mode 100644 index 8c50b7846..000000000 --- a/hw/xgl/egl/xeglinput.c +++ /dev/null @@ -1,168 +0,0 @@ -#include "xgl.h" -#include "xegl.h" - -KdOsFuncs *kdOsFuncs; -Bool kdEmulateMiddleButton; -Bool kdRawPointerCoordinates; -Bool kdDontZap; -Bool kdDisableZaphod; -int kdScreenPrivateIndex; - -static char * -KdParseFindNext (char *cur, char *delim, char *save, char *last) -{ - while (*cur && !strchr (delim, *cur)) - { - *save++ = *cur++; - } - *save = 0; - *last = *cur; - if (*cur) - cur++; - return cur; -} - -/* - * Mouse argument syntax: - * - * device,protocol,options... - * - * Options are any of: - * 1-5 n button mouse - * 2button emulate middle button - * {NMO} Reorder buttons - */ -char * -KdSaveString (char *str) -{ - char *n = (char *) xalloc (strlen (str) + 1); - - if (!n) - return 0; - strcpy (n, str); - return n; -} - -/* - * Parse mouse information. Syntax: - * - * ,,{,