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.22 by pcg, Thu Dec 18 13:33:02 2003 UTC vs.
Revision 1.32 by pcg, Thu Jan 29 23:31:45 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: command.c 2 * File: command.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: command.C,v 1.22 2003/12/18 13:33:02 pcg Exp $ 4 * $Id: command.C,v 1.32 2004/01/29 23:31:45 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
8 * - original version 8 * - original version
9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
64 KeySym keysym; 64 KeySym keysym;
65#ifdef DEBUG_CMD 65#ifdef DEBUG_CMD
66 static int debug_key = 1; /* accessible by a debugger only */ 66 static int debug_key = 1; /* accessible by a debugger only */
67#endif 67#endif
68 int valid_keysym; 68 int valid_keysym;
69 unsigned char *kbuf = R->kbuf; 69 unsigned char kbuf[KBUFSZ];
70 70
71/* 71/*
72 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 72 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
73 * escape sequence to toggle the Keypad. 73 * escape sequence to toggle the Keypad.
74 * 74 *
90 if (R->Input_Context) 90 if (R->Input_Context)
91 { 91 {
92 Status status_return; 92 Status status_return;
93 93
94#ifdef X_HAVE_UTF8_STRING 94#ifdef X_HAVE_UTF8_STRING
95 if (R->enc_utf8) 95 if (R->enc_utf8 && 0)
96 len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf, 96 len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf,
97 KBUFSZ, &keysym, &status_return); 97 KBUFSZ, &keysym, &status_return);
98 else 98 else
99#endif 99#endif
100 { 100 {
635 for (i = 0, p = kbuf; i < len; i++, p++) 635 for (i = 0, p = kbuf; i < len; i++, p++)
636 fprintf(stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); 636 fprintf(stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p);
637 fprintf(stderr, "'\n"); 637 fprintf(stderr, "'\n");
638 } 638 }
639#endif /* DEBUG_CMD */ 639#endif /* DEBUG_CMD */
640 R->tt_write(kbuf, (unsigned int)len); 640 R->tt_write (kbuf, (unsigned int)len);
641} 641}
642/*}}} */ 642/*}}} */
643 643
644#if (MENUBAR_MAX) 644#if (MENUBAR_MAX)
645/*{{{ rxvt_cmd_write(), rxvt_cmd_getc() */ 645/*{{{ rxvt_cmd_write(), rxvt_cmd_getc() */
695 rxvt_IMSendSpot (this); 695 rxvt_IMSendSpot (this);
696#endif 696#endif
697 } 697 }
698 698
699 XFlush (Xdisplay); 699 XFlush (Xdisplay);
700#if 0
701 if (XPending (Xdisplay)) process_x_events ();
702 if (XPending (Xdisplay)) process_x_events ();
703#endif
704} 700}
705 701
706void 702void
707rxvt_term::check_cb (check_watcher &w) 703rxvt_term::check_cb (check_watcher &w)
708{ 704{
720 XEvent xev; 716 XEvent xev;
721 717
722 XNextEvent (Xdisplay, &xev); 718 XNextEvent (Xdisplay, &xev);
723 719
724#if defined(CURSOR_BLINK) 720#if defined(CURSOR_BLINK)
725 if ((Options & Opt_cursorBlink) 721 if ((Options & Opt_cursorBlink) && xev.type == KeyPress)
726 && xev.type == KeyPress)
727 { 722 {
728 if (hidden_cursor) 723 if (hidden_cursor)
729 { 724 {
730 hidden_cursor = 0; 725 hidden_cursor = 0;
731 want_refresh = 1; 726 want_refresh = 1;
732 } 727 }
733 728
734 blink_ev.start (NOW + BLINK_INTERVAL); 729 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
735 } 730 }
736#endif 731#endif
737 732
738#if defined(POINTER_BLANK) 733#if defined(POINTER_BLANK)
739 if ((Options & Opt_pointerBlank) 734 if ((Options & Opt_pointerBlank) && pointerBlankDelay > 0)
740 && (pointerBlankDelay > 0))
741 { 735 {
742 if (xev.type == MotionNotify 736 if (xev.type == MotionNotify
743 || xev.type == ButtonPress 737 || xev.type == ButtonPress
744 || xev.type == ButtonRelease) 738 || xev.type == ButtonRelease)
745 if (hidden_pointer) 739 if (hidden_pointer)
756 rxvt_process_x_event (this, &xev); 750 rxvt_process_x_event (this, &xev);
757 } 751 }
758 while (XPending (Xdisplay)); 752 while (XPending (Xdisplay));
759} 753}
760 754
755#ifdef CURSOR_BLINK
761void 756void
762rxvt_term::blink_cb (time_watcher &w) 757rxvt_term::cursor_blink_cb (time_watcher &w)
763{ 758{
764 w.at += BLINK_INTERVAL;
765 hidden_cursor = !hidden_cursor; 759 hidden_cursor = !hidden_cursor;
766 want_refresh = 1; 760 want_refresh = 1;
761
762 w.start (w.at + BLINK_INTERVAL);
767} 763}
764#endif
765
766#ifdef TEXT_BLINK
767void
768rxvt_term::text_blink_cb (time_watcher &w)
769{
770 if (scr_refresh_rend (RS_Blink, RS_Blink))
771 {
772 hidden_text = !hidden_text;
773 want_refresh = 1;
774 w.start (w.at + TEXT_BLINK_INTERVAL);
775 }
776}
777#endif
768 778
769void 779void
770rxvt_term::x_cb (io_watcher &w, short revents) 780rxvt_term::x_cb (io_watcher &w, short revents)
771{ 781{
772 SET_R (this); 782 SET_R (this);
1021 quick_timeout |= R->want_full_refresh; 1031 quick_timeout |= R->want_full_refresh;
1022#endif 1032#endif
1023#endif 1033#endif
1024} 1034}
1025 1035
1036#ifdef POINTER_BLANK
1026void 1037void
1027rxvt_term::pointer_unblank () 1038rxvt_term::pointer_unblank ()
1028{ 1039{
1029 XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); 1040 XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor);
1030 recolour_cursor (); 1041 recolour_cursor ();
1031 1042
1032#ifdef POINTER_BLANK
1033 hidden_pointer = 0; 1043 hidden_pointer = 0;
1034 1044
1035 if (Options & Opt_pointerBlank) 1045 if (Options & Opt_pointerBlank)
1036 pointer_ev.start (NOW + pointerBlankDelay); 1046 pointer_ev.start (NOW + pointerBlankDelay);
1037#endif
1038} 1047}
1039 1048
1040#ifdef POINTER_BLANK
1041void 1049void
1042rxvt_term::pointer_blank () 1050rxvt_term::pointer_blank ()
1043{ 1051{
1044 pointer_ev.stop ();
1045
1046 if (!(Options & Opt_pointerBlank)) 1052 if (!(Options & Opt_pointerBlank))
1047 return; 1053 return;
1048 1054
1049 XDefineCursor (Xdisplay, TermWin.vt, blank_cursor); 1055 XDefineCursor (Xdisplay, TermWin.vt, blank_cursor);
1050 XFlush (Xdisplay); 1056 XFlush (Xdisplay);
1297 if (R->Input_Context != NULL) 1303 if (R->Input_Context != NULL)
1298 XSetICFocus(R->Input_Context); 1304 XSetICFocus(R->Input_Context);
1299#endif 1305#endif
1300#ifdef CURSOR_BLINK 1306#ifdef CURSOR_BLINK
1301 if (R->Options & Opt_cursorBlink) 1307 if (R->Options & Opt_cursorBlink)
1302 R->blink_ev.start (NOW + BLINK_INTERVAL); 1308 R->cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1303#endif 1309#endif
1304 } 1310 }
1305 break; 1311 break;
1306 1312
1307 case FocusOut: 1313 case FocusOut:
1312 if (R->Input_Context != NULL) 1318 if (R->Input_Context != NULL)
1313 XUnsetICFocus(R->Input_Context); 1319 XUnsetICFocus(R->Input_Context);
1314#endif 1320#endif
1315#ifdef CURSOR_BLINK 1321#ifdef CURSOR_BLINK
1316 if (R->Options & Opt_cursorBlink) 1322 if (R->Options & Opt_cursorBlink)
1317 R->blink_ev.stop (); 1323 R->cursor_blink_ev.stop ();
1318 R->hidden_cursor = 0; 1324 R->hidden_cursor = 0;
1319#endif 1325#endif
1320 } 1326 }
1321 break; 1327 break;
1322 1328
1363 rxvt_selection_send(aR_ &(ev->xselectionrequest)); 1369 rxvt_selection_send(aR_ &(ev->xselectionrequest));
1364 break; 1370 break;
1365 1371
1366 case UnmapNotify: 1372 case UnmapNotify:
1367 R->TermWin.mapped = 0; 1373 R->TermWin.mapped = 0;
1374#ifdef TEXT_BLINK
1375 R->text_blink_ev.stop ();
1376#endif
1368 break; 1377 break;
1369 1378
1370 case MapNotify: 1379 case MapNotify:
1371 R->TermWin.mapped = 1; 1380 R->TermWin.mapped = 1;
1381#ifdef TEXT_BLINK
1382 R->text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
1383#endif
1372 break; 1384 break;
1373 1385
1374 case PropertyNotify: 1386 case PropertyNotify:
1375 if (ev->xproperty.atom == R->xa[XA_VT_SELECTION]) { 1387 if (ev->xproperty.atom == R->xa[XA_VT_SELECTION]) {
1376 if (ev->xproperty.state == PropertyNewValue) 1388 if (ev->xproperty.state == PropertyNewValue)
1530 1542
1531/* INTPROTO */ 1543/* INTPROTO */
1532void 1544void
1533rxvt_button_press(pR_ XButtonEvent *ev) 1545rxvt_button_press(pR_ XButtonEvent *ev)
1534{ 1546{
1535 int reportmode = 0, clickintime; 1547 int reportmode = 0, clickintime;
1536 1548
1537 R->bypass_keystate = ev->state & (R->ModMetaMask | ShiftMask); 1549 R->bypass_keystate = ev->state & (R->ModMetaMask | ShiftMask);
1538 if (!R->bypass_keystate) 1550 if (!R->bypass_keystate)
1539 reportmode = !!(R->PrivateModes & PrivMode_mouse_report); 1551 reportmode = !!(R->PrivateModes & PrivMode_mouse_report);
1540/* 1552/*
1588 R->MEvent.clicks = 0; 1600 R->MEvent.clicks = 0;
1589 switch (ev->button) 1601 switch (ev->button)
1590 { 1602 {
1591 case Button1: 1603 case Button1:
1592 /* allow shift+left click to extend selection */ 1604 /* allow shift+left click to extend selection */
1593 if (ev->state & ShiftMask) 1605 if (ev->state & ShiftMask && !(R->PrivateModes & PrivMode_mouse_report))
1594 { 1606 {
1595 if (R->MEvent.button == Button1 && clickintime) 1607 if (R->MEvent.button == Button1 && clickintime)
1596 R->selection_rotate (ev->x, ev->y); 1608 R->selection_rotate (ev->x, ev->y);
1597 else 1609 else
1598 R->selection_extend (ev->x, ev->y, 1); 1610 R->selection_extend (ev->x, ev->y, 1);
2696 break; 2708 break;
2697#endif 2709#endif
2698 2710
2699 case CSI_78: /* DECREQTPARM */ 2711 case CSI_78: /* DECREQTPARM */
2700 if (arg[0] == 0 || arg[0] == 1) 2712 if (arg[0] == 0 || arg[0] == 1)
2701 R->tt_printf("\033[%d;1;1;112;112;1;0x", arg[0] + 2); 2713 R->tt_printf("\033[%d;1;1;128;128;1;0x", arg[0] + 2);
2702 /* FALLTHROUGH */ 2714 /* FALLTHROUGH */
2703 2715
2704 default: 2716 default:
2705 break; 2717 break;
2706 } 2718 }
3073#endif 3085#endif
3074 { 1000, PrivMode_MouseX11 }, 3086 { 1000, PrivMode_MouseX11 },
3075 { 1010, PrivMode_TtyOutputInh }, 3087 { 1010, PrivMode_TtyOutputInh },
3076 { 1011, PrivMode_Keypress }, 3088 { 1011, PrivMode_Keypress },
3077 { 1047, PrivMode_Screen }, 3089 { 1047, PrivMode_Screen },
3090 { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */
3078 }; 3091 };
3079 3092
3080 if (nargs == 0) 3093 if (nargs == 0)
3081 return; 3094 return;
3082 3095
3189 R->Options |= Opt_scrollTtyKeypress; 3202 R->Options |= Opt_scrollTtyKeypress;
3190 else 3203 else
3191 R->Options &= ~Opt_scrollTtyKeypress; 3204 R->Options &= ~Opt_scrollTtyKeypress;
3192 break; 3205 break;
3193 case 1047: /* secondary screen w/ clearing */ 3206 case 1047: /* secondary screen w/ clearing */
3207 case 1049: /* better secondary screen w/ clearing, but not fully implemented */
3194 if (R->current_screen != PRIMARY) 3208 if (R->current_screen != PRIMARY)
3195 R->scr_erase_screen (2); 3209 R->scr_erase_screen (2);
3196 rxvt_scr_change_screen(aR_ state); 3210 rxvt_scr_change_screen(aR_ state);
3197 /* FALLTHROUGH */ 3211 /* FALLTHROUGH */
3198 default: 3212 default:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines