Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!snorkelwacker.mit.edu!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Simple X11R4 Server question. Message-ID: <9012190608.AA03128@Larry.McRCIM.McGill.EDU> Date: 19 Dec 90 06:08:56 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 56 > I am wondering how a server function [ProcessInputEvents()] is > suppose to register that it wants to be called when the file > descriptor it has open for the mouse and keyboard (one descriptor for > both) is ready for reading. Look at the ddx/sun stuff for an example; grep for Enabled and you should find the relevant pieces. When an fd is passed to AddEnabledDevice, things are arranged so that ProcessInputEvents gets called when something arrives on the fd. (ProcessInputEvents must be prepared to get called at other times as well.) Specifically, sunKbdProc (sunKbd.c) is what you want to look at. The comment header at the beginning contains * Note: * When using sunwindows, all input comes off a single fd, stored in the * global windowFd. Therefore, only one device should be enabled and * disabled, even though the application still sees both mouse and * keyboard. We have arbitrarily chosen to enable and disable windowFd * in the keyboard routine sunKbdProc rather than in sunMouseProc. which addresses exactly what you say you have - one fd for both mouse and keyboard. The code itself looks like int sunKbdProc (pKeyboard, what) DevicePtr pKeyboard; /* Keyboard to manipulate */ int what; /* What to do to it */ { ... switch (what) { ... case DEVICE_ON: if (sunUseSunWindows()) { #ifdef SUN_WINDOWS if (! sunSetUpKbdSunWin(windowFd, TRUE)) { FatalError("Can't set up keyboard\n"); } ... AddEnabledDevice(windowFd); #endif SUN_WINDOWS } else { ... } pKeyboard->on = TRUE; break; ... } return (Success); } der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu