|
|
1.1 ! root 1: .ds ZZ DEVELOPMENT PACKAGE ! 2: .TH BUTTONS 3R/3L "630 MTG" ! 3: .XE "bttn()" ! 4: .XE "bttn1()" ! 5: .XE "bttn2()" ! 6: .XE "bttn3()" ! 7: .XE "bttn12()" ! 8: .XE "bttn13()" ! 9: .XE "bttn23()" ! 10: .XE "bttn123()" ! 11: .XE "button()" ! 12: .XE "button1()" ! 13: .XE "button2()" ! 14: .XE "button3()" ! 15: .XE "button12()" ! 16: .XE "button13()" ! 17: .XE "button23()" ! 18: .XE "button123()" ! 19: .XE "bttns()" ! 20: .SH NAME ! 21: button[123], bttn[123], bttns \- button state ! 22: .SH SYNOPSIS ! 23: .sp ! 24: .B #include <dmd.h> ! 25: .sp ! 26: \f3int button1 ( ), button2 ( ), button3 ( )\f1 ! 27: .br ! 28: \f3int button12 ( ), button13 ( ), button23 ( ), button123 ( )\f1 ! 29: .sp ! 30: .B int button (b) ! 31: .sp ! 32: \f3int bttn1 ( ), bttn2 ( ), bttn3 ( )\f1 ! 33: .br ! 34: \f3int bttn12 ( ), bttn13 ( ), bttn23 ( ), bttn123 ( )\f1 ! 35: .sp ! 36: .B int bttn (b) ! 37: .sp ! 38: .B void bttns (updown) ! 39: .sp ! 40: .B int b; ! 41: .br ! 42: .B int updown; ! 43: .SH DESCRIPTION ! 44: The functions ! 45: .IR button1 , ! 46: .IR button2 , ! 47: and ! 48: .I button3 ! 49: return the state of the associated mouse button. ! 50: They return a ! 51: non-zero if the button is depressed, 0 if not. ! 52: .PP ! 53: The ! 54: .I button12 ! 55: function ! 56: and the other multi-button functions return ! 57: a Boolean OR ! 58: of their states, ! 59: e.g., ! 60: true if either button 1 ! 61: or ! 62: button 2 is depressed ! 63: (as opposed to button 1 ! 64: and ! 65: button 2). ! 66: .PP ! 67: The ! 68: .I button ! 69: function ! 70: takes as an argument the button number ! 71: 1, 2, or 3 ! 72: and returns the state of the button. ! 73: The process must be current and have possession of the mouse. ! 74: Furthermore, the mouse must be within the bounds of the window. ! 75: .PP ! 76: The bttn routines operate in the same manner as the corresponding ! 77: button routines except that they do not clip to the process's window. ! 78: This means that the calling processs must be current and have ! 79: possession of the mouse. It is not necessary, however, for the ! 80: mouse cursor to be inside the process's window. ! 81: .P ! 82: The ability to detect button transitions outside the window is ! 83: necessary in applications which have menus that may go outside the ! 84: window. ! 85: The button routines should be used in preference to the bttn routines ! 86: unless there is a specific need to be able to detect button state ! 87: changes outside of the process's window. ! 88: .P ! 89: Usage of the bttn routines is restricted to routines which do not ! 90: release the CPU, because the 630 MTG control process also watches ! 91: for button transitions outside of the current process's window. ! 92: The control process is the system process which normally handles ! 93: button operations when the mouse is not in the selected window. ! 94: Race conditions would otherwise arise as to whether the ! 95: application process or the control process should interpret the ! 96: button's state change. ! 97: .PP ! 98: The ! 99: .I bttn ! 100: function ! 101: takes as an argument the button number ! 102: 1, 2, or 3 ! 103: and returns the state of the button. ! 104: It does not clip to the window. ! 105: .PP ! 106: The ! 107: .I bttns ! 108: function ! 109: is used to determine when the mouse state changes. ! 110: When \fIbttns\fR is called, it ``busy loops''; not returning and not releasing ! 111: the CPU until the mouse state changes. ! 112: If ! 113: .I updown ! 114: is 0, ! 115: .I bttns ! 116: ``busy loops'' until all buttons are released. ! 117: If ! 118: .I updown ! 119: is 1, ! 120: .I bttns ! 121: ``busy loops'' until any button is depressed. ! 122: If ! 123: .I updown ! 124: is not 0 or 1, ! 125: .I bttns ! 126: returns immediately. ! 127: .PP ! 128: Note that these functions are only valid when \fBown()&MOUSE\fR is ! 129: true. ! 130: .SH EXAMPLE ! 131: The following code segment could be written to ``doodle'' in ! 132: a window. ! 133: .PP ! 134: .RS 3 ! 135: .ft CM ! 136: .nf ! 137: #include <dmd.h> ! 138: ! 139: main() ! 140: { ! 141: request (MOUSE); ! 142: for (;;){ ! 143: wait (MOUSE); ! 144: if (button3()) ! 145: break; ! 146: if (button1()) ! 147: point (&display, mouse.xy, ! 148: F_STORE); ! 149: } ! 150: } ! 151: .fi ! 152: .ft R ! 153: .RE ! 154: .SH SEE ALSO ! 155: resources(3R), transform(3R/3L).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.