… | |
… | |
501 | |
501 | |
502 | #ifdef POINTER_BLANK |
502 | #ifdef POINTER_BLANK |
503 | XFreeCursor (dpy, blank_cursor); |
503 | XFreeCursor (dpy, blank_cursor); |
504 | #endif |
504 | #endif |
505 | x_ev.stop (); |
505 | x_ev.stop (); |
|
|
506 | flush_ev.stop (); |
506 | #ifdef USE_XIM |
507 | #ifdef USE_XIM |
507 | xims.clear (); |
508 | xims.clear (); |
508 | #endif |
509 | #endif |
509 | XCloseDisplay (dpy); |
510 | XCloseDisplay (dpy); |
510 | } |
511 | } |
… | |
… | |
598 | } |
599 | } |
599 | |
600 | |
600 | void rxvt_display::set_selection_owner (rxvt_term *owner) |
601 | void rxvt_display::set_selection_owner (rxvt_term *owner) |
601 | { |
602 | { |
602 | if (selection_owner && selection_owner != owner) |
603 | if (selection_owner && selection_owner != owner) |
|
|
604 | { |
|
|
605 | rxvt_term *owner = selection_owner; |
|
|
606 | |
603 | selection_owner->selection_clear (); |
607 | owner->selection_clear (); |
|
|
608 | owner->flush (); |
|
|
609 | } |
604 | |
610 | |
605 | selection_owner = owner; |
611 | selection_owner = owner; |
606 | } |
612 | } |
607 | |
613 | |
608 | #ifdef USE_XIM |
614 | #ifdef USE_XIM |
… | |
… | |
667 | } |
673 | } |
668 | |
674 | |
669 | bool |
675 | bool |
670 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
676 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
671 | { |
677 | { |
|
|
678 | //TODO: only supports 24 bit |
|
|
679 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
|
|
680 | |
672 | #if XFT |
681 | #if XFT |
673 | XRenderPictFormat *format; |
682 | XRenderPictFormat *format; |
674 | |
683 | |
675 | // FUCKING Xft gets it wrong, of course, so work around it. |
684 | // FUCKING Xft gets it wrong, of course, so work around it. |
676 | // Transparency users should eat shit and die, and then |
685 | // Transparency users should eat shit and die, and then |
… | |
… | |
680 | { |
689 | { |
681 | // the fun lies in doing everything manually... |
690 | // the fun lies in doing everything manually... |
682 | c.color.red = color.r; |
691 | c.color.red = color.r; |
683 | c.color.green = color.g; |
692 | c.color.green = color.g; |
684 | c.color.blue = color.b; |
693 | c.color.blue = color.b; |
685 | c.color.alpha = color.a; |
694 | c.color.alpha = alpha; |
686 | |
695 | |
687 | c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) |
696 | c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) |
688 | | insert_component (color.g, format->direct.greenMask, format->direct.green) |
697 | | insert_component (color.g, format->direct.greenMask, format->direct.green) |
689 | | insert_component (color.b, format->direct.blueMask , format->direct.blue ) |
698 | | insert_component (color.b, format->direct.blueMask , format->direct.blue ) |
690 | | insert_component (color.a, format->direct.alphaMask, format->direct.alpha); |
699 | | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); |
691 | |
700 | |
692 | return true; |
701 | return true; |
693 | } |
702 | } |
694 | else |
703 | else |
695 | { |
704 | { |
696 | XRenderColor d; |
705 | XRenderColor d; |
697 | |
706 | |
698 | d.red = color.r; |
707 | d.red = color.r; |
699 | d.green = color.g; |
708 | d.green = color.g; |
700 | d.blue = color.b; |
709 | d.blue = color.b; |
701 | d.alpha = color.a; |
710 | d.alpha = alpha; |
702 | |
711 | |
703 | return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); |
712 | return XftColorAllocValue (screen->dpy, screen->visual, screen->cmap, &d, &c); |
704 | } |
713 | } |
705 | #else |
714 | #else |
706 | c.red = color.r; |
715 | c.red = color.r; |
… | |
… | |
731 | { |
740 | { |
732 | rgba c; |
741 | rgba c; |
733 | char eos; |
742 | char eos; |
734 | int skip; |
743 | int skip; |
735 | |
744 | |
|
|
745 | c.a = rgba::MAX_CC; |
|
|
746 | |
736 | // parse the nonstandard "[alphapercent]" prefix |
747 | // parse the nonstandard "[alphapercent]" prefix |
737 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
748 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
738 | { |
749 | { |
739 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
750 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
740 | name += skip; |
751 | name += skip; |
741 | } |
752 | } |
742 | else |
|
|
743 | c.a = rgba::MAX_CC; |
|
|
744 | |
753 | |
745 | // parse the non-standard "#aarrggbb" format |
|
|
746 | if (name[0] == '#' && strlen (name) == 1+2+2+2+2 && 4 == sscanf (name+1, "%2hx%2hx%2hx%2hx%c", &c.a, &c.r, &c.g, &c.b, &eos)) |
|
|
747 | { |
|
|
748 | if (c.r) |
|
|
749 | c.r = (c.r << 8) | 0x0ff; |
|
|
750 | if (c.g) |
|
|
751 | c.g = (c.g << 8) | 0x0ff; |
|
|
752 | if (c.b) |
|
|
753 | c.b = (c.b << 8) | 0x0ff; |
|
|
754 | if (c.a) |
|
|
755 | c.a = (c.a << 8) | 0x0ff; |
|
|
756 | } |
|
|
757 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
754 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
758 | else if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) |
755 | if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) |
759 | { |
756 | { |
760 | XColor xc; |
757 | XColor xc; |
761 | |
758 | |
762 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
759 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
763 | { |
760 | { |