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.273 by ayin, Thu Jan 19 23:13:19 2006 UTC vs.
Revision 1.276 by root, Fri Jan 20 11:02:46 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, Sel_Primary); 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
1404 case ButtonRelease: 1401 case ButtonRelease:
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])
1411 { 1407 {
1408 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1409 {
1412 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1410 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1411 {
1412 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, ev, DT_END)))
1413 destroy (); 1413 destroy ();
1414 }
1414#if ENABLE_EWMH 1415#if ENABLE_EWMH
1415 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) 1416 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1416 XSendEvent (disp, ev.xclient.window = display->root, 1417 XSendEvent (disp, ev.xclient.window = display->root,
1417 False, SubstructureRedirectMask | SubstructureNotifyMask, 1418 False, SubstructureRedirectMask | SubstructureNotifyMask,
1418 &ev); 1419 &ev);
1420#endif
1421 }
1422#if ENABLE_XEMBED
1423 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1424 {
1425 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1426 focus_in ();
1427 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1428 focus_out ();
1429 }
1419#endif 1430#endif
1420 } 1431 }
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; 1432 break;
1457 1433
1458 case MappingNotify: 1434 case MappingNotify:
1459 XRefreshKeyboardMapping (&ev.xmapping); 1435 XRefreshKeyboardMapping (&ev.xmapping);
1460 break; 1436 break;
1713 { 1689 {
1714 hidden_cursor = 0; 1690 hidden_cursor = 0;
1715 want_refresh = 1; 1691 want_refresh = 1;
1716 } 1692 }
1717 1693
1718 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1694 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL);
1719 } 1695 }
1720#endif 1696#endif
1721 1697
1722#if defined(POINTER_BLANK) 1698#if defined(POINTER_BLANK)
1723 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) 1699 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1751 XSetICFocus (Input_Context); 1727 XSetICFocus (Input_Context);
1752 } 1728 }
1753#endif 1729#endif
1754#if CURSOR_BLINK 1730#if CURSOR_BLINK
1755 if (OPTION (Opt_cursorBlink)) 1731 if (OPTION (Opt_cursorBlink))
1756 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1732 cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL);
1757#endif 1733#endif
1758#if OFF_FOCUS_FADING 1734#if OFF_FOCUS_FADING
1759 if (rs[Rs_fade]) 1735 if (rs[Rs_fade])
1760 { 1736 {
1761 pix_colors = pix_colors_focused; 1737 pix_colors = pix_colors_focused;
2157 case Button3: 2133 case Button3:
2158 selection_make (ev.time); 2134 selection_make (ev.time);
2159 break; 2135 break;
2160 2136
2161 case Button2: 2137 case Button2:
2162 if (IN_RANGE_EXC (ev.x, 0, width) 2138 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
2163 && IN_RANGE_EXC (ev.y, 0, height)) // inside window? 2139 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary);
2164 {
2165 if (ev.state & ShiftMask)
2166 selection_request (ev.time, Sel_Clipboard);
2167 else
2168 selection_request (ev.time, Sel_Primary);
2169 }
2170 break; 2140 break;
2171 2141
2172#ifdef MOUSE_WHEEL 2142#ifdef MOUSE_WHEEL
2173 case Button4: 2143 case Button4:
2174 case Button5: 2144 case Button5:
2831 return flag; 2801 return flag;
2832} 2802}
2833 2803
2834// read the next character 2804// read the next character
2835wchar_t 2805wchar_t
2836rxvt_term::next_char () 2806rxvt_term::next_char () NOTHROW
2837{ 2807{
2838 while (cmdbuf_ptr < cmdbuf_endp) 2808 while (cmdbuf_ptr < cmdbuf_endp)
2839 { 2809 {
2840 // assume 7-bit to be ascii ALWAYS 2810 // assume 7-bit to be ascii ALWAYS
2841 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b) 2811 if ((unsigned char)*cmdbuf_ptr <= 0x7f && *cmdbuf_ptr != 0x1b)
2862 return NOCHAR; 2832 return NOCHAR;
2863} 2833}
2864 2834
2865// read the next octet 2835// read the next octet
2866uint32_t 2836uint32_t
2867rxvt_term::next_octet () 2837rxvt_term::next_octet () NOTHROW
2868{ 2838{
2869 return cmdbuf_ptr < cmdbuf_endp 2839 return cmdbuf_ptr < cmdbuf_endp
2870 ? (unsigned char)*cmdbuf_ptr++ 2840 ? (unsigned char)*cmdbuf_ptr++
2871 : NOCHAR; 2841 : NOCHAR;
2872} 2842}
2843
2844static class out_of_input out_of_input;
2873 2845
2874/* rxvt_cmd_getc () - Return next input character */ 2846/* rxvt_cmd_getc () - Return next input character */
2875/* 2847/*
2876 * Return the next input character after first passing any keyboard input 2848 * Return the next input character after first passing any keyboard input
2877 * to the command. 2849 * to the command.
2878 */ 2850 */
2879wchar_t 2851wchar_t
2880rxvt_term::cmd_getc () 2852rxvt_term::cmd_getc () THROW ((class out_of_input))
2881{ 2853{
2882 wchar_t c = next_char (); 2854 wchar_t c = next_char ();
2883 2855
2884 if (c == NOCHAR) 2856 if (c == NOCHAR)
2885 throw out_of_input; 2857 throw out_of_input;
2886 2858
2887 return c; 2859 return c;
2888} 2860}
2889 2861
2890uint32_t 2862uint32_t
2891rxvt_term::cmd_get8 () 2863rxvt_term::cmd_get8 () THROW ((class out_of_input))
2892{ 2864{
2893 uint32_t c = next_octet (); 2865 uint32_t c = next_octet ();
2894 2866
2895 if (c == NOCHAR) 2867 if (c == NOCHAR)
2896 throw out_of_input; 2868 throw out_of_input;
4046 return state; 4018 return state;
4047} 4019}
4048 4020
4049/* we're not using priv _yet_ */ 4021/* we're not using priv _yet_ */
4050void 4022void
4051rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) 4023rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg)
4052{ 4024{
4053 unsigned int i, j; 4025 unsigned int i, j;
4054 int state; 4026 int state;
4055 4027
4056 static const struct 4028 static const struct

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines