Annotation of 43BSD/contrib/X/doc/Xlib/ch11b.t, revision 1.1.1.1

1.1       root        1: .NH 2
                      2: User Preference Subroutines
                      3: .PP
                      4: .IN "Keyboard" "Bell Volume"
                      5: .IN "Keyboard" "Keyclick Volume"
                      6: .IN "Mouse" "Programming"
                      7: In this category are the user preference options of bell, keyclick,
                      8: mouse behavior, etc.
                      9: The default values for many of these functions are determined by
                     10: .IN "File" "/etc/ttys"
                     11: command line arguments to the X server, typically set in \fI/etc/ttys\fP.
                     12: Not all implementations will actually be able to control all of these
                     13: parameters.
                     14: .FD
                     15: .IN "Definitions" "XMouseControl"
                     16: .IN "XMouseControl"
                     17: .IN "Mouse" "Behavior"
                     18: XMouseControl (acceleration, threshold)
                     19:        int acceleration, threshold;
                     20: .FN
                     21: Defines how the mouse moves.
                     22: The \fIacceleration\fP is a multiplier for movement.
                     23: For example,
                     24: specifying 3 means the cursor moves three times as fast as the mouse.
                     25: Acceleration only takes effect if the mouse moves more than
                     26: threshold pixels at once,
                     27: and only applies to the amount beyond the \fIthreshold\fP.
                     28: .FD
                     29: .IN "Definitions" "XFeepControl"
                     30: .IN "XFeepControl"
                     31: XFeepControl (volume)
                     32:        int volume;     /* 0 to 7 */
                     33: .FN
                     34: Defines the base volume for \fIXFeep\fP request.
                     35: The volume is in the range
                     36: 0 to 7, with 7 the loudest.
                     37: .FD
                     38: .IN "Definitions" "XFeep"
                     39: .IN "XFeep"
                     40: XFeep (volume)
                     41:        int volume;     /* -7 to 7 */
                     42: .FN    
                     43: \fIXFeep\fP rings a bell on the display. 
                     44: The
                     45: sound \fIvolume\fP is in the range -7 to 7
                     46: and is added to the base \fIvolume\fP defined by \fIXFeepControl\fP.
                     47: .FD
                     48: .IN "Definitions" "XKeyClickControl"
                     49: .IN "XKeyClickControl"
                     50: XKeyClickControl (volume)
                     51:        int volume;     /* 0 to 8 */
                     52: .FN
                     53: \fIXKeyClick\fP controls the volume of the `click' that the keyboard makes
                     54: when a key is pressed. 
                     55: 0 is `off', 8 is the loudest \fIvolume\fP.
                     56: .FD
                     57: .IN "Keyboard" "Auto-Repeat"
                     58: .IN "Definitions" "XAutoRepeatOn"
                     59: .IN "Definitions" "XAutoRepeatOff"
                     60: .IN "XAutoRepeatOn"
                     61: .IN "XAutoRepeatOff"
                     62: XAutoRepeatOn ()
                     63: 
                     64: XAutoRepeatOff ()
                     65: .FN
                     66: \fIXAutoRepeatOn\fP turns the keyboard's auto-repeat on.
                     67: \fIXAutoRepeatOff\fP turns the keyboard's auto-repeat off.
                     68: .FD
                     69: .IN "Keyboard" "Lock Key"
                     70: .IN "Definitions" "XLockUpDown"
                     71: .IN "XLockUpDown"
                     72: .IN "Definitions" "XLockToggle"
                     73: .IN "XLockToggle"
                     74: XLockUpDown ()
                     75: 
                     76: XLockToggle ()
                     77: .FN
                     78: Some people hate the behavior of the shift lock key.
                     79: These subroutines change the mode of the Shift LOCK key on the keyboard.
                     80: When the keyboard is in \fILockUpDown\fP mode,
                     81: KeyPressed and KeyReleased events are sent as for any other key, and the
                     82: ShiftLockMask sent in events gives the current state of the key.
                     83: .IN "KeyPressed Events"
                     84: In \fILockToggle\fP mode, 
                     85: \fIKeyPressed\fP and \fIKeyReleased\fP events are never sent
                     86: for the Lock key,
                     87: and the state of the \fIShiftLockMask\fP sent in events is toggled on every
                     88: press of the LOCK key.
                     89: .FD
                     90: .IN "Screen Saver"
                     91: .IN "Definitions" "XScreenSaver"
                     92: .IN "XScreenSaver"
                     93: XScreenSaver (savetimeout, patterntimeout, video)
                     94:        int savetimeout, patterntimeout;        /* in minutes */
                     95:        int video;
                     96: .FN
                     97: If the server remains idle for the specified number of minutes,
                     98: the server will blank the screen, usually with a pattern that changes at the
                     99: specified rate.
                    100: The screen state will typically be restored when the next request or input
                    101: event occurs, unless the server was out of memory, in which case exposure
                    102: events to all mapped windows are generated.
                    103: If \fIvideo\fP is non-zero, the server will attempt to disable the video to
                    104: implement the screen saver, rather than change to the background
                    105: grey.
                    106: .FD
                    107: .IN "XGetDefault"
                    108: .IN "Definitions" "XGetDefault"
                    109: .IN "Default Options"
                    110: char *XGetDefault(program, name)
                    111:        char *program;  /* usually name of program */
                    112:        char *name;
                    113: .FN
                    114: The number of options that a program may need can be very large in the X
                    115: environment.
                    116: (Fonts of various sorts, colors of characters, mouse, background, text,
                    117: cursor, etc.)
                    118: If only command line options could be used to specify each of these,
                    119: things quickly become unmanageable as your tastes in windows will often
                    120: be drastically different from someone else's.
                    121: .PP
                    122: \fIXGetDefault\fP
                    123: makes it easy to find out what the user wants for his favorite
                    124: font, colors, etc.
                    125: Its use is highly encouraged.
                    126: .PP
                    127: \fIXGetDefault\fP will return NULL if no option of the specified name exists for
                    128: the program.
                    129: Defaults are read out of a file called
                    130: .IN "File" "$HOME/.Xdefaults"
                    131: \fI~/.Xdefaults\fP in the user's home directory.
                    132: See the X manual page
                    133: for details of its format.
                    134: .PP
                    135: The strings returned by \fIXGetDefault\fP are owned by Xlib and should not
                    136: be modified or freed by the client.
                    137: .FD
                    138: .IN "XParseGeometry"
                    139: .IN "Definitions" "XParseGeometry"
                    140: .IN "Window" "Initial Location"
                    141: int XParseGeometry (string, x, y, width, height)
                    142:        char *string;
                    143:        int *x, *y, *width, *height;    /* RETURN */
                    144: .FN
                    145: By convention,
                    146: X applications use a standard string to indicate window size and placement.
                    147: This subroutine makes it easy to conform to this standard.
                    148: It is not normally used by user programs, which typically use
                    149: .IN "XCreate"
                    150: .IN "XCreateTerm"
                    151: the \fIXCreate\fP or \fIXCreateTerm\fP subroutines to create the window.
                    152: This subroutine is used to parse strings of form 
                    153: \fI=<width>x<height>{+-}<xoffset>{+-}<yoffset>\fP where
                    154: width, height, xoffset and yoffset are returned in the \fIwidth\fP, 
                    155: \fIheight\fP, \fIx\fP and \fIy\fP arguments.
                    156: It returns a bitmask that indicates which of the four values were
                    157: actually found in the string, and whether the x and y values
                    158: are negative (remember, -0 is not equal +0 in this system!).
                    159: For each value found, the corresponding argument is updated;
                    160: for each value not found, the argument is left unchanged.
                    161: The bits are \fIXValue\fP, \fIYValue\fP, \fIWidthValue\fP, \fIHeightValue\fP,
                    162: \fIXNegative\fP, \fIYNegative\fP, and are defined in \fI<X/Xlib.h>\fP.
                    163: .IN "File" "<X/Xlib.h>
                    164: They will be set whenever one of the values are defined or signs
                    165: are set.
                    166: .FD
                    167: .IN "XGeometry"
                    168: .IN "Definitions" "Geometry"
                    169: .IN "Window" "Initial Location"
                    170: .IN "Window" "Computing Placement"
                    171: int XGeometry (position, default, bwidth, fwidth, fheight, xadd, yadd, x, y, width, height)
                    172:        char *position, default;        /* geometry specs */
                    173:        int bwidth;     /* border width */
                    174:        int fwidth, fheight;    /* size of units of width and height spec */
                    175:        int xadd, yadd; /* any additional interior space */
                    176:        int *x, *y, *width, *height;    /* RETURN */
                    177: .FN
                    178: This routine does all the work required to determine the placement of
                    179: a window using the current format to position windows.
                    180: Given a fully qualified default geometry specification and a (possibly)
                    181: incompletely specified geometry specification, it will return a bitmask
                    182: value as defined above in the \fIXParseGeometry\fP call.
                    183: It is not normally used by user programs, which typically use
                    184: .IN "XCreate"
                    185: .IN "XCreateTerm"
                    186: the \fIXCreate\fP or \fIXCreateTerm\fP subroutines to create the window.
                    187: The position the window should be placed will be returned in the
                    188: x, y, width, and height arguments.
                    189: If either the function returns the \fIXValue\fP or \fIYValue\fP flag,
                    190: you should
                    191: place the window at the requested position.
                    192: The border width (\fIbwidth\fP),
                    193: size of the increments \fIfwidth\fP and \fIfheight\fP
                    194: (typically font width and height),
                    195: and any additional interior space (\fIxadd\fP and \fIyadd\fP)
                    196: are passed in to make it easy to compute the resulting size.
                    197: .FD
                    198: .IN "XReadBitmapFile"
                    199: .IN "Definitions" "Bitmap file format"
                    200: .IN "Definitions" "XReadBitmapFile"
                    201: Status XReadBitmapFile (filename, width, height, data, x_hot, y_hot)
                    202:        char *filename;
                    203:        int *width, *height;  /* RETURN; must be non-NULL */
                    204:        short **data;         /* RETURN */
                    205:        int *x_hot, *y_hot;   /* RETURN; may be NULL */
                    206: .FN
                    207: \fIXReadBitmapFile\fP reads a file produced by the
                    208: .I bitmap(1)
                    209: program.   The format of that file is described in the man page for 
                    210: that program.
                    211: .PP
                    212: If the cannot be opened, \fIXReadBitmapFile\fP returns a Status of 0.  If the 
                    213: file can be opened but is not syntactically valid, the procedure returns
                    214: a negative Status.  If the file is readable and valid, it returns a Status of 1.
                    215: .PP
                    216: \fIXReadBitmapFile\fP assigns the bitmap's \fIheight\fP and \fIwidth\fP,
                    217: as read from the file,
                    218: to the caller's variables 
                    219: \fIwidth\fP
                    220: and 
                    221: \fIheight\fP.
                    222: It then allocates an appropriate
                    223: amount of storage, reads the bitmap data from the file, and assigns to the
                    224: caller's variable 
                    225: .I data.
                    226: The caller must free 
                    227: .I data
                    228: when he is done with it.
                    229: .PP
                    230: If
                    231: .I x_hot
                    232: and 
                    233: .I y_hot
                    234: are non-NULL, then \fIXReadBitmapFile\fP will set 
                    235: .I *x_hot
                    236: and 
                    237: .I *y_hot
                    238: to the value of the hot spot as defined in the file.  If no hot spot is
                    239: defined, \fIXReadBitmapFile\fP will set
                    240: .I *x_hot
                    241: and 
                    242: .I *y_hot
                    243: to -1.
                    244: 

unix.superglobalmegacorp.com

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