ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.329 by ayin, Mon Jun 11 19:57:28 2007 UTC vs.
Revision 1.363 by root, Sun Nov 11 04:08:00 2007 UTC

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,
519# endif 518# endif
520 return; 519 return;
521 } 520 }
522 else 521 else
523 { 522 {
524# if ENABLE_OVERLAY 523# if ISO_14755
525 scr_overlay_off (); 524 scr_overlay_off ();
526# endif 525# endif
527 iso14755buf = 0; 526 iso14755buf = 0;
528 } 527 }
529 } 528 }
530 else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R)) 529 else if ((ctrl && (keysym == XK_Shift_L || keysym == XK_Shift_R))
531 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R))) 530 || (shft && (keysym == XK_Control_L || keysym == XK_Control_R)))
532 if (!(iso14755buf & ISO_14755_STARTED)) 531 if (!(iso14755buf & ISO_14755_STARTED))
533 { 532 {
534 iso14755buf |= ISO_14755_STARTED; 533 iso14755buf |= ISO_14755_STARTED;
535# if ENABLE_OVERLAY 534# if ISO_14755
536 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); 535 scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1);
537 scr_overlay_set (0, 0, "ISO 14755 mode"); 536 scr_overlay_set (0, 0, "ISO 14755 mode");
538# endif 537# endif
539 } 538 }
540#endif 539#endif
548#endif 547#endif
549 548
550 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 549 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
551 { 550 {
552 { 551 {
552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553 newlen = 1; 553 newlen = 1;
554 switch (keysym) 554 switch (keysym)
555 { 555 {
556#ifndef NO_BACKSPACE_KEY 556#ifndef NO_BACKSPACE_KEY
557 case XK_BackSpace: 557 case XK_BackSpace:
560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) 560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace)
561 ^ !!ctrl) ? '\b' : '\177'; 561 ^ !!ctrl) ? '\b' : '\177';
562 kbuf[1] = '\0'; 562 kbuf[1] = '\0';
563 } 563 }
564 else 564 else
565 strcpy (kbuf, key_backspace); 565 strcpy (kbuf, rs[Rs_backspace_key]);
566 break; 566 break;
567#endif 567#endif
568#ifndef NO_DELETE_KEY 568#ifndef NO_DELETE_KEY
569# ifdef XK_KP_Prior 569# ifdef XK_KP_Delete
570 case XK_KP_Delete: 570 case XK_KP_Delete:
571 /* allow shift to override */ 571 /* allow shift to override */
572 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 572 if (kp)
573 { 573 {
574 strcpy (kbuf, "\033On"); 574 strcpy (kbuf, "\033On");
575 break; 575 break;
576 } 576 }
577 /* FALLTHROUGH */ 577 /* FALLTHROUGH */
578# endif 578# endif
579 case XK_Delete: 579 case XK_Delete:
580 strcpy (kbuf, key_delete); 580 strcpy (kbuf, rs[Rs_delete_key]);
581 break; 581 break;
582#endif 582#endif
583 case XK_Tab: 583 case XK_Tab:
584 if (shft) 584 if (shft)
585 strcpy (kbuf, "\033[Z"); 585 strcpy (kbuf, "\033[Z");
596 newlen = 0; 596 newlen = 0;
597 } 597 }
598 break; 598 break;
599 599
600#ifdef XK_KP_Left 600#ifdef XK_KP_Left
601 case XK_KP_Left: /* \033Ot or standard */
601 case XK_KP_Up: /* \033Ox or standard */ 602 case XK_KP_Up: /* \033Ox or standard */
603 case XK_KP_Right: /* \033Ov or standard */
602 case XK_KP_Down: /* \033Or or standard */ 604 case XK_KP_Down: /* \033Or or standard */
603 case XK_KP_Right: /* \033Ov or standard */ 605 if (kp)
604 case XK_KP_Left: /* \033Ot or standard */
605 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
606 { 606 {
607 strcpy (kbuf, "\033OZ"); 607 strcpy (kbuf, "\033OZ");
608 kbuf[2] = "txvr"[keysym - XK_KP_Left]; 608 kbuf[2] = "txvr"[keysym - XK_KP_Left];
609 break; 609 break;
610 } 610 }
633 633
634#ifndef UNSHIFTED_SCROLLKEYS 634#ifndef UNSHIFTED_SCROLLKEYS
635# ifdef XK_KP_Prior 635# ifdef XK_KP_Prior
636 case XK_KP_Prior: 636 case XK_KP_Prior:
637 /* allow shift to override */ 637 /* allow shift to override */
638 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 638 if (kp)
639 { 639 {
640 strcpy (kbuf, "\033Oy"); 640 strcpy (kbuf, "\033Oy");
641 break; 641 break;
642 } 642 }
643 /* FALLTHROUGH */ 643 /* FALLTHROUGH */
646 strcpy (kbuf, "\033[5~"); 646 strcpy (kbuf, "\033[5~");
647 break; 647 break;
648# ifdef XK_KP_Next 648# ifdef XK_KP_Next
649 case XK_KP_Next: 649 case XK_KP_Next:
650 /* allow shift to override */ 650 /* allow shift to override */
651 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 651 if (kp)
652 { 652 {
653 strcpy (kbuf, "\033Os"); 653 strcpy (kbuf, "\033Os");
654 break; 654 break;
655 } 655 }
656 /* FALLTHROUGH */ 656 /* FALLTHROUGH */
659 strcpy (kbuf, "\033[6~"); 659 strcpy (kbuf, "\033[6~");
660 break; 660 break;
661#endif 661#endif
662 case XK_KP_Enter: 662 case XK_KP_Enter:
663 /* allow shift to override */ 663 /* allow shift to override */
664 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 664 if (kp)
665 { 665 {
666 strcpy (kbuf, "\033OM"); 666 strcpy (kbuf, "\033OM");
667 break; 667 break;
668 } 668 }
669 669
712 case XK_KP_6: /* "\033Ov" : "6" */ 712 case XK_KP_6: /* "\033Ov" : "6" */
713 case XK_KP_7: /* "\033Ow" : "7" */ 713 case XK_KP_7: /* "\033Ow" : "7" */
714 case XK_KP_8: /* "\033Ox" : "8" */ 714 case XK_KP_8: /* "\033Ox" : "8" */
715 case XK_KP_9: /* "\033Oy" : "9" */ 715 case XK_KP_9: /* "\033Oy" : "9" */
716 /* allow shift to override */ 716 /* allow shift to override */
717 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 717 if (kp)
718 { 718 {
719 strcpy (kbuf, "\033Oj"); 719 strcpy (kbuf, "\033Oj");
720 kbuf[2] += (keysym - XK_KP_Multiply); 720 kbuf[2] += (keysym - XK_KP_Multiply);
721 } 721 }
722 else 722 else
728 728
729 case XK_Find: 729 case XK_Find:
730 strcpy (kbuf, "\033[1~"); 730 strcpy (kbuf, "\033[1~");
731 break; 731 break;
732 732
733#ifdef XK_KP_End 733#ifdef XK_KP_Insert
734 case XK_KP_Insert: 734 case XK_KP_Insert:
735 /* allow shift to override */ 735 /* allow shift to override */
736 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 736 if (kp)
737 { 737 {
738 strcpy (kbuf, "\033Op"); 738 strcpy (kbuf, "\033Op");
739 break; 739 break;
740 } 740 }
741 /* FALLTHROUGH */ 741 /* FALLTHROUGH */
754 strcpy (kbuf, "\033[4~"); 754 strcpy (kbuf, "\033[4~");
755 break; 755 break;
756#ifdef XK_KP_End 756#ifdef XK_KP_End
757 case XK_KP_End: 757 case XK_KP_End:
758 /* allow shift to override */ 758 /* allow shift to override */
759 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 759 if (kp)
760 { 760 {
761 strcpy (kbuf, "\033Oq"); 761 strcpy (kbuf, "\033Oq");
762 break; 762 break;
763 } 763 }
764 /* FALLTHROUGH */ 764 /* FALLTHROUGH */
767 strcpy (kbuf, KS_END); 767 strcpy (kbuf, KS_END);
768 break; 768 break;
769#ifdef XK_KP_Home 769#ifdef XK_KP_Home
770 case XK_KP_Home: 770 case XK_KP_Home:
771 /* allow shift to override */ 771 /* allow shift to override */
772 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 772 if (kp)
773 { 773 {
774 strcpy (kbuf, "\033Ow"); 774 strcpy (kbuf, "\033Ow");
775 break; 775 break;
776 } 776 }
777 /* FALLTHROUGH */ 777 /* FALLTHROUGH */
934#if ENABLE_FRILLS || ISO_14755 934#if ENABLE_FRILLS || ISO_14755
935 // ISO 14755 support 935 // ISO 14755 support
936 if (iso14755buf) 936 if (iso14755buf)
937 if (iso14755buf & ISO_14755_52) 937 if (iso14755buf & ISO_14755_52)
938 { 938 {
939# if ENABLE_OVERLAY 939# if ISO_14755
940 scr_overlay_off (); 940 scr_overlay_off ();
941# endif 941# endif
942# if ISO_14755 942# if ISO_14755
943 // iso14755 part 5.2 handling: release time 943 // iso14755 part 5.2 handling: release time
944 // first: controls 944 // first: controls
967 967
968 return; 968 return;
969 } 969 }
970 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask)) 970 else if ((ev.state & (ShiftMask | ControlMask)) != (ShiftMask | ControlMask))
971 { 971 {
972# if ENABLE_OVERLAY 972# if ISO_14755
973 scr_overlay_off (); 973 scr_overlay_off ();
974# endif 974# endif
975 if (iso14755buf & ISO_14755_51) 975 if (iso14755buf & ISO_14755_51)
976 commit_iso14755 (); 976 commit_iso14755 ();
977#if ISO_14755 977#if ISO_14755
1035void 1035void
1036rxvt_term::flush () 1036rxvt_term::flush ()
1037{ 1037{
1038 flush_ev.stop (); 1038 flush_ev.stop ();
1039 1039
1040#ifdef TRANSPARENT 1040#ifdef HAVE_BG_PIXMAP
1041 if (want_full_refresh) 1041 if (bgPixmap.check_clearChanged ())
1042 { 1042 {
1043 want_full_refresh = 0; 1043// scr_clear (true); This needs to be researched further!
1044 scr_clear ();
1045 scr_touch (false); 1044 scr_touch (false);
1046 } 1045 }
1047#endif 1046#endif
1048 1047
1049 if (want_refresh) 1048 if (want_refresh)
1095 1094
1096 display->flush (); 1095 display->flush ();
1097} 1096}
1098 1097
1099void 1098void
1100rxvt_term::check_cb (check_watcher &w) 1099rxvt_term::prepare_cb (ev::prepare &w, int revents)
1101{ 1100{
1102 make_current (); 1101 make_current ();
1103 1102
1104 display->flush (); 1103 display->flush ();
1105 1104
1106 if (want_refresh && !flush_ev.active) 1105 if (want_refresh && !flush_ev.active)
1107 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally 1106 flush_ev.start (1. / 60.); // refresh at max. 60 hz normally
1108} 1107}
1109 1108
1110void 1109void
1111rxvt_term::flush_cb (time_watcher &w) 1110rxvt_term::flush_cb (ev::timer &w, int revents)
1112{ 1111{
1113 make_current (); 1112 make_current ();
1114 1113
1115 refresh_limit = 1;
1116 refresh_count = 0; 1114 refresh_count = 0;
1117 flush (); 1115 flush ();
1118} 1116}
1119 1117
1120#ifdef CURSOR_BLINK 1118#ifdef CURSOR_BLINK
1121void 1119void
1122rxvt_term::cursor_blink_cb (time_watcher &w) 1120rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1123{ 1121{
1124 hidden_cursor = !hidden_cursor; 1122 hidden_cursor = !hidden_cursor;
1125 want_refresh = 1; 1123 want_refresh = 1;
1126
1127 w.start (w.at + CURSOR_BLINK_INTERVAL);
1128} 1124}
1129#endif 1125#endif
1130 1126
1131#ifdef TEXT_BLINK 1127#ifdef TEXT_BLINK
1132void 1128void
1133rxvt_term::text_blink_cb (time_watcher &w) 1129rxvt_term::text_blink_cb (ev::timer &w, int revents)
1134{ 1130{
1135 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1131 if (scr_refresh_rend (RS_Blink, RS_Blink))
1136 { 1132 {
1137 hidden_text = !hidden_text; 1133 hidden_text = !hidden_text;
1138 want_refresh = 1; 1134 want_refresh = 1;
1139 w.start (w.at + TEXT_BLINK_INTERVAL);
1140 } 1135 }
1141} 1136}
1142#endif 1137#endif
1143 1138
1144#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1139#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1145void 1140void
1146rxvt_term::cont_scroll_cb (time_watcher &w) 1141rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1147{ 1142{
1148 if ((scrollbar_isUp() || scrollbar_isDn()) && 1143 if ((scrollbar_isUp() || scrollbar_isDn()) &&
1149 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1144 scr_page (scrollbar_isUp() ? UP : DN, 1))
1150 {
1151 want_refresh = 1; 1145 want_refresh = 1;
1152 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1146 else
1153 } 1147 w.stop ();
1154} 1148}
1155#endif 1149#endif
1156 1150
1157#ifdef SELECTION_SCROLLING 1151#ifdef SELECTION_SCROLLING
1158void 1152void
1159rxvt_term::sel_scroll_cb (time_watcher &w) 1153rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1160{ 1154{
1161 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1155 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1162 { 1156 {
1163 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1157 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1164 want_refresh = 1; 1158 want_refresh = 1;
1165 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1166 } 1159 }
1160 else
1161 w.stop ();
1167} 1162}
1168#endif 1163#endif
1169 1164
1170#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1165#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1171void 1166void
1172rxvt_term::slip_wheel_cb (time_watcher &w) 1167rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1173{ 1168{
1174 if (mouse_slip_wheel_speed == 0 1169 if (mouse_slip_wheel_speed == 0
1175 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) 1170 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1176 : scr_page (UP, mouse_slip_wheel_speed)) 1171 : scr_page (UP, mouse_slip_wheel_speed))
1177 { 1172 {
1178 if (view_start == top_row || view_start == 0) 1173 if (view_start == top_row || view_start == 0)
1179 mouse_slip_wheel_speed = 0; 1174 mouse_slip_wheel_speed = 0;
1180 1175
1181 want_refresh = 1; 1176 want_refresh = 1;
1182 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1183 } 1177 }
1178 else
1179 w.stop ();
1184} 1180}
1185#endif 1181#endif
1186 1182
1187#if LINUX_YIELD_HACK 1183#if LINUX_YIELD_HACK
1188static struct event_handler 1184static struct event_handler
1189{ 1185{
1190 check_watcher yield_ev; 1186 ev::prepare yield_ev;
1191 1187
1192 void yield_cb (check_watcher &w) 1188 void yield_cb (ev::prepare &w, int revents)
1193 { 1189 {
1194 // this should really be sched_yield(), but the linux guys thought 1190 // this should really be sched_yield(), but the linux guys thought
1195 // that giving a process calling sched_yield () less cpu time than 1191 // that giving a process calling sched_yield () less cpu time than
1196 // ones with high nice levels is a useful thing to do. It surely is is 1192 // ones with high nice levels is a useful thing to do. It surely is is
1197 // allowed by the sus... as is returning ENOSYS. 1193 // allowed by the sus... as is returning ENOSYS.
1248 1244
1249 return false; 1245 return false;
1250} 1246}
1251 1247
1252void 1248void
1253rxvt_term::pty_cb (io_watcher &w, short revents) 1249rxvt_term::pty_cb (ev::io &w, int revents)
1254{ 1250{
1255 make_current (); 1251 make_current ();
1256 1252
1257 if (revents & EVENT_READ) 1253 if (revents & ev::READ)
1258 // loop, but don't allow a single term to monopolize us 1254 // loop, but don't allow a single term to monopolize us
1259 while (pty_fill ()) 1255 while (pty_fill ())
1260 if (cmd_parse ()) 1256 if (cmd_parse ())
1261 break; 1257 break;
1262 1258
1263 if (revents & EVENT_WRITE) 1259 if (revents & ev::WRITE)
1264 pty_write (); 1260 pty_write ();
1265} 1261}
1266 1262
1267void 1263void
1268rxvt_term::pointer_unblank () 1264rxvt_term::pointer_unblank ()
1272 1268
1273#ifdef POINTER_BLANK 1269#ifdef POINTER_BLANK
1274 hidden_pointer = 0; 1270 hidden_pointer = 0;
1275 1271
1276 if (option (Opt_pointerBlank)) 1272 if (option (Opt_pointerBlank))
1277 pointer_ev.start (NOW + pointerBlankDelay); 1273 pointer_ev.start (pointerBlankDelay);
1278#endif 1274#endif
1279} 1275}
1280 1276
1281#ifdef POINTER_BLANK 1277#ifdef POINTER_BLANK
1282void 1278void
1290 1286
1291 hidden_pointer = 1; 1287 hidden_pointer = 1;
1292} 1288}
1293 1289
1294void 1290void
1295rxvt_term::pointer_cb (time_watcher &w) 1291rxvt_term::pointer_cb (ev::timer &w, int revents)
1296{ 1292{
1297 make_current (); 1293 make_current ();
1298 1294
1299 pointer_blank (); 1295 pointer_blank ();
1300} 1296}
1303void 1299void
1304rxvt_term::mouse_report (XButtonEvent &ev) 1300rxvt_term::mouse_report (XButtonEvent &ev)
1305{ 1301{
1306 int button_number, key_state = 0; 1302 int button_number, key_state = 0;
1307 int x, y; 1303 int x, y;
1304 int code = 32;
1308 1305
1309 x = ev.x; 1306 x = Pixel2Col (ev.x);
1310 y = ev.y; 1307 y = Pixel2Row (ev.y);
1311 pixel_position (&x, &y); 1308 if (ev.type == MotionNotify) {
1309 if (x == mouse_row && y == mouse_col)
1310 return;
1311 mouse_row = x;
1312 mouse_col = y;
1313 code += 32;
1314 }
1312 1315
1313 if (MEvent.button == AnyButton) 1316 if (MEvent.button == AnyButton)
1314 button_number = 3; 1317 button_number = 3;
1315 else 1318 else
1316 { 1319 {
1362 x + 1, 1365 x + 1,
1363 y + 1); 1366 y + 1);
1364#endif 1367#endif
1365 1368
1366 tt_printf ("\033[M%c%c%c", 1369 tt_printf ("\033[M%c%c%c",
1367 (32 + button_number + key_state), 1370 (code + button_number + key_state),
1368 (32 + x + 1), 1371 (32 + x + 1),
1369 (32 + y + 1)); 1372 (32 + y + 1));
1370} 1373}
1371 1374
1372/*{{{ process an X event */ 1375/*{{{ process an X event */
1434 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) 1437 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1435 focus_out (); 1438 focus_out ();
1436 } 1439 }
1437#endif 1440#endif
1438 } 1441 }
1439 break;
1440
1441 case MappingNotify:
1442 XRefreshKeyboardMapping (&ev.xmapping);
1443 break; 1442 break;
1444 1443
1445 /* 1444 /*
1446 * XXX: this is not the _current_ arrangement 1445 * XXX: this is not the _current_ arrangement
1447 * Here's my conclusion: 1446 * Here's my conclusion:
1480 && ev.xfocus.mode != NotifyGrab) 1479 && ev.xfocus.mode != NotifyGrab)
1481 focus_out (); 1480 focus_out ();
1482 break; 1481 break;
1483 1482
1484 case ConfigureNotify: 1483 case ConfigureNotify:
1484 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1485 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1486 szHint.width, szHint.height); */
1485 if (ev.xconfigure.window == parent[0]) 1487 if (ev.xconfigure.window == parent[0])
1486 { 1488 {
1487 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1489 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1488 ; 1490 ;
1489 1491
1490 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1492 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1491 { 1493 {
1492 seen_resize = 1; 1494 seen_resize = 1;
1493 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1495 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1494#ifdef XPM_BACKGROUND
1495 if (!option (Opt_transparent) && bgPixmap.auto_resize)
1496 {
1497 resize_pixmap ();
1498 scr_touch (true);
1499 }
1500#endif
1501 } 1496 }
1502 1497 else
1498 {
1499#ifdef HAVE_BG_PIXMAP
1500 if (bgPixmap.window_position_sensitive ())
1501 update_background ();
1502#endif
1503 }
1503 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1504 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1504
1505#ifdef TRANSPARENT
1506 if (option (Opt_transparent))
1507 check_our_parents ();
1508#endif
1509 } 1505 }
1510 break; 1506 break;
1511 1507
1512 case PropertyNotify: 1508 case PropertyNotify:
1513 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) 1509 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1531 break; 1527 break;
1532 1528
1533 case MapNotify: 1529 case MapNotify:
1534 mapped = 1; 1530 mapped = 1;
1535#ifdef TEXT_BLINK 1531#ifdef TEXT_BLINK
1536 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1532 text_blink_ev.start (TEXT_BLINK_INTERVAL);
1537#endif 1533#endif
1538 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1534 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1539 break; 1535 break;
1540 1536
1541 case UnmapNotify: 1537 case UnmapNotify:
1543#ifdef TEXT_BLINK 1539#ifdef TEXT_BLINK
1544 text_blink_ev.stop (); 1540 text_blink_ev.stop ();
1545#endif 1541#endif
1546 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1542 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1547 break; 1543 break;
1548
1549#ifdef TRANSPARENT
1550 case ReparentNotify:
1551 rootwin_cb (ev);
1552 break;
1553#endif /* TRANSPARENT */
1554 1544
1555 case GraphicsExpose: 1545 case GraphicsExpose:
1556 case Expose: 1546 case Expose:
1557 if (ev.xany.window == vt) 1547 if (ev.xany.window == vt)
1558 { 1548 {
1559 do 1549 do
1550 {
1560 scr_expose (ev.xexpose.x, ev.xexpose.y, 1551 scr_expose (ev.xexpose.x, ev.xexpose.y,
1561 ev.xexpose.width, ev.xexpose.height, False); 1552 ev.xexpose.width, ev.xexpose.height, False);
1553 }
1562 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1554 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1563 1555
1564 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1556 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1565 1557
1566 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1559 {
1567 scr_expose (ev.xexpose.x, ev.xexpose.y, 1560 scr_expose (ev.xexpose.x, ev.xexpose.y,
1568 ev.xexpose.width, ev.xexpose.height, False); 1561 ev.xexpose.width, ev.xexpose.height, False);
1569 1562 }
1570 want_refresh = 1; 1563 want_refresh = 1;
1571 } 1564 }
1572 else 1565 else
1573 { 1566 {
1574 XEvent unused_event; 1567 XEvent unused_event;
1581 if (isScrollbarWindow (ev.xany.window)) 1574 if (isScrollbarWindow (ev.xany.window))
1582 { 1575 {
1583 scrollBar.setIdle (); 1576 scrollBar.setIdle ();
1584 scrollbar_show (0); 1577 scrollbar_show (0);
1585 } 1578 }
1586
1587#ifdef TRANSPARENT
1588 if (am_transparent && ev.xany.window == parent[0])
1589 XClearWindow (dpy, ev.xany.window);
1590#endif
1591 } 1579 }
1592 break; 1580 break;
1593 1581
1594 case MotionNotify: 1582 case MotionNotify:
1595#ifdef POINTER_BLANK 1583#ifdef POINTER_BLANK
1596 if (hidden_pointer) 1584 if (hidden_pointer)
1597 pointer_unblank (); 1585 pointer_unblank ();
1598#endif 1586#endif
1587 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1588 || priv_modes & PrivMode_MouseAnyEvent)
1589 mouse_report (ev.xbutton);
1599 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1590 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1600 break; 1591 break;
1601 1592
1602 if (ev.xany.window == vt) 1593 if (ev.xany.window == vt)
1603 { 1594 {
1638 1629
1639 /* don't clobber the current delay if we are 1630 /* don't clobber the current delay if we are
1640 * already in the middle of scrolling. 1631 * already in the middle of scrolling.
1641 */ 1632 */
1642 if (!sel_scroll_ev.active) 1633 if (!sel_scroll_ev.active)
1643 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1634 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1644 1635
1645 /* save the event params so we can highlight 1636 /* save the event params so we can highlight
1646 * the selection in the pending-scroll loop 1637 * the selection in the pending-scroll loop
1647 */ 1638 */
1648 selection_save_x = ev.xbutton.x; 1639 selection_save_x = ev.xbutton.x;
1693 &ev.xbutton.x, &ev.xbutton.y, 1684 &ev.xbutton.x, &ev.xbutton.y,
1694 &unused_mask); 1685 &unused_mask);
1695 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO, 1686 scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
1696 scrollbar_size ()); 1687 scrollbar_size ());
1697 want_refresh = 1; 1688 want_refresh = 1;
1698 refresh_limit = 0;
1699 scrollbar_show (1); 1689 scrollbar_show (1);
1700 } 1690 }
1701 break; 1691 break;
1702 } 1692 }
1703 1693
1708 { 1698 {
1709 hidden_cursor = 0; 1699 hidden_cursor = 0;
1710 want_refresh = 1; 1700 want_refresh = 1;
1711 } 1701 }
1712 1702
1713 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1703 cursor_blink_ev.again ();
1714 } 1704 }
1715#endif 1705#endif
1716 1706
1717#if defined(POINTER_BLANK) 1707#if defined(POINTER_BLANK)
1718 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1708 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1746 XSetICFocus (Input_Context); 1736 XSetICFocus (Input_Context);
1747 } 1737 }
1748#endif 1738#endif
1749#if CURSOR_BLINK 1739#if CURSOR_BLINK
1750 if (option (Opt_cursorBlink)) 1740 if (option (Opt_cursorBlink))
1751 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1741 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL);
1752#endif 1742#endif
1753#if OFF_FOCUS_FADING 1743#if OFF_FOCUS_FADING
1754 if (rs[Rs_fade]) 1744 if (rs[Rs_fade])
1755 { 1745 {
1756 pix_colors = pix_colors_focused; 1746 pix_colors = pix_colors_focused;
1758 } 1748 }
1759#endif 1749#endif
1760#if ENABLE_FRILLS 1750#if ENABLE_FRILLS
1761 if (option (Opt_urgentOnBell)) 1751 if (option (Opt_urgentOnBell))
1762 { 1752 {
1763 XWMHints *h;
1764
1765 h = XGetWMHints(dpy, parent[0]); 1753 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1766 if (h != NULL)
1767 { 1754 {
1768 h->flags &= ~XUrgencyHint; 1755 h->flags &= ~XUrgencyHint;
1769 XSetWMHints(dpy, parent[0], h); 1756 XSetWMHints (dpy, parent[0], h);
1770 } 1757 }
1771 } 1758 }
1772#endif 1759#endif
1773 } 1760 }
1774} 1761}
1785 1772
1786#if ENABLE_FRILLS || ISO_14755 1773#if ENABLE_FRILLS || ISO_14755
1787 if (iso14755buf) 1774 if (iso14755buf)
1788 { 1775 {
1789 iso14755buf = 0; 1776 iso14755buf = 0;
1790# if ENABLE_OVERLAY 1777# if ISO_14755
1791 scr_overlay_off (); 1778 scr_overlay_off ();
1792# endif 1779# endif
1793 } 1780 }
1794#endif 1781#endif
1795#if USE_XIM 1782#if USE_XIM
1797 XUnsetICFocus (Input_Context); 1784 XUnsetICFocus (Input_Context);
1798#endif 1785#endif
1799#if CURSOR_BLINK 1786#if CURSOR_BLINK
1800 if (option (Opt_cursorBlink)) 1787 if (option (Opt_cursorBlink))
1801 cursor_blink_ev.stop (); 1788 cursor_blink_ev.stop ();
1789
1802 hidden_cursor = 0; 1790 hidden_cursor = 0;
1803#endif 1791#endif
1804#if OFF_FOCUS_FADING 1792#if OFF_FOCUS_FADING
1805 if (rs[Rs_fade]) 1793 if (rs[Rs_fade])
1806 { 1794 {
1822 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); 1810 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
1823 } 1811 }
1824#endif 1812#endif
1825} 1813}
1826 1814
1827#if TRANSPARENT || ENABLE_PERL 1815#if ENABLE_TRANSPARENCY || ENABLE_PERL
1828void 1816void
1829rxvt_term::rootwin_cb (XEvent &ev) 1817rxvt_term::rootwin_cb (XEvent &ev)
1830{ 1818{
1831 make_current (); 1819 make_current ();
1832 1820
1833 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1821 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1834 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1822 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1835 return; 1823 return;
1836 1824
1837# if TRANSPARENT 1825# if ENABLE_TRANSPARENCY
1838 switch (ev.type) 1826 switch (ev.type)
1839 { 1827 {
1840 case PropertyNotify: 1828 case PropertyNotify:
1841 /* 1829 /*
1842 * if user used some Esetroot compatible prog to set the root bg, 1830 * if user used some Esetroot compatible prog to set the root bg,
1843 * use the property to determine the pixmap. We use it later on. 1831 * use the property to determine the pixmap. We use it later on.
1844 */ 1832 */
1845 if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] 1833 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1846 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1834 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1847 return; 1835 {
1848 1836 bgPixmap.set_root_pixmap ();
1849 /* FALLTHROUGH */ 1837 update_background ();
1850 case ReparentNotify: 1838 }
1851 if (option (Opt_transparent))
1852 check_our_parents ();
1853 break; 1839 break;
1854 } 1840 }
1855# endif 1841# endif
1856} 1842}
1857#endif 1843#endif
2041 upordown = 1; /* down */ 2027 upordown = 1; /* down */
2042 } 2028 }
2043 if (upordown) 2029 if (upordown)
2044 { 2030 {
2045#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2031#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2046 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2032 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2047#endif 2033#endif
2048 if (scr_page (upordown < 0 ? UP : DN, 1)) 2034 if (scr_page (upordown < 0 ? UP : DN, 1))
2049 { 2035 {
2050 if (upordown < 0) 2036 if (upordown < 0)
2051 scrollBar.setUp (); 2037 scrollBar.setUp ();
2214 { 2200 {
2215 mouse_slip_wheel_speed += v ? -1 : 1; 2201 mouse_slip_wheel_speed += v ? -1 : 1;
2216 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2202 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2217 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2203 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2218 2204
2219 if (slip_wheel_ev.at < NOW) 2205 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2220 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
2221
2222 slip_wheel_ev.start ();
2223 } 2206 }
2224 else 2207 else
2225 { 2208 {
2226# endif 2209# endif
2227 scr_page (v, i); 2210 scr_page (v, i);
2291 if (ch == C0_LF) 2274 if (ch == C0_LF)
2292 nlines++; 2275 nlines++;
2293 2276
2294 refresh_count++; 2277 refresh_count++;
2295 2278
2296 if (!option (Opt_jumpScroll) 2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2297 || (refresh_count >= refresh_limit * (nrow - 1)))
2298 { 2280 {
2299 refreshnow = true;
2300 refresh_count = 0; 2281 refresh_count = 0;
2282
2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.)
2284 {
2285 refreshnow = true;
2301 ch = NOCHAR; 2286 ch = NOCHAR;
2302 break; 2287 break;
2288 }
2303 } 2289 }
2304 2290
2305 // scr_add_lines only works for nlines <= nrow - 1. 2291 // scr_add_lines only works for nlines <= nrow - 1.
2306 if (nlines >= nrow - 1) 2292 if (nlines >= nrow - 1)
2307 { 2293 {
2335 && 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))))
2336 scr_add_lines (buf, str - buf, nlines); 2322 scr_add_lines (buf, str - buf, nlines);
2337 2323
2338 /* 2324 /*
2339 * 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
2340 * 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.
2341 * the number of pages between refreshes is refresh_limit, which 2327 * if skipScroll is enabled.
2342 * is incremented here because we must be doing flat-out scrolling.
2343 */ 2328 */
2344 if (refreshnow) 2329 if (refreshnow)
2345 { 2330 {
2346 if (option (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2347 refresh_limit++;
2348 else
2349 {
2350 flag = true; 2331 flag = true;
2351 //TODO: due to popular request, implement "skipscroll" option here
2352 scr_refresh (); 2332 scr_refresh ();
2353 want_refresh = 1; 2333 want_refresh = 1;
2354 }
2355 } 2334 }
2356 2335
2357 } 2336 }
2358 else 2337 else
2359 { 2338 {
2580 process_dcs_seq (); 2559 process_dcs_seq ();
2581 break; 2560 break;
2582 case 0x9b: /* CSI */ 2561 case 0x9b: /* CSI */
2583 process_csi_seq (); 2562 process_csi_seq ();
2584 break; 2563 break;
2585 case 0x9d: /* CSI */ 2564 case 0x9d: /* OSC */
2586 process_osc_seq (); 2565 process_osc_seq ();
2587 break; 2566 break;
2588#endif 2567#endif
2589 } 2568 }
2590} 2569}
2816rxvt_term::process_csi_seq () 2795rxvt_term::process_csi_seq ()
2817{ 2796{
2818 unicode_t ch, priv, i; 2797 unicode_t ch, priv, i;
2819 unsigned int nargs, p; 2798 unsigned int nargs, p;
2820 int n, ndef; 2799 int n, ndef;
2821 int arg[ESC_ARGS]; 2800 int arg[ESC_ARGS] = { };
2822 2801
2823 for (nargs = ESC_ARGS; nargs > 0;) 2802 nargs = 0;
2824 arg[--nargs] = 0;
2825 2803
2826 priv = 0; 2804 priv = 0;
2827 ch = cmd_getc (); 2805 ch = cmd_getc ();
2828 if (ch >= '<' && ch <= '?') 2806 if (ch >= '<' && ch <= '?')
2829 { /* '<' '=' '>' '?' */ 2807 { /* '<' '=' '>' '?' */
2873 switch (priv) 2851 switch (priv)
2874 { 2852 {
2875 case '>': 2853 case '>':
2876 if (ch == CSI_DA) /* secondary device attributes */ 2854 if (ch == CSI_DA) /* secondary device attributes */
2877 { 2855 {
2878 // 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,
2879 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2857 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2880 // 2858 //
2881 // 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
2882 // 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, 94 for urxvt <= 8.3, and 95 for later
2883 // that we do not support xterm mouse reporting (should be 95 when we do). 2861 // versions.
2884 // 2862 //
2885 tt_printf ("\033[>%d;94;0c", 'U'); 2863 tt_printf ("\033[>%d;95;0c", 'U');
2886 } 2864 }
2887 break; 2865 break;
2888 case '?': 2866 case '?':
2889 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2867 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2890 process_terminal_mode (ch, priv, nargs, arg); 2868 process_terminal_mode (ch, priv, nargs, arg);
3441 break; 3419 break;
3442 case URxvt_Color_IT: 3420 case URxvt_Color_IT:
3443 process_color_seq (op, Color_IT, str, resp); 3421 process_color_seq (op, Color_IT, str, resp);
3444 break; 3422 break;
3445#endif 3423#endif
3446#if TRANSPARENT && TINTING 3424#if ENABLE_TRANSPARENCY
3447 case URxvt_Color_tint: 3425 case URxvt_Color_tint:
3448 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 }
3449 3436
3450 check_our_parents ();
3451
3452 if (am_transparent)
3453 want_full_refresh = want_refresh = 1;
3454
3455 break; 3437 break;
3456#endif 3438#endif
3457 3439
3440#if BG_IMAGE_FROM_FILE
3458 case Rxvt_Pixmap: 3441 case Rxvt_Pixmap:
3459 { 3442 if (!strcmp (str, "?"))
3460 if (*str != ';')
3461 { 3443 {
3462#if XPM_BACKGROUND 3444 char str[256];
3463 scale_pixmap (""); /* reset to default scaling */ 3445
3464 set_bgPixmap (str); /* change pixmap */ 3446 sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */
3465 scr_touch (true); 3447 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
3466#endif 3448 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
3449 process_xterm_seq (XTerm_title, str, CHAR_ST);
3467 } 3450 }
3468 3451 else
3452 {
3469 int changed = 0; 3453 int changed = 0;
3470 3454
3471 while ((str = strchr (str, ';')) != NULL) 3455 if (*str != ';')
3472 { 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 {
3473 str++; 3467 str++;
3474#if XPM_BACKGROUND 3468 if (bgPixmap.set_geometry (str))
3475 changed += scale_pixmap (str); 3469 changed++;
3476#endif 3470 str = strchr (str, ';');
3477 } 3471 }
3478
3479 if (changed) 3472 if (changed)
3480 { 3473 update_background ();
3481#ifdef XPM_BACKGROUND
3482 resize_pixmap ();
3483 scr_touch (true);
3484#endif
3485 } 3474 }
3486#if TRANSPARENT && defined(HAVE_AFTERIMAGE)
3487 if (option (Opt_transparent))
3488 check_our_parents ();
3489#endif
3490 }
3491 break; 3475 break;
3476#endif
3492 3477
3493 case Rxvt_restoreFG: 3478 case Rxvt_restoreFG:
3494 set_window_color (Color_fg, str); 3479 set_window_color (Color_fg, str);
3495 break; 3480 break;
3496 case Rxvt_restoreBG: 3481 case Rxvt_restoreBG:
3618{ 3603{
3619 unsigned int i, j; 3604 unsigned int i, j;
3620 int state; 3605 int state;
3621 3606
3622 static const struct 3607 static const struct
3623 { 3608 {
3624 const int argval; 3609 const int argval;
3625 const unsigned long bit; 3610 const unsigned long bit;
3626 }
3627
3628 argtopriv[] = { 3611 } argtopriv[] = {
3629 { 1, PrivMode_aplCUR }, 3612 { 1, PrivMode_aplCUR },
3630 { 2, PrivMode_vt52 }, 3613 { 2, PrivMode_vt52 },
3631 { 3, PrivMode_132 }, 3614 { 3, PrivMode_132 },
3632 { 4, PrivMode_smoothScroll }, 3615 { 4, PrivMode_smoothScroll },
3633 { 5, PrivMode_rVideo }, 3616 { 5, PrivMode_rVideo },
3650#ifndef NO_BACKSPACE_KEY 3633#ifndef NO_BACKSPACE_KEY
3651 { 67, PrivMode_BackSpace }, 3634 { 67, PrivMode_BackSpace },
3652#endif 3635#endif
3653 { 1000, PrivMode_MouseX11 }, 3636 { 1000, PrivMode_MouseX11 },
3654 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3655 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3638 { 1002, PrivMode_MouseBtnEvent },
3656 // 1003 Use All Motion Mouse Tracking. NYI, TODO 3639 { 1003, PrivMode_MouseAnyEvent },
3657 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3658 { 1011, PrivMode_Keypress }, // rxvt extension 3641 { 1011, PrivMode_Keypress }, // rxvt extension
3659 // 1035 enable modifiers for alt, numlock NYI 3642 // 1035 enable modifiers for alt, numlock NYI
3660 // 1036 send ESC for meta keys NYI 3643 // 1036 send ESC for meta keys NYI
3661 // 1037 send DEL for keypad delete NYI 3644 // 1037 send DEL for keypad delete NYI
3735 scr_autowrap (state); 3718 scr_autowrap (state);
3736 break; 3719 break;
3737 /* case 8: - auto repeat, can't do on a per window basis */ 3720 /* case 8: - auto repeat, can't do on a per window basis */
3738 case 9: /* X10 mouse reporting */ 3721 case 9: /* X10 mouse reporting */
3739 if (state) /* orthogonal */ 3722 if (state) /* orthogonal */
3740 priv_modes &= ~PrivMode_MouseX11; 3723 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3741 break; 3724 break;
3742#ifdef scrollBar_esc 3725#ifdef scrollBar_esc
3743 case scrollBar_esc: 3726 case scrollBar_esc:
3744 if (scrollbar_mapping (state)) 3727 if (scrollbar_mapping (state))
3745 { 3728 {
3758 break; 3741 break;
3759 /* case 66: - application key pad */ 3742 /* case 66: - application key pad */
3760 /* case 67: - backspace key */ 3743 /* case 67: - backspace key */
3761 case 1000: /* X11 mouse reporting */ 3744 case 1000: /* X11 mouse reporting */
3762 if (state) /* orthogonal */ 3745 if (state) /* orthogonal */
3763 priv_modes &= ~PrivMode_MouseX10; 3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3764 break; 3747 break;
3765#if 0 3748#if 0
3766 case 1001: 3749 case 1001:
3767 break; /* X11 mouse highlighting */ 3750 break; /* X11 mouse highlighting */
3768#endif 3751#endif
3752 case 1002:
3753 case 1003:
3754 if (state) {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask;
3758 } else
3759 vt_emask_mouse = NoEventMask;
3760 vt_select_input ();
3761 break;
3769 case 1010: /* scroll to bottom on TTY output inhibit */ 3762 case 1010: /* scroll to bottom on TTY output inhibit */
3770 set_option (Opt_scrollTtyOutput, !state); 3763 set_option (Opt_scrollTtyOutput, !state);
3771 break; 3764 break;
3772 case 1011: /* scroll to bottom on key press */ 3765 case 1011: /* scroll to bottom on key press */
3773 set_option (Opt_scrollTtyKeypress, state); 3766 set_option (Opt_scrollTtyKeypress, state);
4010 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 4003 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
4011 4004
4012 memcpy (v_buffer + v_buflen, data, len); 4005 memcpy (v_buffer + v_buflen, data, len);
4013 v_buflen += len; 4006 v_buflen += len;
4014 4007
4015 pty_ev.set (EVENT_READ | EVENT_WRITE); 4008 pty_ev.set (ev::READ | ev::WRITE);
4016} 4009}
4017 4010
4018void rxvt_term::pty_write () 4011void rxvt_term::pty_write ()
4019{ 4012{
4020 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 4013 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4025 4018
4026 if (v_buflen == 0) 4019 if (v_buflen == 0)
4027 { 4020 {
4028 free (v_buffer); 4021 free (v_buffer);
4029 v_buffer = 0; 4022 v_buffer = 0;
4030 v_buflen = 0;
4031 4023
4032 pty_ev.set (EVENT_READ); 4024 pty_ev.set (ev::READ);
4033 return; 4025 return;
4034 } 4026 }
4035 4027
4036 memmove (v_buffer, v_buffer + written, v_buflen); 4028 memmove (v_buffer, v_buffer + written, v_buflen);
4037 } 4029 }
4038 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4030 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4039 pty_ev.set (EVENT_READ); 4031 pty_ev.set (ev::READ);
4040} 4032}
4041 4033
4042/*----------------------- end-of-file (C source) -----------------------*/ 4034/*----------------------- end-of-file (C source) -----------------------*/
4043 4035

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines