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.392 by root, Sat Jan 12 22:13:46 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 {
1499#ifdef HAVE_BG_PIXMAP 1458#ifdef HAVE_BG_PIXMAP
1500 if (bgPixmap.window_position_sensitive ()) 1459 if (bgPixmap.window_position_sensitive ())
1501 update_background (); 1460 update_background ();
1502#endif 1461#endif
1503 } 1462 }
1463
1504 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); 1464 HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1505 } 1465 }
1506 break; 1466 break;
1507 1467
1508 case PropertyNotify: 1468 case PropertyNotify:
1527 break; 1487 break;
1528 1488
1529 case MapNotify: 1489 case MapNotify:
1530 mapped = 1; 1490 mapped = 1;
1531#ifdef TEXT_BLINK 1491#ifdef TEXT_BLINK
1532 text_blink_ev.start (TEXT_BLINK_INTERVAL); 1492 text_blink_ev.start ();
1533#endif 1493#endif
1534 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); 1494 HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1535 break; 1495 break;
1536 1496
1537 case UnmapNotify: 1497 case UnmapNotify:
1558 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev)) 1518 while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1559 { 1519 {
1560 scr_expose (ev.xexpose.x, ev.xexpose.y, 1520 scr_expose (ev.xexpose.x, ev.xexpose.y,
1561 ev.xexpose.width, ev.xexpose.height, False); 1521 ev.xexpose.width, ev.xexpose.height, False);
1562 } 1522 }
1523
1563 want_refresh = 1; 1524 want_refresh = 1;
1564 } 1525 }
1565 else 1526 else
1566 { 1527 {
1567 XEvent unused_event; 1528 XEvent unused_event;
1569 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event)) 1530 while (XCheckTypedWindowEvent (dpy, ev.xany.window, Expose, &unused_event))
1570 ; 1531 ;
1571 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event)) 1532 while (XCheckTypedWindowEvent (dpy, ev.xany.window, GraphicsExpose, &unused_event))
1572 ; 1533 ;
1573 1534
1574 if (isScrollbarWindow (ev.xany.window)) 1535 if (scrollBar.state && ev.xany.window == scrollBar.win)
1575 { 1536 {
1576 scrollBar.setIdle (); 1537 scrollBar.setIdle ();
1577 scrollbar_show (0); 1538 scrollbar_show (0);
1578 } 1539 }
1579 } 1540 }
1628 int dist; 1589 int dist;
1629 1590
1630 /* don't clobber the current delay if we are 1591 /* don't clobber the current delay if we are
1631 * already in the middle of scrolling. 1592 * already in the middle of scrolling.
1632 */ 1593 */
1633 if (!sel_scroll_ev.active) 1594 if (!sel_scroll_ev.is_active ())
1634 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1595 sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
1635 1596
1636 /* save the event params so we can highlight 1597 /* save the event params so we can highlight
1637 * the selection in the pending-scroll loop 1598 * the selection in the pending-scroll loop
1638 */ 1599 */
1661 else 1622 else
1662 { 1623 {
1663 /* we are within the text window, so we 1624 /* we are within the text window, so we
1664 * shouldn't be scrolling 1625 * shouldn't be scrolling
1665 */ 1626 */
1666 if (sel_scroll_ev.active)
1667 sel_scroll_ev.stop(); 1627 sel_scroll_ev.stop();
1668 } 1628 }
1669#endif 1629#endif
1670#ifdef MOUSE_THRESHOLD 1630#ifdef MOUSE_THRESHOLD
1671 } 1631 }
1672#endif 1632#endif
1673 } 1633 }
1674 } 1634 }
1675 else if (isScrollbarWindow (ev.xany.window) && scrollbar_isMotion ()) 1635 else if (scrollbar_isMotion () && ev.xany.window == scrollBar.win)
1676 { 1636 {
1677 while (XCheckTypedWindowEvent (dpy, scrollBar.win, 1637 while (XCheckTypedWindowEvent (dpy, scrollBar.win,
1678 MotionNotify, &ev)) 1638 MotionNotify, &ev))
1679 ; 1639 ;
1680 1640
1715 1675
1716 if (ev.type == KeyPress && hidden_pointer == 0) 1676 if (ev.type == KeyPress && hidden_pointer == 0)
1717 pointer_blank (); 1677 pointer_blank ();
1718 } 1678 }
1719#endif 1679#endif
1680
1681 refresh_check ();
1720} 1682}
1721 1683
1722void 1684void
1723rxvt_term::focus_in () 1685rxvt_term::focus_in ()
1724{ 1686{
1736 XSetICFocus (Input_Context); 1698 XSetICFocus (Input_Context);
1737 } 1699 }
1738#endif 1700#endif
1739#if CURSOR_BLINK 1701#if CURSOR_BLINK
1740 if (option (Opt_cursorBlink)) 1702 if (option (Opt_cursorBlink))
1741 cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); 1703 cursor_blink_ev.again ();
1742#endif 1704#endif
1743#if OFF_FOCUS_FADING 1705#if OFF_FOCUS_FADING
1744 if (rs[Rs_fade]) 1706 if (rs[Rs_fade])
1745 { 1707 {
1746 pix_colors = pix_colors_focused; 1708 pix_colors = pix_colors_focused;
1834 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1796 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1835 { 1797 {
1836 bgPixmap.set_root_pixmap (); 1798 bgPixmap.set_root_pixmap ();
1837 update_background (); 1799 update_background ();
1838 } 1800 }
1801
1839 break; 1802 break;
1840 } 1803 }
1841# endif 1804# endif
1805
1806 refresh_check ();
1842} 1807}
1843#endif 1808#endif
1844 1809
1845void 1810void
1846rxvt_term::button_press (XButtonEvent &ev) 1811rxvt_term::button_press (XButtonEvent &ev)
1901 mouse_report (ev); 1866 mouse_report (ev);
1902 } 1867 }
1903#else 1868#else
1904 MEvent.button = ev.button; 1869 MEvent.button = ev.button;
1905 mouse_report (ev); 1870 mouse_report (ev);
1906#endif /* MOUSE_REPORT_DOUBLECLICK */ 1871#endif /* MOUSE_REPORT_DOUBLECLICK */
1907 1872
1908 } 1873 }
1909 else 1874 else
1910 { 1875 {
1911 if (ev.button != MEvent.button) 1876 if (ev.button != MEvent.button)
1959 } 1924 }
1960 1925
1961 /* 1926 /*
1962 * Scrollbar window processing of button press 1927 * Scrollbar window processing of button press
1963 */ 1928 */
1964 if (isScrollbarWindow (ev.window)) 1929 if (scrollBar.state && ev.window == scrollBar.win)
1965 { 1930 {
1966 scrollBar.setIdle (); 1931 scrollBar.setIdle ();
1967 /* 1932 /*
1968 * Rxvt-style scrollbar: 1933 * Rxvt-style scrollbar:
1969 * move up if mouse is above slider 1934 * move up if mouse is above slider
2005 tt_printf ("\033[5~"); 1970 tt_printf ("\033[5~");
2006 break; 1971 break;
2007 } 1972 }
2008 } 1973 }
2009 else 1974 else
2010#endif /* NO_SCROLLBAR_REPORT */ 1975#endif /* NO_SCROLLBAR_REPORT */
2011 1976
2012 { 1977 {
2013 char upordown = 0; 1978 char upordown = 0;
2014 1979
2015 if (scrollBar.style == R_SB_NEXT) 1980 if (scrollBar.style == R_SB_NEXT)
2016 { 1981 {
2017 if (scrollbarnext_upButton (ev.y)) 1982 if (scrollbarnext_upButton (ev.y))
2018 upordown = -1; /* up */ 1983 upordown = -1; /* up */
2024 if (scrollbarrxvt_upButton (ev.y)) 1989 if (scrollbarrxvt_upButton (ev.y))
2025 upordown = -1; /* up */ 1990 upordown = -1; /* up */
2026 else if (scrollbarrxvt_dnButton (ev.y)) 1991 else if (scrollbarrxvt_dnButton (ev.y))
2027 upordown = 1; /* down */ 1992 upordown = 1; /* down */
2028 } 1993 }
1994
2029 if (upordown) 1995 if (upordown)
2030 { 1996 {
2031#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING 1997#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
1998 if (!cont_scroll_ev.is_active ())
2032 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 1999 cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2033#endif 2000#endif
2034 if (scr_page (upordown < 0 ? UP : DN, 1)) 2001 if (scr_page (upordown < 0 ? UP : DN, 1))
2035 { 2002 {
2036 if (upordown < 0) 2003 if (upordown < 0)
2037 scrollBar.setUp (); 2004 scrollBar.setUp ();
2041 } 2008 }
2042 else 2009 else
2043 switch (ev.button) 2010 switch (ev.button)
2044 { 2011 {
2045 case Button2: 2012 case Button2:
2046 switch (scrollbar_align) 2013 switch (scrollBar.align)
2047 { 2014 {
2048 case R_SB_ALIGN_TOP: 2015 case R_SB_ALIGN_TOP:
2049 csrO = 0; 2016 csrO = 0;
2050 break; 2017 break;
2051 case R_SB_ALIGN_CENTRE: 2018 case R_SB_ALIGN_CENTRE:
2063 2030
2064 scrollBar.setMotion (); 2031 scrollBar.setMotion ();
2065 break; 2032 break;
2066 2033
2067 case Button1: 2034 case Button1:
2068 if (scrollbar_align == R_SB_ALIGN_CENTRE) 2035 if (scrollBar.align == R_SB_ALIGN_CENTRE)
2069 csrO = ev.y - scrollBar.top; 2036 csrO = ev.y - scrollBar.top;
2070 /* FALLTHROUGH */ 2037 /* FALLTHROUGH */
2071 2038
2072 case Button3: 2039 case Button3:
2073 if (scrollBar.style != R_SB_XTERM) 2040 if (scrollBar.style != R_SB_XTERM)
2117 scrollBar.setIdle (); 2084 scrollBar.setIdle ();
2118 scrollbar_show (0); 2085 scrollbar_show (0);
2119 } 2086 }
2120 2087
2121#ifdef SELECTION_SCROLLING 2088#ifdef SELECTION_SCROLLING
2122 if (sel_scroll_ev.active)
2123 sel_scroll_ev.stop(); 2089 sel_scroll_ev.stop();
2124#endif 2090#endif
2125 2091
2126 if (ev.window == vt) 2092 if (ev.window == vt)
2127 { 2093 {
2128 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) 2094 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2152 mouse_report (ev); 2118 mouse_report (ev);
2153 } 2119 }
2154#else /* MOUSE_REPORT_DOUBLECLICK */ 2120#else /* MOUSE_REPORT_DOUBLECLICK */
2155 MEvent.button = AnyButton; 2121 MEvent.button = AnyButton;
2156 mouse_report (ev); 2122 mouse_report (ev);
2157#endif /* MOUSE_REPORT_DOUBLECLICK */ 2123#endif /* MOUSE_REPORT_DOUBLECLICK */
2158 return; 2124 return;
2159 } 2125 }
2160 2126
2161 /* 2127 /*
2162 * dumb hack to compensate for the failure of click-and-drag 2128 * dumb hack to compensate for the failure of click-and-drag
2200 { 2166 {
2201 mouse_slip_wheel_speed += v ? -1 : 1; 2167 mouse_slip_wheel_speed += v ? -1 : 1;
2202 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; 2168 if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow;
2203 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; 2169 if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow;
2204 2170
2171 if (!slip_wheel_ev.is_active ())
2205 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); 2172 slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY);
2206 } 2173 }
2207 else 2174 else
2175# endif
2208 { 2176 {
2209# endif
2210 scr_page (v, i); 2177 scr_page (v, i);
2211 scrollbar_show (1); 2178 scrollbar_show (1);
2212# ifdef MOUSE_SLIP_WHEELING
2213 } 2179 }
2214# endif
2215 } 2180 }
2216 break; 2181 break;
2217#endif 2182#endif
2218 } 2183 }
2219 } 2184 }
2278 2243
2279 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1) 2244 if (!option (Opt_jumpScroll) || refresh_count >= nrow - 1)
2280 { 2245 {
2281 refresh_count = 0; 2246 refresh_count = 0;
2282 2247
2283 if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) 2248 if (!option (Opt_skipScroll) || ev_time () > ev::now () + 1. / 60.)
2284 { 2249 {
2285 refreshnow = true; 2250 refreshnow = true;
2286 ch = NOCHAR; 2251 ch = NOCHAR;
2287 break; 2252 break;
2288 } 2253 }
2499 } 2464 }
2500 } 2465 }
2501 2466
2502 pclose_printer (fd); 2467 pclose_printer (fd);
2503} 2468}
2504#endif /* PRINTPIPE */ 2469#endif /* PRINTPIPE */
2505/*}}} */ 2470/*}}} */
2506 2471
2507/* *INDENT-OFF* */ 2472/* *INDENT-OFF* */
2508enum { 2473enum {
2509 C1_40 = 0x40, 2474 C1_40 = 0x40,
2802 nargs = 0; 2767 nargs = 0;
2803 2768
2804 priv = 0; 2769 priv = 0;
2805 ch = cmd_getc (); 2770 ch = cmd_getc ();
2806 if (ch >= '<' && ch <= '?') 2771 if (ch >= '<' && ch <= '?')
2772 {
2807 { /* '<' '=' '>' '?' */ 2773 /* '<' '=' '>' '?' */
2808 priv = ch; 2774 priv = ch;
2809 ch = cmd_getc (); 2775 ch = cmd_getc ();
2810 } 2776 }
2811 2777
2812 /* read any numerical arguments */ 2778 /* read any numerical arguments */
3424#if ENABLE_TRANSPARENCY 3390#if ENABLE_TRANSPARENCY
3425 case URxvt_Color_tint: 3391 case URxvt_Color_tint:
3426 process_color_seq (op, Color_tint, str, resp); 3392 process_color_seq (op, Color_tint, str, resp);
3427 { 3393 {
3428 bool changed = false; 3394 bool changed = false;
3395
3429 if (ISSET_PIXCOLOR (Color_tint)) 3396 if (ISSET_PIXCOLOR (Color_tint))
3430 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]); 3397 changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
3431 else 3398 else
3432 changed = bgPixmap.unset_tint (); 3399 changed = bgPixmap.unset_tint ();
3400
3433 if (changed) 3401 if (changed)
3434 update_background (); 3402 update_background ();
3435 } 3403 }
3436 3404
3437 break; 3405 break;
3460 changed++; 3428 changed++;
3461 str = strchr (str, ';'); 3429 str = strchr (str, ';');
3462 if (str == NULL) 3430 if (str == NULL)
3463 bgPixmap.set_defaultGeometry (); 3431 bgPixmap.set_defaultGeometry ();
3464 } 3432 }
3433
3465 while (str) 3434 while (str)
3466 { 3435 {
3467 str++; 3436 str++;
3468 if (bgPixmap.set_geometry (str)) 3437 if (bgPixmap.set_geometry (str))
3469 changed++; 3438 changed++;
3470 str = strchr (str, ';'); 3439 str = strchr (str, ';');
3471 } 3440 }
3441
3472 if (changed) 3442 if (changed)
3473 update_background (); 3443 update_background ();
3474 } 3444 }
3475 break; 3445 break;
3476#endif 3446#endif
3477 3447
3478 case Rxvt_restoreFG: 3448 case Rxvt_restoreFG:
3632 { 66, PrivMode_aplKP }, 3602 { 66, PrivMode_aplKP },
3633#ifndef NO_BACKSPACE_KEY 3603#ifndef NO_BACKSPACE_KEY
3634 { 67, PrivMode_BackSpace }, 3604 { 67, PrivMode_BackSpace },
3635#endif 3605#endif
3636 { 1000, PrivMode_MouseX11 }, 3606 { 1000, PrivMode_MouseX11 },
3637 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3638 { 1002, PrivMode_MouseBtnEvent }, 3607 { 1002, PrivMode_MouseBtnEvent },
3639 { 1003, PrivMode_MouseAnyEvent }, 3608 { 1003, PrivMode_MouseAnyEvent },
3640 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3609 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3641 { 1011, PrivMode_Keypress }, // rxvt extension 3610 { 1011, PrivMode_Keypress }, // rxvt extension
3642 // 1035 enable modifiers for alt, numlock NYI 3611 // 1035 enable modifiers for alt, numlock NYI
3701 */ 3670 */
3702 PrivMode (1, PrivMode_vt52); 3671 PrivMode (1, PrivMode_vt52);
3703 break; 3672 break;
3704 case 3: /* 80/132 */ 3673 case 3: /* 80/132 */
3705 if (priv_modes & PrivMode_132OK) 3674 if (priv_modes & PrivMode_132OK)
3675 {
3676 scr_poweron ();
3706 set_widthheight (((state ? 132 : 80) * fwidth), height); 3677 set_widthheight (((state ? 132 : 80) * fwidth), 24 * fheight);
3678 }
3707 break; 3679 break;
3708 case 4: /* smooth scrolling */ 3680 case 4: /* smooth scrolling */
3709 set_option (Opt_jumpScroll, !state); 3681 set_option (Opt_jumpScroll, !state);
3710 break; 3682 break;
3711 case 5: /* reverse video */ 3683 case 5: /* reverse video */
3743 /* case 67: - backspace key */ 3715 /* case 67: - backspace key */
3744 case 1000: /* X11 mouse reporting */ 3716 case 1000: /* X11 mouse reporting */
3745 if (state) /* orthogonal */ 3717 if (state) /* orthogonal */
3746 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent); 3718 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3747 break; 3719 break;
3748#if 0
3749 case 1001:
3750 break; /* X11 mouse highlighting */
3751#endif
3752 case 1002: 3720 case 1002:
3753 case 1003: 3721 case 1003:
3754 if (state) { 3722 if (state)
3723 {
3755 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11); 3724 priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
3756 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent; 3725 priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
3757 vt_emask_mouse = PointerMotionMask; 3726 vt_emask_mouse = PointerMotionMask;
3727 }
3758 } else 3728 else
3759 vt_emask_mouse = NoEventMask; 3729 vt_emask_mouse = NoEventMask;
3760 vt_select_input (); 3730 vt_select_input ();
3761 break; 3731 break;
3762 case 1010: /* scroll to bottom on TTY output inhibit */ 3732 case 1010: /* scroll to bottom on TTY output inhibit */
3763 set_option (Opt_scrollTtyOutput, !state); 3733 set_option (Opt_scrollTtyOutput, !state);
3943rxvt_term::process_graphics () 3913rxvt_term::process_graphics ()
3944{ 3914{
3945 unicode_t ch, cmd = cmd_getc (); 3915 unicode_t ch, cmd = cmd_getc ();
3946 3916
3947 if (cmd == 'Q') 3917 if (cmd == 'Q')
3918 {
3948 { /* query graphics */ 3919 /* query graphics */
3949 tt_printf ("\033G0\012"); /* no graphics */ 3920 tt_printf ("\033G0\012"); /* no graphics */
3950 return; 3921 return;
3951 } 3922 }
3952 /* swallow other graphics sequences until terminating ':' */ 3923 /* swallow other graphics sequences until terminating ':' */
3953 do 3924 do

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines