… | |
… | |
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 | /* make sure the user can type ctrl-@, i.e. NUL */ |
|
|
116 | if (len == 1 && *wkbuf == 0) |
|
|
117 | { |
|
|
118 | kbuf[0] = 0; |
|
|
119 | len = 1; |
|
|
120 | } |
|
|
121 | else |
|
|
122 | { |
115 | wkbuf[len] = 0; |
123 | wkbuf[len] = 0; |
116 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
124 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
117 | if (len < 0) |
125 | if (len < 0) |
118 | len = 0; |
126 | len = 0; |
|
|
127 | } |
119 | } |
128 | } |
120 | else |
129 | else |
121 | len = 0; |
130 | len = 0; |
122 | } |
131 | } |
123 | |
132 | |
… | |
… | |
141 | if (meta) |
150 | if (meta) |
142 | # endif |
151 | # endif |
143 | { |
152 | { |
144 | if (keysym == ks_bigfont) |
153 | if (keysym == ks_bigfont) |
145 | { |
154 | { |
146 | change_font (0, FONT_UP); |
155 | change_font (FONT_UP); |
147 | return; |
156 | return; |
148 | } |
157 | } |
149 | else if (keysym == ks_smallfont) |
158 | else if (keysym == ks_smallfont) |
150 | { |
159 | { |
151 | change_font (0, FONT_DN); |
160 | change_font (FONT_DN); |
152 | return; |
161 | return; |
153 | } |
162 | } |
154 | } |
163 | } |
155 | #endif |
164 | #endif |
156 | |
165 | |
… | |
… | |
229 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
238 | case XK_Insert: /* Shift+Insert = paste mouse selection */ |
230 | selection_request (ev.time, 0, 0); |
239 | selection_request (ev.time, 0, 0); |
231 | return; |
240 | return; |
232 | /* rxvt extras */ |
241 | /* rxvt extras */ |
233 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
242 | case XK_KP_Add: /* Shift+KP_Add = bigger font */ |
234 | change_font (0, FONT_UP); |
243 | change_font (FONT_UP); |
235 | return; |
244 | return; |
236 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
245 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
237 | change_font (0, FONT_DN); |
246 | change_font (FONT_DN); |
238 | return; |
247 | return; |
239 | } |
248 | } |
240 | } |
249 | } |
241 | } |
250 | } |
242 | #ifdef PRINTPIPE |
251 | #ifdef PRINTPIPE |
243 | if (keysym == XK_Print) |
252 | if (keysym == XK_Print) |
244 | { |
253 | { |
245 | scr_printscreen (ctrl | shft); |
254 | scr_printscreen (ctrl | shft); |
246 | return; |
|
|
247 | } |
|
|
248 | #endif |
|
|
249 | #ifdef GREEK_SUPPORT |
|
|
250 | if (keysym == ks_greekmodeswith) |
|
|
251 | { |
|
|
252 | greek_mode = !greek_mode; |
|
|
253 | if (greek_mode) |
|
|
254 | { |
|
|
255 | xterm_seq (XTerm_title, |
|
|
256 | (greek_getmode () == GREEK_ELOT928 |
|
|
257 | ? "[Greek: iso]" : "[Greek: ibm]"), CHAR_ST); |
|
|
258 | greek_reset (); |
|
|
259 | } |
|
|
260 | else |
|
|
261 | xterm_seq (XTerm_title, APL_NAME "-" VERSION, CHAR_ST); |
|
|
262 | return; |
255 | return; |
263 | } |
256 | } |
264 | #endif |
257 | #endif |
265 | |
258 | |
266 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
259 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
… | |
… | |
638 | for (ch = kbuf; ch < kbuf + len; ch++) |
631 | for (ch = kbuf; ch < kbuf + len; ch++) |
639 | *ch |= 0x80; |
632 | *ch |= 0x80; |
640 | meta = 0; |
633 | meta = 0; |
641 | } |
634 | } |
642 | #endif |
635 | #endif |
643 | #ifdef GREEK_SUPPORT |
|
|
644 | if (greek_mode) |
|
|
645 | len = greek_xlat (kbuf, len); |
|
|
646 | #endif |
|
|
647 | /* nil */ ; |
636 | /* nil */ ; |
648 | } |
637 | } |
649 | } |
638 | } |
650 | |
639 | |
651 | if (len <= 0) |
640 | if (len <= 0) |
… | |
… | |
673 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
662 | kbuf[len - 1] = (shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~')); |
674 | |
663 | |
675 | /* escape prefix */ |
664 | /* escape prefix */ |
676 | if (meta |
665 | if (meta |
677 | #ifdef META8_OPTION |
666 | #ifdef META8_OPTION |
678 | && (meta_char == C0_ESC) |
667 | && meta_char == C0_ESC |
679 | #endif |
668 | #endif |
680 | ) |
669 | ) |
681 | { |
670 | { |
682 | const unsigned char ch = C0_ESC; |
671 | const unsigned char ch = C0_ESC; |
683 | |
|
|
684 | tt_write (&ch, 1); |
672 | tt_write (&ch, 1); |
685 | } |
673 | } |
|
|
674 | |
686 | #ifdef DEBUG_CMD |
675 | #if defined(DEBUG_CMD) |
687 | if (debug_key) |
|
|
688 | { /* Display keyboard buffer contents */ |
676 | /* Display keyboard buffer contents */ |
689 | char *p; |
677 | unsigned char *p; |
690 | int i; |
678 | int i; |
691 | |
679 | |
692 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
680 | fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len); |
693 | for (i = 0, p = kbuf; i < len; i++, p++) |
681 | for (i = 0, p = kbuf; i < len; i++, p++) |
694 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
682 | fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); |
695 | fprintf (stderr, "'\n"); |
683 | fprintf (stderr, "'\n"); |
696 | } |
|
|
697 | #endif /* DEBUG_CMD */ |
684 | #endif /* DEBUG_CMD */ |
698 | tt_write (kbuf, (unsigned int)len); |
685 | tt_write (kbuf, (unsigned int)len); |
699 | } |
686 | } |
700 | /*}}} */ |
687 | /*}}} */ |
701 | |
688 | |
… | |
… | |
1424 | } |
1411 | } |
1425 | #ifdef MENUBAR |
1412 | #ifdef MENUBAR |
1426 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1413 | if (menubar_visible () && isMenuBarWindow (ev.xany.window)) |
1427 | menubar_expose (); |
1414 | menubar_expose (); |
1428 | #endif |
1415 | #endif |
1429 | #ifdef RXVT_GRAPHICS |
|
|
1430 | Gr_expose (ev.xany.window); |
|
|
1431 | #endif |
|
|
1432 | |
|
|
1433 | } |
1416 | } |
1434 | break; |
1417 | break; |
1435 | |
1418 | |
1436 | case MotionNotify: |
1419 | case MotionNotify: |
1437 | #ifdef POINTER_BLANK |
1420 | #ifdef POINTER_BLANK |
… | |
… | |
1590 | /* |
1573 | /* |
1591 | * VT window processing of button press |
1574 | * VT window processing of button press |
1592 | */ |
1575 | */ |
1593 | if (ev.window == TermWin.vt) |
1576 | if (ev.window == TermWin.vt) |
1594 | { |
1577 | { |
1595 | #if RXVT_GRAPHICS |
|
|
1596 | if (ev.subwindow != None) |
|
|
1597 | rxvt_Gr_ButtonPress (ev.x, ev.y); |
|
|
1598 | else |
|
|
1599 | #endif |
|
|
1600 | |
|
|
1601 | { |
|
|
1602 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1578 | clickintime = ev.time - MEvent.time < MULTICLICK_TIME; |
1603 | if (reportmode) |
1579 | if (reportmode) |
|
|
1580 | { |
|
|
1581 | /* mouse report from vt window */ |
|
|
1582 | /* save the xbutton state (for ButtonRelease) */ |
|
|
1583 | MEvent.state = ev.state; |
|
|
1584 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1585 | if (ev.button == MEvent.button && clickintime) |
1604 | { |
1586 | { |
1605 | /* mouse report from vt window */ |
1587 | /* same button, within alloted time */ |
1606 | /* save the xbutton state (for ButtonRelease) */ |
1588 | MEvent.clicks++; |
1607 | MEvent.state = ev.state; |
1589 | if (MEvent.clicks > 1) |
1608 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1609 | if (ev.button == MEvent.button && clickintime) |
|
|
1610 | { |
1590 | { |
1611 | /* same button, within alloted time */ |
|
|
1612 | MEvent.clicks++; |
|
|
1613 | if (MEvent.clicks > 1) |
|
|
1614 | { |
|
|
1615 | /* only report double clicks */ |
1591 | /* only report double clicks */ |
1616 | MEvent.clicks = 2; |
1592 | MEvent.clicks = 2; |
1617 | mouse_report (ev); |
1593 | mouse_report (ev); |
1618 | |
1594 | |
1619 | /* don't report the release */ |
1595 | /* don't report the release */ |
1620 | MEvent.clicks = 0; |
1596 | MEvent.clicks = 0; |
1621 | MEvent.button = AnyButton; |
1597 | MEvent.button = AnyButton; |
1622 | } |
|
|
1623 | } |
1598 | } |
1624 | else |
|
|
1625 | { |
|
|
1626 | /* different button, or time expired */ |
|
|
1627 | MEvent.clicks = 1; |
|
|
1628 | MEvent.button = ev.button; |
|
|
1629 | mouse_report (ev); |
|
|
1630 | } |
|
|
1631 | #else |
|
|
1632 | MEvent.button = ev.button; |
|
|
1633 | mouse_report (ev); |
|
|
1634 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1635 | |
|
|
1636 | } |
1599 | } |
1637 | else |
1600 | else |
1638 | { |
1601 | { |
|
|
1602 | /* different button, or time expired */ |
|
|
1603 | MEvent.clicks = 1; |
|
|
1604 | MEvent.button = ev.button; |
|
|
1605 | mouse_report (ev); |
|
|
1606 | } |
|
|
1607 | #else |
|
|
1608 | MEvent.button = ev.button; |
|
|
1609 | mouse_report (ev); |
|
|
1610 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1611 | |
|
|
1612 | } |
|
|
1613 | else |
|
|
1614 | { |
1639 | if (ev.button != MEvent.button) |
1615 | if (ev.button != MEvent.button) |
1640 | MEvent.clicks = 0; |
1616 | MEvent.clicks = 0; |
1641 | switch (ev.button) |
1617 | switch (ev.button) |
1642 | { |
1618 | { |
1643 | case Button1: |
1619 | case Button1: |
1644 | /* allow shift+left click to extend selection */ |
1620 | /* allow shift+left click to extend selection */ |
1645 | if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) |
1621 | if (ev.state & ShiftMask && ! (PrivateModes & PrivMode_mouse_report)) |
1646 | { |
1622 | { |
1647 | if (MEvent.button == Button1 && clickintime) |
|
|
1648 | selection_rotate (ev.x, ev.y); |
|
|
1649 | else |
|
|
1650 | selection_extend (ev.x, ev.y, 1); |
|
|
1651 | } |
|
|
1652 | else |
|
|
1653 | { |
|
|
1654 | if (MEvent.button == Button1 && clickintime) |
|
|
1655 | MEvent.clicks++; |
|
|
1656 | else |
|
|
1657 | MEvent.clicks = 1; |
|
|
1658 | |
|
|
1659 | selection_click (MEvent.clicks, ev.x, ev.y); |
|
|
1660 | } |
|
|
1661 | |
|
|
1662 | MEvent.button = Button1; |
|
|
1663 | break; |
|
|
1664 | |
|
|
1665 | case Button3: |
|
|
1666 | if (MEvent.button == Button3 && clickintime) |
1623 | if (MEvent.button == Button1 && clickintime) |
1667 | selection_rotate (ev.x, ev.y); |
1624 | selection_rotate (ev.x, ev.y); |
1668 | else |
1625 | else |
1669 | selection_extend (ev.x, ev.y, 1); |
1626 | selection_extend (ev.x, ev.y, 1); |
|
|
1627 | } |
|
|
1628 | else |
|
|
1629 | { |
|
|
1630 | if (MEvent.button == Button1 && clickintime) |
|
|
1631 | MEvent.clicks++; |
|
|
1632 | else |
|
|
1633 | MEvent.clicks = 1; |
|
|
1634 | |
|
|
1635 | selection_click (MEvent.clicks, ev.x, ev.y); |
|
|
1636 | } |
|
|
1637 | |
|
|
1638 | MEvent.button = Button1; |
|
|
1639 | break; |
|
|
1640 | |
|
|
1641 | case Button3: |
|
|
1642 | if (MEvent.button == Button3 && clickintime) |
|
|
1643 | selection_rotate (ev.x, ev.y); |
|
|
1644 | else |
|
|
1645 | selection_extend (ev.x, ev.y, 1); |
1670 | MEvent.button = Button3; |
1646 | MEvent.button = Button3; |
1671 | break; |
1647 | break; |
1672 | } |
|
|
1673 | } |
1648 | } |
|
|
1649 | } |
1674 | MEvent.time = ev.time; |
1650 | MEvent.time = ev.time; |
1675 | return; |
1651 | return; |
1676 | } |
|
|
1677 | } |
1652 | } |
1678 | |
1653 | |
1679 | /* |
1654 | /* |
1680 | * Scrollbar window processing of button press |
1655 | * Scrollbar window processing of button press |
1681 | */ |
1656 | */ |
… | |
… | |
1846 | #ifdef SELECTION_SCROLLING |
1821 | #ifdef SELECTION_SCROLLING |
1847 | pending_scroll_selection=0; |
1822 | pending_scroll_selection=0; |
1848 | #endif |
1823 | #endif |
1849 | if (ev.window == TermWin.vt) |
1824 | if (ev.window == TermWin.vt) |
1850 | { |
1825 | { |
1851 | #ifdef RXVT_GRAPHICS |
|
|
1852 | if (ev.subwindow != None) |
|
|
1853 | rxvt_Gr_ButtonRelease (ev.x, ev.y); |
|
|
1854 | else |
|
|
1855 | #endif |
|
|
1856 | |
|
|
1857 | { |
|
|
1858 | if (reportmode) |
1826 | if (reportmode) |
|
|
1827 | { |
|
|
1828 | /* mouse report from vt window */ |
|
|
1829 | /* don't report release of wheel "buttons" */ |
|
|
1830 | if (ev.button >= 4) |
|
|
1831 | return; |
|
|
1832 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1833 | /* only report the release of 'slow' single clicks */ |
|
|
1834 | if (MEvent.button != AnyButton |
|
|
1835 | && (ev.button != MEvent.button |
|
|
1836 | || (ev.time - MEvent.time |
|
|
1837 | > MULTICLICK_TIME / 2))) |
1859 | { |
1838 | { |
1860 | /* mouse report from vt window */ |
|
|
1861 | /* don't report release of wheel "buttons" */ |
|
|
1862 | if (ev.button >= 4) |
|
|
1863 | return; |
|
|
1864 | #ifdef MOUSE_REPORT_DOUBLECLICK |
|
|
1865 | /* only report the release of 'slow' single clicks */ |
|
|
1866 | if (MEvent.button != AnyButton |
|
|
1867 | && (ev.button != MEvent.button |
|
|
1868 | || (ev.time - MEvent.time |
|
|
1869 | > MULTICLICK_TIME / 2))) |
|
|
1870 | { |
|
|
1871 | MEvent.clicks = 0; |
1839 | MEvent.clicks = 0; |
1872 | MEvent.button = AnyButton; |
|
|
1873 | mouse_report (ev); |
|
|
1874 | } |
|
|
1875 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1876 | MEvent.button = AnyButton; |
1840 | MEvent.button = AnyButton; |
1877 | mouse_report (ev); |
1841 | mouse_report (ev); |
|
|
1842 | } |
|
|
1843 | #else /* MOUSE_REPORT_DOUBLECLICK */ |
|
|
1844 | MEvent.button = AnyButton; |
|
|
1845 | mouse_report (ev); |
1878 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1846 | #endif /* MOUSE_REPORT_DOUBLECLICK */ |
1879 | return; |
1847 | return; |
1880 | } |
1848 | } |
1881 | /* |
1849 | /* |
1882 | * dumb hack to compensate for the failure of click-and-drag |
1850 | * dumb hack to compensate for the failure of click-and-drag |
1883 | * when overriding mouse reporting |
1851 | * when overriding mouse reporting |
1884 | */ |
1852 | */ |
1885 | if (PrivateModes & PrivMode_mouse_report |
1853 | if (PrivateModes & PrivMode_mouse_report |
1886 | && bypass_keystate |
1854 | && bypass_keystate |
1887 | && ev.button == Button1 && MEvent.clicks <= 1) |
1855 | && ev.button == Button1 && MEvent.clicks <= 1) |
1888 | selection_extend (ev.x, ev.y, 0); |
1856 | selection_extend (ev.x, ev.y, 0); |
1889 | |
1857 | |
1890 | switch (ev.button) |
1858 | switch (ev.button) |
|
|
1859 | { |
|
|
1860 | case Button1: |
|
|
1861 | case Button3: |
|
|
1862 | selection_make (ev.time); |
|
|
1863 | break; |
|
|
1864 | case Button2: |
|
|
1865 | selection_request (ev.time, ev.x, ev.y); |
|
|
1866 | break; |
|
|
1867 | #ifdef MOUSE_WHEEL |
|
|
1868 | case Button4: |
|
|
1869 | case Button5: |
1891 | { |
1870 | { |
1892 | case Button1: |
1871 | int i; |
1893 | case Button3: |
1872 | page_dirn v; |
1894 | selection_make (ev.time); |
1873 | |
|
|
1874 | v = (ev.button == Button4) ? UP : DN; |
|
|
1875 | if (ev.state & ShiftMask) |
1895 | break; |
1876 | i = 1; |
1896 | case Button2: |
1877 | else if ((Options & Opt_mouseWheelScrollPage)) |
1897 | selection_request (ev.time, ev.x, ev.y); |
1878 | i = TermWin.nrow - 1; |
|
|
1879 | else |
1898 | break; |
1880 | i = 5; |
1899 | #ifdef MOUSE_WHEEL |
1881 | # ifdef MOUSE_SLIP_WHEELING |
1900 | case Button4: |
1882 | if (ev.state & ControlMask) |
1901 | case Button5: |
|
|
1902 | { |
1883 | { |
1903 | int i; |
|
|
1904 | page_dirn v; |
|
|
1905 | |
|
|
1906 | v = (ev.button == Button4) ? UP : DN; |
|
|
1907 | if (ev.state & ShiftMask) |
|
|
1908 | i = 1; |
|
|
1909 | else if ((Options & Opt_mouseWheelScrollPage)) |
|
|
1910 | i = TermWin.nrow - 1; |
|
|
1911 | else |
|
|
1912 | i = 5; |
|
|
1913 | # ifdef MOUSE_SLIP_WHEELING |
|
|
1914 | if (ev.state & ControlMask) |
|
|
1915 | { |
|
|
1916 | mouse_slip_wheel_speed += (v ? -1 : 1); |
1884 | mouse_slip_wheel_speed += (v ? -1 : 1); |
1917 | mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; |
1885 | mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; |
1918 | } |
1886 | } |
1919 | # endif |
1887 | # endif |
1920 | # ifdef JUMP_MOUSE_WHEEL |
1888 | # ifdef JUMP_MOUSE_WHEEL |
|
|
1889 | scr_page (v, i); |
|
|
1890 | scr_refresh (SMOOTH_REFRESH); |
|
|
1891 | scrollbar_show (1); |
|
|
1892 | # else |
|
|
1893 | while (i--) |
|
|
1894 | { |
1921 | scr_page (v, i); |
1895 | scr_page (v, 1); |
1922 | scr_refresh (SMOOTH_REFRESH); |
1896 | scr_refresh (SMOOTH_REFRESH); |
1923 | scrollbar_show (1); |
1897 | scrollbar_show (1); |
1924 | # else |
|
|
1925 | while (i--) |
|
|
1926 | { |
|
|
1927 | scr_page (v, 1); |
|
|
1928 | scr_refresh (SMOOTH_REFRESH); |
|
|
1929 | scrollbar_show (1); |
|
|
1930 | } |
1898 | } |
1931 | # endif |
1899 | # endif |
1932 | |
1900 | |
1933 | } |
|
|
1934 | break; |
|
|
1935 | #endif |
|
|
1936 | |
|
|
1937 | } |
1901 | } |
|
|
1902 | break; |
|
|
1903 | #endif |
|
|
1904 | |
1938 | } |
1905 | } |
1939 | } |
1906 | } |
1940 | #ifdef MENUBAR |
1907 | #ifdef MENUBAR |
1941 | else if (isMenuBarWindow (ev.window)) |
1908 | else if (isMenuBarWindow (ev.window)) |
1942 | menubar_control (ev); |
1909 | menubar_control (ev); |
… | |
… | |
3011 | * 19 = change underlined character color |
2978 | * 19 = change underlined character color |
3012 | * 46 = change logfile (not implemented) |
2979 | * 46 = change logfile (not implemented) |
3013 | * 50 = change font |
2980 | * 50 = change font |
3014 | * |
2981 | * |
3015 | * rxvt extensions: |
2982 | * rxvt extensions: |
|
|
2983 | * 9 = change locale (NYI) |
3016 | * 10 = menu (may change in future) |
2984 | * 10 = menu (may change in future) |
3017 | * 20 = bg pixmap |
2985 | * 20 = bg pixmap |
3018 | * 39 = change default fg color |
2986 | * 39 = change default fg color |
3019 | * 49 = change default bg color |
2987 | * 49 = change default bg color |
3020 | * 55 = dump scrollback buffer and all of screen |
2988 | * 55 = dump scrollback buffer and all of screen |
… | |
… | |
3111 | set_window_color (Color_bg, str); |
3079 | set_window_color (Color_bg, str); |
3112 | break; |
3080 | break; |
3113 | case XTerm_logfile: |
3081 | case XTerm_logfile: |
3114 | break; |
3082 | break; |
3115 | case XTerm_font: |
3083 | case XTerm_font: |
3116 | change_font (0, str); |
3084 | change_font (str); |
|
|
3085 | break; |
|
|
3086 | case XTerm_locale: |
|
|
3087 | if (str[0] == '?' && !str[1]) |
|
|
3088 | tt_printf ("%-.250s\n", locale); |
|
|
3089 | else |
|
|
3090 | { |
|
|
3091 | set_locale (str); |
|
|
3092 | im_cb (); |
|
|
3093 | } |
3117 | break; |
3094 | break; |
3118 | #if 0 |
3095 | #if 0 |
3119 | case XTerm_dumpscreen: /* no error notices */ |
3096 | case XTerm_dumpscreen: /* no error notices */ |
3120 | { |
3097 | { |
3121 | int fd; |
3098 | int fd; |
… | |
… | |
3472 | void |
3449 | void |
3473 | rxvt_term::process_graphics () |
3450 | rxvt_term::process_graphics () |
3474 | { |
3451 | { |
3475 | unsigned char ch, cmd = cmd_getc (); |
3452 | unsigned char ch, cmd = cmd_getc (); |
3476 | |
3453 | |
3477 | #ifndef RXVT_GRAPHICS |
|
|
3478 | if (cmd == 'Q') |
3454 | if (cmd == 'Q') |
3479 | { /* query graphics */ |
3455 | { /* query graphics */ |
3480 | tt_printf ("\033G0\n"); /* no graphics */ |
3456 | tt_printf ("\033G0\n"); /* no graphics */ |
3481 | return; |
3457 | return; |
3482 | } |
3458 | } |
3483 | /* swallow other graphics sequences until terminating ':' */ |
3459 | /* swallow other graphics sequences until terminating ':' */ |
3484 | do |
3460 | do |
3485 | ch = cmd_getc (); |
3461 | ch = cmd_getc (); |
3486 | while (ch != ':'); |
3462 | while (ch != ':'); |
3487 | #else |
|
|
3488 | unsigned int nargs; |
|
|
3489 | int args[NGRX_PTS]; |
|
|
3490 | unsigned char *text = NULL; |
|
|
3491 | |
|
|
3492 | if (cmd == 'Q') |
|
|
3493 | { /* query graphics */ |
|
|
3494 | tt_printf ("\033G1\n"); /* yes, graphics (color) */ |
|
|
3495 | return; |
|
|
3496 | } |
|
|
3497 | for (nargs = 0; nargs < (sizeof (args) / sizeof (args[0])) - 1;) |
|
|
3498 | { |
|
|
3499 | int neg; |
|
|
3500 | |
|
|
3501 | ch = cmd_getc (); |
|
|
3502 | neg = (ch == '-'); |
|
|
3503 | if (neg || ch == '+') |
|
|
3504 | ch = cmd_getc (); |
|
|
3505 | |
|
|
3506 | for (args[nargs] = 0; isdigit (ch); ch = cmd_getc ()) |
|
|
3507 | args[nargs] = args[nargs] * 10 + (ch - '0'); |
|
|
3508 | if (neg) |
|
|
3509 | args[nargs] = -args[nargs]; |
|
|
3510 | |
|
|
3511 | nargs++; |
|
|
3512 | args[nargs] = 0; |
|
|
3513 | if (ch != ';') |
|
|
3514 | break; |
|
|
3515 | } |
|
|
3516 | |
|
|
3517 | if ((cmd == 'T') && (nargs >= 5)) |
|
|
3518 | { |
|
|
3519 | int i, len = args[4]; |
|
|
3520 | |
|
|
3521 | text = (unsigned char *)rxvt_malloc ((len + 1) * sizeof (char)); |
|
|
3522 | |
|
|
3523 | if (text != NULL) |
|
|
3524 | { |
|
|
3525 | for (i = 0; i < len; i++) |
|
|
3526 | text[i] = cmd_getc (); |
|
|
3527 | text[len] = '\0'; |
|
|
3528 | } |
|
|
3529 | } |
|
|
3530 | Gr_do_graphics (cmd, nargs, args, text); |
|
|
3531 | #endif |
|
|
3532 | } |
3463 | } |
3533 | /*}}} */ |
3464 | /*}}} */ |
3534 | |
3465 | |
3535 | /* ------------------------------------------------------------------------- */ |
3466 | /* ------------------------------------------------------------------------- */ |
3536 | |
3467 | |