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.293 by root, Mon Jan 30 04:27:17 2006 UTC vs.
Revision 1.303 by root, Tue Jan 31 21:47:56 2006 UTC

49#include "rxvt.h" 49#include "rxvt.h"
50#include "rxvtperl.h" 50#include "rxvtperl.h"
51#include "version.h" 51#include "version.h"
52#include "command.h" 52#include "command.h"
53 53
54#if HAVE_SCHED_YIELD
55#undef HAVE_SCHED_YIELD // disabled for the time being
56//# include <sched.h>
57#endif
58
59#ifdef KEYSYM_RESOURCE 54#ifdef KEYSYM_RESOURCE
60# include "keyboard.h" 55# include "keyboard.h"
61#endif 56#endif
62 57
63#include <csignal> 58#include <csignal>
59
60#if LINUX_YIELD_HACK
61# include <ctime>
62#endif
64 63
65/*----------------------------------------------------------------------*/ 64/*----------------------------------------------------------------------*/
66 65
67#define IS_CONTROL(ch) !((ch) & 0xffffff60UL) 66#define IS_CONTROL(ch) !((ch) & 0xffffff60UL)
68 67
1095 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); 1094 w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY);
1096 } 1095 }
1097} 1096}
1098#endif 1097#endif
1099 1098
1100#if HAVE_SCHED_YIELD 1099#if LINUX_YIELD_HACK
1101static struct event_handler 1100static struct event_handler
1102{ 1101{
1103 check_watcher cw_yield; 1102 check_watcher yield_ev;
1104 1103
1105 void yield (check_watcher &w) 1104 void yield_cb (check_watcher &w)
1106 { 1105 {
1107 sched_yield (); 1106 // this should really be sched_yield(), but the linux guys thought
1107 // that giving a process calling sched_yield () less cpu time than
1108 // ones with high nice levels.
1109
1110 struct timespec ts = { 0, 0 };
1111 nanosleep (&ts, 0);
1112
1108 w.stop (); 1113 w.stop ();
1109 } 1114 }
1110 1115
1111 event_handler () 1116 event_handler ()
1112 : cw_yield (this, &event_handler::yield) 1117 : yield_ev (this, &event_handler::yield_cb)
1113 { 1118 {
1114 } 1119 }
1115} event_handler; 1120} event_handler;
1116#endif 1121#endif
1117 1122
1137 cmdbuf_endp += r; 1142 cmdbuf_endp += r;
1138 return true; 1143 return true;
1139 } 1144 }
1140 else if (r < 0 && (errno == EAGAIN || errno == EINTR)) 1145 else if (r < 0 && (errno == EAGAIN || errno == EINTR))
1141 { 1146 {
1142#if HAVE_SCHED_YIELD 1147#if LINUX_YIELD_HACK
1143 if (display->is_local) 1148 if (display->is_local)
1144 event_handler.cw_yield.start (); 1149 event_handler.yield_ev.start ();
1145#endif 1150#endif
1146 } 1151 }
1147 else 1152 else
1148 { 1153 {
1149 pty_ev.stop (); 1154 pty_ev.stop ();
2462 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2467 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2463 &nitems, &bytes_after, &prop) == Success); 2468 &nitems, &bytes_after, &prop) == Success);
2464 2469
2465 if (!i || prop == NULL 2470 if (!i || prop == NULL
2466#if TINTING 2471#if TINTING
2467 || !rs[Rs_color + Color_tint] 2472 || !ISSET_PIXCOLOR (Color_tint)
2468#endif 2473#endif
2469 ) 2474 )
2470 have_pixmap = 0; 2475 have_pixmap = 0;
2471 else 2476 else
2472 { 2477 {
2538 XFreePixmap (xdisp, pixmap); 2543 XFreePixmap (xdisp, pixmap);
2539 2544
2540#if TINTING 2545#if TINTING
2541 if (ISSET_PIXCOLOR (Color_tint)) 2546 if (ISSET_PIXCOLOR (Color_tint))
2542 { 2547 {
2543 rxvt_rgba c;
2544 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; 2548 int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
2545 2549
2550 rgba c;
2546 pix_colors_focused[Color_tint].get (this, c); 2551 pix_colors_focused [Color_tint].get (c);
2547 2552
2548 ShadeXImage (this, image, shade, c.r, c.g, c.b); 2553 ShadeXImage (this, image, shade, c.r, c.g, c.b);
2549 } 2554 }
2550#endif 2555#endif
2551 2556
2574 * InheritPixmap transparency 2579 * InheritPixmap transparency
2575 */ 2580 */
2576 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) 2581 for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++)
2577 { 2582 {
2578 oldp = parent[i]; 2583 oldp = parent[i];
2579 XQueryTree (xdisp, parent[i - 1], &root, 2584 XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n);
2580 &parent[i], &list, &n);
2581 XFree (list); 2585 XFree (list);
2582 2586
2583 if (parent[i] == display->root) 2587 if (parent[i] == display->root)
2584 { 2588 {
2585 if (oldp != None) 2589 if (oldp != None)
2593 } 2597 }
2594 2598
2595 n = 0; 2599 n = 0;
2596 2600
2597 if (pchanged) 2601 if (pchanged)
2598 {
2599 for (; n < (unsigned int)i; n++) 2602 for (; n < (unsigned int)i; n++)
2600 { 2603 {
2601 XGetWindowAttributes (xdisp, parent[n], &wattr); 2604 XGetWindowAttributes (xdisp, parent[n], &wattr);
2605
2602 if (wattr.depth != rootdepth || wattr.c_class == InputOnly) 2606 if (wattr.depth != rootdepth || wattr.c_class == InputOnly)
2603 { 2607 {
2604 n = (int) (sizeof (parent) / sizeof (Window)) + 1; 2608 n = (int) (sizeof (parent) / sizeof (Window)) + 1;
2605 break; 2609 break;
2606 } 2610 }
2607 } 2611 }
2608 }
2609 2612
2610 if (n > (int) (sizeof (parent) / sizeof (parent[0]))) 2613 if (n > (sizeof (parent) / sizeof (parent[0])))
2611 { 2614 {
2612 XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); 2615 XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]);
2613 XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); 2616 XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]);
2614 am_transparent = 0; 2617 am_transparent = 0;
2615 /* XXX: also turn off Opt_transparent? */ 2618 /* XXX: also turn off Opt_transparent? */
3091 scr_charset_set (2, (unsigned int)cmd_getc ()); 3094 scr_charset_set (2, (unsigned int)cmd_getc ());
3092 break; 3095 break;
3093 case '+': 3096 case '+':
3094 scr_charset_set (3, (unsigned int)cmd_getc ()); 3097 scr_charset_set (3, (unsigned int)cmd_getc ());
3095 break; 3098 break;
3096#if ENABLE_FRILLS 3099#if !ENABLE_MINIMAL
3097 case '6': 3100 case '6':
3098 scr_backindex (); 3101 scr_backindex ();
3099 break; 3102 break;
3100#endif 3103#endif
3101 case '7': 3104 case '7':
3102 scr_cursor (SAVE); 3105 scr_cursor (SAVE);
3103 break; 3106 break;
3104 case '8': 3107 case '8':
3105 scr_cursor (RESTORE); 3108 scr_cursor (RESTORE);
3106 break; 3109 break;
3107#if ENABLE_FRILLS 3110#if !ENABLE_MINIMAL
3108 case '9': 3111 case '9':
3109 scr_forwardindex (); 3112 scr_forwardindex ();
3110 break; 3113 break;
3111#endif 3114#endif
3112 case '=': 3115 case '=':
3505 break; 3508 break;
3506 case CSI_75: 3509 case CSI_75:
3507 scr_cursor (RESTORE); 3510 scr_cursor (RESTORE);
3508 break; 3511 break;
3509 3512
3510#if ENABLE_FRILLS 3513#if !ENABLE_MINIMAL
3511 case CSI_74: 3514 case CSI_74:
3512 process_window_ops (arg, nargs); 3515 process_window_ops (arg, nargs);
3513 break; 3516 break;
3514#endif 3517#endif
3515 3518
3522 break; 3525 break;
3523 } 3526 }
3524} 3527}
3525/*}}} */ 3528/*}}} */
3526 3529
3527#if ENABLE_FRILLS 3530#if !ENABLE_MINIMAL
3528/* ARGSUSED */ 3531/* ARGSUSED */
3529void 3532void
3530rxvt_term::process_window_ops (const int *args, unsigned int nargs) 3533rxvt_term::process_window_ops (const int *args, unsigned int nargs)
3531{ 3534{
3532 int x, y; 3535 int x, y;
3573 default: 3576 default:
3574 if (args[0] >= 24) /* set height (chars) */ 3577 if (args[0] >= 24) /* set height (chars) */
3575 set_widthheight ((unsigned int)width, 3578 set_widthheight ((unsigned int)width,
3576 (unsigned int) (args[1] * fheight)); 3579 (unsigned int) (args[1] * fheight));
3577 break; 3580 break;
3578
3579 3581
3580 /* 3582 /*
3581 * reports - some output format copied from XTerm 3583 * reports - some output format copied from XTerm
3582 */ 3584 */
3583 case 11: /* report window state */ 3585 case 11: /* report window state */
3721void 3723void
3722rxvt_term::process_color_seq (int report, int color, const char *str, char resp) 3724rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
3723{ 3725{
3724 if (str[0] == '?' && !str[1]) 3726 if (str[0] == '?' && !str[1])
3725 { 3727 {
3726 rxvt_rgba c; 3728 rgba c;
3727 pix_colors_focused[color].get (this, c); 3729 pix_colors_focused[color].get (c);
3728 3730
3729#if XFT 3731#if XFT
3730 if (c.a != rxvt_rgba::MAX_CC) 3732 if (c.a != rgba::MAX_CC)
3731 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); 3733 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp);
3732 else 3734 else
3733#endif 3735#endif
3734 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); 3736 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp);
3735 } 3737 }
3853 break; 3855 break;
3854#endif 3856#endif
3855#if TRANSPARENT && TINTING 3857#if TRANSPARENT && TINTING
3856 case URxvt_Color_tint: 3858 case URxvt_Color_tint:
3857 process_color_seq (op, Color_tint, str, resp); 3859 process_color_seq (op, Color_tint, str, resp);
3860
3858 check_our_parents (); 3861 check_our_parents ();
3862
3859 if (am_transparent) 3863 if (am_transparent)
3860 want_full_refresh = want_refresh = 1; 3864 want_full_refresh = want_refresh = 1;
3865
3861 break; 3866 break;
3862#endif 3867#endif
3863 3868
3864 case Rxvt_Pixmap: 3869 case Rxvt_Pixmap:
3865 { 3870 {
3944 op, 3949 op,
3945 rs[Rs_name], VERSION[0], VERSION[2], 3950 rs[Rs_name], VERSION[0], VERSION[2],
3946 resp); 3951 resp);
3947 break; 3952 break;
3948 3953
3949#if ENABLE_FRILLS 3954#if !ENABLE_MINIMAL
3950 case URxvt_locale: 3955 case URxvt_locale:
3951 if (query) 3956 if (query)
3952 tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp); 3957 tt_printf ("\33]%d;%-.250s%c", op, OPTION (Opt_insecure) ? locale : "", resp);
3953 else 3958 else
3954 { 3959 {
4318 scr_color (Color_bg, Color_bg); 4323 scr_color (Color_bg, Color_bg);
4319 break; 4324 break;
4320 4325
4321 //case 50: // not variable spacing 4326 //case 50: // not variable spacing
4322 4327
4323#if ENABLE_FRILLS 4328#if !ENABLE_MINIMAL
4324 case 90: 4329 case 90:
4325 case 91: /* set bright fg color */ 4330 case 91: /* set bright fg color */
4326 case 92: 4331 case 92:
4327 case 93: 4332 case 93:
4328 case 94: 4333 case 94:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines