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.359 by ayin, Mon Oct 15 14:56:06 2007 UTC vs.
Revision 1.394 by ayin, Sat Jan 19 15:00:49 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
549 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 550 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
550 { 551 {
551 { 552 {
552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; 553 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553 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
554 switch (keysym) 585 switch (keysym)
555 { 586 {
556#ifndef NO_BACKSPACE_KEY 587#ifndef NO_BACKSPACE_KEY
557 case XK_BackSpace: 588 case XK_BackSpace:
558 if (priv_modes & PrivMode_HaveBackSpace) 589 if (priv_modes & PrivMode_HaveBackSpace)
564 else 595 else
565 strcpy (kbuf, rs[Rs_backspace_key]); 596 strcpy (kbuf, rs[Rs_backspace_key]);
566 break; 597 break;
567#endif 598#endif
568#ifndef NO_DELETE_KEY 599#ifndef NO_DELETE_KEY
569# ifdef XK_KP_Delete
570 case XK_KP_Delete:
571 /* allow shift to override */
572 if (kp)
573 {
574 strcpy (kbuf, "\033On");
575 break;
576 }
577 /* FALLTHROUGH */
578# endif
579 case XK_Delete: 600 case XK_Delete:
580 strcpy (kbuf, rs[Rs_delete_key]); 601 strcpy (kbuf, rs[Rs_delete_key]);
581 break; 602 break;
582#endif 603#endif
583 case XK_Tab: 604 case XK_Tab:
595#endif 616#endif
596 newlen = 0; 617 newlen = 0;
597 } 618 }
598 break; 619 break;
599 620
600#ifdef XK_KP_Left
601 case XK_KP_Up: /* \033Ox or standard */
602 case XK_KP_Down: /* \033Or or standard */
603 case XK_KP_Right: /* \033Ov or standard */
604 case XK_KP_Left: /* \033Ot or standard */
605 if (kp)
606 {
607 strcpy (kbuf, "\033OZ");
608 kbuf[2] = "txvr"[keysym - XK_KP_Left];
609 break;
610 }
611 else
612 /* translate to std. cursor key */
613 keysym = XK_Left + (keysym - XK_KP_Left);
614 /* FALLTHROUGH */
615#endif
616 case XK_Up: /* "\033[A" */ 621 case XK_Up: /* "\033[A" */
617 case XK_Down: /* "\033[B" */ 622 case XK_Down: /* "\033[B" */
618 case XK_Right: /* "\033[C" */ 623 case XK_Right: /* "\033[C" */
619 case XK_Left: /* "\033[D" */ 624 case XK_Left: /* "\033[D" */
620 strcpy (kbuf, "\033[Z"); 625 strcpy (kbuf, "\033[Z");
630 else if (priv_modes & PrivMode_aplCUR) 635 else if (priv_modes & PrivMode_aplCUR)
631 kbuf[1] = 'O'; 636 kbuf[1] = 'O';
632 break; 637 break;
633 638
634#ifndef UNSHIFTED_SCROLLKEYS 639#ifndef UNSHIFTED_SCROLLKEYS
635# ifdef XK_KP_Prior
636 case XK_KP_Prior:
637 /* allow shift to override */
638 if (kp)
639 {
640 strcpy (kbuf, "\033Oy");
641 break;
642 }
643 /* FALLTHROUGH */
644# endif
645 case XK_Prior: 640 case XK_Prior:
646 strcpy (kbuf, "\033[5~"); 641 strcpy (kbuf, "\033[5~");
647 break; 642 break;
648# ifdef XK_KP_Next
649 case XK_KP_Next:
650 /* allow shift to override */
651 if (kp)
652 {
653 strcpy (kbuf, "\033Os");
654 break;
655 }
656 /* FALLTHROUGH */
657# endif
658 case XK_Next: 643 case XK_Next:
659 strcpy (kbuf, "\033[6~"); 644 strcpy (kbuf, "\033[6~");
660 break; 645 break;
661#endif 646#endif
662 case XK_KP_Enter: 647 case XK_KP_Enter:
681 kbuf[0] = '\015'; 666 kbuf[0] = '\015';
682 kbuf[1] = '\0'; 667 kbuf[1] = '\0';
683 } 668 }
684 break; 669 break;
685 670
686#ifdef XK_KP_Begin
687 case XK_KP_Begin:
688 strcpy (kbuf, "\033Ou");
689 break;
690
691#endif
692 case XK_KP_F1: /* "\033OP" */ 671 case XK_KP_F1: /* "\033OP" */
693 case XK_KP_F2: /* "\033OQ" */ 672 case XK_KP_F2: /* "\033OQ" */
694 case XK_KP_F3: /* "\033OR" */ 673 case XK_KP_F3: /* "\033OR" */
695 case XK_KP_F4: /* "\033OS" */ 674 case XK_KP_F4: /* "\033OS" */
696 strcpy (kbuf, "\033OP"); 675 strcpy (kbuf, "\033OP");
728 707
729 case XK_Find: 708 case XK_Find:
730 strcpy (kbuf, "\033[1~"); 709 strcpy (kbuf, "\033[1~");
731 break; 710 break;
732 711
733#ifdef XK_KP_Insert
734 case XK_KP_Insert:
735 /* allow shift to override */
736 if (kp)
737 {
738 strcpy (kbuf, "\033Op");
739 break;
740 }
741 /* FALLTHROUGH */
742#endif
743 case XK_Insert: 712 case XK_Insert:
744 strcpy (kbuf, "\033[2~"); 713 strcpy (kbuf, "\033[2~");
745 break; 714 break;
746#ifdef DXK_Remove /* support for DEC remove like key */ 715#ifdef DXK_Remove /* support for DEC remove like key */
747 case DXK_Remove: 716 case DXK_Remove:
751 strcpy (kbuf, "\033[3~"); 720 strcpy (kbuf, "\033[3~");
752 break; 721 break;
753 case XK_Select: 722 case XK_Select:
754 strcpy (kbuf, "\033[4~"); 723 strcpy (kbuf, "\033[4~");
755 break; 724 break;
756#ifdef XK_KP_End
757 case XK_KP_End:
758 /* allow shift to override */
759 if (kp)
760 {
761 strcpy (kbuf, "\033Oq");
762 break;
763 }
764 /* FALLTHROUGH */
765#endif
766 case XK_End: 725 case XK_End:
767 strcpy (kbuf, KS_END); 726 strcpy (kbuf, KS_END);
768 break; 727 break;
769#ifdef XK_KP_Home
770 case XK_KP_Home:
771 /* allow shift to override */
772 if (kp)
773 {
774 strcpy (kbuf, "\033Ow");
775 break;
776 }
777 /* FALLTHROUGH */
778#endif
779 case XK_Home: 728 case XK_Home:
780 strcpy (kbuf, KS_HOME); 729 strcpy (kbuf, KS_HOME);
781 break; 730 break;
782 731
783#define FKEY(n, fkey) \ 732#define FKEY(n, fkey) \
1034 983
1035void 984void
1036rxvt_term::flush () 985rxvt_term::flush ()
1037{ 986{
1038 flush_ev.stop (); 987 flush_ev.stop ();
1039 988
1040#ifdef HAVE_BG_PIXMAP 989#ifdef HAVE_BG_PIXMAP
1041 if (bgPixmap.check_clearChanged ()) 990 if (bgPixmap.check_clearChanged ())
1042 { 991 {
1043// scr_clear (true); This needs to be researched further! 992// scr_clear (true); This needs to be researched further!
1044 scr_touch (false); 993 scr_touch (false);
1045 } 994 }
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 = Pixel2Col (ev.x); 1264 x = Pixel2Col (ev.x);
1308 y = Pixel2Row (ev.y); 1265 y = Pixel2Row (ev.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 }
1309 1274
1310 if (MEvent.button == AnyButton) 1275 if (MEvent.button == AnyButton)
1311 button_number = 3; 1276 button_number = 3;
1312 else 1277 else
1313 { 1278 {
1359 x + 1, 1324 x + 1,
1360 y + 1); 1325 y + 1);
1361#endif 1326#endif
1362 1327
1363 tt_printf ("\033[M%c%c%c", 1328 tt_printf ("\033[M%c%c%c",
1364 (32 + button_number + key_state), 1329 (code + button_number + key_state),
1365 (32 + x + 1), 1330 (32 + x + 1),
1366 (32 + y + 1)); 1331 (32 + y + 1));
1367} 1332}
1368 1333
1369/*{{{ process an X event */ 1334/*{{{ process an X event */
1473 && ev.xfocus.mode != NotifyGrab) 1438 && ev.xfocus.mode != NotifyGrab)
1474 focus_out (); 1439 focus_out ();
1475 break; 1440 break;
1476 1441
1477 case ConfigureNotify: 1442 case ConfigureNotify:
1478 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n", 1443 /*fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1479 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y, 1444 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1480 szHint.width, szHint.height); */ 1445 szHint.width, szHint.height); */
1481 if (ev.xconfigure.window == parent[0]) 1446 if (ev.xconfigure.window == parent[0])
1482 { 1447 {
1483 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1448 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1490 } 1455 }
1491 else 1456 else
1492 { 1457 {
1493#ifdef HAVE_BG_PIXMAP 1458#ifdef HAVE_BG_PIXMAP
1494 if (bgPixmap.window_position_sensitive ()) 1459 if (bgPixmap.window_position_sensitive ())
1460 {
1461 if (mapped)
1495 update_background (); 1462 update_background ();
1463 else
1464 bgPixmap.invalidate ();
1465 }
1496#endif 1466#endif
1497 } 1467 }
1468
1498 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1469 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1499 } 1470 }
1500 break; 1471 break;
1501 1472
1502 case PropertyNotify: 1473 case PropertyNotify:
1519 case SelectionRequest: 1490 case SelectionRequest:
1520 selection_send (ev.xselectionrequest); 1491 selection_send (ev.xselectionrequest);
1521 break; 1492 break;
1522 1493
1523 case MapNotify: 1494 case MapNotify:
1495#ifdef HAVE_BG_PIXMAP
1496 /* This is needed spcifically to fix the case of no window manager or a
1497 * non-reparenting window manager. In those cases we never get first
1498 * ConfigureNotify. Also that speeds startup under normal WM, by taking
1499 * care of multiplicity of ConfigureNotify events arriwing while WM does
1500 * reparenting.
1501 * We should not render background immidiately, as there could be several
1502 * ConfigureNotify's to follow. Lets take care of all of them in one scoop
1503 * by scheduling background redraw as soon as we can, but giving a short
1504 * bit of time for ConfigureNotifies to arrive.
1505 * We should render background PRIOR to drawing any text, but AFTER all
1506 * of ConfigureNotifys for the best results.
1507 */
1508 if (bgPixmap.flags & bgPixmap_t::isInvalid)
1509 update_background_ev.start (0.025);
1510#endif
1524 mapped = 1; 1511 mapped = 1;
1525#ifdef TEXT_BLINK 1512#ifdef TEXT_BLINK
1526 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1513 text_blink_ev.start ();
1527#endif 1514#endif
1528 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1515 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1529 break; 1516 break;
1530 1517
1531 case UnmapNotify: 1518 case UnmapNotify:
1552 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1539 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1553 { 1540 {
1554 scr_expose (ev.xexpose.x, ev.xexpose.y, 1541 scr_expose (ev.xexpose.x, ev.xexpose.y,
1555 ev.xexpose.width, ev.xexpose.height, False); 1542 ev.xexpose.width, ev.xexpose.height, False);
1556 } 1543 }
1544
1557 want_refresh = 1; 1545 want_refresh = 1;
1558 } 1546 }
1559 else 1547 else
1560 { 1548 {
1561 XEvent unused_event; 1549 XEvent unused_event;
1563 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1551 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1564 ; 1552 ;
1565 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1553 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1566 ; 1554 ;
1567 1555
1568 if (isScrollbarWindow (ev.xany.window)) 1556 if (scrollBar.state && ev.xany.window == scrollBar.win)
1569 { 1557 {
1570 scrollBar.setIdle (); 1558 scrollBar.setIdle ();
1571 scrollbar_show (0); 1559 scrollbar_show (0);
1572 } 1560 }
1573 } 1561 }
1576 case MotionNotify: 1564 case MotionNotify:
1577#ifdef POINTER_BLANK 1565#ifdef POINTER_BLANK
1578 if (hidden_pointer) 1566 if (hidden_pointer)
1579 pointer_unblank (); 1567 pointer_unblank ();
1580#endif 1568#endif
1569 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1570 || priv_modes & PrivMode_MouseAnyEvent)
1571 mouse_report (ev.xbutton);
1581 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1572 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1582 break; 1573 break;
1583 1574
1584 if (ev.xany.window == vt) 1575 if (ev.xany.window == vt)
1585 { 1576 {
1619 int dist; 1610 int dist;
1620 1611
1621 /* don't clobber the current delay if we are 1612 /* don't clobber the current delay if we are
1622 * already in the middle of scrolling. 1613 * already in the middle of scrolling.
1623 */ 1614 */
1624 if (!sel_scroll_ev.active) 1615 if (!sel_scroll_ev.is_active ())
1625 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1616 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1626 1617
1627 /* save the event params so we can highlight 1618 /* save the event params so we can highlight
1628 * the selection in the pending-scroll loop 1619 * the selection in the pending-scroll loop
1629 */ 1620 */
1630 selection_save_x = ev.xbutton.x; 1621 selection_save_x = ev.xbutton.x;
1652 else 1643 else
1653 { 1644 {
1654 /* we are within the text window, so we 1645 /* we are within the text window, so we
1655 * shouldn't be scrolling 1646 * shouldn't be scrolling
1656 */ 1647 */
1657 if (sel_scroll_ev.active)
1658 sel_scroll_ev.stop(); 1648 sel_scroll_ev.stop();
1659 } 1649 }
1660#endif 1650#endif
1661#ifdef MOUSE_THRESHOLD 1651#ifdef MOUSE_THRESHOLD
1662 } 1652 }
1663#endif 1653#endif
1664 } 1654 }
1665 } 1655 }
1666 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1656 else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win)
1667 { 1657 {
1668 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1658 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1669 MotionNotify, &ev)) 1659 MotionNotify, &ev))
1670 ; 1660 ;
1671 1661
1689 { 1679 {
1690 hidden_cursor = 0; 1680 hidden_cursor = 0;
1691 want_refresh = 1; 1681 want_refresh = 1;
1692 } 1682 }
1693 1683
1694 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1684 cursor_blink_ev.again ();
1695 } 1685 }
1696#endif 1686#endif
1697 1687
1698#if defined(POINTER_BLANK) 1688#if defined(POINTER_BLANK)
1699 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1689 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1706 1696
1707 if (ev.type == KeyPress && hidden_pointer == 0) 1697 if (ev.type == KeyPress && hidden_pointer == 0)
1708 pointer_blank (); 1698 pointer_blank ();
1709 } 1699 }
1710#endif 1700#endif
1701
1702 refresh_check ();
1711} 1703}
1712 1704
1713void 1705void
1714rxvt_term::focus_in () 1706rxvt_term::focus_in ()
1715{ 1707{
1727 XSetICFocus (Input_Context); 1719 XSetICFocus (Input_Context);
1728 } 1720 }
1729#endif 1721#endif
1730#if CURSOR_BLINK 1722#if CURSOR_BLINK
1731 if (option (Opt_cursorBlink)) 1723 if (option (Opt_cursorBlink))
1732 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1724 cursor_blink_ev.again ();
1733#endif 1725#endif
1734#if OFF_FOCUS_FADING 1726#if OFF_FOCUS_FADING
1735 if (rs[Rs_fade]) 1727 if (rs[Rs_fade])
1736 { 1728 {
1737 pix_colors = pix_colors_focused; 1729 pix_colors = pix_colors_focused;
1775 XUnsetICFocus (Input_Context); 1767 XUnsetICFocus (Input_Context);
1776#endif 1768#endif
1777#if CURSOR_BLINK 1769#if CURSOR_BLINK
1778 if (option (Opt_cursorBlink)) 1770 if (option (Opt_cursorBlink))
1779 cursor_blink_ev.stop (); 1771 cursor_blink_ev.stop ();
1772
1780 hidden_cursor = 0; 1773 hidden_cursor = 0;
1781#endif 1774#endif
1782#if OFF_FOCUS_FADING 1775#if OFF_FOCUS_FADING
1783 if (rs[Rs_fade]) 1776 if (rs[Rs_fade])
1784 { 1777 {
1824 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1817 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1825 { 1818 {
1826 bgPixmap.set_root_pixmap (); 1819 bgPixmap.set_root_pixmap ();
1827 update_background (); 1820 update_background ();
1828 } 1821 }
1822
1829 break; 1823 break;
1830 } 1824 }
1831# endif 1825# endif
1826
1827 refresh_check ();
1832} 1828}
1833#endif 1829#endif
1834 1830
1835void 1831void
1836rxvt_term::button_press (XButtonEvent &ev) 1832rxvt_term::button_press (XButtonEvent &ev)
1891 mouse_report (ev); 1887 mouse_report (ev);
1892 } 1888 }
1893#else 1889#else
1894 MEvent.button = ev.button; 1890 MEvent.button = ev.button;
1895 mouse_report (ev); 1891 mouse_report (ev);
1896#endif /* MOUSE_REPORT_DOUBLECLICK */ 1892#endif /* MOUSE_REPORT_DOUBLECLICK */
1897 1893
1898 } 1894 }
1899 else 1895 else
1900 { 1896 {
1901 if (ev.button != MEvent.button) 1897 if (ev.button != MEvent.button)
1949 } 1945 }
1950 1946
1951 /* 1947 /*
1952 * Scrollbar window processing of button press 1948 * Scrollbar window processing of button press
1953 */ 1949 */
1954 if (isScrollbarWindow (ev.window)) 1950 if (scrollBar.state && ev.window == scrollBar.win)
1955 { 1951 {
1956 scrollBar.setIdle (); 1952 scrollBar.setIdle ();
1957 /* 1953 /*
1958 * Rxvt-style scrollbar: 1954 * Rxvt-style scrollbar:
1959 * move up if mouse is above slider 1955 * move up if mouse is above slider
1995 tt_printf ("\033[5~"); 1991 tt_printf ("\033[5~");
1996 break; 1992 break;
1997 } 1993 }
1998 } 1994 }
1999 else 1995 else
2000#endif /* NO_SCROLLBAR_REPORT */ 1996#endif /* NO_SCROLLBAR_REPORT */
2001 1997
2002 { 1998 {
2003 char upordown = 0; 1999 char upordown = 0;
2004 2000
2005 if (scrollBar.style == R_SB_NEXT) 2001 if (scrollBar.style == R_SB_NEXT)
2006 { 2002 {
2007 if (scrollbarnext_upButton (ev.y)) 2003 if (scrollbarnext_upButton (ev.y))
2008 upordown = -1; /* up */ 2004 upordown = -1; /* up */
2014 if (scrollbarrxvt_upButton (ev.y)) 2010 if (scrollbarrxvt_upButton (ev.y))
2015 upordown = -1; /* up */ 2011 upordown = -1; /* up */
2016 else if (scrollbarrxvt_dnButton (ev.y)) 2012 else if (scrollbarrxvt_dnButton (ev.y))
2017 upordown = 1; /* down */ 2013 upordown = 1; /* down */
2018 } 2014 }
2015
2019 if (upordown) 2016 if (upordown)
2020 { 2017 {
2021#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2018#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2019 if (!cont_scroll_ev.is_active ())
2022 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2020 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2023#endif 2021#endif
2024 if (scr_page (upordown < 0 ? UP : DN, 1)) 2022 if (scr_page (upordown < 0 ? UP : DN, 1))
2025 { 2023 {
2026 if (upordown < 0) 2024 if (upordown < 0)
2027 scrollBar.setUp (); 2025 scrollBar.setUp ();
2031 } 2029 }
2032 else 2030 else
2033 switch (ev.button) 2031 switch (ev.button)
2034 { 2032 {
2035 case Button2: 2033 case Button2:
2036 switch (scrollbar_align) 2034 switch (scrollBar.align)
2037 { 2035 {
2038 case R_SB_ALIGN_TOP: 2036 case R_SB_ALIGN_TOP:
2039 csrO = 0; 2037 csrO = 0;
2040 break; 2038 break;
2041 case R_SB_ALIGN_CENTRE: 2039 case R_SB_ALIGN_CENTRE:
2053 2051
2054 scrollBar.setMotion (); 2052 scrollBar.setMotion ();
2055 break; 2053 break;
2056 2054
2057 case Button1: 2055 case Button1:
2058 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2056 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2059 csrO = ev.y - scrollBar.top; 2057 csrO = ev.y - scrollBar.top;
2060 /* FALLTHROUGH */ 2058 /* FALLTHROUGH */
2061 2059
2062 case Button3: 2060 case Button3:
2063 if (scrollBar.style != R_SB_XTERM) 2061 if (scrollBar.style != R_SB_XTERM)
2107 scrollBar.setIdle (); 2105 scrollBar.setIdle ();
2108 scrollbar_show (0); 2106 scrollbar_show (0);
2109 } 2107 }
2110 2108
2111#ifdef SELECTION_SCROLLING 2109#ifdef SELECTION_SCROLLING
2112 if (sel_scroll_ev.active)
2113 sel_scroll_ev.stop(); 2110 sel_scroll_ev.stop();
2114#endif 2111#endif
2115 2112
2116 if (ev.window == vt) 2113 if (ev.window == vt)
2117 { 2114 {
2118 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2115 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2142 mouse_report (ev); 2139 mouse_report (ev);
2143 } 2140 }
2144#else /* MOUSE_REPORT_DOUBLECLICK */ 2141#else /* MOUSE_REPORT_DOUBLECLICK */
2145 MEvent.button = AnyButton; 2142 MEvent.button = AnyButton;
2146 mouse_report (ev); 2143 mouse_report (ev);
2147#endif /* MOUSE_REPORT_DOUBLECLICK */ 2144#endif /* MOUSE_REPORT_DOUBLECLICK */
2148 return; 2145 return;
2149 } 2146 }
2150 2147
2151 /* 2148 /*
2152 * dumb hack to compensate for the failure of click-and-drag 2149 * dumb hack to compensate for the failure of click-and-drag
2190 { 2187 {
2191 mouse_slip_wheel_speed += v ? -1 : 1; 2188 mouse_slip_wheel_speed += v ? -1 : 1;
2192 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2189 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2193 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2190 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2194 2191
2195 if (slip_wheel_ev.at < NOW) 2192 if (!slip_wheel_ev.is_active ())
2196 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; 2193 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2197
2198 slip_wheel_ev.start ();
2199 } 2194 }
2200 else 2195 else
2196# endif
2201 { 2197 {
2202# endif
2203 scr_page (v, i); 2198 scr_page (v, i);
2204 scrollbar_show (1); 2199 scrollbar_show (1);
2205# ifdef MOUSE_SLIP_WHEELING
2206 } 2200 }
2207# endif
2208 } 2201 }
2209 break; 2202 break;
2210#endif 2203#endif
2211 } 2204 }
2212 } 2205 }
2271 2264
2272 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2265 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2273 { 2266 {
2274 refresh_count = 0; 2267 refresh_count = 0;
2275 2268
2276 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2269 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2277 { 2270 {
2278 refreshnow = true; 2271 refreshnow = true;
2279 ch = NOCHAR; 2272 ch = NOCHAR;
2280 break; 2273 break;
2281 } 2274 }
2492 } 2485 }
2493 } 2486 }
2494 2487
2495 pclose_printer (fd); 2488 pclose_printer (fd);
2496} 2489}
2497#endif /* PRINTPIPE */ 2490#endif /* PRINTPIPE */
2498/*}}} */ 2491/*}}} */
2499 2492
2500/* *INDENT-OFF* */ 2493/* *INDENT-OFF* */
2501enum { 2494enum {
2502 C1_40 = 0x40, 2495 C1_40 = 0x40,
2795 nargs = 0; 2788 nargs = 0;
2796 2789
2797 priv = 0; 2790 priv = 0;
2798 ch = cmd_getc (); 2791 ch = cmd_getc ();
2799 if (ch >= '<' && ch <= '?') 2792 if (ch >= '<' && ch <= '?')
2793 {
2800 { /* '<' '=' '>' '?' */ 2794 /* '<' '=' '>' '?' */
2801 priv = ch; 2795 priv = ch;
2802 ch = cmd_getc (); 2796 ch = cmd_getc ();
2803 } 2797 }
2804 2798
2805 /* read any numerical arguments */ 2799 /* read any numerical arguments */
2848 { 2842 {
2849 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, 2843 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2850 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2844 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2851 // 2845 //
2852 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2846 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2853 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2847 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2854 // that we do not support xterm mouse reporting (should be 95 when we do). 2848 // versions.
2855 // 2849 //
2856 tt_printf ("\033[>%d;94;0c", 'U'); 2850 tt_printf ("\033[>%d;95;0c", 'U');
2857 } 2851 }
2858 break; 2852 break;
2859 case '?': 2853 case '?':
2860 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2854 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2861 process_terminal_mode (ch, priv, nargs, arg); 2855 process_terminal_mode (ch, priv, nargs, arg);
3379 *buf++ = '\0'; 3373 *buf++ = '\0';
3380 3374
3381 process_color_seq (op, color, name, resp); 3375 process_color_seq (op, color, name, resp);
3382 } 3376 }
3383 break; 3377 break;
3378 case Rxvt_restoreFG:
3384 case XTerm_Color00: 3379 case XTerm_Color00:
3385 process_color_seq (op, Color_fg, str, resp); 3380 process_color_seq (op, Color_fg, str, resp);
3386 break; 3381 break;
3382 case Rxvt_restoreBG:
3387 case XTerm_Color01: 3383 case XTerm_Color01:
3388 process_color_seq (op, Color_bg, str, resp); 3384 process_color_seq (op, Color_bg, str, resp);
3389 break; 3385 break;
3390#ifndef NO_CURSORCOLOR 3386#ifndef NO_CURSORCOLOR
3391 case XTerm_Color_cursor: 3387 case XTerm_Color_cursor:
3417#if ENABLE_TRANSPARENCY 3413#if ENABLE_TRANSPARENCY
3418 case URxvt_Color_tint: 3414 case URxvt_Color_tint:
3419 process_color_seq (op, Color_tint, str, resp); 3415 process_color_seq (op, Color_tint, str, resp);
3420 { 3416 {
3421 bool changed = false; 3417 bool changed = false;
3418
3422 if (ISSET_PIXCOLOR (Color_tint)) 3419 if (ISSET_PIXCOLOR (Color_tint))
3423 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3420 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3424 else 3421 else
3425 changed = bgPixmap.unset_tint (); 3422 changed = bgPixmap.unset_tint ();
3423
3426 if (changed) 3424 if (changed)
3427 update_background (); 3425 update_background ();
3428 } 3426 }
3429 3427
3430 break; 3428 break;
3453 changed++; 3451 changed++;
3454 str = strchr (str, ';'); 3452 str = strchr (str, ';');
3455 if (str == NULL) 3453 if (str == NULL)
3456 bgPixmap.set_defaultGeometry (); 3454 bgPixmap.set_defaultGeometry ();
3457 } 3455 }
3456
3458 while (str) 3457 while (str)
3459 { 3458 {
3460 str++; 3459 str++;
3461 if (bgPixmap.set_geometry (str)) 3460 if (bgPixmap.set_geometry (str))
3462 changed++; 3461 changed++;
3463 str = strchr (str, ';'); 3462 str = strchr (str, ';');
3464 } 3463 }
3464
3465 if (changed) 3465 if (changed)
3466 update_background (); 3466 update_background ();
3467 } 3467 }
3468 break; 3468 break;
3469#endif 3469#endif
3470
3471 case Rxvt_restoreFG:
3472 set_window_color (Color_fg, str);
3473 break;
3474 case Rxvt_restoreBG:
3475 set_window_color (Color_bg, str);
3476 break;
3477 3470
3478 case XTerm_logfile: 3471 case XTerm_logfile:
3479 // TODO, when secure mode? 3472 // TODO, when secure mode?
3480 break; 3473 break;
3481 3474
3625 { 66, PrivMode_aplKP }, 3618 { 66, PrivMode_aplKP },
3626#ifndef NO_BACKSPACE_KEY 3619#ifndef NO_BACKSPACE_KEY
3627 { 67, PrivMode_BackSpace }, 3620 { 67, PrivMode_BackSpace },
3628#endif 3621#endif
3629 { 1000, PrivMode_MouseX11 }, 3622 { 1000, PrivMode_MouseX11 },
3630 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3623 { 1002, PrivMode_MouseBtnEvent },
3631 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3624 { 1003, PrivMode_MouseAnyEvent },
3632 // 1003 Use All Motion Mouse Tracking. NYI, TODO
3633 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3625 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3634 { 1011, PrivMode_Keypress }, // rxvt extension 3626 { 1011, PrivMode_Keypress }, // rxvt extension
3635 // 1035 enable modifiers for alt, numlock NYI 3627 // 1035 enable modifiers for alt, numlock NYI
3636 // 1036 send ESC for meta keys NYI 3628 // 1036 send ESC for meta keys NYI
3637 // 1037 send DEL for keypad delete NYI 3629 // 1037 send DEL for keypad delete NYI
3694 */ 3686 */
3695 PrivMode (1, PrivMode_vt52); 3687 PrivMode (1, PrivMode_vt52);
3696 break; 3688 break;
3697 case 3: /* 80/132 */ 3689 case 3: /* 80/132 */
3698 if (priv_modes & PrivMode_132OK) 3690 if (priv_modes & PrivMode_132OK)
3691 {
3692 scr_poweron ();
3699 set_widthheight (((state ? 132 : 80) * fwidth), height); 3693 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3694 }
3700 break; 3695 break;
3701 case 4: /* smooth scrolling */ 3696 case 4: /* smooth scrolling */
3702 set_option (Opt_jumpScroll, !state); 3697 set_option (Opt_jumpScroll, !state);
3703 break; 3698 break;
3704 case 5: /* reverse video */ 3699 case 5: /* reverse video */
3711 scr_autowrap (state); 3706 scr_autowrap (state);
3712 break; 3707 break;
3713 /* case 8: - auto repeat, can't do on a per window basis */ 3708 /* case 8: - auto repeat, can't do on a per window basis */
3714 case 9: /* X10 mouse reporting */ 3709 case 9: /* X10 mouse reporting */
3715 if (state) /* orthogonal */ 3710 if (state) /* orthogonal */
3716 priv_modes &= ~PrivMode_MouseX11; 3711 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3717 break; 3712 break;
3718#ifdef scrollBar_esc 3713#ifdef scrollBar_esc
3719 case scrollBar_esc: 3714 case scrollBar_esc:
3720 if (scrollbar_mapping (state)) 3715 if (scrollbar_mapping (state))
3721 { 3716 {
3734 break; 3729 break;
3735 /* case 66: - application key pad */ 3730 /* case 66: - application key pad */
3736 /* case 67: - backspace key */ 3731 /* case 67: - backspace key */
3737 case 1000: /* X11 mouse reporting */ 3732 case 1000: /* X11 mouse reporting */
3738 if (state) /* orthogonal */ 3733 if (state) /* orthogonal */
3739 priv_modes &= ~PrivMode_MouseX10; 3734 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3740 break; 3735 break;
3741#if 0
3742 case 1001: 3736 case 1002:
3743 break; /* X11 mouse highlighting */ 3737 case 1003:
3744#endif 3738 if (state)
3739 {
3740 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3741 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3742 vt_emask_mouse = PointerMotionMask;
3743 }
3744 else
3745 vt_emask_mouse = NoEventMask;
3746 vt_select_input ();
3747 break;
3745 case 1010: /* scroll to bottom on TTY output inhibit */ 3748 case 1010: /* scroll to bottom on TTY output inhibit */
3746 set_option (Opt_scrollTtyOutput, !state); 3749 set_option (Opt_scrollTtyOutput, !state);
3747 break; 3750 break;
3748 case 1011: /* scroll to bottom on key press */ 3751 case 1011: /* scroll to bottom on key press */
3749 set_option (Opt_scrollTtyKeypress, state); 3752 set_option (Opt_scrollTtyKeypress, state);
3926rxvt_term::process_graphics () 3929rxvt_term::process_graphics ()
3927{ 3930{
3928 unicode_t ch, cmd = cmd_getc (); 3931 unicode_t ch, cmd = cmd_getc ();
3929 3932
3930 if (cmd == 'Q') 3933 if (cmd == 'Q')
3934 {
3931 { /* query graphics */ 3935 /* query graphics */
3932 tt_printf ("\033G0\012"); /* no graphics */ 3936 tt_printf ("\033G0\012"); /* no graphics */
3933 return; 3937 return;
3934 } 3938 }
3935 /* swallow other graphics sequences until terminating ':' */ 3939 /* swallow other graphics sequences until terminating ':' */
3936 do 3940 do
3986 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 3990 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
3987 3991
3988 memcpy (v_buffer + v_buflen, data, len); 3992 memcpy (v_buffer + v_buflen, data, len);
3989 v_buflen += len; 3993 v_buflen += len;
3990 3994
3991 pty_ev.set (EVENT_READ | EVENT_WRITE); 3995 pty_ev.set (ev::READ | ev::WRITE);
3992} 3996}
3993 3997
3994void rxvt_term::pty_write () 3998void rxvt_term::pty_write ()
3995{ 3999{
3996 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 4000 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4002 if (v_buflen == 0) 4006 if (v_buflen == 0)
4003 { 4007 {
4004 free (v_buffer); 4008 free (v_buffer);
4005 v_buffer = 0; 4009 v_buffer = 0;
4006 4010
4007 pty_ev.set (EVENT_READ); 4011 pty_ev.set (ev::READ);
4008 return; 4012 return;
4009 } 4013 }
4010 4014
4011 memmove (v_buffer, v_buffer + written, v_buflen); 4015 memmove (v_buffer, v_buffer + written, v_buflen);
4012 } 4016 }
4013 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4017 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4014 pty_ev.set (EVENT_READ); 4018 pty_ev.set (ev::READ);
4015} 4019}
4016 4020
4017/*----------------------- end-of-file (C source) -----------------------*/ 4021/*----------------------- end-of-file (C source) -----------------------*/
4018 4022

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines