… | |
… | |
25 | * - extensive modifications |
25 | * - extensive modifications |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
27 | * Copyright (c) 2001 Marius Gedminas |
27 | * Copyright (c) 2001 Marius Gedminas |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
|
|
30 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
30 | * |
31 | * |
31 | * This program is free software; you can redistribute it and/or modify |
32 | * This program is free software; you can redistribute it and/or modify |
32 | * it under the terms of the GNU General Public License as published by |
33 | * it under the terms of the GNU General Public License as published by |
33 | * the Free Software Foundation; either version 2 of the License, or |
34 | * the Free Software Foundation; either version 2 of the License, or |
34 | * (at your option) any later version. |
35 | * (at your option) any later version. |
… | |
… | |
55 | |
56 | |
56 | /*{{{ Convert the keypress event into a string */ |
57 | /*{{{ Convert the keypress event into a string */ |
57 | void |
58 | void |
58 | rxvt_term::lookup_key (XKeyEvent &ev) |
59 | rxvt_term::lookup_key (XKeyEvent &ev) |
59 | { |
60 | { |
60 | int ctrl, meta, shft, len; |
61 | int ctrl, meta, shft, len; |
61 | unsigned int newlen; |
62 | unsigned int newlen; |
62 | KeySym keysym; |
63 | KeySym keysym; |
63 | #ifdef DEBUG_CMD |
64 | #ifdef DEBUG_CMD |
64 | static int debug_key = 1; /* accessible by a debugger only */ |
65 | static int debug_key = 1; /* accessible by a debugger only */ |
65 | #endif |
66 | #endif |
66 | int valid_keysym; |
67 | int valid_keysym; |
67 | unsigned char kbuf[KBUFSZ]; |
68 | unsigned char kbuf[KBUFSZ]; |
68 | |
69 | |
69 | /* |
70 | /* |
70 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
71 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
71 | * escape sequence to toggle the Keypad. |
72 | * escape sequence to toggle the Keypad. |
… | |
… | |
88 | if (Input_Context) |
89 | if (Input_Context) |
89 | { |
90 | { |
90 | Status status_return; |
91 | Status status_return; |
91 | |
92 | |
92 | #ifdef X_HAVE_UTF8_STRING |
93 | #ifdef X_HAVE_UTF8_STRING |
93 | if (enc_utf8 && 0) |
94 | if (enc_utf8 && 0) // currently disabled, doesn't seem to work, nor is useful |
94 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
95 | len = Xutf8LookupString (Input_Context, &ev, (char *)kbuf, |
95 | KBUFSZ, &keysym, &status_return); |
96 | KBUFSZ, &keysym, &status_return); |
96 | else |
97 | else |
97 | #endif |
98 | #endif |
98 | |
|
|
99 | { |
99 | { |
100 | wchar_t wkbuf[KBUFSZ + 1]; |
100 | wchar_t wkbuf[KBUFSZ + 1]; |
101 | |
101 | |
102 | // the XOpenIM manpage lies about hardcoding the locale |
102 | // the XOpenIM manpage lies about hardcoding the locale |
103 | // at the point of XOpenIM, so temporarily switch locales |
103 | // at the point of XOpenIM, so temporarily switch locales |
… | |
… | |
108 | KBUFSZ, &keysym, &status_return); |
108 | KBUFSZ, &keysym, &status_return); |
109 | if (rs[Rs_imLocale]) |
109 | if (rs[Rs_imLocale]) |
110 | SET_LOCALE (locale); |
110 | SET_LOCALE (locale); |
111 | |
111 | |
112 | if (status_return == XLookupChars |
112 | if (status_return == XLookupChars |
113 | || status_return == XLookupBoth) |
113 | || status_return == XLookupBoth) |
114 | { |
114 | { |
115 | wkbuf[len] = 0; |
115 | wkbuf[len] = 0; |
116 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
116 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
117 | if (len < 0) |
117 | if (len < 0) |
118 | len = 0; |
118 | len = 0; |
… | |
… | |
120 | else |
120 | else |
121 | len = 0; |
121 | len = 0; |
122 | } |
122 | } |
123 | |
123 | |
124 | valid_keysym = status_return == XLookupKeySym |
124 | valid_keysym = status_return == XLookupKeySym |
125 | || status_return == XLookupBoth; |
125 | || status_return == XLookupBoth; |
126 | } |
126 | } |
127 | else |
127 | else |
128 | #endif |
128 | #endif |
129 | |
|
|
130 | { |
129 | { |
131 | len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); |
130 | len = XLookupString (&ev, (char *)kbuf, KBUFSZ, &keysym, &compose); |
132 | valid_keysym = !len; |
131 | valid_keysym = keysym != NoSymbol; |
133 | } |
132 | } |
134 | |
133 | |
135 | if (valid_keysym) |
134 | if (valid_keysym) |
136 | { |
135 | { |
137 | /* for some backwards compatibility */ |
136 | /* for some backwards compatibility */ |
… | |
… | |
162 | { |
161 | { |
163 | #else |
162 | #else |
164 | if (IS_SCROLL_MOD) |
163 | if (IS_SCROLL_MOD) |
165 | { |
164 | { |
166 | #endif |
165 | #endif |
167 | int lnsppg; |
166 | int lnsppg; |
168 | |
167 | |
169 | #ifdef PAGING_CONTEXT_LINES |
168 | #ifdef PAGING_CONTEXT_LINES |
170 | lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; |
169 | lnsppg = TermWin.nrow - PAGING_CONTEXT_LINES; |
171 | #else |
170 | #else |
172 | lnsppg = TermWin.nrow * 4 / 5; |
171 | lnsppg = TermWin.nrow * 4 / 5; |
… | |
… | |
210 | scr_move_to (1, 0); |
209 | scr_move_to (1, 0); |
211 | return; |
210 | return; |
212 | } |
211 | } |
213 | } |
212 | } |
214 | #endif |
213 | #endif |
215 | |
|
|
216 | } |
214 | } |
217 | |
215 | |
218 | if (shft) |
216 | if (shft) |
219 | { |
217 | { |
220 | /* Shift + F1 - F10 generates F11 - F20 */ |
218 | /* Shift + F1 - F10 generates F11 - F20 */ |
… | |
… | |
246 | { |
244 | { |
247 | scr_printscreen (ctrl | shft); |
245 | scr_printscreen (ctrl | shft); |
248 | return; |
246 | return; |
249 | } |
247 | } |
250 | #endif |
248 | #endif |
251 | #ifdef GREEK_SUPPORT |
|
|
252 | if (keysym == ks_greekmodeswith) |
|
|
253 | { |
|
|
254 | greek_mode = !greek_mode; |
|
|
255 | if (greek_mode) |
|
|
256 | { |
|
|
257 | xterm_seq (XTerm_title, |
|
|
258 | (greek_getmode () == GREEK_ELOT928 |
|
|
259 | ? "[Greek: iso]" : "[Greek: ibm]"), CHAR_ST); |
|
|
260 | greek_reset (); |
|
|
261 | } |
|
|
262 | else |
|
|
263 | xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); |
|
|
264 | return; |
|
|
265 | } |
|
|
266 | #endif |
|
|
267 | |
249 | |
268 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
250 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
269 | { |
251 | { |
270 | #ifdef KEYSYM_RESOURCE |
252 | #ifdef KEYSYM_RESOURCE |
271 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
253 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
… | |
… | |
286 | tt_write (kbuf0, l); |
268 | tt_write (kbuf0, l); |
287 | return; |
269 | return; |
288 | } |
270 | } |
289 | else |
271 | else |
290 | #endif |
272 | #endif |
291 | |
|
|
292 | { |
273 | { |
293 | newlen = 1; |
274 | newlen = 1; |
294 | switch (keysym) |
275 | switch (keysym) |
295 | { |
276 | { |
296 | #ifndef NO_BACKSPACE_KEY |
277 | #ifndef NO_BACKSPACE_KEY |
… | |
… | |
348 | meta = 1; |
329 | meta = 1; |
349 | #endif |
330 | #endif |
350 | newlen = 0; |
331 | newlen = 0; |
351 | } |
332 | } |
352 | break; |
333 | break; |
353 | |
|
|
354 | |
334 | |
355 | #ifdef XK_KP_Left |
335 | #ifdef XK_KP_Left |
356 | case XK_KP_Up: /* \033Ox or standard */ |
336 | case XK_KP_Up: /* \033Ox or standard */ |
357 | case XK_KP_Down: /* \033Or or standard */ |
337 | case XK_KP_Down: /* \033Or or standard */ |
358 | case XK_KP_Right: /* \033Ov or standard */ |
338 | case XK_KP_Right: /* \033Ov or standard */ |
… | |
… | |
482 | STRCPY (kbuf, "\033OP"); |
462 | STRCPY (kbuf, "\033OP"); |
483 | kbuf[2] += (keysym - XK_KP_F1); |
463 | kbuf[2] += (keysym - XK_KP_F1); |
484 | break; |
464 | break; |
485 | |
465 | |
486 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
466 | case XK_KP_Multiply: /* "\033Oj" : "*" */ |
487 | case XK_KP_Add: /* "\033Ok" : "+" */ |
467 | case XK_KP_Add: /* "\033Ok" : "+" */ |
488 | case XK_KP_Separator: /* "\033Ol" : "," */ |
468 | case XK_KP_Separator: /* "\033Ol" : "," */ |
489 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
469 | case XK_KP_Subtract: /* "\033Om" : "-" */ |
490 | case XK_KP_Decimal: /* "\033On" : "." */ |
470 | case XK_KP_Decimal: /* "\033On" : "." */ |
491 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
471 | case XK_KP_Divide: /* "\033Oo" : "/" */ |
492 | case XK_KP_0: /* "\033Op" : "0" */ |
472 | case XK_KP_0: /* "\033Op" : "0" */ |
… | |
… | |
642 | for (ch = kbuf; ch < kbuf + len; ch++) |
622 | for (ch = kbuf; ch < kbuf + len; ch++) |
643 | *ch |= 0x80; |
623 | *ch |= 0x80; |
644 | meta = 0; |
624 | meta = 0; |
645 | } |
625 | } |
646 | #endif |
626 | #endif |
647 | #ifdef GREEK_SUPPORT |
|
|
648 | if (greek_mode) |
|
|
649 | len = greek_xlat (kbuf, len); |
|
|
650 | #endif |
|
|
651 | /* nil */ ; |
627 | /* nil */ ; |
652 | } |
628 | } |
653 | } |
629 | } |
654 | |
630 | |
655 | if (len <= 0) |
631 | if (len <= 0) |
… | |
… | |
1428 | } |
1404 | } |
1429 | #ifdef MENUBAR |
1405 | #ifdef MENUBAR |
1430 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1406 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1431 | menubar_expose (); |
1407 | menubar_expose (); |
1432 | #endif |
1408 | #endif |
1433 | #ifdef RXVT_GRAPHICS |
|
|
1434 | Gr_expose (ev.xany.window); |
|
|
1435 | #endif |
|
|
1436 | |
|
|
1437 | } |
1409 | } |
1438 | break; |
1410 | break; |
1439 | |
1411 | |
1440 | case MotionNotify: |
1412 | case MotionNotify: |
1441 | #ifdef POINTER_BLANK |
1413 | #ifdef POINTER_BLANK |
… | |
… | |
1594 | /* |
1566 | /* |
1595 | * VT window processing of button press |
1567 | * VT window processing of button press |
1596 | */ |
1568 | */ |
1597 | if (ev.window == TermWin.vt) |
1569 | if (ev.window == TermWin.vt) |
1598 | { |
1570 | { |
1599 | #if RXVT_GRAPHICS |
|
|
1600 | if (ev.subwindow != None) |
|
|
1601 | rxvt_Gr_ButtonPress (ev.x, ev.y); |
|
|
1602 | else |
|
|
1603 | #endif |
|
|
1604 | |
|
|
1605 | { |
|
|
1606 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1571 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1607 | if (reportmode) |
1572 | if (reportmode) |
|
|
1573 | { |
|
|
1574 | /* mouse report from vt window */ |
|
|
1575 | /* save the xbutton state (for ButtonRelease) */ |
|
|
1576 | MEvent.state = ev.state; |
|
|
1577 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1578 | if (ev.button == MEvent.button && clickintime) |
1608 | { |
1579 | { |
1609 | /* mouse report from vt window */ |
1580 | /* same button, within alloted time */ |
1610 | /* save the xbutton state (for ButtonRelease) */ |
1581 | MEvent.clicks++; |
1611 | MEvent.state = ev.state; |
1582 | if (MEvent.clicks > 1) |
1612 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1613 | if (ev.button == MEvent.button && clickintime) |
|
|
1614 | { |
1583 | { |
1615 | /* same button, within alloted time */ |
|
|
1616 | MEvent.clicks++; |
|
|
1617 | if (MEvent.clicks > 1) |
|
|
1618 | { |
|
|
1619 | /* only report double clicks */ |
1584 | /* only report double clicks */ |
1620 | MEvent.clicks = 2; |
1585 | MEvent.clicks = 2; |
1621 | mouse_report (ev); |
1586 | mouse_report (ev); |
1622 | |
1587 | |
1623 | /* don't report the release */ |
1588 | /* don't report the release */ |
1624 | MEvent.clicks = 0; |
1589 | MEvent.clicks = 0; |
1625 | MEvent.button = AnyButton; |
1590 | MEvent.button = AnyButton; |
1626 | } |
|
|
1627 | } |
1591 | } |
1628 | else |
|
|
1629 | { |
|
|
1630 | /* different button, or time expired */ |
|
|
1631 | MEvent.clicks = 1; |
|
|
1632 | MEvent.button = ev.button; |
|
|
1633 | mouse_report (ev); |
|
|
1634 | } |
|
|
1635 | #else |
|
|
1636 | MEvent.button = ev.button; |
|
|
1637 | mouse_report (ev); |
|
|
1638 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1639 | |
|
|
1640 | } |
1592 | } |
1641 | else |
1593 | else |
1642 | { |
1594 | { |
|
|
1595 | /* different button, or time expired */ |
|
|
1596 | MEvent.clicks = 1; |
|
|
1597 | MEvent.button = ev.button; |
|
|
1598 | mouse_report (ev); |
|
|
1599 | } |
|
|
1600 | #else |
|
|
1601 | MEvent.button = ev.button; |
|
|
1602 | mouse_report (ev); |
|
|
1603 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1604 | |
|
|
1605 | } |
|
|
1606 | else |
|
|
1607 | { |
1643 | if (ev.button != MEvent.button) |
1608 | if (ev.button != MEvent.button) |
1644 | MEvent.clicks = 0; |
1609 | MEvent.clicks = 0; |
1645 | switch (ev.button) |
1610 | switch (ev.button) |
1646 | { |
1611 | { |
1647 | case Button1: |
1612 | case Button1: |
1648 | /* allow shift+left click to extend selection */ |
1613 | /* allow shift+left click to extend selection */ |
1649 | if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) |
1614 | if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) |
1650 | { |
1615 | { |
1651 | if (MEvent.button == Button1 && clickintime) |
|
|
1652 | selection_rotate (ev.x, ev.y); |
|
|
1653 | else |
|
|
1654 | selection_extend (ev.x, ev.y, 1); |
|
|
1655 | } |
|
|
1656 | else |
|
|
1657 | { |
|
|
1658 | if (MEvent.button == Button1 && clickintime) |
|
|
1659 | MEvent.clicks++; |
|
|
1660 | else |
|
|
1661 | MEvent.clicks = 1; |
|
|
1662 | |
|
|
1663 | selection_click (MEvent.clicks, ev.x, ev.y); |
|
|
1664 | } |
|
|
1665 | |
|
|
1666 | MEvent.button = Button1; |
|
|
1667 | break; |
|
|
1668 | |
|
|
1669 | case Button3: |
|
|
1670 | if (MEvent.button == Button3 && clickintime) |
1616 | if (MEvent.button == Button1 && clickintime) |
1671 | selection_rotate (ev.x, ev.y); |
1617 | selection_rotate (ev.x, ev.y); |
1672 | else |
1618 | else |
1673 | selection_extend (ev.x, ev.y, 1); |
1619 | selection_extend (ev.x, ev.y, 1); |
|
|
1620 | } |
|
|
1621 | else |
|
|
1622 | { |
|
|
1623 | if (MEvent.button == Button1 && clickintime) |
|
|
1624 | MEvent.clicks++; |
|
|
1625 | else |
|
|
1626 | MEvent.clicks = 1; |
|
|
1627 | |
|
|
1628 | selection_click (MEvent.clicks, ev.x, ev.y); |
|
|
1629 | } |
|
|
1630 | |
|
|
1631 | MEvent.button = Button1; |
|
|
1632 | break; |
|
|
1633 | |
|
|
1634 | case Button3: |
|
|
1635 | if (MEvent.button == Button3 && clickintime) |
|
|
1636 | selection_rotate (ev.x, ev.y); |
|
|
1637 | else |
|
|
1638 | selection_extend (ev.x, ev.y, 1); |
1674 | MEvent.button = Button3; |
1639 | MEvent.button = Button3; |
1675 | break; |
1640 | break; |
1676 | } |
|
|
1677 | } |
1641 | } |
|
|
1642 | } |
1678 | MEvent.time = ev.time; |
1643 | MEvent.time = ev.time; |
1679 | return; |
1644 | return; |
1680 | } |
|
|
1681 | } |
1645 | } |
1682 | |
1646 | |
1683 | /* |
1647 | /* |
1684 | * Scrollbar window processing of button press |
1648 | * Scrollbar window processing of button press |
1685 | */ |
1649 | */ |
… | |
… | |
1850 | #ifdef SELECTION_SCROLLING |
1814 | #ifdef SELECTION_SCROLLING |
1851 | pending_scroll_selection=0; |
1815 | pending_scroll_selection=0; |
1852 | #endif |
1816 | #endif |
1853 | if (ev.window == TermWin.vt) |
1817 | if (ev.window == TermWin.vt) |
1854 | { |
1818 | { |
1855 | #ifdef RXVT_GRAPHICS |
|
|
1856 | if (ev.subwindow != None) |
|
|
1857 | rxvt_Gr_ButtonRelease (ev.x, ev.y); |
|
|
1858 | else |
|
|
1859 | #endif |
|
|
1860 | |
|
|
1861 | { |
|
|
1862 | if (reportmode) |
1819 | if (reportmode) |
|
|
1820 | { |
|
|
1821 | /* mouse report from vt window */ |
|
|
1822 | /* don't report release of wheel "buttons" */ |
|
|
1823 | if (ev.button >= 4) |
|
|
1824 | return; |
|
|
1825 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1826 | /* only report the release of 'slow' single clicks */ |
|
|
1827 | if (MEvent.button != AnyButton |
|
|
1828 | && (ev.button != MEvent.button |
|
|
1829 | || (ev.time - MEvent.time |
|
|
1830 | > MULTICLICK_TIME / 2))) |
1863 | { |
1831 | { |
1864 | /* mouse report from vt window */ |
|
|
1865 | /* don't report release of wheel "buttons" */ |
|
|
1866 | if (ev.button >= 4) |
|
|
1867 | return; |
|
|
1868 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1869 | /* only report the release of 'slow' single clicks */ |
|
|
1870 | if (MEvent.button != AnyButton |
|
|
1871 | && (ev.button != MEvent.button |
|
|
1872 | || (ev.time - MEvent.time |
|
|
1873 | > MULTICLICK_TIME / 2))) |
|
|
1874 | { |
|
|
1875 | MEvent.clicks = 0; |
1832 | MEvent.clicks = 0; |
1876 | MEvent.button = AnyButton; |
|
|
1877 | mouse_report (ev); |
|
|
1878 | } |
|
|
1879 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1880 | MEvent.button = AnyButton; |
1833 | MEvent.button = AnyButton; |
1881 | mouse_report (ev); |
1834 | mouse_report (ev); |
|
|
1835 | } |
|
|
1836 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1837 | MEvent.button = AnyButton; |
|
|
1838 | mouse_report (ev); |
1882 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1839 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1883 | return; |
1840 | return; |
1884 | } |
1841 | } |
1885 | /* |
1842 | /* |
1886 | * dumb hack to compensate for the failure of click-and-drag |
1843 | * dumb hack to compensate for the failure of click-and-drag |
1887 | * when overriding mouse reporting |
1844 | * when overriding mouse reporting |
1888 | */ |
1845 | */ |
1889 | if (PrivateModes & PrivMode_mouse_report |
1846 | if (PrivateModes & PrivMode_mouse_report |
1890 | && bypass_keystate |
1847 | && bypass_keystate |
1891 | && ev.button == Button1 && MEvent.clicks <= 1) |
1848 | && ev.button == Button1 && MEvent.clicks <= 1) |
1892 | selection_extend (ev.x, ev.y, 0); |
1849 | selection_extend (ev.x, ev.y, 0); |
1893 | |
1850 | |
1894 | switch (ev.button) |
1851 | switch (ev.button) |
|
|
1852 | { |
|
|
1853 | case Button1: |
|
|
1854 | case Button3: |
|
|
1855 | selection_make (ev.time); |
|
|
1856 | break; |
|
|
1857 | case Button2: |
|
|
1858 | selection_request (ev.time, ev.x, ev.y); |
|
|
1859 | break; |
|
|
1860 | #ifdef MOUSE_WHEEL |
|
|
1861 | case Button4: |
|
|
1862 | case Button5: |
1895 | { |
1863 | { |
1896 | case Button1: |
1864 | int i; |
1897 | case Button3: |
1865 | page_dirn v; |
1898 | selection_make (ev.time); |
1866 | |
|
|
1867 | v = (ev.button == Button4) ? UP : DN; |
|
|
1868 | if (ev.state & ShiftMask) |
1899 | break; |
1869 | i = 1; |
1900 | case Button2: |
1870 | else if ((Options & Opt_mouseWheelScrollPage)) |
1901 | selection_request (ev.time, ev.x, ev.y); |
1871 | i = TermWin.nrow - 1; |
|
|
1872 | else |
1902 | break; |
1873 | i = 5; |
1903 | #ifdef MOUSE_WHEEL |
1874 | # ifdef MOUSE_SLIP_WHEELING |
1904 | case Button4: |
1875 | if (ev.state & ControlMask) |
1905 | case Button5: |
|
|
1906 | { |
1876 | { |
1907 | int i; |
|
|
1908 | page_dirn v; |
|
|
1909 | |
|
|
1910 | v = (ev.button == Button4) ? UP : DN; |
|
|
1911 | if (ev.state & ShiftMask) |
|
|
1912 | i = 1; |
|
|
1913 | else if ((Options & Opt_mouseWheelScrollPage)) |
|
|
1914 | i = TermWin.nrow - 1; |
|
|
1915 | else |
|
|
1916 | i = 5; |
|
|
1917 | # ifdef MOUSE_SLIP_WHEELING |
|
|
1918 | if (ev.state & ControlMask) |
|
|
1919 | { |
|
|
1920 | mouse_slip_wheel_speed += (v ? -1 : 1); |
1877 | mouse_slip_wheel_speed += (v ? -1 : 1); |
1921 | mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; |
1878 | mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; |
1922 | } |
1879 | } |
1923 | # endif |
1880 | # endif |
1924 | # ifdef JUMP_MOUSE_WHEEL |
1881 | # ifdef JUMP_MOUSE_WHEEL |
|
|
1882 | scr_page (v, i); |
|
|
1883 | scr_refresh (SMOOTH_REFRESH); |
|
|
1884 | scrollbar_show (1); |
|
|
1885 | # else |
|
|
1886 | while (i--) |
|
|
1887 | { |
1925 | scr_page (v, i); |
1888 | scr_page (v, 1); |
1926 | scr_refresh (SMOOTH_REFRESH); |
1889 | scr_refresh (SMOOTH_REFRESH); |
1927 | scrollbar_show (1); |
1890 | scrollbar_show (1); |
1928 | # else |
|
|
1929 | while (i--) |
|
|
1930 | { |
|
|
1931 | scr_page (v, 1); |
|
|
1932 | scr_refresh (SMOOTH_REFRESH); |
|
|
1933 | scrollbar_show (1); |
|
|
1934 | } |
1891 | } |
1935 | # endif |
1892 | # endif |
1936 | |
1893 | |
1937 | } |
|
|
1938 | break; |
|
|
1939 | #endif |
|
|
1940 | |
|
|
1941 | } |
1894 | } |
|
|
1895 | break; |
|
|
1896 | #endif |
|
|
1897 | |
1942 | } |
1898 | } |
1943 | } |
1899 | } |
1944 | #ifdef MENUBAR |
1900 | #ifdef MENUBAR |
1945 | else if (isMenuBarWindow (ev.window)) |
1901 | else if (isMenuBarWindow (ev.window)) |
1946 | menubar_control (ev); |
1902 | menubar_control (ev); |
… | |
… | |
3476 | void |
3432 | void |
3477 | rxvt_term::process_graphics () |
3433 | rxvt_term::process_graphics () |
3478 | { |
3434 | { |
3479 | unsigned char ch, cmd = cmd_getc (); |
3435 | unsigned char ch, cmd = cmd_getc (); |
3480 | |
3436 | |
3481 | #ifndef RXVT_GRAPHICS |
|
|
3482 | if (cmd == 'Q') |
3437 | if (cmd == 'Q') |
3483 | { /* query graphics */ |
3438 | { /* query graphics */ |
3484 | tt_printf ("\033G0\n"); /* no graphics */ |
3439 | tt_printf ("\033G0\n"); /* no graphics */ |
3485 | return; |
3440 | return; |
3486 | } |
3441 | } |
3487 | /* swallow other graphics sequences until terminating ':' */ |
3442 | /* swallow other graphics sequences until terminating ':' */ |
3488 | do |
3443 | do |
3489 | ch = cmd_getc (); |
3444 | ch = cmd_getc (); |
3490 | while (ch != ':'); |
3445 | while (ch != ':'); |
3491 | #else |
|
|
3492 | unsigned int nargs; |
|
|
3493 | int args[NGRX_PTS]; |
|
|
3494 | unsigned char *text = NULL; |
|
|
3495 | |
|
|
3496 | if (cmd == 'Q') |
|
|
3497 | { /* query graphics */ |
|
|
3498 | tt_printf ("\033G1\n"); /* yes, graphics (color) */ |
|
|
3499 | return; |
|
|
3500 | } |
|
|
3501 | for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1;) |
|
|
3502 | { |
|
|
3503 | int neg; |
|
|
3504 | |
|
|
3505 | ch = cmd_getc (); |
|
|
3506 | neg = (ch == '-'); |
|
|
3507 | if (neg || ch == '+') |
|
|
3508 | ch = cmd_getc (); |
|
|
3509 | |
|
|
3510 | for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) |
|
|
3511 | args[nargs] = args[nargs] * 10 + (ch - '0'); |
|
|
3512 | if (neg) |
|
|
3513 | args[nargs] = -args[nargs]; |
|
|
3514 | |
|
|
3515 | nargs++; |
|
|
3516 | args[nargs] = 0; |
|
|
3517 | if (ch != ';') |
|
|
3518 | break; |
|
|
3519 | } |
|
|
3520 | |
|
|
3521 | if ((cmd == 'T') && (nargs >= 5)) |
|
|
3522 | { |
|
|
3523 | int i, len = args[4]; |
|
|
3524 | |
|
|
3525 | text = (unsigned char *)rxvt_malloc ((len + 1) * sizeof (char)); |
|
|
3526 | |
|
|
3527 | if (text != NULL) |
|
|
3528 | { |
|
|
3529 | for (i = 0; i < len; i++) |
|
|
3530 | text[i] = cmd_getc (); |
|
|
3531 | text[len] = '\0'; |
|
|
3532 | } |
|
|
3533 | } |
|
|
3534 | Gr_do_graphics (cmd, nargs, args, text); |
|
|
3535 | #endif |
|
|
3536 | } |
3446 | } |
3537 | /*}}} */ |
3447 | /*}}} */ |
3538 | |
3448 | |
3539 | /* ------------------------------------------------------------------------- */ |
3449 | /* ------------------------------------------------------------------------- */ |
3540 | |
3450 | |