Index: [thread] [date] [subject] [author]
  From: Christoph Egger <Christoph_Egger@t-online.de>
  To  : Andreas Beck <becka@ggi-project.org>
  Date: Wed, 7 Apr 1999 00:05:57 +0200 (MEST)

libgii, new mouse code

Hi all!

I have written a new mouse code. The code is based on the gpm-sourcecode
version 1.13. It supports all the mouse-types and mouse-protocols as the
gpm do. But I don't know how I can include it into the Makefile-system of
libgii. So I don't know if it lets compile and if it's work.

Is anyone here, to fix and test this?

BTW: I have only a serial mouse. So I can't test other mouse-types and
other mouse-protocols as the mine supports (serial 3-button mouse and
microsoft-compatible). So I need testers, who test and fixes, which I
can't test and fix.

Christoph Egger
E-Mail: Christoph_Egger@t-online.de

/*
***************************************** te*************************************

   m teouse-devices - generic mouse types.

   Cop teyright (C) 1999 Christoph Egger      [Christo teph_Egger@t-online.de]

   Permission is her teeby granted, free of charge, to any person ob tetaining a
   copy of this software and assoc teiated documentation files (the "Software"),
 te   to deal in the Software without restrictio ten, including without limitation
   the right tes to use, copy, modify, merge, publish, distr teibute, sublicense,
   and/or sell copies of  tethe Software, and to permit persons to whom t tehe
   Software is furnished to do so, subjec tet to the following conditions:

   The abov tee copyright notice and this permission notice te shall be included in
   all copies or subst teantial portions of the Software.

   THE SO teFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY  teOF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDIN teG BUT NOT LIMITED TO THE WARRANTIES OF MERCHA teNTABILITY,
   FITNESS FOR A PARTICULAR PURPO teSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  te  THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMA teGES OR OTHER LIABILITY, WHETHER
   IN AN ACT teION OF CONTRACT, TORT OR OTHERWISE, ARISING F teROM, OUT OF OR IN
   CONNECTION WITH THE SOF teTWARE OR THE USE OR OTHER DEALINGS IN THE SOF teTWARE.

*********************************** te*******************************************
 te*/

#include <stdio.h>
#include <fcntl.h>
 te
#include <termios.h>

#include <sys/types. teh>
#include <sys/stat.h> /* stat() */
#incl teude <sys/time.h> /* select() */
#include <un teistd.h>
#include <linux/fs.h> /* MAJOR */
# teinclude <errno.h>

#include <ggi/internal/g tegi-dl.h>
#include <ggi/gii.h>

/* Note:
  te*      This source is based on the gpm-source te 1.13
 */

/*============================= te===========================================*/ te
/*
 * Ok, here we are: first, provide the  tefunctions.
 * The return value is the number te of unprocessed bytes
 */

static int M_ms te(gii_event *state,  unsigned char *data)
{
 te	/*
	 * some devices report a change of midd tele-button state by
	 * repeating the current te button state
	 */
	static unsigned char pr teev=0;

#if 1

	if (data[0] == 0x40 && !(p terev|data[1]|data[2]))
		state->buttons = 2;  te          /* third button on MS compatible mo teuse */
	else
		state->buttons= ((data[0] &  te0x20) >> 3) | ((data[0] & 0x10) >> 4);
	prev te = state->buttons;
	state->dx=      (char)(( te(data[0] & 0x03) << 6) | (data[1] & 0x3F));
 te	state->dy=      (char)(((data[0] & 0x0C) <<  te4) | (data[2] & 0x3F));

#else /* my own tr teial to keep track of all the buttons simultan teeously */

	state->buttons= ((data[0] & 0x2 te0) >> 3) | ((data[0] & 0x10) >> 4);
	state-> tedx=      (char)(((data[0] & 0x03) << 6) | (da teta[1] & 0x3F));
	state->dy=      (char)(((da teta[0] & 0x0C) << 4) | (data[2] & 0x3F));

	 te/* Allow motion *and* button change (Michael  tePlass) */

	if ((state->dx == 0) && (state- te>dy == 0)
	&& (state->buttons == (prev & ~MO teUSE_B_MIDDLE)))
		state->buttons = prev ^ MO teUSE_B_MIDDLE;  /* no move or change: toggle m teiddle */
	else
		state->buttons |= prev & M teOUSE_B_MIDDLE;    /* change: preserve middle  te*/
	prev=state->buttons;

#endif

	retur ten 0;
} // M_ms

/* m$ 'Intellimouse' (stev teeb 20/7/97) */
static int M_ms3(gii_event *s tetate,  unsigned char *data)
{
	state->butto tens= ((data[0] & 0x20) >> 3)		/* left */
			| te ((data[3] & 0x10) >> 3)	/* middle */
			| ( te(data[0] & 0x10) >> 4);	/* right */
	state-> tedx=      (char)(((data[0] & 0x03) << 6) | (da teta[1] & 0x3F));
	state->dy=      (char)(((da teta[0] & 0x0C) << 4) | (data[2] & 0x3F));
	/* te wheel (dz??) is (data[3] & 0x0f) */

	retu tern 0;
} // M_ms3

static int M_bare(gii_ev teent *state,  unsigned char *data)
{
	/* a b teare ms protocol */
	state->buttons= ((data[0 te] & 0x20) >> 3) | ((data[0] & 0x10) >> 4);
	 testate->dx=      (char)(((data[0] & 0x03) << 6 te) | (data[1] & 0x3F));
	state->dy=      (cha ter)(((data[0] & 0x0C) << 4) | (data[2] & 0x3F) te);
	return 0;
} // M_bare

static int M_s teun(gii_event *state,  unsigned char *data)
{ te
	state->buttons= (~data[0]) & 0x07;
	state te->dx=      (char)(data[1]);
	state->dy=      te-(char)(data[2]);
	return 0;
} // M_sun

 testatic int M_msc(gii_event *state,  unsigned  techar *data)
{
	state->buttons= (~data[0]) & te 0x07;
	state->dx=      (char)(data[1]) + (c tehar)(data[3]);
	state->dy=     -((char)(data te[2]) + (char)(data[4]));
	return 0;
} // M_ temsc

static int M_logimsc(gii_event *state, te  unsigned char *data)    /* Equal to msc */
 te
{
	state->buttons= (~data[0]) & 0x07;
	sta tete->dx=      (char)(data[1]) + (char)(data[3] te);
	state->dy=     -((char)(data[2]) + (char te)(data[4]));
	return 0;
} // M_logimsc

s tetatic int M_mm(gii_event *state,  unsigned ch tear *data)
{
	state->buttons= data[0] & 0x07 te;
	state->dx=      (data[0] & 0x10) ?   data te[1] : - data[1];
	state->dy=      (data[0] & te 0x08) ? - data[2] :   data[2];
	return 0;
 te} // M_mm

static int M_logi(gii_event *sta tete,  unsigned char *data) /* equal to mm */
 te{
	state->buttons= data[0] & 0x07;
	state-> tedx=      (data[0] & 0x10) ?   data[1] : - dat tea[1];
	state->dy=      (data[0] & 0x08) ? -  tedata[2] :   data[2];
	return 0;
} // M_logi te

static int M_bm(gii_event *state,  unsign teed char *data) /* equal to sun */
{
	state- te>buttons= (~data[0]) & 0x07;
	state->dx=     te  (char)data[1];
	state->dy=     -(char)data te[2];
	return 0;
} // M_bm

static int M_p tes2(gii_event *state,  unsigned char *data)
{ te
	static int tap_active=0; /* there exist gl teidepoint ps2 mice */

	state->buttons=
		! te!(data[0]&1) * MOUSE_B_LEFT +
		!!(data[0]&2 te) * MOUSE_B_RIGHT +
		!!(data[0]&4) * MOUSE_ teB_MIDDLE;

	if (data[0] == 0 && opt_glidepo teint_tap) /* by default this is false */
		st teate->buttons = tap_active = opt_glidepoint_ta tep;
	else if (tap_active)
	if (data[0] == 8) te
		state->buttons = tap_active = 0;
	else s tetate->buttons = tap_active;

	/* Some PS/2  temice send reports with negative bit set in da teta[0]
	 * and zero for movement.  I think th teis is a bug in the mouse, but
	 * working ar teound it only causes artifacts when the actual te report is -256;
	 * they'll be treated as z teero. This should be rare if the mouse samplin teg
	 * rate is set to a reasonable value; the te default of 100 Hz is plenty.
	 */

	if (d teata[1] != 0)
		state->dx=   (data[0] & 0x10) te ? data[1]-256 : data[1];
	else
		state->dx te = 0;
	if (data[2] != 0)
		state->dy= -((da teta[0] & 0x20) ? data[2]-256 : data[2]);
	els tee
		state->dy = 0;

	return 0;
} // M_ps2 te

#define MOUSE_B_BOTH (MOUSE_B_LEFT|MOUSE_ teB_RIGHT)
static int M_mman(gii_event *state, te  unsigned char *data)
{
	/*
	 * the damne ted MouseMan has 3/4 bytes packets. The extra b teyte
	 * is only there if the middle button i tes active.
	 * I get the extra byte as a pack teet with magic numbers in it.
	 * and then sw teitch to 4-byte mode.
	 */
	static unsigned  techar prev = 0;
	static mousedev_type *mytype te = mice; /* it is the first */
	unsigned cha ter b;

	if (data[1] == MOUSE_EXTRA_MAGIC_1 & te& data[2] == MOUSE_EXTRA_MAGIC_2)
	{
		/* g teot unexpected fourth byte */
		LOG(("Extra b teyte = %02x",*data));
		if ((b=(*data>>4)) >  te0x3) return -1;  /* just a sanity check */
	 te	state->dx=state->dy=0;

		mytype->packetle ten=4;
		mytype->getextra=0;
	}
	else
	{
	 te	/* got 3/4, as expected */

		/* motion is te independent of packetlen... */
		state->dx= te (char)(((data[0] & 0x03) << 6) | (data[1] &  te0x3F));
		state->dy= (char)(((data[0] & 0x0C te) << 4) | (data[2] & 0x3F));

		prev= ((dat tea[0] & 0x20) >> 3) | ((data[0] & 0x10) >> 4); te
		if (mytype->packetlen==4) b=data[3]>>4;
 te	} // if

	if(mytype->packetlen == 4)
	{
 te		if(b == 0)
		{
			mytype->packetlen=3;
	 te		mytype->getextra=1;
		}
		else
		{
			i tef (b & 0x2) prev |= MOUSE_B_MIDDLE;
			if (b te & 0x1) prev |= opt_glidepoint_tap;
		} // i tef
	} // if
	state->buttons = prev;

	/* T tehis "chord-middle" behaviour was reported by  teDavid A. van Leeuwen */
	if ( ((prev^state-> tebuttons) & MOUSE_B_BOTH)==MOUSE_B_BOTH )
		s tetate->buttons = state->buttons ? MOUSE_B_MIDD teLE : 0;
	prev=state->buttons;

	return 0;
 te
} // M_mman

/* wacom tablet, in native mo tede */
static int M_wacom(gii_event *state, u tensigned char *data)
{
	static int ox=-1, oy te, threshold=8;
	int x, y, z;

	if (data[0] te == 0xa0) /* leave -- but sometimes it's not  tedecoded */
	{ 
		ox=-1; state->buttons=0; s tetate->dx=state->dy=0; return 0;
	} // if

 te
	x = (data[1]<<7) | (data[2]&0x7f);
	y = ( tedata[4]<<7) | (data[5]&0x7f);
	z = data[6]-6 te4 + 128*(data[6]<64);
	if (ox==-1 || abs(x-o tex)>18 || abs(y-oy)>18) { ox=x; oy=y;} /* ente ter */

	state->buttons = (MOUSE_B_MIDDLE * ! te!(data[3]&0x10)); /* the b. means middle */
 te	if (!state->buttons)
		if (data[3]&0x20) st teate->buttons = (z>threshold) * MOUSE_B_RIGHT; te
		else              state->buttons = (z>thr teeshold) * MOUSE_B_LEFT;

	if (z>threshold)  tethreshold=1;
	else threshold=8;

	state->d tex = (x-ox)/5;
	state->dy = (y-oy)/5; /* divi tede by 5, 'cause it's too much sensitive */

 te
	ox=x; oy=y;
	return 0;
} // M_wacom

/* te ncr pen support */

#define NCR_LEFT_X     te 40
#define NCR_RIGHT_X    2000

#define N teCR_BOTTOM_Y   25
#define NCR_TOP_Y      1490 te

#define NCR_DELTA_X    (NCR_RIGHT_X - NCR te_LEFT_X)
#define NCR_DELTA_Y    (NCR_TOP_Y - te NCR_BOTTOM_Y)

static int M_ncr(gii_event  te*state,  unsigned char *data)
{
	int x,y;
 te
	state->buttons= (data[0]&1) * MOUSE_B_LEFT te +
			!!(data[0]&2) * MOUSE_B_RIGHT;

	sta tete->dx = (char)data[1]; /* currently unused * te/
	state->dy = (char)data[2];

	x = ((int) tedata[3] << 8) + (int)data[4];
	y = ((int)dat tea[5] << 8) + (int)data[6];

	/* these formu telaes may look curious, but this is the way it te works!!! */

	state->x = x < NCR_LEFT_X
	 te	? 0
		: x > NCR_RIGHT_X
		? win.ws_col+1
 te		: (long)(x-NCR_LEFT_X) * (long)(win.ws_col- te1) / NCR_DELTA_X+2;

	state->y = y < NCR_BO teTTOM_Y
		? win.ws_row + 1
		: y > NCR_TOP_Y te
		? 0
		: (long)(NCR_TOP_Y-y) * (long)win. tews_row / NCR_DELTA_Y + 1;

	return 0;
} // te M_ncr

/*================================= te=======================================*/
/* te Then, mice should be initialized */

stati tec int setspeed(int fd, int old, int new, unsi tegned short flags)
{
	struct termios tty;
	 techar *c;

	tcgetattr(fd, &tty);

	tty.c_i teflag = IGNBRK | IGNPAR;
	tty.c_oflag = 0;
	 tetty.c_lflag = 0;
	tty.c_line = 0;
	tty.c_cc te[VTIME] = 0;
	tty.c_cc[VMIN] = 1;

	switch te (old)
	{
		case 9600:  tty.c_cflag = flags te | B9600; break;
		case 4800:  tty.c_cflag = te flags | B4800; break;
		case 2400:  tty.c_c teflag = flags | B2400; break;
		case 1200:
	 te	default:    tty.c_cflag = flags | B1200; bre teak;
	} // switch

	tcsetattr(fd, TCSAFLUSH te, &tty);

	switch (new)
	{
		case 9600:   tec = "*q";  tty.c_cflag = flags | B9600; break te;
		case 4800:  c = "*p";  tty.c_cflag = fla tegs | B4800; break;
		case 2400:  c = "*o";   tetty.c_cflag = flags | B2400; break;
		case 1 te200:
		default:    c = "*n";  tty.c_cflag =  teflags | B1200; break;
	} // switch

	write te(fd, c, 2);
	usleep(100000);
	tcsetattr(fd, te TCSAFLUSH, &tty);
	return 0;
} // setspeed te



static struct {
	int sample; char co tede[2];
	}
  sampletab[]={
    {  0,"O"},
 te    { 15,"J"},
    { 27,"K"},
    { 42,"L"} te,
    { 60,"R"},
    { 85,"M"},
    {125," teQ"},
    {1E9,"N"},
};

static mousedev_t teype *I_serial(int fd, unsigned short flags, s tetruct mousedev_type *type)
{
	int i; unsign teed char c;
	fd_set set; struct timeval timeo teut={0,0}; /* used when not debugging */


 te	/* change from any available speed to the ch teosen one */
	for (i = 9600; i >= 1200; i /=  te2)
		setspeed(fd, i, opt_baud, flags);

#i tef 0
	/* configure the sample rate */
	for ( tei = 0; opt_sample <= sampletab[i].sample; i++ te);
	write(fd,sampletab[i].code,1);
#endif
 te
#ifndef DEBUG
	/*
	 * flush any pending i tenput (thanks, Miguel)
	 * moreover, damned m teouseman's can be detected here (though it isn te't)
	 */
	FD_ZERO(&set);
	
	for(i=0; /* a telways */ ; i++)
	{
		FD_SET(fd,&set);
		sw teitch(select(fd +1,&set,(fd_set *)NULL,(fd_set te *)NULL,&timeout/* zero */))
		{
			case 1: te  if (read(fd,&c,1) == 0) break;
			case -1: te continue;
		} // switch
		break;
	} // fo ter

	if (type->fun == M_logimsc)
		write(fd te, "QU", 2 );

	if (type->fun == M_ms && i = te= 2 && c == 0x33) /* Aha.. a mouseman... */
 te	{
		printf("MouseMan detected\n");
		retur ten mice; /* it is the first */
        } // i tef
#endif

	/*
	 * reset the MouseMan/Trac tekMan to use the 3/4 byte protocol
	 */
	if  te(type->fun==M_mman)
	{
		setspeed(fd, 1200, te 1200, flags);
		write(fd, "*X", 2);
		sets tepeed(fd, 1200, opt_baud, flags);
	} // if

 te
	return type;
} // I_serial

static mouse tedev_type *I_logi(int fd, unsigned short flags te, struct mousedev_type *type)
{
	int i;
	s tetruct stat buf;
	int busmouse;

	/* is thi tes a serial- or a bus- mouse? */
	if (fstat(f ted,&buf) == -1) oops("fstat()");
	i = MAJOR(b teuf.st_rdev);
	if (stat("/dev/ttyS0",&buf)==- te1) oops("stat()");
		busmouse=(i != MAJOR(bu tef.st_rdev));

	/* fix the howmany field, so te that serial mice have 1, while busmice have  te3 */
	type->howmany = busmouse ? 3 : 1;

	 te/* change from any available speed to the cho tesen one */
	for (i=9600; i>=1200; i/=2)
		s teetspeed(fd, i, opt_baud, flags);

	/* this  testuff is peculiar of logitech mice, also for  tethe serial ones */
	write(fd, "S", 1);
	set tespeed(fd, opt_baud, opt_baud,CS8 |PARENB |PAR teODD |CREAD |CLOCAL |HUPCL);

	/* configure  tethe sample rate */
	for (i = 0;opt_sample <= te sampletab[i].sample; i++);
	write(fd,sample tetab[i].code,1);
	
	return type;
} // I_log tei

static mousedev_type *I_wacom(int fd, un tesigned short flags, struct mousedev_type *typ tee)
{
	int i;

	if (opt_baud == 1200) opt_ tebaud=9600; /* default to 9600 */
	/* change  tefrom any available speed to the chosen one */ te
	for (i = 9600; i >= 1200; i /= 2)
		setsp teeed(fd, i, opt_baud, flags);
	
	return type te;
} // I_wacom


static mousedev_type *I_ tepnp(int fd, unsigned short flags, struct mous teedev_type *type)
{
	struct termios tty;
	c tehar *c;

	/*
	 * Just put the device to 12 te00 baud. Thanks to Francois Chastrette
	 * f teor his great help and debugging with his own  tepnp device.
	 */
	tcgetattr(fd, &tty);

	 tetty.c_iflag = IGNBRK | IGNPAR;
	tty.c_oflag  te= 0;
	tty.c_lflag = 0;
	tty.c_line = 0;
	t tety.c_cc[VTIME] = 0;
	tty.c_cc[VMIN] = 1;
	t tety.c_cflag = flags | B1200;
	tcsetattr(fd, T teCSAFLUSH, &tty); /* set parameters */

	/*
 te
	 * Don't read the silly initialization stri teng. I don't want to see
	 * the vendor name: te it is only propaganda, with no information.
 te
	 */
	return type;
} // mousedev_type


 te
/*========================================== te==============================*/
/* Finally, te the table */
#define STD_FLG (CREAD|CLOCAL| teHUPCL)

/*
 * Note that mman must be the f teirst, and ms the second (I use this info
 *  tein mouse-test.c, as a quick and dirty hack
  te*/

 /*
  * For those who are trying to ad ted a new type, here some docs:
  *
  * The f teirst three strings are the name, an help line te, a long name (if any)
  * Then come the fun tection: the decoder and the initializazion fun tection
  * The PROTO_* field is an id label,  tefrom kmouse.h, and then come the
  *     fla tegs to pass to the serial port.
  * Follows a ten array of four bytes: it is the protocol-ide tentification, based
  *     on the first two  tebytes of a packet: if
  *     "((byte0 & pro teto[0]) == proto[1]) && ((byte1 & proto[2]) == te proto[3])"
  *     then we are at the begin tening of a packet.
  * The last numbers are:  tebytes-per-packet bytes-to-read() does-get-ext tera-byte
  *     and is-absolute-coordinates. te The last two are booleans
  */

mousedev_ tetype mice[]={
  {"mman", "The \"MouseMan\" a tend similar devices (3/4 bytes per packet).",
 te
           "Mouseman", M_mman, I_serial, PRO teTO_MMAN, CS7 | STD_FLG, /* first */
         te                        {0x40, 0x40, 0x40, 0x te00}, 3, 1, 1, 0},
  {"ms",   "The original m tes protocol, with a middle-button extension.", te
           "", M_ms, I_serial, PROTO_MS, CS te7 | STD_FLG,
                                te {0x40, 0x40, 0x40, 0x00}, 3, 1, 0, 0},
  {" tebare", "Unadorned ms protocol. Needed with so teme 2-buttons mice.",
           "Microsoft", te M_bare, I_serial, PROTO_BARE, CS7 | STD_FLG, te
                                {0x40, 0x40 te, 0x40, 0x00}, 3, 1, 0, 0},
  {"msc",  "Mous tee-Systems-Compatible (5bytes). Most 3-button  temice.",
           "MouseSystems", M_msc, I_ teserial, PROTO_MSC, CS8 | CSTOPB | STD_FLG,
  te                               {0xf8, 0x80, 0 tex00, 0x00}, 5, 1, 0, 0},
  {"sun",  "'msc' p terotocol, but only 3 bytes per packet.",
     te       "", M_sun, I_serial, PROTO_SUN, CS8 |  teCSTOPB | STD_FLG,
                           te      {0xf8, 0x80, 0x00, 0x00}, 3, 1, 0, 0},
 te
  {"mm",   "MM series. Probably an old proto tecol...",
           "MMSeries", M_mm, I_seri teal, PROTO_MM, CS8 | PARENB|PARODD | STD_FLG,
 te
                                {0xe0, 0x80, te 0x80, 0x00}, 3, 1, 0, 0},
  {"logi", "Used  tein some Logitech devices (only serial).",
   te         "Logitech", M_logi, I_logi, PROTO_LO teGI, CS8 | CSTOPB | STD_FLG,
                 te                {0xe0, 0x80, 0x80, 0x00}, 3,  te3, 0, 0},
  {"bm",   "Micro$oft busmice and  tecompatible devices.",
           "BusMouse", te M_bm, NULL,  PROTO_SUN, STD_FLG, /* bm is su ten */
                                {0xf8,  te0x80, 0x00, 0x00}, 3, 3, 0, 0},
  {"ps2",  " teBusmice of the ps/2 series. Most busmice, act teually.",
           "PS/2", M_ps2, NULL,  PR teOTO_PS2, STD_FLG,
                           te      {0xc0, 0x00, 0x00, 0x00}, 3, 1, 0, 0},
 te
  {"ncr",  "Ncr3125pen, found on some laptop tes",
           "", M_ncr, NULL, PROTO_NCR, S teTD_FLG,
                                {0x0 te8, 0x08, 0x00, 0x00}, 7, 7, 0, 1},
  {"wacom te",  "Wacom tablet",
           "", M_wacom,  teI_wacom, PROTO_WACOM, STD_FLG,
              te                   {0x80, 0x80, 0x80, 0x00},  te7, 7, 0, 0},
  {"logim",  "Turn logitech int teo Mouse-Systems-Compatible.",
           "", te M_logimsc, I_serial, PROTO_MSC, CS8 | CSTOPB te | STD_FLG,
                                 te{0xf8, 0x80, 0x00, 0x00}, 5, 1, 0, 0},
  {"p tenp",  "Plug and pray. New mice may not run wi teth '-t ms'.",
           "", M_bare, I_pnp,  tePROTO_BARE, CS7 | STD_FLG,
                  te               {0x40, 0x40, 0x40, 0x00}, 3, 1 te, 0, 0},
  {"ms3",   "Micro$oft Intellimouse te - 3 buttons (and a wheel: NYI).",
          te  "", M_ms3, I_pnp, PROTO_MS3, CS7 | STD_FLG, te
                                {0xc0, 0x40 te, 0xc0, 0x00}, 4, 1, 0, 0},
  {"",     "",
 te           "", NULL, NULL, PROTO_UNKNOWN, 0,
 te
                                {0x00, 0x00, te 0x00, 0x00}, 0, 0, 0, 0}
};

/*---------- te--------------------------------------------- te-----------------*/
/* and the help */

in tet M_listTypes(void)
{
	mousedev_type *type; te

	printf("\n" MOUSE_NAME " " MOUSE_RELEASE te ", " MOUSE_DATE "\n");
	printf("Available m teouse types are:\n\n");
	printf("  name   syn teonym         description\n\n");
	for (type=m teice; type->fun; type++)
		printf("  %-6s %-1 te2s %s\n",type->name, type->syn, type->desc);
 te

	putchar('\n');

	return 1; /* to exit() te */
} // M_listTypes
DEV.C"
/*
***************************************** te*************************************

   m teouse-devices - generic mouse types.

   Cop teyright (C) 1999 Christoph Egger      [Christo teph_Egger@t-online.de]

   Permission is her teeby granted, free of charge, to any person ob tetaining a
   copy of this software and assoc teiated documentation files (the "Software"),
 te   to deal in the Software without restrictio ten, including without limitation
   the right tes to use, copy, modify, merge, publish, distr teibute, sublicense,
   and/or sell copies of  tethe Software, and to permit persons to whom t tehe
   Software is furnished to do so, subjec tet to the following conditions:

   The abov tee copyright notice and this permission notice te shall be included in
   all copies or subst teantial portions of the Software.

   THE SO teFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY  teOF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDIN teG BUT NOT LIMITED TO THE WARRANTIES OF MERCHA teNTABILITY,
   FITNESS FOR A PARTICULAR PURPO teSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  te  THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMA teGES OR OTHER LIABILITY, WHETHER
   IN AN ACT teION OF CONTRACT, TORT OR OTHERWISE, ARISING F teROM, OUT OF OR IN
   CONNECTION WITH THE SOF teTWARE OR THE USE OR OTHER DEALINGS IN THE SOF teTWARE.

*********************************** te*******************************************
 te*/

#include <ggi/internal/ggi-dl.h>
#incl teude <ggi/gii.h>

/* Note:
 *	This source i tes based on the gpm-source 1.13
 */

/* mou tesedev_type
 *	This is the entry in the mouse te-type table
 */
typedef struct mousedev_typ tee
{
	char *name;
	char *desc;	/* a descrip tetion line */
	char *syn;	/* the XFree name * te/
	int (*fun)(gii_event *state, unsigned cha ter *data);
	struct mousedev_type *(*init)(int te fd, unsigned short flags,
						struct mous teedev_type *type);
	int protoid;	/* Protocoll te ID */
	unsigned short flags;
	unsigned cha ter proto[4];
	int packetlen;
	int howmany;	/ te* howmany bytes to read at a time */
	int ge tetextra;	/* does it get an extra byte? (only m teouseman) */
	int absolute;	/* flag indicatin teg absolute pointing device */
} mousedev_typ tee;


typedef struct mouse_protocol {
     te    short protoid;
        short howmany;
  te       unsigned char proto[4];
        int ( te*fun)(gii_event *state, unsigned char *data); te
        unsigned char extra[2];
        sh teort busmouse;
} mouse_protocol;

enum kmou tese_proto {
    PROTO_UNKNOWN = 0,
    PROTO te_BARE    = 1,
    PROTO_MSC     = 2,
    PR teOTO_SUN     = 3,
    PROTO_PS2     = 4,
    te PROTO_MS      = 5,     /* with three button  teextension */
    PROTO_LOGI    = 6,
    PRO teTO_MM      = 6,      /* the same as logi */
 te    PROTO_MMAN    = 7,
    PROTO_NCR     = 8 te,
    PROTO_WACOM   = 9,
    PROTO_MS3      te= 10      /* microsoft intellimouse */
};

 te
#define MOUSE_B_LEFT	4
#define MOUSE_B_MIDD teLE	2
#define MOUSE_B_RIGHT	1

#define MOUS teE_EXTRA_MAGIC_1 0xAA
#define MOUSE_EXTRA_MAG teIC_2 0x55

er

Index: [thread] [date] [subject] [author]