From 8493bc3c5d174cbdcdabda0b461bb278fc2c3d6b Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 20 Apr 2016 01:14:46 -0400 Subject: [PATCH] Fixed the GTK+ SetColor() issues. It works! --- unix/GNUfiles.mk | 2 +- unix/draw.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/unix/GNUfiles.mk b/unix/GNUfiles.mk index 49fdd8d0..83f979aa 100644 --- a/unix/GNUfiles.mk +++ b/unix/GNUfiles.mk @@ -40,7 +40,7 @@ CFLAGS += \ CXXFLAGS += \ `pkg-config --cflags gtk+-3.0` LDFLAGS += \ - `pkg-config --libs gtk+-3.0` -lm + `pkg-config --libs gtk+-3.0` -lm -ldl # flags for building a shared library # OS X does support -shared but it has a preferred name for this so let's use that there instead; hence this is not gcc-global diff --git a/unix/draw.c b/unix/draw.c index 7396d33f..c5f6f0d0 100644 --- a/unix/draw.c +++ b/unix/draw.c @@ -689,7 +689,7 @@ static void prepareLayout(uiDrawTextLayout *layout, PangoLayout *pl) width = -1; pango_layout_set_width(pl, width); - pango_layout_set_attribute_list(pl, layout->attrs); + pango_layout_set_attributes(pl, layout->attrs); } void uiDrawTextLayoutExtents(uiDrawTextLayout *layout, double *width, double *height) @@ -745,6 +745,7 @@ static void try138(void) void *handle; tried138 = TRUE; + // dlsym() walks the dependency chain, so opening the current process should be sufficient handle = dlopen(NULL, RTLD_LAZY); if (handle == NULL) return; @@ -769,9 +770,7 @@ void uiDrawTextLayoutSetColor(uiDrawTextLayout *layout, intmax_t startChar, intm try138(); // TODO what if aa == 0? if (newFGAlphaAttr != NULL) { -g_printf("adding alpha\n"); attr = (*newFGAlphaAttr)(aa); addAttr(layout, attr, startChar, endChar); } -else g_printf("ignoring alpha\n"); }