… | |
… | |
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: |
… | |
… | |
1472 | && ev.xfocus.mode != NotifyGrab) |
1474 | && ev.xfocus.mode != NotifyGrab) |
1473 | focus_out (); |
1475 | focus_out (); |
1474 | break; |
1476 | break; |
1475 | |
1477 | |
1476 | case ConfigureNotify: |
1478 | case ConfigureNotify: |
|
|
1479 | /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", |
|
|
1480 | ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, |
|
|
1481 | szHint.width, szHint.height);*/ |
1477 | if (ev.xconfigure.window == parent[0]) |
1482 | if (ev.xconfigure.window == parent[0]) |
1478 | { |
1483 | { |
1479 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1484 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1480 | ; |
1485 | ; |
1481 | |
1486 | |
1482 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1487 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1483 | { |
1488 | { |
1484 | seen_resize = 1; |
1489 | seen_resize = 1; |
1485 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1490 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1486 | } |
1491 | } |
1487 | |
1492 | else |
|
|
1493 | { |
|
|
1494 | #ifdef ENABLE_TRANSPARENCY |
|
|
1495 | if (option (Opt_transparent)) |
|
|
1496 | update_background (); |
|
|
1497 | #endif |
|
|
1498 | } |
1488 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1499 | 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 | } |
1500 | } |
1495 | break; |
1501 | break; |
1496 | |
1502 | |
1497 | case PropertyNotify: |
1503 | case PropertyNotify: |
1498 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1504 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1529 | text_blink_ev.stop (); |
1535 | text_blink_ev.stop (); |
1530 | #endif |
1536 | #endif |
1531 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1537 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1532 | break; |
1538 | break; |
1533 | |
1539 | |
1534 | #ifdef TRANSPARENT |
1540 | #ifdef ENABLE_TRANSPARENCY |
1535 | case ReparentNotify: |
1541 | case ReparentNotify: |
1536 | rootwin_cb (ev); |
1542 | rootwin_cb (ev); |
1537 | break; |
1543 | break; |
1538 | #endif /* TRANSPARENT */ |
1544 | #endif /* ENABLE_TRANSPARENCY */ |
1539 | |
1545 | |
1540 | case GraphicsExpose: |
1546 | case GraphicsExpose: |
1541 | case Expose: |
1547 | case Expose: |
1542 | if (ev.xany.window == vt) |
1548 | if (ev.xany.window == vt) |
1543 | { |
1549 | { |
… | |
… | |
1566 | if (isScrollbarWindow (ev.xany.window)) |
1572 | if (isScrollbarWindow (ev.xany.window)) |
1567 | { |
1573 | { |
1568 | scrollBar.setIdle (); |
1574 | scrollBar.setIdle (); |
1569 | scrollbar_show (0); |
1575 | scrollbar_show (0); |
1570 | } |
1576 | } |
1571 | |
|
|
1572 | #ifdef TRANSPARENT |
|
|
1573 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1574 | XClearWindow (dpy, ev.xany.window); |
|
|
1575 | #endif |
|
|
1576 | } |
1577 | } |
1577 | break; |
1578 | break; |
1578 | |
1579 | |
1579 | case MotionNotify: |
1580 | case MotionNotify: |
1580 | #ifdef POINTER_BLANK |
1581 | #ifdef POINTER_BLANK |
… | |
… | |
1678 | &ev.xbutton.x, &ev.xbutton.y, |
1679 | &ev.xbutton.x, &ev.xbutton.y, |
1679 | &unused_mask); |
1680 | &unused_mask); |
1680 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1681 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1681 | scrollbar_size ()); |
1682 | scrollbar_size ()); |
1682 | want_refresh = 1; |
1683 | want_refresh = 1; |
1683 | refresh_limit = 0; |
|
|
1684 | scrollbar_show (1); |
1684 | scrollbar_show (1); |
1685 | } |
1685 | } |
1686 | break; |
1686 | break; |
1687 | } |
1687 | } |
1688 | |
1688 | |
… | |
… | |
1770 | |
1770 | |
1771 | #if ENABLE_FRILLS || ISO_14755 |
1771 | #if ENABLE_FRILLS || ISO_14755 |
1772 | if (iso14755buf) |
1772 | if (iso14755buf) |
1773 | { |
1773 | { |
1774 | iso14755buf = 0; |
1774 | iso14755buf = 0; |
1775 | # if ENABLE_OVERLAY |
1775 | # if ISO_14755 |
1776 | scr_overlay_off (); |
1776 | scr_overlay_off (); |
1777 | # endif |
1777 | # endif |
1778 | } |
1778 | } |
1779 | #endif |
1779 | #endif |
1780 | #if USE_XIM |
1780 | #if USE_XIM |
… | |
… | |
1807 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1807 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1808 | } |
1808 | } |
1809 | #endif |
1809 | #endif |
1810 | } |
1810 | } |
1811 | |
1811 | |
1812 | #if TRANSPARENT || ENABLE_PERL |
1812 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1813 | void |
1813 | void |
1814 | rxvt_term::rootwin_cb (XEvent &ev) |
1814 | rxvt_term::rootwin_cb (XEvent &ev) |
1815 | { |
1815 | { |
1816 | make_current (); |
1816 | make_current (); |
1817 | |
1817 | |
1818 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1818 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
1819 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1819 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
1820 | return; |
1820 | return; |
1821 | |
1821 | |
1822 | # if TRANSPARENT |
1822 | # if ENABLE_TRANSPARENCY |
1823 | switch (ev.type) |
1823 | switch (ev.type) |
1824 | { |
1824 | { |
1825 | case PropertyNotify: |
1825 | case PropertyNotify: |
1826 | /* |
1826 | /* |
1827 | * if user used some Esetroot compatible prog to set the root bg, |
1827 | * if user used some Esetroot compatible prog to set the root bg, |
1828 | * use the property to determine the pixmap. We use it later on. |
1828 | * use the property to determine the pixmap. We use it later on. |
1829 | */ |
1829 | */ |
1830 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1830 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1831 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1831 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1832 | return; |
1832 | { |
1833 | |
1833 | bgPixmap.set_root_pixmap (); |
1834 | /* FALLTHROUGH */ |
1834 | update_background (); |
1835 | case ReparentNotify: |
1835 | } |
1836 | if (option (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1837 | want_refresh = want_full_refresh = 1; |
|
|
1838 | break; |
1836 | break; |
1839 | } |
1837 | } |
1840 | # endif |
1838 | # endif |
1841 | } |
1839 | } |
1842 | #endif |
1840 | #endif |
… | |
… | |
2219 | #endif |
2217 | #endif |
2220 | } |
2218 | } |
2221 | } |
2219 | } |
2222 | } |
2220 | } |
2223 | |
2221 | |
2224 | #ifdef TRANSPARENT |
|
|
2225 | #if TINTING |
|
|
2226 | /* taken from aterm-0.4.2 */ |
|
|
2227 | |
|
|
2228 | typedef uint32_t RUINT32T; |
|
|
2229 | |
|
|
2230 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2231 | { |
|
|
2232 | int sh_r, sh_g, sh_b; |
|
|
2233 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2234 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2235 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2236 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2237 | int i; |
|
|
2238 | |
|
|
2239 | Visual *visual = term->visual; |
|
|
2240 | |
|
|
2241 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2242 | |
|
|
2243 | /* for convenience */ |
|
|
2244 | mask_r = visual->red_mask; |
|
|
2245 | mask_g = visual->green_mask; |
|
|
2246 | mask_b = visual->blue_mask; |
|
|
2247 | |
|
|
2248 | /* boring lookup table pre-initialization */ |
|
|
2249 | switch (srcImage->bits_per_pixel) { |
|
|
2250 | case 15: |
|
|
2251 | if ((mask_r != 0x7c00) || |
|
|
2252 | (mask_g != 0x03e0) || |
|
|
2253 | (mask_b != 0x001f)) |
|
|
2254 | return; |
|
|
2255 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2256 | lookup_r = lookup; |
|
|
2257 | lookup_g = lookup+32; |
|
|
2258 | lookup_b = lookup+32+32; |
|
|
2259 | sh_r = 10; |
|
|
2260 | sh_g = 5; |
|
|
2261 | sh_b = 0; |
|
|
2262 | break; |
|
|
2263 | case 16: |
|
|
2264 | if ((mask_r != 0xf800) || |
|
|
2265 | (mask_g != 0x07e0) || |
|
|
2266 | (mask_b != 0x001f)) |
|
|
2267 | return; |
|
|
2268 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2269 | lookup_r = lookup; |
|
|
2270 | lookup_g = lookup+32; |
|
|
2271 | lookup_b = lookup+32+64; |
|
|
2272 | sh_r = 11; |
|
|
2273 | sh_g = 5; |
|
|
2274 | sh_b = 0; |
|
|
2275 | break; |
|
|
2276 | case 24: |
|
|
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 | case 32: |
|
|
2290 | if ((mask_r != 0xff0000) || |
|
|
2291 | (mask_g != 0x00ff00) || |
|
|
2292 | (mask_b != 0x0000ff)) |
|
|
2293 | return; |
|
|
2294 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2295 | lookup_r = lookup; |
|
|
2296 | lookup_g = lookup+256; |
|
|
2297 | lookup_b = lookup+256+256; |
|
|
2298 | sh_r = 16; |
|
|
2299 | sh_g = 8; |
|
|
2300 | sh_b = 0; |
|
|
2301 | break; |
|
|
2302 | default: |
|
|
2303 | return; /* we do not support this color depth */ |
|
|
2304 | } |
|
|
2305 | |
|
|
2306 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2307 | if (shade < 0) { |
|
|
2308 | shade = -shade; |
|
|
2309 | if (shade < 0) shade = 0; |
|
|
2310 | if (shade > 100) shade = 100; |
|
|
2311 | |
|
|
2312 | lower_lim_r = 65535-rm; |
|
|
2313 | lower_lim_g = 65535-gm; |
|
|
2314 | lower_lim_b = 65535-bm; |
|
|
2315 | |
|
|
2316 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2317 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2318 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2319 | |
|
|
2320 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2321 | } else { |
|
|
2322 | if (shade < 0) shade = 0; |
|
|
2323 | if (shade > 100) shade = 100; |
|
|
2324 | |
|
|
2325 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2326 | |
|
|
2327 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2328 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2329 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2330 | } |
|
|
2331 | |
|
|
2332 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2333 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2334 | { |
|
|
2335 | unsigned int tmp; |
|
|
2336 | |
|
|
2337 | tmp = lower_lim_r; |
|
|
2338 | lower_lim_r = lower_lim_b; |
|
|
2339 | lower_lim_b = tmp; |
|
|
2340 | |
|
|
2341 | tmp = upper_lim_r; |
|
|
2342 | upper_lim_r = upper_lim_b; |
|
|
2343 | upper_lim_b = tmp; |
|
|
2344 | } |
|
|
2345 | |
|
|
2346 | /* fill our lookup tables */ |
|
|
2347 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2348 | { |
|
|
2349 | RUINT32T tmp; |
|
|
2350 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2351 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2352 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2353 | } |
|
|
2354 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2355 | { |
|
|
2356 | RUINT32T tmp; |
|
|
2357 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2358 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2359 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2360 | } |
|
|
2361 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2362 | { |
|
|
2363 | RUINT32T tmp; |
|
|
2364 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2365 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2366 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2367 | } |
|
|
2368 | |
|
|
2369 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2370 | switch (srcImage->bits_per_pixel) |
|
|
2371 | { |
|
|
2372 | case 15: |
|
|
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 & 0x7c00)>>10] | |
|
|
2384 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2385 | lookup_b[(*p & 0x001f)]; |
|
|
2386 | } |
|
|
2387 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2388 | } |
|
|
2389 | break; |
|
|
2390 | } |
|
|
2391 | case 16: |
|
|
2392 | { |
|
|
2393 | unsigned short *p1, *pf, *p, *pl; |
|
|
2394 | p1 = (unsigned short *) srcImage->data; |
|
|
2395 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2396 | while (p1 < pf) |
|
|
2397 | { |
|
|
2398 | p = p1; |
|
|
2399 | pl = p1 + srcImage->width; |
|
|
2400 | for (; p < pl; p++) |
|
|
2401 | { |
|
|
2402 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2403 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2404 | lookup_b[(*p & 0x001f)]; |
|
|
2405 | } |
|
|
2406 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2407 | } |
|
|
2408 | break; |
|
|
2409 | } |
|
|
2410 | case 24: |
|
|
2411 | { |
|
|
2412 | unsigned char *p1, *pf, *p, *pl; |
|
|
2413 | p1 = (unsigned char *) srcImage->data; |
|
|
2414 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2415 | while (p1 < pf) |
|
|
2416 | { |
|
|
2417 | p = p1; |
|
|
2418 | pl = p1 + srcImage->width * 3; |
|
|
2419 | for (; p < pl; p += 3) |
|
|
2420 | { |
|
|
2421 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2422 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2423 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2424 | } |
|
|
2425 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2426 | } |
|
|
2427 | break; |
|
|
2428 | } |
|
|
2429 | case 32: |
|
|
2430 | { |
|
|
2431 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2432 | p1 = (RUINT32T *) srcImage->data; |
|
|
2433 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2434 | |
|
|
2435 | while (p1 < pf) |
|
|
2436 | { |
|
|
2437 | p = p1; |
|
|
2438 | pl = p1 + srcImage->width; |
|
|
2439 | for (; p < pl; p++) |
|
|
2440 | { |
|
|
2441 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2442 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2443 | lookup_b[(*p & 0x0000ff)] | |
|
|
2444 | (*p & ~0xffffff); |
|
|
2445 | } |
|
|
2446 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2447 | } |
|
|
2448 | break; |
|
|
2449 | } |
|
|
2450 | } |
|
|
2451 | |
|
|
2452 | free (lookup); |
|
|
2453 | } |
|
|
2454 | #endif |
|
|
2455 | |
|
|
2456 | /* |
|
|
2457 | * Check our parents are still who we think they are. |
|
|
2458 | * Do transparency updates if required |
|
|
2459 | */ |
|
|
2460 | int |
|
|
2461 | rxvt_term::check_our_parents () |
|
|
2462 | { |
|
|
2463 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2464 | unsigned long nitems, bytes_after; |
|
|
2465 | Atom atype; |
|
|
2466 | unsigned char *prop = NULL; |
|
|
2467 | Window root, oldp, *list; |
|
|
2468 | Pixmap rootpixmap = None; |
|
|
2469 | XWindowAttributes wattr, wrootattr; |
|
|
2470 | |
|
|
2471 | pchanged = 0; |
|
|
2472 | |
|
|
2473 | if (!option (Opt_transparent)) |
|
|
2474 | return pchanged; /* Don't try any more */ |
|
|
2475 | |
|
|
2476 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2477 | rootdepth = wrootattr.depth; |
|
|
2478 | |
|
|
2479 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2480 | |
|
|
2481 | if (rootdepth != wattr.depth) |
|
|
2482 | { |
|
|
2483 | if (am_transparent) |
|
|
2484 | { |
|
|
2485 | pchanged = 1; |
|
|
2486 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2487 | am_transparent = am_pixmap_trans = 0; |
|
|
2488 | } |
|
|
2489 | |
|
|
2490 | return pchanged; /* Don't try any more */ |
|
|
2491 | } |
|
|
2492 | |
|
|
2493 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2494 | XSync (dpy, False); |
|
|
2495 | |
|
|
2496 | /* |
|
|
2497 | * Make the frame window set by the window manager have |
|
|
2498 | * the root background. Some window managers put multiple nested frame |
|
|
2499 | * windows for each client, so we have to take care about that. |
|
|
2500 | */ |
|
|
2501 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2502 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2503 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2504 | &nitems, &bytes_after, &prop) == Success); |
|
|
2505 | |
|
|
2506 | if (!i || prop == NULL) |
|
|
2507 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2508 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2509 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2510 | &nitems, &bytes_after, &prop) == Success); |
|
|
2511 | |
|
|
2512 | if (!i || prop == NULL |
|
|
2513 | #if TINTING |
|
|
2514 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2515 | #endif |
|
|
2516 | ) |
|
|
2517 | have_pixmap = 0; |
|
|
2518 | else |
|
|
2519 | { |
|
|
2520 | have_pixmap = 1; |
|
|
2521 | rootpixmap = *(Pixmap *)prop; |
|
|
2522 | XFree (prop); |
|
|
2523 | } |
|
|
2524 | |
|
|
2525 | if (have_pixmap) |
|
|
2526 | { |
|
|
2527 | /* |
|
|
2528 | * Copy display->root pixmap transparency |
|
|
2529 | */ |
|
|
2530 | int sx, sy, nx, ny; |
|
|
2531 | unsigned int nw, nh; |
|
|
2532 | Window cr; |
|
|
2533 | XImage *image; |
|
|
2534 | GC gc; |
|
|
2535 | XGCValues gcvalue; |
|
|
2536 | |
|
|
2537 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2538 | 0, 0, &sx, &sy, &cr); |
|
|
2539 | nw = (unsigned int)szHint.width; |
|
|
2540 | nh = (unsigned int)szHint.height; |
|
|
2541 | nx = ny = 0; |
|
|
2542 | |
|
|
2543 | if (sx < 0) |
|
|
2544 | { |
|
|
2545 | nw += sx; |
|
|
2546 | nx = -sx; |
|
|
2547 | sx = 0; |
|
|
2548 | } |
|
|
2549 | |
|
|
2550 | if (sy < 0) |
|
|
2551 | { |
|
|
2552 | nh += sy; |
|
|
2553 | ny = -sy; |
|
|
2554 | sy = 0; |
|
|
2555 | } |
|
|
2556 | |
|
|
2557 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2558 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2559 | |
|
|
2560 | XSync (dpy, False); |
|
|
2561 | allowedxerror = -1; |
|
|
2562 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2563 | |
|
|
2564 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2565 | /* XXX: may need a delay here? */ |
|
|
2566 | allowedxerror = 0; |
|
|
2567 | |
|
|
2568 | if (image == NULL) |
|
|
2569 | { |
|
|
2570 | if (am_transparent && am_pixmap_trans) |
|
|
2571 | { |
|
|
2572 | pchanged = 1; |
|
|
2573 | if (pixmap != None) |
|
|
2574 | { |
|
|
2575 | XFreePixmap (dpy, pixmap); |
|
|
2576 | pixmap = None; |
|
|
2577 | } |
|
|
2578 | } |
|
|
2579 | |
|
|
2580 | am_pixmap_trans = 0; |
|
|
2581 | } |
|
|
2582 | else |
|
|
2583 | { |
|
|
2584 | if (pixmap != None) |
|
|
2585 | XFreePixmap (dpy, pixmap); |
|
|
2586 | |
|
|
2587 | #if TINTING |
|
|
2588 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2589 | { |
|
|
2590 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2591 | |
|
|
2592 | rgba c; |
|
|
2593 | pix_colors_focused [Color_tint].get (c); |
|
|
2594 | |
|
|
2595 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2596 | } |
|
|
2597 | #endif |
|
|
2598 | |
|
|
2599 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2600 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2601 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2602 | nx, ny, image->width, image->height); |
|
|
2603 | XFreeGC (dpy, gc); |
|
|
2604 | XDestroyImage (image); |
|
|
2605 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2606 | XClearWindow (dpy, parent[0]); |
|
|
2607 | |
|
|
2608 | if (!am_transparent || !am_pixmap_trans) |
|
|
2609 | pchanged = 1; |
|
|
2610 | |
|
|
2611 | am_transparent = am_pixmap_trans = 1; |
|
|
2612 | } |
|
|
2613 | } |
|
|
2614 | |
|
|
2615 | if (am_pixmap_trans) |
|
|
2616 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2617 | else |
|
|
2618 | { |
|
|
2619 | unsigned int n; |
|
|
2620 | /* |
|
|
2621 | * InheritPixmap transparency |
|
|
2622 | */ |
|
|
2623 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2624 | { |
|
|
2625 | oldp = parent[i]; |
|
|
2626 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2627 | XFree (list); |
|
|
2628 | |
|
|
2629 | if (parent[i] == display->root) |
|
|
2630 | { |
|
|
2631 | if (oldp != None) |
|
|
2632 | pchanged = 1; |
|
|
2633 | |
|
|
2634 | break; |
|
|
2635 | } |
|
|
2636 | |
|
|
2637 | if (oldp != parent[i]) |
|
|
2638 | pchanged = 1; |
|
|
2639 | } |
|
|
2640 | |
|
|
2641 | n = 0; |
|
|
2642 | |
|
|
2643 | if (pchanged) |
|
|
2644 | for (; n < (unsigned int)i; n++) |
|
|
2645 | { |
|
|
2646 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2647 | |
|
|
2648 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2649 | { |
|
|
2650 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2651 | break; |
|
|
2652 | } |
|
|
2653 | } |
|
|
2654 | |
|
|
2655 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2656 | { |
|
|
2657 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2658 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2659 | am_transparent = 0; |
|
|
2660 | /* XXX: also turn off Opt_transparent? */ |
|
|
2661 | } |
|
|
2662 | else |
|
|
2663 | { |
|
|
2664 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2665 | { |
|
|
2666 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2667 | XClearWindow (dpy, parent[n]); |
|
|
2668 | } |
|
|
2669 | |
|
|
2670 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2671 | am_transparent = 1; |
|
|
2672 | } |
|
|
2673 | |
|
|
2674 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2675 | parent[i] = None; |
|
|
2676 | } |
|
|
2677 | |
|
|
2678 | if (scrollBar.win) |
|
|
2679 | { |
|
|
2680 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2681 | scrollBar.setIdle (); |
|
|
2682 | scrollbar_show (0); |
|
|
2683 | } |
|
|
2684 | |
|
|
2685 | if (am_transparent) |
|
|
2686 | { |
|
|
2687 | want_refresh = want_full_refresh = 1; |
|
|
2688 | if (am_pixmap_trans) |
|
|
2689 | flush (); |
|
|
2690 | } |
|
|
2691 | |
|
|
2692 | return pchanged; |
|
|
2693 | } |
|
|
2694 | #endif |
|
|
2695 | |
|
|
2696 | /*}}} */ |
2222 | /*}}} */ |
2697 | |
2223 | |
2698 | bool |
2224 | bool |
2699 | rxvt_term::cmd_parse () |
2225 | rxvt_term::cmd_parse () |
2700 | { |
2226 | { |
… | |
… | |
2748 | if (ch == C0_LF) |
2274 | if (ch == C0_LF) |
2749 | nlines++; |
2275 | nlines++; |
2750 | |
2276 | |
2751 | refresh_count++; |
2277 | refresh_count++; |
2752 | |
2278 | |
2753 | if (!option (Opt_jumpScroll) |
2279 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2754 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2755 | { |
2280 | { |
2756 | refreshnow = true; |
|
|
2757 | refresh_count = 0; |
2281 | refresh_count = 0; |
|
|
2282 | |
|
|
2283 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
|
|
2284 | { |
|
|
2285 | refreshnow = true; |
2758 | ch = NOCHAR; |
2286 | ch = NOCHAR; |
2759 | break; |
2287 | break; |
|
|
2288 | } |
2760 | } |
2289 | } |
2761 | |
2290 | |
2762 | // scr_add_lines only works for nlines <= nrow - 1. |
2291 | // scr_add_lines only works for nlines <= nrow - 1. |
2763 | if (nlines >= nrow - 1) |
2292 | if (nlines >= nrow - 1) |
2764 | { |
2293 | { |
… | |
… | |
2792 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2321 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2793 | scr_add_lines (buf, str - buf, nlines); |
2322 | scr_add_lines (buf, str - buf, nlines); |
2794 | |
2323 | |
2795 | /* |
2324 | /* |
2796 | * If there have been a lot of new lines, then update the screen |
2325 | * If there have been a lot of new lines, then update the screen |
2797 | * What the heck I'll cheat and only refresh less than every page-full. |
2326 | * What the heck we'll cheat and only refresh less than every page-full. |
2798 | * the number of pages between refreshes is refresh_limit, which |
2327 | * if skipScroll is enabled. |
2799 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2800 | */ |
2328 | */ |
2801 | if (refreshnow) |
2329 | if (refreshnow) |
2802 | { |
2330 | { |
2803 | if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2804 | refresh_limit++; |
|
|
2805 | else |
|
|
2806 | { |
|
|
2807 | flag = true; |
2331 | flag = true; |
2808 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2809 | scr_refresh (); |
2332 | scr_refresh (); |
2810 | want_refresh = 1; |
2333 | want_refresh = 1; |
2811 | } |
|
|
2812 | } |
2334 | } |
2813 | |
2335 | |
2814 | } |
2336 | } |
2815 | else |
2337 | else |
2816 | { |
2338 | { |
… | |
… | |
2965 | { |
2487 | { |
2966 | if ((buf[len++] = cmd_getc ()) == 'i') |
2488 | if ((buf[len++] = cmd_getc ()) == 'i') |
2967 | break; /* done = 1 */ |
2489 | break; /* done = 1 */ |
2968 | } |
2490 | } |
2969 | } |
2491 | } |
2970 | |
2492 | |
2971 | for (i = 0; i < len; i++) |
2493 | for (i = 0; i < len; i++) |
2972 | if (putc (buf[i], fd) == EOF) |
2494 | if (putc (buf[i], fd) == EOF) |
2973 | { |
2495 | { |
2974 | done = 1; |
2496 | done = 1; |
2975 | break; |
2497 | break; |
… | |
… | |
3037 | process_dcs_seq (); |
2559 | process_dcs_seq (); |
3038 | break; |
2560 | break; |
3039 | case 0x9b: /* CSI */ |
2561 | case 0x9b: /* CSI */ |
3040 | process_csi_seq (); |
2562 | process_csi_seq (); |
3041 | break; |
2563 | break; |
3042 | case 0x9d: /* CSI */ |
2564 | case 0x9d: /* OSC */ |
3043 | process_osc_seq (); |
2565 | process_osc_seq (); |
3044 | break; |
2566 | break; |
3045 | #endif |
2567 | #endif |
3046 | } |
2568 | } |
3047 | } |
2569 | } |
… | |
… | |
3273 | rxvt_term::process_csi_seq () |
2795 | rxvt_term::process_csi_seq () |
3274 | { |
2796 | { |
3275 | unicode_t ch, priv, i; |
2797 | unicode_t ch, priv, i; |
3276 | unsigned int nargs, p; |
2798 | unsigned int nargs, p; |
3277 | int n, ndef; |
2799 | int n, ndef; |
3278 | int arg[ESC_ARGS]; |
2800 | int arg[ESC_ARGS] = { }; |
3279 | |
2801 | |
3280 | for (nargs = ESC_ARGS; nargs > 0;) |
2802 | nargs = 0; |
3281 | arg[--nargs] = 0; |
|
|
3282 | |
2803 | |
3283 | priv = 0; |
2804 | priv = 0; |
3284 | ch = cmd_getc (); |
2805 | ch = cmd_getc (); |
3285 | if (ch >= '<' && ch <= '?') |
2806 | if (ch >= '<' && ch <= '?') |
3286 | { /* '<' '=' '>' '?' */ |
2807 | { /* '<' '=' '>' '?' */ |
… | |
… | |
3330 | switch (priv) |
2851 | switch (priv) |
3331 | { |
2852 | { |
3332 | case '>': |
2853 | case '>': |
3333 | if (ch == CSI_DA) /* secondary device attributes */ |
2854 | if (ch == CSI_DA) /* secondary device attributes */ |
3334 | { |
2855 | { |
3335 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2856 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3336 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2857 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3337 | // |
2858 | // |
3338 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2859 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3339 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2860 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
3340 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2861 | // that we do not support xterm mouse reporting (should be 95 when we do). |
… | |
… | |
3793 | int saveop = op; |
3314 | int saveop = op; |
3794 | |
3315 | |
3795 | dLocal (Display *, dpy); |
3316 | dLocal (Display *, dpy); |
3796 | |
3317 | |
3797 | assert (str != NULL); |
3318 | assert (str != NULL); |
3798 | |
3319 | |
3799 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3320 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3800 | return; |
3321 | return; |
3801 | |
3322 | |
3802 | switch (op) |
3323 | switch (op) |
3803 | { |
3324 | { |
… | |
… | |
3898 | break; |
3419 | break; |
3899 | case URxvt_Color_IT: |
3420 | case URxvt_Color_IT: |
3900 | process_color_seq (op, Color_IT, str, resp); |
3421 | process_color_seq (op, Color_IT, str, resp); |
3901 | break; |
3422 | break; |
3902 | #endif |
3423 | #endif |
3903 | #if TRANSPARENT && TINTING |
3424 | #if ENABLE_TRANSPARENCY |
3904 | case URxvt_Color_tint: |
3425 | case URxvt_Color_tint: |
3905 | process_color_seq (op, Color_tint, str, resp); |
3426 | process_color_seq (op, Color_tint, str, resp); |
|
|
3427 | { |
|
|
3428 | bool changed = false; |
|
|
3429 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3430 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3431 | else |
|
|
3432 | changed = bgPixmap.unset_tint (); |
|
|
3433 | if (changed) |
|
|
3434 | update_background (); |
|
|
3435 | } |
3906 | |
3436 | |
3907 | check_our_parents (); |
|
|
3908 | |
|
|
3909 | if (am_transparent) |
|
|
3910 | want_full_refresh = want_refresh = 1; |
|
|
3911 | |
|
|
3912 | break; |
3437 | break; |
3913 | #endif |
3438 | #endif |
3914 | |
3439 | |
|
|
3440 | #if XPM_BACKGROUND |
3915 | case Rxvt_Pixmap: |
3441 | case Rxvt_Pixmap: |
3916 | { |
3442 | if (!strcmp (str, "?")) |
3917 | if (*str != ';') |
|
|
3918 | { |
3443 | { |
3919 | #if XPM_BACKGROUND |
3444 | char str[256]; |
3920 | scale_pixmap (""); /* reset to default scaling */ |
3445 | |
3921 | set_bgPixmap (str); /* change pixmap */ |
3446 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3922 | scr_touch (true); |
3447 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3923 | #endif |
3448 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3449 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3924 | } |
3450 | } |
3925 | |
3451 | else |
|
|
3452 | { |
3926 | int changed = 0; |
3453 | int changed = 0; |
3927 | |
3454 | |
3928 | while ((str = strchr (str, ';')) != NULL) |
3455 | if (*str != ';') |
3929 | { |
3456 | { |
|
|
3457 | /* reset to default scaling :*/ |
|
|
3458 | bgPixmap.unset_geometry (); |
|
|
3459 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3460 | changed++; |
|
|
3461 | str = strchr (str, ';'); |
|
|
3462 | if (str == NULL) |
|
|
3463 | bgPixmap.set_defaultGeometry (); |
|
|
3464 | } |
|
|
3465 | while (str) |
|
|
3466 | { |
3930 | str++; |
3467 | str++; |
3931 | #if XPM_BACKGROUND |
3468 | if (bgPixmap.set_geometry (str)) |
3932 | changed += scale_pixmap (str); |
3469 | changed++; |
3933 | #endif |
3470 | str = strchr (str, ';'); |
3934 | } |
3471 | } |
3935 | |
|
|
3936 | if (changed) |
3472 | if (changed) |
3937 | { |
3473 | update_background (); |
3938 | #ifdef XPM_BACKGROUND |
|
|
3939 | resize_pixmap (); |
|
|
3940 | scr_touch (true); |
|
|
3941 | #endif |
|
|
3942 | } |
3474 | } |
3943 | } |
|
|
3944 | break; |
3475 | break; |
|
|
3476 | #endif |
3945 | |
3477 | |
3946 | case Rxvt_restoreFG: |
3478 | case Rxvt_restoreFG: |
3947 | set_window_color (Color_fg, str); |
3479 | set_window_color (Color_fg, str); |
3948 | break; |
3480 | break; |
3949 | case Rxvt_restoreBG: |
3481 | case Rxvt_restoreBG: |
… | |
… | |
4071 | { |
3603 | { |
4072 | unsigned int i, j; |
3604 | unsigned int i, j; |
4073 | int state; |
3605 | int state; |
4074 | |
3606 | |
4075 | static const struct |
3607 | static const struct |
4076 | { |
3608 | { |
4077 | const int argval; |
3609 | const int argval; |
4078 | const unsigned long bit; |
3610 | const unsigned long bit; |
4079 | } |
|
|
4080 | |
|
|
4081 | argtopriv[] = { |
3611 | } argtopriv[] = { |
4082 | { 1, PrivMode_aplCUR }, |
3612 | { 1, PrivMode_aplCUR }, |
4083 | { 2, PrivMode_vt52 }, |
3613 | { 2, PrivMode_vt52 }, |
4084 | { 3, PrivMode_132 }, |
3614 | { 3, PrivMode_132 }, |
4085 | { 4, PrivMode_smoothScroll }, |
3615 | { 4, PrivMode_smoothScroll }, |
4086 | { 5, PrivMode_rVideo }, |
3616 | { 5, PrivMode_rVideo }, |