retain compatibility with old firm_event. Perhaps we should bump the protocol

version with an ioctl?
This commit is contained in:
christos 2009-01-11 23:36:39 +00:00
parent 9273b33558
commit ced9088db5
3 changed files with 25 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.61 2008/04/20 03:05:55 tsutsui Exp $ */
/* $NetBSD: kbd.c,v 1.62 2009/01/11 23:36:39 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.61 2008/04/20 03:05:55 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.62 2009/01/11 23:36:39 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -790,7 +790,7 @@ kbd_input_event(struct kbd_softc *k, int code)
fe->id = KEY_CODE(code);
fe->value = KEY_UP(code) ? VKEY_UP : VKEY_DOWN;
getmicrotime(&fe->time);
firm_gettime(fe);
k->k_events.ev_put = put;
EV_WAKEUP(&k->k_events);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ms.c,v 1.37 2008/04/20 03:05:55 tsutsui Exp $ */
/* $NetBSD: ms.c,v 1.38 2009/01/11 23:36:39 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.37 2008/04/20 03:05:55 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.38 2009/01/11 23:36:39 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -347,7 +347,7 @@ ms_input(struct ms_softc *ms, int c)
d = to_one[d - 1]; /* from 1..7 to {1,2,4} */
fe->id = to_id[d - 1]; /* from {1,2,4} to ID */
fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
getmicrotime(&fe->time);
firm_gettime(fe);
ADVANCE;
ub ^= d;
}
@ -355,7 +355,7 @@ ms_input(struct ms_softc *ms, int c)
NEXT;
fe->id = LOC_X_DELTA;
fe->value = ms->ms_dx;
getmicrotime(&fe->time);
firm_gettime(fe);
ADVANCE;
ms->ms_dx = 0;
}
@ -363,7 +363,7 @@ ms_input(struct ms_softc *ms, int c)
NEXT;
fe->id = LOC_Y_DELTA;
fe->value = ms->ms_dy;
getmicrotime(&fe->time);
firm_gettime(fe);
ADVANCE;
ms->ms_dy = 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vuid_event.h,v 1.4 2006/08/28 16:41:04 he Exp $ */
/* $NetBSD: vuid_event.h,v 1.5 2009/01/11 23:36:39 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -43,6 +43,11 @@
#ifndef _SUN_VUID_EVENT_H_
#define _SUN_VUID_EVENT_H_
struct firm_timeval {
long tv_sec;
long tv_usec;
};
/*
* The following is a minimal emulation of Sun's `Firm_event' structures
* and related operations necessary to make X11 happy (i.e., make it
@ -52,9 +57,19 @@ typedef struct firm_event {
u_short id; /* key or MS_* or LOC_[XY]_DELTA */
u_short pad; /* unused, at least by X11 */
int value; /* VKEY_{UP,DOWN} or locator delta */
struct timeval time;
struct firm_timeval time;
} Firm_event;
__BEGIN_DECLS
static __inline void firm_settime(Firm_event *fev)
{
struct timeval tv;
getmicrotime(&tv);
fev->time.tv_sec = (long)tv.tv_sec;
fev->time.tv_usec = (long)tv.tv_usec;
}
__END_DECLS
/*
* Special `id' fields. These weird numbers simply match the old binaries.
* Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).