… | |
… | |
500 | # if ISO_14755 |
500 | # if ISO_14755 |
501 | iso14755_51 (0); |
501 | iso14755_51 (0); |
502 | # endif |
502 | # endif |
503 | return; |
503 | return; |
504 | } |
504 | } |
|
|
505 | else if (keysym == XK_BackSpace) |
|
|
506 | { |
|
|
507 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
508 | # if ISO_14755 |
|
|
509 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
510 | # endif |
|
|
511 | return; |
|
|
512 | } |
505 | else if ((hv = hex_keyval (ev)) >= 0) |
513 | else if ((hv = hex_keyval (ev)) >= 0) |
506 | { |
514 | { |
507 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
515 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
508 | | hv | ISO_14755_51; |
516 | | hv | ISO_14755_51; |
509 | # if ISO_14755 |
517 | # if ISO_14755 |
… | |
… | |
528 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
536 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
529 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
537 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
530 | # endif |
538 | # endif |
531 | } |
539 | } |
532 | #endif |
540 | #endif |
533 | |
541 | |
534 | #ifdef PRINTPIPE |
542 | #ifdef PRINTPIPE |
535 | if (keysym == XK_Print) |
543 | if (keysym == XK_Print) |
536 | { |
544 | { |
537 | scr_printscreen (ctrl | shft); |
545 | scr_printscreen (ctrl | shft); |
538 | return; |
546 | return; |
… | |
… | |
877 | return; |
885 | return; |
878 | |
886 | |
879 | if (len <= 0) |
887 | if (len <= 0) |
880 | return; /* not mapped */ |
888 | return; /* not mapped */ |
881 | |
889 | |
882 | if (OPTION (Opt_scrollTtyKeypress)) |
890 | if (option (Opt_scrollTtyKeypress)) |
883 | if (view_start) |
891 | if (view_start) |
884 | { |
892 | { |
885 | view_start = 0; |
893 | view_start = 0; |
886 | want_refresh = 1; |
894 | want_refresh = 1; |
887 | } |
895 | } |
… | |
… | |
965 | scr_overlay_off (); |
973 | scr_overlay_off (); |
966 | # endif |
974 | # endif |
967 | if (iso14755buf & ISO_14755_51) |
975 | if (iso14755buf & ISO_14755_51) |
968 | commit_iso14755 (); |
976 | commit_iso14755 (); |
969 | #if ISO_14755 |
977 | #if ISO_14755 |
970 | else if (iso14755buf & ISO_14755_STARTED) |
978 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
971 | { |
979 | { |
972 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
980 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
973 | |
981 | |
974 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
982 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
975 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
983 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
… | |
… | |
1027 | void |
1035 | void |
1028 | rxvt_term::flush () |
1036 | rxvt_term::flush () |
1029 | { |
1037 | { |
1030 | flush_ev.stop (); |
1038 | flush_ev.stop (); |
1031 | |
1039 | |
1032 | #ifdef TRANSPARENT |
1040 | #ifdef ENABLE_TRANSPARENCY |
1033 | if (want_full_refresh) |
1041 | if (want_full_refresh) |
1034 | { |
1042 | { |
1035 | want_full_refresh = 0; |
1043 | want_full_refresh = 0; |
1036 | scr_clear (); |
1044 | scr_clear (); |
1037 | scr_touch (false); |
1045 | scr_touch (false); |
… | |
… | |
1102 | void |
1110 | void |
1103 | rxvt_term::flush_cb (time_watcher &w) |
1111 | rxvt_term::flush_cb (time_watcher &w) |
1104 | { |
1112 | { |
1105 | make_current (); |
1113 | make_current (); |
1106 | |
1114 | |
1107 | refresh_limit = 1; |
|
|
1108 | refresh_count = 0; |
1115 | refresh_count = 0; |
1109 | flush (); |
1116 | flush (); |
1110 | } |
1117 | } |
1111 | |
1118 | |
1112 | #ifdef CURSOR_BLINK |
1119 | #ifdef CURSOR_BLINK |
… | |
… | |
1178 | |
1185 | |
1179 | #if LINUX_YIELD_HACK |
1186 | #if LINUX_YIELD_HACK |
1180 | static struct event_handler |
1187 | static struct event_handler |
1181 | { |
1188 | { |
1182 | check_watcher yield_ev; |
1189 | check_watcher yield_ev; |
1183 | |
1190 | |
1184 | void yield_cb (check_watcher &w) |
1191 | void yield_cb (check_watcher &w) |
1185 | { |
1192 | { |
1186 | // this should really be sched_yield(), but the linux guys thought |
1193 | // this should really be sched_yield(), but the linux guys thought |
1187 | // that giving a process calling sched_yield () less cpu time than |
1194 | // that giving a process calling sched_yield () less cpu time than |
1188 | // ones with high nice levels is a useful thing to do. It surely is is |
1195 | // ones with high nice levels is a useful thing to do. It surely is is |
… | |
… | |
1232 | } |
1239 | } |
1233 | else |
1240 | else |
1234 | { |
1241 | { |
1235 | pty_ev.stop (); |
1242 | pty_ev.stop (); |
1236 | |
1243 | |
1237 | if (!OPTION (Opt_hold)) |
1244 | if (!option (Opt_hold)) |
1238 | destroy (); |
1245 | destroy (); |
1239 | } |
1246 | } |
1240 | |
1247 | |
1241 | return false; |
1248 | return false; |
1242 | } |
1249 | } |
1243 | |
1250 | |
1244 | void |
1251 | void |
1245 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1252 | rxvt_term::pty_cb (io_watcher &w, short revents) |
… | |
… | |
1263 | recolour_cursor (); |
1270 | recolour_cursor (); |
1264 | |
1271 | |
1265 | #ifdef POINTER_BLANK |
1272 | #ifdef POINTER_BLANK |
1266 | hidden_pointer = 0; |
1273 | hidden_pointer = 0; |
1267 | |
1274 | |
1268 | if (OPTION (Opt_pointerBlank)) |
1275 | if (option (Opt_pointerBlank)) |
1269 | pointer_ev.start (NOW + pointerBlankDelay); |
1276 | pointer_ev.start (NOW + pointerBlankDelay); |
1270 | #endif |
1277 | #endif |
1271 | } |
1278 | } |
1272 | |
1279 | |
1273 | #ifdef POINTER_BLANK |
1280 | #ifdef POINTER_BLANK |
1274 | void |
1281 | void |
1275 | rxvt_term::pointer_blank () |
1282 | rxvt_term::pointer_blank () |
1276 | { |
1283 | { |
1277 | if (!OPTION (Opt_pointerBlank)) |
1284 | if (!option (Opt_pointerBlank)) |
1278 | return; |
1285 | return; |
1279 | |
1286 | |
1280 | XDefineCursor (dpy, vt, display->blank_cursor); |
1287 | XDefineCursor (dpy, vt, display->blank_cursor); |
1281 | XFlush (dpy); |
1288 | XFlush (dpy); |
1282 | |
1289 | |
… | |
… | |
1458 | break; |
1465 | break; |
1459 | } |
1466 | } |
1460 | break; |
1467 | break; |
1461 | |
1468 | |
1462 | case FocusIn: |
1469 | case FocusIn: |
|
|
1470 | if (ev.xfocus.detail != NotifyInferior |
|
|
1471 | && ev.xfocus.detail != NotifyPointer |
|
|
1472 | && ev.xfocus.mode != NotifyGrab) |
1463 | focus_in (); |
1473 | focus_in (); |
1464 | break; |
1474 | break; |
1465 | |
1475 | |
1466 | case FocusOut: |
1476 | case FocusOut: |
|
|
1477 | if (ev.xfocus.detail != NotifyInferior |
|
|
1478 | && ev.xfocus.detail != NotifyPointer |
|
|
1479 | && ev.xfocus.mode != NotifyGrab) |
1467 | focus_out (); |
1480 | focus_out (); |
1468 | break; |
1481 | break; |
1469 | |
1482 | |
1470 | case ConfigureNotify: |
1483 | case ConfigureNotify: |
1471 | if (ev.xconfigure.window == parent[0]) |
1484 | if (ev.xconfigure.window == parent[0]) |
1472 | { |
1485 | { |
… | |
… | |
1475 | |
1488 | |
1476 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1489 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1477 | { |
1490 | { |
1478 | seen_resize = 1; |
1491 | seen_resize = 1; |
1479 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1492 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
|
|
1493 | #ifdef XPM_BACKGROUND |
|
|
1494 | if (!option (Opt_transparent) && bgPixmap.auto_resize) |
|
|
1495 | { |
|
|
1496 | resize_pixmap (); |
|
|
1497 | scr_touch (true); |
|
|
1498 | } |
|
|
1499 | #endif |
1480 | } |
1500 | } |
1481 | |
1501 | |
1482 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1502 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | |
1503 | |
1484 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
1504 | #ifdef ENABLE_TRANSPARENCY |
1485 | if (OPTION (Opt_transparent)) |
1505 | if (option (Opt_transparent)) |
1486 | check_our_parents (); |
1506 | check_our_parents (); |
1487 | #endif |
1507 | #endif |
1488 | } |
1508 | } |
1489 | break; |
1509 | break; |
1490 | |
1510 | |
… | |
… | |
1523 | text_blink_ev.stop (); |
1543 | text_blink_ev.stop (); |
1524 | #endif |
1544 | #endif |
1525 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1545 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1526 | break; |
1546 | break; |
1527 | |
1547 | |
1528 | #ifdef TRANSPARENT |
1548 | #ifdef ENABLE_TRANSPARENCY |
1529 | case ReparentNotify: |
1549 | case ReparentNotify: |
1530 | rootwin_cb (ev); |
1550 | rootwin_cb (ev); |
1531 | break; |
1551 | break; |
1532 | #endif /* TRANSPARENT */ |
1552 | #endif /* ENABLE_TRANSPARENCY */ |
1533 | |
1553 | |
1534 | case GraphicsExpose: |
1554 | case GraphicsExpose: |
1535 | case Expose: |
1555 | case Expose: |
1536 | if (ev.xany.window == vt) |
1556 | if (ev.xany.window == vt) |
1537 | { |
1557 | { |
… | |
… | |
1561 | { |
1581 | { |
1562 | scrollBar.setIdle (); |
1582 | scrollBar.setIdle (); |
1563 | scrollbar_show (0); |
1583 | scrollbar_show (0); |
1564 | } |
1584 | } |
1565 | |
1585 | |
1566 | #ifdef TRANSPARENT |
1586 | #ifdef ENABLE_TRANSPARENCY |
1567 | if (am_transparent && ev.xany.window == parent[0]) |
1587 | if (am_transparent && ev.xany.window == parent[0]) |
1568 | XClearWindow (dpy, ev.xany.window); |
1588 | XClearWindow (dpy, ev.xany.window); |
1569 | #endif |
1589 | #endif |
1570 | } |
1590 | } |
1571 | break; |
1591 | break; |
… | |
… | |
1672 | &ev.xbutton.x, &ev.xbutton.y, |
1692 | &ev.xbutton.x, &ev.xbutton.y, |
1673 | &unused_mask); |
1693 | &unused_mask); |
1674 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1694 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1675 | scrollbar_size ()); |
1695 | scrollbar_size ()); |
1676 | want_refresh = 1; |
1696 | want_refresh = 1; |
1677 | refresh_limit = 0; |
|
|
1678 | scrollbar_show (1); |
1697 | scrollbar_show (1); |
1679 | } |
1698 | } |
1680 | break; |
1699 | break; |
1681 | } |
1700 | } |
1682 | |
1701 | |
1683 | #if defined(CURSOR_BLINK) |
1702 | #if defined(CURSOR_BLINK) |
1684 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1703 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1685 | { |
1704 | { |
1686 | if (hidden_cursor) |
1705 | if (hidden_cursor) |
1687 | { |
1706 | { |
1688 | hidden_cursor = 0; |
1707 | hidden_cursor = 0; |
1689 | want_refresh = 1; |
1708 | want_refresh = 1; |
… | |
… | |
1692 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1711 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1693 | } |
1712 | } |
1694 | #endif |
1713 | #endif |
1695 | |
1714 | |
1696 | #if defined(POINTER_BLANK) |
1715 | #if defined(POINTER_BLANK) |
1697 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1716 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1698 | { |
1717 | { |
1699 | if (ev.type == MotionNotify |
1718 | if (ev.type == MotionNotify |
1700 | || ev.type == ButtonPress |
1719 | || ev.type == ButtonPress |
1701 | || ev.type == ButtonRelease) |
1720 | || ev.type == ButtonRelease) |
1702 | if (hidden_pointer) |
1721 | if (hidden_pointer) |
… | |
… | |
1724 | IMSetPosition (); |
1743 | IMSetPosition (); |
1725 | XSetICFocus (Input_Context); |
1744 | XSetICFocus (Input_Context); |
1726 | } |
1745 | } |
1727 | #endif |
1746 | #endif |
1728 | #if CURSOR_BLINK |
1747 | #if CURSOR_BLINK |
1729 | if (OPTION (Opt_cursorBlink)) |
1748 | if (option (Opt_cursorBlink)) |
1730 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1749 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1731 | #endif |
1750 | #endif |
1732 | #if OFF_FOCUS_FADING |
1751 | #if OFF_FOCUS_FADING |
1733 | if (rs[Rs_fade]) |
1752 | if (rs[Rs_fade]) |
1734 | { |
1753 | { |
1735 | pix_colors = pix_colors_focused; |
1754 | pix_colors = pix_colors_focused; |
1736 | scr_recolour (); |
1755 | scr_recolour (); |
|
|
1756 | } |
|
|
1757 | #endif |
|
|
1758 | #if ENABLE_FRILLS |
|
|
1759 | if (option (Opt_urgentOnBell)) |
|
|
1760 | { |
|
|
1761 | XWMHints *h; |
|
|
1762 | |
|
|
1763 | h = XGetWMHints(dpy, parent[0]); |
|
|
1764 | if (h != NULL) |
|
|
1765 | { |
|
|
1766 | h->flags &= ~XUrgencyHint; |
|
|
1767 | XSetWMHints(dpy, parent[0], h); |
|
|
1768 | } |
1737 | } |
1769 | } |
1738 | #endif |
1770 | #endif |
1739 | } |
1771 | } |
1740 | } |
1772 | } |
1741 | |
1773 | |
… | |
… | |
1761 | #if USE_XIM |
1793 | #if USE_XIM |
1762 | if (Input_Context != NULL) |
1794 | if (Input_Context != NULL) |
1763 | XUnsetICFocus (Input_Context); |
1795 | XUnsetICFocus (Input_Context); |
1764 | #endif |
1796 | #endif |
1765 | #if CURSOR_BLINK |
1797 | #if CURSOR_BLINK |
1766 | if (OPTION (Opt_cursorBlink)) |
1798 | if (option (Opt_cursorBlink)) |
1767 | cursor_blink_ev.stop (); |
1799 | cursor_blink_ev.stop (); |
1768 | hidden_cursor = 0; |
1800 | hidden_cursor = 0; |
1769 | #endif |
1801 | #endif |
1770 | #if OFF_FOCUS_FADING |
1802 | #if OFF_FOCUS_FADING |
1771 | if (rs[Rs_fade]) |
1803 | if (rs[Rs_fade]) |
… | |
… | |
1788 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1820 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1789 | } |
1821 | } |
1790 | #endif |
1822 | #endif |
1791 | } |
1823 | } |
1792 | |
1824 | |
1793 | #if TRANSPARENT || ENABLE_PERL |
1825 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1794 | void |
1826 | void |
1795 | rxvt_term::rootwin_cb (XEvent &ev) |
1827 | rxvt_term::rootwin_cb (XEvent &ev) |
1796 | { |
1828 | { |
1797 | make_current (); |
1829 | make_current (); |
1798 | |
1830 | |
1799 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1831 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1800 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1832 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1801 | return; |
1833 | return; |
1802 | |
1834 | |
1803 | # if TRANSPARENT |
1835 | # if ENABLE_TRANSPARENCY |
1804 | switch (ev.type) |
1836 | switch (ev.type) |
1805 | { |
1837 | { |
1806 | case PropertyNotify: |
1838 | case PropertyNotify: |
1807 | /* |
1839 | /* |
1808 | * if user used some Esetroot compatible prog to set the root bg, |
1840 | * if user used some Esetroot compatible prog to set the root bg, |
… | |
… | |
1812 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1844 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1813 | return; |
1845 | return; |
1814 | |
1846 | |
1815 | /* FALLTHROUGH */ |
1847 | /* FALLTHROUGH */ |
1816 | case ReparentNotify: |
1848 | case ReparentNotify: |
1817 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
1849 | if (option (Opt_transparent)) |
1818 | want_refresh = want_full_refresh = 1; |
1850 | check_our_parents (); |
1819 | break; |
1851 | break; |
1820 | } |
1852 | } |
1821 | # endif |
1853 | # endif |
1822 | } |
1854 | } |
1823 | #endif |
1855 | #endif |
… | |
… | |
2154 | selection_make (ev.time); |
2186 | selection_make (ev.time); |
2155 | break; |
2187 | break; |
2156 | |
2188 | |
2157 | case Button2: |
2189 | case Button2: |
2158 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2190 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2159 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2191 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2160 | break; |
2192 | break; |
2161 | |
2193 | |
2162 | #ifdef MOUSE_WHEEL |
2194 | #ifdef MOUSE_WHEEL |
2163 | case Button4: |
2195 | case Button4: |
2164 | case Button5: |
2196 | case Button5: |
… | |
… | |
2168 | |
2200 | |
2169 | v = ev.button == Button4 ? UP : DN; |
2201 | v = ev.button == Button4 ? UP : DN; |
2170 | |
2202 | |
2171 | if (ev.state & ShiftMask) |
2203 | if (ev.state & ShiftMask) |
2172 | i = 1; |
2204 | i = 1; |
2173 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2205 | else if (option (Opt_mouseWheelScrollPage)) |
2174 | i = nrow - 1; |
2206 | i = nrow - 1; |
2175 | else |
2207 | else |
2176 | i = 5; |
2208 | i = 5; |
2177 | |
2209 | |
2178 | # ifdef MOUSE_SLIP_WHEELING |
2210 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2199 | break; |
2231 | break; |
2200 | #endif |
2232 | #endif |
2201 | } |
2233 | } |
2202 | } |
2234 | } |
2203 | } |
2235 | } |
2204 | |
|
|
2205 | #ifdef TRANSPARENT |
|
|
2206 | #if TINTING |
|
|
2207 | /* taken from aterm-0.4.2 */ |
|
|
2208 | |
|
|
2209 | typedef uint32_t RUINT32T; |
|
|
2210 | |
|
|
2211 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2212 | { |
|
|
2213 | int sh_r, sh_g, sh_b; |
|
|
2214 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2215 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2216 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2217 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2218 | int i; |
|
|
2219 | |
|
|
2220 | Visual *visual = term->visual; |
|
|
2221 | |
|
|
2222 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2223 | |
|
|
2224 | /* for convenience */ |
|
|
2225 | mask_r = visual->red_mask; |
|
|
2226 | mask_g = visual->green_mask; |
|
|
2227 | mask_b = visual->blue_mask; |
|
|
2228 | |
|
|
2229 | /* boring lookup table pre-initialization */ |
|
|
2230 | switch (srcImage->bits_per_pixel) { |
|
|
2231 | case 15: |
|
|
2232 | if ((mask_r != 0x7c00) || |
|
|
2233 | (mask_g != 0x03e0) || |
|
|
2234 | (mask_b != 0x001f)) |
|
|
2235 | return; |
|
|
2236 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2237 | lookup_r = lookup; |
|
|
2238 | lookup_g = lookup+32; |
|
|
2239 | lookup_b = lookup+32+32; |
|
|
2240 | sh_r = 10; |
|
|
2241 | sh_g = 5; |
|
|
2242 | sh_b = 0; |
|
|
2243 | break; |
|
|
2244 | case 16: |
|
|
2245 | if ((mask_r != 0xf800) || |
|
|
2246 | (mask_g != 0x07e0) || |
|
|
2247 | (mask_b != 0x001f)) |
|
|
2248 | return; |
|
|
2249 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2250 | lookup_r = lookup; |
|
|
2251 | lookup_g = lookup+32; |
|
|
2252 | lookup_b = lookup+32+64; |
|
|
2253 | sh_r = 11; |
|
|
2254 | sh_g = 5; |
|
|
2255 | sh_b = 0; |
|
|
2256 | break; |
|
|
2257 | case 24: |
|
|
2258 | if ((mask_r != 0xff0000) || |
|
|
2259 | (mask_g != 0x00ff00) || |
|
|
2260 | (mask_b != 0x0000ff)) |
|
|
2261 | return; |
|
|
2262 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2263 | lookup_r = lookup; |
|
|
2264 | lookup_g = lookup+256; |
|
|
2265 | lookup_b = lookup+256+256; |
|
|
2266 | sh_r = 16; |
|
|
2267 | sh_g = 8; |
|
|
2268 | sh_b = 0; |
|
|
2269 | break; |
|
|
2270 | case 32: |
|
|
2271 | if ((mask_r != 0xff0000) || |
|
|
2272 | (mask_g != 0x00ff00) || |
|
|
2273 | (mask_b != 0x0000ff)) |
|
|
2274 | return; |
|
|
2275 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2276 | lookup_r = lookup; |
|
|
2277 | lookup_g = lookup+256; |
|
|
2278 | lookup_b = lookup+256+256; |
|
|
2279 | sh_r = 16; |
|
|
2280 | sh_g = 8; |
|
|
2281 | sh_b = 0; |
|
|
2282 | break; |
|
|
2283 | default: |
|
|
2284 | return; /* we do not support this color depth */ |
|
|
2285 | } |
|
|
2286 | |
|
|
2287 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2288 | if (shade < 0) { |
|
|
2289 | shade = -shade; |
|
|
2290 | if (shade < 0) shade = 0; |
|
|
2291 | if (shade > 100) shade = 100; |
|
|
2292 | |
|
|
2293 | lower_lim_r = 65535-rm; |
|
|
2294 | lower_lim_g = 65535-gm; |
|
|
2295 | lower_lim_b = 65535-bm; |
|
|
2296 | |
|
|
2297 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2298 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2299 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2300 | |
|
|
2301 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2302 | } else { |
|
|
2303 | if (shade < 0) shade = 0; |
|
|
2304 | if (shade > 100) shade = 100; |
|
|
2305 | |
|
|
2306 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2307 | |
|
|
2308 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2309 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2310 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2311 | } |
|
|
2312 | |
|
|
2313 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2314 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2315 | { |
|
|
2316 | unsigned int tmp; |
|
|
2317 | |
|
|
2318 | tmp = lower_lim_r; |
|
|
2319 | lower_lim_r = lower_lim_b; |
|
|
2320 | lower_lim_b = tmp; |
|
|
2321 | |
|
|
2322 | tmp = upper_lim_r; |
|
|
2323 | upper_lim_r = upper_lim_b; |
|
|
2324 | upper_lim_b = tmp; |
|
|
2325 | } |
|
|
2326 | |
|
|
2327 | /* fill our lookup tables */ |
|
|
2328 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2329 | { |
|
|
2330 | RUINT32T tmp; |
|
|
2331 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2332 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2333 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2334 | } |
|
|
2335 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2336 | { |
|
|
2337 | RUINT32T tmp; |
|
|
2338 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2339 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2340 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2341 | } |
|
|
2342 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2343 | { |
|
|
2344 | RUINT32T tmp; |
|
|
2345 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2346 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2347 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2348 | } |
|
|
2349 | |
|
|
2350 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2351 | switch (srcImage->bits_per_pixel) |
|
|
2352 | { |
|
|
2353 | case 15: |
|
|
2354 | { |
|
|
2355 | unsigned short *p1, *pf, *p, *pl; |
|
|
2356 | p1 = (unsigned short *) srcImage->data; |
|
|
2357 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2358 | while (p1 < pf) |
|
|
2359 | { |
|
|
2360 | p = p1; |
|
|
2361 | pl = p1 + srcImage->width; |
|
|
2362 | for (; p < pl; p++) |
|
|
2363 | { |
|
|
2364 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2365 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2366 | lookup_b[(*p & 0x001f)]; |
|
|
2367 | } |
|
|
2368 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2369 | } |
|
|
2370 | break; |
|
|
2371 | } |
|
|
2372 | case 16: |
|
|
2373 | { |
|
|
2374 | unsigned short *p1, *pf, *p, *pl; |
|
|
2375 | p1 = (unsigned short *) srcImage->data; |
|
|
2376 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2377 | while (p1 < pf) |
|
|
2378 | { |
|
|
2379 | p = p1; |
|
|
2380 | pl = p1 + srcImage->width; |
|
|
2381 | for (; p < pl; p++) |
|
|
2382 | { |
|
|
2383 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2384 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2385 | lookup_b[(*p & 0x001f)]; |
|
|
2386 | } |
|
|
2387 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2388 | } |
|
|
2389 | break; |
|
|
2390 | } |
|
|
2391 | case 24: |
|
|
2392 | { |
|
|
2393 | unsigned char *p1, *pf, *p, *pl; |
|
|
2394 | p1 = (unsigned char *) srcImage->data; |
|
|
2395 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2396 | while (p1 < pf) |
|
|
2397 | { |
|
|
2398 | p = p1; |
|
|
2399 | pl = p1 + srcImage->width * 3; |
|
|
2400 | for (; p < pl; p += 3) |
|
|
2401 | { |
|
|
2402 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2403 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2404 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2405 | } |
|
|
2406 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2407 | } |
|
|
2408 | break; |
|
|
2409 | } |
|
|
2410 | case 32: |
|
|
2411 | { |
|
|
2412 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2413 | p1 = (RUINT32T *) srcImage->data; |
|
|
2414 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2415 | |
|
|
2416 | while (p1 < pf) |
|
|
2417 | { |
|
|
2418 | p = p1; |
|
|
2419 | pl = p1 + srcImage->width; |
|
|
2420 | for (; p < pl; p++) |
|
|
2421 | { |
|
|
2422 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2423 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2424 | lookup_b[(*p & 0x0000ff)] | |
|
|
2425 | (*p & ~0xffffff); |
|
|
2426 | } |
|
|
2427 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2428 | } |
|
|
2429 | break; |
|
|
2430 | } |
|
|
2431 | } |
|
|
2432 | |
|
|
2433 | free (lookup); |
|
|
2434 | } |
|
|
2435 | #endif |
|
|
2436 | |
|
|
2437 | /* |
|
|
2438 | * Check our parents are still who we think they are. |
|
|
2439 | * Do transparency updates if required |
|
|
2440 | */ |
|
|
2441 | int |
|
|
2442 | rxvt_term::check_our_parents () |
|
|
2443 | { |
|
|
2444 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2445 | unsigned long nitems, bytes_after; |
|
|
2446 | Atom atype; |
|
|
2447 | unsigned char *prop = NULL; |
|
|
2448 | Window root, oldp, *list; |
|
|
2449 | Pixmap rootpixmap = None; |
|
|
2450 | XWindowAttributes wattr, wrootattr; |
|
|
2451 | |
|
|
2452 | pchanged = 0; |
|
|
2453 | |
|
|
2454 | if (!OPTION (Opt_transparent)) |
|
|
2455 | return pchanged; /* Don't try any more */ |
|
|
2456 | |
|
|
2457 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2458 | rootdepth = wrootattr.depth; |
|
|
2459 | |
|
|
2460 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2461 | |
|
|
2462 | if (rootdepth != wattr.depth) |
|
|
2463 | { |
|
|
2464 | if (am_transparent) |
|
|
2465 | { |
|
|
2466 | pchanged = 1; |
|
|
2467 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2468 | am_transparent = am_pixmap_trans = 0; |
|
|
2469 | } |
|
|
2470 | |
|
|
2471 | return pchanged; /* Don't try any more */ |
|
|
2472 | } |
|
|
2473 | |
|
|
2474 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2475 | XSync (dpy, False); |
|
|
2476 | |
|
|
2477 | /* |
|
|
2478 | * Make the frame window set by the window manager have |
|
|
2479 | * the root background. Some window managers put multiple nested frame |
|
|
2480 | * windows for each client, so we have to take care about that. |
|
|
2481 | */ |
|
|
2482 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2483 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2484 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2485 | &nitems, &bytes_after, &prop) == Success); |
|
|
2486 | |
|
|
2487 | if (!i || prop == NULL) |
|
|
2488 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2489 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2490 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2491 | &nitems, &bytes_after, &prop) == Success); |
|
|
2492 | |
|
|
2493 | if (!i || prop == NULL |
|
|
2494 | #if TINTING |
|
|
2495 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2496 | #endif |
|
|
2497 | ) |
|
|
2498 | have_pixmap = 0; |
|
|
2499 | else |
|
|
2500 | { |
|
|
2501 | have_pixmap = 1; |
|
|
2502 | rootpixmap = *(Pixmap *)prop; |
|
|
2503 | XFree (prop); |
|
|
2504 | } |
|
|
2505 | |
|
|
2506 | if (have_pixmap) |
|
|
2507 | { |
|
|
2508 | /* |
|
|
2509 | * Copy display->root pixmap transparency |
|
|
2510 | */ |
|
|
2511 | int sx, sy, nx, ny; |
|
|
2512 | unsigned int nw, nh; |
|
|
2513 | Window cr; |
|
|
2514 | XImage *image; |
|
|
2515 | GC gc; |
|
|
2516 | XGCValues gcvalue; |
|
|
2517 | |
|
|
2518 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2519 | 0, 0, &sx, &sy, &cr); |
|
|
2520 | nw = (unsigned int)szHint.width; |
|
|
2521 | nh = (unsigned int)szHint.height; |
|
|
2522 | nx = ny = 0; |
|
|
2523 | |
|
|
2524 | if (sx < 0) |
|
|
2525 | { |
|
|
2526 | nw += sx; |
|
|
2527 | nx = -sx; |
|
|
2528 | sx = 0; |
|
|
2529 | } |
|
|
2530 | |
|
|
2531 | if (sy < 0) |
|
|
2532 | { |
|
|
2533 | nh += sy; |
|
|
2534 | ny = -sy; |
|
|
2535 | sy = 0; |
|
|
2536 | } |
|
|
2537 | |
|
|
2538 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2539 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2540 | |
|
|
2541 | XSync (dpy, False); |
|
|
2542 | allowedxerror = -1; |
|
|
2543 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2544 | |
|
|
2545 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2546 | /* XXX: may need a delay here? */ |
|
|
2547 | allowedxerror = 0; |
|
|
2548 | |
|
|
2549 | if (image == NULL) |
|
|
2550 | { |
|
|
2551 | if (am_transparent && am_pixmap_trans) |
|
|
2552 | { |
|
|
2553 | pchanged = 1; |
|
|
2554 | if (pixmap != None) |
|
|
2555 | { |
|
|
2556 | XFreePixmap (dpy, pixmap); |
|
|
2557 | pixmap = None; |
|
|
2558 | } |
|
|
2559 | } |
|
|
2560 | |
|
|
2561 | am_pixmap_trans = 0; |
|
|
2562 | } |
|
|
2563 | else |
|
|
2564 | { |
|
|
2565 | if (pixmap != None) |
|
|
2566 | XFreePixmap (dpy, pixmap); |
|
|
2567 | |
|
|
2568 | #if TINTING |
|
|
2569 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2570 | { |
|
|
2571 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2572 | |
|
|
2573 | rgba c; |
|
|
2574 | pix_colors_focused [Color_tint].get (c); |
|
|
2575 | |
|
|
2576 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2577 | } |
|
|
2578 | #endif |
|
|
2579 | |
|
|
2580 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2581 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2582 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2583 | nx, ny, image->width, image->height); |
|
|
2584 | XFreeGC (dpy, gc); |
|
|
2585 | XDestroyImage (image); |
|
|
2586 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2587 | XClearWindow (dpy, parent[0]); |
|
|
2588 | |
|
|
2589 | if (!am_transparent || !am_pixmap_trans) |
|
|
2590 | pchanged = 1; |
|
|
2591 | |
|
|
2592 | am_transparent = am_pixmap_trans = 1; |
|
|
2593 | } |
|
|
2594 | } |
|
|
2595 | |
|
|
2596 | if (am_pixmap_trans) |
|
|
2597 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2598 | else |
|
|
2599 | { |
|
|
2600 | unsigned int n; |
|
|
2601 | /* |
|
|
2602 | * InheritPixmap transparency |
|
|
2603 | */ |
|
|
2604 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2605 | { |
|
|
2606 | oldp = parent[i]; |
|
|
2607 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2608 | XFree (list); |
|
|
2609 | |
|
|
2610 | if (parent[i] == display->root) |
|
|
2611 | { |
|
|
2612 | if (oldp != None) |
|
|
2613 | pchanged = 1; |
|
|
2614 | |
|
|
2615 | break; |
|
|
2616 | } |
|
|
2617 | |
|
|
2618 | if (oldp != parent[i]) |
|
|
2619 | pchanged = 1; |
|
|
2620 | } |
|
|
2621 | |
|
|
2622 | n = 0; |
|
|
2623 | |
|
|
2624 | if (pchanged) |
|
|
2625 | for (; n < (unsigned int)i; n++) |
|
|
2626 | { |
|
|
2627 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2628 | |
|
|
2629 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2630 | { |
|
|
2631 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2632 | break; |
|
|
2633 | } |
|
|
2634 | } |
|
|
2635 | |
|
|
2636 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2637 | { |
|
|
2638 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2639 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2640 | am_transparent = 0; |
|
|
2641 | /* XXX: also turn off Opt_transparent? */ |
|
|
2642 | } |
|
|
2643 | else |
|
|
2644 | { |
|
|
2645 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2646 | { |
|
|
2647 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2648 | XClearWindow (dpy, parent[n]); |
|
|
2649 | } |
|
|
2650 | |
|
|
2651 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2652 | am_transparent = 1; |
|
|
2653 | } |
|
|
2654 | |
|
|
2655 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2656 | parent[i] = None; |
|
|
2657 | } |
|
|
2658 | |
|
|
2659 | if (scrollBar.win) |
|
|
2660 | { |
|
|
2661 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2662 | scrollBar.setIdle (); |
|
|
2663 | scrollbar_show (0); |
|
|
2664 | } |
|
|
2665 | |
|
|
2666 | if (am_transparent) |
|
|
2667 | { |
|
|
2668 | want_refresh = want_full_refresh = 1; |
|
|
2669 | if (am_pixmap_trans) |
|
|
2670 | flush (); |
|
|
2671 | } |
|
|
2672 | |
|
|
2673 | return pchanged; |
|
|
2674 | } |
|
|
2675 | #endif |
|
|
2676 | |
2236 | |
2677 | /*}}} */ |
2237 | /*}}} */ |
2678 | |
2238 | |
2679 | bool |
2239 | bool |
2680 | rxvt_term::cmd_parse () |
2240 | rxvt_term::cmd_parse () |
… | |
… | |
2729 | if (ch == C0_LF) |
2289 | if (ch == C0_LF) |
2730 | nlines++; |
2290 | nlines++; |
2731 | |
2291 | |
2732 | refresh_count++; |
2292 | refresh_count++; |
2733 | |
2293 | |
2734 | if (!OPTION (Opt_jumpScroll) |
2294 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2735 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2736 | { |
2295 | { |
2737 | refreshnow = true; |
|
|
2738 | refresh_count = 0; |
2296 | refresh_count = 0; |
|
|
2297 | |
|
|
2298 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
|
|
2299 | { |
|
|
2300 | refreshnow = true; |
2739 | ch = NOCHAR; |
2301 | ch = NOCHAR; |
2740 | break; |
2302 | break; |
|
|
2303 | } |
2741 | } |
2304 | } |
2742 | |
2305 | |
2743 | // scr_add_lines only works for nlines <= nrow - 1. |
2306 | // scr_add_lines only works for nlines <= nrow - 1. |
2744 | if (nlines >= nrow - 1) |
2307 | if (nlines >= nrow - 1) |
2745 | { |
2308 | { |
… | |
… | |
2773 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2336 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2774 | scr_add_lines (buf, str - buf, nlines); |
2337 | scr_add_lines (buf, str - buf, nlines); |
2775 | |
2338 | |
2776 | /* |
2339 | /* |
2777 | * If there have been a lot of new lines, then update the screen |
2340 | * If there have been a lot of new lines, then update the screen |
2778 | * What the heck I'll cheat and only refresh less than every page-full. |
2341 | * What the heck we'll cheat and only refresh less than every page-full. |
2779 | * the number of pages between refreshes is refresh_limit, which |
2342 | * if skipScroll is enabled. |
2780 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2781 | */ |
2343 | */ |
2782 | if (refreshnow) |
2344 | if (refreshnow) |
2783 | { |
2345 | { |
2784 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2785 | refresh_limit++; |
|
|
2786 | else |
|
|
2787 | { |
|
|
2788 | flag = true; |
2346 | flag = true; |
2789 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2790 | scr_refresh (); |
2347 | scr_refresh (); |
2791 | want_refresh = 1; |
2348 | want_refresh = 1; |
2792 | } |
|
|
2793 | } |
2349 | } |
2794 | |
2350 | |
2795 | } |
2351 | } |
2796 | else |
2352 | else |
2797 | { |
2353 | { |
… | |
… | |
2946 | { |
2502 | { |
2947 | if ((buf[len++] = cmd_getc ()) == 'i') |
2503 | if ((buf[len++] = cmd_getc ()) == 'i') |
2948 | break; /* done = 1 */ |
2504 | break; /* done = 1 */ |
2949 | } |
2505 | } |
2950 | } |
2506 | } |
2951 | |
2507 | |
2952 | for (i = 0; i < len; i++) |
2508 | for (i = 0; i < len; i++) |
2953 | if (putc (buf[i], fd) == EOF) |
2509 | if (putc (buf[i], fd) == EOF) |
2954 | { |
2510 | { |
2955 | done = 1; |
2511 | done = 1; |
2956 | break; |
2512 | break; |
… | |
… | |
3455 | break; |
3011 | break; |
3456 | case 6: /* CPR requested */ |
3012 | case 6: /* CPR requested */ |
3457 | scr_report_position (); |
3013 | scr_report_position (); |
3458 | break; |
3014 | break; |
3459 | case 7: /* unofficial extension */ |
3015 | case 7: /* unofficial extension */ |
3460 | if (OPTION (Opt_insecure)) |
3016 | if (option (Opt_insecure)) |
3461 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3017 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3462 | break; |
3018 | break; |
3463 | case 8: /* unofficial extension */ |
3019 | case 8: /* unofficial extension */ |
3464 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3020 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3465 | break; |
3021 | break; |
… | |
… | |
3629 | break; |
3185 | break; |
3630 | case 20: /* report icon label */ |
3186 | case 20: /* report icon label */ |
3631 | { |
3187 | { |
3632 | char *s; |
3188 | char *s; |
3633 | XGetIconName (dpy, parent[0], &s); |
3189 | XGetIconName (dpy, parent[0], &s); |
3634 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3190 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3635 | XFree (s); |
3191 | XFree (s); |
3636 | } |
3192 | } |
3637 | break; |
3193 | break; |
3638 | case 21: /* report window title */ |
3194 | case 21: /* report window title */ |
3639 | { |
3195 | { |
3640 | char *s; |
3196 | char *s; |
3641 | XFetchName (dpy, parent[0], &s); |
3197 | XFetchName (dpy, parent[0], &s); |
3642 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3198 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3643 | XFree (s); |
3199 | XFree (s); |
3644 | } |
3200 | } |
3645 | break; |
3201 | break; |
3646 | } |
3202 | } |
3647 | } |
3203 | } |
… | |
… | |
3774 | int saveop = op; |
3330 | int saveop = op; |
3775 | |
3331 | |
3776 | dLocal (Display *, dpy); |
3332 | dLocal (Display *, dpy); |
3777 | |
3333 | |
3778 | assert (str != NULL); |
3334 | assert (str != NULL); |
3779 | |
3335 | |
3780 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3336 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3781 | return; |
3337 | return; |
3782 | |
3338 | |
3783 | switch (op) |
3339 | switch (op) |
3784 | { |
3340 | { |
… | |
… | |
3879 | break; |
3435 | break; |
3880 | case URxvt_Color_IT: |
3436 | case URxvt_Color_IT: |
3881 | process_color_seq (op, Color_IT, str, resp); |
3437 | process_color_seq (op, Color_IT, str, resp); |
3882 | break; |
3438 | break; |
3883 | #endif |
3439 | #endif |
3884 | #if TRANSPARENT && TINTING |
3440 | #if ENABLE_TRANSPARENCY && TINTING |
3885 | case URxvt_Color_tint: |
3441 | case URxvt_Color_tint: |
3886 | process_color_seq (op, Color_tint, str, resp); |
3442 | process_color_seq (op, Color_tint, str, resp); |
3887 | |
3443 | |
3888 | check_our_parents (); |
3444 | check_our_parents (); |
3889 | |
3445 | |
… | |
… | |
3919 | #ifdef XPM_BACKGROUND |
3475 | #ifdef XPM_BACKGROUND |
3920 | resize_pixmap (); |
3476 | resize_pixmap (); |
3921 | scr_touch (true); |
3477 | scr_touch (true); |
3922 | #endif |
3478 | #endif |
3923 | } |
3479 | } |
|
|
3480 | #if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE) |
|
|
3481 | if (option (Opt_transparent)) |
|
|
3482 | check_our_parents (); |
|
|
3483 | #endif |
3924 | } |
3484 | } |
3925 | break; |
3485 | break; |
3926 | |
3486 | |
3927 | case Rxvt_restoreFG: |
3487 | case Rxvt_restoreFG: |
3928 | set_window_color (Color_fg, str); |
3488 | set_window_color (Color_fg, str); |
… | |
… | |
3955 | case URxvt_italicFont: |
3515 | case URxvt_italicFont: |
3956 | case URxvt_boldItalicFont: |
3516 | case URxvt_boldItalicFont: |
3957 | #endif |
3517 | #endif |
3958 | if (query) |
3518 | if (query) |
3959 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3519 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3960 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3520 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3961 | ? fontset[op - URxvt_font]->fontdesc : "", |
3521 | ? fontset[op - URxvt_font]->fontdesc : "", |
3962 | resp); |
3522 | resp); |
3963 | else |
3523 | else |
3964 | { |
3524 | { |
3965 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3525 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3979 | break; |
3539 | break; |
3980 | |
3540 | |
3981 | #if !ENABLE_MINIMAL |
3541 | #if !ENABLE_MINIMAL |
3982 | case URxvt_locale: |
3542 | case URxvt_locale: |
3983 | if (query) |
3543 | if (query) |
3984 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3544 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3985 | else |
3545 | else |
3986 | { |
3546 | { |
3987 | set_locale (str); |
3547 | set_locale (str); |
3988 | pty->set_utf8_mode (enc_utf8); |
3548 | pty->set_utf8_mode (enc_utf8); |
3989 | init_xlocale (); |
3549 | init_xlocale (); |
… | |
… | |
4130 | scr_touch (true); |
3690 | scr_touch (true); |
4131 | break; |
3691 | break; |
4132 | #endif |
3692 | #endif |
4133 | case 1048: /* alternative cursor save */ |
3693 | case 1048: /* alternative cursor save */ |
4134 | case 1049: |
3694 | case 1049: |
4135 | if (OPTION (Opt_secondaryScreen)) |
3695 | if (option (Opt_secondaryScreen)) |
4136 | if (mode == 0) |
3696 | if (mode == 0) |
4137 | scr_cursor (RESTORE); |
3697 | scr_cursor (RESTORE); |
4138 | else if (mode == 1) |
3698 | else if (mode == 1) |
4139 | scr_cursor (SAVE); |
3699 | scr_cursor (SAVE); |
4140 | break; |
3700 | break; |
… | |
… | |
4205 | break; |
3765 | break; |
4206 | case 1011: /* scroll to bottom on key press */ |
3766 | case 1011: /* scroll to bottom on key press */ |
4207 | set_option (Opt_scrollTtyKeypress, state); |
3767 | set_option (Opt_scrollTtyKeypress, state); |
4208 | break; |
3768 | break; |
4209 | case 1047: /* secondary screen w/ clearing last */ |
3769 | case 1047: /* secondary screen w/ clearing last */ |
4210 | if (OPTION (Opt_secondaryScreen)) |
3770 | if (option (Opt_secondaryScreen)) |
4211 | if (current_screen != PRIMARY) |
3771 | if (current_screen != PRIMARY) |
4212 | scr_erase_screen (2); |
3772 | scr_erase_screen (2); |
4213 | scr_change_screen (state); |
3773 | scr_change_screen (state); |
4214 | break; |
3774 | break; |
4215 | case 1049: /* secondary screen w/ clearing first */ |
3775 | case 1049: /* secondary screen w/ clearing first */ |
4216 | scr_change_screen (state); |
3776 | scr_change_screen (state); |
4217 | if (OPTION (Opt_secondaryScreen)) |
3777 | if (option (Opt_secondaryScreen)) |
4218 | if (current_screen != PRIMARY) |
3778 | if (current_screen != PRIMARY) |
4219 | scr_erase_screen (2); |
3779 | scr_erase_screen (2); |
4220 | break; |
3780 | break; |
4221 | default: |
3781 | default: |
4222 | break; |
3782 | break; |