… | |
… | |
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; |
… | |
… | |
540 | #endif |
547 | #endif |
541 | |
548 | |
542 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
549 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
543 | { |
550 | { |
544 | { |
551 | { |
|
|
552 | bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; |
545 | newlen = 1; |
553 | newlen = 1; |
546 | switch (keysym) |
554 | switch (keysym) |
547 | { |
555 | { |
548 | #ifndef NO_BACKSPACE_KEY |
556 | #ifndef NO_BACKSPACE_KEY |
549 | case XK_BackSpace: |
557 | case XK_BackSpace: |
… | |
… | |
552 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
560 | kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) |
553 | ^ !!ctrl) ? '\b' : '\177'; |
561 | ^ !!ctrl) ? '\b' : '\177'; |
554 | kbuf[1] = '\0'; |
562 | kbuf[1] = '\0'; |
555 | } |
563 | } |
556 | else |
564 | else |
557 | strcpy (kbuf, key_backspace); |
565 | strcpy (kbuf, rs[Rs_backspace_key]); |
558 | break; |
566 | break; |
559 | #endif |
567 | #endif |
560 | #ifndef NO_DELETE_KEY |
568 | #ifndef NO_DELETE_KEY |
561 | # ifdef XK_KP_Prior |
569 | # ifdef XK_KP_Delete |
562 | case XK_KP_Delete: |
570 | case XK_KP_Delete: |
563 | /* allow shift to override */ |
571 | /* allow shift to override */ |
564 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
572 | if (kp) |
565 | { |
573 | { |
566 | strcpy (kbuf, "\033On"); |
574 | strcpy (kbuf, "\033On"); |
567 | break; |
575 | break; |
568 | } |
576 | } |
569 | /* FALLTHROUGH */ |
577 | /* FALLTHROUGH */ |
570 | # endif |
578 | # endif |
571 | case XK_Delete: |
579 | case XK_Delete: |
572 | strcpy (kbuf, key_delete); |
580 | strcpy (kbuf, rs[Rs_delete_key]); |
573 | break; |
581 | break; |
574 | #endif |
582 | #endif |
575 | case XK_Tab: |
583 | case XK_Tab: |
576 | if (shft) |
584 | if (shft) |
577 | strcpy (kbuf, "\033[Z"); |
585 | strcpy (kbuf, "\033[Z"); |
… | |
… | |
592 | #ifdef XK_KP_Left |
600 | #ifdef XK_KP_Left |
593 | case XK_KP_Up: /* \033Ox or standard */ |
601 | case XK_KP_Up: /* \033Ox or standard */ |
594 | case XK_KP_Down: /* \033Or or standard */ |
602 | case XK_KP_Down: /* \033Or or standard */ |
595 | case XK_KP_Right: /* \033Ov or standard */ |
603 | case XK_KP_Right: /* \033Ov or standard */ |
596 | case XK_KP_Left: /* \033Ot or standard */ |
604 | case XK_KP_Left: /* \033Ot or standard */ |
597 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
605 | if (kp) |
598 | { |
606 | { |
599 | strcpy (kbuf, "\033OZ"); |
607 | strcpy (kbuf, "\033OZ"); |
600 | kbuf[2] = "txvr"[keysym - XK_KP_Left]; |
608 | kbuf[2] = "txvr"[keysym - XK_KP_Left]; |
601 | break; |
609 | break; |
602 | } |
610 | } |
… | |
… | |
625 | |
633 | |
626 | #ifndef UNSHIFTED_SCROLLKEYS |
634 | #ifndef UNSHIFTED_SCROLLKEYS |
627 | # ifdef XK_KP_Prior |
635 | # ifdef XK_KP_Prior |
628 | case XK_KP_Prior: |
636 | case XK_KP_Prior: |
629 | /* allow shift to override */ |
637 | /* allow shift to override */ |
630 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
638 | if (kp) |
631 | { |
639 | { |
632 | strcpy (kbuf, "\033Oy"); |
640 | strcpy (kbuf, "\033Oy"); |
633 | break; |
641 | break; |
634 | } |
642 | } |
635 | /* FALLTHROUGH */ |
643 | /* FALLTHROUGH */ |
… | |
… | |
638 | strcpy (kbuf, "\033[5~"); |
646 | strcpy (kbuf, "\033[5~"); |
639 | break; |
647 | break; |
640 | # ifdef XK_KP_Next |
648 | # ifdef XK_KP_Next |
641 | case XK_KP_Next: |
649 | case XK_KP_Next: |
642 | /* allow shift to override */ |
650 | /* allow shift to override */ |
643 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
651 | if (kp) |
644 | { |
652 | { |
645 | strcpy (kbuf, "\033Os"); |
653 | strcpy (kbuf, "\033Os"); |
646 | break; |
654 | break; |
647 | } |
655 | } |
648 | /* FALLTHROUGH */ |
656 | /* FALLTHROUGH */ |
… | |
… | |
651 | strcpy (kbuf, "\033[6~"); |
659 | strcpy (kbuf, "\033[6~"); |
652 | break; |
660 | break; |
653 | #endif |
661 | #endif |
654 | case XK_KP_Enter: |
662 | case XK_KP_Enter: |
655 | /* allow shift to override */ |
663 | /* allow shift to override */ |
656 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
664 | if (kp) |
657 | { |
665 | { |
658 | strcpy (kbuf, "\033OM"); |
666 | strcpy (kbuf, "\033OM"); |
659 | break; |
667 | break; |
660 | } |
668 | } |
661 | |
669 | |
… | |
… | |
704 | case XK_KP_6: /* "\033Ov" : "6" */ |
712 | case XK_KP_6: /* "\033Ov" : "6" */ |
705 | case XK_KP_7: /* "\033Ow" : "7" */ |
713 | case XK_KP_7: /* "\033Ow" : "7" */ |
706 | case XK_KP_8: /* "\033Ox" : "8" */ |
714 | case XK_KP_8: /* "\033Ox" : "8" */ |
707 | case XK_KP_9: /* "\033Oy" : "9" */ |
715 | case XK_KP_9: /* "\033Oy" : "9" */ |
708 | /* allow shift to override */ |
716 | /* allow shift to override */ |
709 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
717 | if (kp) |
710 | { |
718 | { |
711 | strcpy (kbuf, "\033Oj"); |
719 | strcpy (kbuf, "\033Oj"); |
712 | kbuf[2] += (keysym - XK_KP_Multiply); |
720 | kbuf[2] += (keysym - XK_KP_Multiply); |
713 | } |
721 | } |
714 | else |
722 | else |
… | |
… | |
720 | |
728 | |
721 | case XK_Find: |
729 | case XK_Find: |
722 | strcpy (kbuf, "\033[1~"); |
730 | strcpy (kbuf, "\033[1~"); |
723 | break; |
731 | break; |
724 | |
732 | |
725 | #ifdef XK_KP_End |
733 | #ifdef XK_KP_Insert |
726 | case XK_KP_Insert: |
734 | case XK_KP_Insert: |
727 | /* allow shift to override */ |
735 | /* allow shift to override */ |
728 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
736 | if (kp) |
729 | { |
737 | { |
730 | strcpy (kbuf, "\033Op"); |
738 | strcpy (kbuf, "\033Op"); |
731 | break; |
739 | break; |
732 | } |
740 | } |
733 | /* FALLTHROUGH */ |
741 | /* FALLTHROUGH */ |
… | |
… | |
746 | strcpy (kbuf, "\033[4~"); |
754 | strcpy (kbuf, "\033[4~"); |
747 | break; |
755 | break; |
748 | #ifdef XK_KP_End |
756 | #ifdef XK_KP_End |
749 | case XK_KP_End: |
757 | case XK_KP_End: |
750 | /* allow shift to override */ |
758 | /* allow shift to override */ |
751 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
759 | if (kp) |
752 | { |
760 | { |
753 | strcpy (kbuf, "\033Oq"); |
761 | strcpy (kbuf, "\033Oq"); |
754 | break; |
762 | break; |
755 | } |
763 | } |
756 | /* FALLTHROUGH */ |
764 | /* FALLTHROUGH */ |
… | |
… | |
759 | strcpy (kbuf, KS_END); |
767 | strcpy (kbuf, KS_END); |
760 | break; |
768 | break; |
761 | #ifdef XK_KP_Home |
769 | #ifdef XK_KP_Home |
762 | case XK_KP_Home: |
770 | case XK_KP_Home: |
763 | /* allow shift to override */ |
771 | /* allow shift to override */ |
764 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
772 | if (kp) |
765 | { |
773 | { |
766 | strcpy (kbuf, "\033Ow"); |
774 | strcpy (kbuf, "\033Ow"); |
767 | break; |
775 | break; |
768 | } |
776 | } |
769 | /* FALLTHROUGH */ |
777 | /* FALLTHROUGH */ |
… | |
… | |
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 | } |
… | |
… | |
926 | #if ENABLE_FRILLS || ISO_14755 |
934 | #if ENABLE_FRILLS || ISO_14755 |
927 | // ISO 14755 support |
935 | // ISO 14755 support |
928 | if (iso14755buf) |
936 | if (iso14755buf) |
929 | if (iso14755buf & ISO_14755_52) |
937 | if (iso14755buf & ISO_14755_52) |
930 | { |
938 | { |
931 | # if ENABLE_OVERLAY |
939 | # if ISO_14755 |
932 | scr_overlay_off (); |
940 | scr_overlay_off (); |
933 | # endif |
941 | # endif |
934 | # if ISO_14755 |
942 | # if ISO_14755 |
935 | // iso14755 part 5.2 handling: release time |
943 | // iso14755 part 5.2 handling: release time |
936 | // first: controls |
944 | // first: controls |
… | |
… | |
959 | |
967 | |
960 | return; |
968 | return; |
961 | } |
969 | } |
962 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
970 | else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) |
963 | { |
971 | { |
964 | # if ENABLE_OVERLAY |
972 | # if ISO_14755 |
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 | |
… | |
… | |
1426 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1433 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
1427 | focus_out (); |
1434 | focus_out (); |
1428 | } |
1435 | } |
1429 | #endif |
1436 | #endif |
1430 | } |
1437 | } |
1431 | break; |
|
|
1432 | |
|
|
1433 | case MappingNotify: |
|
|
1434 | XRefreshKeyboardMapping (&ev.xmapping); |
|
|
1435 | break; |
1438 | break; |
1436 | |
1439 | |
1437 | /* |
1440 | /* |
1438 | * XXX: this is not the _current_ arrangement |
1441 | * XXX: this is not the _current_ arrangement |
1439 | * Here's my conclusion: |
1442 | * Here's my conclusion: |
… | |
… | |
1458 | break; |
1461 | break; |
1459 | } |
1462 | } |
1460 | break; |
1463 | break; |
1461 | |
1464 | |
1462 | case FocusIn: |
1465 | case FocusIn: |
|
|
1466 | if (ev.xfocus.detail != NotifyInferior |
|
|
1467 | && ev.xfocus.detail != NotifyPointer |
|
|
1468 | && ev.xfocus.mode != NotifyGrab) |
1463 | focus_in (); |
1469 | focus_in (); |
1464 | break; |
1470 | break; |
1465 | |
1471 | |
1466 | case FocusOut: |
1472 | case FocusOut: |
|
|
1473 | if (ev.xfocus.detail != NotifyInferior |
|
|
1474 | && ev.xfocus.detail != NotifyPointer |
|
|
1475 | && ev.xfocus.mode != NotifyGrab) |
1467 | focus_out (); |
1476 | focus_out (); |
1468 | break; |
1477 | break; |
1469 | |
1478 | |
1470 | case ConfigureNotify: |
1479 | case ConfigureNotify: |
|
|
1480 | /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", |
|
|
1481 | ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, |
|
|
1482 | szHint.width, szHint.height);*/ |
1471 | if (ev.xconfigure.window == parent[0]) |
1483 | if (ev.xconfigure.window == parent[0]) |
1472 | { |
1484 | { |
1473 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1485 | while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) |
1474 | ; |
1486 | ; |
1475 | |
1487 | |
1476 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1488 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1477 | { |
1489 | { |
1478 | seen_resize = 1; |
1490 | seen_resize = 1; |
1479 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1491 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1480 | } |
1492 | } |
1481 | |
1493 | else |
|
|
1494 | { |
|
|
1495 | #ifdef ENABLE_TRANSPARENCY |
|
|
1496 | if (option (Opt_transparent)) |
|
|
1497 | update_background (); |
|
|
1498 | #endif |
|
|
1499 | } |
1482 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1500 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1483 | |
|
|
1484 | #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ |
|
|
1485 | if (OPTION (Opt_transparent)) |
|
|
1486 | check_our_parents (); |
|
|
1487 | #endif |
|
|
1488 | } |
1501 | } |
1489 | break; |
1502 | break; |
1490 | |
1503 | |
1491 | case PropertyNotify: |
1504 | case PropertyNotify: |
1492 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1505 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
… | |
… | |
1523 | text_blink_ev.stop (); |
1536 | text_blink_ev.stop (); |
1524 | #endif |
1537 | #endif |
1525 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1538 | HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1526 | break; |
1539 | break; |
1527 | |
1540 | |
1528 | #ifdef TRANSPARENT |
1541 | #ifdef ENABLE_TRANSPARENCY |
1529 | case ReparentNotify: |
1542 | case ReparentNotify: |
1530 | rootwin_cb (ev); |
1543 | rootwin_cb (ev); |
1531 | break; |
1544 | break; |
1532 | #endif /* TRANSPARENT */ |
1545 | #endif /* ENABLE_TRANSPARENCY */ |
1533 | |
1546 | |
1534 | case GraphicsExpose: |
1547 | case GraphicsExpose: |
1535 | case Expose: |
1548 | case Expose: |
1536 | if (ev.xany.window == vt) |
1549 | if (ev.xany.window == vt) |
1537 | { |
1550 | { |
… | |
… | |
1560 | if (isScrollbarWindow (ev.xany.window)) |
1573 | if (isScrollbarWindow (ev.xany.window)) |
1561 | { |
1574 | { |
1562 | scrollBar.setIdle (); |
1575 | scrollBar.setIdle (); |
1563 | scrollbar_show (0); |
1576 | scrollbar_show (0); |
1564 | } |
1577 | } |
1565 | |
|
|
1566 | #ifdef TRANSPARENT |
|
|
1567 | if (am_transparent && ev.xany.window == parent[0]) |
|
|
1568 | XClearWindow (dpy, ev.xany.window); |
|
|
1569 | #endif |
|
|
1570 | } |
1578 | } |
1571 | break; |
1579 | break; |
1572 | |
1580 | |
1573 | case MotionNotify: |
1581 | case MotionNotify: |
1574 | #ifdef POINTER_BLANK |
1582 | #ifdef POINTER_BLANK |
… | |
… | |
1672 | &ev.xbutton.x, &ev.xbutton.y, |
1680 | &ev.xbutton.x, &ev.xbutton.y, |
1673 | &unused_mask); |
1681 | &unused_mask); |
1674 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1682 | scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, |
1675 | scrollbar_size ()); |
1683 | scrollbar_size ()); |
1676 | want_refresh = 1; |
1684 | want_refresh = 1; |
1677 | refresh_limit = 0; |
|
|
1678 | scrollbar_show (1); |
1685 | scrollbar_show (1); |
1679 | } |
1686 | } |
1680 | break; |
1687 | break; |
1681 | } |
1688 | } |
1682 | |
1689 | |
1683 | #if defined(CURSOR_BLINK) |
1690 | #if defined(CURSOR_BLINK) |
1684 | if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) |
1691 | if (option (Opt_cursorBlink) && ev.type == KeyPress) |
1685 | { |
1692 | { |
1686 | if (hidden_cursor) |
1693 | if (hidden_cursor) |
1687 | { |
1694 | { |
1688 | hidden_cursor = 0; |
1695 | hidden_cursor = 0; |
1689 | want_refresh = 1; |
1696 | want_refresh = 1; |
… | |
… | |
1692 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1699 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1693 | } |
1700 | } |
1694 | #endif |
1701 | #endif |
1695 | |
1702 | |
1696 | #if defined(POINTER_BLANK) |
1703 | #if defined(POINTER_BLANK) |
1697 | if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) |
1704 | if (option (Opt_pointerBlank) && pointerBlankDelay > 0) |
1698 | { |
1705 | { |
1699 | if (ev.type == MotionNotify |
1706 | if (ev.type == MotionNotify |
1700 | || ev.type == ButtonPress |
1707 | || ev.type == ButtonPress |
1701 | || ev.type == ButtonRelease) |
1708 | || ev.type == ButtonRelease) |
1702 | if (hidden_pointer) |
1709 | if (hidden_pointer) |
… | |
… | |
1724 | IMSetPosition (); |
1731 | IMSetPosition (); |
1725 | XSetICFocus (Input_Context); |
1732 | XSetICFocus (Input_Context); |
1726 | } |
1733 | } |
1727 | #endif |
1734 | #endif |
1728 | #if CURSOR_BLINK |
1735 | #if CURSOR_BLINK |
1729 | if (OPTION (Opt_cursorBlink)) |
1736 | if (option (Opt_cursorBlink)) |
1730 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1737 | cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); |
1731 | #endif |
1738 | #endif |
1732 | #if OFF_FOCUS_FADING |
1739 | #if OFF_FOCUS_FADING |
1733 | if (rs[Rs_fade]) |
1740 | if (rs[Rs_fade]) |
1734 | { |
1741 | { |
1735 | pix_colors = pix_colors_focused; |
1742 | pix_colors = pix_colors_focused; |
1736 | scr_recolour (); |
1743 | scr_recolour (); |
1737 | } |
1744 | } |
1738 | #endif |
1745 | #endif |
|
|
1746 | #if ENABLE_FRILLS |
|
|
1747 | if (option (Opt_urgentOnBell)) |
|
|
1748 | { |
|
|
1749 | XWMHints *h; |
|
|
1750 | |
|
|
1751 | h = XGetWMHints(dpy, parent[0]); |
|
|
1752 | if (h != NULL) |
|
|
1753 | { |
|
|
1754 | h->flags &= ~XUrgencyHint; |
|
|
1755 | XSetWMHints(dpy, parent[0], h); |
|
|
1756 | } |
|
|
1757 | } |
|
|
1758 | #endif |
1739 | } |
1759 | } |
1740 | } |
1760 | } |
1741 | |
1761 | |
1742 | void |
1762 | void |
1743 | rxvt_term::focus_out () |
1763 | rxvt_term::focus_out () |
… | |
… | |
1751 | |
1771 | |
1752 | #if ENABLE_FRILLS || ISO_14755 |
1772 | #if ENABLE_FRILLS || ISO_14755 |
1753 | if (iso14755buf) |
1773 | if (iso14755buf) |
1754 | { |
1774 | { |
1755 | iso14755buf = 0; |
1775 | iso14755buf = 0; |
1756 | # if ENABLE_OVERLAY |
1776 | # if ISO_14755 |
1757 | scr_overlay_off (); |
1777 | scr_overlay_off (); |
1758 | # endif |
1778 | # endif |
1759 | } |
1779 | } |
1760 | #endif |
1780 | #endif |
1761 | #if USE_XIM |
1781 | #if USE_XIM |
1762 | if (Input_Context != NULL) |
1782 | if (Input_Context != NULL) |
1763 | XUnsetICFocus (Input_Context); |
1783 | XUnsetICFocus (Input_Context); |
1764 | #endif |
1784 | #endif |
1765 | #if CURSOR_BLINK |
1785 | #if CURSOR_BLINK |
1766 | if (OPTION (Opt_cursorBlink)) |
1786 | if (option (Opt_cursorBlink)) |
1767 | cursor_blink_ev.stop (); |
1787 | cursor_blink_ev.stop (); |
1768 | hidden_cursor = 0; |
1788 | hidden_cursor = 0; |
1769 | #endif |
1789 | #endif |
1770 | #if OFF_FOCUS_FADING |
1790 | #if OFF_FOCUS_FADING |
1771 | if (rs[Rs_fade]) |
1791 | if (rs[Rs_fade]) |
… | |
… | |
1788 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1808 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
1789 | } |
1809 | } |
1790 | #endif |
1810 | #endif |
1791 | } |
1811 | } |
1792 | |
1812 | |
1793 | #if TRANSPARENT |
1813 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1794 | void |
1814 | void |
1795 | rxvt_term::rootwin_cb (XEvent &ev) |
1815 | rxvt_term::rootwin_cb (XEvent &ev) |
1796 | { |
1816 | { |
1797 | make_current (); |
1817 | make_current (); |
1798 | |
1818 | |
|
|
1819 | if (SHOULD_INVOKE (HOOK_ROOT_EVENT) |
|
|
1820 | && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) |
|
|
1821 | return; |
|
|
1822 | |
|
|
1823 | # if ENABLE_TRANSPARENCY |
1799 | switch (ev.type) |
1824 | switch (ev.type) |
1800 | { |
1825 | { |
1801 | case PropertyNotify: |
1826 | case PropertyNotify: |
1802 | /* |
1827 | /* |
1803 | * if user used some Esetroot compatible prog to set the root bg, |
1828 | * if user used some Esetroot compatible prog to set the root bg, |
1804 | * use the property to determine the pixmap. We use it later on. |
1829 | * use the property to determine the pixmap. We use it later on. |
1805 | */ |
1830 | */ |
1806 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1831 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1807 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1832 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1808 | return; |
1833 | { |
1809 | |
1834 | bgPixmap.set_root_pixmap (); |
1810 | /* FALLTHROUGH */ |
1835 | update_background (); |
1811 | case ReparentNotify: |
1836 | } |
1812 | if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) |
|
|
1813 | want_refresh = want_full_refresh = 1; |
|
|
1814 | break; |
1837 | break; |
1815 | } |
1838 | } |
|
|
1839 | # endif |
1816 | } |
1840 | } |
1817 | #endif |
1841 | #endif |
1818 | |
1842 | |
1819 | void |
1843 | void |
1820 | rxvt_term::button_press (XButtonEvent &ev) |
1844 | rxvt_term::button_press (XButtonEvent &ev) |
… | |
… | |
2148 | selection_make (ev.time); |
2172 | selection_make (ev.time); |
2149 | break; |
2173 | break; |
2150 | |
2174 | |
2151 | case Button2: |
2175 | case Button2: |
2152 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2176 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2153 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2177 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); |
2154 | break; |
2178 | break; |
2155 | |
2179 | |
2156 | #ifdef MOUSE_WHEEL |
2180 | #ifdef MOUSE_WHEEL |
2157 | case Button4: |
2181 | case Button4: |
2158 | case Button5: |
2182 | case Button5: |
… | |
… | |
2162 | |
2186 | |
2163 | v = ev.button == Button4 ? UP : DN; |
2187 | v = ev.button == Button4 ? UP : DN; |
2164 | |
2188 | |
2165 | if (ev.state & ShiftMask) |
2189 | if (ev.state & ShiftMask) |
2166 | i = 1; |
2190 | i = 1; |
2167 | else if (OPTION (Opt_mouseWheelScrollPage)) |
2191 | else if (option (Opt_mouseWheelScrollPage)) |
2168 | i = nrow - 1; |
2192 | i = nrow - 1; |
2169 | else |
2193 | else |
2170 | i = 5; |
2194 | i = 5; |
2171 | |
2195 | |
2172 | # ifdef MOUSE_SLIP_WHEELING |
2196 | # ifdef MOUSE_SLIP_WHEELING |
… | |
… | |
2193 | break; |
2217 | break; |
2194 | #endif |
2218 | #endif |
2195 | } |
2219 | } |
2196 | } |
2220 | } |
2197 | } |
2221 | } |
2198 | |
|
|
2199 | #ifdef TRANSPARENT |
|
|
2200 | #if TINTING |
|
|
2201 | /* taken from aterm-0.4.2 */ |
|
|
2202 | |
|
|
2203 | typedef uint32_t RUINT32T; |
|
|
2204 | |
|
|
2205 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2206 | { |
|
|
2207 | int sh_r, sh_g, sh_b; |
|
|
2208 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2209 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2210 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2211 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2212 | int i; |
|
|
2213 | |
|
|
2214 | Visual *visual = term->visual; |
|
|
2215 | |
|
|
2216 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2217 | |
|
|
2218 | /* for convenience */ |
|
|
2219 | mask_r = visual->red_mask; |
|
|
2220 | mask_g = visual->green_mask; |
|
|
2221 | mask_b = visual->blue_mask; |
|
|
2222 | |
|
|
2223 | /* boring lookup table pre-initialization */ |
|
|
2224 | switch (srcImage->bits_per_pixel) { |
|
|
2225 | case 15: |
|
|
2226 | if ((mask_r != 0x7c00) || |
|
|
2227 | (mask_g != 0x03e0) || |
|
|
2228 | (mask_b != 0x001f)) |
|
|
2229 | return; |
|
|
2230 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2231 | lookup_r = lookup; |
|
|
2232 | lookup_g = lookup+32; |
|
|
2233 | lookup_b = lookup+32+32; |
|
|
2234 | sh_r = 10; |
|
|
2235 | sh_g = 5; |
|
|
2236 | sh_b = 0; |
|
|
2237 | break; |
|
|
2238 | case 16: |
|
|
2239 | if ((mask_r != 0xf800) || |
|
|
2240 | (mask_g != 0x07e0) || |
|
|
2241 | (mask_b != 0x001f)) |
|
|
2242 | return; |
|
|
2243 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2244 | lookup_r = lookup; |
|
|
2245 | lookup_g = lookup+32; |
|
|
2246 | lookup_b = lookup+32+64; |
|
|
2247 | sh_r = 11; |
|
|
2248 | sh_g = 5; |
|
|
2249 | sh_b = 0; |
|
|
2250 | break; |
|
|
2251 | case 24: |
|
|
2252 | if ((mask_r != 0xff0000) || |
|
|
2253 | (mask_g != 0x00ff00) || |
|
|
2254 | (mask_b != 0x0000ff)) |
|
|
2255 | return; |
|
|
2256 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2257 | lookup_r = lookup; |
|
|
2258 | lookup_g = lookup+256; |
|
|
2259 | lookup_b = lookup+256+256; |
|
|
2260 | sh_r = 16; |
|
|
2261 | sh_g = 8; |
|
|
2262 | sh_b = 0; |
|
|
2263 | break; |
|
|
2264 | case 32: |
|
|
2265 | if ((mask_r != 0xff0000) || |
|
|
2266 | (mask_g != 0x00ff00) || |
|
|
2267 | (mask_b != 0x0000ff)) |
|
|
2268 | return; |
|
|
2269 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2270 | lookup_r = lookup; |
|
|
2271 | lookup_g = lookup+256; |
|
|
2272 | lookup_b = lookup+256+256; |
|
|
2273 | sh_r = 16; |
|
|
2274 | sh_g = 8; |
|
|
2275 | sh_b = 0; |
|
|
2276 | break; |
|
|
2277 | default: |
|
|
2278 | return; /* we do not support this color depth */ |
|
|
2279 | } |
|
|
2280 | |
|
|
2281 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2282 | if (shade < 0) { |
|
|
2283 | shade = -shade; |
|
|
2284 | if (shade < 0) shade = 0; |
|
|
2285 | if (shade > 100) shade = 100; |
|
|
2286 | |
|
|
2287 | lower_lim_r = 65535-rm; |
|
|
2288 | lower_lim_g = 65535-gm; |
|
|
2289 | lower_lim_b = 65535-bm; |
|
|
2290 | |
|
|
2291 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2292 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2293 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2294 | |
|
|
2295 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2296 | } else { |
|
|
2297 | if (shade < 0) shade = 0; |
|
|
2298 | if (shade > 100) shade = 100; |
|
|
2299 | |
|
|
2300 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2301 | |
|
|
2302 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2303 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2304 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2305 | } |
|
|
2306 | |
|
|
2307 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2308 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2309 | { |
|
|
2310 | unsigned int tmp; |
|
|
2311 | |
|
|
2312 | tmp = lower_lim_r; |
|
|
2313 | lower_lim_r = lower_lim_b; |
|
|
2314 | lower_lim_b = tmp; |
|
|
2315 | |
|
|
2316 | tmp = upper_lim_r; |
|
|
2317 | upper_lim_r = upper_lim_b; |
|
|
2318 | upper_lim_b = tmp; |
|
|
2319 | } |
|
|
2320 | |
|
|
2321 | /* fill our lookup tables */ |
|
|
2322 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2323 | { |
|
|
2324 | RUINT32T tmp; |
|
|
2325 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2326 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2327 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2328 | } |
|
|
2329 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2330 | { |
|
|
2331 | RUINT32T tmp; |
|
|
2332 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2333 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2334 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2335 | } |
|
|
2336 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2337 | { |
|
|
2338 | RUINT32T tmp; |
|
|
2339 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2340 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2341 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2342 | } |
|
|
2343 | |
|
|
2344 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2345 | switch (srcImage->bits_per_pixel) |
|
|
2346 | { |
|
|
2347 | case 15: |
|
|
2348 | { |
|
|
2349 | unsigned short *p1, *pf, *p, *pl; |
|
|
2350 | p1 = (unsigned short *) srcImage->data; |
|
|
2351 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2352 | while (p1 < pf) |
|
|
2353 | { |
|
|
2354 | p = p1; |
|
|
2355 | pl = p1 + srcImage->width; |
|
|
2356 | for (; p < pl; p++) |
|
|
2357 | { |
|
|
2358 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2359 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2360 | lookup_b[(*p & 0x001f)]; |
|
|
2361 | } |
|
|
2362 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2363 | } |
|
|
2364 | break; |
|
|
2365 | } |
|
|
2366 | case 16: |
|
|
2367 | { |
|
|
2368 | unsigned short *p1, *pf, *p, *pl; |
|
|
2369 | p1 = (unsigned short *) srcImage->data; |
|
|
2370 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2371 | while (p1 < pf) |
|
|
2372 | { |
|
|
2373 | p = p1; |
|
|
2374 | pl = p1 + srcImage->width; |
|
|
2375 | for (; p < pl; p++) |
|
|
2376 | { |
|
|
2377 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2378 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2379 | lookup_b[(*p & 0x001f)]; |
|
|
2380 | } |
|
|
2381 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2382 | } |
|
|
2383 | break; |
|
|
2384 | } |
|
|
2385 | case 24: |
|
|
2386 | { |
|
|
2387 | unsigned char *p1, *pf, *p, *pl; |
|
|
2388 | p1 = (unsigned char *) srcImage->data; |
|
|
2389 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2390 | while (p1 < pf) |
|
|
2391 | { |
|
|
2392 | p = p1; |
|
|
2393 | pl = p1 + srcImage->width * 3; |
|
|
2394 | for (; p < pl; p += 3) |
|
|
2395 | { |
|
|
2396 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2397 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2398 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2399 | } |
|
|
2400 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2401 | } |
|
|
2402 | break; |
|
|
2403 | } |
|
|
2404 | case 32: |
|
|
2405 | { |
|
|
2406 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2407 | p1 = (RUINT32T *) srcImage->data; |
|
|
2408 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2409 | |
|
|
2410 | while (p1 < pf) |
|
|
2411 | { |
|
|
2412 | p = p1; |
|
|
2413 | pl = p1 + srcImage->width; |
|
|
2414 | for (; p < pl; p++) |
|
|
2415 | { |
|
|
2416 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2417 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2418 | lookup_b[(*p & 0x0000ff)] | |
|
|
2419 | (*p & ~0xffffff); |
|
|
2420 | } |
|
|
2421 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2422 | } |
|
|
2423 | break; |
|
|
2424 | } |
|
|
2425 | } |
|
|
2426 | |
|
|
2427 | free (lookup); |
|
|
2428 | } |
|
|
2429 | #endif |
|
|
2430 | |
|
|
2431 | /* |
|
|
2432 | * Check our parents are still who we think they are. |
|
|
2433 | * Do transparency updates if required |
|
|
2434 | */ |
|
|
2435 | int |
|
|
2436 | rxvt_term::check_our_parents () |
|
|
2437 | { |
|
|
2438 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2439 | unsigned long nitems, bytes_after; |
|
|
2440 | Atom atype; |
|
|
2441 | unsigned char *prop = NULL; |
|
|
2442 | Window root, oldp, *list; |
|
|
2443 | Pixmap rootpixmap = None; |
|
|
2444 | XWindowAttributes wattr, wrootattr; |
|
|
2445 | |
|
|
2446 | pchanged = 0; |
|
|
2447 | |
|
|
2448 | if (!OPTION (Opt_transparent)) |
|
|
2449 | return pchanged; /* Don't try any more */ |
|
|
2450 | |
|
|
2451 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2452 | rootdepth = wrootattr.depth; |
|
|
2453 | |
|
|
2454 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2455 | |
|
|
2456 | if (rootdepth != wattr.depth) |
|
|
2457 | { |
|
|
2458 | if (am_transparent) |
|
|
2459 | { |
|
|
2460 | pchanged = 1; |
|
|
2461 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2462 | am_transparent = am_pixmap_trans = 0; |
|
|
2463 | } |
|
|
2464 | |
|
|
2465 | return pchanged; /* Don't try any more */ |
|
|
2466 | } |
|
|
2467 | |
|
|
2468 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2469 | XSync (dpy, False); |
|
|
2470 | |
|
|
2471 | /* |
|
|
2472 | * Make the frame window set by the window manager have |
|
|
2473 | * the root background. Some window managers put multiple nested frame |
|
|
2474 | * windows for each client, so we have to take care about that. |
|
|
2475 | */ |
|
|
2476 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2477 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2478 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2479 | &nitems, &bytes_after, &prop) == Success); |
|
|
2480 | |
|
|
2481 | if (!i || prop == NULL) |
|
|
2482 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2483 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2484 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2485 | &nitems, &bytes_after, &prop) == Success); |
|
|
2486 | |
|
|
2487 | if (!i || prop == NULL |
|
|
2488 | #if TINTING |
|
|
2489 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2490 | #endif |
|
|
2491 | ) |
|
|
2492 | have_pixmap = 0; |
|
|
2493 | else |
|
|
2494 | { |
|
|
2495 | have_pixmap = 1; |
|
|
2496 | rootpixmap = *(Pixmap *)prop; |
|
|
2497 | XFree (prop); |
|
|
2498 | } |
|
|
2499 | |
|
|
2500 | if (have_pixmap) |
|
|
2501 | { |
|
|
2502 | /* |
|
|
2503 | * Copy display->root pixmap transparency |
|
|
2504 | */ |
|
|
2505 | int sx, sy, nx, ny; |
|
|
2506 | unsigned int nw, nh; |
|
|
2507 | Window cr; |
|
|
2508 | XImage *image; |
|
|
2509 | GC gc; |
|
|
2510 | XGCValues gcvalue; |
|
|
2511 | |
|
|
2512 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2513 | 0, 0, &sx, &sy, &cr); |
|
|
2514 | nw = (unsigned int)szHint.width; |
|
|
2515 | nh = (unsigned int)szHint.height; |
|
|
2516 | nx = ny = 0; |
|
|
2517 | |
|
|
2518 | if (sx < 0) |
|
|
2519 | { |
|
|
2520 | nw += sx; |
|
|
2521 | nx = -sx; |
|
|
2522 | sx = 0; |
|
|
2523 | } |
|
|
2524 | |
|
|
2525 | if (sy < 0) |
|
|
2526 | { |
|
|
2527 | nh += sy; |
|
|
2528 | ny = -sy; |
|
|
2529 | sy = 0; |
|
|
2530 | } |
|
|
2531 | |
|
|
2532 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2533 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2534 | |
|
|
2535 | XSync (dpy, False); |
|
|
2536 | allowedxerror = -1; |
|
|
2537 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2538 | |
|
|
2539 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2540 | /* XXX: may need a delay here? */ |
|
|
2541 | allowedxerror = 0; |
|
|
2542 | |
|
|
2543 | if (image == NULL) |
|
|
2544 | { |
|
|
2545 | if (am_transparent && am_pixmap_trans) |
|
|
2546 | { |
|
|
2547 | pchanged = 1; |
|
|
2548 | if (pixmap != None) |
|
|
2549 | { |
|
|
2550 | XFreePixmap (dpy, pixmap); |
|
|
2551 | pixmap = None; |
|
|
2552 | } |
|
|
2553 | } |
|
|
2554 | |
|
|
2555 | am_pixmap_trans = 0; |
|
|
2556 | } |
|
|
2557 | else |
|
|
2558 | { |
|
|
2559 | if (pixmap != None) |
|
|
2560 | XFreePixmap (dpy, pixmap); |
|
|
2561 | |
|
|
2562 | #if TINTING |
|
|
2563 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2564 | { |
|
|
2565 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2566 | |
|
|
2567 | rgba c; |
|
|
2568 | pix_colors_focused [Color_tint].get (c); |
|
|
2569 | |
|
|
2570 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2571 | } |
|
|
2572 | #endif |
|
|
2573 | |
|
|
2574 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2575 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2576 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2577 | nx, ny, image->width, image->height); |
|
|
2578 | XFreeGC (dpy, gc); |
|
|
2579 | XDestroyImage (image); |
|
|
2580 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2581 | XClearWindow (dpy, parent[0]); |
|
|
2582 | |
|
|
2583 | if (!am_transparent || !am_pixmap_trans) |
|
|
2584 | pchanged = 1; |
|
|
2585 | |
|
|
2586 | am_transparent = am_pixmap_trans = 1; |
|
|
2587 | } |
|
|
2588 | } |
|
|
2589 | |
|
|
2590 | if (am_pixmap_trans) |
|
|
2591 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2592 | else |
|
|
2593 | { |
|
|
2594 | unsigned int n; |
|
|
2595 | /* |
|
|
2596 | * InheritPixmap transparency |
|
|
2597 | */ |
|
|
2598 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2599 | { |
|
|
2600 | oldp = parent[i]; |
|
|
2601 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2602 | XFree (list); |
|
|
2603 | |
|
|
2604 | if (parent[i] == display->root) |
|
|
2605 | { |
|
|
2606 | if (oldp != None) |
|
|
2607 | pchanged = 1; |
|
|
2608 | |
|
|
2609 | break; |
|
|
2610 | } |
|
|
2611 | |
|
|
2612 | if (oldp != parent[i]) |
|
|
2613 | pchanged = 1; |
|
|
2614 | } |
|
|
2615 | |
|
|
2616 | n = 0; |
|
|
2617 | |
|
|
2618 | if (pchanged) |
|
|
2619 | for (; n < (unsigned int)i; n++) |
|
|
2620 | { |
|
|
2621 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2622 | |
|
|
2623 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2624 | { |
|
|
2625 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2626 | break; |
|
|
2627 | } |
|
|
2628 | } |
|
|
2629 | |
|
|
2630 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2631 | { |
|
|
2632 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2633 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2634 | am_transparent = 0; |
|
|
2635 | /* XXX: also turn off Opt_transparent? */ |
|
|
2636 | } |
|
|
2637 | else |
|
|
2638 | { |
|
|
2639 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2640 | { |
|
|
2641 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2642 | XClearWindow (dpy, parent[n]); |
|
|
2643 | } |
|
|
2644 | |
|
|
2645 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2646 | am_transparent = 1; |
|
|
2647 | } |
|
|
2648 | |
|
|
2649 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2650 | parent[i] = None; |
|
|
2651 | } |
|
|
2652 | |
|
|
2653 | if (scrollBar.win) |
|
|
2654 | { |
|
|
2655 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2656 | scrollBar.setIdle (); |
|
|
2657 | scrollbar_show (0); |
|
|
2658 | } |
|
|
2659 | |
|
|
2660 | if (am_transparent) |
|
|
2661 | { |
|
|
2662 | want_refresh = want_full_refresh = 1; |
|
|
2663 | if (am_pixmap_trans) |
|
|
2664 | flush (); |
|
|
2665 | } |
|
|
2666 | |
|
|
2667 | return pchanged; |
|
|
2668 | } |
|
|
2669 | #endif |
|
|
2670 | |
2222 | |
2671 | /*}}} */ |
2223 | /*}}} */ |
2672 | |
2224 | |
2673 | bool |
2225 | bool |
2674 | rxvt_term::cmd_parse () |
2226 | rxvt_term::cmd_parse () |
… | |
… | |
2723 | if (ch == C0_LF) |
2275 | if (ch == C0_LF) |
2724 | nlines++; |
2276 | nlines++; |
2725 | |
2277 | |
2726 | refresh_count++; |
2278 | refresh_count++; |
2727 | |
2279 | |
2728 | if (!OPTION (Opt_jumpScroll) |
2280 | if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) |
2729 | || (refresh_count >= refresh_limit * (nrow - 1))) |
|
|
2730 | { |
2281 | { |
2731 | refreshnow = true; |
|
|
2732 | refresh_count = 0; |
2282 | refresh_count = 0; |
|
|
2283 | |
|
|
2284 | if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) |
|
|
2285 | { |
|
|
2286 | refreshnow = true; |
2733 | ch = NOCHAR; |
2287 | ch = NOCHAR; |
2734 | break; |
2288 | break; |
|
|
2289 | } |
2735 | } |
2290 | } |
2736 | |
2291 | |
2737 | // scr_add_lines only works for nlines <= nrow - 1. |
2292 | // scr_add_lines only works for nlines <= nrow - 1. |
2738 | if (nlines >= nrow - 1) |
2293 | if (nlines >= nrow - 1) |
2739 | { |
2294 | { |
… | |
… | |
2767 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2322 | && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) |
2768 | scr_add_lines (buf, str - buf, nlines); |
2323 | scr_add_lines (buf, str - buf, nlines); |
2769 | |
2324 | |
2770 | /* |
2325 | /* |
2771 | * If there have been a lot of new lines, then update the screen |
2326 | * If there have been a lot of new lines, then update the screen |
2772 | * What the heck I'll cheat and only refresh less than every page-full. |
2327 | * What the heck we'll cheat and only refresh less than every page-full. |
2773 | * the number of pages between refreshes is refresh_limit, which |
2328 | * if skipScroll is enabled. |
2774 | * is incremented here because we must be doing flat-out scrolling. |
|
|
2775 | */ |
2329 | */ |
2776 | if (refreshnow) |
2330 | if (refreshnow) |
2777 | { |
2331 | { |
2778 | if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) |
|
|
2779 | refresh_limit++; |
|
|
2780 | else |
|
|
2781 | { |
|
|
2782 | flag = true; |
2332 | flag = true; |
2783 | //TODO: due to popular request, implement "skipscroll" option here |
|
|
2784 | scr_refresh (); |
2333 | scr_refresh (); |
2785 | want_refresh = 1; |
2334 | want_refresh = 1; |
2786 | } |
|
|
2787 | } |
2335 | } |
2788 | |
2336 | |
2789 | } |
2337 | } |
2790 | else |
2338 | else |
2791 | { |
2339 | { |
… | |
… | |
2940 | { |
2488 | { |
2941 | if ((buf[len++] = cmd_getc ()) == 'i') |
2489 | if ((buf[len++] = cmd_getc ()) == 'i') |
2942 | break; /* done = 1 */ |
2490 | break; /* done = 1 */ |
2943 | } |
2491 | } |
2944 | } |
2492 | } |
2945 | |
2493 | |
2946 | for (i = 0; i < len; i++) |
2494 | for (i = 0; i < len; i++) |
2947 | if (putc (buf[i], fd) == EOF) |
2495 | if (putc (buf[i], fd) == EOF) |
2948 | { |
2496 | { |
2949 | done = 1; |
2497 | done = 1; |
2950 | break; |
2498 | break; |
… | |
… | |
3012 | process_dcs_seq (); |
2560 | process_dcs_seq (); |
3013 | break; |
2561 | break; |
3014 | case 0x9b: /* CSI */ |
2562 | case 0x9b: /* CSI */ |
3015 | process_csi_seq (); |
2563 | process_csi_seq (); |
3016 | break; |
2564 | break; |
3017 | case 0x9d: /* CSI */ |
2565 | case 0x9d: /* OSC */ |
3018 | process_osc_seq (); |
2566 | process_osc_seq (); |
3019 | break; |
2567 | break; |
3020 | #endif |
2568 | #endif |
3021 | } |
2569 | } |
3022 | } |
2570 | } |
… | |
… | |
3248 | rxvt_term::process_csi_seq () |
2796 | rxvt_term::process_csi_seq () |
3249 | { |
2797 | { |
3250 | unicode_t ch, priv, i; |
2798 | unicode_t ch, priv, i; |
3251 | unsigned int nargs, p; |
2799 | unsigned int nargs, p; |
3252 | int n, ndef; |
2800 | int n, ndef; |
3253 | int arg[ESC_ARGS]; |
2801 | int arg[ESC_ARGS] = { }; |
3254 | |
2802 | |
3255 | for (nargs = ESC_ARGS; nargs > 0;) |
2803 | nargs = 0; |
3256 | arg[--nargs] = 0; |
|
|
3257 | |
2804 | |
3258 | priv = 0; |
2805 | priv = 0; |
3259 | ch = cmd_getc (); |
2806 | ch = cmd_getc (); |
3260 | if (ch >= '<' && ch <= '?') |
2807 | if (ch >= '<' && ch <= '?') |
3261 | { /* '<' '=' '>' '?' */ |
2808 | { /* '<' '=' '>' '?' */ |
… | |
… | |
3305 | switch (priv) |
2852 | switch (priv) |
3306 | { |
2853 | { |
3307 | case '>': |
2854 | case '>': |
3308 | if (ch == CSI_DA) /* secondary device attributes */ |
2855 | if (ch == CSI_DA) /* secondary device attributes */ |
3309 | { |
2856 | { |
3310 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
2857 | // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, |
3311 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
2858 | // 'U' for rxvt-unicode != 7.[34] (where it was broken). |
3312 | // |
2859 | // |
3313 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
2860 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
3314 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
2861 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
3315 | // that we do not support xterm mouse reporting (should be 95 when we do). |
2862 | // that we do not support xterm mouse reporting (should be 95 when we do). |
… | |
… | |
3449 | break; |
2996 | break; |
3450 | case 6: /* CPR requested */ |
2997 | case 6: /* CPR requested */ |
3451 | scr_report_position (); |
2998 | scr_report_position (); |
3452 | break; |
2999 | break; |
3453 | case 7: /* unofficial extension */ |
3000 | case 7: /* unofficial extension */ |
3454 | if (OPTION (Opt_insecure)) |
3001 | if (option (Opt_insecure)) |
3455 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3002 | tt_printf ("%-.250s\012", rs[Rs_display_name]); |
3456 | break; |
3003 | break; |
3457 | case 8: /* unofficial extension */ |
3004 | case 8: /* unofficial extension */ |
3458 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3005 | process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); |
3459 | break; |
3006 | break; |
… | |
… | |
3623 | break; |
3170 | break; |
3624 | case 20: /* report icon label */ |
3171 | case 20: /* report icon label */ |
3625 | { |
3172 | { |
3626 | char *s; |
3173 | char *s; |
3627 | XGetIconName (dpy, parent[0], &s); |
3174 | XGetIconName (dpy, parent[0], &s); |
3628 | tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3175 | tt_printf ("\033]L%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3629 | XFree (s); |
3176 | XFree (s); |
3630 | } |
3177 | } |
3631 | break; |
3178 | break; |
3632 | case 21: /* report window title */ |
3179 | case 21: /* report window title */ |
3633 | { |
3180 | { |
3634 | char *s; |
3181 | char *s; |
3635 | XFetchName (dpy, parent[0], &s); |
3182 | XFetchName (dpy, parent[0], &s); |
3636 | tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3183 | tt_printf ("\033]l%-.250s\234", option (Opt_insecure) && s ? s : ""); /* 8bit ST */ |
3637 | XFree (s); |
3184 | XFree (s); |
3638 | } |
3185 | } |
3639 | break; |
3186 | break; |
3640 | } |
3187 | } |
3641 | } |
3188 | } |
… | |
… | |
3668 | seen_esc = true; |
3215 | seen_esc = true; |
3669 | continue; |
3216 | continue; |
3670 | } |
3217 | } |
3671 | else if (ch == C0_BEL || ch == CHAR_ST) |
3218 | else if (ch == C0_BEL || ch == CHAR_ST) |
3672 | break; |
3219 | break; |
|
|
3220 | else if (ch == C0_SYN) |
|
|
3221 | ch = cmd_get8 (); |
3673 | else if (ch < 0x20) |
3222 | else if (ch < 0x20) |
3674 | return NULL; /* other control character - exit */ |
3223 | return NULL; /* other control character - exit */ |
3675 | |
3224 | |
3676 | seen_esc = false; |
3225 | seen_esc = false; |
3677 | |
3226 | |
3678 | if (n >= STRING_MAX - 1) |
3227 | if (n >= STRING_MAX - 1) |
3679 | // stop at some sane length |
3228 | // stop at some sane length |
3680 | return NULL; |
3229 | return NULL; |
3681 | |
3230 | |
3682 | if (ch == C0_SYN) |
|
|
3683 | string[n++] = cmd_get8 (); |
|
|
3684 | else |
|
|
3685 | string[n++] = ch; |
3231 | string[n++] = ch; |
3686 | } |
3232 | } |
3687 | |
3233 | |
3688 | string[n++] = '\0'; |
3234 | string[n++] = '\0'; |
3689 | |
3235 | |
3690 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
3236 | ends_how = (ch == 0x5c ? C0_ESC : ch); |
… | |
… | |
3769 | int saveop = op; |
3315 | int saveop = op; |
3770 | |
3316 | |
3771 | dLocal (Display *, dpy); |
3317 | dLocal (Display *, dpy); |
3772 | |
3318 | |
3773 | assert (str != NULL); |
3319 | assert (str != NULL); |
3774 | |
3320 | |
3775 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3321 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3776 | return; |
3322 | return; |
3777 | |
3323 | |
3778 | switch (op) |
3324 | switch (op) |
3779 | { |
3325 | { |
… | |
… | |
3874 | break; |
3420 | break; |
3875 | case URxvt_Color_IT: |
3421 | case URxvt_Color_IT: |
3876 | process_color_seq (op, Color_IT, str, resp); |
3422 | process_color_seq (op, Color_IT, str, resp); |
3877 | break; |
3423 | break; |
3878 | #endif |
3424 | #endif |
3879 | #if TRANSPARENT && TINTING |
3425 | #if ENABLE_TRANSPARENCY |
3880 | case URxvt_Color_tint: |
3426 | case URxvt_Color_tint: |
3881 | process_color_seq (op, Color_tint, str, resp); |
3427 | process_color_seq (op, Color_tint, str, resp); |
|
|
3428 | { |
|
|
3429 | bool changed = false; |
|
|
3430 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
3431 | changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
|
|
3432 | else |
|
|
3433 | changed = bgPixmap.unset_tint (); |
|
|
3434 | if (changed) |
|
|
3435 | update_background (); |
|
|
3436 | } |
3882 | |
3437 | |
3883 | check_our_parents (); |
|
|
3884 | |
|
|
3885 | if (am_transparent) |
|
|
3886 | want_full_refresh = want_refresh = 1; |
|
|
3887 | |
|
|
3888 | break; |
3438 | break; |
3889 | #endif |
3439 | #endif |
3890 | |
3440 | |
|
|
3441 | #if XPM_BACKGROUND |
3891 | case Rxvt_Pixmap: |
3442 | case Rxvt_Pixmap: |
3892 | { |
3443 | if (!strcmp (str, "?")) |
3893 | if (*str != ';') |
|
|
3894 | { |
3444 | { |
3895 | #if XPM_BACKGROUND |
3445 | char str[256]; |
3896 | scale_pixmap (""); /* reset to default scaling */ |
3446 | |
3897 | set_bgPixmap (str); /* change pixmap */ |
3447 | sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ |
3898 | scr_touch (true); |
3448 | min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), |
3899 | #endif |
3449 | min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); |
|
|
3450 | process_xterm_seq (XTerm_title, str, CHAR_ST); |
3900 | } |
3451 | } |
3901 | |
3452 | else |
|
|
3453 | { |
3902 | int changed = 0; |
3454 | int changed = 0; |
3903 | |
3455 | |
3904 | while ((str = strchr (str, ';')) != NULL) |
3456 | if (*str != ';') |
3905 | { |
3457 | { |
|
|
3458 | /* reset to default scaling :*/ |
|
|
3459 | bgPixmap.unset_geometry (); |
|
|
3460 | if (bgPixmap.set_file (str)) /* change pixmap */ |
|
|
3461 | changed++; |
|
|
3462 | str = strchr (str, ';'); |
|
|
3463 | if (str == NULL) |
|
|
3464 | bgPixmap.set_defaultGeometry (); |
|
|
3465 | } |
|
|
3466 | while (str) |
|
|
3467 | { |
3906 | str++; |
3468 | str++; |
3907 | #if XPM_BACKGROUND |
3469 | if (bgPixmap.set_geometry (str)) |
3908 | changed += scale_pixmap (str); |
3470 | changed++; |
3909 | #endif |
3471 | str = strchr (str, ';'); |
3910 | } |
3472 | } |
3911 | |
|
|
3912 | if (changed) |
3473 | if (changed) |
3913 | { |
3474 | update_background (); |
3914 | #ifdef XPM_BACKGROUND |
|
|
3915 | resize_pixmap (); |
|
|
3916 | scr_touch (true); |
|
|
3917 | #endif |
|
|
3918 | } |
3475 | } |
3919 | } |
|
|
3920 | break; |
3476 | break; |
|
|
3477 | #endif |
3921 | |
3478 | |
3922 | case Rxvt_restoreFG: |
3479 | case Rxvt_restoreFG: |
3923 | set_window_color (Color_fg, str); |
3480 | set_window_color (Color_fg, str); |
3924 | break; |
3481 | break; |
3925 | case Rxvt_restoreBG: |
3482 | case Rxvt_restoreBG: |
… | |
… | |
3950 | case URxvt_italicFont: |
3507 | case URxvt_italicFont: |
3951 | case URxvt_boldItalicFont: |
3508 | case URxvt_boldItalicFont: |
3952 | #endif |
3509 | #endif |
3953 | if (query) |
3510 | if (query) |
3954 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3511 | tt_printf ("\33]%d;%-.250s%c", saveop, |
3955 | OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3512 | option (Opt_insecure) && fontset[op - URxvt_font]->fontdesc |
3956 | ? fontset[op - URxvt_font]->fontdesc : "", |
3513 | ? fontset[op - URxvt_font]->fontdesc : "", |
3957 | resp); |
3514 | resp); |
3958 | else |
3515 | else |
3959 | { |
3516 | { |
3960 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
3517 | const char *&res = rs[Rs_font + (op - URxvt_font)]; |
… | |
… | |
3974 | break; |
3531 | break; |
3975 | |
3532 | |
3976 | #if !ENABLE_MINIMAL |
3533 | #if !ENABLE_MINIMAL |
3977 | case URxvt_locale: |
3534 | case URxvt_locale: |
3978 | if (query) |
3535 | if (query) |
3979 | tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); |
3536 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3980 | else |
3537 | else |
3981 | { |
3538 | { |
3982 | set_locale (str); |
3539 | set_locale (str); |
3983 | pty->set_utf8_mode (enc_utf8); |
3540 | pty->set_utf8_mode (enc_utf8); |
3984 | init_xlocale (); |
3541 | init_xlocale (); |
… | |
… | |
4047 | { |
3604 | { |
4048 | unsigned int i, j; |
3605 | unsigned int i, j; |
4049 | int state; |
3606 | int state; |
4050 | |
3607 | |
4051 | static const struct |
3608 | static const struct |
4052 | { |
3609 | { |
4053 | const int argval; |
3610 | const int argval; |
4054 | const unsigned long bit; |
3611 | const unsigned long bit; |
4055 | } |
|
|
4056 | |
|
|
4057 | argtopriv[] = { |
3612 | } argtopriv[] = { |
4058 | { 1, PrivMode_aplCUR }, |
3613 | { 1, PrivMode_aplCUR }, |
4059 | { 2, PrivMode_vt52 }, |
3614 | { 2, PrivMode_vt52 }, |
4060 | { 3, PrivMode_132 }, |
3615 | { 3, PrivMode_132 }, |
4061 | { 4, PrivMode_smoothScroll }, |
3616 | { 4, PrivMode_smoothScroll }, |
4062 | { 5, PrivMode_rVideo }, |
3617 | { 5, PrivMode_rVideo }, |
… | |
… | |
4125 | scr_touch (true); |
3680 | scr_touch (true); |
4126 | break; |
3681 | break; |
4127 | #endif |
3682 | #endif |
4128 | case 1048: /* alternative cursor save */ |
3683 | case 1048: /* alternative cursor save */ |
4129 | case 1049: |
3684 | case 1049: |
4130 | if (OPTION (Opt_secondaryScreen)) |
3685 | if (option (Opt_secondaryScreen)) |
4131 | if (mode == 0) |
3686 | if (mode == 0) |
4132 | scr_cursor (RESTORE); |
3687 | scr_cursor (RESTORE); |
4133 | else if (mode == 1) |
3688 | else if (mode == 1) |
4134 | scr_cursor (SAVE); |
3689 | scr_cursor (SAVE); |
4135 | break; |
3690 | break; |
… | |
… | |
4200 | break; |
3755 | break; |
4201 | case 1011: /* scroll to bottom on key press */ |
3756 | case 1011: /* scroll to bottom on key press */ |
4202 | set_option (Opt_scrollTtyKeypress, state); |
3757 | set_option (Opt_scrollTtyKeypress, state); |
4203 | break; |
3758 | break; |
4204 | case 1047: /* secondary screen w/ clearing last */ |
3759 | case 1047: /* secondary screen w/ clearing last */ |
4205 | if (OPTION (Opt_secondaryScreen)) |
3760 | if (option (Opt_secondaryScreen)) |
4206 | if (current_screen != PRIMARY) |
3761 | if (current_screen != PRIMARY) |
4207 | scr_erase_screen (2); |
3762 | scr_erase_screen (2); |
4208 | scr_change_screen (state); |
3763 | scr_change_screen (state); |
4209 | break; |
3764 | break; |
4210 | case 1049: /* secondary screen w/ clearing first */ |
3765 | case 1049: /* secondary screen w/ clearing first */ |
4211 | scr_change_screen (state); |
3766 | scr_change_screen (state); |
4212 | if (OPTION (Opt_secondaryScreen)) |
3767 | if (option (Opt_secondaryScreen)) |
4213 | if (current_screen != PRIMARY) |
3768 | if (current_screen != PRIMARY) |
4214 | scr_erase_screen (2); |
3769 | scr_erase_screen (2); |
4215 | break; |
3770 | break; |
4216 | default: |
3771 | default: |
4217 | break; |
3772 | break; |