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.347 by sasha, Wed Aug 15 22:41:52 2007 UTC vs.
Revision 1.392 by root, Sat Jan 12 22:13:46 2008 UTC

25 * - extensive modifications 25 * - extensive modifications
26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> 30 * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com>
31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it>
31 * 32 *
32 * This program is free software; you can redistribute it and/or modify 33 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by 34 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or 35 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version. 36 * (at your option) any later version.
198 r & RS_Uline ? " uline" : "", 199 r & RS_Uline ? " uline" : "",
199 r & RS_Careful ? " careful" : ""); 200 r & RS_Careful ? " careful" : "");
200 201
201 int width = wcswidth (fname, wcslen (fname)); 202 int width = wcswidth (fname, wcslen (fname));
202 203
203 max_it (width, 8+5); // for char + hey 204 max_it (width, 8+5); // for char + hex
204 max_it (width, strlen (attr)); 205 max_it (width, strlen (attr));
205 206
206 if (y >= 0) 207 if (y >= 0)
207 { 208 {
208 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; 209 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
220 ch = *chr++; 221 ch = *chr++;
221 222
222 sprintf (buf, "%8x", ch); 223 sprintf (buf, "%8x", ch);
223 scr_overlay_set (0, y, buf); 224 scr_overlay_set (0, y, buf);
224 scr_overlay_set (9, y, '='); 225 scr_overlay_set (9, y, '=');
225# if !UNICODE3 226# if !UNICODE_3
226 if (ch >= 0x10000) 227 if (ch >= 0x10000)
227 ch = 0xfffd; 228 ch = 0xfffd;
228# endif 229# endif
229 scr_overlay_set (11, y, ch, r); 230 scr_overlay_set (11, y, ch, r);
230 231
547#endif 548#endif
548 549
549 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 550 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
550 { 551 {
551 { 552 {
553 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
552 newlen = 1; 554 newlen = 1;
555#ifdef XK_KP_Home
556 static const KeySym keypadtrans[] = {
557 XK_KP_7, // XK_KP_Home
558 XK_KP_4, // XK_KP_Left
559 XK_KP_8, // XK_KP_Up
560 XK_KP_6, // XK_KP_Right
561 XK_KP_2, // XK_KP_Down
562#ifndef UNSHIFTED_SCROLLKEYS
563 XK_KP_9, // XK_KP_Prior
564 XK_KP_3, // XK_KP_Next
565#else
566 XK_Prior,
567 XK_Next,
568#endif
569 XK_KP_1, // XK_KP_End
570 XK_KP_5, // XK_KP_Begin
571 };
572
573 if (IN_RANGE_INC (keysym, XK_KP_Home, XK_KP_Begin))
574 {
575 unsigned int index = keysym - XK_KP_Home;
576 keysym = kp ? keypadtrans[index] : XK_Home + index;
577 }
578 else if (keysym == XK_KP_Insert)
579 keysym = kp ? XK_KP_0 : XK_Insert;
580#ifndef NO_DELETE_KEY
581 else if (keysym == XK_KP_Delete)
582 keysym = kp ? XK_KP_Decimal : XK_Delete;
583#endif
584#endif
553 switch (keysym) 585 switch (keysym)
554 { 586 {
555#ifndef NO_BACKSPACE_KEY 587#ifndef NO_BACKSPACE_KEY
556 case XK_BackSpace: 588 case XK_BackSpace:
557 if (priv_modes & PrivMode_HaveBackSpace) 589 if (priv_modes & PrivMode_HaveBackSpace)
559 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) 591 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace)
560 ^ !!ctrl) ? '\b' : '\177'; 592 ^ !!ctrl) ? '\b' : '\177';
561 kbuf[1] = '\0'; 593 kbuf[1] = '\0';
562 } 594 }
563 else 595 else
564 strcpy (kbuf, key_backspace); 596 strcpy (kbuf, rs[Rs_backspace_key]);
565 break; 597 break;
566#endif 598#endif
567#ifndef NO_DELETE_KEY 599#ifndef NO_DELETE_KEY
568# ifdef XK_KP_Prior
569 case XK_KP_Delete:
570 /* allow shift to override */
571 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
572 {
573 strcpy (kbuf, "\033On");
574 break;
575 }
576 /* FALLTHROUGH */
577# endif
578 case XK_Delete: 600 case XK_Delete:
579 strcpy (kbuf, key_delete); 601 strcpy (kbuf, rs[Rs_delete_key]);
580 break; 602 break;
581#endif 603#endif
582 case XK_Tab: 604 case XK_Tab:
583 if (shft) 605 if (shft)
584 strcpy (kbuf, "\033[Z"); 606 strcpy (kbuf, "\033[Z");
594#endif 616#endif
595 newlen = 0; 617 newlen = 0;
596 } 618 }
597 break; 619 break;
598 620
599#ifdef XK_KP_Left
600 case XK_KP_Up: /* \033Ox or standard */
601 case XK_KP_Down: /* \033Or or standard */
602 case XK_KP_Right: /* \033Ov or standard */
603 case XK_KP_Left: /* \033Ot or standard */
604 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
605 {
606 strcpy (kbuf, "\033OZ");
607 kbuf[2] = "txvr"[keysym - XK_KP_Left];
608 break;
609 }
610 else
611 /* translate to std. cursor key */
612 keysym = XK_Left + (keysym - XK_KP_Left);
613 /* FALLTHROUGH */
614#endif
615 case XK_Up: /* "\033[A" */ 621 case XK_Up: /* "\033[A" */
616 case XK_Down: /* "\033[B" */ 622 case XK_Down: /* "\033[B" */
617 case XK_Right: /* "\033[C" */ 623 case XK_Right: /* "\033[C" */
618 case XK_Left: /* "\033[D" */ 624 case XK_Left: /* "\033[D" */
619 strcpy (kbuf, "\033[Z"); 625 strcpy (kbuf, "\033[Z");
629 else if (priv_modes & PrivMode_aplCUR) 635 else if (priv_modes & PrivMode_aplCUR)
630 kbuf[1] = 'O'; 636 kbuf[1] = 'O';
631 break; 637 break;
632 638
633#ifndef UNSHIFTED_SCROLLKEYS 639#ifndef UNSHIFTED_SCROLLKEYS
634# ifdef XK_KP_Prior
635 case XK_KP_Prior:
636 /* allow shift to override */
637 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
638 {
639 strcpy (kbuf, "\033Oy");
640 break;
641 }
642 /* FALLTHROUGH */
643# endif
644 case XK_Prior: 640 case XK_Prior:
645 strcpy (kbuf, "\033[5~"); 641 strcpy (kbuf, "\033[5~");
646 break; 642 break;
647# ifdef XK_KP_Next
648 case XK_KP_Next:
649 /* allow shift to override */
650 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
651 {
652 strcpy (kbuf, "\033Os");
653 break;
654 }
655 /* FALLTHROUGH */
656# endif
657 case XK_Next: 643 case XK_Next:
658 strcpy (kbuf, "\033[6~"); 644 strcpy (kbuf, "\033[6~");
659 break; 645 break;
660#endif 646#endif
661 case XK_KP_Enter: 647 case XK_KP_Enter:
662 /* allow shift to override */ 648 /* allow shift to override */
663 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 649 if (kp)
664 { 650 {
665 strcpy (kbuf, "\033OM"); 651 strcpy (kbuf, "\033OM");
666 break; 652 break;
667 } 653 }
668 654
680 kbuf[0] = '\015'; 666 kbuf[0] = '\015';
681 kbuf[1] = '\0'; 667 kbuf[1] = '\0';
682 } 668 }
683 break; 669 break;
684 670
685#ifdef XK_KP_Begin
686 case XK_KP_Begin:
687 strcpy (kbuf, "\033Ou");
688 break;
689
690#endif
691 case XK_KP_F1: /* "\033OP" */ 671 case XK_KP_F1: /* "\033OP" */
692 case XK_KP_F2: /* "\033OQ" */ 672 case XK_KP_F2: /* "\033OQ" */
693 case XK_KP_F3: /* "\033OR" */ 673 case XK_KP_F3: /* "\033OR" */
694 case XK_KP_F4: /* "\033OS" */ 674 case XK_KP_F4: /* "\033OS" */
695 strcpy (kbuf, "\033OP"); 675 strcpy (kbuf, "\033OP");
711 case XK_KP_6: /* "\033Ov" : "6" */ 691 case XK_KP_6: /* "\033Ov" : "6" */
712 case XK_KP_7: /* "\033Ow" : "7" */ 692 case XK_KP_7: /* "\033Ow" : "7" */
713 case XK_KP_8: /* "\033Ox" : "8" */ 693 case XK_KP_8: /* "\033Ox" : "8" */
714 case XK_KP_9: /* "\033Oy" : "9" */ 694 case XK_KP_9: /* "\033Oy" : "9" */
715 /* allow shift to override */ 695 /* allow shift to override */
716 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 696 if (kp)
717 { 697 {
718 strcpy (kbuf, "\033Oj"); 698 strcpy (kbuf, "\033Oj");
719 kbuf[2] += (keysym - XK_KP_Multiply); 699 kbuf[2] += (keysym - XK_KP_Multiply);
720 } 700 }
721 else 701 else
727 707
728 case XK_Find: 708 case XK_Find:
729 strcpy (kbuf, "\033[1~"); 709 strcpy (kbuf, "\033[1~");
730 break; 710 break;
731 711
732#ifdef XK_KP_Insert
733 case XK_KP_Insert:
734 /* allow shift to override */
735 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
736 {
737 strcpy (kbuf, "\033Op");
738 break;
739 }
740 /* FALLTHROUGH */
741#endif
742 case XK_Insert: 712 case XK_Insert:
743 strcpy (kbuf, "\033[2~"); 713 strcpy (kbuf, "\033[2~");
744 break; 714 break;
745#ifdef DXK_Remove /* support for DEC remove like key */ 715#ifdef DXK_Remove /* support for DEC remove like key */
746 case DXK_Remove: 716 case DXK_Remove:
750 strcpy (kbuf, "\033[3~"); 720 strcpy (kbuf, "\033[3~");
751 break; 721 break;
752 case XK_Select: 722 case XK_Select:
753 strcpy (kbuf, "\033[4~"); 723 strcpy (kbuf, "\033[4~");
754 break; 724 break;
755#ifdef XK_KP_End
756 case XK_KP_End:
757 /* allow shift to override */
758 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
759 {
760 strcpy (kbuf, "\033Oq");
761 break;
762 }
763 /* FALLTHROUGH */
764#endif
765 case XK_End: 725 case XK_End:
766 strcpy (kbuf, KS_END); 726 strcpy (kbuf, KS_END);
767 break; 727 break;
768#ifdef XK_KP_Home
769 case XK_KP_Home:
770 /* allow shift to override */
771 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
772 {
773 strcpy (kbuf, "\033Ow");
774 break;
775 }
776 /* FALLTHROUGH */
777#endif
778 case XK_Home: 728 case XK_Home:
779 strcpy (kbuf, KS_HOME); 729 strcpy (kbuf, KS_HOME);
780 break; 730 break;
781 731
782#define FKEY(n, fkey) \ 732#define FKEY(n, fkey) \
1034void 984void
1035rxvt_term::flush () 985rxvt_term::flush ()
1036{ 986{
1037 flush_ev.stop (); 987 flush_ev.stop ();
1038 988
1039#ifdef ENABLE_TRANSPARENCY 989#ifdef HAVE_BG_PIXMAP
1040 if (want_full_refresh) 990 if (bgPixmap.check_clearChanged ())
1041 { 991 {
1042 want_full_refresh = 0; 992// scr_clear (true); This needs to be researched further!
1043 scr_clear ();
1044 scr_touch (false); 993 scr_touch (false);
1045 } 994 }
1046#endif 995#endif
1047 996
1048 if (want_refresh) 997 if (want_refresh)
1093 } 1042 }
1094 1043
1095 display->flush (); 1044 display->flush ();
1096} 1045}
1097 1046
1047/* checks wether a refresh is requested and starts the refresh timer */
1098void 1048void
1099rxvt_term::check_cb (check_watcher &w) 1049rxvt_term::refresh_check ()
1100{ 1050{
1101 make_current (); 1051 if (want_refresh && !flush_ev.is_active ())
1052 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1102 1053
1103 display->flush (); 1054 display->flush ();
1104
1105 if (want_refresh && !flush_ev.active)
1106 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
1107} 1055}
1108 1056
1109void 1057void
1110rxvt_term::flush_cb (time_watcher &w) 1058rxvt_term::flush_cb (ev::timer &w, int revents)
1111{ 1059{
1112 make_current (); 1060 make_current ();
1113 1061
1114 refresh_count = 0; 1062 refresh_count = 0;
1115 flush (); 1063 flush ();
1116} 1064}
1117 1065
1118#ifdef CURSOR_BLINK 1066#ifdef CURSOR_BLINK
1119void 1067void
1120rxvt_term::cursor_blink_cb (time_watcher &w) 1068rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1121{ 1069{
1122 hidden_cursor = !hidden_cursor; 1070 hidden_cursor = !hidden_cursor;
1123 want_refresh = 1; 1071 want_refresh = 1;
1124 1072 refresh_check ();
1125 w.start (w.at + CURSOR_BLINK_INTERVAL);
1126} 1073}
1127#endif 1074#endif
1128 1075
1129#ifdef TEXT_BLINK 1076#ifdef TEXT_BLINK
1130void 1077void
1131rxvt_term::text_blink_cb (time_watcher &w) 1078rxvt_term::text_blink_cb (ev::timer &w, int revents)
1132{ 1079{
1133 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1080 if (scr_refresh_rend (RS_Blink, RS_Blink))
1134 { 1081 {
1135 hidden_text = !hidden_text; 1082 hidden_text = !hidden_text;
1136 want_refresh = 1; 1083 want_refresh = 1;
1137 w.start (w.at + TEXT_BLINK_INTERVAL); 1084 refresh_check ();
1138 } 1085 }
1086 else
1087 w.stop ();
1139} 1088}
1140#endif 1089#endif
1141 1090
1142#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1091#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1143void 1092void
1144rxvt_term::cont_scroll_cb (time_watcher &w) 1093rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1145{ 1094{
1146 if ((scrollbar_isUp() || scrollbar_isDn()) && 1095 if ((scrollbar_isUp () || scrollbar_isDn ())
1147 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1096 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1148 { 1097 {
1149 want_refresh = 1; 1098 want_refresh = 1;
1150 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1099 refresh_check ();
1151 } 1100 }
1101 else
1102 w.stop ();
1152} 1103}
1153#endif 1104#endif
1154 1105
1155#ifdef SELECTION_SCROLLING 1106#ifdef SELECTION_SCROLLING
1156void 1107void
1157rxvt_term::sel_scroll_cb (time_watcher &w) 1108rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1158{ 1109{
1159 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1110 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1160 { 1111 {
1161 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1112 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1162 want_refresh = 1; 1113 want_refresh = 1;
1163 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1114 refresh_check ();
1164 } 1115 }
1116 else
1117 w.stop ();
1165} 1118}
1166#endif 1119#endif
1167 1120
1168#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1121#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1169void 1122void
1170rxvt_term::slip_wheel_cb (time_watcher &w) 1123rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1171{ 1124{
1172 if (mouse_slip_wheel_speed == 0 1125 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1173 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1174 : scr_page (UP, mouse_slip_wheel_speed))
1175 { 1126 {
1176 if (view_start == top_row || view_start == 0)
1177 mouse_slip_wheel_speed = 0;
1178
1179 want_refresh = 1; 1127 want_refresh = 1;
1180 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1128 refresh_check ();
1129 }
1130
1131 if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0)
1132 {
1133 mouse_slip_wheel_speed = 0;
1134 w.stop ();
1181 } 1135 }
1182} 1136}
1183#endif 1137#endif
1184 1138
1185#if LINUX_YIELD_HACK 1139#if LINUX_YIELD_HACK
1186static struct event_handler 1140static struct event_handler
1187{ 1141{
1188 check_watcher yield_ev; 1142 ev::prepare yield_ev;
1189 1143
1190 void yield_cb (check_watcher &w) 1144 void yield_cb (ev::prepare &w, int revents)
1191 { 1145 {
1192 // this should really be sched_yield(), but the linux guys thought 1146 // this should really be sched_yield(), but the linux guys thought
1193 // that giving a process calling sched_yield () less cpu time than 1147 // that giving a process calling sched_yield () less cpu time than
1194 // ones with high nice levels is a useful thing to do. It surely is is 1148 // ones with high nice levels is a useful thing to do. It surely is is
1195 // allowed by the sus... as is returning ENOSYS. 1149 // allowed by the sus... as is returning ENOSYS.
1246 1200
1247 return false; 1201 return false;
1248} 1202}
1249 1203
1250void 1204void
1251rxvt_term::pty_cb (io_watcher &w, short revents) 1205rxvt_term::pty_cb (ev::io &w, int revents)
1252{ 1206{
1253 make_current (); 1207 make_current ();
1254 1208
1255 if (revents & EVENT_READ) 1209 if (revents & ev::READ)
1256 // loop, but don't allow a single term to monopolize us 1210 // loop, but don't allow a single term to monopolize us
1257 while (pty_fill ()) 1211 while (pty_fill ())
1258 if (cmd_parse ()) 1212 if (cmd_parse ())
1259 break; 1213 break;
1260 1214
1261 if (revents & EVENT_WRITE) 1215 if (revents & ev::WRITE)
1262 pty_write (); 1216 pty_write ();
1217
1218 refresh_check ();
1263} 1219}
1264 1220
1265void 1221void
1266rxvt_term::pointer_unblank () 1222rxvt_term::pointer_unblank ()
1267{ 1223{
1270 1226
1271#ifdef POINTER_BLANK 1227#ifdef POINTER_BLANK
1272 hidden_pointer = 0; 1228 hidden_pointer = 0;
1273 1229
1274 if (option (Opt_pointerBlank)) 1230 if (option (Opt_pointerBlank))
1275 pointer_ev.start (NOW + pointerBlankDelay); 1231 pointer_ev.start (pointerBlankDelay);
1276#endif 1232#endif
1277} 1233}
1278 1234
1279#ifdef POINTER_BLANK 1235#ifdef POINTER_BLANK
1280void 1236void
1288 1244
1289 hidden_pointer = 1; 1245 hidden_pointer = 1;
1290} 1246}
1291 1247
1292void 1248void
1293rxvt_term::pointer_cb (time_watcher &w) 1249rxvt_term::pointer_cb (ev::timer &w, int revents)
1294{ 1250{
1295 make_current (); 1251 make_current ();
1296 1252
1297 pointer_blank (); 1253 pointer_blank ();
1298} 1254}
1301void 1257void
1302rxvt_term::mouse_report (XButtonEvent &ev) 1258rxvt_term::mouse_report (XButtonEvent &ev)
1303{ 1259{
1304 int button_number, key_state = 0; 1260 int button_number, key_state = 0;
1305 int x, y; 1261 int x, y;
1262 int code = 32;
1306 1263
1307 x = ev.x; 1264 x = Pixel2Col (ev.x);
1308 y = ev.y; 1265 y = Pixel2Row (ev.y);
1309 pixel_position (&x, &y); 1266 if (ev.type == MotionNotify)
1267 {
1268 if (x == mouse_row && y == mouse_col)
1269 return;
1270 mouse_row = x;
1271 mouse_col = y;
1272 code += 32;
1273 }
1310 1274
1311 if (MEvent.button == AnyButton) 1275 if (MEvent.button == AnyButton)
1312 button_number = 3; 1276 button_number = 3;
1313 else 1277 else
1314 { 1278 {
1360 x + 1, 1324 x + 1,
1361 y + 1); 1325 y + 1);
1362#endif 1326#endif
1363 1327
1364 tt_printf ("\033[M%c%c%c", 1328 tt_printf ("\033[M%c%c%c",
1365 (32 + button_number + key_state), 1329 (code + button_number + key_state),
1366 (32 + x + 1), 1330 (32 + x + 1),
1367 (32 + y + 1)); 1331 (32 + y + 1));
1368} 1332}
1369 1333
1370/*{{{ process an X event */ 1334/*{{{ process an X event */
1474 && ev.xfocus.mode != NotifyGrab) 1438 && ev.xfocus.mode != NotifyGrab)
1475 focus_out (); 1439 focus_out ();
1476 break; 1440 break;
1477 1441
1478 case ConfigureNotify: 1442 case ConfigureNotify:
1443 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1444 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1445 szHint.width, szHint.height); */
1479 if (ev.xconfigure.window == parent[0]) 1446 if (ev.xconfigure.window == parent[0])
1480 { 1447 {
1481 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1448 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1482 ; 1449 ;
1483 1450
1486 seen_resize = 1; 1453 seen_resize = 1;
1487 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1454 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1488 } 1455 }
1489 else 1456 else
1490 { 1457 {
1491#ifdef ENABLE_TRANSPARENCY 1458#ifdef HAVE_BG_PIXMAP
1492 if (option (Opt_transparent)) 1459 if (bgPixmap.window_position_sensitive ())
1493 if (bgPixmap.render ()) 1460 update_background ();
1494 scr_touch (false);
1495#endif 1461#endif
1496 } 1462 }
1463
1497 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1464 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1498 } 1465 }
1499 break; 1466 break;
1500 1467
1501 case PropertyNotify: 1468 case PropertyNotify:
1520 break; 1487 break;
1521 1488
1522 case MapNotify: 1489 case MapNotify:
1523 mapped = 1; 1490 mapped = 1;
1524#ifdef TEXT_BLINK 1491#ifdef TEXT_BLINK
1525 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1492 text_blink_ev.start ();
1526#endif 1493#endif
1527 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1494 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1528 break; 1495 break;
1529 1496
1530 case UnmapNotify: 1497 case UnmapNotify:
1532#ifdef TEXT_BLINK 1499#ifdef TEXT_BLINK
1533 text_blink_ev.stop (); 1500 text_blink_ev.stop ();
1534#endif 1501#endif
1535 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1502 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1536 break; 1503 break;
1537
1538#ifdef ENABLE_TRANSPARENCY
1539 case ReparentNotify:
1540 rootwin_cb (ev);
1541 break;
1542#endif /* ENABLE_TRANSPARENCY */
1543 1504
1544 case GraphicsExpose: 1505 case GraphicsExpose:
1545 case Expose: 1506 case Expose:
1546 if (ev.xany.window == vt) 1507 if (ev.xany.window == vt)
1547 { 1508 {
1548 do 1509 do
1510 {
1549 scr_expose (ev.xexpose.x, ev.xexpose.y, 1511 scr_expose (ev.xexpose.x, ev.xexpose.y,
1550 ev.xexpose.width, ev.xexpose.height, False); 1512 ev.xexpose.width, ev.xexpose.height, False);
1513 }
1551 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1514 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1552 1515
1553 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1516 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1554 1517
1555 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1518 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1519 {
1556 scr_expose (ev.xexpose.x, ev.xexpose.y, 1520 scr_expose (ev.xexpose.x, ev.xexpose.y,
1557 ev.xexpose.width, ev.xexpose.height, False); 1521 ev.xexpose.width, ev.xexpose.height, False);
1522 }
1558 1523
1559 want_refresh = 1; 1524 want_refresh = 1;
1560 } 1525 }
1561 else 1526 else
1562 { 1527 {
1565 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1530 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1566 ; 1531 ;
1567 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1532 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1568 ; 1533 ;
1569 1534
1570 if (isScrollbarWindow (ev.xany.window)) 1535 if (scrollBar.state && ev.xany.window == scrollBar.win)
1571 { 1536 {
1572 scrollBar.setIdle (); 1537 scrollBar.setIdle ();
1573 scrollbar_show (0); 1538 scrollbar_show (0);
1574 } 1539 }
1575 } 1540 }
1578 case MotionNotify: 1543 case MotionNotify:
1579#ifdef POINTER_BLANK 1544#ifdef POINTER_BLANK
1580 if (hidden_pointer) 1545 if (hidden_pointer)
1581 pointer_unblank (); 1546 pointer_unblank ();
1582#endif 1547#endif
1548 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1549 || priv_modes & PrivMode_MouseAnyEvent)
1550 mouse_report (ev.xbutton);
1583 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1551 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1584 break; 1552 break;
1585 1553
1586 if (ev.xany.window == vt) 1554 if (ev.xany.window == vt)
1587 { 1555 {
1621 int dist; 1589 int dist;
1622 1590
1623 /* don't clobber the current delay if we are 1591 /* don't clobber the current delay if we are
1624 * already in the middle of scrolling. 1592 * already in the middle of scrolling.
1625 */ 1593 */
1626 if (!sel_scroll_ev.active) 1594 if (!sel_scroll_ev.is_active ())
1627 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1595 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1628 1596
1629 /* save the event params so we can highlight 1597 /* save the event params so we can highlight
1630 * the selection in the pending-scroll loop 1598 * the selection in the pending-scroll loop
1631 */ 1599 */
1632 selection_save_x = ev.xbutton.x; 1600 selection_save_x = ev.xbutton.x;
1654 else 1622 else
1655 { 1623 {
1656 /* we are within the text window, so we 1624 /* we are within the text window, so we
1657 * shouldn't be scrolling 1625 * shouldn't be scrolling
1658 */ 1626 */
1659 if (sel_scroll_ev.active)
1660 sel_scroll_ev.stop(); 1627 sel_scroll_ev.stop();
1661 } 1628 }
1662#endif 1629#endif
1663#ifdef MOUSE_THRESHOLD 1630#ifdef MOUSE_THRESHOLD
1664 } 1631 }
1665#endif 1632#endif
1666 } 1633 }
1667 } 1634 }
1668 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1635 else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win)
1669 { 1636 {
1670 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1637 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1671 MotionNotify, &ev)) 1638 MotionNotify, &ev))
1672 ; 1639 ;
1673 1640
1691 { 1658 {
1692 hidden_cursor = 0; 1659 hidden_cursor = 0;
1693 want_refresh = 1; 1660 want_refresh = 1;
1694 } 1661 }
1695 1662
1696 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1663 cursor_blink_ev.again ();
1697 } 1664 }
1698#endif 1665#endif
1699 1666
1700#if defined(POINTER_BLANK) 1667#if defined(POINTER_BLANK)
1701 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1668 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1708 1675
1709 if (ev.type == KeyPress && hidden_pointer == 0) 1676 if (ev.type == KeyPress && hidden_pointer == 0)
1710 pointer_blank (); 1677 pointer_blank ();
1711 } 1678 }
1712#endif 1679#endif
1680
1681 refresh_check ();
1713} 1682}
1714 1683
1715void 1684void
1716rxvt_term::focus_in () 1685rxvt_term::focus_in ()
1717{ 1686{
1729 XSetICFocus (Input_Context); 1698 XSetICFocus (Input_Context);
1730 } 1699 }
1731#endif 1700#endif
1732#if CURSOR_BLINK 1701#if CURSOR_BLINK
1733 if (option (Opt_cursorBlink)) 1702 if (option (Opt_cursorBlink))
1734 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1703 cursor_blink_ev.again ();
1735#endif 1704#endif
1736#if OFF_FOCUS_FADING 1705#if OFF_FOCUS_FADING
1737 if (rs[Rs_fade]) 1706 if (rs[Rs_fade])
1738 { 1707 {
1739 pix_colors = pix_colors_focused; 1708 pix_colors = pix_colors_focused;
1741 } 1710 }
1742#endif 1711#endif
1743#if ENABLE_FRILLS 1712#if ENABLE_FRILLS
1744 if (option (Opt_urgentOnBell)) 1713 if (option (Opt_urgentOnBell))
1745 { 1714 {
1746 XWMHints *h;
1747
1748 h = XGetWMHints(dpy, parent[0]); 1715 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1749 if (h != NULL)
1750 { 1716 {
1751 h->flags &= ~XUrgencyHint; 1717 h->flags &= ~XUrgencyHint;
1752 XSetWMHints(dpy, parent[0], h); 1718 XSetWMHints (dpy, parent[0], h);
1753 } 1719 }
1754 } 1720 }
1755#endif 1721#endif
1756 } 1722 }
1757} 1723}
1780 XUnsetICFocus (Input_Context); 1746 XUnsetICFocus (Input_Context);
1781#endif 1747#endif
1782#if CURSOR_BLINK 1748#if CURSOR_BLINK
1783 if (option (Opt_cursorBlink)) 1749 if (option (Opt_cursorBlink))
1784 cursor_blink_ev.stop (); 1750 cursor_blink_ev.stop ();
1751
1785 hidden_cursor = 0; 1752 hidden_cursor = 0;
1786#endif 1753#endif
1787#if OFF_FOCUS_FADING 1754#if OFF_FOCUS_FADING
1788 if (rs[Rs_fade]) 1755 if (rs[Rs_fade])
1789 { 1756 {
1827 */ 1794 */
1828 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] 1795 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1829 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1796 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1830 { 1797 {
1831 bgPixmap.set_root_pixmap (); 1798 bgPixmap.set_root_pixmap ();
1832 bgPixmap.render (); 1799 update_background ();
1833 } 1800 }
1801
1834 break; 1802 break;
1835 } 1803 }
1836# endif 1804# endif
1805
1806 refresh_check ();
1837} 1807}
1838#endif 1808#endif
1839 1809
1840void 1810void
1841rxvt_term::button_press (XButtonEvent &ev) 1811rxvt_term::button_press (XButtonEvent &ev)
1896 mouse_report (ev); 1866 mouse_report (ev);
1897 } 1867 }
1898#else 1868#else
1899 MEvent.button = ev.button; 1869 MEvent.button = ev.button;
1900 mouse_report (ev); 1870 mouse_report (ev);
1901#endif /* MOUSE_REPORT_DOUBLECLICK */ 1871#endif /* MOUSE_REPORT_DOUBLECLICK */
1902 1872
1903 } 1873 }
1904 else 1874 else
1905 { 1875 {
1906 if (ev.button != MEvent.button) 1876 if (ev.button != MEvent.button)
1954 } 1924 }
1955 1925
1956 /* 1926 /*
1957 * Scrollbar window processing of button press 1927 * Scrollbar window processing of button press
1958 */ 1928 */
1959 if (isScrollbarWindow (ev.window)) 1929 if (scrollBar.state && ev.window == scrollBar.win)
1960 { 1930 {
1961 scrollBar.setIdle (); 1931 scrollBar.setIdle ();
1962 /* 1932 /*
1963 * Rxvt-style scrollbar: 1933 * Rxvt-style scrollbar:
1964 * move up if mouse is above slider 1934 * move up if mouse is above slider
2000 tt_printf ("\033[5~"); 1970 tt_printf ("\033[5~");
2001 break; 1971 break;
2002 } 1972 }
2003 } 1973 }
2004 else 1974 else
2005#endif /* NO_SCROLLBAR_REPORT */ 1975#endif /* NO_SCROLLBAR_REPORT */
2006 1976
2007 { 1977 {
2008 char upordown = 0; 1978 char upordown = 0;
2009 1979
2010 if (scrollBar.style == R_SB_NEXT) 1980 if (scrollBar.style == R_SB_NEXT)
2011 { 1981 {
2012 if (scrollbarnext_upButton (ev.y)) 1982 if (scrollbarnext_upButton (ev.y))
2013 upordown = -1; /* up */ 1983 upordown = -1; /* up */
2019 if (scrollbarrxvt_upButton (ev.y)) 1989 if (scrollbarrxvt_upButton (ev.y))
2020 upordown = -1; /* up */ 1990 upordown = -1; /* up */
2021 else if (scrollbarrxvt_dnButton (ev.y)) 1991 else if (scrollbarrxvt_dnButton (ev.y))
2022 upordown = 1; /* down */ 1992 upordown = 1; /* down */
2023 } 1993 }
1994
2024 if (upordown) 1995 if (upordown)
2025 { 1996 {
2026#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1997#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1998 if (!cont_scroll_ev.is_active ())
2027 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1999 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2028#endif 2000#endif
2029 if (scr_page (upordown < 0 ? UP : DN, 1)) 2001 if (scr_page (upordown < 0 ? UP : DN, 1))
2030 { 2002 {
2031 if (upordown < 0) 2003 if (upordown < 0)
2032 scrollBar.setUp (); 2004 scrollBar.setUp ();
2036 } 2008 }
2037 else 2009 else
2038 switch (ev.button) 2010 switch (ev.button)
2039 { 2011 {
2040 case Button2: 2012 case Button2:
2041 switch (scrollbar_align) 2013 switch (scrollBar.align)
2042 { 2014 {
2043 case R_SB_ALIGN_TOP: 2015 case R_SB_ALIGN_TOP:
2044 csrO = 0; 2016 csrO = 0;
2045 break; 2017 break;
2046 case R_SB_ALIGN_CENTRE: 2018 case R_SB_ALIGN_CENTRE:
2058 2030
2059 scrollBar.setMotion (); 2031 scrollBar.setMotion ();
2060 break; 2032 break;
2061 2033
2062 case Button1: 2034 case Button1:
2063 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2035 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2064 csrO = ev.y - scrollBar.top; 2036 csrO = ev.y - scrollBar.top;
2065 /* FALLTHROUGH */ 2037 /* FALLTHROUGH */
2066 2038
2067 case Button3: 2039 case Button3:
2068 if (scrollBar.style != R_SB_XTERM) 2040 if (scrollBar.style != R_SB_XTERM)
2112 scrollBar.setIdle (); 2084 scrollBar.setIdle ();
2113 scrollbar_show (0); 2085 scrollbar_show (0);
2114 } 2086 }
2115 2087
2116#ifdef SELECTION_SCROLLING 2088#ifdef SELECTION_SCROLLING
2117 if (sel_scroll_ev.active)
2118 sel_scroll_ev.stop(); 2089 sel_scroll_ev.stop();
2119#endif 2090#endif
2120 2091
2121 if (ev.window == vt) 2092 if (ev.window == vt)
2122 { 2093 {
2123 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2094 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2147 mouse_report (ev); 2118 mouse_report (ev);
2148 } 2119 }
2149#else /* MOUSE_REPORT_DOUBLECLICK */ 2120#else /* MOUSE_REPORT_DOUBLECLICK */
2150 MEvent.button = AnyButton; 2121 MEvent.button = AnyButton;
2151 mouse_report (ev); 2122 mouse_report (ev);
2152#endif /* MOUSE_REPORT_DOUBLECLICK */ 2123#endif /* MOUSE_REPORT_DOUBLECLICK */
2153 return; 2124 return;
2154 } 2125 }
2155 2126
2156 /* 2127 /*
2157 * dumb hack to compensate for the failure of click-and-drag 2128 * dumb hack to compensate for the failure of click-and-drag
2195 { 2166 {
2196 mouse_slip_wheel_speed += v ? -1 : 1; 2167 mouse_slip_wheel_speed += v ? -1 : 1;
2197 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2168 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2198 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2169 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2199 2170
2200 if (slip_wheel_ev.at < NOW) 2171 if (!slip_wheel_ev.is_active ())
2201 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; 2172 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2202
2203 slip_wheel_ev.start ();
2204 } 2173 }
2205 else 2174 else
2175# endif
2206 { 2176 {
2207# endif
2208 scr_page (v, i); 2177 scr_page (v, i);
2209 scrollbar_show (1); 2178 scrollbar_show (1);
2210# ifdef MOUSE_SLIP_WHEELING
2211 } 2179 }
2212# endif
2213 } 2180 }
2214 break; 2181 break;
2215#endif 2182#endif
2216 } 2183 }
2217 } 2184 }
2276 2243
2277 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2244 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2278 { 2245 {
2279 refresh_count = 0; 2246 refresh_count = 0;
2280 2247
2281 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2248 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2282 { 2249 {
2283 refreshnow = true; 2250 refreshnow = true;
2284 ch = NOCHAR; 2251 ch = NOCHAR;
2285 break; 2252 break;
2286 } 2253 }
2497 } 2464 }
2498 } 2465 }
2499 2466
2500 pclose_printer (fd); 2467 pclose_printer (fd);
2501} 2468}
2502#endif /* PRINTPIPE */ 2469#endif /* PRINTPIPE */
2503/*}}} */ 2470/*}}} */
2504 2471
2505/* *INDENT-OFF* */ 2472/* *INDENT-OFF* */
2506enum { 2473enum {
2507 C1_40 = 0x40, 2474 C1_40 = 0x40,
2793rxvt_term::process_csi_seq () 2760rxvt_term::process_csi_seq ()
2794{ 2761{
2795 unicode_t ch, priv, i; 2762 unicode_t ch, priv, i;
2796 unsigned int nargs, p; 2763 unsigned int nargs, p;
2797 int n, ndef; 2764 int n, ndef;
2798 int arg[ESC_ARGS]; 2765 int arg[ESC_ARGS] = { };
2799 2766
2800 memset (arg, 0, sizeof (arg));
2801 nargs = 0; 2767 nargs = 0;
2802 2768
2803 priv = 0; 2769 priv = 0;
2804 ch = cmd_getc (); 2770 ch = cmd_getc ();
2805 if (ch >= '<' && ch <= '?') 2771 if (ch >= '<' && ch <= '?')
2772 {
2806 { /* '<' '=' '>' '?' */ 2773 /* '<' '=' '>' '?' */
2807 priv = ch; 2774 priv = ch;
2808 ch = cmd_getc (); 2775 ch = cmd_getc ();
2809 } 2776 }
2810 2777
2811 /* read any numerical arguments */ 2778 /* read any numerical arguments */
2854 { 2821 {
2855 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, 2822 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2856 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2823 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2857 // 2824 //
2858 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2825 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2859 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2826 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2860 // that we do not support xterm mouse reporting (should be 95 when we do). 2827 // versions.
2861 // 2828 //
2862 tt_printf ("\033[>%d;94;0c", 'U'); 2829 tt_printf ("\033[>%d;95;0c", 'U');
2863 } 2830 }
2864 break; 2831 break;
2865 case '?': 2832 case '?':
2866 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2833 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2867 process_terminal_mode (ch, priv, nargs, arg); 2834 process_terminal_mode (ch, priv, nargs, arg);
3423#if ENABLE_TRANSPARENCY 3390#if ENABLE_TRANSPARENCY
3424 case URxvt_Color_tint: 3391 case URxvt_Color_tint:
3425 process_color_seq (op, Color_tint, str, resp); 3392 process_color_seq (op, Color_tint, str, resp);
3426 { 3393 {
3427 bool changed = false; 3394 bool changed = false;
3395
3428 if (ISSET_PIXCOLOR (Color_tint)) 3396 if (ISSET_PIXCOLOR (Color_tint))
3429 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3397 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3430 else 3398 else
3431 changed = bgPixmap.unset_tint (); 3399 changed = bgPixmap.unset_tint ();
3400
3432 if (changed) 3401 if (changed)
3433 bgPixmap.render (); 3402 update_background ();
3434 } 3403 }
3435 3404
3436 break; 3405 break;
3437#endif 3406#endif
3438 3407
3439#if XPM_BACKGROUND 3408#if BG_IMAGE_FROM_FILE
3440 case Rxvt_Pixmap: 3409 case Rxvt_Pixmap:
3441 if (!strcmp (str, "?")) 3410 if (!strcmp (str, "?"))
3442 { 3411 {
3443 char str[256]; 3412 char str[256];
3444 3413
3459 changed++; 3428 changed++;
3460 str = strchr (str, ';'); 3429 str = strchr (str, ';');
3461 if (str == NULL) 3430 if (str == NULL)
3462 bgPixmap.set_defaultGeometry (); 3431 bgPixmap.set_defaultGeometry ();
3463 } 3432 }
3433
3464 while (str) 3434 while (str)
3465 { 3435 {
3466 str++; 3436 str++;
3467 if (bgPixmap.set_geometry (str)) 3437 if (bgPixmap.set_geometry (str))
3468 changed++; 3438 changed++;
3469 str = strchr (str, ';'); 3439 str = strchr (str, ';');
3470 } 3440 }
3441
3471 if (changed) 3442 if (changed)
3472 { 3443 update_background ();
3473 bgPixmap.render ();
3474 scr_touch (true);
3475 }
3476 } 3444 }
3477 break; 3445 break;
3478#endif 3446#endif
3479 3447
3480 case Rxvt_restoreFG: 3448 case Rxvt_restoreFG:
3634 { 66, PrivMode_aplKP }, 3602 { 66, PrivMode_aplKP },
3635#ifndef NO_BACKSPACE_KEY 3603#ifndef NO_BACKSPACE_KEY
3636 { 67, PrivMode_BackSpace }, 3604 { 67, PrivMode_BackSpace },
3637#endif 3605#endif
3638 { 1000, PrivMode_MouseX11 }, 3606 { 1000, PrivMode_MouseX11 },
3639 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3607 { 1002, PrivMode_MouseBtnEvent },
3640 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3608 { 1003, PrivMode_MouseAnyEvent },
3641 // 1003 Use All Motion Mouse Tracking. NYI, TODO
3642 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3609 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3643 { 1011, PrivMode_Keypress }, // rxvt extension 3610 { 1011, PrivMode_Keypress }, // rxvt extension
3644 // 1035 enable modifiers for alt, numlock NYI 3611 // 1035 enable modifiers for alt, numlock NYI
3645 // 1036 send ESC for meta keys NYI 3612 // 1036 send ESC for meta keys NYI
3646 // 1037 send DEL for keypad delete NYI 3613 // 1037 send DEL for keypad delete NYI
3703 */ 3670 */
3704 PrivMode (1, PrivMode_vt52); 3671 PrivMode (1, PrivMode_vt52);
3705 break; 3672 break;
3706 case 3: /* 80/132 */ 3673 case 3: /* 80/132 */
3707 if (priv_modes & PrivMode_132OK) 3674 if (priv_modes & PrivMode_132OK)
3675 {
3676 scr_poweron ();
3708 set_widthheight (((state ? 132 : 80) * fwidth), height); 3677 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3678 }
3709 break; 3679 break;
3710 case 4: /* smooth scrolling */ 3680 case 4: /* smooth scrolling */
3711 set_option (Opt_jumpScroll, !state); 3681 set_option (Opt_jumpScroll, !state);
3712 break; 3682 break;
3713 case 5: /* reverse video */ 3683 case 5: /* reverse video */
3720 scr_autowrap (state); 3690 scr_autowrap (state);
3721 break; 3691 break;
3722 /* case 8: - auto repeat, can't do on a per window basis */ 3692 /* case 8: - auto repeat, can't do on a per window basis */
3723 case 9: /* X10 mouse reporting */ 3693 case 9: /* X10 mouse reporting */
3724 if (state) /* orthogonal */ 3694 if (state) /* orthogonal */
3725 priv_modes &= ~PrivMode_MouseX11; 3695 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3726 break; 3696 break;
3727#ifdef scrollBar_esc 3697#ifdef scrollBar_esc
3728 case scrollBar_esc: 3698 case scrollBar_esc:
3729 if (scrollbar_mapping (state)) 3699 if (scrollbar_mapping (state))
3730 { 3700 {
3743 break; 3713 break;
3744 /* case 66: - application key pad */ 3714 /* case 66: - application key pad */
3745 /* case 67: - backspace key */ 3715 /* case 67: - backspace key */
3746 case 1000: /* X11 mouse reporting */ 3716 case 1000: /* X11 mouse reporting */
3747 if (state) /* orthogonal */ 3717 if (state) /* orthogonal */
3748 priv_modes &= ~PrivMode_MouseX10; 3718 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3749 break; 3719 break;
3750#if 0
3751 case 1001: 3720 case 1002:
3752 break; /* X11 mouse highlighting */ 3721 case 1003:
3753#endif 3722 if (state)
3723 {
3724 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3725 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3726 vt_emask_mouse = PointerMotionMask;
3727 }
3728 else
3729 vt_emask_mouse = NoEventMask;
3730 vt_select_input ();
3731 break;
3754 case 1010: /* scroll to bottom on TTY output inhibit */ 3732 case 1010: /* scroll to bottom on TTY output inhibit */
3755 set_option (Opt_scrollTtyOutput, !state); 3733 set_option (Opt_scrollTtyOutput, !state);
3756 break; 3734 break;
3757 case 1011: /* scroll to bottom on key press */ 3735 case 1011: /* scroll to bottom on key press */
3758 set_option (Opt_scrollTtyKeypress, state); 3736 set_option (Opt_scrollTtyKeypress, state);
3935rxvt_term::process_graphics () 3913rxvt_term::process_graphics ()
3936{ 3914{
3937 unicode_t ch, cmd = cmd_getc (); 3915 unicode_t ch, cmd = cmd_getc ();
3938 3916
3939 if (cmd == 'Q') 3917 if (cmd == 'Q')
3918 {
3940 { /* query graphics */ 3919 /* query graphics */
3941 tt_printf ("\033G0\012"); /* no graphics */ 3920 tt_printf ("\033G0\012"); /* no graphics */
3942 return; 3921 return;
3943 } 3922 }
3944 /* swallow other graphics sequences until terminating ':' */ 3923 /* swallow other graphics sequences until terminating ':' */
3945 do 3924 do
3995 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 3974 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
3996 3975
3997 memcpy (v_buffer + v_buflen, data, len); 3976 memcpy (v_buffer + v_buflen, data, len);
3998 v_buflen += len; 3977 v_buflen += len;
3999 3978
4000 pty_ev.set (EVENT_READ | EVENT_WRITE); 3979 pty_ev.set (ev::READ | ev::WRITE);
4001} 3980}
4002 3981
4003void rxvt_term::pty_write () 3982void rxvt_term::pty_write ()
4004{ 3983{
4005 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 3984 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4010 3989
4011 if (v_buflen == 0) 3990 if (v_buflen == 0)
4012 { 3991 {
4013 free (v_buffer); 3992 free (v_buffer);
4014 v_buffer = 0; 3993 v_buffer = 0;
4015 v_buflen = 0;
4016 3994
4017 pty_ev.set (EVENT_READ); 3995 pty_ev.set (ev::READ);
4018 return; 3996 return;
4019 } 3997 }
4020 3998
4021 memmove (v_buffer, v_buffer + written, v_buflen); 3999 memmove (v_buffer, v_buffer + written, v_buflen);
4022 } 4000 }
4023 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4001 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4024 pty_ev.set (EVENT_READ); 4002 pty_ev.set (ev::READ);
4025} 4003}
4026 4004
4027/*----------------------- end-of-file (C source) -----------------------*/ 4005/*----------------------- end-of-file (C source) -----------------------*/
4028 4006

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines