diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/GetTime.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/GetTime.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/GetTime.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/GetTime.c 2004-01-03 03:40:05.000000000 -0800 @@ -0,0 +1,43 @@ +/* $Xorg: GetTime.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ +/* + +Copyright (c) 1993 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from the X Consortium. + +*/ + + +#include "Xos.h" +#include + +long +GetTimeInMillis() +{ + struct timeval tp; + + X_GETTIMEOFDAY(&tp); + return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); +} diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Imakefile xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Imakefile --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Imakefile 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Imakefile 2004-01-03 19:37:18.000000000 -0800 @@ -0,0 +1,44 @@ +#include + +SRCS = \ + mac68kEvent.c \ + mac68kMouse.c \ + mac68kKbd.c \ + mac68kScreens.c \ + mac68kKeyMap.c \ + mac68kInit.c + +OBJS = \ + mac68kEvent.o \ + mac68kMouse.o \ + mac68kKbd.o \ + mac68kScreens.o \ + mac68kKeyMap.o \ + mac68kInit.o + + DEFINES = $(SIGNAL_DEFINES) -DPASS_OPTION + INCLUDES = -I. -I../../../include -I../../../mi -I../../../mfb \ + -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) + LINTLIBS = ../../../dix/llib-ldix.ln ../../../os/llib-los.ln \ + ../../../mfb/llib-lmfb.ln ../../../mi/llib-lmi.ln \ + ../../../cfb/llib-lcfb.ln + +NormalLibraryObjectRule() + +all:: + +lintlib: + +NormalLibraryTarget(mac68k,$(OBJS)) +NormalLintTarget($(SRCS)) +#if 0 +InstallScript(X11R6,$(BINDIR)) +InstallNamedProg(X11R6.script,X11,$(BINDIR)) +InstallNamedNonExec(def.x11start,.x11start,$(LIBDIR)) +InstallNamedNonExec(xterm.tic,xterm,$(USRLIBDIR)/terminfo/x) +InstallNamedNonExec(xterms.tic,xterms,$(USRLIBDIR)/terminfo/x) +InstallNonExecFile(xterm.tic,$(LIBDIR)) +InstallNonExecFile(xterms.tic,$(LIBDIR)) +#endif +DependTarget() +InstallManPage(Xmac68k,$(MANDIR)) diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Xmac68k.man xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Xmac68k.man --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Xmac68k.man 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/Xmac68k.man 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,176 @@ +.\" $XConsortium: XmacII.man,v 1.13 94/04/18 18:05:17 rws Exp $ +.\" Copyright (c) 1989 X Consortium +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining +.\" a copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation the rights to use, copy, modify, merge, publish, +.\" distribute, sublicense, and/or sell copies of the Software, and to +.\" permit persons to whom the Software is furnished to do so, subject to +.\" the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included +.\" in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +.\" OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the X Consortium shall +.\" not be used in advertising or otherwise to promote the sale, use or +.\" other dealings in this Software without prior written authorization +.\" from the X Consortium. +.TH XMACII 1 "Release 6" "X Version 11" +.SH NAME +XmacII \- Macintosh II server for X Version 11 +.SH SYNOPSIS +.B XmacII +[ option ] ... +.SH DESCRIPTION +.I XmacII +is the server for Version 11 of the X window system on Macintosh II hardware running A/UX. +It will normally be started by the shell script +.IR X11. +.fi +.SH CONFIGURATIONS +.I XmacII +operates under A/UX Release 2.0 and later. +Color and multiple screens are supported. +.SH OPTIONS +.PP +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXmacII\fP accepts the following command line switches: +.TP 8 +.B \-screen \fInumber\fP \-depth \fInumber\fP +arranges that the given screen will operate at the given depth. +Screens are numbered from 0 and correspond to the relative position +of video cards in the Macintosh II slots. +Supported depths are 1 (monochrome at 1 bit per pixel), +8 (color at 8 bits per pixel, indexing a colormap with 256 entries), and +24 (color at 24 bits per pixel). The server starts up, by default, in the +deepest depth available for any particular screen. This option must be used to +modify that behavior. +.TP 8 +.B \-optionmouse +requires holding the option key down while pressing the arrow keys to get +middle and right mouse buttons. Allows the arrow keys to retain their normal +function +.TP 8 +.B \-noosm +don't open /dev/osm +.SH "BUTTON MAPPINGS" +Many X clients assume the mouse has three buttons. The A/UX X server simulates +the middle and right mouse buttons with keystrokes -- the left-arrow key +generates middle button events, and the right-arrow key generates right button +events -- the real mouse button generates left button events. The +open-apple or cloverleaf key is the "Meta" modifier, Meta can also be obtained +by pressing the up-arrow key. The down-arrow key duplicates the Control key. +Meta, Control, and Shift are often used in combination with other keystrokes +or mouse clicks. For example, the terminal emulator xterm pops up menus in +response to control-left and control-middle. The original function of the +arrow keys may be obtained by holding down the Option key while pressing +one of the arrow keys. +.SH "SECURITY" +.I X +uses an access control list for deciding whether or not to accept a +connection from a given client. This list +initially consists of the machine on which the server is running, and any +hosts listed in the file +\fI/etc/X0.hosts\fP +This file should contain one line +per host name, with no white space. +.PP +The user can manipulate a dynamic form of this list in the server +using the \fIxhost(1)\fP program from +the same machine as the server. +.PP +Unlike some window systems, \fIX\fP does not have any notion of +window operation permissions or +place any restrictions on what a client can do; if +a program can connect to a display, it has full run of the screen. There +is support for using +authentication services on connection startup beyond the simple host name +check, but it is not used in the standard distribution. +.SH "FONTS" +Fonts are stored in individual files in the directory(ies) named by +the font search path. These files may be created by the \fIfc\fP utility. +The name of the file must correspond to the name of the font in lowercase +with the suffix ".pcf" appended. +Font files may be stored in \fIcompress\fP(1) format, in which case an +additional suffix (usually ".Z", defined when the server is built) must +be appended to the usual filename. +.SH "FILES" +.TP 30 +/bin/X11 +/bin/X11R6 +Bourne shell scripts which start the server and initial +.I xterm +client. refers to the root of the X11 install tree. +.TP 30 +$HOME/.x11start +Bourne shell script executed by initial +.I xterm +client which starts a slew of other clients. +Reference copy in /lib/X11/.x11start +.TP 30 +/bin/XmacII +the server binary +.TP 30 +/bin/Xrepair +ensures console viability after server exits +.TP 30 +/bin/* +client binaries +.TP 30 +lib/X11/fonts/* +.TP 30 +/lib/X11/rgb.{dir,pag,txt} +color names to RGB mapping +.TP 30 +/etc/X0.hosts +Initial access control list +.TP 30 +/tmp/.X11-unix/X0 +Unix domain socket +.TP 30 +/usr/adm/X0msgs +Error log file +.TP 30 +$HOME/.twmrc +customization for the +.I twm +window manager. Reference copy in /lib/X11/Sample.twmrc +.TP 30 +/lib/X11/XErrorDB +client error message database +.TP 30 +/lib/X11/app-defaults +client specific resource specifications +.TP 30 +/lib/X11/examples/Xaw/* +source code examples of applications built on the +.I X +Toolkit +.TP 30 +/lib/terminfo/x/xterm* +.I terminfo +database entries descibing the terminal emulation capabilities of the +.I xterm +client. Reference copies in /lib/X11/xterm*.tic +.TP 30 +/include/X11/bitmaps/*icon +bitmap representations of icons used by the +.I twm +window manager +.SH "SEE ALSO" +xinit(1), X(1) +.SH BUGS +In the unlikely event the server crashes, +it may leave the keyboard in a non-useful state. +The X11 script executes the +.I Xrepair +command in an attempt to repair the damage. diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68k.h xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68k.h --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68k.h 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68k.h 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,93 @@ +/*- + * 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. + * + */ + +#define NEED_EVENTS + +#include "X.h" +#include "misc.h" +#include "Xproto.h" +#include "scrnintstr.h" +#include "screenint.h" +#include "inputstr.h" +#include "input.h" +#include "cursorstr.h" +#include "cursor.h" +#include "pixmapstr.h" +#include "pixmap.h" +#include "windowstr.h" +#include "gc.h" +#include "gcstruct.h" +#include "regionstr.h" +#include "colormap.h" +#include "miscstruct.h" +#include "dix.h" +#include "mfb.h" +#include "mi.h" +#include "mipointer.h" +#include +#include +#include +#include +#include +#include + +#define TVTOMILLI(tv) ((tv).tv_usec / 1000 + (tv).tv_sec * 1000) + + +#if !defined(MAXSCREENS) +#define MAXSCREENS 8 /* God forbid anyone should have more... */ +#endif + + +extern int mac_adbfd; + + +extern Time mac_lasteventtime; + +extern DevicePtr mac68k_mouse; +extern DevicePtr mac68k_kbd; + + +typedef struct fbinfo_s { + int modenum; + caddr_t vaddr; + struct grfmode idata; + int added; + int fd; +} fbinfo_t; + +typedef struct { + BYTE key; + CARD8 modifiers; +} MacModmapRec; + +extern fbinfo_t mac_fbs[MAXSCREENS]; +extern int mac_scrs; + +extern miPointerScreenFuncRec mac_mousefuncs; diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kEvent.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kEvent.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kEvent.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kEvent.c 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,73 @@ +/*- + * 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 +#include +#include +#include +#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 (); +} diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kInit.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kInit.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kInit.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kInit.c 2004-01-03 04:19:02.000000000 -0800 @@ -0,0 +1,383 @@ +/*- + * 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 +#include "mac68k.h" +#include "dixstruct.h" +#include "dix.h" +#include "opaque.h" +#include +#include +#include +#include +#include +#include + + +#define CATCH_BROKEN_MODE 1 + + +void ProcessInputEvents(void); + + +int mac_adbfd; + +Time mac_lasteventtime; + +int mac_scrs = 0; +fbinfo_t mac_fbs[MAXSCREENS]; + +DevicePtr mac68k_mouse; +DevicePtr mac68k_kbd; + +int mac68k_mouseproc( + DevicePtr mouse, + int what); + +int mac68k_kbdproc( + DevicePtr mouse, + int what); + +Bool mac68kMonoInit( + int index, + ScreenPtr screen, + int argc, + char **argv); + + +void mac68k_enqevents( + void); + + +static void handle_sigio( + int flags) +{ + mac68k_enqevents(); +} + +#if MAC68K_IOHACK +void OsVendorInit( +#if NeedFunctionPrototypes + void +#endif +) +{ +} + +int initialize_desktop() +#else + +void OsVendorInit( +#if NeedFunctionPrototypes + void +#endif +) + +#endif +{ + int i, j; + struct imagedata *id; + int totalscreens; + int argnum = 1; + + mac_adbfd = open ("/dev/adb", O_RDWR); + + if (mac_adbfd == -1) { + ErrorF("Couldn't open /dev/adb..."); + FatalError(sys_errlist[errno]); + } + + mac68k_getmouse(); /* find mouse and set up or error */ + mac68k_getkbd(); /* find keyboard and set up or error */ + + signal(SIGIO, handle_sigio); +} + +choose_best_depths() +{ +#if 0 + int scr, mode, best; + struct imagedata *si; + int umph, bestumph; /* "umph" is goodness of screen */ + /* Could have a nicer calculation, like depth versus */ + /* resolution versus dimensions with weights... */ + char scrstr[100]; + + for(scr = 0; scr < mac_ci.numscreens; scr++){ + best = -1; + if(mac_si[scr].nummodes > 0){ + best = 0; + si = &mac_si[scr].modes[0].modeinfo; + bestumph = si->pixelSize * (si->right - si->left) * + (si->bottom - si->top); + + for(mode = 1; mode < mac_si[scr].nummodes; mode++){ + si = &mac_si[scr].modes[mode].modeinfo; + umph = si->pixelSize * (si->right - si->left) * + (si->bottom - si->top); + if(umph > bestumph){ + bestumph = umph; + best = mode; + } + } + }else{ + sprintf(scrstr, "Cannot find modes for screen %d." + " Ignoring.", scr); + ErrorF(scrstr); + } + mac_bestmode[scr] = best; + } +#endif +} + + +Bool mac68k_screeninit( + ScreenPtr screen) +{ + miDCInitialize(screen, &mac_mousefuncs); + + return TRUE; +} + + + +parse_args( + int argc, + char **argv) +{ + /* try to match argv params to screens and depths */ + /* BARF I really should do this, but not right now, */ + /* while I am feverishly trying to finish the other X code. */ +} + + +setup_screens( + ScreenInfo *xsi, + int argc, + char **argv) +{ + char fname[128]; + int done = 0; + caddr_t vaddr; + int scr; + + do { + sprintf(fname, "/dev/grf%d", mac_scrs); +#if DEBUG + ErrorF("attempting %s...\n", fname); +#endif + if ((mac_fbs[mac_scrs].fd = open(fname, O_RDWR)) != -1) { +#if DEBUG + ErrorF("opened successfully\n"); +#endif + if (ioctl (mac_fbs[mac_scrs].fd, GRFIOCGMODE, + &mac_fbs[mac_scrs].idata) != 0) + { + ErrorF("Couldn't get info for %d.\n",mac_scrs); + FatalError(sys_errlist[errno]); + } + vaddr = mmap(0, mac_fbs[mac_scrs].idata.fbsize, + (PROT_READ|PROT_WRITE),MAP_SHARED, + mac_fbs[mac_scrs].fd, + mac_fbs[mac_scrs].idata.fboff); + if (vaddr == (caddr_t) -1) { + ErrorF("Couldn't map SCREEN %d.\n", mac_scrs); + FatalError(sys_errlist[errno]); + } + mac_fbs[mac_scrs].modenum = 0; + mac_fbs[mac_scrs].vaddr = vaddr; + mac_fbs[mac_scrs].added = FALSE; + mac_scrs++; + } else { + if (errno != ENXIO) { + ErrorF("Couldn't open %s.\n", fname); + FatalError(sys_errlist[errno]); + } + done = 1; + } + } while(!done); + + if(mac_scrs == 0) + FatalError("Can't run X server with no screens!"); + + xsi->imageByteOrder = IMAGE_BYTE_ORDER; + xsi->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + xsi->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + xsi->bitmapBitOrder = BITMAP_BIT_ORDER; + + xsi->formats[0].depth = 1; + xsi->formats[0].bitsPerPixel = 1; + xsi->formats[0].scanlinePad = BITMAP_SCANLINE_PAD; + + xsi->formats[1].depth = 8; + xsi->formats[1].bitsPerPixel = 8; + xsi->formats[1].scanlinePad = BITMAP_SCANLINE_PAD; + + xsi->formats[2].depth = 16; + xsi->formats[2].bitsPerPixel = 16; + xsi->formats[2].scanlinePad = BITMAP_SCANLINE_PAD; + + xsi->formats[3].depth = 24; + xsi->formats[3].bitsPerPixel = 32; + xsi->formats[3].scanlinePad = BITMAP_SCANLINE_PAD; + + xsi->numPixmapFormats = 4; + +#if DEBUG + ErrorF("# of screens: %d\n", mac_scrs); +#endif + for(scr = 0; scr < mac_scrs; scr++){ +#if DEBUG + ErrorF("adding screen %d\n", scr); +#endif +#if CATCH_BROKEN_MODE + if(mac_fbs[scr].idata.psize == 0) + mac_fbs[scr].idata.psize = 1; +#endif /* CATCH_BROKEN_MODE */ + if(mac_fbs[scr].idata.psize == 1) + AddScreen(mac68kMonoInit, argc, argv); + else +#if COLOR_SUPPORT /* Damn, I'm lazy! */ + AddScreen(mac68kColorInit, argc, argv); +#else + FatalError("I don't support color screens!\n"); +#endif + } + + xsi->numScreens = scr; +} + + +void InitOutput( + ScreenInfo *xsi, + int argc, + char **argv) +{ + static int dejavu = 0; + + if(dejavu) + return; + else + dejavu = 1; + + /* set up all screens */ +#if MAC68K_IOHACK + initialize_desktop(); +#endif + choose_best_depths(); + parse_args(argc, argv); + setup_screens(xsi, argc, argv); +} + + +void InitInput( + int argc, + char **argv) +{ + DevicePtr mouse; + DevicePtr kbd; + static int dejavu = 0; + + if(dejavu) + return; + else + dejavu = 1; + + mac68k_mouse = mouse = AddInputDevice((DeviceProc)mac68k_mouseproc, + TRUE); + RegisterPointerDevice(mouse); + miRegisterPointerDevice(screenInfo.screens[0], mouse); + + mac68k_kbd = kbd = AddInputDevice((DeviceProc)mac68k_kbdproc, TRUE); + RegisterKeyboardDevice(kbd); + + if (!mieqInit (kbd, mouse)) + FatalError ("could not initialize event queue"); + + mac_lasteventtime = time(0) * 1000; +} + + +void AbortDDX(void) +{ + close(mac_adbfd); +} + + +void ddxGiveUp(void) +{ +} + + +int ddxProcessArgument( + int argc, + char **argv, + int i) +{ + if(strcmp(argv[i], "-screen") == 0) + return(3); + return(0); +} + + +void ddxUseMsg(void) +{ + ErrorF("-screen S D\t\t\tuse depth for screen "); + ErrorF("\t(use the 'console' program for screen information)"); +} + + +void MessageF( + char *s) +{ + ErrorF(s); +} + +void OsVendorFatalError(void) +{ +} + +#ifdef DPMSExtension +/* + * DPMS stubs + */ +void DPMSSet(int level) +{ +} + +int DPMSGet(int level) +{ + return -1; +} + +Bool DPMSSupported() +{ + return FALSE; +} +#endif /* DPMSExtension */ diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKbd.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKbd.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKbd.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKbd.c 2004-01-03 03:50:29.000000000 -0800 @@ -0,0 +1,169 @@ +/* + * Copyright 1996 Scott Reynolds + * 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 +#include +#include +#include +#include "mac68k.h" +#include "Xproto.h" +#include "inputstr.h" + +#define MIN_KEYCODE 8 /* necessary to avoid the mouse buttons */ +#define MAX_KEYCODE 255 /* limited by the protocol */ + +extern MacModmapRec *macModMaps[]; /* Borrowed from A/UX code */ +extern KeySymsRec macKeySyms[]; /* Borrowed from A/UX code */ + + +void mac68k_bell() +{ + static int itefd = (-1); + + if (itefd == (-1)) + if ((itefd = open( "/dev/ttye0", O_RDONLY )) == (-1)) + itefd = (-2); + + if (itefd >= 0) + ioctl(itefd, ITEIOC_RINGBELL); +} + + +void mac68k_kbdctrl() +{ +} + + +#if NeedFunctionPrototypes +int mac68k_kbdproc ( + DevicePtr kbd, + int what) +#else +int mac68k_kdbproc (kbd, what) + DevicePtr kbd; /* Keyboard to manipulate */ + int what; /* What to do to it */ +#endif +{ + static CARD8 *workingModMap = NULL; + static KeySymsRec *workingKeySyms; + int i; + + switch (what) { + case DEVICE_INIT: + if (kbd != LookupKeyboardDevice()) { + ErrorF ("Cannot open non-system keyboard\n"); + return (!Success); + } + + if (!workingKeySyms) { + workingKeySyms = macKeySyms; + + if (workingKeySyms->minKeyCode < MIN_KEYCODE) { + workingKeySyms->minKeyCode += MIN_KEYCODE; + workingKeySyms->maxKeyCode += MIN_KEYCODE; + } +#if 0 + /* + * maxKeyCode is eight bits long, MAX_KEYCODE is + * 255. This check is unneeded and gcc catches + * it as a warning. + */ + if (workingKeySyms->maxKeyCode > MAX_KEYCODE) + workingKeySyms->maxKeyCode = MAX_KEYCODE; +#endif + } + + if (!workingModMap) { + workingModMap = (CARD8 *)xalloc(MAP_LENGTH); + (void) memset(workingModMap, 0, MAP_LENGTH); + for (i = 0; macModMaps[1][i].key != 0; i++) + workingModMap[macModMaps[1][i].key+MIN_KEYCODE] + = macModMaps[1][i].modifiers; + } + + kbd->on = FALSE; + + InitKeyboardDeviceStruct(kbd, workingKeySyms, + workingModMap, mac68k_bell, mac68k_kbdctrl); + break; + + case DEVICE_ON: + kbd->on = TRUE; + break; + + case DEVICE_OFF: + kbd->on = FALSE; + break; + + case DEVICE_CLOSE: + /* nothing! */ + break; + + default: + FatalError("Unknown keyboard operation\n"); + } + + return Success; +} + + +void mac68k_getkbd( + void) +{ + int index; + + /* Find out where there is a keyboard */ + + /* FatalError("Cannot run X server without a keyboard.\n"); */ +} + + +void mac68k_processkbd( + DevicePtr kbd, + adb_event_t *event) +{ + xEvent xev; + + mac_lasteventtime = xev.u.keyButtonPointer.time = + TVTOMILLI(event->timestamp); + + xev.u.u.type = (event->u.k.key & 0x80) ? KeyRelease : KeyPress; + xev.u.u.detail = (event->u.k.key & 0x7f) + MIN_KEYCODE; + + mieqEnqueue(&xev); +} + + +Bool LegalModifier( + unsigned int key, + DevicePtr dev) +{ + return(TRUE); +} diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKeyMap.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKeyMap.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKeyMap.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kKeyMap.c 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,205 @@ +/************************************************************ +Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright no- +tice appear in all copies and that both that copyright no- +tice and this permission notice appear in supporting docu- +mentation, and that the names of Sun or X Consortium +not be used in advertising or publicity pertaining to +distribution of the software without specific prior +written permission. Sun and X Consortium make no +representations about the suitability of this software for +any purpose. It is provided "as is" without any express or +implied warranty. + +SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- +NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- +ABLE 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 "mac68k.h" +#include "keysym.h" + +/* twm and Motif have hard-coded dependencies on Meta being Mod1 :-( */ +#if 0 +/* This set has optimal characteristics for use in the Toolkit... */ +#define Meta_Mask Mod1Mask +#define Mode_switch_Mask Mod2Mask +#define Num_Lock_Mask Mod3Mask +#define Alt_Mask Mod4Mask +#else +/* but this set is compatible with what we shipped in R6. */ +#define Meta_Mask Mod1Mask +#define Mode_switch_Mask Mod2Mask +#define Alt_Mask Mod3Mask +#define Num_Lock_Mask Mod4Mask +#endif + +static KeySym map[] = { + XK_A, NoSymbol, /* 0x0 */ + XK_S, NoSymbol, /* 0x1 */ + XK_D, NoSymbol, /* 0x2 */ + XK_F, NoSymbol, /* 0x3 */ + XK_H, NoSymbol, /* 0x4 */ + XK_G, NoSymbol, /* 0x5 */ + XK_Z, NoSymbol, /* 0x6 */ + XK_X, NoSymbol, /* 0x7 */ + XK_C, NoSymbol, /* 0x8 */ + XK_V, NoSymbol, /* 0x9 */ + NoSymbol, NoSymbol, /* 0xa */ + XK_B, NoSymbol, /* 0xb */ + XK_Q, NoSymbol, /* 0xc */ + XK_W, NoSymbol, /* 0xd */ + XK_E, NoSymbol, /* 0xe */ + XK_R, NoSymbol, /* 0xf */ + XK_Y, NoSymbol, /* 0x10 */ + XK_T, NoSymbol, /* 0x11 */ + XK_1, XK_exclam, /* 0x12 */ + XK_2, XK_at, /* 0x13 */ + XK_3, XK_numbersign, /* 0x14 */ + XK_4, XK_dollar, /* 0x15 */ + XK_6, XK_asciicircum, /* 0x16 */ + XK_5, XK_percent, /* 0x17 */ + XK_equal, XK_plus, /* 0x18 */ + XK_9, XK_parenleft, /* 0x19 */ + XK_7, XK_ampersand, /* 0x1a */ + XK_minus, XK_underscore, /* 0x1b */ + XK_8, XK_asterisk, /* 0x1c */ + XK_0, XK_parenright, /* 0x1d */ + XK_bracketright,XK_braceright, /* 0x1e */ + XK_O, NoSymbol, /* 0x1f */ + XK_U, NoSymbol, /* 0x20 */ + XK_bracketleft, XK_braceleft, /* 0x21 */ + XK_I, NoSymbol, /* 0x22 */ + XK_P, NoSymbol, /* 0x23 */ + XK_Return, NoSymbol, /* 0x24 */ + XK_L, NoSymbol, /* 0x25 */ + XK_J, NoSymbol, /* 0x26 */ + XK_quoteright, XK_quotedbl, /* 0x27 */ + XK_K, NoSymbol, /* 0x28 */ + XK_semicolon, XK_colon, /* 0x29 */ + XK_backslash, XK_bar, /* 0x2a */ + XK_comma, XK_less, /* 0x2b */ + XK_slash, XK_question, /* 0x2c */ + XK_N, NoSymbol, /* 0x2d */ + XK_M, NoSymbol, /* 0x2e */ + XK_period, XK_greater, /* 0x2f */ + XK_Tab, NoSymbol, /* 0x30 */ + XK_space, NoSymbol, /* 0x31 */ + XK_quoteleft, XK_asciitilde, /* 0x32 */ + XK_Delete, NoSymbol, /* 0x33 */ + NoSymbol, NoSymbol, /* 0x34 */ + XK_Escape, NoSymbol, /* 0x35 */ + XK_Control_L, NoSymbol, /* 0x36 */ + XK_Meta_L, NoSymbol, /* 0x37 */ /* apple/clover */ + XK_Shift_L, NoSymbol, /* 0x38 */ + XK_Caps_Lock, NoSymbol, /* 0x39 */ + XK_Alt_L, NoSymbol, /* 0x3a */ /* option/alt */ + XK_Left, NoSymbol, /* 0x3b */ + XK_Right, NoSymbol, /* 0x3c */ + XK_Down, NoSymbol, /* 0x3d */ + XK_Up, NoSymbol, /* 0x3e */ + NoSymbol, NoSymbol, /* 0x3f */ + NoSymbol, NoSymbol, /* 0x40 */ + XK_KP_Decimal, NoSymbol, /* 0x41 */ + NoSymbol, NoSymbol, /* 0x42 */ + XK_KP_Multiply, NoSymbol, /* 0x43 */ + NoSymbol, NoSymbol, /* 0x44 */ + XK_KP_Add, NoSymbol, /* 0x45 */ + NoSymbol, NoSymbol, /* 0x46 */ + XK_Clear, NoSymbol, /* 0x47 */ + NoSymbol, NoSymbol, /* 0x48 */ + NoSymbol, NoSymbol, /* 0x49 */ + NoSymbol, NoSymbol, /* 0x4a */ + XK_KP_Divide, NoSymbol, /* 0x4b */ + XK_KP_Enter, NoSymbol, /* 0x4c */ + NoSymbol, NoSymbol, /* 0x4d */ + XK_KP_Subtract, NoSymbol, /* 0x4e */ + NoSymbol, NoSymbol, /* 0x4f */ + NoSymbol, NoSymbol, /* 0x50 */ + XK_KP_Equal, NoSymbol, /* 0x51 */ + XK_KP_0, NoSymbol, /* 0x52 */ + XK_KP_1, NoSymbol, /* 0x53 */ + XK_KP_2, NoSymbol, /* 0x54 */ + XK_KP_3, NoSymbol, /* 0x55 */ + XK_KP_4, NoSymbol, /* 0x56 */ + XK_KP_5, NoSymbol, /* 0x57 */ + XK_KP_6, NoSymbol, /* 0x58 */ + XK_KP_7, NoSymbol, /* 0x59 */ + NoSymbol, NoSymbol, /* 0x5a */ + XK_KP_8, NoSymbol, /* 0x5b */ + XK_KP_9, NoSymbol, /* 0x5c */ + NoSymbol, NoSymbol, /* 0x5d */ + NoSymbol, NoSymbol, /* 0x5e */ + NoSymbol, NoSymbol, /* 0x5f */ + XK_F5, NoSymbol, /* 0x60 */ + XK_F6, NoSymbol, /* 0x61 */ + XK_F7, NoSymbol, /* 0x62 */ + XK_F3, NoSymbol, /* 0x63 */ + XK_F8, NoSymbol, /* 0x64 */ + XK_F9, NoSymbol, /* 0x65 */ + NoSymbol, NoSymbol, /* 0x66 */ + XK_F11, NoSymbol, /* 0x67 */ + NoSymbol, NoSymbol, /* 0x68 */ + XK_F13, XK_Print, /* 0x69 */ + NoSymbol, NoSymbol, /* 0x6a */ + XK_F14, XK_Pause, /* 0x6b */ + NoSymbol, NoSymbol, /* 0x6c */ + XK_F10, NoSymbol, /* 0x6d */ + NoSymbol, NoSymbol, /* 0x6e */ + XK_F12, NoSymbol, /* 0x6f */ + NoSymbol, NoSymbol, /* 0x70 */ + XK_F15, XK_Pause, /* 0x71 */ + XK_Help, XK_Insert, /* 0x72 */ + XK_Home, NoSymbol, /* 0x73 */ + XK_Prior, NoSymbol, /* 0x74 */ /* Page Up */ + XK_Delete, NoSymbol, /* 0x75 */ + XK_F4, NoSymbol, /* 0x76 */ + XK_End, NoSymbol, /* 0x77 */ + XK_F2, NoSymbol, /* 0x78 */ + XK_Next, NoSymbol, /* 0x79 */ /* Page Down */ + XK_F1, NoSymbol, /* 0x7a */ + XK_Shift_R, NoSymbol, /* 0x7b */ + XK_Alt_R, NoSymbol, /* 0x7c */ + XK_Control_R, NoSymbol, /* 0x7d */ + NoSymbol, NoSymbol, /* 0x7e */ + NoSymbol, NoSymbol, /* 0x7f */ /* Soft Power */ +}; + +KeySymsRec macKeySyms[] = { + /* map minKC maxKC width */ + map, 0, 0x7e, 2, +}; + +static MacModmapRec macModMap[] = { + 0x36, ControlMask, + 0x38, ShiftMask, + 0x39, LockMask, + 0x3a, Meta_Mask, + 0, 0 +}; + +static MacModmapRec altModMap[] = { + 0x36, ControlMask, + 0x37, Meta_Mask, + 0x38, ShiftMask, + 0x39, LockMask, + 0x7b, ShiftMask, + 0x7d, ControlMask, + 0, 0 +}; + +MacModmapRec *macModMaps[] = { + macModMap, + altModMap, +}; diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMonoScreens.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMonoScreens.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMonoScreens.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMonoScreens.c 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,83 @@ +/*- + * 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 "mac68k.h" +#include "dixstruct.h" +#include "dix.h" +#include "opaque.h" +#include +#include +#include +#include + + +Bool mac68kMonoSave( + ScreenPtr screen, + int on) +{ + /* if(on == SCREEN_SAVER_FORCER) + Do something with event time */ + return(FALSE); +} + + + +Bool mac68kMonoInit( + int index, + ScreenPtr screen, + int argc, + char **argv) +{ + struct grfmode *id; + char scrstr[150]; + + if(mac_fbs[index].added) + return(TRUE); + + screen->SaveScreen = mac68kMonoSave; + screen->whitePixel = 0; + screen->blackPixel = 1; + + id = &mac_fbs[index].idata; + printf("Calling ScreenInit to add screen %d...\n", index); + sprintf(scrstr, "Screen %d at %#08x, %d by %d, rowB %d, fbbase %#x.\n", + index, mac_fbs[index].vaddr, id->width, + id->height, id->rowbytes, id->fbbase); + ErrorF(scrstr); + if(!mfbScreenInit(screen, + mac_fbs[index].vaddr, /* BARF */ + id->width, + id->height, + /* id->vRes >> 16 */ 75, /* BARF */ + /* id->vRes >> 16 */ 75, /* BARF */ + id->rowbytes*8)) + return(FALSE); + mac_fbs[index].added = 1; + return(mac68k_screeninit(screen) && mfbCreateDefColormap(screen)); +} diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMouse.c xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMouse.c --- xsrc.old/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMouse.c 1969-12-31 16:00:00.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/hw/netbsd/mac68k/mac68kMouse.c 2004-01-03 02:58:59.000000000 -0800 @@ -0,0 +1,211 @@ +/*- + * 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 +#include +#include +#include +#include "mac68k.h" + + +#define LEFTB(b) (b & 0x1) /* Mouse buttons are stored reverse. */ +#define MIDDLEB(b) (b & 0x2) +#define RIGHTB(b) (b & 0x4) + + +static Bool mac68k_msoffscreen( + ScreenPtr *screen, + int *x, + int *y) +{ + int index; + + if((screenInfo.numScreens > 1) && + ((*x >= (*screen)->width) || (*x < 0))) + { + index = (*screen)->myNum; + + if(*x < 0){ + index = (index - 1 + screenInfo.numScreens) % + screenInfo.numScreens; + *screen = screenInfo.screens[index]; + *x += (*screen)->width; + }else{ + *x -= (*screen)->width; + index = (index + 1 ) % screenInfo.numScreens; + *screen = screenInfo.screens[index]; + } + + return(TRUE); + } + return(FALSE); +} + + +static void mac68k_mscrossscreen( + ScreenPtr screen, + Bool entering) +{ + /* nothing. (stolen from A/UX X server) */ +} + + +static void mac68k_mswarp( + ScreenPtr screen, + int x, + int y) +{ + /* Why even have a function here? */ + miPointerWarpCursor(screen, x, y); +} + + +miPointerScreenFuncRec mac_mousefuncs = { + mac68k_msoffscreen, + mac68k_mscrossscreen, + mac68k_mswarp +}; + + +void mac68k_mousectrl() +{ + return; +} + + +int mac68k_mouseproc( + DevicePtr mouse, + int what) +{ + BYTE map[4]; + + switch(what){ + case DEVICE_INIT: + if(mouse != LookupPointerDevice()){ + ErrorF("Mouse routines can only handle DESKTOP" + " mice.\n"); + return(!Success); + } + + map[0] = 0; + map[1] = 1; + map[2] = 2; + map[3] = 3; + + InitPointerDeviceStruct(mouse, map, 3, + miPointerGetMotionEvents, mac68k_mousectrl, + miPointerGetMotionBufferSize()); + + mouse->on = FALSE; + break; + + case DEVICE_ON: + mouse->on = TRUE; + break; + + case DEVICE_OFF: + mouse->on = FALSE; + break; + + case DEVICE_CLOSE: + /* nothing! */ + break; + } + + return(Success); +} + + +static int accel_mouse ( + DevicePtr mouse, + int delta) +{ + register int sgn = sign(delta); + register PtrCtrl *ctrlptr; + + delta = abs(delta); + ctrlptr = &((DeviceIntPtr) mouse)->ptrfeed->ctrl; + + if (delta > ctrlptr->threshold) + return (sgn * (ctrlptr->threshold + ((delta - ctrlptr->threshold) * + ctrlptr->num) / ctrlptr->den)); + else + return (sgn * delta); +} + + +void mac68k_processmouse( + DevicePtr mouse, + adb_event_t *event) +{ + xEvent xev; + int dx, dy; + static int buttons = 0; + + mac_lasteventtime = xev.u.keyButtonPointer.time = + TVTOMILLI(event->timestamp); + + if(buttons != event->u.m.buttons){ + if(LEFTB(buttons) != LEFTB(event->u.m.buttons)){ + xev.u.u.detail = 1; /* leftmost */ + xev.u.u.type = LEFTB(event->u.m.buttons) ? + ButtonPress : ButtonRelease; + mieqEnqueue(&xev); + } + if(MIDDLEB(buttons) != MIDDLEB(event->u.m.buttons)){ + xev.u.u.detail = 2; /* middle */ + xev.u.u.type = MIDDLEB(event->u.m.buttons) ? + ButtonPress : ButtonRelease; + mieqEnqueue(&xev); + } + if(RIGHTB(buttons) != RIGHTB(event->u.m.buttons)){ + xev.u.u.detail = 3; /* right */ + xev.u.u.type = RIGHTB(event->u.m.buttons) ? + ButtonPress : ButtonRelease; + mieqEnqueue(&xev); + } + buttons = event->u.m.buttons; + } + + dx = accel_mouse(mouse, event->u.m.dx); + dy = accel_mouse(mouse, event->u.m.dy); + + miPointerDeltaCursor(dx, dy, mac_lasteventtime); +} + + +void mac68k_getmouse( + void) +{ + int index; + + /* make sure there is a mouse */ + + /* FatalError("Cannot run X server without a mouse.\n"); */ +} diff -ruN -x CVS -x '.*' xsrc.old/xfree/xc/programs/Xserver/include/servermd.h xsrc/xfree/xc/programs/Xserver/include/servermd.h --- xsrc.old/xfree/xc/programs/Xserver/include/servermd.h 2003-02-28 13:49:45.000000000 -0800 +++ xsrc/xfree/xc/programs/Xserver/include/servermd.h 2004-01-02 06:46:55.000000000 -0800 @@ -338,6 +338,13 @@ #endif /* macII */ +#if defined(__NetBSD__) && defined(__m68k__) +# define IMAGE_BYTE_ORDER MSBFirst +# define BITMAP_BIT_ORDER MSBFirst +# define GLYPHPADBYTES 4 +# define GETLEFTBITS_ALIGNMENT 1 +#endif /* __m68k__ */ + #if (defined(mips) || defined(__mips)) && !defined(sgi) #if defined(MIPSEL) || defined(__MIPSEL__)