… | |
… | |
95 | XK_Shift_L, 0x21e7, |
95 | XK_Shift_L, 0x21e7, |
96 | XK_Shift_R, 0x21e7, |
96 | XK_Shift_R, 0x21e7, |
97 | |
97 | |
98 | XK_Shift_Lock, 0x21eb, |
98 | XK_Shift_Lock, 0x21eb, |
99 | XK_ISO_Lock, 0x21eb, |
99 | XK_ISO_Lock, 0x21eb, |
100 | XK_ISO_Lock, 0x21eb, |
|
|
101 | XK_Caps_Lock, 0x21ec, |
100 | XK_Caps_Lock, 0x21ec, |
102 | XK_Num_Lock, 0x21ed, |
101 | XK_Num_Lock, 0x21ed, |
103 | XK_ISO_Level3_Shift, 0x21ee, |
102 | XK_ISO_Level3_Shift, 0x21ee, |
104 | XK_ISO_Level3_Lock, 0x21ef, |
103 | XK_ISO_Level3_Lock, 0x21ef, |
105 | XK_ISO_Group_Lock, 0x21f0, |
104 | XK_ISO_Group_Lock, 0x21f0, |
… | |
… | |
500 | # if ISO_14755 |
499 | # if ISO_14755 |
501 | iso14755_51 (0); |
500 | iso14755_51 (0); |
502 | # endif |
501 | # endif |
503 | return; |
502 | return; |
504 | } |
503 | } |
|
|
504 | else if (keysym == XK_BackSpace) |
|
|
505 | { |
|
|
506 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
507 | # if ISO_14755 |
|
|
508 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
509 | # endif |
|
|
510 | return; |
|
|
511 | } |
505 | else if ((hv = hex_keyval (ev)) >= 0) |
512 | else if ((hv = hex_keyval (ev)) >= 0) |
506 | { |
513 | { |
507 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
514 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
508 | | hv | ISO_14755_51; |
515 | | hv | ISO_14755_51; |
509 | # if ISO_14755 |
516 | # if ISO_14755 |
… | |
… | |
511 | # endif |
518 | # endif |
512 | return; |
519 | return; |
513 | } |
520 | } |
514 | else |
521 | else |
515 | { |
522 | { |
516 | # if ENABLE_OVERLAY |
523 | # if ISO_14755 |
517 | scr_overlay_off (); |
524 | scr_overlay_off (); |
518 | # endif |
525 | # endif |
519 | iso14755buf = 0; |
526 | iso14755buf = 0; |
520 | } |
527 | } |
521 | } |
528 | } |
522 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
529 | else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) |
523 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
530 | || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) |
524 | if (!(iso14755buf & ISO_14755_STARTED)) |
531 | if (!(iso14755buf & ISO_14755_STARTED)) |
525 | { |
532 | { |
526 | iso14755buf |= ISO_14755_STARTED; |
533 | iso14755buf |= ISO_14755_STARTED; |
527 | # if ENABLE_OVERLAY |
534 | # if ISO_14755 |
528 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
535 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
529 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
536 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
530 | # endif |
537 | # endif |
531 | } |
538 | } |
532 | #endif |
539 | #endif |
533 | |
540 | |
534 | #ifdef PRINTPIPE |
541 | #ifdef PRINTPIPE |
535 | if (keysym == XK_Print) |
542 | if (keysym == XK_Print) |
536 | { |
543 | { |
537 | scr_printscreen (ctrl | shft); |
544 | scr_printscreen (ctrl | shft); |
538 | return; |
545 | return; |
… | |
… | |
720 | |
727 | |
721 | case XK_Find: |
728 | case XK_Find: |
722 | strcpy (kbuf, "\033[1~"); |
729 | strcpy (kbuf, "\033[1~"); |
723 | break; |
730 | break; |
724 | |
731 | |
725 | #ifdef XK_KP_End |
732 | #ifdef XK_KP_Insert |
726 | case XK_KP_Insert: |
733 | case XK_KP_Insert: |
727 | /* allow shift to override */ |
734 | /* allow shift to override */ |
728 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
735 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
729 | { |
736 | { |
730 | strcpy (kbuf, "\033Op"); |
737 | strcpy (kbuf, "\033Op"); |
… | |
… | |
926 | #if ENABLE_FRILLS || ISO_14755 |
933 | #if ENABLE_FRILLS || ISO_14755 |
927 | // ISO 14755 support |
934 | // ISO 14755 support |
928 | if (iso14755buf) |
935 | if (iso14755buf) |
929 | if (iso14755buf & ISO_14755_52) |
936 | if (iso14755buf & ISO_14755_52) |
930 | { |
937 | { |
931 | # if ENABLE_OVERLAY |
938 | # if ISO_14755 |
932 | scr_overlay_off (); |
939 | scr_overlay_off (); |
933 | # endif |
940 | # endif |
934 | # if ISO_14755 |
941 | # if ISO_14755 |
935 | // iso14755 part 5.2 handling: release time |
942 | // iso14755 part 5.2 handling: release time |
936 | // first: controls |
943 | // first: controls |
… | |
… | |
959 | |
966 | |
960 | return; |
967 | return; |
961 | } |
968 | } |
962 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
969 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
963 | { |
970 | { |
964 | # if ENABLE_OVERLAY |
971 | # if ISO_14755 |
965 | scr_overlay_off (); |
972 | scr_overlay_off (); |
966 | # endif |
973 | # endif |
967 | if (iso14755buf & ISO_14755_51) |
974 | if (iso14755buf & ISO_14755_51) |
968 | commit_iso14755 (); |
975 | commit_iso14755 (); |
969 | #if ISO_14755 |
976 | #if ISO_14755 |
970 | else if (iso14755buf & ISO_14755_STARTED) |
977 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
971 | { |
978 | { |
972 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
979 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
973 | |
980 | |
974 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
981 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
975 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
982 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
… | |
… | |
1027 | void |
1034 | void |
1028 | rxvt_term::flush () |
1035 | rxvt_term::flush () |
1029 | { |
1036 | { |
1030 | flush_ev.stop (); |
1037 | flush_ev.stop (); |
1031 | |
1038 | |
1032 | #ifdef TRANSPARENT |
1039 | #ifdef ENABLE_TRANSPARENCY |
1033 | if (want_full_refresh) |
1040 | if (want_full_refresh) |
1034 | { |
1041 | { |
1035 | want_full_refresh = 0; |
1042 | want_full_refresh = 0; |
1036 | scr_clear (); |
1043 | scr_clear (); |
1037 | scr_touch (false); |
1044 | scr_touch (false); |
… | |
… | |
1102 | void |
1109 | void |
1103 | rxvt_term::flush_cb (time_watcher &w) |
1110 | rxvt_term::flush_cb (time_watcher &w) |
1104 | { |
1111 | { |
1105 | make_current (); |
1112 | make_current (); |
1106 | |
1113 | |
1107 | refresh_limit = 1; |
|
|
1108 | refresh_count = 0; |
1114 | refresh_count = 0; |
1109 | flush (); |
1115 | flush (); |
1110 | } |
1116 | } |
1111 | |
1117 | |
1112 | #ifdef CURSOR_BLINK |
1118 | #ifdef CURSOR_BLINK |
… | |
… | |
1178 | |
1184 | |
1179 | #if LINUX_YIELD_HACK |
1185 | #if LINUX_YIELD_HACK |
1180 | static struct event_handler |
1186 | static struct event_handler |
1181 | { |
1187 | { |
1182 | check_watcher yield_ev; |
1188 | check_watcher yield_ev; |
1183 | |
1189 | |
1184 | void yield_cb (check_watcher &w) |
1190 | void yield_cb (check_watcher &w) |
1185 | { |
1191 | { |
1186 | // this should really be sched_yield(), but the linux guys thought |
1192 | // this should really be sched_yield(), but the linux guys thought |
1187 | // that giving a process calling sched_yield () less cpu time than |
1193 | // 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 |
1194 | // ones with high nice levels is a useful thing to do. It surely is is |
… | |
… | |
1235 | pty_ev.stop (); |
1241 | pty_ev.stop (); |
1236 | |
1242 | |
1237 | if (!option (Opt_hold)) |
1243 | if (!option (Opt_hold)) |
1238 | destroy (); |
1244 | destroy (); |
1239 | } |
1245 | } |
1240 | |
1246 | |
1241 | return false; |
1247 | return false; |
1242 | } |
1248 | } |
1243 | |
1249 | |
1244 | void |
1250 | void |
1245 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1251 | rxvt_term::pty_cb (io_watcher &w, short revents) |
… | |
… | |
1426 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1432 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1427 | focus_out (); |
1433 | focus_out (); |
1428 | } |
1434 | } |
1429 | #endif |
1435 | #endif |
1430 | } |
1436 | } |
1431 | break; |
|
|
1432 | |
|
|
1433 | case MappingNotify: |
|
|
1434 | XRefreshKeyboardMapping (&ev.xmapping); |
|
|
1435 | break; |
1437 | break; |
1436 | |
1438 | |
1437 | /* |
1439 | /* |
1438 | * XXX: this is not the _current_ arrangement |
1440 | * XXX: this is not the _current_ arrangement |
1439 | * Here's my conclusion: |
1441 | * Here's my conclusion: |
… | |
… | |
1482 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1484 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1483 | { |
1485 | { |
1484 | seen_resize = 1; |
1486 | seen_resize = 1; |
1485 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1487 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1486 | } |
1488 | } |
1487 | |
1489 | else |
|
|
1490 | { |
|
|
1491 | #ifdef ENABLE_TRANSPARENCY |
|
|
1492 | if (option (Opt_transparent)) |
|
|
1493 | if (bgPixmap.render ()) |
|
|
1494 | scr_touch (false); |
|
|
1495 | #endif |
|
|
1496 | } |
1488 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1497 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1489 | |
|
|
1490 | #ifdef TRANSPARENT |
|
|
1491 | if (option (Opt_transparent)) |
|
|
1492 | check_our_parents (); |
|
|
1493 | #endif |
|
|
1494 | } |
1498 | } |
1495 | break; |
1499 | break; |
1496 | |
1500 | |
1497 | case PropertyNotify: |
1501 | case PropertyNotify: |
1498 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1502 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1529 | text_blink_ev.stop (); |
1533 | text_blink_ev.stop (); |
1530 | #endif |
1534 | #endif |
1531 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1535 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1532 | break; |
1536 | break; |
1533 | |
1537 | |
1534 | #ifdef TRANSPARENT |
1538 | #ifdef ENABLE_TRANSPARENCY |
1535 | case ReparentNotify: |
1539 | case ReparentNotify: |
1536 | rootwin_cb (ev); |
1540 | rootwin_cb (ev); |
1537 | break; |
1541 | break; |
1538 | #endif /* TRANSPARENT */ |
1542 | #endif /* ENABLE_TRANSPARENCY */ |
1539 | |
1543 | |
1540 | case GraphicsExpose: |
1544 | case GraphicsExpose: |
1541 | case Expose: |
1545 | case Expose: |
1542 | if (ev.xany.window == vt) |
1546 | if (ev.xany.window == vt) |
1543 | { |
1547 | { |
… | |
… | |
1566 | if (isScrollbarWindow (ev.xany.window)) |
1570 | if (isScrollbarWindow (ev.xany.window)) |
1567 | { |
1571 | { |
1568 | scrollBar.setIdle (); |
1572 | scrollBar.setIdle (); |
1569 | scrollbar_show (0); |
1573 | scrollbar_show (0); |
1570 | } |
1574 | } |
1571 | |
|
|
1572 | #ifdef TRANSPARENT |
|
|
1573 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1574 | XClearWindow (dpy, ev.xany.window); |
|
|
1575 | #endif |
|
|
1576 | } |
1575 | } |
1577 | break; |
1576 | break; |
1578 | |
1577 | |
1579 | case MotionNotify: |
1578 | case MotionNotify: |
1580 | #ifdef POINTER_BLANK |
1579 | #ifdef POINTER_BLANK |
… | |
… | |
1678 | &ev.xbutton.x, &ev.xbutton.y, |
1677 | &ev.xbutton.x, &ev.xbutton.y, |
1679 | &unused_mask); |
1678 | &unused_mask); |
1680 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1679 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1681 | scrollbar_size ()); |
1680 | scrollbar_size ()); |
1682 | want_refresh = 1; |
1681 | want_refresh = 1; |
1683 | refresh_limit = 0; |
|
|
1684 | scrollbar_show (1); |
1682 | scrollbar_show (1); |
1685 | } |
1683 | } |
1686 | break; |
1684 | break; |
1687 | } |
1685 | } |
1688 | |
1686 | |
… | |
… | |
1740 | { |
1738 | { |
1741 | pix_colors = pix_colors_focused; |
1739 | pix_colors = pix_colors_focused; |
1742 | scr_recolour (); |
1740 | scr_recolour (); |
1743 | } |
1741 | } |
1744 | #endif |
1742 | #endif |
|
|
1743 | #if ENABLE_FRILLS |
|
|
1744 | if (option (Opt_urgentOnBell)) |
|
|
1745 | { |
|
|
1746 | XWMHints *h; |
|
|
1747 | |
|
|
1748 | h = XGetWMHints(dpy, parent[0]); |
|
|
1749 | if (h != NULL) |
|
|
1750 | { |
|
|
1751 | h->flags &= ~XUrgencyHint; |
|
|
1752 | XSetWMHints(dpy, parent[0], h); |
|
|
1753 | } |
|
|
1754 | } |
|
|
1755 | #endif |
1745 | } |
1756 | } |
1746 | } |
1757 | } |
1747 | |
1758 | |
1748 | void |
1759 | void |
1749 | rxvt_term::focus_out () |
1760 | rxvt_term::focus_out () |
… | |
… | |
1757 | |
1768 | |
1758 | #if ENABLE_FRILLS || ISO_14755 |
1769 | #if ENABLE_FRILLS || ISO_14755 |
1759 | if (iso14755buf) |
1770 | if (iso14755buf) |
1760 | { |
1771 | { |
1761 | iso14755buf = 0; |
1772 | iso14755buf = 0; |
1762 | # if ENABLE_OVERLAY |
1773 | # if ISO_14755 |
1763 | scr_overlay_off (); |
1774 | scr_overlay_off (); |
1764 | # endif |
1775 | # endif |
1765 | } |
1776 | } |
1766 | #endif |
1777 | #endif |
1767 | #if USE_XIM |
1778 | #if USE_XIM |
… | |
… | |
1794 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1805 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1795 | } |
1806 | } |
1796 | #endif |
1807 | #endif |
1797 | } |
1808 | } |
1798 | |
1809 | |
1799 | #if TRANSPARENT || ENABLE_PERL |
1810 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1800 | void |
1811 | void |
1801 | rxvt_term::rootwin_cb (XEvent &ev) |
1812 | rxvt_term::rootwin_cb (XEvent &ev) |
1802 | { |
1813 | { |
1803 | make_current (); |
1814 | make_current (); |
1804 | |
1815 | |
1805 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1816 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1806 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1817 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1807 | return; |
1818 | return; |
1808 | |
1819 | |
1809 | # if TRANSPARENT |
1820 | # if ENABLE_TRANSPARENCY |
1810 | switch (ev.type) |
1821 | switch (ev.type) |
1811 | { |
1822 | { |
1812 | case PropertyNotify: |
1823 | case PropertyNotify: |
1813 | /* |
1824 | /* |
1814 | * if user used some Esetroot compatible prog to set the root bg, |
1825 | * if user used some Esetroot compatible prog to set the root bg, |
1815 | * use the property to determine the pixmap. We use it later on. |
1826 | * use the property to determine the pixmap. We use it later on. |
1816 | */ |
1827 | */ |
1817 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1828 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1818 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1829 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1819 | return; |
1830 | { |
1820 | |
1831 | bgPixmap.set_root_pixmap (); |
1821 | /* FALLTHROUGH */ |
1832 | bgPixmap.render (); |
1822 | case ReparentNotify: |
1833 | } |
1823 | if (option (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1824 | want_refresh = want_full_refresh = 1; |
|
|
1825 | break; |
1834 | break; |
1826 | } |
1835 | } |
1827 | # endif |
1836 | # endif |
1828 | } |
1837 | } |
1829 | #endif |
1838 | #endif |
… | |
… | |
2206 | #endif |
2215 | #endif |
2207 | } |
2216 | } |
2208 | } |
2217 | } |
2209 | } |
2218 | } |
2210 | |
2219 | |
2211 | #ifdef TRANSPARENT |
|
|
2212 | #if TINTING |
|
|
2213 | /* taken from aterm-0.4.2 */ |
|
|
2214 | |
|
|
2215 | typedef uint32_t RUINT32T; |
|
|
2216 | |
|
|
2217 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2218 | { |
|
|
2219 | int sh_r, sh_g, sh_b; |
|
|
2220 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2221 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2222 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2223 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2224 | int i; |
|
|
2225 | |
|
|
2226 | Visual *visual = term->visual; |
|
|
2227 | |
|
|
2228 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2229 | |
|
|
2230 | /* for convenience */ |
|
|
2231 | mask_r = visual->red_mask; |
|
|
2232 | mask_g = visual->green_mask; |
|
|
2233 | mask_b = visual->blue_mask; |
|
|
2234 | |
|
|
2235 | /* boring lookup table pre-initialization */ |
|
|
2236 | switch (srcImage->bits_per_pixel) { |
|
|
2237 | case 15: |
|
|
2238 | if ((mask_r != 0x7c00) || |
|
|
2239 | (mask_g != 0x03e0) || |
|
|
2240 | (mask_b != 0x001f)) |
|
|
2241 | return; |
|
|
2242 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2243 | lookup_r = lookup; |
|
|
2244 | lookup_g = lookup+32; |
|
|
2245 | lookup_b = lookup+32+32; |
|
|
2246 | sh_r = 10; |
|
|
2247 | sh_g = 5; |
|
|
2248 | sh_b = 0; |
|
|
2249 | break; |
|
|
2250 | case 16: |
|
|
2251 | if ((mask_r != 0xf800) || |
|
|
2252 | (mask_g != 0x07e0) || |
|
|
2253 | (mask_b != 0x001f)) |
|
|
2254 | return; |
|
|
2255 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2256 | lookup_r = lookup; |
|
|
2257 | lookup_g = lookup+32; |
|
|
2258 | lookup_b = lookup+32+64; |
|
|
2259 | sh_r = 11; |
|
|
2260 | sh_g = 5; |
|
|
2261 | sh_b = 0; |
|
|
2262 | break; |
|
|
2263 | case 24: |
|
|
2264 | if ((mask_r != 0xff0000) || |
|
|
2265 | (mask_g != 0x00ff00) || |
|
|
2266 | (mask_b != 0x0000ff)) |
|
|
2267 | return; |
|
|
2268 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2269 | lookup_r = lookup; |
|
|
2270 | lookup_g = lookup+256; |
|
|
2271 | lookup_b = lookup+256+256; |
|
|
2272 | sh_r = 16; |
|
|
2273 | sh_g = 8; |
|
|
2274 | sh_b = 0; |
|
|
2275 | break; |
|
|
2276 | case 32: |
|
|
2277 | if ((mask_r != 0xff0000) || |
|
|
2278 | (mask_g != 0x00ff00) || |
|
|
2279 | (mask_b != 0x0000ff)) |
|
|
2280 | return; |
|
|
2281 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2282 | lookup_r = lookup; |
|
|
2283 | lookup_g = lookup+256; |
|
|
2284 | lookup_b = lookup+256+256; |
|
|
2285 | sh_r = 16; |
|
|
2286 | sh_g = 8; |
|
|
2287 | sh_b = 0; |
|
|
2288 | break; |
|
|
2289 | default: |
|
|
2290 | return; /* we do not support this color depth */ |
|
|
2291 | } |
|
|
2292 | |
|
|
2293 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2294 | if (shade < 0) { |
|
|
2295 | shade = -shade; |
|
|
2296 | if (shade < 0) shade = 0; |
|
|
2297 | if (shade > 100) shade = 100; |
|
|
2298 | |
|
|
2299 | lower_lim_r = 65535-rm; |
|
|
2300 | lower_lim_g = 65535-gm; |
|
|
2301 | lower_lim_b = 65535-bm; |
|
|
2302 | |
|
|
2303 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2304 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2305 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2306 | |
|
|
2307 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2308 | } else { |
|
|
2309 | if (shade < 0) shade = 0; |
|
|
2310 | if (shade > 100) shade = 100; |
|
|
2311 | |
|
|
2312 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2313 | |
|
|
2314 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2315 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2316 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2317 | } |
|
|
2318 | |
|
|
2319 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2320 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2321 | { |
|
|
2322 | unsigned int tmp; |
|
|
2323 | |
|
|
2324 | tmp = lower_lim_r; |
|
|
2325 | lower_lim_r = lower_lim_b; |
|
|
2326 | lower_lim_b = tmp; |
|
|
2327 | |
|
|
2328 | tmp = upper_lim_r; |
|
|
2329 | upper_lim_r = upper_lim_b; |
|
|
2330 | upper_lim_b = tmp; |
|
|
2331 | } |
|
|
2332 | |
|
|
2333 | /* fill our lookup tables */ |
|
|
2334 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2335 | { |
|
|
2336 | RUINT32T tmp; |
|
|
2337 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2338 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2339 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2340 | } |
|
|
2341 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2342 | { |
|
|
2343 | RUINT32T tmp; |
|
|
2344 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2345 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2346 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2347 | } |
|
|
2348 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2349 | { |
|
|
2350 | RUINT32T tmp; |
|
|
2351 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2352 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2353 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2354 | } |
|
|
2355 | |
|
|
2356 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2357 | switch (srcImage->bits_per_pixel) |
|
|
2358 | { |
|
|
2359 | case 15: |
|
|
2360 | { |
|
|
2361 | unsigned short *p1, *pf, *p, *pl; |
|
|
2362 | p1 = (unsigned short *) srcImage->data; |
|
|
2363 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2364 | while (p1 < pf) |
|
|
2365 | { |
|
|
2366 | p = p1; |
|
|
2367 | pl = p1 + srcImage->width; |
|
|
2368 | for (; p < pl; p++) |
|
|
2369 | { |
|
|
2370 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2371 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2372 | lookup_b[(*p & 0x001f)]; |
|
|
2373 | } |
|
|
2374 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2375 | } |
|
|
2376 | break; |
|
|
2377 | } |
|
|
2378 | case 16: |
|
|
2379 | { |
|
|
2380 | unsigned short *p1, *pf, *p, *pl; |
|
|
2381 | p1 = (unsigned short *) srcImage->data; |
|
|
2382 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2383 | while (p1 < pf) |
|
|
2384 | { |
|
|
2385 | p = p1; |
|
|
2386 | pl = p1 + srcImage->width; |
|
|
2387 | for (; p < pl; p++) |
|
|
2388 | { |
|
|
2389 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2390 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2391 | lookup_b[(*p & 0x001f)]; |
|
|
2392 | } |
|
|
2393 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2394 | } |
|
|
2395 | break; |
|
|
2396 | } |
|
|
2397 | case 24: |
|
|
2398 | { |
|
|
2399 | unsigned char *p1, *pf, *p, *pl; |
|
|
2400 | p1 = (unsigned char *) srcImage->data; |
|
|
2401 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2402 | while (p1 < pf) |
|
|
2403 | { |
|
|
2404 | p = p1; |
|
|
2405 | pl = p1 + srcImage->width * 3; |
|
|
2406 | for (; p < pl; p += 3) |
|
|
2407 | { |
|
|
2408 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2409 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2410 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2411 | } |
|
|
2412 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2413 | } |
|
|
2414 | break; |
|
|
2415 | } |
|
|
2416 | case 32: |
|
|
2417 | { |
|
|
2418 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2419 | p1 = (RUINT32T *) srcImage->data; |
|
|
2420 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2421 | |
|
|
2422 | while (p1 < pf) |
|
|
2423 | { |
|
|
2424 | p = p1; |
|
|
2425 | pl = p1 + srcImage->width; |
|
|
2426 | for (; p < pl; p++) |
|
|
2427 | { |
|
|
2428 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2429 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2430 | lookup_b[(*p & 0x0000ff)] | |
|
|
2431 | (*p & ~0xffffff); |
|
|
2432 | } |
|
|
2433 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2434 | } |
|
|
2435 | break; |
|
|
2436 | } |
|
|
2437 | } |
|
|
2438 | |
|
|
2439 | free (lookup); |
|
|
2440 | } |
|
|
2441 | #endif |
|
|
2442 | |
|
|
2443 | /* |
|
|
2444 | * Check our parents are still who we think they are. |
|
|
2445 | * Do transparency updates if required |
|
|
2446 | */ |
|
|
2447 | int |
|
|
2448 | rxvt_term::check_our_parents () |
|
|
2449 | { |
|
|
2450 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2451 | unsigned long nitems, bytes_after; |
|
|
2452 | Atom atype; |
|
|
2453 | unsigned char *prop = NULL; |
|
|
2454 | Window root, oldp, *list; |
|
|
2455 | Pixmap rootpixmap = None; |
|
|
2456 | XWindowAttributes wattr, wrootattr; |
|
|
2457 | |
|
|
2458 | pchanged = 0; |
|
|
2459 | |
|
|
2460 | if (!option (Opt_transparent)) |
|
|
2461 | return pchanged; /* Don't try any more */ |
|
|
2462 | |
|
|
2463 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2464 | rootdepth = wrootattr.depth; |
|
|
2465 | |
|
|
2466 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2467 | |
|
|
2468 | if (rootdepth != wattr.depth) |
|
|
2469 | { |
|
|
2470 | if (am_transparent) |
|
|
2471 | { |
|
|
2472 | pchanged = 1; |
|
|
2473 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2474 | am_transparent = am_pixmap_trans = 0; |
|
|
2475 | } |
|
|
2476 | |
|
|
2477 | return pchanged; /* Don't try any more */ |
|
|
2478 | } |
|
|
2479 | |
|
|
2480 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2481 | XSync (dpy, False); |
|
|
2482 | |
|
|
2483 | /* |
|
|
2484 | * Make the frame window set by the window manager have |
|
|
2485 | * the root background. Some window managers put multiple nested frame |
|
|
2486 | * windows for each client, so we have to take care about that. |
|
|
2487 | */ |
|
|
2488 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2489 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2490 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2491 | &nitems, &bytes_after, &prop) == Success); |
|
|
2492 | |
|
|
2493 | if (!i || prop == NULL) |
|
|
2494 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2495 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2496 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2497 | &nitems, &bytes_after, &prop) == Success); |
|
|
2498 | |
|
|
2499 | if (!i || prop == NULL |
|
|
2500 | #if TINTING |
|
|
2501 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2502 | #endif |
|
|
2503 | ) |
|
|
2504 | have_pixmap = 0; |
|
|
2505 | else |
|
|
2506 | { |
|
|
2507 | have_pixmap = 1; |
|
|
2508 | rootpixmap = *(Pixmap *)prop; |
|
|
2509 | XFree (prop); |
|
|
2510 | } |
|
|
2511 | |
|
|
2512 | if (have_pixmap) |
|
|
2513 | { |
|
|
2514 | /* |
|
|
2515 | * Copy display->root pixmap transparency |
|
|
2516 | */ |
|
|
2517 | int sx, sy, nx, ny; |
|
|
2518 | unsigned int nw, nh; |
|
|
2519 | Window cr; |
|
|
2520 | XImage *image; |
|
|
2521 | GC gc; |
|
|
2522 | XGCValues gcvalue; |
|
|
2523 | |
|
|
2524 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2525 | 0, 0, &sx, &sy, &cr); |
|
|
2526 | nw = (unsigned int)szHint.width; |
|
|
2527 | nh = (unsigned int)szHint.height; |
|
|
2528 | nx = ny = 0; |
|
|
2529 | |
|
|
2530 | if (sx < 0) |
|
|
2531 | { |
|
|
2532 | nw += sx; |
|
|
2533 | nx = -sx; |
|
|
2534 | sx = 0; |
|
|
2535 | } |
|
|
2536 | |
|
|
2537 | if (sy < 0) |
|
|
2538 | { |
|
|
2539 | nh += sy; |
|
|
2540 | ny = -sy; |
|
|
2541 | sy = 0; |
|
|
2542 | } |
|
|
2543 | |
|
|
2544 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2545 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2546 | |
|
|
2547 | XSync (dpy, False); |
|
|
2548 | allowedxerror = -1; |
|
|
2549 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2550 | |
|
|
2551 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2552 | /* XXX: may need a delay here? */ |
|
|
2553 | allowedxerror = 0; |
|
|
2554 | |
|
|
2555 | if (image == NULL) |
|
|
2556 | { |
|
|
2557 | if (am_transparent && am_pixmap_trans) |
|
|
2558 | { |
|
|
2559 | pchanged = 1; |
|
|
2560 | if (pixmap != None) |
|
|
2561 | { |
|
|
2562 | XFreePixmap (dpy, pixmap); |
|
|
2563 | pixmap = None; |
|
|
2564 | } |
|
|
2565 | } |
|
|
2566 | |
|
|
2567 | am_pixmap_trans = 0; |
|
|
2568 | } |
|
|
2569 | else |
|
|
2570 | { |
|
|
2571 | if (pixmap != None) |
|
|
2572 | XFreePixmap (dpy, pixmap); |
|
|
2573 | |
|
|
2574 | #if TINTING |
|
|
2575 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2576 | { |
|
|
2577 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2578 | |
|
|
2579 | rgba c; |
|
|
2580 | pix_colors_focused [Color_tint].get (c); |
|
|
2581 | |
|
|
2582 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2583 | } |
|
|
2584 | #endif |
|
|
2585 | |
|
|
2586 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2587 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2588 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2589 | nx, ny, image->width, image->height); |
|
|
2590 | XFreeGC (dpy, gc); |
|
|
2591 | XDestroyImage (image); |
|
|
2592 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2593 | XClearWindow (dpy, parent[0]); |
|
|
2594 | |
|
|
2595 | if (!am_transparent || !am_pixmap_trans) |
|
|
2596 | pchanged = 1; |
|
|
2597 | |
|
|
2598 | am_transparent = am_pixmap_trans = 1; |
|
|
2599 | } |
|
|
2600 | } |
|
|
2601 | |
|
|
2602 | if (am_pixmap_trans) |
|
|
2603 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2604 | else |
|
|
2605 | { |
|
|
2606 | unsigned int n; |
|
|
2607 | /* |
|
|
2608 | * InheritPixmap transparency |
|
|
2609 | */ |
|
|
2610 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2611 | { |
|
|
2612 | oldp = parent[i]; |
|
|
2613 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2614 | XFree (list); |
|
|
2615 | |
|
|
2616 | if (parent[i] == display->root) |
|
|
2617 | { |
|
|
2618 | if (oldp != None) |
|
|
2619 | pchanged = 1; |
|
|
2620 | |
|
|
2621 | break; |
|
|
2622 | } |
|
|
2623 | |
|
|
2624 | if (oldp != parent[i]) |
|
|
2625 | pchanged = 1; |
|
|
2626 | } |
|
|
2627 | |
|
|
2628 | n = 0; |
|
|
2629 | |
|
|
2630 | if (pchanged) |
|
|
2631 | for (; n < (unsigned int)i; n++) |
|
|
2632 | { |
|
|
2633 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2634 | |
|
|
2635 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2636 | { |
|
|
2637 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2638 | break; |
|
|
2639 | } |
|
|
2640 | } |
|
|
2641 | |
|
|
2642 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2643 | { |
|
|
2644 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2645 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2646 | am_transparent = 0; |
|
|
2647 | /* XXX: also turn off Opt_transparent? */ |
|
|
2648 | } |
|
|
2649 | else |
|
|
2650 | { |
|
|
2651 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2652 | { |
|
|
2653 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2654 | XClearWindow (dpy, parent[n]); |
|
|
2655 | } |
|
|
2656 | |
|
|
2657 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2658 | am_transparent = 1; |
|
|
2659 | } |
|
|
2660 | |
|
|
2661 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2662 | parent[i] = None; |
|
|
2663 | } |
|
|
2664 | |
|
|
2665 | if (scrollBar.win) |
|
|
2666 | { |
|
|
2667 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2668 | scrollBar.setIdle (); |
|
|
2669 | scrollbar_show (0); |
|
|
2670 | } |
|
|
2671 | |
|
|
2672 | if (am_transparent) |
|
|
2673 | { |
|
|
2674 | want_refresh = want_full_refresh = 1; |
|
|
2675 | if (am_pixmap_trans) |
|
|
2676 | flush (); |
|
|
2677 | } |
|
|
2678 | |
|
|
2679 | return pchanged; |
|
|
2680 | } |
|
|
2681 | #endif |
|
|
2682 | |
|
|
2683 | /*}}} */ |
2220 | /*}}} */ |
2684 | |
2221 | |
2685 | bool |
2222 | bool |
2686 | rxvt_term::cmd_parse () |
2223 | rxvt_term::cmd_parse () |
2687 | { |
2224 | { |
… | |
… | |
2735 | if (ch == C0_LF) |
2272 | if (ch == C0_LF) |
2736 | nlines++; |
2273 | nlines++; |
2737 | |
2274 | |
2738 | refresh_count++; |
2275 | refresh_count++; |
2739 | |
2276 | |
2740 | if (!option (Opt_jumpScroll) |
2277 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2741 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2742 | { |
2278 | { |
2743 | refreshnow = true; |
|
|
2744 | refresh_count = 0; |
2279 | refresh_count = 0; |
|
|
2280 | |
|
|
2281 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
|
|
2282 | { |
|
|
2283 | refreshnow = true; |
2745 | ch = NOCHAR; |
2284 | ch = NOCHAR; |
2746 | break; |
2285 | break; |
|
|
2286 | } |
2747 | } |
2287 | } |
2748 | |
2288 | |
2749 | // scr_add_lines only works for nlines <= nrow - 1. |
2289 | // scr_add_lines only works for nlines <= nrow - 1. |
2750 | if (nlines >= nrow - 1) |
2290 | if (nlines >= nrow - 1) |
2751 | { |
2291 | { |
… | |
… | |
2779 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2319 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2780 | scr_add_lines (buf, str - buf, nlines); |
2320 | scr_add_lines (buf, str - buf, nlines); |
2781 | |
2321 | |
2782 | /* |
2322 | /* |
2783 | * If there have been a lot of new lines, then update the screen |
2323 | * If there have been a lot of new lines, then update the screen |
2784 | * What the heck I'll cheat and only refresh less than every page-full. |
2324 | * What the heck we'll cheat and only refresh less than every page-full. |
2785 | * the number of pages between refreshes is refresh_limit, which |
2325 | * if skipScroll is enabled. |
2786 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2787 | */ |
2326 | */ |
2788 | if (refreshnow) |
2327 | if (refreshnow) |
2789 | { |
2328 | { |
2790 | if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2791 | refresh_limit++; |
|
|
2792 | else |
|
|
2793 | { |
|
|
2794 | flag = true; |
2329 | flag = true; |
2795 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2796 | scr_refresh (); |
2330 | scr_refresh (); |
2797 | want_refresh = 1; |
2331 | want_refresh = 1; |
2798 | } |
|
|
2799 | } |
2332 | } |
2800 | |
2333 | |
2801 | } |
2334 | } |
2802 | else |
2335 | else |
2803 | { |
2336 | { |
… | |
… | |
2952 | { |
2485 | { |
2953 | if ((buf[len++] = cmd_getc ()) == 'i') |
2486 | if ((buf[len++] = cmd_getc ()) == 'i') |
2954 | break; /* done = 1 */ |
2487 | break; /* done = 1 */ |
2955 | } |
2488 | } |
2956 | } |
2489 | } |
2957 | |
2490 | |
2958 | for (i = 0; i < len; i++) |
2491 | for (i = 0; i < len; i++) |
2959 | if (putc (buf[i], fd) == EOF) |
2492 | if (putc (buf[i], fd) == EOF) |
2960 | { |
2493 | { |
2961 | done = 1; |
2494 | done = 1; |
2962 | break; |
2495 | break; |
… | |
… | |
3024 | process_dcs_seq (); |
2557 | process_dcs_seq (); |
3025 | break; |
2558 | break; |
3026 | case 0x9b: /* CSI */ |
2559 | case 0x9b: /* CSI */ |
3027 | process_csi_seq (); |
2560 | process_csi_seq (); |
3028 | break; |
2561 | break; |
3029 | case 0x9d: /* CSI */ |
2562 | case 0x9d: /* OSC */ |
3030 | process_osc_seq (); |
2563 | process_osc_seq (); |
3031 | break; |
2564 | break; |
3032 | #endif |
2565 | #endif |
3033 | } |
2566 | } |
3034 | } |
2567 | } |
… | |
… | |
3262 | unicode_t ch, priv, i; |
2795 | unicode_t ch, priv, i; |
3263 | unsigned int nargs, p; |
2796 | unsigned int nargs, p; |
3264 | int n, ndef; |
2797 | int n, ndef; |
3265 | int arg[ESC_ARGS]; |
2798 | int arg[ESC_ARGS]; |
3266 | |
2799 | |
3267 | for (nargs = ESC_ARGS; nargs > 0;) |
2800 | memset (arg, 0, sizeof (arg)); |
3268 | arg[--nargs] = 0; |
2801 | nargs = 0; |
3269 | |
2802 | |
3270 | priv = 0; |
2803 | priv = 0; |
3271 | ch = cmd_getc (); |
2804 | ch = cmd_getc (); |
3272 | if (ch >= '<' && ch <= '?') |
2805 | if (ch >= '<' && ch <= '?') |
3273 | { /* '<' '=' '>' '?' */ |
2806 | { /* '<' '=' '>' '?' */ |
… | |
… | |
3317 | switch (priv) |
2850 | switch (priv) |
3318 | { |
2851 | { |
3319 | case '>': |
2852 | case '>': |
3320 | if (ch == CSI_DA) /* secondary device attributes */ |
2853 | if (ch == CSI_DA) /* secondary device attributes */ |
3321 | { |
2854 | { |
3322 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2855 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3323 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2856 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3324 | // |
2857 | // |
3325 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2858 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3326 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2859 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
3327 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2860 | // that we do not support xterm mouse reporting (should be 95 when we do). |
… | |
… | |
3780 | int saveop = op; |
3313 | int saveop = op; |
3781 | |
3314 | |
3782 | dLocal (Display *, dpy); |
3315 | dLocal (Display *, dpy); |
3783 | |
3316 | |
3784 | assert (str != NULL); |
3317 | assert (str != NULL); |
3785 | |
3318 | |
3786 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3319 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3787 | return; |
3320 | return; |
3788 | |
3321 | |
3789 | switch (op) |
3322 | switch (op) |
3790 | { |
3323 | { |
… | |
… | |
3885 | break; |
3418 | break; |
3886 | case URxvt_Color_IT: |
3419 | case URxvt_Color_IT: |
3887 | process_color_seq (op, Color_IT, str, resp); |
3420 | process_color_seq (op, Color_IT, str, resp); |
3888 | break; |
3421 | break; |
3889 | #endif |
3422 | #endif |
3890 | #if TRANSPARENT && TINTING |
3423 | #if ENABLE_TRANSPARENCY |
3891 | case URxvt_Color_tint: |
3424 | case URxvt_Color_tint: |
3892 | process_color_seq (op, Color_tint, str, resp); |
3425 | process_color_seq (op, Color_tint, str, resp); |
|
|
3426 | { |
|
|
3427 | bool changed = false; |
|
|
3428 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3429 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3430 | else |
|
|
3431 | changed = bgPixmap.unset_tint (); |
|
|
3432 | if (changed) |
|
|
3433 | bgPixmap.render (); |
|
|
3434 | } |
3893 | |
3435 | |
3894 | check_our_parents (); |
|
|
3895 | |
|
|
3896 | if (am_transparent) |
|
|
3897 | want_full_refresh = want_refresh = 1; |
|
|
3898 | |
|
|
3899 | break; |
3436 | break; |
3900 | #endif |
3437 | #endif |
3901 | |
3438 | |
|
|
3439 | #if XPM_BACKGROUND |
3902 | case Rxvt_Pixmap: |
3440 | case Rxvt_Pixmap: |
|
|
3441 | if (!strcmp (str, "?")) |
3903 | { |
3442 | { |
|
|
3443 | char str[256]; |
|
|
3444 | |
|
|
3445 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
|
|
3446 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
|
|
3447 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3448 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
|
|
3449 | } |
|
|
3450 | else |
|
|
3451 | { |
|
|
3452 | int changed = 0; |
|
|
3453 | |
3904 | if (*str != ';') |
3454 | if (*str != ';') |
3905 | { |
3455 | { |
3906 | #if XPM_BACKGROUND |
|
|
3907 | scale_pixmap (""); /* reset to default scaling */ |
3456 | /* reset to default scaling :*/ |
|
|
3457 | bgPixmap.unset_geometry (); |
3908 | set_bgPixmap (str); /* change pixmap */ |
3458 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3459 | changed++; |
|
|
3460 | str = strchr (str, ';'); |
|
|
3461 | if (str == NULL) |
|
|
3462 | bgPixmap.set_defaultGeometry (); |
|
|
3463 | } |
|
|
3464 | while (str) |
|
|
3465 | { |
|
|
3466 | str++; |
|
|
3467 | if (bgPixmap.set_geometry (str)) |
|
|
3468 | changed++; |
|
|
3469 | str = strchr (str, ';'); |
|
|
3470 | } |
|
|
3471 | if (changed) |
|
|
3472 | { |
|
|
3473 | bgPixmap.render (); |
3909 | scr_touch (true); |
3474 | scr_touch (true); |
3910 | #endif |
|
|
3911 | } |
3475 | } |
3912 | |
|
|
3913 | int changed = 0; |
|
|
3914 | |
|
|
3915 | while ((str = strchr (str, ';')) != NULL) |
|
|
3916 | { |
|
|
3917 | str++; |
|
|
3918 | #if XPM_BACKGROUND |
|
|
3919 | changed += scale_pixmap (str); |
|
|
3920 | #endif |
|
|
3921 | } |
3476 | } |
3922 | |
|
|
3923 | if (changed) |
|
|
3924 | { |
|
|
3925 | #ifdef XPM_BACKGROUND |
|
|
3926 | resize_pixmap (); |
|
|
3927 | scr_touch (true); |
|
|
3928 | #endif |
|
|
3929 | } |
|
|
3930 | } |
|
|
3931 | break; |
3477 | break; |
|
|
3478 | #endif |
3932 | |
3479 | |
3933 | case Rxvt_restoreFG: |
3480 | case Rxvt_restoreFG: |
3934 | set_window_color (Color_fg, str); |
3481 | set_window_color (Color_fg, str); |
3935 | break; |
3482 | break; |
3936 | case Rxvt_restoreBG: |
3483 | case Rxvt_restoreBG: |
… | |
… | |
4058 | { |
3605 | { |
4059 | unsigned int i, j; |
3606 | unsigned int i, j; |
4060 | int state; |
3607 | int state; |
4061 | |
3608 | |
4062 | static const struct |
3609 | static const struct |
4063 | { |
3610 | { |
4064 | const int argval; |
3611 | const int argval; |
4065 | const unsigned long bit; |
3612 | const unsigned long bit; |
4066 | } |
|
|
4067 | |
|
|
4068 | argtopriv[] = { |
3613 | } argtopriv[] = { |
4069 | { 1, PrivMode_aplCUR }, |
3614 | { 1, PrivMode_aplCUR }, |
4070 | { 2, PrivMode_vt52 }, |
3615 | { 2, PrivMode_vt52 }, |
4071 | { 3, PrivMode_132 }, |
3616 | { 3, PrivMode_132 }, |
4072 | { 4, PrivMode_smoothScroll }, |
3617 | { 4, PrivMode_smoothScroll }, |
4073 | { 5, PrivMode_rVideo }, |
3618 | { 5, PrivMode_rVideo }, |