Files
xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kEvent.c

74 lines
2.2 KiB
C

/*-
* Copyright (C) 1994 Bradley A. Grantham and Lawrence A. Kesteloot
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The names of the Alice Group or any of its members may not be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "mac68k.h"
void mac68k_enqevents(
void)
{
int len, i;
adb_event_t e[128];
char str[100];
while(1){
len = read (mac_adbfd, e, sizeof (e));
if(len == -1){
ErrorF("Failure to read from ADB device\n");
FatalError(sys_errlist[errno]);
}
if(len == 0)
break;
len /= sizeof (e[0]);
for (i = 0; i < len; i++) {
if (e[i].def_addr == ADBADDR_MS) {
mac68k_processmouse(mac68k_mouse, &e[i]);
}else if (e[i].def_addr == ADBADDR_KBD) {
mac68k_processkbd(mac68k_kbd, &e[i]);
}
}
}
}
void ProcessInputEvents (
void)
{
mieqProcessInputEvents ();
miPointerUpdate ();
}