Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | '\" t |
| 2 | .\"*************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 3 | .\" Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | .\" * |
| 5 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | .\" copy of this software and associated documentation files (the * |
| 7 | .\" "Software"), to deal in the Software without restriction, including * |
| 8 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 11 | .\" furnished to do so, subject to the following conditions: * |
| 12 | .\" * |
| 13 | .\" The above copyright notice and this permission notice shall be included * |
| 14 | .\" in all copies or substantial portions of the Software. * |
| 15 | .\" * |
| 16 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | .\" * |
| 24 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 25 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 26 | .\" sale, use or other dealings in this Software without prior written * |
| 27 | .\" authorization. * |
| 28 | .\"*************************************************************************** |
| 29 | .\" |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 30 | .\" $Id: curs_mouse.3x,v 1.42 2015/07/21 09:27:39 tom Exp $ |
| 31 | .de bP |
| 32 | .IP \(bu 4 |
| 33 | .. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 34 | .TH curs_mouse 3X "" |
| 35 | .na |
| 36 | .hy 0 |
| 37 | .SH NAME |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 38 | \fBhas_mouse\fR, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 39 | \fBgetmouse\fR, \fBungetmouse\fR, |
| 40 | \fBmousemask\fR, \fBwenclose\fR, |
| 41 | \fBmouse_trafo\fR, \fBwmouse_trafo\fR, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 42 | \fBmouseinterval\fR \- mouse interface through curses |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 43 | .ad |
| 44 | .hy |
| 45 | .SH SYNOPSIS |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 46 | \fB#include <curses.h>\fR |
| 47 | .PP |
| 48 | \fBtypedef unsigned long mmask_t;\fR |
| 49 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 50 | .nf |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 51 | \fBtypedef struct {\fR |
| 52 | \fB short id; \fR\fI/* ID to distinguish multiple devices */\fR |
| 53 | \fB int x, y, z; \fR\fI/* event coordinates */\fR |
| 54 | \fB mmask_t bstate; \fR\fI/* button state bits */\fR |
| 55 | \fB} MEVENT;\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 56 | .fi |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 57 | .PP |
| 58 | \fBbool has_mouse(void);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 59 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 60 | \fBint getmouse(MEVENT *\fP\fIevent\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 61 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 62 | \fBint ungetmouse(MEVENT *\fP\fIevent\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 63 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 64 | \fBmmask_t mousemask(mmask_t \fP\fInewmask\fP\fB, mmask_t *\fP\fIoldmask\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 65 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 66 | \fBbool wenclose(const WINDOW *\fP\fIwin\fP\fB, int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 67 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 68 | \fBbool mouse_trafo(int* \fP\fIpY\fP\fB, int* \fP\fIpX\fP\fB, bool \fP\fIto_screen\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 69 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 70 | \fBbool wmouse_trafo(const WINDOW* \fP\fIwin\fP\fB, int* \fP\fIpY\fP\fB, int* \fP\fIpX\fP\fB,\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 71 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 72 | \fBbool \fP\fIto_screen\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 74 | \fBint mouseinterval(int \fP\fIerval\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 75 | .br |
| 76 | .SH DESCRIPTION |
| 77 | These functions provide an interface to mouse events from |
| 78 | \fBncurses\fR(3X). |
| 79 | Mouse events are represented by \fBKEY_MOUSE\fR |
| 80 | pseudo-key values in the \fBwgetch\fR input stream. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 81 | .SS mousemask |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 82 | .PP |
| 83 | To make mouse events visible, use the \fBmousemask\fR function. |
| 84 | This will set |
| 85 | the mouse events to be reported. |
| 86 | By default, no mouse events are reported. |
| 87 | The function will return a mask to indicate which of the specified mouse events |
| 88 | can be reported; on complete failure it returns 0. |
| 89 | If oldmask is non-NULL, |
| 90 | this function fills the indicated location with the previous value of the given |
| 91 | window's mouse event mask. |
| 92 | .PP |
| 93 | As a side effect, setting a zero mousemask may turn off the mouse pointer; |
| 94 | setting a nonzero mask may turn it on. |
| 95 | Whether this happens is device-dependent. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 96 | .SS Mouse events |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 97 | .PP |
| 98 | Here are the mouse event type masks which may be defined: |
| 99 | .PP |
| 100 | .TS |
| 101 | l l |
| 102 | _ _ |
| 103 | l l. |
| 104 | \fIName\fR \fIDescription\fR |
| 105 | BUTTON1_PRESSED mouse button 1 down |
| 106 | BUTTON1_RELEASED mouse button 1 up |
| 107 | BUTTON1_CLICKED mouse button 1 clicked |
| 108 | BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked |
| 109 | BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked |
| 110 | _ |
| 111 | BUTTON2_PRESSED mouse button 2 down |
| 112 | BUTTON2_RELEASED mouse button 2 up |
| 113 | BUTTON2_CLICKED mouse button 2 clicked |
| 114 | BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked |
| 115 | BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked |
| 116 | _ |
| 117 | BUTTON3_PRESSED mouse button 3 down |
| 118 | BUTTON3_RELEASED mouse button 3 up |
| 119 | BUTTON3_CLICKED mouse button 3 clicked |
| 120 | BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked |
| 121 | BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked |
| 122 | _ |
| 123 | BUTTON4_PRESSED mouse button 4 down |
| 124 | BUTTON4_RELEASED mouse button 4 up |
| 125 | BUTTON4_CLICKED mouse button 4 clicked |
| 126 | BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked |
| 127 | BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked |
| 128 | _ |
| 129 | BUTTON5_PRESSED mouse button 5 down |
| 130 | BUTTON5_RELEASED mouse button 5 up |
| 131 | BUTTON5_CLICKED mouse button 5 clicked |
| 132 | BUTTON5_DOUBLE_CLICKED mouse button 5 double clicked |
| 133 | BUTTON5_TRIPLE_CLICKED mouse button 5 triple clicked |
| 134 | _ |
| 135 | BUTTON_SHIFT shift was down during button state change |
| 136 | BUTTON_CTRL control was down during button state change |
| 137 | BUTTON_ALT alt was down during button state change |
| 138 | ALL_MOUSE_EVENTS report all button state changes |
| 139 | REPORT_MOUSE_POSITION report mouse movement |
| 140 | _ |
| 141 | .TE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 142 | .SS getmouse |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 143 | .PP |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 144 | Once a class of mouse events has been made visible in a window, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 145 | calling the \fBwgetch\fR function on that window may return |
| 146 | \fBKEY_MOUSE\fR as an indicator that a mouse event has been queued. |
| 147 | To read the event data and pop the event off the queue, call |
| 148 | \fBgetmouse\fR. |
| 149 | This function will return \fBOK\fR if a mouse event |
| 150 | is actually visible in the given window, \fBERR\fR otherwise. |
| 151 | When \fBgetmouse\fR returns \fBOK\fR, the data deposited as y and |
| 152 | x in the event structure coordinates will be screen-relative character-cell |
| 153 | coordinates. |
| 154 | The returned state mask will have exactly one bit set to |
| 155 | indicate the event type. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 156 | The corresponding data in the queue is marked invalid. |
| 157 | A subsequent call to \fBgetmouse\fP will retrieve the next older |
| 158 | item from the queue. |
| 159 | .SS ungetmouse |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 160 | .PP |
| 161 | The \fBungetmouse\fR function behaves analogously to \fBungetch\fR. |
| 162 | It pushes |
| 163 | a \fBKEY_MOUSE\fR event onto the input queue, and associates with that event |
| 164 | the given state data and screen-relative character-cell coordinates. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 165 | .SS wenclose |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 166 | .PP |
| 167 | The \fBwenclose\fR function tests whether a given pair of screen-relative |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 168 | character-cell coordinates is enclosed by a given window, returning \fBTRUE\fP |
| 169 | if it is and \fBFALSE\fP otherwise. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 170 | It is useful for determining what subset of |
| 171 | the screen windows enclose the location of a mouse event. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 172 | .SS wmouse_trafo |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 173 | .PP |
| 174 | The \fBwmouse_trafo\fR function transforms a given pair of coordinates |
| 175 | from stdscr-relative coordinates |
| 176 | to coordinates relative to the given window or vice versa. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 177 | The resulting stdscr-relative coordinates are not always identical |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 178 | to window-relative coordinates due to the mechanism to reserve lines on top |
| 179 | or bottom of the screen for other purposes |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 180 | (see the \fBripoffline\fP and \fBslk_init\fR calls, for example). |
| 181 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 182 | If the parameter \fBto_screen\fR is \fBTRUE\fR, the pointers |
| 183 | \fBpY, pX\fR must reference the coordinates of a location |
| 184 | inside the window \fBwin\fR. |
| 185 | They are converted to window-relative coordinates and returned |
| 186 | through the pointers. |
| 187 | If the conversion was successful, the function returns \fBTRUE\fR. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 188 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 189 | If one of the parameters was NULL or the location is |
| 190 | not inside the window, \fBFALSE\fR is returned. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 191 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 192 | If \fBto_screen\fR is |
| 193 | \fBFALSE\fR, the pointers \fBpY, pX\fR must reference window-relative |
| 194 | coordinates. |
| 195 | They are converted to stdscr-relative coordinates if the |
| 196 | window \fBwin\fR encloses this point. |
| 197 | In this case the function returns \fBTRUE\fR. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 198 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 199 | If one of the parameters is NULL or the point is not inside the |
| 200 | window, \fBFALSE\fR is returned. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 201 | The referenced coordinates |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 202 | are only replaced by the converted coordinates if the transformation was |
| 203 | successful. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 204 | .SS mouse_trafo |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 205 | .PP |
| 206 | The \fBmouse_trafo\fR function performs the same translation |
| 207 | as \fBwmouse_trafo\fR, |
| 208 | using stdscr for \fBwin\fR. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 209 | .SS mouseinterval |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 210 | .PP |
| 211 | The \fBmouseinterval\fR function sets the maximum time (in thousands of a |
| 212 | second) that can elapse between press and release events for them to |
| 213 | be recognized as a click. |
| 214 | Use \fBmouseinterval(0)\fR to disable click resolution. |
| 215 | This function returns the previous interval value. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 216 | Use \fBmouseinterval(\-1)\fR to obtain the interval without altering it. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 217 | The default is one sixth of a second. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 218 | .SS has_mouse |
| 219 | .PP |
| 220 | The \fBhas_mouse\fP function returns \fBTRUE\fP if the mouse driver has been |
| 221 | successfully initialized. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 222 | .PP |
| 223 | Note that mouse events will be ignored when input is in cooked mode, and will |
| 224 | cause an error beep when cooked mode is being simulated in a window by a |
| 225 | function such as \fBgetstr\fR that expects a linefeed for input-loop |
| 226 | termination. |
| 227 | .SH RETURN VALUE |
| 228 | \fBgetmouse\fR and \fBungetmouse\fR |
| 229 | return the integer \fBERR\fR upon failure or \fBOK\fR |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 230 | upon successful completion: |
| 231 | .RS 3 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 232 | .TP 5 |
| 233 | \fBgetmouse\fP |
| 234 | returns an error. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 235 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 236 | If no mouse driver was initialized, or |
| 237 | if the mask parameter is zero, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 238 | .bP |
| 239 | It also returns an error if no more events remain in the queue. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 240 | .TP 5 |
| 241 | \fBungetmouse\fP |
| 242 | returns an error if the FIFO is full. |
| 243 | .RE |
| 244 | .PP |
| 245 | \fBmousemask\fR |
| 246 | returns the mask of reportable events. |
| 247 | .PP |
| 248 | \fBmouseinterval\fR |
| 249 | returns the previous interval value, unless |
| 250 | the terminal was not initialized. |
| 251 | In that case, it returns the maximum interval value (166). |
| 252 | .PP |
| 253 | \fBwenclose\fR and \fBwmouse_trafo\fR |
| 254 | are boolean functions returning \fBTRUE\fR or \fBFALSE\fR depending |
| 255 | on their test result. |
| 256 | .SH PORTABILITY |
| 257 | These calls were designed for \fBncurses\fR(3X), and are not found in SVr4 |
| 258 | curses, 4.4BSD curses, or any other previous version of curses. |
| 259 | .PP |
| 260 | The feature macro \fBNCURSES_MOUSE_VERSION\fR is provided so the preprocessor |
| 261 | can be used to test whether these features are present. |
| 262 | If the interface is changed, the value of \fBNCURSES_MOUSE_VERSION\fR will be |
| 263 | incremented. |
| 264 | These values for \fBNCURSES_MOUSE_VERSION\fR may be |
| 265 | specified when configuring ncurses: |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 266 | .RS 3 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 267 | .TP 3 |
| 268 | 1 |
| 269 | has definitions for reserved events. |
| 270 | The mask uses 28 bits. |
| 271 | .TP 3 |
| 272 | 2 |
| 273 | adds definitions for button 5, |
| 274 | removes the definitions for reserved events. |
| 275 | The mask uses 29 bits. |
| 276 | .RE |
| 277 | .PP |
| 278 | The order of the \fBMEVENT\fR structure members is not guaranteed. |
| 279 | Additional fields may be added to the structure in the future. |
| 280 | .PP |
| 281 | Under \fBncurses\fR(3X), these calls are implemented using either |
| 282 | xterm's built-in mouse-tracking API or |
| 283 | platform-specific drivers including |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 284 | .RS 3 |
| 285 | .bP |
| 286 | Alessandro Rubini's gpm server |
| 287 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 288 | FreeBSD sysmouse |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 289 | .bP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 290 | OS/2 EMX |
| 291 | .RE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 292 | .PP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 293 | If you are using an unsupported configuration, |
| 294 | mouse events will not be visible to |
| 295 | \fBncurses\fR(3X) (and the \fBmousemask\fR function will always |
| 296 | return \fB0\fR). |
| 297 | .PP |
| 298 | If the terminfo entry contains a \fBXM\fR string, |
| 299 | this is used in the xterm mouse driver to control the |
| 300 | way the terminal is initialized for mouse operation. |
| 301 | The default, if \fBXM\fR is not found, |
| 302 | corresponds to private mode 1000 of xterm: |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 303 | .PP |
| 304 | .RS 3 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 305 | \\E[?1000%?%p1%{1}%=%th%el%; |
| 306 | .RE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 307 | .PP |
| 308 | The \fIz\fP member in the event structure is not presently used. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 309 | It is intended |
| 310 | for use with touch screens (which may be pressure-sensitive) or with |
| 311 | 3D-mice/trackballs/power gloves. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 312 | .PP |
| 313 | The \fBALL_MOUSE_EVENTS\fP class does not include \fBREPORT_MOUSE_POSITION\fP. |
| 314 | They are distinct. |
| 315 | For example, in xterm, |
| 316 | wheel/scrolling mice send position reports as a sequence of |
| 317 | presses of buttons 4 or 5 without matching button-releases. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 318 | .SH BUGS |
| 319 | Mouse events under xterm will not in fact be ignored during cooked mode, |
| 320 | if they have been enabled by \fBmousemask\fR. |
| 321 | Instead, the xterm mouse |
| 322 | report sequence will appear in the string read. |
| 323 | .PP |
| 324 | Mouse events under xterm will not be detected correctly in a window with |
| 325 | its keypad bit off, since they are interpreted as a variety of function key. |
| 326 | Your terminfo description should have \fBkmous\fR set to "\\E[M" |
| 327 | (the beginning of the response from xterm for mouse clicks). |
| 328 | Other values for \fBkmous\fR are permitted, |
| 329 | but under the same assumption, |
| 330 | i.e., it is the beginning of the response. |
| 331 | .PP |
| 332 | Because there are no standard terminal responses that would serve to identify |
| 333 | terminals which support the xterm mouse protocol, \fBncurses\fR assumes that |
| 334 | if your $TERM environment variable contains "xterm", |
| 335 | or \fBkmous\fR is defined in |
| 336 | the terminal description, then the terminal may send mouse events. |
| 337 | .SH SEE ALSO |
| 338 | \fBcurses\fR(3X), |
| 339 | \fBcurs_kernel\fR(3X), |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 340 | \fBcurs_slk\fR(3X), |
| 341 | \fBcurs_variables\fR(3X). |