xserver/hw/xgl/egl Makefile.am, NONE, 1.1 evdev.c, NONE, 1.1 kinput.c, NONE, 1.1 kkeymap.h, NONE, 1.1 xegl.c, NONE, 1.1 xegl.h, NONE, 1.1 xeglinput.c, NONE, 1.1
Jon Smirl <xserver-commit-u7BhqnqprCWvj1b/[email protected]> Sat, 4 Jun 2005 16:33:06 -0700 (PDT)
| Newsgroups | gmane.comp.freedesktop.xserver.cvs |
|---|---|
| Message-ID | <[email protected]> |
Committed by: jonsmirl
Update of /cvs/xserver/xserver/hw/xgl/egl
In directory gabe:/tmp/cvs-serv28582
Added Files:
Makefile.am evdev.c kinput.c kkeymap.h xegl.c xegl.h
xeglinput.c
Log Message:
Initial Xegl check-in. Works on EGL fbdev driver
Input is totally broken.
--- NEW FILE: Makefile.am ---
INCLUDES = \
@XGL_INCS@ \
@XEGLSERVER_CFLAGS@ \
@XSERVER_CFLAGS@
bin_PROGRAMS = Xegl
Xegl_SOURCES = xegl.c xeglinput.c kinput.c evdev.c
Xegl_LDADD = \
@XGL_LIBS@ \
@XEGLSERVER_LIBS@ \
@XSERVER_LIBS@
Xegl_DEPENDENCIES = @XGL_LIBS@
--- NEW FILE: evdev.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: kinput.c ---
/*
* Id: kinput.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
*
* Copyright 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
[...1644 lines suppressed...]
miPointerWarpCursor (pScreen, x, y);
KdUnblockSigio ();
}
miPointerScreenFuncRec kdPointerScreenFuncs =
{
KdCursorOffScreen,
KdCrossScreen,
KdWarpCursor
};
void
ProcessInputEvents ()
{
mieqProcessInputEvents();
miPointerUpdate();
// if (kdSwitchPending)
// KdProcessSwitch ();
KdCheckLock ();
}
--- NEW FILE: kkeymap.h ---
/*
* Id: kkeymap.h,v 1.1 1999/11/02 03:54:46 keithp Exp $
*
* Copyright 1999 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $RCSId: xc/programs/Xserver/hw/kdrive/kkeymap.h,v 1.1 1999/11/19 13:53:50 hohndel Exp $ */
/*
* 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 */
--- NEW FILE: xegl.c ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: xegl.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 _KdScreenInfo {
struct _KdScreenInfo *next;
ScreenPtr pScreen;
void *driver;
Rotation randr; /* rotation and reflection */
int width;
int height;
int rate;
int width_mm;
int height_mm;
int subpixel_order;
Bool dumb;
Bool softCursor;
int mynum;
DDXPointRec origin;
} KdScreenInfo;
#define KD_MAX_FB 2
#define KD_MAX_PSEUDO_DEPTH 8
#define KD_MAX_PSEUDO_SIZE (1 << KD_MAX_PSEUDO_DEPTH)
typedef struct _xeglScreen {
Window win;
Colormap colormap;
CloseScreenProcPtr CloseScreen;
KdScreenInfo *screen;
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
} xeglScreenRec, *xeglScreenPtr;
extern KdMouseInfo *kdMouseInfo;
extern KdOsFuncs *kdOsFuncs;
extern Bool kdDontZap;
extern Bool kdDisableZaphod;
extern int kdScreenPrivateIndex;
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) \
(pScreen)->devPrivates[kdScreenPrivateIndex].ptr)
#define KdScreenPriv(pScreen) xeglScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
extern void eglInitInput(KdMouseFuncs *pMouseFuncs, KdKeyboardFuncs *pKeyboardFuncs);
extern void KdParseMouse(char *arg);
extern KdMouseInfo *KdMouseInfoAdd(void);
extern void KdMouseInfoDispose(KdMouseInfo *mi);
extern int KdAllocInputType(void);
extern char *KdSaveString (char *str);
extern Bool KdRegisterFd(int type, int fd, void (*read) (int fd, void *closure), void *closure);
extern void KdUnregisterFds(int type, Bool do_close);
extern void KdEnqueueKeyboardEvent(unsigned char scan_code, unsigned char is_up);
extern void KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry);
extern void KdRegisterFdEnableDisable(int fd,
int (*enable)(int fd, void *closure),
void (*disable)(int fd, void *closure));
extern void KdWakeupHandler(int screen, pointer data, unsigned long lresult, pointer readmask);
--- NEW FILE: xeglinput.c ---
#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:
*
* <device>,<nbutton>,<protocol>{,<option>}...
*
* options: {nmo} pointer mapping (e.g. {321})
* 2button emulate middle button
* 3button dont emulate middle button
*/
void
KdParseMouse (char *arg)
{
char save[1024];
char delim;
KdMouseInfo *mi;
int i;
mi = KdMouseInfoAdd ();
if (!mi)
return;
mi->name = 0;
mi->prot = 0;
mi->emulateMiddleButton = kdEmulateMiddleButton;
mi->transformCoordinates = !kdRawPointerCoordinates;
mi->nbutton = 3;
for (i = 0; i < KD_MAX_BUTTON; i++)
mi->map[i] = i + 1;
if (!arg)
return;
if (strlen (arg) >= sizeof (save))
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
mi->name = KdSaveString (save);
if (delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
{
mi->nbutton = save[0] - '0';
if (mi->nbutton > KD_MAX_BUTTON)
{
UseMsg ();
return;
}
}
if (!delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0])
mi->prot = KdSaveString (save);
while (delim == ',')
{
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0] == '{')
{
char *s = save + 1;
i = 0;
while (*s && *s != '}')
{
if ('1' <= *s && *s <= '0' + mi->nbutton)
mi->map[i] = *s - '0';
else
UseMsg ();
s++;
}
}
else if (!strcmp (save, "2button"))
mi->emulateMiddleButton = TRUE;
else if (!strcmp (save, "3button"))
mi->emulateMiddleButton = FALSE;
else if (!strcmp (save, "rawcoord"))
mi->transformCoordinates = FALSE;
else if (!strcmp (save, "transform"))
mi->transformCoordinates = TRUE;
else
UseMsg ();
}
}
KdMouseInfo *kdMouseInfo;
KdMouseInfo *
KdMouseInfoAdd (void)
{
KdMouseInfo *mi, **prev;
mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
if (!mi)
return 0;
bzero (mi, sizeof (KdMouseInfo));
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
*prev = mi;
return mi;
}
void
KdMouseInfoDispose (KdMouseInfo *mi)
{
KdMouseInfo **prev;
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
if (*prev == mi)
{
*prev = mi->next;
if (mi->name)
xfree (mi->name);
if (mi->prot)
xfree (mi->prot);
xfree (mi);
break;
}
}