@@ -1044,38 +1044,23 @@ set_printable_label_text(GtkLabel *label, char_u *text)
10441044 attrentry_T * aep ;
10451045 PangoAttribute * attr ;
10461046 guicolor_T pixel ;
1047+ #if GTK_CHECK_VERSION (3 ,0 ,0 )
1048+ GdkRGBA color = { 0.0 , 0.0 , 0.0 , 1.0 };
1049+ PangoAttribute * attr_alpha ;
1050+ #else
10471051 GdkColor color = { 0 , 0 , 0 , 0 };
1052+ #endif
10481053
10491054 /* Look up the RGB values of the SpecialKey foreground color. */
10501055 aep = syn_gui_attr2entry (hl_attr (HLF_8 ));
10511056 pixel = (aep != NULL ) ? aep -> ae_u .gui .fg_color : INVALCOLOR ;
10521057 if (pixel != INVALCOLOR )
10531058# if GTK_CHECK_VERSION (3 ,0 ,0 )
10541059 {
1055- GdkVisual * const visual = gtk_widget_get_visual (gui .drawarea );
1056-
1057- if (visual == NULL )
1058- {
1059- color .red = 0 ;
1060- color .green = 0 ;
1061- color .blue = 0 ;
1062- }
1063- else
1064- {
1065- guint32 r_mask , g_mask , b_mask ;
1066- gint r_shift , g_shift , b_shift ;
1067-
1068- gdk_visual_get_red_pixel_details (visual , & r_mask , & r_shift ,
1069- NULL );
1070- gdk_visual_get_green_pixel_details (visual , & g_mask , & g_shift ,
1071- NULL );
1072- gdk_visual_get_blue_pixel_details (visual , & b_mask , & b_shift ,
1073- NULL );
1074-
1075- color .red = ((pixel & r_mask ) >> r_shift ) / 255.0 * 65535 ;
1076- color .green = ((pixel & g_mask ) >> g_shift ) / 255.0 * 65535 ;
1077- color .blue = ((pixel & b_mask ) >> b_shift ) / 255.0 * 65535 ;
1078- }
1060+ color .red = ((pixel & 0xff0000 ) >> 16 ) / 255.0 ;
1061+ color .green = ((pixel & 0xff00 ) >> 8 ) / 255.0 ;
1062+ color .blue = (pixel & 0xff ) / 255.0 ;
1063+ color .alpha = 1.0 ;
10791064 }
10801065# else
10811066 gdk_colormap_query_color (gtk_widget_get_colormap (gui .drawarea ),
@@ -1124,11 +1109,27 @@ set_printable_label_text(GtkLabel *label, char_u *text)
11241109 }
11251110 if (pixel != INVALCOLOR )
11261111 {
1112+ #if GTK_CHECK_VERSION (3 ,0 ,0 )
1113+ # define DOUBLE2UINT16 (val ) ((guint16)((val) * 65535 + 0.5))
1114+ attr = pango_attr_foreground_new (
1115+ DOUBLE2UINT16 (color .red ),
1116+ DOUBLE2UINT16 (color .green ),
1117+ DOUBLE2UINT16 (color .blue ));
1118+ attr_alpha = pango_attr_foreground_alpha_new (
1119+ DOUBLE2UINT16 (color .alpha ));
1120+ # undef DOUBLE2UINT16
1121+ #else
11271122 attr = pango_attr_foreground_new (
11281123 color .red , color .green , color .blue );
1124+ #endif
11291125 attr -> start_index = pdest - buf ;
11301126 attr -> end_index = pdest - buf + outlen ;
11311127 pango_attr_list_insert (attr_list , attr );
1128+ #if GTK_CHECK_VERSION (3 ,0 ,0 )
1129+ attr_alpha -> start_index = pdest - buf ;
1130+ attr_alpha -> end_index = pdest - buf + outlen ;
1131+ pango_attr_list_insert (attr_list , attr_alpha );
1132+ #endif
11321133 }
11331134 pdest += outlen ;
11341135 p += charlen ;
0 commit comments