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.30 2004/01/29 21:35:58 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 | |
706 | void |
702 | void |
707 | rxvt_term::check_cb (check_watcher &w) |
703 | rxvt_term::check_cb (check_watcher &w) |
708 | { |
704 | { |
… | |
… | |
756 | rxvt_process_x_event (this, &xev); |
752 | rxvt_process_x_event (this, &xev); |
757 | } |
753 | } |
758 | while (XPending (Xdisplay)); |
754 | while (XPending (Xdisplay)); |
759 | } |
755 | } |
760 | |
756 | |
|
|
757 | #ifdef CURSOR_BLINK |
761 | void |
758 | void |
762 | rxvt_term::blink_cb (time_watcher &w) |
759 | rxvt_term::blink_cb (time_watcher &w) |
763 | { |
760 | { |
764 | w.at += BLINK_INTERVAL; |
|
|
765 | hidden_cursor = !hidden_cursor; |
761 | hidden_cursor = !hidden_cursor; |
766 | want_refresh = 1; |
762 | want_refresh = 1; |
|
|
763 | |
|
|
764 | w.start (w.at + BLINK_INTERVAL); |
767 | } |
765 | } |
|
|
766 | #endif |
768 | |
767 | |
769 | void |
768 | void |
770 | rxvt_term::x_cb (io_watcher &w, short revents) |
769 | rxvt_term::x_cb (io_watcher &w, short revents) |
771 | { |
770 | { |
772 | SET_R (this); |
771 | SET_R (this); |
… | |
… | |
1021 | quick_timeout |= R->want_full_refresh; |
1020 | quick_timeout |= R->want_full_refresh; |
1022 | #endif |
1021 | #endif |
1023 | #endif |
1022 | #endif |
1024 | } |
1023 | } |
1025 | |
1024 | |
|
|
1025 | #ifdef POINTER_BLANK |
1026 | void |
1026 | void |
1027 | rxvt_term::pointer_unblank () |
1027 | rxvt_term::pointer_unblank () |
1028 | { |
1028 | { |
1029 | XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); |
1029 | XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); |
1030 | recolour_cursor (); |
1030 | recolour_cursor (); |
1031 | |
1031 | |
1032 | #ifdef POINTER_BLANK |
|
|
1033 | hidden_pointer = 0; |
1032 | hidden_pointer = 0; |
1034 | |
1033 | |
1035 | if (Options & Opt_pointerBlank) |
1034 | if (Options & Opt_pointerBlank) |
1036 | pointer_ev.start (NOW + pointerBlankDelay); |
1035 | pointer_ev.start (NOW + pointerBlankDelay); |
1037 | #endif |
|
|
1038 | } |
1036 | } |
1039 | |
1037 | |
1040 | #ifdef POINTER_BLANK |
|
|
1041 | void |
1038 | void |
1042 | rxvt_term::pointer_blank () |
1039 | rxvt_term::pointer_blank () |
1043 | { |
1040 | { |
1044 | pointer_ev.stop (); |
|
|
1045 | |
|
|
1046 | if (!(Options & Opt_pointerBlank)) |
1041 | if (!(Options & Opt_pointerBlank)) |
1047 | return; |
1042 | return; |
1048 | |
1043 | |
1049 | XDefineCursor (Xdisplay, TermWin.vt, blank_cursor); |
1044 | XDefineCursor (Xdisplay, TermWin.vt, blank_cursor); |
1050 | XFlush (Xdisplay); |
1045 | XFlush (Xdisplay); |
… | |
… | |
1530 | |
1525 | |
1531 | /* INTPROTO */ |
1526 | /* INTPROTO */ |
1532 | void |
1527 | void |
1533 | rxvt_button_press(pR_ XButtonEvent *ev) |
1528 | rxvt_button_press(pR_ XButtonEvent *ev) |
1534 | { |
1529 | { |
1535 | int reportmode = 0, clickintime; |
1530 | int reportmode = 0, clickintime; |
1536 | |
1531 | |
1537 | R->bypass_keystate = ev->state & (R->ModMetaMask | ShiftMask); |
1532 | R->bypass_keystate = ev->state & (R->ModMetaMask | ShiftMask); |
1538 | if (!R->bypass_keystate) |
1533 | if (!R->bypass_keystate) |
1539 | reportmode = !!(R->PrivateModes & PrivMode_mouse_report); |
1534 | reportmode = !!(R->PrivateModes & PrivMode_mouse_report); |
1540 | /* |
1535 | /* |
… | |
… | |
1588 | R->MEvent.clicks = 0; |
1583 | R->MEvent.clicks = 0; |
1589 | switch (ev->button) |
1584 | switch (ev->button) |
1590 | { |
1585 | { |
1591 | case Button1: |
1586 | case Button1: |
1592 | /* allow shift+left click to extend selection */ |
1587 | /* allow shift+left click to extend selection */ |
1593 | if (ev->state & ShiftMask) |
1588 | if (ev->state & ShiftMask && !(R->PrivateModes & PrivMode_mouse_report)) |
1594 | { |
1589 | { |
1595 | if (R->MEvent.button == Button1 && clickintime) |
1590 | if (R->MEvent.button == Button1 && clickintime) |
1596 | R->selection_rotate (ev->x, ev->y); |
1591 | R->selection_rotate (ev->x, ev->y); |
1597 | else |
1592 | else |
1598 | R->selection_extend (ev->x, ev->y, 1); |
1593 | R->selection_extend (ev->x, ev->y, 1); |
… | |
… | |
2696 | break; |
2691 | break; |
2697 | #endif |
2692 | #endif |
2698 | |
2693 | |
2699 | case CSI_78: /* DECREQTPARM */ |
2694 | case CSI_78: /* DECREQTPARM */ |
2700 | if (arg[0] == 0 || arg[0] == 1) |
2695 | if (arg[0] == 0 || arg[0] == 1) |
2701 | R->tt_printf("\033[%d;1;1;112;112;1;0x", arg[0] + 2); |
2696 | R->tt_printf("\033[%d;1;1;128;128;1;0x", arg[0] + 2); |
2702 | /* FALLTHROUGH */ |
2697 | /* FALLTHROUGH */ |
2703 | |
2698 | |
2704 | default: |
2699 | default: |
2705 | break; |
2700 | break; |
2706 | } |
2701 | } |