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.356 by root, Mon Sep 17 08:31:54 2007 UTC vs.
Revision 1.401 by ayin, Tue Jan 29 13:57:23 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) \
1035void 984void
1036rxvt_term::flush () 985rxvt_term::flush ()
1037{ 986{
1038 flush_ev.stop (); 987 flush_ev.stop ();
1039 988
989#ifdef HAVE_BG_PIXMAP
990 if (bgPixmap.check_clearChanged ())
991 {
992// scr_clear (true); This needs to be researched further!
993 scr_touch (false);
994 }
995#endif
996
1040 if (want_refresh) 997 if (want_refresh)
1041 { 998 {
1042 if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) 999 if (SHOULD_INVOKE (HOOK_LINE_UPDATE))
1043 { 1000 {
1044 int row = view_start; 1001 int row = view_start;
1085 } 1042 }
1086 1043
1087 display->flush (); 1044 display->flush ();
1088} 1045}
1089 1046
1047/* checks wether a refresh is requested and starts the refresh timer */
1090void 1048void
1091rxvt_term::check_cb (check_watcher &w) 1049rxvt_term::refresh_check ()
1092{ 1050{
1093 make_current (); 1051 if (want_refresh && !flush_ev.is_active ())
1052 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1094 1053
1095 display->flush (); 1054 display->flush ();
1096
1097 if (want_refresh && !flush_ev.active)
1098 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally
1099} 1055}
1100 1056
1101void 1057void
1102rxvt_term::flush_cb (time_watcher &w) 1058rxvt_term::flush_cb (ev::timer &w, int revents)
1103{ 1059{
1104 make_current (); 1060 make_current ();
1105 1061
1106 refresh_count = 0; 1062 refresh_count = 0;
1107 flush (); 1063 flush ();
1108} 1064}
1109 1065
1110#ifdef CURSOR_BLINK 1066#ifdef CURSOR_BLINK
1111void 1067void
1112rxvt_term::cursor_blink_cb (time_watcher &w) 1068rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1113{ 1069{
1114 hidden_cursor = !hidden_cursor; 1070 hidden_cursor = !hidden_cursor;
1115 want_refresh = 1; 1071 want_refresh = 1;
1116 1072 refresh_check ();
1117 w.start (w.at + CURSOR_BLINK_INTERVAL);
1118} 1073}
1119#endif 1074#endif
1120 1075
1121#ifdef TEXT_BLINK 1076#ifdef TEXT_BLINK
1122void 1077void
1123rxvt_term::text_blink_cb (time_watcher &w) 1078rxvt_term::text_blink_cb (ev::timer &w, int revents)
1124{ 1079{
1125 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1080 if (scr_refresh_rend (RS_Blink, RS_Blink))
1126 { 1081 {
1127 hidden_text = !hidden_text; 1082 hidden_text = !hidden_text;
1128 want_refresh = 1; 1083 want_refresh = 1;
1129 w.start (w.at + TEXT_BLINK_INTERVAL); 1084 refresh_check ();
1130 } 1085 }
1086 else
1087 w.stop ();
1131} 1088}
1132#endif 1089#endif
1133 1090
1134#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1091#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1135void 1092void
1136rxvt_term::cont_scroll_cb (time_watcher &w) 1093rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1137{ 1094{
1138 if ((scrollbar_isUp() || scrollbar_isDn()) && 1095 if ((scrollbar_isUp () || scrollbar_isDn ())
1139 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1096 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1140 { 1097 {
1141 want_refresh = 1; 1098 want_refresh = 1;
1142 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1099 refresh_check ();
1143 } 1100 }
1101 else
1102 w.stop ();
1144} 1103}
1145#endif 1104#endif
1146 1105
1147#ifdef SELECTION_SCROLLING 1106#ifdef SELECTION_SCROLLING
1148void 1107void
1149rxvt_term::sel_scroll_cb (time_watcher &w) 1108rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1150{ 1109{
1151 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1110 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1152 { 1111 {
1153 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1112 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1154 want_refresh = 1; 1113 want_refresh = 1;
1155 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1114 refresh_check ();
1156 } 1115 }
1116 else
1117 w.stop ();
1157} 1118}
1158#endif 1119#endif
1159 1120
1160#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1121#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1161void 1122void
1162rxvt_term::slip_wheel_cb (time_watcher &w) 1123rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1163{ 1124{
1164 if (mouse_slip_wheel_speed == 0 1125 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1165 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1166 : scr_page (UP, mouse_slip_wheel_speed))
1167 { 1126 {
1168 if (view_start == top_row || view_start == 0)
1169 mouse_slip_wheel_speed = 0;
1170
1171 want_refresh = 1; 1127 want_refresh = 1;
1172 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 ();
1173 } 1135 }
1174} 1136}
1175#endif 1137#endif
1176 1138
1177#if LINUX_YIELD_HACK 1139#if LINUX_YIELD_HACK
1178static struct event_handler 1140static struct event_handler
1179{ 1141{
1180 check_watcher yield_ev; 1142 ev::prepare yield_ev;
1181 1143
1182 void yield_cb (check_watcher &w) 1144 void yield_cb (ev::prepare &w, int revents)
1183 { 1145 {
1184 // this should really be sched_yield(), but the linux guys thought 1146 // this should really be sched_yield(), but the linux guys thought
1185 // that giving a process calling sched_yield () less cpu time than 1147 // that giving a process calling sched_yield () less cpu time than
1186 // 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
1187 // allowed by the sus... as is returning ENOSYS. 1149 // allowed by the sus... as is returning ENOSYS.
1238 1200
1239 return false; 1201 return false;
1240} 1202}
1241 1203
1242void 1204void
1243rxvt_term::pty_cb (io_watcher &w, short revents) 1205rxvt_term::pty_cb (ev::io &w, int revents)
1244{ 1206{
1245 make_current (); 1207 make_current ();
1246 1208
1247 if (revents & EVENT_READ) 1209 if (revents & ev::READ)
1248 // loop, but don't allow a single term to monopolize us 1210 // loop, but don't allow a single term to monopolize us
1249 while (pty_fill ()) 1211 while (pty_fill ())
1250 if (cmd_parse ()) 1212 if (cmd_parse ())
1251 break; 1213 break;
1252 1214
1253 if (revents & EVENT_WRITE) 1215 if (revents & ev::WRITE)
1254 pty_write (); 1216 pty_write ();
1217
1218 refresh_check ();
1255} 1219}
1256 1220
1257void 1221void
1258rxvt_term::pointer_unblank () 1222rxvt_term::pointer_unblank ()
1259{ 1223{
1262 1226
1263#ifdef POINTER_BLANK 1227#ifdef POINTER_BLANK
1264 hidden_pointer = 0; 1228 hidden_pointer = 0;
1265 1229
1266 if (option (Opt_pointerBlank)) 1230 if (option (Opt_pointerBlank))
1267 pointer_ev.start (NOW + pointerBlankDelay); 1231 pointer_ev.start (pointerBlankDelay);
1268#endif 1232#endif
1269} 1233}
1270 1234
1271#ifdef POINTER_BLANK 1235#ifdef POINTER_BLANK
1272void 1236void
1280 1244
1281 hidden_pointer = 1; 1245 hidden_pointer = 1;
1282} 1246}
1283 1247
1284void 1248void
1285rxvt_term::pointer_cb (time_watcher &w) 1249rxvt_term::pointer_cb (ev::timer &w, int revents)
1286{ 1250{
1287 make_current (); 1251 make_current ();
1288 1252
1289 pointer_blank (); 1253 pointer_blank ();
1290} 1254}
1293void 1257void
1294rxvt_term::mouse_report (XButtonEvent &ev) 1258rxvt_term::mouse_report (XButtonEvent &ev)
1295{ 1259{
1296 int button_number, key_state = 0; 1260 int button_number, key_state = 0;
1297 int x, y; 1261 int x, y;
1262 int code = 32;
1298 1263
1299 x = ev.x; 1264 x = Pixel2Col (ev.x);
1300 y = ev.y; 1265 y = Pixel2Row (ev.y);
1301 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 }
1302 1274
1303 if (MEvent.button == AnyButton) 1275 if (MEvent.button == AnyButton)
1304 button_number = 3; 1276 button_number = 3;
1305 else 1277 else
1306 { 1278 {
1352 x + 1, 1324 x + 1,
1353 y + 1); 1325 y + 1);
1354#endif 1326#endif
1355 1327
1356 tt_printf ("\033[M%c%c%c", 1328 tt_printf ("\033[M%c%c%c",
1357 (32 + button_number + key_state), 1329 (code + button_number + key_state),
1358 (32 + x + 1), 1330 (32 + x + 1),
1359 (32 + y + 1)); 1331 (32 + y + 1));
1360} 1332}
1361 1333
1362/*{{{ process an X event */ 1334/*{{{ process an X event */
1466 && ev.xfocus.mode != NotifyGrab) 1438 && ev.xfocus.mode != NotifyGrab)
1467 focus_out (); 1439 focus_out ();
1468 break; 1440 break;
1469 1441
1470 case ConfigureNotify: 1442 case ConfigureNotify:
1471/* 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",
1472 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,
1473 szHint.width, szHint.height);*/ 1445 szHint.width, szHint.height);*/
1474 if (ev.xconfigure.window == parent[0]) 1446 if (ev.xconfigure.window == parent[0])
1475 { 1447 {
1476 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1448 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1483 } 1455 }
1484 else 1456 else
1485 { 1457 {
1486#ifdef HAVE_BG_PIXMAP 1458#ifdef HAVE_BG_PIXMAP
1487 if (bgPixmap.window_position_sensitive ()) 1459 if (bgPixmap.window_position_sensitive ())
1460 {
1461 if (mapped)
1488 update_background (); 1462 update_background ();
1463 else
1464 bgPixmap.invalidate ();
1465 }
1489#endif 1466#endif
1490 } 1467 }
1468
1491 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1469 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1492 } 1470 }
1493 break; 1471 break;
1494 1472
1495 case PropertyNotify: 1473 case PropertyNotify:
1512 case SelectionRequest: 1490 case SelectionRequest:
1513 selection_send (ev.xselectionrequest); 1491 selection_send (ev.xselectionrequest);
1514 break; 1492 break;
1515 1493
1516 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
1517 mapped = 1; 1511 mapped = 1;
1518#ifdef TEXT_BLINK 1512#ifdef TEXT_BLINK
1519 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1513 text_blink_ev.start ();
1520#endif 1514#endif
1521 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1515 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1522 break; 1516 break;
1523 1517
1524 case UnmapNotify: 1518 case UnmapNotify:
1532 case GraphicsExpose: 1526 case GraphicsExpose:
1533 case Expose: 1527 case Expose:
1534 if (ev.xany.window == vt) 1528 if (ev.xany.window == vt)
1535 { 1529 {
1536 do 1530 do
1531 {
1537 scr_expose (ev.xexpose.x, ev.xexpose.y, 1532 scr_expose (ev.xexpose.x, ev.xexpose.y,
1538 ev.xexpose.width, ev.xexpose.height, False); 1533 ev.xexpose.width, ev.xexpose.height, False);
1534 }
1539 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1535 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1540 1536
1541 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1537 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1542 1538
1543 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1539 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1540 {
1544 scr_expose (ev.xexpose.x, ev.xexpose.y, 1541 scr_expose (ev.xexpose.x, ev.xexpose.y,
1545 ev.xexpose.width, ev.xexpose.height, False); 1542 ev.xexpose.width, ev.xexpose.height, False);
1543 }
1546 1544
1547 want_refresh = 1; 1545 want_refresh = 1;
1548 } 1546 }
1549 else 1547 else
1550 { 1548 {
1553 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1551 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1554 ; 1552 ;
1555 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1553 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1556 ; 1554 ;
1557 1555
1558 if (isScrollbarWindow (ev.xany.window)) 1556 if (scrollBar.state && ev.xany.window == scrollBar.win)
1559 { 1557 {
1560 scrollBar.setIdle (); 1558 scrollBar.state = STATE_IDLE;
1561 scrollbar_show (0); 1559 scrollbar_show (0);
1562 } 1560 }
1563 } 1561 }
1564 break; 1562 break;
1565 1563
1566 case MotionNotify: 1564 case MotionNotify:
1567#ifdef POINTER_BLANK 1565#ifdef POINTER_BLANK
1568 if (hidden_pointer) 1566 if (hidden_pointer)
1569 pointer_unblank (); 1567 pointer_unblank ();
1570#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);
1571 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1572 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1572 break; 1573 break;
1573 1574
1574 if (ev.xany.window == vt) 1575 if (ev.xany.window == vt)
1575 { 1576 {
1609 int dist; 1610 int dist;
1610 1611
1611 /* don't clobber the current delay if we are 1612 /* don't clobber the current delay if we are
1612 * already in the middle of scrolling. 1613 * already in the middle of scrolling.
1613 */ 1614 */
1614 if (!sel_scroll_ev.active) 1615 if (!sel_scroll_ev.is_active ())
1615 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1616 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1616 1617
1617 /* save the event params so we can highlight 1618 /* save the event params so we can highlight
1618 * the selection in the pending-scroll loop 1619 * the selection in the pending-scroll loop
1619 */ 1620 */
1620 selection_save_x = ev.xbutton.x; 1621 selection_save_x = ev.xbutton.x;
1642 else 1643 else
1643 { 1644 {
1644 /* we are within the text window, so we 1645 /* we are within the text window, so we
1645 * shouldn't be scrolling 1646 * shouldn't be scrolling
1646 */ 1647 */
1647 if (sel_scroll_ev.active)
1648 sel_scroll_ev.stop(); 1648 sel_scroll_ev.stop();
1649 } 1649 }
1650#endif 1650#endif
1651#ifdef MOUSE_THRESHOLD 1651#ifdef MOUSE_THRESHOLD
1652 } 1652 }
1653#endif 1653#endif
1654 } 1654 }
1655 } 1655 }
1656 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1656 else if (scrollBar.state == STATE_MOTION && ev.xany.window == scrollBar.win)
1657 { 1657 {
1658 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1658 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1659 MotionNotify, &ev)) 1659 MotionNotify, &ev))
1660 ; 1660 ;
1661 1661
1679 { 1679 {
1680 hidden_cursor = 0; 1680 hidden_cursor = 0;
1681 want_refresh = 1; 1681 want_refresh = 1;
1682 } 1682 }
1683 1683
1684 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1684 cursor_blink_ev.again ();
1685 } 1685 }
1686#endif 1686#endif
1687 1687
1688#if defined(POINTER_BLANK) 1688#if defined(POINTER_BLANK)
1689 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1689 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1696 1696
1697 if (ev.type == KeyPress && hidden_pointer == 0) 1697 if (ev.type == KeyPress && hidden_pointer == 0)
1698 pointer_blank (); 1698 pointer_blank ();
1699 } 1699 }
1700#endif 1700#endif
1701
1702 refresh_check ();
1701} 1703}
1702 1704
1703void 1705void
1704rxvt_term::focus_in () 1706rxvt_term::focus_in ()
1705{ 1707{
1717 XSetICFocus (Input_Context); 1719 XSetICFocus (Input_Context);
1718 } 1720 }
1719#endif 1721#endif
1720#if CURSOR_BLINK 1722#if CURSOR_BLINK
1721 if (option (Opt_cursorBlink)) 1723 if (option (Opt_cursorBlink))
1722 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1724 cursor_blink_ev.again ();
1723#endif 1725#endif
1724#if OFF_FOCUS_FADING 1726#if OFF_FOCUS_FADING
1725 if (rs[Rs_fade]) 1727 if (rs[Rs_fade])
1726 { 1728 {
1727 pix_colors = pix_colors_focused; 1729 pix_colors = pix_colors_focused;
1765 XUnsetICFocus (Input_Context); 1767 XUnsetICFocus (Input_Context);
1766#endif 1768#endif
1767#if CURSOR_BLINK 1769#if CURSOR_BLINK
1768 if (option (Opt_cursorBlink)) 1770 if (option (Opt_cursorBlink))
1769 cursor_blink_ev.stop (); 1771 cursor_blink_ev.stop ();
1772
1770 hidden_cursor = 0; 1773 hidden_cursor = 0;
1771#endif 1774#endif
1772#if OFF_FOCUS_FADING 1775#if OFF_FOCUS_FADING
1773 if (rs[Rs_fade]) 1776 if (rs[Rs_fade])
1774 { 1777 {
1814 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1817 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1815 { 1818 {
1816 bgPixmap.set_root_pixmap (); 1819 bgPixmap.set_root_pixmap ();
1817 update_background (); 1820 update_background ();
1818 } 1821 }
1822
1819 break; 1823 break;
1820 } 1824 }
1821# endif 1825# endif
1826
1827 refresh_check ();
1822} 1828}
1823#endif 1829#endif
1824 1830
1825void 1831void
1826rxvt_term::button_press (XButtonEvent &ev) 1832rxvt_term::button_press (XButtonEvent &ev)
1881 mouse_report (ev); 1887 mouse_report (ev);
1882 } 1888 }
1883#else 1889#else
1884 MEvent.button = ev.button; 1890 MEvent.button = ev.button;
1885 mouse_report (ev); 1891 mouse_report (ev);
1886#endif /* MOUSE_REPORT_DOUBLECLICK */ 1892#endif /* MOUSE_REPORT_DOUBLECLICK */
1887 1893
1888 } 1894 }
1889 else 1895 else
1890 { 1896 {
1891 if (ev.button != MEvent.button) 1897 if (ev.button != MEvent.button)
1939 } 1945 }
1940 1946
1941 /* 1947 /*
1942 * Scrollbar window processing of button press 1948 * Scrollbar window processing of button press
1943 */ 1949 */
1944 if (isScrollbarWindow (ev.window)) 1950 if (scrollBar.state && ev.window == scrollBar.win)
1945 { 1951 {
1946 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;
1947 /* 1960 /*
1948 * Rxvt-style scrollbar: 1961 * Rxvt-style scrollbar:
1949 * move up if mouse is above slider 1962 * move up if mouse is above slider
1950 * move dn if mouse is below slider 1963 * move dn if mouse is below slider
1951 * 1964 *
1960 /* 1973 /*
1961 * Mouse report disabled scrollbar: 1974 * Mouse report disabled scrollbar:
1962 * arrow buttons - send up/down 1975 * arrow buttons - send up/down
1963 * click on scrollbar - send pageup/down 1976 * click on scrollbar - send pageup/down
1964 */ 1977 */
1965 if ((scrollBar.style == R_SB_NEXT 1978 if (upordown < 0)
1966 && scrollbarnext_upButton (ev.y))
1967 || (scrollBar.style == R_SB_RXVT
1968 && scrollbarrxvt_upButton (ev.y)))
1969 tt_printf ("\033[A"); 1979 tt_printf ("\033[A");
1970 else if ((scrollBar.style == R_SB_NEXT 1980 else if (upordown > 0)
1971 && scrollbarnext_dnButton (ev.y))
1972 || (scrollBar.style == R_SB_RXVT
1973 && scrollbarrxvt_dnButton (ev.y)))
1974 tt_printf ("\033[B"); 1981 tt_printf ("\033[B");
1975 else 1982 else
1976 switch (ev.button) 1983 switch (ev.button)
1977 { 1984 {
1978 case Button2: 1985 case Button2:
1985 tt_printf ("\033[5~"); 1992 tt_printf ("\033[5~");
1986 break; 1993 break;
1987 } 1994 }
1988 } 1995 }
1989 else 1996 else
1990#endif /* NO_SCROLLBAR_REPORT */ 1997#endif /* NO_SCROLLBAR_REPORT */
1991 1998
1992 {
1993 char upordown = 0;
1994
1995 if (scrollBar.style == R_SB_NEXT)
1996 { 1999 {
1997 if (scrollbarnext_upButton (ev.y))
1998 upordown = -1; /* up */
1999 else if (scrollbarnext_dnButton (ev.y))
2000 upordown = 1; /* down */
2001 }
2002 else if (scrollBar.style == R_SB_RXVT)
2003 {
2004 if (scrollbarrxvt_upButton (ev.y))
2005 upordown = -1; /* up */
2006 else if (scrollbarrxvt_dnButton (ev.y))
2007 upordown = 1; /* down */
2008 }
2009 if (upordown) 2000 if (upordown)
2010 { 2001 {
2011#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2002#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2003 if (!cont_scroll_ev.is_active ())
2012 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2004 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2013#endif 2005#endif
2014 if (scr_page (upordown < 0 ? UP : DN, 1)) 2006 if (scr_page (upordown < 0 ? UP : DN, 1))
2015 { 2007 {
2016 if (upordown < 0) 2008 if (upordown < 0)
2017 scrollBar.setUp (); 2009 scrollBar.state = STATE_UP;
2018 else 2010 else
2019 scrollBar.setDn (); 2011 scrollBar.state = STATE_DOWN;
2020 } 2012 }
2021 } 2013 }
2022 else 2014 else
2023 switch (ev.button) 2015 switch (ev.button)
2024 { 2016 {
2025 case Button2: 2017 case Button2:
2026 switch (scrollbar_align) 2018 switch (scrollBar.align)
2027 { 2019 {
2028 case R_SB_ALIGN_TOP: 2020 case R_SB_ALIGN_TOP:
2029 csrO = 0; 2021 csrO = 0;
2030 break; 2022 break;
2031 case R_SB_ALIGN_CENTRE: 2023 case R_SB_ALIGN_CENTRE:
2039 if (scrollBar.style == R_SB_XTERM 2031 if (scrollBar.style == R_SB_XTERM
2040 || scrollbar_above_slider (ev.y) 2032 || scrollbar_above_slider (ev.y)
2041 || scrollbar_below_slider (ev.y)) 2033 || scrollbar_below_slider (ev.y))
2042 scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ()); 2034 scr_move_to (scrollbar_position (ev.y) - csrO, scrollbar_size ());
2043 2035
2044 scrollBar.setMotion (); 2036 scrollBar.state = STATE_MOTION;
2045 break; 2037 break;
2046 2038
2047 case Button1: 2039 case Button1:
2048 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2040 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2049 csrO = ev.y - scrollBar.top; 2041 csrO = ev.y - scrollBar.top;
2050 /* FALLTHROUGH */ 2042 /* FALLTHROUGH */
2051 2043
2052 case Button3: 2044 case Button3:
2053 if (scrollBar.style != R_SB_XTERM) 2045 if (scrollBar.style != R_SB_XTERM)
2063 scr_page (DN, nrow - 1); 2055 scr_page (DN, nrow - 1);
2064# else 2056# else
2065 scr_page (DN, nrow / 4); 2057 scr_page (DN, nrow / 4);
2066# endif 2058# endif
2067 else 2059 else
2068 scrollBar.setMotion (); 2060 scrollBar.state = STATE_MOTION;
2069 } 2061 }
2070 else 2062 else
2071 { 2063 {
2072 scr_page ((ev.button == Button1 ? DN : UP), 2064 scr_page ((ev.button == Button1 ? DN : UP),
2073 (nrow 2065 (nrow
2090 2082
2091 csrO = 0; /* reset csr Offset */ 2083 csrO = 0; /* reset csr Offset */
2092 if (!bypass_keystate) 2084 if (!bypass_keystate)
2093 reportmode = !! (priv_modes & PrivMode_mouse_report); 2085 reportmode = !! (priv_modes & PrivMode_mouse_report);
2094 2086
2095 if (scrollbar_isUpDn ()) 2087 if (scrollBar.state == STATE_UP || scrollBar.state == STATE_DOWN)
2096 { 2088 {
2097 scrollBar.setIdle (); 2089 scrollBar.state = STATE_IDLE;
2098 scrollbar_show (0); 2090 scrollbar_show (0);
2099 } 2091 }
2100 2092
2101#ifdef SELECTION_SCROLLING 2093#ifdef SELECTION_SCROLLING
2102 if (sel_scroll_ev.active)
2103 sel_scroll_ev.stop(); 2094 sel_scroll_ev.stop();
2104#endif 2095#endif
2105 2096
2106 if (ev.window == vt) 2097 if (ev.window == vt)
2107 { 2098 {
2108 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)))
2132 mouse_report (ev); 2123 mouse_report (ev);
2133 } 2124 }
2134#else /* MOUSE_REPORT_DOUBLECLICK */ 2125#else /* MOUSE_REPORT_DOUBLECLICK */
2135 MEvent.button = AnyButton; 2126 MEvent.button = AnyButton;
2136 mouse_report (ev); 2127 mouse_report (ev);
2137#endif /* MOUSE_REPORT_DOUBLECLICK */ 2128#endif /* MOUSE_REPORT_DOUBLECLICK */
2138 return; 2129 return;
2139 } 2130 }
2140 2131
2141 /* 2132 /*
2142 * dumb hack to compensate for the failure of click-and-drag 2133 * dumb hack to compensate for the failure of click-and-drag
2180 { 2171 {
2181 mouse_slip_wheel_speed += v ? -1 : 1; 2172 mouse_slip_wheel_speed += v ? -1 : 1;
2182 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2173 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2183 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2174 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2184 2175
2185 if (slip_wheel_ev.at < NOW) 2176 if (!slip_wheel_ev.is_active ())
2186 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; 2177 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2187
2188 slip_wheel_ev.start ();
2189 } 2178 }
2190 else 2179 else
2180# endif
2191 { 2181 {
2192# endif
2193 scr_page (v, i); 2182 scr_page (v, i);
2194 scrollbar_show (1); 2183 scrollbar_show (1);
2195# ifdef MOUSE_SLIP_WHEELING
2196 } 2184 }
2197# endif
2198 } 2185 }
2199 break; 2186 break;
2200#endif 2187#endif
2201 } 2188 }
2202 } 2189 }
2261 2248
2262 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2249 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2263 { 2250 {
2264 refresh_count = 0; 2251 refresh_count = 0;
2265 2252
2266 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2253 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2267 { 2254 {
2268 refreshnow = true; 2255 refreshnow = true;
2269 ch = NOCHAR; 2256 ch = NOCHAR;
2270 break; 2257 break;
2271 } 2258 }
2482 } 2469 }
2483 } 2470 }
2484 2471
2485 pclose_printer (fd); 2472 pclose_printer (fd);
2486} 2473}
2487#endif /* PRINTPIPE */ 2474#endif /* PRINTPIPE */
2488/*}}} */ 2475/*}}} */
2489 2476
2490/* *INDENT-OFF* */ 2477/* *INDENT-OFF* */
2491enum { 2478enum {
2492 C1_40 = 0x40, 2479 C1_40 = 0x40,
2785 nargs = 0; 2772 nargs = 0;
2786 2773
2787 priv = 0; 2774 priv = 0;
2788 ch = cmd_getc (); 2775 ch = cmd_getc ();
2789 if (ch >= '<' && ch <= '?') 2776 if (ch >= '<' && ch <= '?')
2777 {
2790 { /* '<' '=' '>' '?' */ 2778 /* '<' '=' '>' '?' */
2791 priv = ch; 2779 priv = ch;
2792 ch = cmd_getc (); 2780 ch = cmd_getc ();
2793 } 2781 }
2794 2782
2795 /* read any numerical arguments */ 2783 /* read any numerical arguments */
2838 { 2826 {
2839 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, 2827 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2840 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2828 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2841 // 2829 //
2842 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2830 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2843 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2831 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2844 // that we do not support xterm mouse reporting (should be 95 when we do). 2832 // versions.
2845 // 2833 //
2846 tt_printf ("\033[>%d;94;0c", 'U'); 2834 tt_printf ("\033[>%d;95;0c", 'U');
2847 } 2835 }
2848 break; 2836 break;
2837
2849 case '?': 2838 case '?':
2850 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2839 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2851 process_terminal_mode (ch, priv, nargs, arg); 2840 process_terminal_mode (ch, priv, nargs, arg);
2852 break; 2841 break;
2853 } 2842 }
3369 *buf++ = '\0'; 3358 *buf++ = '\0';
3370 3359
3371 process_color_seq (op, color, name, resp); 3360 process_color_seq (op, color, name, resp);
3372 } 3361 }
3373 break; 3362 break;
3363 case Rxvt_restoreFG:
3374 case XTerm_Color00: 3364 case XTerm_Color00:
3375 process_color_seq (op, Color_fg, str, resp); 3365 process_color_seq (op, Color_fg, str, resp);
3376 break; 3366 break;
3367 case Rxvt_restoreBG:
3377 case XTerm_Color01: 3368 case XTerm_Color01:
3378 process_color_seq (op, Color_bg, str, resp); 3369 process_color_seq (op, Color_bg, str, resp);
3379 break; 3370 break;
3380#ifndef NO_CURSORCOLOR 3371#ifndef NO_CURSORCOLOR
3381 case XTerm_Color_cursor: 3372 case XTerm_Color_cursor:
3407#if ENABLE_TRANSPARENCY 3398#if ENABLE_TRANSPARENCY
3408 case URxvt_Color_tint: 3399 case URxvt_Color_tint:
3409 process_color_seq (op, Color_tint, str, resp); 3400 process_color_seq (op, Color_tint, str, resp);
3410 { 3401 {
3411 bool changed = false; 3402 bool changed = false;
3403
3412 if (ISSET_PIXCOLOR (Color_tint)) 3404 if (ISSET_PIXCOLOR (Color_tint))
3413 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3405 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3414 else 3406 else
3415 changed = bgPixmap.unset_tint (); 3407 changed = bgPixmap.unset_tint ();
3408
3416 if (changed) 3409 if (changed)
3417 update_background (); 3410 update_background ();
3418 } 3411 }
3419 3412
3420 break; 3413 break;
3443 changed++; 3436 changed++;
3444 str = strchr (str, ';'); 3437 str = strchr (str, ';');
3445 if (str == NULL) 3438 if (str == NULL)
3446 bgPixmap.set_defaultGeometry (); 3439 bgPixmap.set_defaultGeometry ();
3447 } 3440 }
3441
3448 while (str) 3442 while (str)
3449 { 3443 {
3450 str++; 3444 str++;
3451 if (bgPixmap.set_geometry (str)) 3445 if (bgPixmap.set_geometry (str))
3452 changed++; 3446 changed++;
3453 str = strchr (str, ';'); 3447 str = strchr (str, ';');
3454 } 3448 }
3449
3455 if (changed) 3450 if (changed)
3456 update_background (); 3451 update_background ();
3457 } 3452 }
3458 break; 3453 break;
3459#endif 3454#endif
3460
3461 case Rxvt_restoreFG:
3462 set_window_color (Color_fg, str);
3463 break;
3464 case Rxvt_restoreBG:
3465 set_window_color (Color_bg, str);
3466 break;
3467 3455
3468 case XTerm_logfile: 3456 case XTerm_logfile:
3469 // TODO, when secure mode? 3457 // TODO, when secure mode?
3470 break; 3458 break;
3471 3459
3615 { 66, PrivMode_aplKP }, 3603 { 66, PrivMode_aplKP },
3616#ifndef NO_BACKSPACE_KEY 3604#ifndef NO_BACKSPACE_KEY
3617 { 67, PrivMode_BackSpace }, 3605 { 67, PrivMode_BackSpace },
3618#endif 3606#endif
3619 { 1000, PrivMode_MouseX11 }, 3607 { 1000, PrivMode_MouseX11 },
3620 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3608 { 1002, PrivMode_MouseBtnEvent },
3621 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3609 { 1003, PrivMode_MouseAnyEvent },
3622 // 1003 Use All Motion Mouse Tracking. NYI, TODO
3623 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3610 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3624 { 1011, PrivMode_Keypress }, // rxvt extension 3611 { 1011, PrivMode_Keypress }, // rxvt extension
3625 // 1035 enable modifiers for alt, numlock NYI 3612 // 1035 enable modifiers for alt, numlock NYI
3626 // 1036 send ESC for meta keys NYI 3613 // 1036 send ESC for meta keys NYI
3627 // 1037 send DEL for keypad delete NYI 3614 // 1037 send DEL for keypad delete NYI
3628 { 1047, PrivMode_Screen }, 3615 { 1047, PrivMode_Screen },
3629 // 1048 save and restore cursor 3616 // 1048 save and restore cursor
3630 { 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 */
3631 // 1051, 1052, 1060, 1061 keyboard emulation NYI 3618 // 1051, 1052, 1060, 1061 keyboard emulation NYI
3619 { 2004, PrivMode_BracketPaste },
3632 }; 3620 };
3633 3621
3634 if (nargs == 0) 3622 if (nargs == 0)
3635 return; 3623 return;
3636 3624
3684 */ 3672 */
3685 PrivMode (1, PrivMode_vt52); 3673 PrivMode (1, PrivMode_vt52);
3686 break; 3674 break;
3687 case 3: /* 80/132 */ 3675 case 3: /* 80/132 */
3688 if (priv_modes & PrivMode_132OK) 3676 if (priv_modes & PrivMode_132OK)
3677 {
3678 scr_poweron ();
3689 set_widthheight (((state ? 132 : 80) * fwidth), height); 3679 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3680 }
3690 break; 3681 break;
3691 case 4: /* smooth scrolling */ 3682 case 4: /* smooth scrolling */
3692 set_option (Opt_jumpScroll, !state); 3683 set_option (Opt_jumpScroll, !state);
3693 break; 3684 break;
3694 case 5: /* reverse video */ 3685 case 5: /* reverse video */
3701 scr_autowrap (state); 3692 scr_autowrap (state);
3702 break; 3693 break;
3703 /* case 8: - auto repeat, can't do on a per window basis */ 3694 /* case 8: - auto repeat, can't do on a per window basis */
3704 case 9: /* X10 mouse reporting */ 3695 case 9: /* X10 mouse reporting */
3705 if (state) /* orthogonal */ 3696 if (state) /* orthogonal */
3706 priv_modes &= ~PrivMode_MouseX11; 3697 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3707 break; 3698 break;
3708#ifdef scrollBar_esc 3699#ifdef scrollBar_esc
3709 case scrollBar_esc: 3700 case scrollBar_esc:
3710 if (scrollbar_mapping (state)) 3701 if (scrollbar_mapping (state))
3711 { 3702 {
3724 break; 3715 break;
3725 /* case 66: - application key pad */ 3716 /* case 66: - application key pad */
3726 /* case 67: - backspace key */ 3717 /* case 67: - backspace key */
3727 case 1000: /* X11 mouse reporting */ 3718 case 1000: /* X11 mouse reporting */
3728 if (state) /* orthogonal */ 3719 if (state) /* orthogonal */
3729 priv_modes &= ~PrivMode_MouseX10; 3720 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3730 break; 3721 break;
3731#if 0
3732 case 1001: 3722 case 1002:
3733 break; /* X11 mouse highlighting */ 3723 case 1003:
3734#endif 3724 if (state)
3725 {
3726 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3727 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3728 vt_emask_mouse = PointerMotionMask;
3729 }
3730 else
3731 vt_emask_mouse = NoEventMask;
3732 vt_select_input ();
3733 break;
3735 case 1010: /* scroll to bottom on TTY output inhibit */ 3734 case 1010: /* scroll to bottom on TTY output inhibit */
3736 set_option (Opt_scrollTtyOutput, !state); 3735 set_option (Opt_scrollTtyOutput, !state);
3737 break; 3736 break;
3738 case 1011: /* scroll to bottom on key press */ 3737 case 1011: /* scroll to bottom on key press */
3739 set_option (Opt_scrollTtyKeypress, state); 3738 set_option (Opt_scrollTtyKeypress, state);
3916rxvt_term::process_graphics () 3915rxvt_term::process_graphics ()
3917{ 3916{
3918 unicode_t ch, cmd = cmd_getc (); 3917 unicode_t ch, cmd = cmd_getc ();
3919 3918
3920 if (cmd == 'Q') 3919 if (cmd == 'Q')
3920 {
3921 { /* query graphics */ 3921 /* query graphics */
3922 tt_printf ("\033G0\012"); /* no graphics */ 3922 tt_printf ("\033G0\012"); /* no graphics */
3923 return; 3923 return;
3924 } 3924 }
3925 /* swallow other graphics sequences until terminating ':' */ 3925 /* swallow other graphics sequences until terminating ':' */
3926 do 3926 do
3976 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 3976 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
3977 3977
3978 memcpy (v_buffer + v_buflen, data, len); 3978 memcpy (v_buffer + v_buflen, data, len);
3979 v_buflen += len; 3979 v_buflen += len;
3980 3980
3981 pty_ev.set (EVENT_READ | EVENT_WRITE); 3981 pty_ev.set (ev::READ | ev::WRITE);
3982} 3982}
3983 3983
3984void rxvt_term::pty_write () 3984void rxvt_term::pty_write ()
3985{ 3985{
3986 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));
3992 if (v_buflen == 0) 3992 if (v_buflen == 0)
3993 { 3993 {
3994 free (v_buffer); 3994 free (v_buffer);
3995 v_buffer = 0; 3995 v_buffer = 0;
3996 3996
3997 pty_ev.set (EVENT_READ); 3997 pty_ev.set (ev::READ);
3998 return; 3998 return;
3999 } 3999 }
4000 4000
4001 memmove (v_buffer, v_buffer + written, v_buflen); 4001 memmove (v_buffer, v_buffer + written, v_buflen);
4002 } 4002 }
4003 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4003 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4004 pty_ev.set (EVENT_READ); 4004 pty_ev.set (ev::READ);
4005} 4005}
4006 4006
4007/*----------------------- end-of-file (C source) -----------------------*/ 4007/*----------------------- end-of-file (C source) -----------------------*/
4008 4008

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines