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.510 by sf-exg, Fri May 25 08:27:47 2012 UTC vs.
Revision 1.515 by root, Tue Jun 5 11:00:40 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)
2215 } 2229 }
2216} 2230}
2217 2231
2218/*}}} */ 2232/*}}} */
2219 2233
2220void 2234void ecb_hot
2221rxvt_term::cmd_parse () 2235rxvt_term::cmd_parse ()
2222{ 2236{
2223 wchar_t ch = NOCHAR; 2237 wchar_t ch = NOCHAR;
2224 char *seq_begin; // remember start of esc-sequence here 2238 char *seq_begin; // remember start of esc-sequence here
2225 2239
2344 } 2358 }
2345 } 2359 }
2346} 2360}
2347 2361
2348// read the next character 2362// read the next character
2349wchar_t 2363wchar_t ecb_hot
2350rxvt_term::next_char () NOTHROW 2364rxvt_term::next_char () NOTHROW
2351{ 2365{
2352 while (cmdbuf_ptr < cmdbuf_endp) 2366 while (cmdbuf_ptr < cmdbuf_endp)
2353 { 2367 {
2354 // assume 7-bit to be ascii ALWAYS 2368 // assume 7-bit to be ascii ALWAYS
2378 2392
2379 return NOCHAR; 2393 return NOCHAR;
2380} 2394}
2381 2395
2382// read the next octet 2396// read the next octet
2383uint32_t 2397uint32_t ecb_hot
2384rxvt_term::next_octet () NOTHROW 2398rxvt_term::next_octet () NOTHROW
2385{ 2399{
2386 return cmdbuf_ptr < cmdbuf_endp 2400 return cmdbuf_ptr < cmdbuf_endp
2387 ? (unsigned char)*cmdbuf_ptr++ 2401 ? (unsigned char)*cmdbuf_ptr++
2388 : NOCHAR; 2402 : NOCHAR;
2389} 2403}
2390 2404
2391static class out_of_input out_of_input; 2405static class out_of_input out_of_input;
2392 2406
2393wchar_t 2407wchar_t ecb_hot
2394rxvt_term::cmd_getc () THROW ((class out_of_input)) 2408rxvt_term::cmd_getc () THROW ((class out_of_input))
2395{ 2409{
2396 wchar_t c = next_char (); 2410 wchar_t c = next_char ();
2397 2411
2398 if (c == NOCHAR) 2412 if (c == NOCHAR)
2399 throw out_of_input; 2413 throw out_of_input;
2400 2414
2401 return c; 2415 return c;
2402} 2416}
2403 2417
2404uint32_t 2418uint32_t ecb_hot
2405rxvt_term::cmd_get8 () THROW ((class out_of_input)) 2419rxvt_term::cmd_get8 () THROW ((class out_of_input))
2406{ 2420{
2407 uint32_t c = next_octet (); 2421 uint32_t c = next_octet ();
2408 2422
2409 if (c == NOCHAR) 2423 if (c == NOCHAR)
2413} 2427}
2414 2428
2415/*{{{ print pipe */ 2429/*{{{ print pipe */
2416/*----------------------------------------------------------------------*/ 2430/*----------------------------------------------------------------------*/
2417#ifdef PRINTPIPE 2431#ifdef PRINTPIPE
2418FILE * 2432FILE * ecb_cold
2419rxvt_term::popen_printer () 2433rxvt_term::popen_printer ()
2420{ 2434{
2421 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w"); 2435 FILE *stream = popen (rs[Rs_print_pipe] ? rs[Rs_print_pipe] : PRINTPIPE, "w");
2422 2436
2423 if (stream == NULL) 2437 if (stream == NULL)
2424 rxvt_warn ("can't open printer pipe, not printing.\n"); 2438 rxvt_warn ("can't open printer pipe, not printing.\n");
2425 2439
2426 return stream; 2440 return stream;
2427} 2441}
2428 2442
2429int 2443int ecb_cold
2430rxvt_term::pclose_printer (FILE *stream) 2444rxvt_term::pclose_printer (FILE *stream)
2431{ 2445{
2432 fflush (stream); 2446 fflush (stream);
2433 return pclose (stream); 2447 return pclose (stream);
2434} 2448}
2435 2449
2436/* 2450/*
2437 * simulate attached vt100 printer 2451 * simulate attached vt100 printer
2438 */ 2452 */
2439void 2453void ecb_cold
2440rxvt_term::process_print_pipe () 2454rxvt_term::process_print_pipe ()
2441{ 2455{
2442 FILE *fd = popen_printer (); 2456 FILE *fd = popen_printer ();
2443 2457
2444 if (!fd) 2458 if (!fd)
2499 C1_DCS, C1_PU1, C1_PU2, C1_STS, C1_CCH, C1_MW , C1_SPA, C1_EPA, 2513 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, 2514 C1_SOS, C1_59 , C1_SCI, C1_CSI, CS_ST , C1_OSC, C1_PM , C1_APC,
2501}; 2515};
2502 2516
2503/*{{{ process non-printing single characters */ 2517/*{{{ process non-printing single characters */
2504void 2518void ecb_hot
2505rxvt_term::process_nonprinting (unicode_t ch) 2519rxvt_term::process_nonprinting (unicode_t ch)
2506{ 2520{
2507 switch (ch) 2521 switch (ch)
2508 { 2522 {
2509 case C0_ESC: 2523 case C0_ESC:
2555} 2569}
2556/*}}} */ 2570/*}}} */
2557 2571
2558 2572
2559/*{{{ process VT52 escape sequences */ 2573/*{{{ process VT52 escape sequences */
2560void 2574void ecb_cold
2561rxvt_term::process_escape_vt52 (unicode_t ch) 2575rxvt_term::process_escape_vt52 (unicode_t ch)
2562{ 2576{
2563 int row, col; 2577 int row, col;
2564 2578
2565 switch (ch) 2579 switch (ch)
2615} 2629}
2616/*}}} */ 2630/*}}} */
2617 2631
2618 2632
2619/*{{{ process escape sequences */ 2633/*{{{ process escape sequences */
2620void 2634void ecb_hot
2621rxvt_term::process_escape_seq () 2635rxvt_term::process_escape_seq ()
2622{ 2636{
2623 unicode_t ch = cmd_getc (); 2637 unicode_t ch = cmd_getc ();
2624 2638
2625 if (priv_modes & PrivMode_vt52) 2639 if (priv_modes & PrivMode_vt52)
2777 make_byte (0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */ 2791 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, */ 2792 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, {, |, }, ~, */ 2793 make_byte (0,0,0,0,0,0,0,0), /* x, y, z, {, |, }, ~, */
2780 }; 2794 };
2781 2795
2782void 2796void ecb_hot
2783rxvt_term::process_csi_seq () 2797rxvt_term::process_csi_seq ()
2784{ 2798{
2785 unicode_t ch, priv, i; 2799 unicode_t ch, priv, i;
2786 unsigned int nargs, p; 2800 unsigned int nargs, p;
2787 int n, ndef; 2801 int n, ndef;
3437 process_color_seq (op, Color_tint, str, resp); 3451 process_color_seq (op, Color_tint, str, resp);
3438 { 3452 {
3439 bool changed = false; 3453 bool changed = false;
3440 3454
3441 if (ISSET_PIXCOLOR (Color_tint)) 3455 if (ISSET_PIXCOLOR (Color_tint))
3442 changed = bg_set_tint (pix_colors_focused [Color_tint]); 3456 changed = root_effects.set_tint (pix_colors_focused [Color_tint]);
3443 3457
3444 if (changed) 3458 if (changed)
3445 update_background (); 3459 update_background ();
3446 } 3460 }
3447 3461
3472 { 3486 {
3473 bool changed = false; 3487 bool changed = false;
3474 3488
3475 if (*str != ';') 3489 if (*str != ';')
3476 { 3490 {
3477 if (image_vec.size () > 0 3491 if (image_vec.size () > 0)
3478 && image_vec[0].set_file_geometry (str)) 3492 changed = image_vec[0].set_file_geometry (str);
3479 changed = true;
3480 else 3493 else
3481 { 3494 {
3482 rxvt_image *image = new_image (); 3495 rxvt_image *image = new_image ();
3483 if (!image->set_file_geometry (str)) 3496 if (!image->set_file_geometry (str))
3484 image_vec.pop_back (); 3497 image_vec.pop_back ();
3487 } 3500 }
3488 } 3501 }
3489 else 3502 else
3490 { 3503 {
3491 str++; 3504 str++;
3492 if (image_vec.size () > 0 3505 if (image_vec.size () > 0)
3493 && image_vec[0].set_geometry (str, true)) 3506 changed = image_vec[0].set_geometry (str, true);
3494 changed = true;
3495 } 3507 }
3496 3508
3497 if (changed) 3509 if (changed)
3498 { 3510 {
3499 if (bg_window_position_sensitive ()) 3511 if (bg_window_position_sensitive ())
3598 * 's' = save 3610 * 's' = save
3599 * 'r' = restore 3611 * 'r' = restore
3600 * 't' = toggle 3612 * 't' = toggle
3601 * so no need for fancy checking 3613 * so no need for fancy checking
3602 */ 3614 */
3603int 3615int ecb_cold
3604rxvt_term::privcases (int mode, unsigned long bit) 3616rxvt_term::privcases (int mode, unsigned long bit)
3605{ 3617{
3606 int state; 3618 int state;
3607 3619
3608 if (mode == 's') 3620 if (mode == 's')
3828 } 3840 }
3829} 3841}
3830/*}}} */ 3842/*}}} */
3831 3843
3832/*{{{ process sgr sequences */ 3844/*{{{ process sgr sequences */
3833void 3845void ecb_hot
3834rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg) 3846rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
3835{ 3847{
3836 unsigned int i; 3848 unsigned int i;
3837 short rendset; 3849 short rendset;
3838 int rendstyle; 3850 int rendstyle;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines