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.339 by ayin, Fri Aug 3 14:03:28 2007 UTC vs.
Revision 1.363 by root, Sun Nov 11 04:08:00 2007 UTC

95 XK_Shift_L, 0x21e7, 95 XK_Shift_L, 0x21e7,
96 XK_Shift_R, 0x21e7, 96 XK_Shift_R, 0x21e7,
97 97
98 XK_Shift_Lock, 0x21eb, 98 XK_Shift_Lock, 0x21eb,
99 XK_ISO_Lock, 0x21eb, 99 XK_ISO_Lock, 0x21eb,
100 XK_ISO_Lock, 0x21eb,
101 XK_Caps_Lock, 0x21ec, 100 XK_Caps_Lock, 0x21ec,
102 XK_Num_Lock, 0x21ed, 101 XK_Num_Lock, 0x21ed,
103 XK_ISO_Level3_Shift, 0x21ee, 102 XK_ISO_Level3_Shift, 0x21ee,
104 XK_ISO_Level3_Lock, 0x21ef, 103 XK_ISO_Level3_Lock, 0x21ef,
105 XK_ISO_Group_Lock, 0x21f0, 104 XK_ISO_Group_Lock, 0x21f0,
548#endif 547#endif
549 548
550 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 549 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
551 { 550 {
552 { 551 {
552 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553 newlen = 1; 553 newlen = 1;
554 switch (keysym) 554 switch (keysym)
555 { 555 {
556#ifndef NO_BACKSPACE_KEY 556#ifndef NO_BACKSPACE_KEY
557 case XK_BackSpace: 557 case XK_BackSpace:
560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace) 560 kbuf[0] = (!! (priv_modes & PrivMode_BackSpace)
561 ^ !!ctrl) ? '\b' : '\177'; 561 ^ !!ctrl) ? '\b' : '\177';
562 kbuf[1] = '\0'; 562 kbuf[1] = '\0';
563 } 563 }
564 else 564 else
565 strcpy (kbuf, key_backspace); 565 strcpy (kbuf, rs[Rs_backspace_key]);
566 break; 566 break;
567#endif 567#endif
568#ifndef NO_DELETE_KEY 568#ifndef NO_DELETE_KEY
569# ifdef XK_KP_Prior 569# ifdef XK_KP_Delete
570 case XK_KP_Delete: 570 case XK_KP_Delete:
571 /* allow shift to override */ 571 /* allow shift to override */
572 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 572 if (kp)
573 { 573 {
574 strcpy (kbuf, "\033On"); 574 strcpy (kbuf, "\033On");
575 break; 575 break;
576 } 576 }
577 /* FALLTHROUGH */ 577 /* FALLTHROUGH */
578# endif 578# endif
579 case XK_Delete: 579 case XK_Delete:
580 strcpy (kbuf, key_delete); 580 strcpy (kbuf, rs[Rs_delete_key]);
581 break; 581 break;
582#endif 582#endif
583 case XK_Tab: 583 case XK_Tab:
584 if (shft) 584 if (shft)
585 strcpy (kbuf, "\033[Z"); 585 strcpy (kbuf, "\033[Z");
596 newlen = 0; 596 newlen = 0;
597 } 597 }
598 break; 598 break;
599 599
600#ifdef XK_KP_Left 600#ifdef XK_KP_Left
601 case XK_KP_Left: /* \033Ot or standard */
601 case XK_KP_Up: /* \033Ox or standard */ 602 case XK_KP_Up: /* \033Ox or standard */
603 case XK_KP_Right: /* \033Ov or standard */
602 case XK_KP_Down: /* \033Or or standard */ 604 case XK_KP_Down: /* \033Or or standard */
603 case XK_KP_Right: /* \033Ov or standard */ 605 if (kp)
604 case XK_KP_Left: /* \033Ot or standard */
605 if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
606 { 606 {
607 strcpy (kbuf, "\033OZ"); 607 strcpy (kbuf, "\033OZ");
608 kbuf[2] = "txvr"[keysym - XK_KP_Left]; 608 kbuf[2] = "txvr"[keysym - XK_KP_Left];
609 break; 609 break;
610 } 610 }
633 633
634#ifndef UNSHIFTED_SCROLLKEYS 634#ifndef UNSHIFTED_SCROLLKEYS
635# ifdef XK_KP_Prior 635# ifdef XK_KP_Prior
636 case XK_KP_Prior: 636 case XK_KP_Prior:
637 /* allow shift to override */ 637 /* allow shift to override */
638 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 638 if (kp)
639 { 639 {
640 strcpy (kbuf, "\033Oy"); 640 strcpy (kbuf, "\033Oy");
641 break; 641 break;
642 } 642 }
643 /* FALLTHROUGH */ 643 /* FALLTHROUGH */
646 strcpy (kbuf, "\033[5~"); 646 strcpy (kbuf, "\033[5~");
647 break; 647 break;
648# ifdef XK_KP_Next 648# ifdef XK_KP_Next
649 case XK_KP_Next: 649 case XK_KP_Next:
650 /* allow shift to override */ 650 /* allow shift to override */
651 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 651 if (kp)
652 { 652 {
653 strcpy (kbuf, "\033Os"); 653 strcpy (kbuf, "\033Os");
654 break; 654 break;
655 } 655 }
656 /* FALLTHROUGH */ 656 /* FALLTHROUGH */
659 strcpy (kbuf, "\033[6~"); 659 strcpy (kbuf, "\033[6~");
660 break; 660 break;
661#endif 661#endif
662 case XK_KP_Enter: 662 case XK_KP_Enter:
663 /* allow shift to override */ 663 /* allow shift to override */
664 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 664 if (kp)
665 { 665 {
666 strcpy (kbuf, "\033OM"); 666 strcpy (kbuf, "\033OM");
667 break; 667 break;
668 } 668 }
669 669
712 case XK_KP_6: /* "\033Ov" : "6" */ 712 case XK_KP_6: /* "\033Ov" : "6" */
713 case XK_KP_7: /* "\033Ow" : "7" */ 713 case XK_KP_7: /* "\033Ow" : "7" */
714 case XK_KP_8: /* "\033Ox" : "8" */ 714 case XK_KP_8: /* "\033Ox" : "8" */
715 case XK_KP_9: /* "\033Oy" : "9" */ 715 case XK_KP_9: /* "\033Oy" : "9" */
716 /* allow shift to override */ 716 /* allow shift to override */
717 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 717 if (kp)
718 { 718 {
719 strcpy (kbuf, "\033Oj"); 719 strcpy (kbuf, "\033Oj");
720 kbuf[2] += (keysym - XK_KP_Multiply); 720 kbuf[2] += (keysym - XK_KP_Multiply);
721 } 721 }
722 else 722 else
731 break; 731 break;
732 732
733#ifdef XK_KP_Insert 733#ifdef XK_KP_Insert
734 case XK_KP_Insert: 734 case XK_KP_Insert:
735 /* allow shift to override */ 735 /* allow shift to override */
736 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 736 if (kp)
737 { 737 {
738 strcpy (kbuf, "\033Op"); 738 strcpy (kbuf, "\033Op");
739 break; 739 break;
740 } 740 }
741 /* FALLTHROUGH */ 741 /* FALLTHROUGH */
754 strcpy (kbuf, "\033[4~"); 754 strcpy (kbuf, "\033[4~");
755 break; 755 break;
756#ifdef XK_KP_End 756#ifdef XK_KP_End
757 case XK_KP_End: 757 case XK_KP_End:
758 /* allow shift to override */ 758 /* allow shift to override */
759 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 759 if (kp)
760 { 760 {
761 strcpy (kbuf, "\033Oq"); 761 strcpy (kbuf, "\033Oq");
762 break; 762 break;
763 } 763 }
764 /* FALLTHROUGH */ 764 /* FALLTHROUGH */
767 strcpy (kbuf, KS_END); 767 strcpy (kbuf, KS_END);
768 break; 768 break;
769#ifdef XK_KP_Home 769#ifdef XK_KP_Home
770 case XK_KP_Home: 770 case XK_KP_Home:
771 /* allow shift to override */ 771 /* allow shift to override */
772 if ((priv_modes & PrivMode_aplKP) ? !shft : shft) 772 if (kp)
773 { 773 {
774 strcpy (kbuf, "\033Ow"); 774 strcpy (kbuf, "\033Ow");
775 break; 775 break;
776 } 776 }
777 /* FALLTHROUGH */ 777 /* FALLTHROUGH */
1035void 1035void
1036rxvt_term::flush () 1036rxvt_term::flush ()
1037{ 1037{
1038 flush_ev.stop (); 1038 flush_ev.stop ();
1039 1039
1040#ifdef ENABLE_TRANSPARENCY 1040#ifdef HAVE_BG_PIXMAP
1041 if (want_full_refresh) 1041 if (bgPixmap.check_clearChanged ())
1042 { 1042 {
1043 want_full_refresh = 0; 1043// scr_clear (true); This needs to be researched further!
1044 scr_clear ();
1045 scr_touch (false); 1044 scr_touch (false);
1046 } 1045 }
1047#endif 1046#endif
1048 1047
1049 if (want_refresh) 1048 if (want_refresh)
1095 1094
1096 display->flush (); 1095 display->flush ();
1097} 1096}
1098 1097
1099void 1098void
1100rxvt_term::check_cb (check_watcher &w) 1099rxvt_term::prepare_cb (ev::prepare &w, int revents)
1101{ 1100{
1102 make_current (); 1101 make_current ();
1103 1102
1104 display->flush (); 1103 display->flush ();
1105 1104
1106 if (want_refresh && !flush_ev.active) 1105 if (want_refresh && !flush_ev.active)
1107 flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally 1106 flush_ev.start (1. / 60.); // refresh at max. 60 hz normally
1108} 1107}
1109 1108
1110void 1109void
1111rxvt_term::flush_cb (time_watcher &w) 1110rxvt_term::flush_cb (ev::timer &w, int revents)
1112{ 1111{
1113 make_current (); 1112 make_current ();
1114 1113
1115 refresh_count = 0; 1114 refresh_count = 0;
1116 flush (); 1115 flush ();
1117} 1116}
1118 1117
1119#ifdef CURSOR_BLINK 1118#ifdef CURSOR_BLINK
1120void 1119void
1121rxvt_term::cursor_blink_cb (time_watcher &w) 1120rxvt_term::cursor_blink_cb (ev::timer &w, int revents)
1122{ 1121{
1123 hidden_cursor = !hidden_cursor; 1122 hidden_cursor = !hidden_cursor;
1124 want_refresh = 1; 1123 want_refresh = 1;
1125
1126 w.start (w.at + CURSOR_BLINK_INTERVAL);
1127} 1124}
1128#endif 1125#endif
1129 1126
1130#ifdef TEXT_BLINK 1127#ifdef TEXT_BLINK
1131void 1128void
1132rxvt_term::text_blink_cb (time_watcher &w) 1129rxvt_term::text_blink_cb (ev::timer &w, int revents)
1133{ 1130{
1134 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1131 if (scr_refresh_rend (RS_Blink, RS_Blink))
1135 { 1132 {
1136 hidden_text = !hidden_text; 1133 hidden_text = !hidden_text;
1137 want_refresh = 1; 1134 want_refresh = 1;
1138 w.start (w.at + TEXT_BLINK_INTERVAL);
1139 } 1135 }
1140} 1136}
1141#endif 1137#endif
1142 1138
1143#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1139#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1144void 1140void
1145rxvt_term::cont_scroll_cb (time_watcher &w) 1141rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1146{ 1142{
1147 if ((scrollbar_isUp() || scrollbar_isDn()) && 1143 if ((scrollbar_isUp() || scrollbar_isDn()) &&
1148 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1144 scr_page (scrollbar_isUp() ? UP : DN, 1))
1149 {
1150 want_refresh = 1; 1145 want_refresh = 1;
1151 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1146 else
1152 } 1147 w.stop ();
1153} 1148}
1154#endif 1149#endif
1155 1150
1156#ifdef SELECTION_SCROLLING 1151#ifdef SELECTION_SCROLLING
1157void 1152void
1158rxvt_term::sel_scroll_cb (time_watcher &w) 1153rxvt_term::sel_scroll_cb (ev::timer &w, int revents)
1159{ 1154{
1160 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1155 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1161 { 1156 {
1162 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1157 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1163 want_refresh = 1; 1158 want_refresh = 1;
1164 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1165 } 1159 }
1160 else
1161 w.stop ();
1166} 1162}
1167#endif 1163#endif
1168 1164
1169#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1165#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1170void 1166void
1171rxvt_term::slip_wheel_cb (time_watcher &w) 1167rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1172{ 1168{
1173 if (mouse_slip_wheel_speed == 0 1169 if (mouse_slip_wheel_speed == 0
1174 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) 1170 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1175 : scr_page (UP, mouse_slip_wheel_speed)) 1171 : scr_page (UP, mouse_slip_wheel_speed))
1176 { 1172 {
1177 if (view_start == top_row || view_start == 0) 1173 if (view_start == top_row || view_start == 0)
1178 mouse_slip_wheel_speed = 0; 1174 mouse_slip_wheel_speed = 0;
1179 1175
1180 want_refresh = 1; 1176 want_refresh = 1;
1181 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1182 } 1177 }
1178 else
1179 w.stop ();
1183} 1180}
1184#endif 1181#endif
1185 1182
1186#if LINUX_YIELD_HACK 1183#if LINUX_YIELD_HACK
1187static struct event_handler 1184static struct event_handler
1188{ 1185{
1189 check_watcher yield_ev; 1186 ev::prepare yield_ev;
1190 1187
1191 void yield_cb (check_watcher &w) 1188 void yield_cb (ev::prepare &w, int revents)
1192 { 1189 {
1193 // this should really be sched_yield(), but the linux guys thought 1190 // this should really be sched_yield(), but the linux guys thought
1194 // that giving a process calling sched_yield () less cpu time than 1191 // that giving a process calling sched_yield () less cpu time than
1195 // ones with high nice levels is a useful thing to do. It surely is is 1192 // ones with high nice levels is a useful thing to do. It surely is is
1196 // allowed by the sus... as is returning ENOSYS. 1193 // allowed by the sus... as is returning ENOSYS.
1247 1244
1248 return false; 1245 return false;
1249} 1246}
1250 1247
1251void 1248void
1252rxvt_term::pty_cb (io_watcher &w, short revents) 1249rxvt_term::pty_cb (ev::io &w, int revents)
1253{ 1250{
1254 make_current (); 1251 make_current ();
1255 1252
1256 if (revents & EVENT_READ) 1253 if (revents & ev::READ)
1257 // loop, but don't allow a single term to monopolize us 1254 // loop, but don't allow a single term to monopolize us
1258 while (pty_fill ()) 1255 while (pty_fill ())
1259 if (cmd_parse ()) 1256 if (cmd_parse ())
1260 break; 1257 break;
1261 1258
1262 if (revents & EVENT_WRITE) 1259 if (revents & ev::WRITE)
1263 pty_write (); 1260 pty_write ();
1264} 1261}
1265 1262
1266void 1263void
1267rxvt_term::pointer_unblank () 1264rxvt_term::pointer_unblank ()
1271 1268
1272#ifdef POINTER_BLANK 1269#ifdef POINTER_BLANK
1273 hidden_pointer = 0; 1270 hidden_pointer = 0;
1274 1271
1275 if (option (Opt_pointerBlank)) 1272 if (option (Opt_pointerBlank))
1276 pointer_ev.start (NOW + pointerBlankDelay); 1273 pointer_ev.start (pointerBlankDelay);
1277#endif 1274#endif
1278} 1275}
1279 1276
1280#ifdef POINTER_BLANK 1277#ifdef POINTER_BLANK
1281void 1278void
1289 1286
1290 hidden_pointer = 1; 1287 hidden_pointer = 1;
1291} 1288}
1292 1289
1293void 1290void
1294rxvt_term::pointer_cb (time_watcher &w) 1291rxvt_term::pointer_cb (ev::timer &w, int revents)
1295{ 1292{
1296 make_current (); 1293 make_current ();
1297 1294
1298 pointer_blank (); 1295 pointer_blank ();
1299} 1296}
1302void 1299void
1303rxvt_term::mouse_report (XButtonEvent &ev) 1300rxvt_term::mouse_report (XButtonEvent &ev)
1304{ 1301{
1305 int button_number, key_state = 0; 1302 int button_number, key_state = 0;
1306 int x, y; 1303 int x, y;
1304 int code = 32;
1307 1305
1308 x = ev.x; 1306 x = Pixel2Col (ev.x);
1309 y = ev.y; 1307 y = Pixel2Row (ev.y);
1310 pixel_position (&x, &y); 1308 if (ev.type == MotionNotify) {
1309 if (x == mouse_row && y == mouse_col)
1310 return;
1311 mouse_row = x;
1312 mouse_col = y;
1313 code += 32;
1314 }
1311 1315
1312 if (MEvent.button == AnyButton) 1316 if (MEvent.button == AnyButton)
1313 button_number = 3; 1317 button_number = 3;
1314 else 1318 else
1315 { 1319 {
1361 x + 1, 1365 x + 1,
1362 y + 1); 1366 y + 1);
1363#endif 1367#endif
1364 1368
1365 tt_printf ("\033[M%c%c%c", 1369 tt_printf ("\033[M%c%c%c",
1366 (32 + button_number + key_state), 1370 (code + button_number + key_state),
1367 (32 + x + 1), 1371 (32 + x + 1),
1368 (32 + y + 1)); 1372 (32 + y + 1));
1369} 1373}
1370 1374
1371/*{{{ process an X event */ 1375/*{{{ process an X event */
1475 && ev.xfocus.mode != NotifyGrab) 1479 && ev.xfocus.mode != NotifyGrab)
1476 focus_out (); 1480 focus_out ();
1477 break; 1481 break;
1478 1482
1479 case ConfigureNotify: 1483 case ConfigureNotify:
1484 /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
1485 ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
1486 szHint.width, szHint.height); */
1480 if (ev.xconfigure.window == parent[0]) 1487 if (ev.xconfigure.window == parent[0])
1481 { 1488 {
1482 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1489 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1483 ; 1490 ;
1484 1491
1485 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1492 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1486 { 1493 {
1487 seen_resize = 1; 1494 seen_resize = 1;
1488 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1495 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1489#ifdef XPM_BACKGROUND
1490 if (!option (Opt_transparent) && bgPixmap.auto_resize)
1491 {
1492 resize_pixmap ();
1493 scr_touch (true);
1494 }
1495#endif
1496 } 1496 }
1497 1497 else
1498 {
1499#ifdef HAVE_BG_PIXMAP
1500 if (bgPixmap.window_position_sensitive ())
1501 update_background ();
1502#endif
1503 }
1498 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1504 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1499
1500#ifdef ENABLE_TRANSPARENCY
1501 if (option (Opt_transparent))
1502 check_our_parents ();
1503#endif
1504 } 1505 }
1505 break; 1506 break;
1506 1507
1507 case PropertyNotify: 1508 case PropertyNotify:
1508 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) 1509 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1526 break; 1527 break;
1527 1528
1528 case MapNotify: 1529 case MapNotify:
1529 mapped = 1; 1530 mapped = 1;
1530#ifdef TEXT_BLINK 1531#ifdef TEXT_BLINK
1531 text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); 1532 text_blink_ev.start (TEXT_BLINK_INTERVAL);
1532#endif 1533#endif
1533 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1534 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1534 break; 1535 break;
1535 1536
1536 case UnmapNotify: 1537 case UnmapNotify:
1538#ifdef TEXT_BLINK 1539#ifdef TEXT_BLINK
1539 text_blink_ev.stop (); 1540 text_blink_ev.stop ();
1540#endif 1541#endif
1541 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1542 HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1542 break; 1543 break;
1543
1544#ifdef ENABLE_TRANSPARENCY
1545 case ReparentNotify:
1546 rootwin_cb (ev);
1547 break;
1548#endif /* ENABLE_TRANSPARENCY */
1549 1544
1550 case GraphicsExpose: 1545 case GraphicsExpose:
1551 case Expose: 1546 case Expose:
1552 if (ev.xany.window == vt) 1547 if (ev.xany.window == vt)
1553 { 1548 {
1554 do 1549 do
1550 {
1555 scr_expose (ev.xexpose.x, ev.xexpose.y, 1551 scr_expose (ev.xexpose.x, ev.xexpose.y,
1556 ev.xexpose.width, ev.xexpose.height, False); 1552 ev.xexpose.width, ev.xexpose.height, False);
1553 }
1557 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)); 1554 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1558 1555
1559 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose; 1556 ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1560 1557
1561 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1559 {
1562 scr_expose (ev.xexpose.x, ev.xexpose.y, 1560 scr_expose (ev.xexpose.x, ev.xexpose.y,
1563 ev.xexpose.width, ev.xexpose.height, False); 1561 ev.xexpose.width, ev.xexpose.height, False);
1564 1562 }
1565 want_refresh = 1; 1563 want_refresh = 1;
1566 } 1564 }
1567 else 1565 else
1568 { 1566 {
1569 XEvent unused_event; 1567 XEvent unused_event;
1576 if (isScrollbarWindow (ev.xany.window)) 1574 if (isScrollbarWindow (ev.xany.window))
1577 { 1575 {
1578 scrollBar.setIdle (); 1576 scrollBar.setIdle ();
1579 scrollbar_show (0); 1577 scrollbar_show (0);
1580 } 1578 }
1581
1582#ifdef ENABLE_TRANSPARENCY
1583 if (am_transparent && ev.xany.window == parent[0])
1584 XClearWindow (dpy, ev.xany.window);
1585#endif
1586 } 1579 }
1587 break; 1580 break;
1588 1581
1589 case MotionNotify: 1582 case MotionNotify:
1590#ifdef POINTER_BLANK 1583#ifdef POINTER_BLANK
1591 if (hidden_pointer) 1584 if (hidden_pointer)
1592 pointer_unblank (); 1585 pointer_unblank ();
1593#endif 1586#endif
1587 if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
1588 || priv_modes & PrivMode_MouseAnyEvent)
1589 mouse_report (ev.xbutton);
1594 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) 1590 if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1595 break; 1591 break;
1596 1592
1597 if (ev.xany.window == vt) 1593 if (ev.xany.window == vt)
1598 { 1594 {
1633 1629
1634 /* don't clobber the current delay if we are 1630 /* don't clobber the current delay if we are
1635 * already in the middle of scrolling. 1631 * already in the middle of scrolling.
1636 */ 1632 */
1637 if (!sel_scroll_ev.active) 1633 if (!sel_scroll_ev.active)
1638 sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 1634 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1639 1635
1640 /* save the event params so we can highlight 1636 /* save the event params so we can highlight
1641 * the selection in the pending-scroll loop 1637 * the selection in the pending-scroll loop
1642 */ 1638 */
1643 selection_save_x = ev.xbutton.x; 1639 selection_save_x = ev.xbutton.x;
1702 { 1698 {
1703 hidden_cursor = 0; 1699 hidden_cursor = 0;
1704 want_refresh = 1; 1700 want_refresh = 1;
1705 } 1701 }
1706 1702
1707 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1703 cursor_blink_ev.again ();
1708 } 1704 }
1709#endif 1705#endif
1710 1706
1711#if defined(POINTER_BLANK) 1707#if defined(POINTER_BLANK)
1712 if (option (Opt_pointerBlank) && pointerBlankDelay > 0) 1708 if (option (Opt_pointerBlank) && pointerBlankDelay > 0)
1740 XSetICFocus (Input_Context); 1736 XSetICFocus (Input_Context);
1741 } 1737 }
1742#endif 1738#endif
1743#if CURSOR_BLINK 1739#if CURSOR_BLINK
1744 if (option (Opt_cursorBlink)) 1740 if (option (Opt_cursorBlink))
1745 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); 1741 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL);
1746#endif 1742#endif
1747#if OFF_FOCUS_FADING 1743#if OFF_FOCUS_FADING
1748 if (rs[Rs_fade]) 1744 if (rs[Rs_fade])
1749 { 1745 {
1750 pix_colors = pix_colors_focused; 1746 pix_colors = pix_colors_focused;
1752 } 1748 }
1753#endif 1749#endif
1754#if ENABLE_FRILLS 1750#if ENABLE_FRILLS
1755 if (option (Opt_urgentOnBell)) 1751 if (option (Opt_urgentOnBell))
1756 { 1752 {
1757 XWMHints *h;
1758
1759 h = XGetWMHints(dpy, parent[0]); 1753 if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1760 if (h != NULL)
1761 { 1754 {
1762 h->flags &= ~XUrgencyHint; 1755 h->flags &= ~XUrgencyHint;
1763 XSetWMHints(dpy, parent[0], h); 1756 XSetWMHints (dpy, parent[0], h);
1764 } 1757 }
1765 } 1758 }
1766#endif 1759#endif
1767 } 1760 }
1768} 1761}
1791 XUnsetICFocus (Input_Context); 1784 XUnsetICFocus (Input_Context);
1792#endif 1785#endif
1793#if CURSOR_BLINK 1786#if CURSOR_BLINK
1794 if (option (Opt_cursorBlink)) 1787 if (option (Opt_cursorBlink))
1795 cursor_blink_ev.stop (); 1788 cursor_blink_ev.stop ();
1789
1796 hidden_cursor = 0; 1790 hidden_cursor = 0;
1797#endif 1791#endif
1798#if OFF_FOCUS_FADING 1792#if OFF_FOCUS_FADING
1799 if (rs[Rs_fade]) 1793 if (rs[Rs_fade])
1800 { 1794 {
1834 case PropertyNotify: 1828 case PropertyNotify:
1835 /* 1829 /*
1836 * if user used some Esetroot compatible prog to set the root bg, 1830 * if user used some Esetroot compatible prog to set the root bg,
1837 * use the property to determine the pixmap. We use it later on. 1831 * use the property to determine the pixmap. We use it later on.
1838 */ 1832 */
1839 if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] 1833 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1840 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1834 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1841 return; 1835 {
1842 1836 bgPixmap.set_root_pixmap ();
1843 /* FALLTHROUGH */ 1837 update_background ();
1844 case ReparentNotify: 1838 }
1845 if (option (Opt_transparent))
1846 check_our_parents ();
1847 break; 1839 break;
1848 } 1840 }
1849# endif 1841# endif
1850} 1842}
1851#endif 1843#endif
2035 upordown = 1; /* down */ 2027 upordown = 1; /* down */
2036 } 2028 }
2037 if (upordown) 2029 if (upordown)
2038 { 2030 {
2039#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2031#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2040 cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); 2032 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2041#endif 2033#endif
2042 if (scr_page (upordown < 0 ? UP : DN, 1)) 2034 if (scr_page (upordown < 0 ? UP : DN, 1))
2043 { 2035 {
2044 if (upordown < 0) 2036 if (upordown < 0)
2045 scrollBar.setUp (); 2037 scrollBar.setUp ();
2208 { 2200 {
2209 mouse_slip_wheel_speed += v ? -1 : 1; 2201 mouse_slip_wheel_speed += v ? -1 : 1;
2210 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2202 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2211 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2203 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2212 2204
2213 if (slip_wheel_ev.at < NOW) 2205 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2214 slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY;
2215
2216 slip_wheel_ev.start ();
2217 } 2206 }
2218 else 2207 else
2219 { 2208 {
2220# endif 2209# endif
2221 scr_page (v, i); 2210 scr_page (v, i);
2289 2278
2290 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2291 { 2280 {
2292 refresh_count = 0; 2281 refresh_count = 0;
2293 2282
2294 if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) 2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.)
2295 { 2284 {
2296 refreshnow = true; 2285 refreshnow = true;
2297 ch = NOCHAR; 2286 ch = NOCHAR;
2298 break; 2287 break;
2299 } 2288 }
2806rxvt_term::process_csi_seq () 2795rxvt_term::process_csi_seq ()
2807{ 2796{
2808 unicode_t ch, priv, i; 2797 unicode_t ch, priv, i;
2809 unsigned int nargs, p; 2798 unsigned int nargs, p;
2810 int n, ndef; 2799 int n, ndef;
2811 int arg[ESC_ARGS]; 2800 int arg[ESC_ARGS] = { };
2812 2801
2813 memset (arg, 0, sizeof (arg));
2814 nargs = 0; 2802 nargs = 0;
2815 2803
2816 priv = 0; 2804 priv = 0;
2817 ch = cmd_getc (); 2805 ch = cmd_getc ();
2818 if (ch >= '<' && ch <= '?') 2806 if (ch >= '<' && ch <= '?')
2867 { 2855 {
2868 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt, 2856 // first parameter is normally 0 for vt100, 1 for vt220, 'R' for rxvt,
2869 // 'U' for rxvt-unicode != 7.[34] (where it was broken). 2857 // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2870 // 2858 //
2871 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt 2859 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2872 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify 2860 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
2873 // that we do not support xterm mouse reporting (should be 95 when we do). 2861 // versions.
2874 // 2862 //
2875 tt_printf ("\033[>%d;94;0c", 'U'); 2863 tt_printf ("\033[>%d;95;0c", 'U');
2876 } 2864 }
2877 break; 2865 break;
2878 case '?': 2866 case '?':
2879 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2867 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2880 process_terminal_mode (ch, priv, nargs, arg); 2868 process_terminal_mode (ch, priv, nargs, arg);
3431 break; 3419 break;
3432 case URxvt_Color_IT: 3420 case URxvt_Color_IT:
3433 process_color_seq (op, Color_IT, str, resp); 3421 process_color_seq (op, Color_IT, str, resp);
3434 break; 3422 break;
3435#endif 3423#endif
3436#if ENABLE_TRANSPARENCY && TINTING 3424#if ENABLE_TRANSPARENCY
3437 case URxvt_Color_tint: 3425 case URxvt_Color_tint:
3438 process_color_seq (op, Color_tint, str, resp); 3426 process_color_seq (op, Color_tint, str, resp);
3427 {
3428 bool changed = false;
3429 if (ISSET_PIXCOLOR (Color_tint))
3430 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3431 else
3432 changed = bgPixmap.unset_tint ();
3433 if (changed)
3434 update_background ();
3435 }
3439 3436
3440 check_our_parents ();
3441
3442 if (am_transparent)
3443 want_full_refresh = want_refresh = 1;
3444
3445 break; 3437 break;
3446#endif 3438#endif
3447 3439
3448#if XPM_BACKGROUND 3440#if BG_IMAGE_FROM_FILE
3449 case Rxvt_Pixmap: 3441 case Rxvt_Pixmap:
3450 { 3442 if (!strcmp (str, "?"))
3451 if (*str != ';')
3452 { 3443 {
3453 scale_pixmap (""); /* reset to default scaling */ 3444 char str[256];
3454 set_bgPixmap (str); /* change pixmap */ 3445
3455 scr_touch (true); 3446 sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */
3447 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
3448 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
3449 process_xterm_seq (XTerm_title, str, CHAR_ST);
3456 } 3450 }
3457 3451 else
3452 {
3458 int changed = 0; 3453 int changed = 0;
3459 3454
3460 while ((str = strchr (str, ';')) != NULL) 3455 if (*str != ';')
3461 { 3456 {
3457 /* reset to default scaling :*/
3458 bgPixmap.unset_geometry ();
3459 if (bgPixmap.set_file (str)) /* change pixmap */
3460 changed++;
3461 str = strchr (str, ';');
3462 if (str == NULL)
3463 bgPixmap.set_defaultGeometry ();
3464 }
3465 while (str)
3466 {
3462 str++; 3467 str++;
3463 changed += scale_pixmap (str); 3468 if (bgPixmap.set_geometry (str))
3469 changed++;
3470 str = strchr (str, ';');
3464 } 3471 }
3465
3466 if (changed) 3472 if (changed)
3467 { 3473 update_background ();
3468 resize_pixmap ();
3469 scr_touch (true);
3470 } 3474 }
3471#if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE)
3472 if (option (Opt_transparent))
3473 check_our_parents ();
3474#endif
3475 }
3476 break; 3475 break;
3477#endif 3476#endif
3478 3477
3479 case Rxvt_restoreFG: 3478 case Rxvt_restoreFG:
3480 set_window_color (Color_fg, str); 3479 set_window_color (Color_fg, str);
3604{ 3603{
3605 unsigned int i, j; 3604 unsigned int i, j;
3606 int state; 3605 int state;
3607 3606
3608 static const struct 3607 static const struct
3609 { 3608 {
3610 const int argval; 3609 const int argval;
3611 const unsigned long bit; 3610 const unsigned long bit;
3612 }
3613
3614 argtopriv[] = { 3611 } argtopriv[] = {
3615 { 1, PrivMode_aplCUR }, 3612 { 1, PrivMode_aplCUR },
3616 { 2, PrivMode_vt52 }, 3613 { 2, PrivMode_vt52 },
3617 { 3, PrivMode_132 }, 3614 { 3, PrivMode_132 },
3618 { 4, PrivMode_smoothScroll }, 3615 { 4, PrivMode_smoothScroll },
3619 { 5, PrivMode_rVideo }, 3616 { 5, PrivMode_rVideo },
3636#ifndef NO_BACKSPACE_KEY 3633#ifndef NO_BACKSPACE_KEY
3637 { 67, PrivMode_BackSpace }, 3634 { 67, PrivMode_BackSpace },
3638#endif 3635#endif
3639 { 1000, PrivMode_MouseX11 }, 3636 { 1000, PrivMode_MouseX11 },
3640 // 1001 Use Hilite Mouse Tracking. NYI, TODO 3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3641 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO 3638 { 1002, PrivMode_MouseBtnEvent },
3642 // 1003 Use All Motion Mouse Tracking. NYI, TODO 3639 { 1003, PrivMode_MouseAnyEvent },
3643 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3644 { 1011, PrivMode_Keypress }, // rxvt extension 3641 { 1011, PrivMode_Keypress }, // rxvt extension
3645 // 1035 enable modifiers for alt, numlock NYI 3642 // 1035 enable modifiers for alt, numlock NYI
3646 // 1036 send ESC for meta keys NYI 3643 // 1036 send ESC for meta keys NYI
3647 // 1037 send DEL for keypad delete NYI 3644 // 1037 send DEL for keypad delete NYI
3721 scr_autowrap (state); 3718 scr_autowrap (state);
3722 break; 3719 break;
3723 /* case 8: - auto repeat, can't do on a per window basis */ 3720 /* case 8: - auto repeat, can't do on a per window basis */
3724 case 9: /* X10 mouse reporting */ 3721 case 9: /* X10 mouse reporting */
3725 if (state) /* orthogonal */ 3722 if (state) /* orthogonal */
3726 priv_modes &= ~PrivMode_MouseX11; 3723 priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3727 break; 3724 break;
3728#ifdef scrollBar_esc 3725#ifdef scrollBar_esc
3729 case scrollBar_esc: 3726 case scrollBar_esc:
3730 if (scrollbar_mapping (state)) 3727 if (scrollbar_mapping (state))
3731 { 3728 {
3744 break; 3741 break;
3745 /* case 66: - application key pad */ 3742 /* case 66: - application key pad */
3746 /* case 67: - backspace key */ 3743 /* case 67: - backspace key */
3747 case 1000: /* X11 mouse reporting */ 3744 case 1000: /* X11 mouse reporting */
3748 if (state) /* orthogonal */ 3745 if (state) /* orthogonal */
3749 priv_modes &= ~PrivMode_MouseX10; 3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3750 break; 3747 break;
3751#if 0 3748#if 0
3752 case 1001: 3749 case 1001:
3753 break; /* X11 mouse highlighting */ 3750 break; /* X11 mouse highlighting */
3754#endif 3751#endif
3752 case 1002:
3753 case 1003:
3754 if (state) {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask;
3758 } else
3759 vt_emask_mouse = NoEventMask;
3760 vt_select_input ();
3761 break;
3755 case 1010: /* scroll to bottom on TTY output inhibit */ 3762 case 1010: /* scroll to bottom on TTY output inhibit */
3756 set_option (Opt_scrollTtyOutput, !state); 3763 set_option (Opt_scrollTtyOutput, !state);
3757 break; 3764 break;
3758 case 1011: /* scroll to bottom on key press */ 3765 case 1011: /* scroll to bottom on key press */
3759 set_option (Opt_scrollTtyKeypress, state); 3766 set_option (Opt_scrollTtyKeypress, state);
3996 v_buffer = (char *)realloc (v_buffer, v_buflen + len); 4003 v_buffer = (char *)realloc (v_buffer, v_buflen + len);
3997 4004
3998 memcpy (v_buffer + v_buflen, data, len); 4005 memcpy (v_buffer + v_buflen, data, len);
3999 v_buflen += len; 4006 v_buflen += len;
4000 4007
4001 pty_ev.set (EVENT_READ | EVENT_WRITE); 4008 pty_ev.set (ev::READ | ev::WRITE);
4002} 4009}
4003 4010
4004void rxvt_term::pty_write () 4011void rxvt_term::pty_write ()
4005{ 4012{
4006 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); 4013 int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4011 4018
4012 if (v_buflen == 0) 4019 if (v_buflen == 0)
4013 { 4020 {
4014 free (v_buffer); 4021 free (v_buffer);
4015 v_buffer = 0; 4022 v_buffer = 0;
4016 v_buflen = 0;
4017 4023
4018 pty_ev.set (EVENT_READ); 4024 pty_ev.set (ev::READ);
4019 return; 4025 return;
4020 } 4026 }
4021 4027
4022 memmove (v_buffer, v_buffer + written, v_buflen); 4028 memmove (v_buffer, v_buffer + written, v_buflen);
4023 } 4029 }
4024 else if (written != -1 || (errno != EAGAIN && errno != EINTR)) 4030 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4025 pty_ev.set (EVENT_READ); 4031 pty_ev.set (ev::READ);
4026} 4032}
4027 4033
4028/*----------------------- end-of-file (C source) -----------------------*/ 4034/*----------------------- end-of-file (C source) -----------------------*/
4029 4035

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines