Skip to content

Commit e259374

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 6736c31 + 36edf06 commit e259374

21 files changed

Lines changed: 639 additions & 226 deletions

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,7 @@ test_arglist \
20782078
test_cscope \
20792079
test_cursor_func \
20802080
test_delete \
2081+
test_digraph \
20812082
test_ex_undo \
20822083
test_execute_func \
20832084
test_expand \

src/gui.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,15 @@ typedef struct Gui
388388
GtkWidget *menubar_h; /* menubar handle */
389389
GtkWidget *toolbar_h; /* toolbar handle */
390390
# endif
391+
# ifdef USE_GTK3
392+
GdkRGBA *fgcolor; /* GDK-styled foreground color */
393+
GdkRGBA *bgcolor; /* GDK-styled background color */
394+
GdkRGBA *spcolor; /* GDK-styled special color */
395+
# else
391396
GdkColor *fgcolor; /* GDK-styled foreground color */
392397
GdkColor *bgcolor; /* GDK-styled background color */
393398
GdkColor *spcolor; /* GDK-styled special color */
399+
# endif
394400
# ifdef USE_GTK3
395401
cairo_surface_t *surface; /* drawarea surface */
396402
gboolean by_signal; /* cause of draw operation */

src/gui_beval.c

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)