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.270 by root, Wed Jan 18 10:31:37 2006 UTC vs.
Revision 1.278 by root, Fri Jan 20 18:50:49 2006 UTC

64 64
65/*----------------------------------------------------------------------*/ 65/*----------------------------------------------------------------------*/
66 66
67#define IS_CONTROL(ch) !((ch) & 0xffffff60UL) 67#define IS_CONTROL(ch) !((ch) & 0xffffff60UL)
68 68
69// exception thrown when the command parser runs out of input data
70class out_of_input { } out_of_input;
71
72#if ENABLE_FRILLS || ISO_14755 69#if ENABLE_FRILLS || ISO_14755
73 70
74#define ISO_14755_STARTED 0x80000000UL 71#define ISO_14755_STARTED 0x80000000UL
75#define ISO_14755_51 0x40000000UL // basic (section 5.1) 72#define ISO_14755_51 0x40000000UL // basic (section 5.1)
76#define ISO_14755_52 0x20000000UL // keycap (section 5.2) 73#define ISO_14755_52 0x20000000UL // keycap (section 5.2)
464 { 461 {
465 switch (keysym) 462 switch (keysym)
466 { 463 {
467 /* normal XTerm key bindings */ 464 /* normal XTerm key bindings */
468 case XK_Insert: /* Shift+Insert = paste mouse selection */ 465 case XK_Insert: /* Shift+Insert = paste mouse selection */
469 selection_request (ev.time, 0, 0); 466 selection_request (ev.time);
470 return; 467 return;
471#if TODO 468#if TODO
472 /* rxvt extras */ 469 /* rxvt extras */
473 case XK_KP_Add: /* Shift+KP_Add = bigger font */ 470 case XK_KP_Add: /* Shift+KP_Add = bigger font */
474 change_font (FONT_UP); 471 change_font (FONT_UP);
1044rxvt_term::cursor_blink_cb (time_watcher &w) 1041rxvt_term::cursor_blink_cb (time_watcher &w)
1045{ 1042{
1046 hidden_cursor = !hidden_cursor; 1043 hidden_cursor = !hidden_cursor;
1047 want_refresh = 1; 1044 want_refresh = 1;
1048 1045
1049 w.start (w.at + BLINK_INTERVAL); 1046 w.start (w.at + CURSOR_BLINK_INTERVAL);
1050} 1047}
1051#endif 1048#endif
1052 1049
1053#ifdef TEXT_BLINK 1050#ifdef TEXT_BLINK
1054void 1051void
1405 button_release (ev.xbutton); 1402 button_release (ev.xbutton);
1406 break; 1403 break;
1407 1404
1408 case ClientMessage: 1405 case ClientMessage:
1409 if (ev.xclient.format == 32 1406 if (ev.xclient.format == 32
1410 && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) 1407 && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END)))
1411 { 1408 {
1409 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1410 {
1411 if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END)))
1412 {
1412 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1413 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1414 {
1415 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END)))
1413 destroy (); 1416 destroy ();
1417 }
1414#if ENABLE_EWMH 1418#if ENABLE_EWMH
1415 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) 1419 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1416 XSendEvent (disp, ev.xclient.window = display->root, 1420 XSendEvent (disp, ev.xclient.window = display->root,
1417 False, SubstructureRedirectMask | SubstructureNotifyMask, 1421 False, SubstructureRedirectMask | SubstructureNotifyMask,
1418 &ev); 1422 &ev);
1423#endif
1424 }
1425 }
1426#if ENABLE_XEMBED
1427 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1428 {
1429 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1430 focus_in ();
1431 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1432 focus_out ();
1433 }
1419#endif 1434#endif
1420 } 1435 }
1421#if ENABLE_XEMBED
1422 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1423 {
1424 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1425 focus_in ();
1426 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1427 focus_out ();
1428 }
1429#endif
1430#ifdef OFFIX_DND
1431 /* OffiX Dnd (drag 'n' drop) protocol */
1432 else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL]
1433 && (ev.xclient.data.l[0] == DndFile
1434 || ev.xclient.data.l[0] == DndDir
1435 || ev.xclient.data.l[0] == DndLink))
1436 {
1437 /* Get Dnd data */
1438 Atom ActualType;
1439 int ActualFormat;
1440 unsigned char *data;
1441 unsigned long Size, RemainingBytes;
1442
1443 XGetWindowProperty (disp, display->root,
1444 xa[XA_DNDSELECTION],
1445 0L, 1000000L,
1446 False, AnyPropertyType,
1447 &ActualType, &ActualFormat,
1448 &Size, &RemainingBytes,
1449 &data);
1450 set_string_property (XA_CUT_BUFFER0, data);
1451 XFree (data);
1452 selection_paste (display->root, XA_CUT_BUFFER0, true);
1453 XSetInputFocus (disp, display->root, RevertToNone, CurrentTime);
1454 }
1455#endif /* OFFIX_DND */
1456 break; 1436 break;
1457 1437
1458 case MappingNotify: 1438 case MappingNotify:
1459 XRefreshKeyboardMapping (&ev.xmapping); 1439 XRefreshKeyboardMapping (&ev.xmapping);
1460 break; 1440 break;
1512#endif 1492#endif
1513 } 1493 }
1514 break; 1494 break;
1515 1495
1516 case PropertyNotify: 1496 case PropertyNotify:
1497 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1517 if (ev.xproperty.atom == xa[XA_VT_SELECTION] 1498 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1518 && ev.xproperty.state == PropertyNewValue) 1499 && ev.xproperty.state == PropertyNewValue)
1519 selection_property (ev.xproperty.window, ev.xproperty.atom); 1500 selection_property (ev.xproperty.window, ev.xproperty.atom);
1520 1501
1521 break; 1502 break;
1522 1503
1523 case SelectionClear: 1504 case SelectionClear:
1524 selection_clear (); 1505 selection_clear ();
1713 { 1694 {
1714 hidden_cursor = 0; 1695 hidden_cursor = 0;
1715 want_refresh = 1; 1696 want_refresh = 1;
1716 } 1697 }
1717 1698
1718 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1699 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL);
1719 } 1700 }
1720#endif 1701#endif
1721 1702
1722#if defined(POINTER_BLANK) 1703#if defined(POINTER_BLANK)
1723 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) 1704 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1751 XSetICFocus (Input_Context); 1732 XSetICFocus (Input_Context);
1752 } 1733 }
1753#endif 1734#endif
1754#if CURSOR_BLINK 1735#if CURSOR_BLINK
1755 if (OPTION (Opt_cursorBlink)) 1736 if (OPTION (Opt_cursorBlink))
1756 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1737 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL);
1757#endif 1738#endif
1758#if OFF_FOCUS_FADING 1739#if OFF_FOCUS_FADING
1759 if (rs[Rs_fade]) 1740 if (rs[Rs_fade])
1760 { 1741 {
1761 pix_colors = pix_colors_focused; 1742 pix_colors = pix_colors_focused;
2155 { 2136 {
2156 case Button1: 2137 case Button1:
2157 case Button3: 2138 case Button3:
2158 selection_make (ev.time); 2139 selection_make (ev.time);
2159 break; 2140 break;
2141
2160 case Button2: 2142 case Button2:
2161 selection_request (ev.time, ev.x, ev.y); 2143 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
2144 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary);
2162 break; 2145 break;
2146
2163#ifdef MOUSE_WHEEL 2147#ifdef MOUSE_WHEEL
2164 case Button4: 2148 case Button4:
2165 case Button5: 2149 case Button5:
2166 { 2150 {
2167 int i; 2151 int i;
2822 return flag; 2806 return flag;
2823} 2807}
2824 2808
2825// read the next character 2809// read the next character
2826wchar_t 2810wchar_t
2827rxvt_term::next_char () 2811rxvt_term::next_char () NOTHROW
2828{ 2812{
2829 while (cmdbuf_ptr < cmdbuf_endp) 2813 while (cmdbuf_ptr < cmdbuf_endp)
2830 { 2814 {
2831 // assume 7-bit to be ascii ALWAYS 2815 // assume 7-bit to be ascii ALWAYS
2832 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2816 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)
2853 return NOCHAR; 2837 return NOCHAR;
2854} 2838}
2855 2839
2856// read the next octet 2840// read the next octet
2857uint32_t 2841uint32_t
2858rxvt_term::next_octet () 2842rxvt_term::next_octet () NOTHROW
2859{ 2843{
2860 return cmdbuf_ptr < cmdbuf_endp 2844 return cmdbuf_ptr < cmdbuf_endp
2861 ? (unsigned char)*cmdbuf_ptr++ 2845 ? (unsigned char)*cmdbuf_ptr++
2862 : NOCHAR; 2846 : NOCHAR;
2863} 2847}
2848
2849static class out_of_input out_of_input;
2864 2850
2865/* rxvt_cmd_getc () - Return next input character */ 2851/* rxvt_cmd_getc () - Return next input character */
2866/* 2852/*
2867 * Return the next input character after first passing any keyboard input 2853 * Return the next input character after first passing any keyboard input
2868 * to the command. 2854 * to the command.
2869 */ 2855 */
2870wchar_t 2856wchar_t
2871rxvt_term::cmd_getc () 2857rxvt_term::cmd_getc () THROW ((class out_of_input))
2872{ 2858{
2873 wchar_t c = next_char (); 2859 wchar_t c = next_char ();
2874 2860
2875 if (c == NOCHAR) 2861 if (c == NOCHAR)
2876 throw out_of_input; 2862 throw out_of_input;
2877 2863
2878 return c; 2864 return c;
2879} 2865}
2880 2866
2881uint32_t 2867uint32_t
2882rxvt_term::cmd_get8 () 2868rxvt_term::cmd_get8 () THROW ((class out_of_input))
2883{ 2869{
2884 uint32_t c = next_octet (); 2870 uint32_t c = next_octet ();
2885 2871
2886 if (c == NOCHAR) 2872 if (c == NOCHAR)
2887 throw out_of_input; 2873 throw out_of_input;
3766 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) 3752 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
3767 */ 3753 */
3768void 3754void
3769rxvt_term::process_xterm_seq (int op, const char *str, char resp) 3755rxvt_term::process_xterm_seq (int op, const char *str, char resp)
3770{ 3756{
3771 int changed = 0;
3772 int color; 3757 int color;
3773 char *buf, *name; 3758 char *buf, *name;
3774 bool query = str[0] == '?' && !str[1]; 3759 bool query = str[0] == '?' && !str[1];
3775 int saveop = op; 3760 int saveop = op;
3776 dDisp; 3761 dDisp;
3892 want_full_refresh = want_refresh = 1; 3877 want_full_refresh = want_refresh = 1;
3893 break; 3878 break;
3894#endif 3879#endif
3895 3880
3896 case Rxvt_Pixmap: 3881 case Rxvt_Pixmap:
3882 {
3897 if (*str != ';') 3883 if (*str != ';')
3898 { 3884 {
3899#if XPM_BACKGROUND 3885#if XPM_BACKGROUND
3900 scale_pixmap (""); /* reset to default scaling */ 3886 scale_pixmap (""); /* reset to default scaling */
3901 set_bgPixmap (str); /* change pixmap */ 3887 set_bgPixmap (str); /* change pixmap */
3902 scr_touch (true); 3888 scr_touch (true);
3903#endif 3889#endif
3904 } 3890 }
3905 3891
3892 int changed = 0;
3893
3906 while ((str = strchr (str, ';')) != NULL) 3894 while ((str = strchr (str, ';')) != NULL)
3907 { 3895 {
3908 str++; 3896 str++;
3909#if XPM_BACKGROUND 3897#if XPM_BACKGROUND
3910 changed += scale_pixmap (str); 3898 changed += scale_pixmap (str);
3911#endif 3899#endif
3912 } 3900 }
3913 3901
3914 if (changed) 3902 if (changed)
3915 { 3903 {
3916#ifdef XPM_BACKGROUND 3904#ifdef XPM_BACKGROUND
3917 resize_pixmap (); 3905 resize_pixmap ();
3918 scr_touch (true); 3906 scr_touch (true);
3919#endif 3907#endif
3920 } 3908 }
3909 }
3921 break; 3910 break;
3922 3911
3923 case Rxvt_restoreFG: 3912 case Rxvt_restoreFG:
3924 set_window_color (Color_fg, str); 3913 set_window_color (Color_fg, str);
3925 break; 3914 break;
4034 return state; 4023 return state;
4035} 4024}
4036 4025
4037/* we're not using priv _yet_ */ 4026/* we're not using priv _yet_ */
4038void 4027void
4039rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) 4028rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg)
4040{ 4029{
4041 unsigned int i, j; 4030 unsigned int i, j;
4042 int state; 4031 int state;
4043 4032
4044 static const struct 4033 static const struct

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines