… | |
… | |
449 | return false; |
449 | return false; |
450 | |
450 | |
451 | screen = DefaultScreen (dpy); |
451 | screen = DefaultScreen (dpy); |
452 | root = DefaultRootWindow (dpy); |
452 | root = DefaultRootWindow (dpy); |
453 | |
453 | |
454 | assert (ARRAY_LENGTH(xa_names) == NUM_XA); |
454 | assert (ecb_array_length (xa_names) == NUM_XA); |
455 | XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); |
455 | XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); |
456 | |
456 | |
457 | XrmSetDatabase (dpy, get_resources (false)); |
457 | XrmSetDatabase (dpy, get_resources (false)); |
458 | |
458 | |
459 | #ifdef POINTER_BLANK |
459 | #ifdef POINTER_BLANK |
… | |
… | |
703 | c.color.red = color.r; |
703 | c.color.red = color.r; |
704 | c.color.green = color.g; |
704 | c.color.green = color.g; |
705 | c.color.blue = color.b; |
705 | c.color.blue = color.b; |
706 | c.color.alpha = alpha; |
706 | c.color.alpha = alpha; |
707 | |
707 | |
|
|
708 | // Xft wants premultiplied alpha, but abuses the alpha channel |
|
|
709 | // as blend factor, and doesn't allow us to set the alpha channel |
|
|
710 | c.color.red = c.color.red * alpha / 0xffff; |
|
|
711 | c.color.green = c.color.green * alpha / 0xffff; |
|
|
712 | c.color.blue = c.color.blue * alpha / 0xffff; |
|
|
713 | |
708 | c.pixel = insert_component (color.r, format->direct.redMask , format->direct.red ) |
714 | c.pixel = insert_component (c.color.red , format->direct.redMask , format->direct.red ) |
709 | | insert_component (color.g, format->direct.greenMask, format->direct.green) |
715 | | insert_component (c.color.green, format->direct.greenMask, format->direct.green) |
710 | | insert_component (color.b, format->direct.blueMask , format->direct.blue ) |
716 | | insert_component (c.color.blue , format->direct.blueMask , format->direct.blue ) |
711 | | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); |
717 | | insert_component (alpha , format->direct.alphaMask, format->direct.alpha); |
712 | |
718 | |
713 | return true; |
719 | return true; |
714 | } |
720 | } |
715 | else |
721 | else |
716 | { |
722 | { |
… | |
… | |
728 | c.green = color.g; |
734 | c.green = color.g; |
729 | c.blue = color.b; |
735 | c.blue = color.b; |
730 | |
736 | |
731 | if (screen->visual->c_class == TrueColor) |
737 | if (screen->visual->c_class == TrueColor) |
732 | { |
738 | { |
733 | c.pixel = (color.r >> (16 - rxvt_popcount (screen->visual->red_mask )) << rxvt_ctz (screen->visual->red_mask )) |
739 | c.pixel = (color.r >> (16 - ecb_popcount32 (screen->visual->red_mask )) << ecb_ctz32 (screen->visual->red_mask )) |
734 | | (color.g >> (16 - rxvt_popcount (screen->visual->green_mask)) << rxvt_ctz (screen->visual->green_mask)) |
740 | | (color.g >> (16 - ecb_popcount32 (screen->visual->green_mask)) << ecb_ctz32 (screen->visual->green_mask)) |
735 | | (color.b >> (16 - rxvt_popcount (screen->visual->blue_mask )) << rxvt_ctz (screen->visual->blue_mask )); |
741 | | (color.b >> (16 - ecb_popcount32 (screen->visual->blue_mask )) << ecb_ctz32 (screen->visual->blue_mask )); |
736 | |
742 | |
737 | return true; |
743 | return true; |
738 | } |
744 | } |
739 | else if (XAllocColor (screen->dpy, screen->cmap, &c)) |
745 | else if (XAllocColor (screen->dpy, screen->cmap, &c)) |
740 | return true; |
746 | return true; |
… | |
… | |
926 | void |
932 | void |
927 | rxvt_selection::run () |
933 | rxvt_selection::run () |
928 | { |
934 | { |
929 | int selnum = selection_type; |
935 | int selnum = selection_type; |
930 | |
936 | |
|
|
937 | #if ENABLE_FRILLS |
|
|
938 | if (selnum == Sel_Primary && display->selection_owner) |
|
|
939 | { |
|
|
940 | /* internal selection */ |
|
|
941 | char *str = rxvt_wcstombs (display->selection_owner->selection.text, display->selection_owner->selection.len); |
|
|
942 | finish (str, strlen (str)); |
|
|
943 | free (str); |
|
|
944 | return; |
|
|
945 | } |
|
|
946 | #endif |
|
|
947 | |
931 | #if X_HAVE_UTF8_STRING |
948 | #if X_HAVE_UTF8_STRING |
932 | selection_type = Sel_UTF8String; |
949 | selection_type = Sel_UTF8String; |
933 | if (request (display->xa[XA_UTF8_STRING], selnum)) |
950 | if (request (display->xa[XA_UTF8_STRING], selnum)) |
934 | return; |
951 | return; |
935 | #else |
952 | #else |
… | |
… | |
1160 | handle_selection (xev.xproperty.window, xev.xproperty.atom, true); |
1177 | handle_selection (xev.xproperty.window, xev.xproperty.atom, true); |
1161 | break; |
1178 | break; |
1162 | |
1179 | |
1163 | case SelectionNotify: |
1180 | case SelectionNotify: |
1164 | if (selection_wait == Sel_normal |
1181 | if (selection_wait == Sel_normal |
1165 | && xev.xselection.time == request_time |
1182 | && xev.xselection.time == request_time) |
1166 | && xev.xselection.property == request_prop) |
|
|
1167 | { |
1183 | { |
1168 | timer_ev.stop (); |
1184 | timer_ev.stop (); |
1169 | handle_selection (xev.xselection.requestor, xev.xselection.property, true); |
1185 | handle_selection (xev.xselection.requestor, xev.xselection.property, true); |
1170 | } |
1186 | } |
1171 | break; |
1187 | break; |