… | |
… | |
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 |
1101 | static struct event_handler |
1100 | static 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 is a useful thing to do. It surely is is |
|
|
1109 | // allowed by the sus... as is returning ENOSYS. |
|
|
1110 | |
|
|
1111 | struct timespec ts = { 0, 0 }; |
|
|
1112 | nanosleep (&ts, 0); |
|
|
1113 | |
1108 | w.stop (); |
1114 | w.stop (); |
1109 | } |
1115 | } |
1110 | |
1116 | |
1111 | event_handler () |
1117 | event_handler () |
1112 | : cw_yield (this, &event_handler::yield) |
1118 | : yield_ev (this, &event_handler::yield_cb) |
1113 | { |
1119 | { |
1114 | } |
1120 | } |
1115 | } event_handler; |
1121 | } event_handler; |
1116 | #endif |
1122 | #endif |
1117 | |
1123 | |
… | |
… | |
1137 | cmdbuf_endp += r; |
1143 | cmdbuf_endp += r; |
1138 | return true; |
1144 | return true; |
1139 | } |
1145 | } |
1140 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1146 | else if (r < 0 && (errno == EAGAIN || errno == EINTR)) |
1141 | { |
1147 | { |
1142 | #if HAVE_SCHED_YIELD |
1148 | #if LINUX_YIELD_HACK |
1143 | if (display->is_local) |
1149 | if (display->is_local) |
1144 | event_handler.cw_yield.start (); |
1150 | event_handler.yield_ev.start (); |
1145 | #endif |
1151 | #endif |
1146 | } |
1152 | } |
1147 | else |
1153 | else |
1148 | { |
1154 | { |
1149 | pty_ev.stop (); |
1155 | pty_ev.stop (); |
… | |
… | |
2462 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2468 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
2463 | &nitems, &bytes_after, &prop) == Success); |
2469 | &nitems, &bytes_after, &prop) == Success); |
2464 | |
2470 | |
2465 | if (!i || prop == NULL |
2471 | if (!i || prop == NULL |
2466 | #if TINTING |
2472 | #if TINTING |
2467 | || !rs[Rs_color + Color_tint] |
2473 | || !ISSET_PIXCOLOR (Color_tint) |
2468 | #endif |
2474 | #endif |
2469 | ) |
2475 | ) |
2470 | have_pixmap = 0; |
2476 | have_pixmap = 0; |
2471 | else |
2477 | else |
2472 | { |
2478 | { |
… | |
… | |
2540 | #if TINTING |
2546 | #if TINTING |
2541 | if (ISSET_PIXCOLOR (Color_tint)) |
2547 | if (ISSET_PIXCOLOR (Color_tint)) |
2542 | { |
2548 | { |
2543 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2549 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
2544 | |
2550 | |
2545 | rxvt_rgba c; |
2551 | rgba c; |
2546 | pix_colors_focused [Color_tint].get (this, c); |
2552 | pix_colors_focused [Color_tint].get (c); |
2547 | |
2553 | |
2548 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2554 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
2549 | } |
2555 | } |
2550 | #endif |
2556 | #endif |
2551 | |
2557 | |
… | |
… | |
2574 | * InheritPixmap transparency |
2580 | * InheritPixmap transparency |
2575 | */ |
2581 | */ |
2576 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2582 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
2577 | { |
2583 | { |
2578 | oldp = parent[i]; |
2584 | oldp = parent[i]; |
2579 | XQueryTree (xdisp, parent[i - 1], &root, |
2585 | XQueryTree (xdisp, parent[i - 1], &root, &parent[i], &list, &n); |
2580 | &parent[i], &list, &n); |
|
|
2581 | XFree (list); |
2586 | XFree (list); |
2582 | |
2587 | |
2583 | if (parent[i] == display->root) |
2588 | if (parent[i] == display->root) |
2584 | { |
2589 | { |
2585 | if (oldp != None) |
2590 | if (oldp != None) |
… | |
… | |
2593 | } |
2598 | } |
2594 | |
2599 | |
2595 | n = 0; |
2600 | n = 0; |
2596 | |
2601 | |
2597 | if (pchanged) |
2602 | if (pchanged) |
2598 | { |
|
|
2599 | for (; n < (unsigned int)i; n++) |
2603 | for (; n < (unsigned int)i; n++) |
2600 | { |
2604 | { |
2601 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
2605 | XGetWindowAttributes (xdisp, parent[n], &wattr); |
|
|
2606 | |
2602 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2607 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
2603 | { |
2608 | { |
2604 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2609 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
2605 | break; |
2610 | break; |
2606 | } |
2611 | } |
2607 | } |
2612 | } |
2608 | } |
|
|
2609 | |
2613 | |
2610 | if (n > (int) (sizeof (parent) / sizeof (parent[0]))) |
2614 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
2611 | { |
2615 | { |
2612 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2616 | XSetWindowBackground (xdisp, parent[0], pix_colors_focused[Color_border]); |
2613 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2617 | XSetWindowBackground (xdisp, vt, pix_colors_focused[Color_bg]); |
2614 | am_transparent = 0; |
2618 | am_transparent = 0; |
2615 | /* XXX: also turn off Opt_transparent? */ |
2619 | /* XXX: also turn off Opt_transparent? */ |
… | |
… | |
3574 | if (args[0] >= 24) /* set height (chars) */ |
3578 | if (args[0] >= 24) /* set height (chars) */ |
3575 | set_widthheight ((unsigned int)width, |
3579 | set_widthheight ((unsigned int)width, |
3576 | (unsigned int) (args[1] * fheight)); |
3580 | (unsigned int) (args[1] * fheight)); |
3577 | break; |
3581 | break; |
3578 | |
3582 | |
3579 | |
|
|
3580 | /* |
3583 | /* |
3581 | * reports - some output format copied from XTerm |
3584 | * reports - some output format copied from XTerm |
3582 | */ |
3585 | */ |
3583 | case 11: /* report window state */ |
3586 | case 11: /* report window state */ |
3584 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
3587 | XGetWindowAttributes (xdisp, parent[0], &wattr); |
… | |
… | |
3721 | void |
3724 | void |
3722 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3725 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3723 | { |
3726 | { |
3724 | if (str[0] == '?' && !str[1]) |
3727 | if (str[0] == '?' && !str[1]) |
3725 | { |
3728 | { |
3726 | rxvt_rgba c; |
3729 | rgba c; |
3727 | pix_colors_focused[color].get (this, c); |
3730 | pix_colors_focused[color].get (c); |
3728 | |
3731 | |
3729 | #if XFT |
3732 | #if XFT |
3730 | if (c.a != rxvt_rgba::MAX_CC) |
3733 | 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); |
3734 | tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); |
3732 | else |
3735 | else |
3733 | #endif |
3736 | #endif |
3734 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); |
3737 | tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); |
3735 | } |
3738 | } |
… | |
… | |
3853 | break; |
3856 | break; |
3854 | #endif |
3857 | #endif |
3855 | #if TRANSPARENT && TINTING |
3858 | #if TRANSPARENT && TINTING |
3856 | case URxvt_Color_tint: |
3859 | case URxvt_Color_tint: |
3857 | process_color_seq (op, Color_tint, str, resp); |
3860 | process_color_seq (op, Color_tint, str, resp); |
|
|
3861 | |
3858 | check_our_parents (); |
3862 | check_our_parents (); |
|
|
3863 | |
3859 | if (am_transparent) |
3864 | if (am_transparent) |
3860 | want_full_refresh = want_refresh = 1; |
3865 | want_full_refresh = want_refresh = 1; |
|
|
3866 | |
3861 | break; |
3867 | break; |
3862 | #endif |
3868 | #endif |
3863 | |
3869 | |
3864 | case Rxvt_Pixmap: |
3870 | case Rxvt_Pixmap: |
3865 | { |
3871 | { |