diff -ur xterm-276.orig/button.c xterm-276/button.c
old
|
new
|
|
176 | 176 | static unsigned |
177 | 177 | EmitMousePosition(TScreen * screen, Char line[], unsigned count, int value) |
178 | 178 | { |
179 | | int mouse_limit = (screen->ext_mode_mouse |
| 179 | int mouse_limit = (screen->urxvt_ext_mode_mouse |
| 180 | ? -1 |
| 181 | : screen->ext_mode_mouse |
180 | 182 | ? EXT_MOUSE_LIMIT |
181 | 183 | : MOUSE_LIMIT); |
182 | 184 | |
… |
… |
|
192 | 194 | */ |
193 | 195 | if (value == mouse_limit) { |
194 | 196 | line[count++] = CharOf(0); |
| 197 | } else if (screen->urxvt_ext_mode_mouse) { |
| 198 | count += sprintf(line + count, "%d", value + 1); |
195 | 199 | } else if (!screen->ext_mode_mouse || value < EXT_MOUSE_START) { |
196 | 200 | line[count++] = CharOf(' ' + value + 1); |
197 | 201 | } else { |
… |
… |
|
202 | 206 | return count; |
203 | 207 | } |
204 | 208 | |
| 209 | static unsigned |
| 210 | EmitMousePositionSeparator(TScreen * screen, Char line[], unsigned count) |
| 211 | { |
| 212 | if (screen->urxvt_ext_mode_mouse) { |
| 213 | line[count++] = ';'; |
| 214 | } |
| 215 | return count; |
| 216 | } |
| 217 | |
205 | 218 | Bool |
206 | 219 | SendMousePosition(XtermWidget xw, XEvent * event) |
207 | 220 | { |
… |
… |
|
2242 | 2255 | CELL cell; |
2243 | 2256 | unsigned count; |
2244 | 2257 | TScreen *screen = TScreenOf(xw); |
2245 | | Char line[20]; |
| 2258 | Char line[64]; |
2246 | 2259 | |
2247 | 2260 | if (use_cursor_loc) { |
2248 | 2261 | cell = screen->cursorp; |
… |
… |
|
2264 | 2277 | if (isSameCELL(&(screen->rawPos), &(screen->startSel)) |
2265 | 2278 | && isSameCELL(&cell, &(screen->endSel))) { |
2266 | 2279 | /* Use short-form emacs select */ |
2267 | | line[count++] = 't'; |
| 2280 | if (!screen->urxvt_ext_mode_mouse) { |
| 2281 | line[count++] = 't'; |
| 2282 | } |
2268 | 2283 | count = EmitMousePosition(screen, line, count, screen->endSel.col); |
| 2284 | count = EmitMousePositionSeparator(screen, line, count); |
2269 | 2285 | count = EmitMousePosition(screen, line, count, screen->endSel.row); |
| 2286 | if (screen->urxvt_ext_mode_mouse) { |
| 2287 | line[count++] = 't'; |
| 2288 | } |
2270 | 2289 | } else { |
2271 | 2290 | /* long-form, specify everything */ |
2272 | | line[count++] = 'T'; |
| 2291 | if (!screen->urxvt_ext_mode_mouse) { |
| 2292 | line[count++] = 'T'; |
| 2293 | } |
2273 | 2294 | count = EmitMousePosition(screen, line, count, screen->startSel.col); |
| 2295 | count = EmitMousePositionSeparator(screen, line, count); |
2274 | 2296 | count = EmitMousePosition(screen, line, count, screen->startSel.row); |
| 2297 | count = EmitMousePositionSeparator(screen, line, count); |
2275 | 2298 | count = EmitMousePosition(screen, line, count, screen->endSel.col); |
| 2299 | count = EmitMousePositionSeparator(screen, line, count); |
2276 | 2300 | count = EmitMousePosition(screen, line, count, screen->endSel.row); |
| 2301 | count = EmitMousePositionSeparator(screen, line, count); |
2277 | 2302 | count = EmitMousePosition(screen, line, count, cell.col); |
| 2303 | count = EmitMousePositionSeparator(screen, line, count); |
2278 | 2304 | count = EmitMousePosition(screen, line, count, cell.row); |
| 2305 | if (screen->urxvt_ext_mode_mouse) { |
| 2306 | line[count++] = 'T'; |
| 2307 | } |
2279 | 2308 | } |
2280 | 2309 | v_write(screen->respond, line, count); |
2281 | 2310 | TrackText(xw, &zeroCELL, &zeroCELL); |
… |
… |
|
4066 | 4095 | } |
4067 | 4096 | |
4068 | 4097 | static unsigned |
4069 | | EmitButtonCode(TScreen * screen, Char * line, unsigned count, XButtonEvent * event) |
| 4098 | EmitButtonCode(TScreen * screen, Char * line, unsigned count, int value) |
4070 | 4099 | { |
4071 | | int value = BtnCode(event, screen->mouse_button); |
4072 | | |
4073 | | if (!screen->ext_mode_mouse || value < 128) { |
| 4100 | if (screen->urxvt_ext_mode_mouse) { |
| 4101 | count += sprintf(line + count, "%d", value); |
| 4102 | } else if (!screen->ext_mode_mouse || value < 128) { |
4074 | 4103 | line[count++] = CharOf(value); |
4075 | 4104 | } else { |
4076 | 4105 | line[count++] = CharOf(0xC0 + (value >> 6)); |
… |
… |
|
4084 | 4113 | { |
4085 | 4114 | TScreen *screen = TScreenOf(xw); |
4086 | 4115 | int pty = screen->respond; |
4087 | | int mouse_limit = screen->ext_mode_mouse ? EXT_MOUSE_LIMIT : MOUSE_LIMIT; |
4088 | | Char line[10]; |
| 4116 | int mouse_limit = screen->urxvt_ext_mode_mouse ? -1 : screen->ext_mode_mouse ? EXT_MOUSE_LIMIT : MOUSE_LIMIT; |
| 4117 | Char line[32]; |
4089 | 4118 | int row, col; |
4090 | 4119 | int button; |
4091 | 4120 | unsigned count = 0; |
… |
… |
|
4111 | 4140 | else if (col > screen->max_col) |
4112 | 4141 | col = screen->max_col; |
4113 | 4142 | |
4114 | | /* Limit to representable mouse dimensions */ |
4115 | | if (row > mouse_limit) |
4116 | | row = mouse_limit; |
4117 | | if (col > mouse_limit) |
4118 | | col = mouse_limit; |
| 4143 | if (mouse_limit > 0) { |
| 4144 | /* Limit to representable mouse dimensions */ |
| 4145 | if (row > mouse_limit) |
| 4146 | row = mouse_limit; |
| 4147 | if (col > mouse_limit) |
| 4148 | col = mouse_limit; |
| 4149 | } |
4119 | 4150 | |
4120 | 4151 | /* Build key sequence starting with \E[M */ |
4121 | 4152 | if (screen->control_eight_bits) { |
… |
… |
|
4133 | 4164 | line[count++] = '>'; |
4134 | 4165 | } |
4135 | 4166 | #endif |
4136 | | line[count++] = 'M'; |
| 4167 | if (!screen->urxvt_ext_mode_mouse) { |
| 4168 | line[count++] = 'M'; |
| 4169 | } |
4137 | 4170 | |
4138 | 4171 | /* Add event code to key sequence */ |
4139 | 4172 | if (screen->send_mouse_pos == X10_MOUSE) { |
4140 | | line[count++] = CharOf(' ' + button); |
| 4173 | count = EmitButtonCode(screen, line, count, CharOf(' ' + button)); |
4141 | 4174 | } else { |
4142 | 4175 | /* Button-Motion events */ |
4143 | 4176 | switch (event->type) { |
4144 | 4177 | case ButtonPress: |
4145 | 4178 | screen->mouse_button = button; |
4146 | | count = EmitButtonCode(screen, line, count, event); |
| 4179 | count = EmitButtonCode(screen, line, count, BtnCode(event, button)); |
4147 | 4180 | break; |
4148 | 4181 | case ButtonRelease: |
4149 | 4182 | /* |
… |
… |
|
4154 | 4187 | if (button < 3) |
4155 | 4188 | button = -1; |
4156 | 4189 | screen->mouse_button = button; |
4157 | | count = EmitButtonCode(screen, line, count, event); |
| 4190 | count = EmitButtonCode(screen, line, count, BtnCode(event, button)); |
4158 | 4191 | break; |
4159 | 4192 | case MotionNotify: |
4160 | 4193 | /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion |
… |
… |
|
4164 | 4197 | && (col == screen->mouse_col)) { |
4165 | 4198 | changed = False; |
4166 | 4199 | } else { |
4167 | | count = EmitButtonCode(screen, line, count, event); |
| 4200 | count = EmitButtonCode(screen, line, count, BtnCode(event, screen->mouse_button)); |
4168 | 4201 | } |
4169 | 4202 | break; |
4170 | 4203 | default: |
… |
… |
|
4180 | 4213 | TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, line[count - 1])); |
4181 | 4214 | |
4182 | 4215 | /* Add pointer position to key sequence */ |
| 4216 | count = EmitMousePositionSeparator(screen, line, count); |
4183 | 4217 | count = EmitMousePosition(screen, line, count, col); |
| 4218 | count = EmitMousePositionSeparator(screen, line, count); |
4184 | 4219 | count = EmitMousePosition(screen, line, count, row); |
4185 | 4220 | |
| 4221 | if (screen->urxvt_ext_mode_mouse) { |
| 4222 | line[count++] = 'M'; |
| 4223 | } |
| 4224 | |
4186 | 4225 | /* Transmit key sequence to process running under xterm */ |
4187 | 4226 | v_write(pty, line, count); |
4188 | 4227 | } |
diff -ur xterm-276.orig/charproc.c xterm-276/charproc.c
old
|
new
|
|
4360 | 4360 | case SET_EXT_MODE_MOUSE: |
4361 | 4361 | set_bool_mode(screen->ext_mode_mouse); |
4362 | 4362 | break; |
| 4363 | case SET_URXVT_EXT_MODE_MOUSE: |
| 4364 | set_bool_mode(screen->urxvt_ext_mode_mouse); |
| 4365 | break; |
4363 | 4366 | case 1010: /* rxvt */ |
4364 | 4367 | set_bool_mode(screen->scrollttyoutput); |
4365 | 4368 | update_scrollttyoutput(); |
… |
… |
|
4565 | 4568 | case SET_EXT_MODE_MOUSE: |
4566 | 4569 | DoSM(DP_X_EXT_MOUSE, screen->ext_mode_mouse); |
4567 | 4570 | break; |
| 4571 | case SET_URXVT_EXT_MODE_MOUSE: |
| 4572 | DoSM(DP_X_EXT_MOUSE, screen->urxvt_ext_mode_mouse); |
| 4573 | break; |
4568 | 4574 | case 1048: |
4569 | 4575 | if (!xw->misc.titeInhibit) { |
4570 | 4576 | CursorSave(xw); |
… |
… |
|
4736 | 4742 | case SET_EXT_MODE_MOUSE: |
4737 | 4743 | DoRM(DP_X_EXT_MOUSE, screen->ext_mode_mouse); |
4738 | 4744 | break; |
| 4745 | case SET_URXVT_EXT_MODE_MOUSE: |
| 4746 | DoRM(DP_X_EXT_MOUSE, screen->urxvt_ext_mode_mouse); |
| 4747 | break; |
4739 | 4748 | case 1048: |
4740 | 4749 | if (!xw->misc.titeInhibit) { |
4741 | 4750 | CursorRestore(xw); |
… |
… |
|
8385 | 8394 | screen->send_mouse_pos = MOUSE_OFF; |
8386 | 8395 | screen->send_focus_pos = OFF; |
8387 | 8396 | screen->ext_mode_mouse = OFF; |
| 8397 | screen->urxvt_ext_mode_mouse = OFF; |
8388 | 8398 | screen->waitingForTrackInfo = False; |
8389 | 8399 | screen->eventMode = NORMAL; |
8390 | 8400 | |
diff -ur xterm-276.orig/ctlseqs.ms xterm-276/ctlseqs.ms
old
|
new
|
|
2010 | 2010 | #define SET_FOCUS_EVENT_MOUSE 1004 |
2011 | 2011 | |
2012 | 2012 | #define SET_EXT_MODE_MOUSE 1005 |
| 2013 | |
| 2014 | #define SET_URXVT_EXT_MODE_MOUSE 1015 |
2013 | 2015 | .DE |
2014 | 2016 | .br |
2015 | 2017 | The motion reporting modes are strictly \fIxterm\fP extensions, and are not |
diff -ur xterm-276.orig/ctlseqs.txt xterm-276/ctlseqs.txt
old
|
new
|
|
1356 | 1356 | |
1357 | 1357 | #define SET_EXT_MODE_MOUSE 1005 |
1358 | 1358 | |
| 1359 | #define SET_URXVT_EXT_MODE_MOUSE 1015 |
| 1360 | |
1359 | 1361 | The motion reporting modes are strictly xterm extensions, and are not |
1360 | 1362 | part of any standard, though they are analogous to the DEC VT200 DECELR |
1361 | 1363 | locator reports. |
diff -ur xterm-276.orig/misc.c xterm-276/misc.c
old
|
new
|
|
3776 | 3776 | case SET_EXT_MODE_MOUSE: |
3777 | 3777 | result = MdBool(screen->ext_mode_mouse); |
3778 | 3778 | break; |
| 3779 | case SET_URXVT_EXT_MODE_MOUSE: |
| 3780 | result = MdBool(screen->urxvt_ext_mode_mouse); |
| 3781 | break; |
3779 | 3782 | case 1010: /* rxvt */ |
3780 | 3783 | result = MdBool(screen->scrollttyoutput); |
3781 | 3784 | break; |
diff -ur xterm-276.orig/ptyx.h xterm-276/ptyx.h
old
|
new
|
|
1635 | 1635 | unsigned send_mouse_pos; /* user wants mouse transition */ |
1636 | 1636 | /* and position information */ |
1637 | 1637 | Boolean ext_mode_mouse; /* support large terminals */ |
| 1638 | Boolean urxvt_ext_mode_mouse; /* support large terminals */ |
1638 | 1639 | Boolean send_focus_pos; /* user wants focus in/out info */ |
1639 | 1640 | Boolean quiet_grab; /* true if no cursor change on focus */ |
1640 | 1641 | #if OPT_PASTE64 |
diff -ur xterm-276.orig/xcharmouse.h xterm-276/xcharmouse.h
old
|
new
|
|
48 | 48 | |
49 | 49 | /* Extend mouse tracking for terminals wider(taller) than 223 cols(rows) */ |
50 | 50 | #define SET_EXT_MODE_MOUSE 1005 /* compatible with above */ |
| 51 | #define SET_URXVT_EXT_MODE_MOUSE 1015 |
51 | 52 | |
52 | 53 | #define SET_BUTTON1_MOVE_POINT 2001 /* click1 emit Esc seq to move point*/ |
53 | 54 | #define SET_BUTTON2_MOVE_POINT 2002 /* press2 emit Esc seq to move point*/ |