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.361 by ayin, Wed Oct 31 09:55:23 2007 UTC vs.
Revision 1.402 by ayin, Fri Feb 1 14:13:52 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) \
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.state == STATE_UP || scrollBar.state == STATE_DOWN)
1147 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1096 && scr_page (scrollBar.state == STATE_UP ? 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}
1305 int x, y; 1261 int x, y;
1306 int code = 32; 1262 int code = 32;
1307 1263
1308 x = Pixel2Col (ev.x); 1264 x = Pixel2Col (ev.x);
1309 y = Pixel2Row (ev.y); 1265 y = Pixel2Row (ev.y);
1310 if (ev.type == MotionNotify) { 1266 if (ev.type == MotionNotify)
1267 {
1311 if (x == mouse_row && y == mouse_col) 1268 if (x == mouse_row && y == mouse_col)
1312 return; 1269 return;
1313 mouse_row = x; 1270 mouse_row = x;
1314 mouse_col = y; 1271 mouse_col = y;
1315 code += 32; 1272 code += 32;
1316 } 1273 }
1317 1274
1318 if (MEvent.button == AnyButton) 1275 if (MEvent.button == AnyButton)
1319 button_number = 3; 1276 button_number = 3;
1320 else 1277 else
1321 { 1278 {
1481 && ev.xfocus.mode != NotifyGrab) 1438 && ev.xfocus.mode != NotifyGrab)
1482 focus_out (); 1439 focus_out ();
1483 break; 1440 break;
1484 1441
1485 case ConfigureNotify: 1442 case ConfigureNotify:
1486 /* 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",
1487 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,
1488 szHint.width, szHint.height); */ 1445 szHint.width, szHint.height);*/
1489 if (ev.xconfigure.window == parent[0]) 1446 if (ev.xconfigure.window == parent[0])
1490 { 1447 {
1491 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1448 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1492 ; 1449 ;
1493 1450
1498 } 1455 }
1499 else 1456 else
1500 { 1457 {
1501#ifdef HAVE_BG_PIXMAP 1458#ifdef HAVE_BG_PIXMAP
1502 if (bgPixmap.window_position_sensitive ()) 1459 if (bgPixmap.window_position_sensitive ())
1460 {
1461 if (mapped)
1503 update_background (); 1462 update_background ();
1463 else
1464 bgPixmap.invalidate ();
1465 }
1504#endif 1466#endif
1505 } 1467 }
1468
1506 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1469 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1507 } 1470 }
1508 break; 1471 break;
1509 1472
1510 case PropertyNotify: 1473 case PropertyNotify:
1527 case SelectionRequest: 1490 case SelectionRequest:
1528 selection_send (ev.xselectionrequest); 1491 selection_send (ev.xselectionrequest);
1529 break; 1492 break;
1530 1493
1531 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
1532 mapped = 1; 1511 mapped = 1;
1533#ifdef TEXT_BLINK 1512#ifdef TEXT_BLINK
1534 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1513 text_blink_ev.start ();
1535#endif 1514#endif
1536 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1515 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1537 break; 1516 break;
1538 1517
1539 case UnmapNotify: 1518 case UnmapNotify:
1560 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1539 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1561 { 1540 {
1562 scr_expose (ev.xexpose.x, ev.xexpose.y, 1541 scr_expose (ev.xexpose.x, ev.xexpose.y,
1563 ev.xexpose.width, ev.xexpose.height, False); 1542 ev.xexpose.width, ev.xexpose.height, False);
1564 } 1543 }
1544
1565 want_refresh = 1; 1545 want_refresh = 1;
1566 } 1546 }
1567 else 1547 else
1568 { 1548 {
1569 XEvent unused_event; 1549 XEvent unused_event;
1571 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1551 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1572 ; 1552 ;
1573 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1553 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1574 ; 1554 ;
1575 1555
1576 if (isScrollbarWindow (ev.xany.window)) 1556 if (scrollBar.state && ev.xany.window == scrollBar.win)
1577 { 1557 {
1578 scrollBar.setIdle (); 1558 scrollBar.state = STATE_IDLE;
1579 scrollbar_show (0); 1559 scrollbar_show (0);
1580 } 1560 }
1581 } 1561 }
1582 break; 1562 break;
1583 1563
1630 int dist; 1610 int dist;
1631 1611
1632 /* don't clobber the current delay if we are 1612 /* don't clobber the current delay if we are
1633 * already in the middle of scrolling. 1613 * already in the middle of scrolling.
1634 */ 1614 */
1635 if (!sel_scroll_ev.active) 1615 if (!sel_scroll_ev.is_active ())
1636 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1616 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1637 1617
1638 /* save the event params so we can highlight 1618 /* save the event params so we can highlight
1639 * the selection in the pending-scroll loop 1619 * the selection in the pending-scroll loop
1640 */ 1620 */
1641 selection_save_x = ev.xbutton.x; 1621 selection_save_x = ev.xbutton.x;
1663 else 1643 else
1664 { 1644 {
1665 /* we are within the text window, so we 1645 /* we are within the text window, so we
1666 * shouldn't be scrolling 1646 * shouldn't be scrolling
1667 */ 1647 */
1668 if (sel_scroll_ev.active)
1669 sel_scroll_ev.stop(); 1648 sel_scroll_ev.stop();
1670 } 1649 }
1671#endif 1650#endif
1672#ifdef MOUSE_THRESHOLD 1651#ifdef MOUSE_THRESHOLD
1673 } 1652 }
1674#endif 1653#endif
1675 } 1654 }
1676 } 1655 }
1677 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1656 else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win)
1678 { 1657 {
1679 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1658 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1680 MotionNotify, &ev)) 1659 MotionNotify, &ev))
1681 ; 1660 ;
1682 1661
1700 { 1679 {
1701 hidden_cursor = 0; 1680 hidden_cursor = 0;
1702 want_refresh = 1; 1681 want_refresh = 1;
1703 } 1682 }
1704 1683
1705 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1684 cursor_blink_ev.again ();
1706 } 1685 }
1707#endif 1686#endif
1708 1687
1709#if defined(POINTER_BLANK) 1688#if defined(POINTER_BLANK)
1710 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1689 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1717 1696
1718 if (ev.type == KeyPress && hidden_pointer == 0) 1697 if (ev.type == KeyPress && hidden_pointer == 0)
1719 pointer_blank (); 1698 pointer_blank ();
1720 } 1699 }
1721#endif 1700#endif
1701
1702 refresh_check ();
1722} 1703}
1723 1704
1724void 1705void
1725rxvt_term::focus_in () 1706rxvt_term::focus_in ()
1726{ 1707{
1738 XSetICFocus (Input_Context); 1719 XSetICFocus (Input_Context);
1739 } 1720 }
1740#endif 1721#endif
1741#if CURSOR_BLINK 1722#if CURSOR_BLINK
1742 if (option (Opt_cursorBlink)) 1723 if (option (Opt_cursorBlink))
1743 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1724 cursor_blink_ev.again ();
1744#endif 1725#endif
1745#if OFF_FOCUS_FADING 1726#if OFF_FOCUS_FADING
1746 if (rs[Rs_fade]) 1727 if (rs[Rs_fade])
1747 { 1728 {
1748 pix_colors = pix_colors_focused; 1729 pix_colors = pix_colors_focused;
1786 XUnsetICFocus (Input_Context); 1767 XUnsetICFocus (Input_Context);
1787#endif 1768#endif
1788#if CURSOR_BLINK 1769#if CURSOR_BLINK
1789 if (option (Opt_cursorBlink)) 1770 if (option (Opt_cursorBlink))
1790 cursor_blink_ev.stop (); 1771 cursor_blink_ev.stop ();
1772
1791 hidden_cursor = 0; 1773 hidden_cursor = 0;
1792#endif 1774#endif
1793#if OFF_FOCUS_FADING 1775#if OFF_FOCUS_FADING
1794 if (rs[Rs_fade]) 1776 if (rs[Rs_fade])
1795 { 1777 {
1835 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1817 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1836 { 1818 {
1837 bgPixmap.set_root_pixmap (); 1819 bgPixmap.set_root_pixmap ();
1838 update_background (); 1820 update_background ();
1839 } 1821 }
1822
1840 break; 1823 break;
1841 } 1824 }
1842# endif 1825# endif
1826
1827 refresh_check ();
1843} 1828}
1844#endif 1829#endif
1845 1830
1846void 1831void
1847rxvt_term::button_press (XButtonEvent &ev) 1832rxvt_term::button_press (XButtonEvent &ev)
1902 mouse_report (ev); 1887 mouse_report (ev);
1903 } 1888 }
1904#else 1889#else
1905 MEvent.button = ev.button; 1890 MEvent.button = ev.button;
1906 mouse_report (ev); 1891 mouse_report (ev);
1907#endif /* MOUSE_REPORT_DOUBLECLICK */ 1892#endif /* MOUSE_REPORT_DOUBLECLICK */
1908 1893
1909 } 1894 }
1910 else 1895 else
1911 { 1896 {
1912 if (ev.button != MEvent.button) 1897 if (ev.button != MEvent.button)
1960 } 1945 }
1961 1946
1962 /* 1947 /*
1963 * Scrollbar window processing of button press 1948 * Scrollbar window processing of button press
1964 */ 1949 */
1965 if (isScrollbarWindow (ev.window)) 1950 if (scrollBar.state && ev.window == scrollBar.win)
1966 { 1951 {
1967 scrollBar.setIdle (); 1952 int upordown = 0;
1953
1954 if (scrollBar.upButton (ev.y))
1955 upordown = -1; /* up */
1956 else if (scrollBar.dnButton (ev.y))
1957 upordown = 1; /* down */
1958
1959 scrollBar.state = STATE_IDLE;
1968 /* 1960 /*
1969 * Rxvt-style scrollbar: 1961 * Rxvt-style scrollbar:
1970 * move up if mouse is above slider 1962 * move up if mouse is above slider
1971 * move dn if mouse is below slider 1963 * move dn if mouse is below slider
1972 * 1964 *
1981 /* 1973 /*
1982 * Mouse report disabled scrollbar: 1974 * Mouse report disabled scrollbar:
1983 * arrow buttons - send up/down 1975 * arrow buttons - send up/down
1984 * click on scrollbar - send pageup/down 1976 * click on scrollbar - send pageup/down
1985 */ 1977 */
1986 if ((scrollBar.style == R_SB_NEXT 1978 if (upordown < 0)
1987 && scrollbarnext_upButton (ev.y))
1988 || (scrollBar.style == R_SB_RXVT
1989 && scrollbarrxvt_upButton (ev.y)))
1990 tt_printf ("\033[A"); 1979 tt_printf ("\033[A");
1991 else if ((scrollBar.style == R_SB_NEXT 1980 else if (upordown > 0)
1992 && scrollbarnext_dnButton (ev.y))
1993 || (scrollBar.style == R_SB_RXVT
1994 && scrollbarrxvt_dnButton (ev.y)))
1995 tt_printf ("\033[B"); 1981 tt_printf ("\033[B");
1996 else 1982 else
1997 switch (ev.button) 1983 switch (ev.button)
1998 { 1984 {
1999 case Button2: 1985 case Button2:
2006 tt_printf ("\033[5~"); 1992 tt_printf ("\033[5~");
2007 break; 1993 break;
2008 } 1994 }
2009 } 1995 }
2010 else 1996 else
2011#endif /* NO_SCROLLBAR_REPORT */ 1997#endif /* NO_SCROLLBAR_REPORT */
2012 1998
2013 {
2014 char upordown = 0;
2015
2016 if (scrollBar.style == R_SB_NEXT)
2017 { 1999 {
2018 if (scrollbarnext_upButton (ev.y))
2019 upordown = -1; /* up */
2020 else if (scrollbarnext_dnButton (ev.y))
2021 upordown = 1; /* down */
2022 }
2023 else if (scrollBar.style == R_SB_RXVT)
2024 {
2025 if (scrollbarrxvt_upButton (ev.y))
2026 upordown = -1; /* up */
2027 else if (scrollbarrxvt_dnButton (ev.y))
2028 upordown = 1; /* down */
2029 }
2030 if (upordown) 2000 if (upordown)
2031 { 2001 {
2032#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2002#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2003 if (!cont_scroll_ev.is_active ())
2033 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2004 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2034#endif 2005#endif
2035 if (scr_page (upordown < 0 ? UP : DN, 1)) 2006 if (scr_page (upordown < 0 ? UP : DN, 1))
2036 { 2007 {
2037 if (upordown < 0) 2008 if (upordown < 0)
2038 scrollBar.setUp (); 2009 scrollBar.state = STATE_UP;
2039 else 2010 else
2040 scrollBar.setDn (); 2011 scrollBar.state = STATE_DOWN;
2041 } 2012 }
2042 } 2013 }
2043 else 2014 else
2044 switch (ev.button) 2015 switch (ev.button)
2045 { 2016 {
2046 case Button2: 2017 case Button2:
2047 switch (scrollbar_align) 2018 switch (scrollBar.align)
2048 { 2019 {
2049 case R_SB_ALIGN_TOP: 2020 case R_SB_ALIGN_TOP:
2050 csrO = 0; 2021 csrO = 0;
2051 break; 2022 break;
2052 case R_SB_ALIGN_CENTRE: 2023 case R_SB_ALIGN_CENTRE:
2060 if (scrollBar.style == R_SB_XTERM 2031 if (scrollBar.style == R_SB_XTERM
2061 || scrollbar_above_slider (ev.y) 2032 || scrollbar_above_slider (ev.y)
2062 || scrollbar_below_slider (ev.y)) 2033 || scrollbar_below_slider (ev.y))
2063 scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); 2034 scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ());
2064 2035
2065 scrollBar.setMotion (); 2036 scrollBar.state = STATE_MOTION;
2066 break; 2037 break;
2067 2038
2068 case Button1: 2039 case Button1:
2069 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2040 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2070 csrO = ev.y - scrollBar.top; 2041 csrO = ev.y - scrollBar.top;
2071 /* FALLTHROUGH */ 2042 /* FALLTHROUGH */
2072 2043
2073 case Button3: 2044 case Button3:
2074 if (scrollBar.style != R_SB_XTERM) 2045 if (scrollBar.style != R_SB_XTERM)
2084 scr_page (DN, nrow - 1); 2055 scr_page (DN, nrow - 1);
2085# else 2056# else
2086 scr_page (DN, nrow / 4); 2057 scr_page (DN, nrow / 4);
2087# endif 2058# endif
2088 else 2059 else
2089 scrollBar.setMotion (); 2060 scrollBar.state = STATE_MOTION;
2090 } 2061 }
2091 else 2062 else
2092 { 2063 {
2093 scr_page ((ev.button == Button1 ? DN : UP), 2064 scr_page ((ev.button == Button1 ? DN : UP),
2094 (nrow 2065 (nrow
2111 2082
2112 csrO = 0; /* reset csr Offset */ 2083 csrO = 0; /* reset csr Offset */
2113 if (!bypass_keystate) 2084 if (!bypass_keystate)
2114 reportmode = !! (priv_modes & PrivMode_mouse_report); 2085 reportmode = !! (priv_modes & PrivMode_mouse_report);
2115 2086
2116 if (scrollbar_isUpDn ()) 2087 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN)
2117 { 2088 {
2118 scrollBar.setIdle (); 2089 scrollBar.state = STATE_IDLE;
2119 scrollbar_show (0); 2090 scrollbar_show (0);
2120 } 2091 }
2121 2092
2122#ifdef SELECTION_SCROLLING 2093#ifdef SELECTION_SCROLLING
2123 if (sel_scroll_ev.active)
2124 sel_scroll_ev.stop(); 2094 sel_scroll_ev.stop();
2125#endif 2095#endif
2126 2096
2127 if (ev.window == vt) 2097 if (ev.window == vt)
2128 { 2098 {
2129 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2099 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2153 mouse_report (ev); 2123 mouse_report (ev);
2154 } 2124 }
2155#else /* MOUSE_REPORT_DOUBLECLICK */ 2125#else /* MOUSE_REPORT_DOUBLECLICK */
2156 MEvent.button = AnyButton; 2126 MEvent.button = AnyButton;
2157 mouse_report (ev); 2127 mouse_report (ev);
2158#endif /* MOUSE_REPORT_DOUBLECLICK */ 2128#endif /* MOUSE_REPORT_DOUBLECLICK */
2159 return; 2129 return;
2160 } 2130 }
2161 2131
2162 /* 2132 /*
2163 * dumb hack to compensate for the failure of click-and-drag 2133 * dumb hack to compensate for the failure of click-and-drag
2201 { 2171 {
2202 mouse_slip_wheel_speed += v ? -1 : 1; 2172 mouse_slip_wheel_speed += v ? -1 : 1;
2203 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2173 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2204 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2174 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2205 2175
2206 if (slip_wheel_ev.at < NOW) 2176 if (!slip_wheel_ev.is_active ())
2207 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; 2177 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2208
2209 slip_wheel_ev.start ();
2210 } 2178 }
2211 else 2179 else
2180# endif
2212 { 2181 {
2213# endif
2214 scr_page (v, i); 2182 scr_page (v, i);
2215 scrollbar_show (1); 2183 scrollbar_show (1);
2216# ifdef MOUSE_SLIP_WHEELING
2217 } 2184 }
2218# endif
2219 } 2185 }
2220 break; 2186 break;
2221#endif 2187#endif
2222 } 2188 }
2223 } 2189 }
2282 2248
2283 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2249 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2284 { 2250 {
2285 refresh_count = 0; 2251 refresh_count = 0;
2286 2252
2287 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2253 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2288 { 2254 {
2289 refreshnow = true; 2255 refreshnow = true;
2290 ch = NOCHAR; 2256 ch = NOCHAR;
2291 break; 2257 break;
2292 } 2258 }
2503 } 2469 }
2504 } 2470 }
2505 2471
2506 pclose_printer (fd); 2472 pclose_printer (fd);
2507} 2473}
2508#endif /* PRINTPIPE */ 2474#endif /* PRINTPIPE */
2509/*}}} */ 2475/*}}} */
2510 2476
2511/* *INDENT-OFF* */ 2477/* *INDENT-OFF* */
2512enum { 2478enum {
2513 C1_40 = 0x40, 2479 C1_40 = 0x40,
2806 nargs = 0; 2772 nargs = 0;
2807 2773
2808 priv = 0; 2774 priv = 0;
2809 ch = cmd_getc (); 2775 ch = cmd_getc ();
2810 if (ch >= '<' && ch <= '?') 2776 if (ch >= '<' && ch <= '?')
2777 {
2811 { /* '<' '=' '>' '?' */ 2778 /* '<' '=' '>' '?' */
2812 priv = ch; 2779 priv = ch;
2813 ch = cmd_getc (); 2780 ch = cmd_getc ();
2814 } 2781 }
2815 2782
2816 /* read any numerical arguments */ 2783 /* read any numerical arguments */
2865 // versions. 2832 // versions.
2866 // 2833 //
2867 tt_printf ("\033[>%d;95;0c", 'U'); 2834 tt_printf ("\033[>%d;95;0c", 'U');
2868 } 2835 }
2869 break; 2836 break;
2837
2870 case '?': 2838 case '?':
2871 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2839 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2872 process_terminal_mode (ch, priv, nargs, arg); 2840 process_terminal_mode (ch, priv, nargs, arg);
2873 break; 2841 break;
2874 } 2842 }
3390 *buf++ = '\0'; 3358 *buf++ = '\0';
3391 3359
3392 process_color_seq (op, color, name, resp); 3360 process_color_seq (op, color, name, resp);
3393 } 3361 }
3394 break; 3362 break;
3363 case Rxvt_restoreFG:
3395 case XTerm_Color00: 3364 case XTerm_Color00:
3396 process_color_seq (op, Color_fg, str, resp); 3365 process_color_seq (op, Color_fg, str, resp);
3397 break; 3366 break;
3367 case Rxvt_restoreBG:
3398 case XTerm_Color01: 3368 case XTerm_Color01:
3399 process_color_seq (op, Color_bg, str, resp); 3369 process_color_seq (op, Color_bg, str, resp);
3400 break; 3370 break;
3401#ifndef NO_CURSORCOLOR 3371#ifndef NO_CURSORCOLOR
3402 case XTerm_Color_cursor: 3372 case XTerm_Color_cursor:
3428#if ENABLE_TRANSPARENCY 3398#if ENABLE_TRANSPARENCY
3429 case URxvt_Color_tint: 3399 case URxvt_Color_tint:
3430 process_color_seq (op, Color_tint, str, resp); 3400 process_color_seq (op, Color_tint, str, resp);
3431 { 3401 {
3432 bool changed = false; 3402 bool changed = false;
3403
3433 if (ISSET_PIXCOLOR (Color_tint)) 3404 if (ISSET_PIXCOLOR (Color_tint))
3434 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3405 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3435 else 3406 else
3436 changed = bgPixmap.unset_tint (); 3407 changed = bgPixmap.unset_tint ();
3408
3437 if (changed) 3409 if (changed)
3438 update_background (); 3410 update_background ();
3439 } 3411 }
3440 3412
3441 break; 3413 break;
3464 changed++; 3436 changed++;
3465 str = strchr (str, ';'); 3437 str = strchr (str, ';');
3466 if (str == NULL) 3438 if (str == NULL)
3467 bgPixmap.set_defaultGeometry (); 3439 bgPixmap.set_defaultGeometry ();
3468 } 3440 }
3441
3469 while (str) 3442 while (str)
3470 { 3443 {
3471 str++; 3444 str++;
3472 if (bgPixmap.set_geometry (str)) 3445 if (bgPixmap.set_geometry (str))
3473 changed++; 3446 changed++;
3474 str = strchr (str, ';'); 3447 str = strchr (str, ';');
3475 } 3448 }
3449
3476 if (changed) 3450 if (changed)
3477 update_background (); 3451 update_background ();
3478 } 3452 }
3479 break; 3453 break;
3480#endif 3454#endif
3481
3482 case Rxvt_restoreFG:
3483 set_window_color (Color_fg, str);
3484 break;
3485 case Rxvt_restoreBG:
3486 set_window_color (Color_bg, str);
3487 break;
3488 3455
3489 case XTerm_logfile: 3456 case XTerm_logfile:
3490 // TODO, when secure mode? 3457 // TODO, when secure mode?
3491 break; 3458 break;
3492 3459
3636 { 66, PrivMode_aplKP }, 3603 { 66, PrivMode_aplKP },
3637#ifndef NO_BACKSPACE_KEY 3604#ifndef NO_BACKSPACE_KEY
3638 { 67, PrivMode_BackSpace }, 3605 { 67, PrivMode_BackSpace },
3639#endif 3606#endif
3640 { 1000, PrivMode_MouseX11 }, 3607 { 1000, PrivMode_MouseX11 },
3641 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3642 { 1002, PrivMode_MouseBtnEvent }, 3608 { 1002, PrivMode_MouseBtnEvent },
3643 { 1003, PrivMode_MouseAnyEvent }, 3609 { 1003, PrivMode_MouseAnyEvent },
3644 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3610 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3645 { 1011, PrivMode_Keypress }, // rxvt extension 3611 { 1011, PrivMode_Keypress }, // rxvt extension
3646 // 1035 enable modifiers for alt, numlock NYI 3612 // 1035 enable modifiers for alt, numlock NYI
3648 // 1037 send DEL for keypad delete NYI 3614 // 1037 send DEL for keypad delete NYI
3649 { 1047, PrivMode_Screen }, 3615 { 1047, PrivMode_Screen },
3650 // 1048 save and restore cursor 3616 // 1048 save and restore cursor
3651 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ 3617 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */
3652 // 1051, 1052, 1060, 1061 keyboard emulation NYI 3618 // 1051, 1052, 1060, 1061 keyboard emulation NYI
3619 { 2004, PrivMode_BracketPaste },
3653 }; 3620 };
3654 3621
3655 if (nargs == 0) 3622 if (nargs == 0)
3656 return; 3623 return;
3657 3624
3705 */ 3672 */
3706 PrivMode (1, PrivMode_vt52); 3673 PrivMode (1, PrivMode_vt52);
3707 break; 3674 break;
3708 case 3: /* 80/132 */ 3675 case 3: /* 80/132 */
3709 if (priv_modes & PrivMode_132OK) 3676 if (priv_modes & PrivMode_132OK)
3677 {
3678 scr_poweron ();
3710 set_widthheight (((state ? 132 : 80) * fwidth), height); 3679 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3680 }
3711 break; 3681 break;
3712 case 4: /* smooth scrolling */ 3682 case 4: /* smooth scrolling */
3713 set_option (Opt_jumpScroll, !state); 3683 set_option (Opt_jumpScroll, !state);
3714 break; 3684 break;
3715 case 5: /* reverse video */ 3685 case 5: /* reverse video */
3747 /* case 67: - backspace key */ 3717 /* case 67: - backspace key */
3748 case 1000: /* X11 mouse reporting */ 3718 case 1000: /* X11 mouse reporting */
3749 if (state) /* orthogonal */ 3719 if (state) /* orthogonal */
3750 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3720 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3751 break; 3721 break;
3752#if 0
3753 case 1001:
3754 break; /* X11 mouse highlighting */
3755#endif
3756 case 1002: 3722 case 1002:
3757 case 1003: 3723 case 1003:
3758 if (state) { 3724 if (state)
3725 {
3759 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3726 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3760 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3727 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3761 vt_emask_mouse = PointerMotionMask; 3728 vt_emask_mouse = PointerMotionMask;
3729 }
3762 } else 3730 else
3763 vt_emask_mouse = NoEventMask; 3731 vt_emask_mouse = NoEventMask;
3764 vt_select_input (); 3732 vt_select_input ();
3765 break; 3733 break;
3766 case 1010: /* scroll to bottom on TTY output inhibit */ 3734 case 1010: /* scroll to bottom on TTY output inhibit */
3767 set_option (Opt_scrollTtyOutput, !state); 3735 set_option (Opt_scrollTtyOutput, !state);
3947rxvt_term::process_graphics () 3915rxvt_term::process_graphics ()
3948{ 3916{
3949 unicode_t ch, cmd = cmd_getc (); 3917 unicode_t ch, cmd = cmd_getc ();
3950 3918
3951 if (cmd == 'Q') 3919 if (cmd == 'Q')
3920 {
3952 { /* query graphics */ 3921 /* query graphics */
3953 tt_printf ("\033G0\012"); /* no graphics */ 3922 tt_printf ("\033G0\012"); /* no graphics */
3954 return; 3923 return;
3955 } 3924 }
3956 /* swallow other graphics sequences until terminating ':' */ 3925 /* swallow other graphics sequences until terminating ':' */
3957 do 3926 do
4007 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 3976 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
4008 3977
4009 memcpy (v_buffer + v_buflen, data, len); 3978 memcpy (v_buffer + v_buflen, data, len);
4010 v_buflen += len; 3979 v_buflen += len;
4011 3980
4012 pty_ev.set (EVENT_READ | EVENT_WRITE); 3981 pty_ev.set (ev::READ | ev::WRITE);
4013} 3982}
4014 3983
4015void rxvt_term::pty_write () 3984void rxvt_term::pty_write ()
4016{ 3985{
4017 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 3986 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4023 if (v_buflen == 0) 3992 if (v_buflen == 0)
4024 { 3993 {
4025 free (v_buffer); 3994 free (v_buffer);
4026 v_buffer = 0; 3995 v_buffer = 0;
4027 3996
4028 pty_ev.set (EVENT_READ); 3997 pty_ev.set (ev::READ);
4029 return; 3998 return;
4030 } 3999 }
4031 4000
4032 memmove (v_buffer, v_buffer + written, v_buflen); 4001 memmove (v_buffer, v_buffer + written, v_buflen);
4033 } 4002 }
4034 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4003 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4035 pty_ev.set (EVENT_READ); 4004 pty_ev.set (ev::READ);
4036} 4005}
4037 4006
4038/*----------------------- end-of-file (C source) -----------------------*/ 4007/*----------------------- end-of-file (C source) -----------------------*/
4039 4008

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines