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.511 by sf-exg, Fri May 25 18:45:40 2012 UTC vs.
Revision 1.516 by root, Tue Jun 5 14:46:54 2012 UTC

131 XK_KP_Space, 0x2422, 131 XK_KP_Space, 0x2422,
132#endif 132#endif
133 0, 133 0,
134}; 134};
135 135
136void 136void ecb_cold
137rxvt_term::iso14755_54 (int x, int y) 137rxvt_term::iso14755_54 (int x, int y)
138{ 138{
139 x = Pixel2Col (x); 139 x = Pixel2Col (x);
140 y = Pixel2Row (y); 140 y = Pixel2Row (y);
141 141
158 158
159 x--; 159 x--;
160 } 160 }
161} 161}
162 162
163void 163void ecb_cold
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) 164rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
165{ 165{
166 rxvt_fontset *fs = FONTSET (r); 166 rxvt_fontset *fs = FONTSET (r);
167 wchar_t *chr, *alloc, ch2, **fname; 167 wchar_t *chr, *alloc, ch2, **fname;
168 int len; 168 int len;
254 delete [] alloc; 254 delete [] alloc;
255# endif 255# endif
256} 256}
257#endif 257#endif
258 258
259void 259void ecb_cold
260rxvt_term::commit_iso14755 () 260rxvt_term::commit_iso14755 ()
261{ 261{
262 wchar_t ch = iso14755buf & ISO_14755_MASK; 262 wchar_t ch = iso14755buf & ISO_14755_MASK;
263 263
264 if (iso14755buf & ISO_14755_51) 264 if (iso14755buf & ISO_14755_51)
282 } 282 }
283 283
284 iso14755buf = 0; 284 iso14755buf = 0;
285} 285}
286 286
287static int 287static int ecb_cold
288hex_keyval (XKeyEvent &ev) 288hex_keyval (XKeyEvent &ev)
289{ 289{
290 // check whether this event corresponds to a hex digit 290 // check whether this event corresponds to a hex digit
291 // if the modifiers had not been pressed. 291 // if the modifiers had not been pressed.
292 for (int index = 0; index < 8; index++) 292 for (int index = 0; index < 8; index++)
301 301
302 return -1; 302 return -1;
303} 303}
304#endif 304#endif
305 305
306static inline KeySym 306static inline KeySym ecb_cold
307translate_keypad (KeySym keysym, bool kp) 307translate_keypad (KeySym keysym, bool kp)
308{ 308{
309#ifdef XK_KP_Home 309#ifdef XK_KP_Home
310 static const KeySym keypadtrans[] = { 310 static const KeySym keypadtrans[] = {
311 XK_KP_7, // XK_KP_Home 311 XK_KP_7, // XK_KP_Home
337# endif 337# endif
338#endif 338#endif
339 return keysym; 339 return keysym;
340} 340}
341 341
342static inline int 342static inline int ecb_cold
343map_function_key (KeySym keysym) 343map_function_key (KeySym keysym)
344{ 344{
345 int param = 0; 345 int param = 0;
346 346
347 if (IN_RANGE_INC (keysym, XK_F1, XK_F35)) 347 if (IN_RANGE_INC (keysym, XK_F1, XK_F35))
396 break; 396 break;
397 } 397 }
398 return param; 398 return param;
399} 399}
400 400
401void 401void ecb_cold
402rxvt_term::key_press (XKeyEvent &ev) 402rxvt_term::key_press (XKeyEvent &ev)
403{ 403{
404 int ctrl, meta, shft, len; 404 int ctrl, meta, shft, len;
405 KeySym keysym; 405 KeySym keysym;
406 int valid_keysym; 406 int valid_keysym;
421 ctrl = ev.state & ControlMask; 421 ctrl = ev.state & ControlMask;
422 meta = ev.state & ModMetaMask; 422 meta = ev.state & ModMetaMask;
423 423
424 kbuf[0] = 0; 424 kbuf[0] = 0;
425 425
426#ifdef USE_XIM 426#if USE_XIM
427 if (Input_Context) 427 if (Input_Context)
428 { 428 {
429 Status status_return; 429 Status status_return;
430 430
431#if 0 431#if 0
855 } 855 }
856 856
857 tt_write (kbuf, (unsigned int)len); 857 tt_write (kbuf, (unsigned int)len);
858} 858}
859 859
860void 860void ecb_cold
861rxvt_term::key_release (XKeyEvent &ev) 861rxvt_term::key_release (XKeyEvent &ev)
862{ 862{
863#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL 863#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755 || ENABLE_PERL
864 KeySym keysym; 864 KeySym keysym;
865 865
987 while (row < end_row); 987 while (row < end_row);
988 } 988 }
989 989
990 scr_refresh (); 990 scr_refresh ();
991 scrollBar.show (1); 991 scrollBar.show (1);
992#ifdef USE_XIM 992#if USE_XIM
993 im_send_spot (); 993 im_send_spot ();
994#endif 994#endif
995 } 995 }
996 996
997 display->flush (); 997 display->flush ();
1219 pty_write (); 1219 pty_write ();
1220 1220
1221 refresh_check (); 1221 refresh_check ();
1222} 1222}
1223 1223
1224void 1224void ecb_cold
1225rxvt_term::pointer_unblank () 1225rxvt_term::pointer_unblank ()
1226{ 1226{
1227 XDefineCursor (dpy, vt, TermWin_cursor); 1227 XDefineCursor (dpy, vt, TermWin_cursor);
1228 recolour_cursor (); 1228 recolour_cursor ();
1229 1229
1234 pointer_ev.start (pointerBlankDelay); 1234 pointer_ev.start (pointerBlankDelay);
1235#endif 1235#endif
1236} 1236}
1237 1237
1238#ifdef POINTER_BLANK 1238#ifdef POINTER_BLANK
1239void 1239void ecb_cold
1240rxvt_term::pointer_blank () 1240rxvt_term::pointer_blank ()
1241{ 1241{
1242 if (!option (Opt_pointerBlank)) 1242 if (!option (Opt_pointerBlank))
1243 return; 1243 return;
1244 1244
1246 XFlush (dpy); 1246 XFlush (dpy);
1247 1247
1248 hidden_pointer = 1; 1248 hidden_pointer = 1;
1249} 1249}
1250 1250
1251void 1251void ecb_cold
1252rxvt_term::pointer_cb (ev::timer &w, int revents) 1252rxvt_term::pointer_cb (ev::timer &w, int revents)
1253{ 1253{
1254 make_current (); 1254 make_current ();
1255 1255
1256 pointer_blank (); 1256 pointer_blank ();
1348 32 + x, 1348 32 + x,
1349 32 + y); 1349 32 + y);
1350} 1350}
1351 1351
1352/*{{{ process an X event */ 1352/*{{{ process an X event */
1353void 1353void ecb_hot
1354rxvt_term::x_cb (XEvent &ev) 1354rxvt_term::x_cb (XEvent &ev)
1355{ 1355{
1356 make_current (); 1356 make_current ();
1357 1357
1358 dLocal (Display *, dpy); 1358 dLocal (Display *, dpy);
1461 if (ev.xconfigure.window == parent) 1461 if (ev.xconfigure.window == parent)
1462 { 1462 {
1463 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev)) 1463 while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1464 ; 1464 ;
1465 1465
1466 bool want_position_change = SHOULD_INVOKE (HOOK_POSITION_CHANGE);
1467
1466#ifdef HAVE_BG_PIXMAP 1468#ifdef HAVE_BG_PIXMAP
1469 if (bg_window_position_sensitive ())
1470 want_position_change = true;
1471#endif
1472
1467 bool moved = false; 1473 bool moved = false;
1468 if (bg_window_position_sensitive ()) 1474
1475 if (want_position_change)
1469 { 1476 {
1470 int x, y; 1477 int x, y;
1478
1471 if (ev.xconfigure.send_event) 1479 if (ev.xconfigure.send_event)
1472 { 1480 {
1473 x = ev.xconfigure.x; 1481 x = ev.xconfigure.x;
1474 y = ev.xconfigure.y; 1482 y = ev.xconfigure.y;
1475 } 1483 }
1476 else 1484 else
1477 get_window_origin (x, y); 1485 get_window_origin (x, y);
1478 1486
1487 if (x != parent_x || y != parent_y)
1488 {
1489 HOOK_INVOKE ((this, HOOK_POSITION_CHANGE, DT_INT, x, DT_INT, y, DT_END));
1490 parent_x = x;
1491 parent_y = y;
1492 }
1493
1479 if (bg_set_position (x, y) 1494 if (bg_set_position (x, y)
1480 || !(bg_flags & BG_IS_VALID)) 1495 || !(bg_flags & BG_IS_VALID))
1481 moved = true; 1496 moved = true;
1482 } 1497 }
1483#endif
1484 1498
1485 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) 1499 if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
1486 { 1500 {
1487 seen_resize = 1; 1501 seen_resize = 1;
1488 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1502 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1713 1727
1714 refresh_check (); 1728 refresh_check ();
1715} 1729}
1716 1730
1717#if ENABLE_FRILLS 1731#if ENABLE_FRILLS
1718void 1732void ecb_cold
1719rxvt_term::set_urgency (bool enable) 1733rxvt_term::set_urgency (bool enable)
1720{ 1734{
1721 if (enable == urgency_hint) 1735 if (enable == urgency_hint)
1722 return; 1736 return;
1723 1737
1729 XFree (h); 1743 XFree (h);
1730 } 1744 }
1731} 1745}
1732#endif 1746#endif
1733 1747
1734void 1748void ecb_cold
1735rxvt_term::focus_in () 1749rxvt_term::focus_in ()
1736{ 1750{
1737 if (!focus) 1751 if (!focus)
1738 { 1752 {
1739 focus = 1; 1753 focus = 1;
1764 1778
1765 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); 1779 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END));
1766 } 1780 }
1767} 1781}
1768 1782
1769void 1783void ecb_cold
1770rxvt_term::focus_out () 1784rxvt_term::focus_out ()
1771{ 1785{
1772 if (focus) 1786 if (focus)
1773 { 1787 {
1774 focus = 0; 1788 focus = 0;
1807 1821
1808 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END)); 1822 HOOK_INVOKE ((this, HOOK_FOCUS_OUT, DT_END));
1809 } 1823 }
1810} 1824}
1811 1825
1812void 1826void ecb_cold
1813rxvt_term::update_fade_color (unsigned int idx) 1827rxvt_term::update_fade_color (unsigned int idx)
1814{ 1828{
1815#if OFF_FOCUS_FADING 1829#if OFF_FOCUS_FADING
1816 if (rs[Rs_fade]) 1830 if (rs[Rs_fade])
1817 { 1831 {
1821 } 1835 }
1822#endif 1836#endif
1823} 1837}
1824 1838
1825#if ENABLE_TRANSPARENCY || ENABLE_PERL 1839#if ENABLE_TRANSPARENCY || ENABLE_PERL
1826void 1840void ecb_hot
1827rxvt_term::rootwin_cb (XEvent &ev) 1841rxvt_term::rootwin_cb (XEvent &ev)
1828{ 1842{
1829 make_current (); 1843 make_current ();
1830 1844
1831 if (SHOULD_INVOKE (HOOK_ROOT_EVENT) 1845 if (SHOULD_INVOKE (HOOK_ROOT_EVENT)
1832 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END))) 1846 && HOOK_INVOKE ((this, HOOK_ROOT_EVENT, DT_XEVENT, &ev, DT_END)))
1833 return; 1847 return;
1834 1848
1835# if ENABLE_TRANSPARENCY
1836 switch (ev.type) 1849 switch (ev.type)
1837 { 1850 {
1838 case PropertyNotify: 1851 case PropertyNotify:
1839 /* 1852 /*
1840 * if user used some Esetroot compatible prog to set the root bg, 1853 * if user used some Esetroot compatible prog to set the root bg,
1841 * use the property to determine the pixmap. We use it later on. 1854 * use the property to determine the pixmap. We use it later on.
1842 */ 1855 */
1843 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] 1856 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1844 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) 1857 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1845 { 1858 {
1859# if ENABLE_TRANSPARENCY
1846 bg_set_root_pixmap (); 1860 bg_set_root_pixmap ();
1847 update_background (); 1861 update_background ();
1862#endif
1863#if ENABLE_PERL
1864 HOOK_INVOKE ((this, HOOK_ROOTPMAP_CHANGE, DT_END));
1865#endif
1848 } 1866 }
1849 1867
1850 break; 1868 break;
1851 } 1869 }
1852# endif
1853 1870
1854 refresh_check (); 1871 refresh_check ();
1855} 1872}
1856#endif 1873#endif
1857 1874
2215 } 2232 }
2216} 2233}
2217 2234
2218/*}}} */ 2235/*}}} */
2219 2236
2220void 2237void ecb_hot
2221rxvt_term::cmd_parse () 2238rxvt_term::cmd_parse ()
2222{ 2239{
2223 wchar_t ch = NOCHAR; 2240 wchar_t ch = NOCHAR;
2224 char *seq_begin; // remember start of esc-sequence here 2241 char *seq_begin; // remember start of esc-sequence here
2225 2242
2344 } 2361 }
2345 } 2362 }
2346} 2363}
2347 2364
2348// read the next character 2365// read the next character
2349wchar_t 2366wchar_t ecb_hot
2350rxvt_term::next_char () NOTHROW 2367rxvt_term::next_char () NOTHROW
2351{ 2368{
2352 while (cmdbuf_ptr < cmdbuf_endp) 2369 while (cmdbuf_ptr < cmdbuf_endp)
2353 { 2370 {
2354 // assume 7-bit to be ascii ALWAYS 2371 // assume 7-bit to be ascii ALWAYS
2378 2395
2379 return NOCHAR; 2396 return NOCHAR;
2380} 2397}
2381 2398
2382// read the next octet 2399// read the next octet
2383uint32_t 2400uint32_t ecb_hot
2384rxvt_term::next_octet () NOTHROW 2401rxvt_term::next_octet () NOTHROW
2385{ 2402{
2386 return cmdbuf_ptr < cmdbuf_endp 2403 return cmdbuf_ptr < cmdbuf_endp
2387 ? (unsigned char)*cmdbuf_ptr++ 2404 ? (unsigned char)*cmdbuf_ptr++
2388 : NOCHAR; 2405 : NOCHAR;
2389} 2406}
2390 2407
2391static class out_of_input out_of_input; 2408static class out_of_input out_of_input;
2392 2409
2393wchar_t 2410wchar_t ecb_hot
2394rxvt_term::cmd_getc () THROW ((class out_of_input)) 2411rxvt_term::cmd_getc () THROW ((class out_of_input))
2395{ 2412{
2396 wchar_t c = next_char (); 2413 wchar_t c = next_char ();
2397 2414
2398 if (c == NOCHAR) 2415 if (c == NOCHAR)
2399 throw out_of_input; 2416 throw out_of_input;
2400 2417
2401 return c; 2418 return c;
2402} 2419}
2403 2420
2404uint32_t 2421uint32_t ecb_hot
2405rxvt_term::cmd_get8 () THROW ((class out_of_input)) 2422rxvt_term::cmd_get8 () THROW ((class out_of_input))
2406{ 2423{
2407 uint32_t c = next_octet (); 2424 uint32_t c = next_octet ();
2408 2425
2409 if (c == NOCHAR) 2426 if (c == NOCHAR)
2413} 2430}
2414 2431
2415/*{{{ print pipe */ 2432/*{{{ print pipe */
2416/*----------------------------------------------------------------------*/ 2433/*----------------------------------------------------------------------*/
2417#ifdef PRINTPIPE 2434#ifdef PRINTPIPE
2418FILE * 2435FILE * ecb_cold
2419rxvt_term::popen_printer () 2436rxvt_term::popen_printer ()
2420{ 2437{
2421 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); 2438 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w");
2422 2439
2423 if (stream == NULL) 2440 if (stream == NULL)
2424 rxvt_warn ("can't open printer pipe, not printing.\n"); 2441 rxvt_warn ("can't open printer pipe, not printing.\n");
2425 2442
2426 return stream; 2443 return stream;
2427} 2444}
2428 2445
2429int 2446int ecb_cold
2430rxvt_term::pclose_printer (FILE *stream) 2447rxvt_term::pclose_printer (FILE *stream)
2431{ 2448{
2432 fflush (stream); 2449 fflush (stream);
2433 return pclose (stream); 2450 return pclose (stream);
2434} 2451}
2435 2452
2436/* 2453/*
2437 * simulate attached vt100 printer 2454 * simulate attached vt100 printer
2438 */ 2455 */
2439void 2456void ecb_cold
2440rxvt_term::process_print_pipe () 2457rxvt_term::process_print_pipe ()
2441{ 2458{
2442 FILE *fd = popen_printer (); 2459 FILE *fd = popen_printer ();
2443 2460
2444 if (!fd) 2461 if (!fd)
2499 C1_DCS, C1_PU1, C1_PU2, C1_STS, C1_CCH, C1_MW , C1_SPA, C1_EPA, 2516 C1_DCS, C1_PU1, C1_PU2, C1_STS, C1_CCH, C1_MW , C1_SPA, C1_EPA,
2500 C1_SOS, C1_59 , C1_SCI, C1_CSI, CS_ST , C1_OSC, C1_PM , C1_APC, 2517 C1_SOS, C1_59 , C1_SCI, C1_CSI, CS_ST , C1_OSC, C1_PM , C1_APC,
2501}; 2518};
2502 2519
2503/*{{{ process non-printing single characters */ 2520/*{{{ process non-printing single characters */
2504void 2521void ecb_hot
2505rxvt_term::process_nonprinting (unicode_t ch) 2522rxvt_term::process_nonprinting (unicode_t ch)
2506{ 2523{
2507 switch (ch) 2524 switch (ch)
2508 { 2525 {
2509 case C0_ESC: 2526 case C0_ESC:
2555} 2572}
2556/*}}} */ 2573/*}}} */
2557 2574
2558 2575
2559/*{{{ process VT52 escape sequences */ 2576/*{{{ process VT52 escape sequences */
2560void 2577void ecb_cold
2561rxvt_term::process_escape_vt52 (unicode_t ch) 2578rxvt_term::process_escape_vt52 (unicode_t ch)
2562{ 2579{
2563 int row, col; 2580 int row, col;
2564 2581
2565 switch (ch) 2582 switch (ch)
2615} 2632}
2616/*}}} */ 2633/*}}} */
2617 2634
2618 2635
2619/*{{{ process escape sequences */ 2636/*{{{ process escape sequences */
2620void 2637void ecb_hot
2621rxvt_term::process_escape_seq () 2638rxvt_term::process_escape_seq ()
2622{ 2639{
2623 unicode_t ch = cmd_getc (); 2640 unicode_t ch = cmd_getc ();
2624 2641
2625 if (priv_modes & PrivMode_vt52) 2642 if (priv_modes & PrivMode_vt52)
2777 make_byte (0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */ 2794 make_byte (0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */
2778 make_byte (0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */ 2795 make_byte (0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */
2779 make_byte (0,0,0,0,0,0,0,0), /* x, y, z, {, |, }, ~, */ 2796 make_byte (0,0,0,0,0,0,0,0), /* x, y, z, {, |, }, ~, */
2780 }; 2797 };
2781 2798
2782void 2799void ecb_hot
2783rxvt_term::process_csi_seq () 2800rxvt_term::process_csi_seq ()
2784{ 2801{
2785 unicode_t ch, priv, i; 2802 unicode_t ch, priv, i;
2786 unsigned int nargs, p; 2803 unsigned int nargs, p;
2787 int n, ndef; 2804 int n, ndef;
3437 process_color_seq (op, Color_tint, str, resp); 3454 process_color_seq (op, Color_tint, str, resp);
3438 { 3455 {
3439 bool changed = false; 3456 bool changed = false;
3440 3457
3441 if (ISSET_PIXCOLOR (Color_tint)) 3458 if (ISSET_PIXCOLOR (Color_tint))
3442 changed = bg_set_tint (pix_colors_focused [Color_tint]); 3459 changed = root_effects.set_tint (pix_colors_focused [Color_tint]);
3443 3460
3444 if (changed) 3461 if (changed)
3445 update_background (); 3462 update_background ();
3446 } 3463 }
3447 3464
3596 * 's' = save 3613 * 's' = save
3597 * 'r' = restore 3614 * 'r' = restore
3598 * 't' = toggle 3615 * 't' = toggle
3599 * so no need for fancy checking 3616 * so no need for fancy checking
3600 */ 3617 */
3601int 3618int ecb_cold
3602rxvt_term::privcases (int mode, unsigned long bit) 3619rxvt_term::privcases (int mode, unsigned long bit)
3603{ 3620{
3604 int state; 3621 int state;
3605 3622
3606 if (mode == 's') 3623 if (mode == 's')
3826 } 3843 }
3827} 3844}
3828/*}}} */ 3845/*}}} */
3829 3846
3830/*{{{ process sgr sequences */ 3847/*{{{ process sgr sequences */
3831void 3848void ecb_hot
3832rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) 3849rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
3833{ 3850{
3834 unsigned int i; 3851 unsigned int i;
3835 short rendset; 3852 short rendset;
3836 int rendstyle; 3853 int rendstyle;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines