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.363 by root, Sun Nov 11 04:08:00 2007 UTC vs.
Revision 1.397 by root, Sat Jan 26 11:40:47 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_Left: /* \033Ot or standard */
602 case XK_KP_Up: /* \033Ox or standard */
603 case XK_KP_Right: /* \033Ov or standard */
604 case XK_KP_Down: /* \033Or 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::prepare_cb (ev::prepare &w, int revents) 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 (1. / 60.); // refresh at max. 60 hz normally
1107} 1055}
1108 1056
1109void 1057void
1110rxvt_term::flush_cb (ev::timer &w, int revents) 1058rxvt_term::flush_cb (ev::timer &w, int revents)
1111{ 1059{
1119void 1067void
1120rxvt_term::cursor_blink_cb (ev::timer &w, int revents) 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;
1072 refresh_check ();
1124} 1073}
1125#endif 1074#endif
1126 1075
1127#ifdef TEXT_BLINK 1076#ifdef TEXT_BLINK
1128void 1077void
1130{ 1079{
1131 if (scr_refresh_rend (RS_Blink, RS_Blink)) 1080 if (scr_refresh_rend (RS_Blink, RS_Blink))
1132 { 1081 {
1133 hidden_text = !hidden_text; 1082 hidden_text = !hidden_text;
1134 want_refresh = 1; 1083 want_refresh = 1;
1084 refresh_check ();
1135 } 1085 }
1086 else
1087 w.stop ();
1136} 1088}
1137#endif 1089#endif
1138 1090
1139#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1091#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1140void 1092void
1141rxvt_term::cont_scroll_cb (ev::timer &w, int revents) 1093rxvt_term::cont_scroll_cb (ev::timer &w, int revents)
1142{ 1094{
1143 if ((scrollbar_isUp() || scrollbar_isDn()) && 1095 if ((scrollbar_isUp () || scrollbar_isDn ())
1144 scr_page (scrollbar_isUp() ? UP : DN, 1)) 1096 && scr_page (scrollbar_isUp () ? UP : DN, 1))
1097 {
1145 want_refresh = 1; 1098 want_refresh = 1;
1099 refresh_check ();
1100 }
1146 else 1101 else
1147 w.stop (); 1102 w.stop ();
1148} 1103}
1149#endif 1104#endif
1150 1105
1154{ 1109{
1155 if (scr_page (scroll_selection_dir, scroll_selection_lines)) 1110 if (scr_page (scroll_selection_dir, scroll_selection_lines))
1156 { 1111 {
1157 selection_extend (selection_save_x, selection_save_y, selection_save_state); 1112 selection_extend (selection_save_x, selection_save_y, selection_save_state);
1158 want_refresh = 1; 1113 want_refresh = 1;
1114 refresh_check ();
1159 } 1115 }
1160 else 1116 else
1161 w.stop (); 1117 w.stop ();
1162} 1118}
1163#endif 1119#endif
1164 1120
1165#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) 1121#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
1166void 1122void
1167rxvt_term::slip_wheel_cb (ev::timer &w, int revents) 1123rxvt_term::slip_wheel_cb (ev::timer &w, int revents)
1168{ 1124{
1169 if (mouse_slip_wheel_speed == 0 1125 if (scr_changeview (view_start - mouse_slip_wheel_speed))
1170 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed)
1171 : scr_page (UP, mouse_slip_wheel_speed))
1172 { 1126 {
1173 if (view_start == top_row || view_start == 0)
1174 mouse_slip_wheel_speed = 0;
1175
1176 want_refresh = 1; 1127 want_refresh = 1;
1128 refresh_check ();
1129 }
1130
1131 if (view_start == top_row || view_start == 0 || mouse_slip_wheel_speed == 0)
1177 } 1132 {
1178 else 1133 mouse_slip_wheel_speed = 0;
1179 w.stop (); 1134 w.stop ();
1135 }
1180} 1136}
1181#endif 1137#endif
1182 1138
1183#if LINUX_YIELD_HACK 1139#if LINUX_YIELD_HACK
1184static struct event_handler 1140static struct event_handler
1256 if (cmd_parse ()) 1212 if (cmd_parse ())
1257 break; 1213 break;
1258 1214
1259 if (revents & ev::WRITE) 1215 if (revents & ev::WRITE)
1260 pty_write (); 1216 pty_write ();
1217
1218 refresh_check ();
1261} 1219}
1262 1220
1263void 1221void
1264rxvt_term::pointer_unblank () 1222rxvt_term::pointer_unblank ()
1265{ 1223{
1303 int x, y; 1261 int x, y;
1304 int code = 32; 1262 int code = 32;
1305 1263
1306 x = Pixel2Col (ev.x); 1264 x = Pixel2Col (ev.x);
1307 y = Pixel2Row (ev.y); 1265 y = Pixel2Row (ev.y);
1308 if (ev.type == MotionNotify) { 1266 if (ev.type == MotionNotify)
1267 {
1309 if (x == mouse_row && y == mouse_col) 1268 if (x == mouse_row && y == mouse_col)
1310 return; 1269 return;
1311 mouse_row = x; 1270 mouse_row = x;
1312 mouse_col = y; 1271 mouse_col = y;
1313 code += 32; 1272 code += 32;
1314 } 1273 }
1315 1274
1316 if (MEvent.button == AnyButton) 1275 if (MEvent.button == AnyButton)
1317 button_number = 3; 1276 button_number = 3;
1318 else 1277 else
1319 { 1278 {
1479 && ev.xfocus.mode != NotifyGrab) 1438 && ev.xfocus.mode != NotifyGrab)
1480 focus_out (); 1439 focus_out ();
1481 break; 1440 break;
1482 1441
1483 case ConfigureNotify: 1442 case ConfigureNotify:
1484 /* 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",
1485 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,
1486 szHint.width, szHint.height); */ 1445 szHint.width, szHint.height);
1487 if (ev.xconfigure.window == parent[0]) 1446 if (ev.xconfigure.window == parent[0])
1488 { 1447 {
1489 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1448 //while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1490 ; 1449 ;
1491 1450
1492 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1451 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1493 { 1452 {
1494 seen_resize = 1; 1453 seen_resize = 1;
1496 } 1455 }
1497 else 1456 else
1498 { 1457 {
1499#ifdef HAVE_BG_PIXMAP 1458#ifdef HAVE_BG_PIXMAP
1500 if (bgPixmap.window_position_sensitive ()) 1459 if (bgPixmap.window_position_sensitive ())
1460 {
1461 if (mapped)
1501 update_background (); 1462 update_background ();
1463 else
1464 bgPixmap.invalidate ();
1465 }
1502#endif 1466#endif
1503 } 1467 }
1468
1504 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1469 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1505 } 1470 }
1506 break; 1471 break;
1507 1472
1508 case PropertyNotify: 1473 case PropertyNotify:
1525 case SelectionRequest: 1490 case SelectionRequest:
1526 selection_send (ev.xselectionrequest); 1491 selection_send (ev.xselectionrequest);
1527 break; 1492 break;
1528 1493
1529 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
1530 mapped = 1; 1511 mapped = 1;
1531#ifdef TEXT_BLINK 1512#ifdef TEXT_BLINK
1532 text_blink_ev.start (TEXT_BLINK_INTERVAL); 1513 text_blink_ev.start ();
1533#endif 1514#endif
1534 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1515 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1535 break; 1516 break;
1536 1517
1537 case UnmapNotify: 1518 case UnmapNotify:
1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1539 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1559 { 1540 {
1560 scr_expose (ev.xexpose.x, ev.xexpose.y, 1541 scr_expose (ev.xexpose.x, ev.xexpose.y,
1561 ev.xexpose.width, ev.xexpose.height, False); 1542 ev.xexpose.width, ev.xexpose.height, False);
1562 } 1543 }
1544
1563 want_refresh = 1; 1545 want_refresh = 1;
1564 } 1546 }
1565 else 1547 else
1566 { 1548 {
1567 XEvent unused_event; 1549 XEvent unused_event;
1569 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1551 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1570 ; 1552 ;
1571 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1553 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1572 ; 1554 ;
1573 1555
1574 if (isScrollbarWindow (ev.xany.window)) 1556 if (scrollBar.state && ev.xany.window == scrollBar.win)
1575 { 1557 {
1576 scrollBar.setIdle (); 1558 scrollBar.setIdle ();
1577 scrollbar_show (0); 1559 scrollbar_show (0);
1578 } 1560 }
1579 } 1561 }
1628 int dist; 1610 int dist;
1629 1611
1630 /* don't clobber the current delay if we are 1612 /* don't clobber the current delay if we are
1631 * already in the middle of scrolling. 1613 * already in the middle of scrolling.
1632 */ 1614 */
1633 if (!sel_scroll_ev.active) 1615 if (!sel_scroll_ev.is_active ())
1634 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1616 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1635 1617
1636 /* save the event params so we can highlight 1618 /* save the event params so we can highlight
1637 * the selection in the pending-scroll loop 1619 * the selection in the pending-scroll loop
1638 */ 1620 */
1661 else 1643 else
1662 { 1644 {
1663 /* we are within the text window, so we 1645 /* we are within the text window, so we
1664 * shouldn't be scrolling 1646 * shouldn't be scrolling
1665 */ 1647 */
1666 if (sel_scroll_ev.active)
1667 sel_scroll_ev.stop(); 1648 sel_scroll_ev.stop();
1668 } 1649 }
1669#endif 1650#endif
1670#ifdef MOUSE_THRESHOLD 1651#ifdef MOUSE_THRESHOLD
1671 } 1652 }
1672#endif 1653#endif
1673 } 1654 }
1674 } 1655 }
1675 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1656 else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win)
1676 { 1657 {
1677 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1658 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1678 MotionNotify, &ev)) 1659 MotionNotify, &ev))
1679 ; 1660 ;
1680 1661
1715 1696
1716 if (ev.type == KeyPress && hidden_pointer == 0) 1697 if (ev.type == KeyPress && hidden_pointer == 0)
1717 pointer_blank (); 1698 pointer_blank ();
1718 } 1699 }
1719#endif 1700#endif
1701
1702 refresh_check ();
1720} 1703}
1721 1704
1722void 1705void
1723rxvt_term::focus_in () 1706rxvt_term::focus_in ()
1724{ 1707{
1736 XSetICFocus (Input_Context); 1719 XSetICFocus (Input_Context);
1737 } 1720 }
1738#endif 1721#endif
1739#if CURSOR_BLINK 1722#if CURSOR_BLINK
1740 if (option (Opt_cursorBlink)) 1723 if (option (Opt_cursorBlink))
1741 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1724 cursor_blink_ev.again ();
1742#endif 1725#endif
1743#if OFF_FOCUS_FADING 1726#if OFF_FOCUS_FADING
1744 if (rs[Rs_fade]) 1727 if (rs[Rs_fade])
1745 { 1728 {
1746 pix_colors = pix_colors_focused; 1729 pix_colors = pix_colors_focused;
1834 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1817 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1835 { 1818 {
1836 bgPixmap.set_root_pixmap (); 1819 bgPixmap.set_root_pixmap ();
1837 update_background (); 1820 update_background ();
1838 } 1821 }
1822
1839 break; 1823 break;
1840 } 1824 }
1841# endif 1825# endif
1826
1827 refresh_check ();
1842} 1828}
1843#endif 1829#endif
1844 1830
1845void 1831void
1846rxvt_term::button_press (XButtonEvent &ev) 1832rxvt_term::button_press (XButtonEvent &ev)
1901 mouse_report (ev); 1887 mouse_report (ev);
1902 } 1888 }
1903#else 1889#else
1904 MEvent.button = ev.button; 1890 MEvent.button = ev.button;
1905 mouse_report (ev); 1891 mouse_report (ev);
1906#endif /* MOUSE_REPORT_DOUBLECLICK */ 1892#endif /* MOUSE_REPORT_DOUBLECLICK */
1907 1893
1908 } 1894 }
1909 else 1895 else
1910 { 1896 {
1911 if (ev.button != MEvent.button) 1897 if (ev.button != MEvent.button)
1959 } 1945 }
1960 1946
1961 /* 1947 /*
1962 * Scrollbar window processing of button press 1948 * Scrollbar window processing of button press
1963 */ 1949 */
1964 if (isScrollbarWindow (ev.window)) 1950 if (scrollBar.state && ev.window == scrollBar.win)
1965 { 1951 {
1966 scrollBar.setIdle (); 1952 scrollBar.setIdle ();
1967 /* 1953 /*
1968 * Rxvt-style scrollbar: 1954 * Rxvt-style scrollbar:
1969 * move up if mouse is above slider 1955 * move up if mouse is above slider
2005 tt_printf ("\033[5~"); 1991 tt_printf ("\033[5~");
2006 break; 1992 break;
2007 } 1993 }
2008 } 1994 }
2009 else 1995 else
2010#endif /* NO_SCROLLBAR_REPORT */ 1996#endif /* NO_SCROLLBAR_REPORT */
2011 1997
2012 { 1998 {
2013 char upordown = 0; 1999 char upordown = 0;
2014 2000
2015 if (scrollBar.style == R_SB_NEXT) 2001 if (scrollBar.style == R_SB_NEXT)
2016 { 2002 {
2017 if (scrollbarnext_upButton (ev.y)) 2003 if (scrollbarnext_upButton (ev.y))
2018 upordown = -1; /* up */ 2004 upordown = -1; /* up */
2024 if (scrollbarrxvt_upButton (ev.y)) 2010 if (scrollbarrxvt_upButton (ev.y))
2025 upordown = -1; /* up */ 2011 upordown = -1; /* up */
2026 else if (scrollbarrxvt_dnButton (ev.y)) 2012 else if (scrollbarrxvt_dnButton (ev.y))
2027 upordown = 1; /* down */ 2013 upordown = 1; /* down */
2028 } 2014 }
2015
2029 if (upordown) 2016 if (upordown)
2030 { 2017 {
2031#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 2018#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
2019 if (!cont_scroll_ev.is_active ())
2032 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2020 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2033#endif 2021#endif
2034 if (scr_page (upordown < 0 ? UP : DN, 1)) 2022 if (scr_page (upordown < 0 ? UP : DN, 1))
2035 { 2023 {
2036 if (upordown < 0) 2024 if (upordown < 0)
2037 scrollBar.setUp (); 2025 scrollBar.setUp ();
2041 } 2029 }
2042 else 2030 else
2043 switch (ev.button) 2031 switch (ev.button)
2044 { 2032 {
2045 case Button2: 2033 case Button2:
2046 switch (scrollbar_align) 2034 switch (scrollBar.align)
2047 { 2035 {
2048 case R_SB_ALIGN_TOP: 2036 case R_SB_ALIGN_TOP:
2049 csrO = 0; 2037 csrO = 0;
2050 break; 2038 break;
2051 case R_SB_ALIGN_CENTRE: 2039 case R_SB_ALIGN_CENTRE:
2063 2051
2064 scrollBar.setMotion (); 2052 scrollBar.setMotion ();
2065 break; 2053 break;
2066 2054
2067 case Button1: 2055 case Button1:
2068 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2056 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2069 csrO = ev.y - scrollBar.top; 2057 csrO = ev.y - scrollBar.top;
2070 /* FALLTHROUGH */ 2058 /* FALLTHROUGH */
2071 2059
2072 case Button3: 2060 case Button3:
2073 if (scrollBar.style != R_SB_XTERM) 2061 if (scrollBar.style != R_SB_XTERM)
2117 scrollBar.setIdle (); 2105 scrollBar.setIdle ();
2118 scrollbar_show (0); 2106 scrollbar_show (0);
2119 } 2107 }
2120 2108
2121#ifdef SELECTION_SCROLLING 2109#ifdef SELECTION_SCROLLING
2122 if (sel_scroll_ev.active)
2123 sel_scroll_ev.stop(); 2110 sel_scroll_ev.stop();
2124#endif 2111#endif
2125 2112
2126 if (ev.window == vt) 2113 if (ev.window == vt)
2127 { 2114 {
2128 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2115 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2152 mouse_report (ev); 2139 mouse_report (ev);
2153 } 2140 }
2154#else /* MOUSE_REPORT_DOUBLECLICK */ 2141#else /* MOUSE_REPORT_DOUBLECLICK */
2155 MEvent.button = AnyButton; 2142 MEvent.button = AnyButton;
2156 mouse_report (ev); 2143 mouse_report (ev);
2157#endif /* MOUSE_REPORT_DOUBLECLICK */ 2144#endif /* MOUSE_REPORT_DOUBLECLICK */
2158 return; 2145 return;
2159 } 2146 }
2160 2147
2161 /* 2148 /*
2162 * dumb hack to compensate for the failure of click-and-drag 2149 * dumb hack to compensate for the failure of click-and-drag
2200 { 2187 {
2201 mouse_slip_wheel_speed += v ? -1 : 1; 2188 mouse_slip_wheel_speed += v ? -1 : 1;
2202 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2189 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2203 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2190 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2204 2191
2192 if (!slip_wheel_ev.is_active ())
2205 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2193 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2206 } 2194 }
2207 else 2195 else
2196# endif
2208 { 2197 {
2209# endif
2210 scr_page (v, i); 2198 scr_page (v, i);
2211 scrollbar_show (1); 2199 scrollbar_show (1);
2212# ifdef MOUSE_SLIP_WHEELING
2213 } 2200 }
2214# endif
2215 } 2201 }
2216 break; 2202 break;
2217#endif 2203#endif
2218 } 2204 }
2219 } 2205 }
2278 2264
2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2265 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2280 { 2266 {
2281 refresh_count = 0; 2267 refresh_count = 0;
2282 2268
2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) 2269 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2284 { 2270 {
2285 refreshnow = true; 2271 refreshnow = true;
2286 ch = NOCHAR; 2272 ch = NOCHAR;
2287 break; 2273 break;
2288 } 2274 }
2499 } 2485 }
2500 } 2486 }
2501 2487
2502 pclose_printer (fd); 2488 pclose_printer (fd);
2503} 2489}
2504#endif /* PRINTPIPE */ 2490#endif /* PRINTPIPE */
2505/*}}} */ 2491/*}}} */
2506 2492
2507/* *INDENT-OFF* */ 2493/* *INDENT-OFF* */
2508enum { 2494enum {
2509 C1_40 = 0x40, 2495 C1_40 = 0x40,
2802 nargs = 0; 2788 nargs = 0;
2803 2789
2804 priv = 0; 2790 priv = 0;
2805 ch = cmd_getc (); 2791 ch = cmd_getc ();
2806 if (ch >= '<' && ch <= '?') 2792 if (ch >= '<' && ch <= '?')
2793 {
2807 { /* '<' '=' '>' '?' */ 2794 /* '<' '=' '>' '?' */
2808 priv = ch; 2795 priv = ch;
2809 ch = cmd_getc (); 2796 ch = cmd_getc ();
2810 } 2797 }
2811 2798
2812 /* read any numerical arguments */ 2799 /* read any numerical arguments */
2861 // versions. 2848 // versions.
2862 // 2849 //
2863 tt_printf ("\033[>%d;95;0c", 'U'); 2850 tt_printf ("\033[>%d;95;0c", 'U');
2864 } 2851 }
2865 break; 2852 break;
2853
2866 case '?': 2854 case '?':
2867 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 2855 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
2868 process_terminal_mode (ch, priv, nargs, arg); 2856 process_terminal_mode (ch, priv, nargs, arg);
2869 break; 2857 break;
2870 } 2858 }
3386 *buf++ = '\0'; 3374 *buf++ = '\0';
3387 3375
3388 process_color_seq (op, color, name, resp); 3376 process_color_seq (op, color, name, resp);
3389 } 3377 }
3390 break; 3378 break;
3379 case Rxvt_restoreFG:
3391 case XTerm_Color00: 3380 case XTerm_Color00:
3392 process_color_seq (op, Color_fg, str, resp); 3381 process_color_seq (op, Color_fg, str, resp);
3393 break; 3382 break;
3383 case Rxvt_restoreBG:
3394 case XTerm_Color01: 3384 case XTerm_Color01:
3395 process_color_seq (op, Color_bg, str, resp); 3385 process_color_seq (op, Color_bg, str, resp);
3396 break; 3386 break;
3397#ifndef NO_CURSORCOLOR 3387#ifndef NO_CURSORCOLOR
3398 case XTerm_Color_cursor: 3388 case XTerm_Color_cursor:
3424#if ENABLE_TRANSPARENCY 3414#if ENABLE_TRANSPARENCY
3425 case URxvt_Color_tint: 3415 case URxvt_Color_tint:
3426 process_color_seq (op, Color_tint, str, resp); 3416 process_color_seq (op, Color_tint, str, resp);
3427 { 3417 {
3428 bool changed = false; 3418 bool changed = false;
3419
3429 if (ISSET_PIXCOLOR (Color_tint)) 3420 if (ISSET_PIXCOLOR (Color_tint))
3430 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3421 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3431 else 3422 else
3432 changed = bgPixmap.unset_tint (); 3423 changed = bgPixmap.unset_tint ();
3424
3433 if (changed) 3425 if (changed)
3434 update_background (); 3426 update_background ();
3435 } 3427 }
3436 3428
3437 break; 3429 break;
3460 changed++; 3452 changed++;
3461 str = strchr (str, ';'); 3453 str = strchr (str, ';');
3462 if (str == NULL) 3454 if (str == NULL)
3463 bgPixmap.set_defaultGeometry (); 3455 bgPixmap.set_defaultGeometry ();
3464 } 3456 }
3457
3465 while (str) 3458 while (str)
3466 { 3459 {
3467 str++; 3460 str++;
3468 if (bgPixmap.set_geometry (str)) 3461 if (bgPixmap.set_geometry (str))
3469 changed++; 3462 changed++;
3470 str = strchr (str, ';'); 3463 str = strchr (str, ';');
3471 } 3464 }
3465
3472 if (changed) 3466 if (changed)
3473 update_background (); 3467 update_background ();
3474 } 3468 }
3475 break; 3469 break;
3476#endif 3470#endif
3477
3478 case Rxvt_restoreFG:
3479 set_window_color (Color_fg, str);
3480 break;
3481 case Rxvt_restoreBG:
3482 set_window_color (Color_bg, str);
3483 break;
3484 3471
3485 case XTerm_logfile: 3472 case XTerm_logfile:
3486 // TODO, when secure mode? 3473 // TODO, when secure mode?
3487 break; 3474 break;
3488 3475
3632 { 66, PrivMode_aplKP }, 3619 { 66, PrivMode_aplKP },
3633#ifndef NO_BACKSPACE_KEY 3620#ifndef NO_BACKSPACE_KEY
3634 { 67, PrivMode_BackSpace }, 3621 { 67, PrivMode_BackSpace },
3635#endif 3622#endif
3636 { 1000, PrivMode_MouseX11 }, 3623 { 1000, PrivMode_MouseX11 },
3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3638 { 1002, PrivMode_MouseBtnEvent }, 3624 { 1002, PrivMode_MouseBtnEvent },
3639 { 1003, PrivMode_MouseAnyEvent }, 3625 { 1003, PrivMode_MouseAnyEvent },
3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3626 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3641 { 1011, PrivMode_Keypress }, // rxvt extension 3627 { 1011, PrivMode_Keypress }, // rxvt extension
3642 // 1035 enable modifiers for alt, numlock NYI 3628 // 1035 enable modifiers for alt, numlock NYI
3644 // 1037 send DEL for keypad delete NYI 3630 // 1037 send DEL for keypad delete NYI
3645 { 1047, PrivMode_Screen }, 3631 { 1047, PrivMode_Screen },
3646 // 1048 save and restore cursor 3632 // 1048 save and restore cursor
3647 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ 3633 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */
3648 // 1051, 1052, 1060, 1061 keyboard emulation NYI 3634 // 1051, 1052, 1060, 1061 keyboard emulation NYI
3635 { 2004, PrivMode_BracketPaste },
3649 }; 3636 };
3650 3637
3651 if (nargs == 0) 3638 if (nargs == 0)
3652 return; 3639 return;
3653 3640
3701 */ 3688 */
3702 PrivMode (1, PrivMode_vt52); 3689 PrivMode (1, PrivMode_vt52);
3703 break; 3690 break;
3704 case 3: /* 80/132 */ 3691 case 3: /* 80/132 */
3705 if (priv_modes & PrivMode_132OK) 3692 if (priv_modes & PrivMode_132OK)
3693 {
3694 scr_poweron ();
3706 set_widthheight (((state ? 132 : 80) * fwidth), height); 3695 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3696 }
3707 break; 3697 break;
3708 case 4: /* smooth scrolling */ 3698 case 4: /* smooth scrolling */
3709 set_option (Opt_jumpScroll, !state); 3699 set_option (Opt_jumpScroll, !state);
3710 break; 3700 break;
3711 case 5: /* reverse video */ 3701 case 5: /* reverse video */
3743 /* case 67: - backspace key */ 3733 /* case 67: - backspace key */
3744 case 1000: /* X11 mouse reporting */ 3734 case 1000: /* X11 mouse reporting */
3745 if (state) /* orthogonal */ 3735 if (state) /* orthogonal */
3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3736 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3747 break; 3737 break;
3748#if 0
3749 case 1001:
3750 break; /* X11 mouse highlighting */
3751#endif
3752 case 1002: 3738 case 1002:
3753 case 1003: 3739 case 1003:
3754 if (state) { 3740 if (state)
3741 {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3742 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3743 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask; 3744 vt_emask_mouse = PointerMotionMask;
3745 }
3758 } else 3746 else
3759 vt_emask_mouse = NoEventMask; 3747 vt_emask_mouse = NoEventMask;
3760 vt_select_input (); 3748 vt_select_input ();
3761 break; 3749 break;
3762 case 1010: /* scroll to bottom on TTY output inhibit */ 3750 case 1010: /* scroll to bottom on TTY output inhibit */
3763 set_option (Opt_scrollTtyOutput, !state); 3751 set_option (Opt_scrollTtyOutput, !state);
3943rxvt_term::process_graphics () 3931rxvt_term::process_graphics ()
3944{ 3932{
3945 unicode_t ch, cmd = cmd_getc (); 3933 unicode_t ch, cmd = cmd_getc ();
3946 3934
3947 if (cmd == 'Q') 3935 if (cmd == 'Q')
3936 {
3948 { /* query graphics */ 3937 /* query graphics */
3949 tt_printf ("\033G0\012"); /* no graphics */ 3938 tt_printf ("\033G0\012"); /* no graphics */
3950 return; 3939 return;
3951 } 3940 }
3952 /* swallow other graphics sequences until terminating ':' */ 3941 /* swallow other graphics sequences until terminating ':' */
3953 do 3942 do

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines