… | |
… | |
686 | |
686 | |
687 | bool |
687 | bool |
688 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
688 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
689 | { |
689 | { |
690 | //TODO: only supports 24 bit |
690 | //TODO: only supports 24 bit |
691 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
691 | unsigned int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
692 | |
692 | |
693 | #if XFT |
693 | #if XFT |
694 | XRenderPictFormat *format; |
694 | XRenderPictFormat *format; |
695 | |
695 | |
696 | // FUCKING Xft gets it wrong, of course, so work around it. |
696 | // FUCKING Xft gets it wrong, of course, so work around it. |
… | |
… | |
725 | d.red = color.r; |
725 | d.red = color.r; |
726 | d.green = color.g; |
726 | d.green = color.g; |
727 | d.blue = color.b; |
727 | d.blue = color.b; |
728 | d.alpha = alpha; |
728 | d.alpha = alpha; |
729 | |
729 | |
730 | return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); |
730 | if (XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c)) |
|
|
731 | return true; |
731 | } |
732 | } |
732 | #else |
733 | #else |
733 | c.red = color.r; |
734 | c.red = color.r; |
734 | c.green = color.g; |
735 | c.green = color.g; |
735 | c.blue = color.b; |
736 | c.blue = color.b; |
… | |
… | |
742 | |
743 | |
743 | return true; |
744 | return true; |
744 | } |
745 | } |
745 | else if (XAllocColor (screen->dpy, screen->cmap, &c)) |
746 | else if (XAllocColor (screen->dpy, screen->cmap, &c)) |
746 | return true; |
747 | return true; |
747 | else |
748 | #endif |
|
|
749 | |
748 | c.pixel = (color.r + color.g + color.b) > 128*3 |
750 | c.pixel = (color.r + color.g + color.b) > 128*3 |
749 | ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->dpy)) |
751 | ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->dpy)) |
750 | : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->dpy)); |
752 | : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->dpy)); |
751 | #endif |
|
|
752 | |
753 | |
753 | return false; |
754 | return false; |
754 | } |
755 | } |
755 | |
756 | |
756 | bool |
757 | bool |
… | |
… | |
911 | |
912 | |
912 | incr_buf = 0; |
913 | incr_buf = 0; |
913 | incr_buf_size = incr_buf_fill = 0; |
914 | incr_buf_size = incr_buf_fill = 0; |
914 | selection_wait = Sel_normal; |
915 | selection_wait = Sel_normal; |
915 | selection_type = selnum; |
916 | selection_type = selnum; |
|
|
917 | cb_sv = 0; |
916 | } |
918 | } |
917 | |
919 | |
918 | void |
920 | void |
919 | rxvt_selection::stop () |
921 | rxvt_selection::stop () |
920 | { |
922 | { |
… | |
… | |
960 | } |
962 | } |
961 | |
963 | |
962 | void |
964 | void |
963 | rxvt_selection::finish (char *data, unsigned int len) |
965 | rxvt_selection::finish (char *data, unsigned int len) |
964 | { |
966 | { |
965 | if (term) |
967 | if (!cb_sv) |
966 | { |
968 | { |
967 | if (data) |
969 | if (data) |
968 | term->paste (data, len); |
970 | term->paste (data, len); |
969 | |
971 | |
970 | term->selection_req = 0; |
972 | term->selection_req = 0; |