… | |
… | |
299 | if (!(display = displays.get (rs[Rs_display_name]))) |
299 | if (!(display = displays.get (rs[Rs_display_name]))) |
300 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
300 | rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); |
301 | |
301 | |
302 | xa = display->xa; |
302 | xa = display->xa; |
303 | |
303 | |
304 | #if ENABLE_FRILLS |
304 | #if XFT |
305 | if (rs[Rs_depth]) |
305 | if (rs[Rs_depth]) |
306 | set (display, strtol (rs[Rs_depth], 0, 0)); |
306 | set (display, strtol (rs[Rs_depth], 0, 0)); |
307 | else |
307 | else |
308 | #endif |
308 | #endif |
309 | set (display); |
309 | set (display); |
… | |
… | |
421 | /* this is how xterm implements reverseVideo */ |
421 | /* this is how xterm implements reverseVideo */ |
422 | if (OPTION (Opt_reverseVideo)) |
422 | if (OPTION (Opt_reverseVideo)) |
423 | { |
423 | { |
424 | if (!rs[Rs_color + Color_fg]) |
424 | if (!rs[Rs_color + Color_fg]) |
425 | rs[Rs_color + Color_fg] = def_colorName[Color_bg]; |
425 | rs[Rs_color + Color_fg] = def_colorName[Color_bg]; |
|
|
426 | |
426 | if (!rs[Rs_color + Color_bg]) |
427 | if (!rs[Rs_color + Color_bg]) |
427 | rs[Rs_color + Color_bg] = def_colorName[Color_fg]; |
428 | rs[Rs_color + Color_bg] = def_colorName[Color_fg]; |
428 | } |
429 | } |
429 | #endif |
430 | #endif |
430 | |
431 | |
… | |
… | |
655 | pix_colors = pix_colors_focused; |
656 | pix_colors = pix_colors_focused; |
656 | #endif |
657 | #endif |
657 | |
658 | |
658 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
659 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
659 | { |
660 | { |
|
|
661 | const char *name = rs[Rs_color + i]; |
|
|
662 | |
|
|
663 | if (!name) |
|
|
664 | continue; |
|
|
665 | |
660 | rxvt_color xcol; |
666 | rxvt_color xcol; |
661 | |
667 | |
662 | if (!rs[Rs_color + i]) |
668 | if (!set_color (xcol, name)) |
663 | continue; |
|
|
664 | |
|
|
665 | if (!rXParseAllocColor (&xcol, rs[Rs_color + i])) |
|
|
666 | { |
669 | { |
667 | #ifndef XTERM_REVERSE_VIDEO |
670 | #ifndef XTERM_REVERSE_VIDEO |
668 | if (i < 2 && OPTION (Opt_reverseVideo)) |
671 | if (i < 2 && OPTION (Opt_reverseVideo)) |
669 | rs[Rs_color + i] = def_colorName[!i]; |
672 | name = def_colorName [1 - i]; |
670 | else |
673 | else |
671 | #endif |
674 | #endif |
672 | rs[Rs_color + i] = def_colorName[i]; |
675 | name = def_colorName [i]; |
673 | |
676 | |
674 | if (!rs[Rs_color + i]) |
677 | if (!name) |
675 | continue; |
678 | continue; |
676 | |
679 | |
677 | if (!rXParseAllocColor (&xcol, rs[Rs_color + i])) |
680 | if (!set_color (xcol, name)) |
678 | { |
681 | { |
679 | switch (i) |
682 | switch (i) |
680 | { |
683 | { |
681 | case Color_fg: |
684 | case Color_fg: |
682 | case Color_bg: |
685 | case Color_bg: |
683 | /* fatal: need bg/fg color */ |
|
|
684 | rxvt_fatal ("unable to get foreground/background colour, aborting.\n"); |
686 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
685 | /* NOTREACHED */ |
687 | name = ""; |
686 | break; |
688 | break; |
687 | #ifndef NO_CURSORCOLOR |
689 | #ifndef NO_CURSORCOLOR |
688 | case Color_cursor2: |
690 | case Color_cursor2: |
689 | xcol = pix_colors[Color_fg]; |
691 | #endif |
690 | break; |
|
|
691 | #endif /* ! NO_CURSORCOLOR */ |
|
|
692 | case Color_pointer_fg: |
692 | case Color_pointer_fg: |
|
|
693 | name = rs[Rs_color + Color_fg]; |
693 | xcol = pix_colors[Color_fg]; |
694 | xcol = pix_colors[Color_fg]; |
694 | break; |
695 | break; |
695 | default: |
696 | default: |
|
|
697 | name = rs[Rs_color + Color_bg]; |
696 | xcol = pix_colors[Color_bg]; /* None */ |
698 | xcol = pix_colors[Color_bg]; |
697 | break; |
699 | break; |
698 | } |
700 | } |
699 | } |
701 | } |
700 | } |
702 | } |
701 | |
703 | |
702 | pix_colors[i] = xcol; |
704 | pix_colors[i] = xcol; |
703 | SET_PIXCOLOR (i); |
705 | rs[Rs_color + i] = name; |
704 | } |
706 | } |
705 | |
707 | |
706 | #ifdef OFF_FOCUS_FADING |
708 | #ifdef OFF_FOCUS_FADING |
707 | if (rs[Rs_fade]) |
709 | if (rs[Rs_fade]) |
708 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
710 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
|
|
711 | { |
|
|
712 | rgba c; |
|
|
713 | pix_colors[Color_fade].get (this, c); |
709 | pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
714 | pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c); |
|
|
715 | } |
710 | #endif |
716 | #endif |
711 | |
717 | |
712 | if (depth <= 2) |
718 | if (depth <= 2) |
713 | { |
719 | { |
714 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
720 | if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; |
… | |
… | |
737 | /* xcol[0] == white |
743 | /* xcol[0] == white |
738 | * xcol[1] == top shadow |
744 | * xcol[1] == top shadow |
739 | * xcol[2] == bot shadow */ |
745 | * xcol[2] == bot shadow */ |
740 | |
746 | |
741 | xcol[1] = pix_colors[Color_scroll]; |
747 | xcol[1] = pix_colors[Color_scroll]; |
742 | xcol[0].set (this, rxvt_rgba (rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC, rxvt_rgba::MAX_CC)); |
748 | xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC)); |
743 | |
749 | |
744 | rxvt_rgba c0, c1; |
750 | rgba c0, c1; |
745 | |
751 | |
746 | xcol[0].get (this, c0); |
752 | xcol[0].get (this, c0); |
747 | xcol[1].get (this, c1); |
753 | xcol[1].get (this, c1); |
748 | |
754 | |
749 | pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); |
755 | xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]); |
750 | |
756 | |
751 | /* topShadowColor */ |
757 | /* topShadowColor */ |
752 | if (!xcol[1].set (this, |
758 | if (!xcol[1].set (this, |
753 | rxvt_rgba ( |
759 | rgba ( |
754 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
760 | min (c0.r, max (c1.r / 5, c1.r) * 7 / 5), |
755 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
761 | min (c0.g, max (c1.g / 5, c1.g) * 7 / 5), |
756 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
762 | min (c0.b, max (c1.b / 5, c1.b) * 7 / 5), |
757 | c1.a) // pa1 vs. pa0: arbitrary |
763 | c1.a) // pa1 vs. pa0: arbitrary |
758 | )); |
764 | )); |