Annotation of 43BSDTahoe/new/X/libis/util.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     $Source: /u1/X/libis/RCS/util.c,v $
                      3:  *     $Header: util.c,v 1.1 86/11/17 14:34:48 swick Rel $
                      4:  */
                      5: 
                      6: #ifndef lint
                      7: static char *rcsid_util_c = "$Header: util.c,v 1.1 86/11/17 14:34:48 swick Rel $";
                      8: #endif lint
                      9: 
                     10: #include "is-copyright.h"
                     11: 
                     12: /* util.c              Various utilities
                     13:  *
                     14:  *     QueryShape      Determine shapes
                     15:  *     ResolveColors   Map X colors to hardware colors
                     16:  *     StoreColors     Load lookup table values
                     17:  *
                     18:  *     The rest of these don't do anything right now.
                     19:  *
                     20:  *     SoundBell       Generate audible bell
                     21:  *     SetKeyClick     Control key click
                     22:  *     SetAutoRepeat   Control auto repeat
                     23:  *     SetLockLED      Control Lock LED
                     24:  *     SetVideo        Set video blanking
                     25:  *
                     26:  *     Copyright (c) 1986, Integrated Solutions, Inc.
                     27:  */
                     28: 
                     29: #include "Xis.h"
                     30: 
                     31: QueryShape(shape, width, height)
                     32: int            shape;
                     33: register short *width, *height;
                     34: {
                     35:     switch (shape) {
                     36:     case CursorShape:
                     37:     case BrushShape:
                     38:        if (*width > 64)
                     39:            *width = 64;
                     40:        if (*height > 64)
                     41:            *height = 64;
                     42:        break;
                     43:     case TileShape:
                     44:        *width = *height = 16;
                     45:        break;
                     46:     }
                     47: 
                     48: #ifdef DEBUG
                     49: if (debug & D_Misc)
                     50:     printf("QueryShape(shape=%d, *width=%d, *height=%d)\n",
                     51:        shape, *width, *height);
                     52: #endif DEBUG
                     53: }
                     54: 
                     55: SoundBell(volume)
                     56: int    volume;
                     57: {
                     58: #ifdef DEBUG
                     59: if (debug & D_Misc)
                     60:     printf("SoundBell(volume=%d)\n", volume);
                     61: #endif DEBUG
                     62: }
                     63: 
                     64: /*ARGSUSED*/
                     65: SetKeyClick(volume)
                     66: int    volume;
                     67: {
                     68: #ifdef DEBUG
                     69: if (debug & D_Misc)
                     70:     printf("SetKeyClick(volume=%d)\n", volume);
                     71: #endif DEBUG
                     72: }
                     73: 
                     74: /*ARGSUSED*/
                     75: SetAutoRepeat(onoff)
                     76: int    onoff;
                     77: {
                     78: #ifdef DEBUG
                     79: if (debug & D_Misc)
                     80:     printf("SetAutoRepeat(onoff=%d)\n", onoff);
                     81: #endif DEBUG
                     82: }
                     83: 
                     84: /*ARGSUSED*/
                     85: SetLockLED(onoff)
                     86: int    onoff;
                     87: {
                     88: #ifdef DEBUG
                     89: if (debug & D_Misc)
                     90:     printf("SetLockLED(onoff=%d)\n", onoff);
                     91: #endif DEBUG
                     92: }
                     93: 
                     94: SetVideo(onoff)
                     95: int    onoff;
                     96: {
                     97: #ifdef DEBUG
                     98: if (debug & D_Misc)
                     99:     printf("SetVideo(onoff=%d)\n", onoff);
                    100: #endif DEBUG
                    101: 
                    102:     return (onoff - 1);
                    103: }
                    104: 
                    105: ResolveColor(red, green, blue)
                    106: unsigned short *red, *green, *blue;
                    107: {
                    108: 
                    109: #ifdef DEBUG
                    110: if (debug & D_Color)
                    111:     printf("ResolveColor(%04x, %04x, %04x)", *red, *green, *blue);
                    112: #endif DEBUG
                    113: 
                    114:     *red       &= (unsigned)~0x0fff;
                    115:     *green     &= (unsigned)~0x0fff;
                    116:     *blue      &= (unsigned)~0x0fff;
                    117: 
                    118: #ifdef DEBUG
                    119: if (debug & D_Color)
                    120:     printf(" to (%04x, %04x, %04x)\n", *red, *green, *blue);
                    121: #endif DEBUG
                    122: }
                    123: 
                    124: StoreColors(count, entries)
                    125: register int           count;
                    126: register ColorDef      *entries;
                    127: {
                    128: 
                    129: #ifdef DEBUG
                    130: if (debug & D_Color)
                    131:     printf("StoreColors(%d colors)\n", count);
                    132: #endif DEBUG
                    133: 
                    134:     while (count--) {
                    135: 
                    136: #ifdef DEBUG
                    137: if (debug & D_Color)
                    138:     printf("   color %d = (%04x, %04x, %04x)\n",
                    139:        entries->pixel, entries->red, entries->green, entries->blue);
                    140: #endif DEBUG
                    141: 
                    142:        GIP_set_lookup((short)(entries->pixel),
                    143:             (short)((entries->red >> 12) & 0xf),
                    144:             (short)((entries->green >> 12) & 0xf),
                    145:             (short)((entries->blue >> 12) & 0xf));
                    146:        entries++;
                    147:     }
                    148: }

unix.superglobalmegacorp.com

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