Annotation of researchv9/X11/src/X.V11R1/server/ddx/v9sun/sunIo.c, revision 1.1.1.1

1.1       root        1: #include    "sun.h"
                      2: #include    "opaque.h"
                      3: 
                      4: Bool           screenSaved = FALSE;
                      5: int            lastEventTime = 0;
                      6: extern void    SaveScreens();
                      7: extern long EnabledDevices, LastSelectMask[];
                      8: extern int sunKbdfd;
                      9: extern int sunMousefd;
                     10: 
                     11: /*-
                     12:  *-----------------------------------------------------------------------
                     13:  * TimeSinceLastInputEvent --
                     14:  *     Function used for screensaver purposes by the os module.
                     15:  *
                     16:  * Results:
                     17:  *     The time in milliseconds since there last was any
                     18:  *     input.
                     19:  *
                     20:  * Side Effects:
                     21:  *     None.
                     22:  *
                     23:  *-----------------------------------------------------------------------
                     24:  */
                     25: int
                     26: TimeSinceLastInputEvent()
                     27: {
                     28:        struct timeb now;
                     29: 
                     30:        ftime(&now);
                     31:        if (!lastEventTime)
                     32:                lastEventTime = now.time * 1000 + now.millitm;
                     33:        return now.time * 1000 + now.millitm - lastEventTime;
                     34: }
                     35: 
                     36: /*-
                     37:  *-----------------------------------------------------------------------
                     38:  * ProcessInputEvents --
                     39:  *     Retrieve all waiting input events and pass them to DIX in their
                     40:  *     correct chronological order. Only reads from the system pointer
                     41:  *     and keyboard.
                     42:  *
                     43:  * Results:
                     44:  *     None.
                     45:  *
                     46:  * Side Effects:
                     47:  *     Events are passed to the DIX layer.
                     48:  *
                     49:  *-----------------------------------------------------------------------
                     50:  */
                     51: void
                     52: ProcessInputEvents ()
                     53: {
                     54:        DevicePtr       pPointer;
                     55:        DevicePtr       pKeyboard;
                     56: 
                     57:        pPointer = LookupPointerDevice();
                     58:        pKeyboard = LookupKeyboardDevice();
                     59: 
                     60:        if (LastSelectMask[0] & EnabledDevices) {
                     61:                SetTimeSinceLastInputEvent();
                     62:                if (LastSelectMask[0] & (1 << sunMousefd)) {
                     63:                        sunMouseEvent(pPointer);
                     64:                        LastSelectMask[0] &= ~(1 << sunMousefd);
                     65:                }
                     66:                if (LastSelectMask[0] & (1 << sunKbdfd)) {
                     67:                        sunKbdEvent(pKeyboard);
                     68:                        LastSelectMask[0] &= ~(1 << sunKbdfd);
                     69:                }
                     70:                if (screenSaved)
                     71:                        SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
                     72:        }
                     73:        sunRestoreCursor();
                     74: }
                     75: 
                     76: 
                     77: /*-
                     78:  *-----------------------------------------------------------------------
                     79:  * SetTimeSinceLastInputEvent --
                     80:  *     Set the lastEventTime to now.
                     81:  *
                     82:  * Results:
                     83:  *     None.
                     84:  *
                     85:  * Side Effects:
                     86:  *     lastEventTime is altered.
                     87:  *
                     88:  *-----------------------------------------------------------------------
                     89:  */
                     90: void
                     91: SetTimeSinceLastInputEvent()
                     92: {
                     93:        struct timeb    now;
                     94: 
                     95:        ftime(&now);
                     96:        lastEventTime = now.time * 1000 + now.millitm;
                     97: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.